com.moesol.bindings.platform_sdk.component_services
Class VARIANT

java.lang.Object
  extended by com.moesol.bindings.NativeStructure
      extended by com.moesol.bindings.platform_sdk.component_services.VARIANT
All Implemented Interfaces:
VARENUM, Comparable

public class VARIANT
extends NativeStructure
implements VARENUM


Field Summary
static VARIANT EMPTY
           
static VARIANT NULL
           
static VARIANT PARAMNOTFOUND
           
static short VARIANT_FALSE
           
static short VARIANT_TRUE
           
 
Fields inherited from interface com.moesol.bindings.platform_sdk.component_services.VARENUM
VT_ARRAY, VT_BLOB, VT_BLOB_OBJECT, VT_BOOL, VT_BSTR, VT_BSTR_BLOB, VT_BYREF, VT_CARRAY, VT_CF, VT_CLSID, VT_CY, VT_DATE, VT_DECIMAL, VT_DISPATCH, VT_EMPTY, VT_ERROR, VT_FILETIME, VT_HRESULT, VT_I1, VT_I2, VT_I4, VT_I8, VT_ILLEGAL, VT_ILLEGALMASKED, VT_INT, VT_LPSTR, VT_LPWSTR, VT_NULL, VT_PTR, VT_R4, VT_R8, VT_RECORD, VT_RESERVED, VT_SAFEARRAY, VT_STORAGE, VT_STORED_OBJECT, VT_STREAM, VT_STREAMED_OBJECT, VT_TYPEMASK, VT_UI1, VT_UI2, VT_UI4, VT_UI8, VT_UINT, VT_UNKNOWN, VT_USERDEFINED, VT_VARIANT, VT_VECTOR, VT_VOID
 
Constructor Summary
VARIANT()
           
VARIANT(ByteBuffer bb)
           
 
Method Summary
 short get_boolVal()
           
 short get_bVal()
           
 byte get_cVal()
           
 long get_cyVal()
           
 double get_date()
           
 double get_dblVal()
           
 float get_fltVal()
           
 int get_intVal()
           
 short get_iVal()
           
 long get_llVal()
           
 int get_lVal()
           
 int get_scode()
           
 long get_uintVal()
           
 int get_uiVal()
           
 long get_ulVal()
           
 short get_vt()
           
 Object getArray()
          Get the array for this VARIANT.
 NativeStructure getRecord()
          Get the record for this VARIANT.
 Object getReference()
          Get the reference for this VARIANT.
 String getString()
           
static VARIANT makeArray(short vt, Object array)
          Creates a VARIANT that passes VARTYPE vt by reference.
static VARIANT makeBOOL(boolean bool)
           
static VARIANT makeCY(long cy)
           
static VARIANT makeERROR(int scode)
           
static VARIANT makeI1(byte cVal)
           
static VARIANT makeI2(short iVal)
           
static VARIANT makeI4(int lVal)
           
static VARIANT makeI8(long lVal)
           
static VARIANT makeINT(int intVal)
           
static VARIANT makeR4(float fltVal)
           
static VARIANT makeR8(double dblVal)
           
static VARIANT makeRecord(NativeStructure record)
           
static VARIANT makeReference(int vt, Object ref)
          Creates a VARIANT that passes VARTYPE vt by reference.
static VARIANT makeUI1(short bVal)
           
static VARIANT makeUI2(int uiVal)
           
static VARIANT makeUI4(long ulVal)
           
static VARIANT makeUINT(long uintVal)
           
 void set_boolVal(short v)
           
 void set_bVal(short v)
           
 void set_cVal(byte v)
           
 void set_cyVal(long v)
           
 void set_date(double v)
           
 void set_dblVal(double v)
           
 void set_fltVal(float v)
           
 void set_intVal(int v)
           
 void set_iVal(short v)
           
 void set_llVal(long v)
           
 void set_lVal(int v)
           
 void set_scode(int v)
           
 void set_uintVal(long v)
           
 void set_uiVal(int v)
           
 void set_ulVal(long v)
           
 void set_vt(short v)
           
 void setArray(Object array)
          Set the array for this VARIANT.
 void setRecord(NativeStructure record)
          Set the record for this VARIANT.
 void setReference(Object ref)
          Set the reference for this VARIANT.
 void setString(String s)
          Set the string for this VARIANT.
static int sizeof()
           
 String toString()
           
static Object wrapBSTR(String s)
          Wrap s in a VARIANT if it is null, otherwise just return s.
