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 import com.sun.jna.WString;
024
025 @Deprecated
026 public class WStringPointer extends Structure<WStringPointer, WStringPointer.ByValue, WStringPointer.ByReference> {
027 public WString value;
028 public String toString() {
029 return value.toString();
030 }
031
032 public WStringPointer() {}
033 public WStringPointer(PointerType p) {
034 this(p.getPointer(), 0);
035 }
036 public WStringPointer(Pointer p) {
037 this(p, 0);
038 }
039 public WStringPointer(Pointer p, int offset) {
040 useMemory(p, offset);
041 read();
042 }
043 public WStringPointer(WString value) {
044 super();
045 this.value = value;
046 }
047 public WStringPointer(String value) {
048 super();
049 this.value = new WString(value);
050 }
051 public static class ByValue extends WStringPointer implements com.sun.jna.Structure.ByValue {}
052 public static class ByReference extends WStringPointer implements com.sun.jna.Structure.ByReference {}
053 @Override
054 protected ByReference newByReference() {
055 return new ByReference();
056 }
057 @Override
058 protected ByValue newByValue() {
059 return new ByValue();
060 }
061 @Override
062 protected WStringPointer newInstance() {
063 return new WStringPointer();
064 }
065 }