001    /*
002            Copyright (c) 2009 Olivier Chafik, All Rights Reserved
003            
004            This file is part of JNAerator (http://jnaerator.googlecode.com/).
005            
006            JNAerator is free software: you can redistribute it and/or modify
007            it under the terms of the GNU Lesser General Public License as published by
008            the Free Software Foundation, either version 3 of the License, or
009            (at your option) any later version.
010            
011            JNAerator is distributed in the hope that it will be useful,
012            but WITHOUT ANY WARRANTY; without even the implied warranty of
013            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014            GNU Lesser General Public License for more details.
015            
016            You should have received a copy of the GNU Lesser General Public License
017            along with JNAerator.  If not, see <http://www.gnu.org/licenses/>.
018    */
019    package com.ochafik.lang.jnaerator.runtime;
020    
021    import com.sun.jna.Pointer;
022    import com.sun.jna.PointerType;
023    
024    @Deprecated
025    public class StringPointer extends Structure<StringPointer, StringPointer.ByValue, StringPointer.ByReference> {
026            public String value;
027            public String toString() {
028                    return value;
029            }
030            public StringPointer() {}
031            public StringPointer(PointerType p) {
032                    this(p.getPointer(), 0);
033            }
034            public StringPointer(Pointer p) {
035                    this(p, 0);
036            }
037            public StringPointer(Pointer p, int offset) {
038                    useMemory(p, offset);
039                    read();
040            }
041            public StringPointer(String value) {
042                    super();
043                    this.value = value;
044            }
045            public static class ByValue extends StringPointer implements com.sun.jna.Structure.ByValue {}
046            public static class ByReference extends StringPointer implements com.sun.jna.Structure.ByReference {}
047            @Override
048            protected ByReference newByReference() {
049                    return new ByReference();
050            }
051            @Override
052            protected ByValue newByValue() {
053                    return new ByValue();
054            }
055            @Override
056            protected StringPointer newInstance() {
057                    return new StringPointer();
058            } 
059    }