View Javadoc

1   /* Copyright (c) 2007 Timothy Wall, All Rights Reserved
2   *
3   * This library is free software; you can redistribute it and/or
4   * modify it under the terms of the GNU Lesser General Public
5   * License as published by the Free Software Foundation; either
6   * version 2.1 of the License, or (at your option) any later version.
7   * <p/>
8   * This library is distributed in the hope that it will be useful,
9   * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.  
12  */
13  package com.ochafik.lang.jnaerator.runtime;
14  
15  import com.sun.jna.Native;
16  import com.sun.jna.ptr.ByReference;
17  
18  public class CharByReference extends ByReference {
19  	public CharByReference() {
20  		this((char)0);
21  	}
22  
23  	public CharByReference(char value) {
24  		super(Native.WCHAR_SIZE);
25  		setValue(value);
26  	}
27  	public void setValue(char value) {
28  		getPointer().setChar(0, value);
29  //		switch (Native.WCHAR_SIZE) {
30  //		case 1:
31  //		case 2:
32  //		case 4:
33  //			getPointer().setInt(0, value);
34  //			break;
35  //		default:
36  //			throw new UnsupportedOperationException("Unhandled CGFloat size : " + CGFloat.SIZE);
37  //		}
38  	}
39  	public char getValue() {
40  		return getPointer().getChar(0);
41  	}
42  
43  }