static Object wrapDISPATCH(IDispatch disp)
          Wrap disp in a VARIANT if it is null, otherwise just return disp.
static Object wrapLPSTR(String s)
           
static Object wrapUNKNOWN(IUnknown i)
           
 
Methods inherited from class com.moesol.bindings.NativeStructure
_getByteBuffer, _getStructureBytes, clearRecord, compareTo, equals, freeLpwstr, getArray, getBool, getBOOLArray, getBstr, getBSTRArray, getBstrArray, getByte, getBYTEArray, getByteArray, getByteBuffer, getByteSize, getByteString, getDate, getDouble, getDOUBLEArray, getDoubleArray, getDoubleSize, getFloat, getFLOATArray, getFloatArray, getFloatSize, getInt, getINTArray, getIntArray, getInterface, getIntSize, getLong, getLONGArray, getLongSize, getLpwstr, getPtrInt, getPtrShort, getPtrShortString, getPtrStruct, getPtrUnsignedByte, getPtrUnsignedShort, getPtrVariant, getPtrvoid, getRemaining, getSCODE, getShort, getSHORTArray, getShortArray, getShortSize, getSlice, getSlice, getString, getStruct, getStruct, getStructArray, getUINTArray, getUnsignedByte, getUnsignedByteArray, getUnsignedByteSize, getUnsignedInt, getUnsignedIntArray, getUnsignedIntSize, getUnsignedLongLong, getUnsignedLongSize, getUnsignedShort, getUnsignedShortArray, getUnsignedShortSize, getUSHORTArray, getVariant, getVARIANTArray, hashCode, order, order, putArray, putBool, putBOOLArray, putBstr, putBstrArray, putBSTRArray, putByte, putByteArray, putBYTEArray, putByteString, putDate, putDouble, putDOUBLEArray, putDoubleArray, putFloat, putFLOATArray, putFloatArray, putInt, putINTArray, putIntArray, putInterface, putLong, putLONGArray, putLpwstr, putPtrInt, putPtrShort, putPtrShortString, putPtrStruct, putPtrUnsignedByte, putPtrUnsignedShort, putPtrVariant, putPtrvoid, putSCODE, putShort, putShortArray, putSHORTArray, putString, putStruct, putStruct, putStructArray, putUINTArray, putUnsignedByte, putUnsignedByteArray, putUnsignedInt, putUnsignedIntArray, putUnsignedLongLong, putUnsignedShort, putUnsignedShortArray, putUSHORTArray, putVariant, putVARIANTArray, stringFromC, stringFromC, zero
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final VARIANT EMPTY

NULL

public static final VARIANT NULL

PARAMNOTFOUND

public static final VARIANT PARAMNOTFOUND

VARIANT_FALSE

public static final short VARIANT_FALSE
See Also:
Constant Field Values

VARIANT_TRUE

public static final short VARIANT_TRUE
See Also:
Constant Field Values
Constructor Detail

VARIANT

public VARIANT()

VARIANT

public VARIANT(ByteBuffer bb)
Method Detail

sizeof

public static int sizeof()

getReference

public Object getReference()
Get the reference for this VARIANT.

Returns:
reference array of size one (1) or null.

setReference

public void setReference(Object ref)
Set the reference for this VARIANT. When the VT_BYREF bit flag is set in the vt field, the native bindings will use the reference set here. The reference should be an array of size one (1). The type of the array should match the VARTYPE set in the other bits of the vt field. Element zero will contain the referred to value.

Parameters:
ref -
Throws:
COMException - if ref is null, not an array, or not length 1

getArray

public Object getArray()
Get the array for this VARIANT.

Returns:
the array.

setArray

public void setArray(Object array)
Set the array for this VARIANT. When the VT_ARRAY bit flag is set in the vt field, the native bindings will use the array set here. The array element type should match the VARTYPE set in the other bits of the vt field.

Parameters:
array -
Throws:
COMException - if array is not an array.

getRecord

public NativeStructure getRecord()
Get the record for this VARIANT.

Returns:
the record

setRecord

public void setRecord(NativeStructure record)
Set the record for this VARIANT. Note that the variant type is not automatically set when this method is called. You may want to call makeRecord instead of this method.

Parameters:
record -

setString

public void setString(String s)
Set the string for this VARIANT. When the VARIANT is of type VT_BSTR, VT_LPSTR, or VT_LPWSTR the converion to a native type uses this property. Normally, you do not need to use this for VT_BSTR since a java.lang.String will convert to VT_BSTR automatically.

