001    /* Copyright (c) 2007 Timothy Wall, All Rights Reserved
002    *
003    * This library is free software; you can redistribute it and/or
004    * modify it under the terms of the GNU Lesser General Public
005    * License as published by the Free Software Foundation; either
006    * version 2.1 of the License, or (at your option) any later version.
007    * <p/>
008    * This library is distributed in the hope that it will be useful,
009    * but WITHOUT ANY WARRANTY; without even the implied warranty of
010    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011    * Lesser General Public License for more details.  
012    */
013    package com.ochafik.lang.jnaerator.runtime;
014    
015    import com.sun.jna.Native;
016    import com.sun.jna.ptr.ByReference;
017    
018    public class CharByReference extends ByReference {
019            public CharByReference() {
020                    this((char)0);
021            }
022    
023            public CharByReference(char value) {
024                    super(Native.WCHAR_SIZE);
025                    setValue(value);
026            }
027            public void setValue(char value) {
028                    getPointer().setChar(0, value);
029    //              switch (Native.WCHAR_SIZE) {
030    //              case 1:
031    //              case 2:
032    //              case 4:
033    //                      getPointer().setInt(0, value);
034    //                      break;
035    //              default:
036    //                      throw new UnsupportedOperationException("Unhandled CGFloat size : " + CGFloat.SIZE);
037    //              }
038            }
039            public char getValue() {
040                    return getPointer().getChar(0);
041            }
042    
043    }