View Javadoc

1   /*
2   	Copyright (c) 2009 Olivier Chafik, All Rights Reserved
3   	
4   	This file is part of JNAerator (http://jnaerator.googlecode.com/).
5   	
6   	JNAerator is free software: you can redistribute it and/or modify
7   	it under the terms of the GNU Lesser General Public License as published by
8   	the Free Software Foundation, either version 3 of the License, or
9   	(at your option) any later version.
10  	
11  	JNAerator is distributed in the hope that it will be useful,
12  	but WITHOUT ANY WARRANTY; without even the implied warranty of
13  	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  	GNU Lesser General Public License for more details.
15  	
16  	You should have received a copy of the GNU Lesser General Public License
17  	along with JNAerator.  If not, see <http://www.gnu.org/licenses/>.
18  */
19  package com.ochafik.lang.jnaerator.runtime;
20  
21  import com.sun.jna.Pointer;
22  import com.sun.jna.PointerType;
23  import com.sun.jna.WString;
24  
25  @Deprecated
26  public class WStringPointer extends Structure<WStringPointer, WStringPointer.ByValue, WStringPointer.ByReference> {
27  	public WString value;
28  	public String toString() {
29  		return value.toString();
30  	}
31  
32  	public WStringPointer() {}
33  	public WStringPointer(PointerType p) {
34  		this(p.getPointer(), 0);
35  	}
36  	public WStringPointer(Pointer p) {
37  		this(p, 0);
38  	}
39  	public WStringPointer(Pointer p, int offset) {
40  		useMemory(p, offset);
41  		read();
42  	}
43  	public WStringPointer(WString value) {
44  		super();
45  		this.value = value;
46  	}
47  	public WStringPointer(String value) {
48  		super();
49  		this.value = new WString(value);
50  	}
51  	public static class ByValue extends WStringPointer implements com.sun.jna.Structure.ByValue {}
52  	public static class ByReference extends WStringPointer implements com.sun.jna.Structure.ByReference {}
53  	@Override
54  	protected ByReference newByReference() {
55  		return new ByReference();
56  	}
57  	@Override
58  	protected ByValue newByValue() {
59  		return new ByValue();
60  	}
61  	@Override
62  	protected WStringPointer newInstance() {
63  		return new WStringPointer();
64  	}
65  }