Parameters:
s -

getString

public String getString()
Returns:
String property

set_vt

public void set_vt(short v)

get_vt

public short get_vt()

set_lVal

public void set_lVal(int v)

get_lVal

public int get_lVal()

set_iVal

public void set_iVal(short v)

get_iVal

public short get_iVal()

set_fltVal

public void set_fltVal(float v)

get_fltVal

public float get_fltVal()

set_dblVal

public void set_dblVal(double v)

get_dblVal

public double get_dblVal()

set_boolVal

public void set_boolVal(short v)

get_boolVal

public short get_boolVal()

set_scode

public void set_scode(int v)

get_scode

public int get_scode()

set_cyVal

public void set_cyVal(long v)

get_cyVal

public long get_cyVal()

set_cVal

public void set_cVal(byte v)

get_cVal

public byte get_cVal()

set_date

public void set_date(double v)

get_date

public double get_date()

set_bVal

public void set_bVal(short v)

get_bVal

public short get_bVal()

set_uiVal

public void set_uiVal(int v)

get_uiVal

public int get_uiVal()

set_ulVal

public void set_ulVal(long v)

get_ulVal

public long get_ulVal()

set_llVal

public void set_llVal(long v)

get_llVal

public long get_llVal()

set_intVal

public void set_intVal(int v)

get_intVal

public int get_intVal()

set_uintVal

public void set_uintVal(long v)

get_uintVal

public long get_uintVal()

makeI2

public static VARIANT makeI2(short iVal)

makeI4

public static VARIANT makeI4(int lVal)

makeR4

public static VARIANT makeR4(float fltVal)

makeR8

public static VARIANT makeR8(double dblVal)

makeBOOL

public static VARIANT makeBOOL(boolean bool)

makeI1

public static VARIANT makeI1(byte cVal)

makeUI1

public static VARIANT makeUI1(short bVal)

makeUI2

public static VARIANT makeUI2(int uiVal)

makeUI4

public static VARIANT makeUI4(long ulVal)

makeI8

public static VARIANT makeI8(long lVal)

makeINT

public static VARIANT makeINT(int intVal)

makeUINT

public static VARIANT makeUINT(long uintVal)

makeERROR

public static VARIANT makeERROR(int scode)

makeCY

public static VARIANT makeCY(long cy)

wrapDISPATCH

public static Object wrapDISPATCH(IDispatch disp)
Wrap disp in a VARIANT if it is null, otherwise just return disp. COM cannot convert a VT_NULL to a VT_DISPATCH so if we want to pass NULL for any VT_DISPATCH argument we must first wrap it in a VARIANT of type VT_DISPATCH

Returns:
disp or a VARIANT of type VT_DISPATCH and value NULL.

wrapUNKNOWN

public static Object wrapUNKNOWN(IUnknown i)
See Also:
wrapDISPATCH(com.moesol.bindings.platform_sdk.component_services.IDispatch)

wrapBSTR

public static Object wrapBSTR(String s)
Wrap s in a VARIANT if it is null, otherwise just return s. COM cannot convert a VT_NULL to a VT_BSTR so if we want to pass NULL for any VT_BSTR argument we must first wrap it in a VARIANT of type VT_BSTR

Returns:
s or a VARIANT of type VT_BSTR and value NULL.

wrapLPSTR

public static Object wrapLPSTR(String s)
See Also:
wrapBSTR(java.lang.String)

makeReference

public static VARIANT makeReference(int vt,
                                    Object ref)
Creates a VARIANT that passes VARTYPE vt by reference. First a new VARIANT is created and its set_vt is called with (vt | VT_BYREF), then setReference(ref) is called.

Parameters:
vt -
ref -
Returns:
VT_BYREF variant
Throws:
COMException - if ref is null, not an array, or not length 1
See Also:
.

makeArray

public static VARIANT makeArray(short vt,
                                Object array)
Creates a VARIANT that passes VARTYPE vt by reference. First a new VARIANT is created and its set_vt is called with (vt | VT_BYREF), then setReference(ref) is called.

Parameters:
vt -
array -
Returns:
a new VARIANT
Throws:
COMException - if array is not an array.
See Also:
.

makeRecord

public static VARIANT makeRecord(NativeStructure record)
Returns:
variant for record

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004 Moebius Solutions, Inc. All Rights Reserved.