| java.lang.Object org.eclipse.swt.ole.win32.Variant
Variant | final public class Variant (Code) | | A Variant is a generic OLE mechanism for passing data of different types via a common interface.
It is used within the OleAutomation object for getting a property, setting a property or invoking
a method on an OLE Control or OLE Document.
|
Field Summary | |
final public static int | sizeof A variant always takes up 16 bytes, no matter what you
store in it. |
Constructor Summary | |
public | Variant() Create an empty Variant object with type VT_EMPTY. | public | Variant(float val) Create a Variant object which represents a Java float as a VT_R4. | public | Variant(double val) Create a Variant object which represents a Java double as a VT_R8. | public | Variant(int val) Create a Variant object which represents a Java int as a VT_I4. | public | Variant(int ptr, short byRefType) Create a Variant object which contains a reference to the data being transferred. | public | Variant(OleAutomation automation) Create a Variant object which represents an IDispatch interface as a VT_Dispatch. | public | Variant(IDispatch idispatch) Create a Variant object which represents an IDispatch interface as a VT_Dispatch. | public | Variant(IUnknown unknown) Create a Variant object which represents an IUnknown interface as a VT_UNKNOWN. | public | Variant(long val) Create a Variant object which represents a Java long as a VT_I8. | public | Variant(String string) Create a Variant object which represents a Java String as a VT_BSTR. | public | Variant(short val) Create a Variant object which represents a Java short as a VT_I2. | public | Variant(boolean val) Create a Variant object which represents a Java boolean as a VT_BOOL. |
Method Summary | |
public void | dispose() Calling dispose will release resources associated with this Variant. | public OleAutomation | getAutomation() Returns the OleAutomation object represented by this Variant.
If this Variant does not contain an OleAutomation object, an attempt is made to
coerce the Variant type into an OleAutomation object. | public boolean | getBoolean() Returns the Java boolean represented by this Variant.
If this Variant does not contain a Java boolean, an attempt is made to
coerce the Variant type into a Java boolean. | public int | getByRef() Returns a pointer to the referenced data represented by this Variant. | public byte | getByte() Returns the Java byte represented by this Variant.
If this Variant does not contain a Java byte, an attempt is made to
coerce the Variant type into a Java byte. | public char | getChar() Returns the Java char represented by this Variant.
If this Variant does not contain a Java char, an attempt is made to
coerce the Variant type into a Java char. | void | getData(int pData) | public IDispatch | getDispatch() Returns the IDispatch object represented by this Variant.
If this Variant does not contain an IDispatch object, an attempt is made to
coerce the Variant type into an IDIspatch object. | public double | getDouble() Returns the Java double represented by this Variant.
If this Variant does not contain a Java double, an attempt is made to
coerce the Variant type into a Java double. | public float | getFloat() Returns the Java float represented by this Variant.
If this Variant does not contain a Java float, an attempt is made to
coerce the Variant type into a Java float. | public int | getInt() Returns the Java int represented by this Variant.
If this Variant does not contain a Java int, an attempt is made to
coerce the Variant type into a Java int. | public long | getLong() Returns the Java long represented by this Variant.
If this Variant does not contain a Java long, an attempt is made to
coerce the Variant type into a Java long. | public short | getShort() Returns the Java short represented by this Variant.
If this Variant does not contain a Java short, an attempt is made to
coerce the Variant type into a Java short. | public String | getString() Returns the Java String represented by this Variant.
If this Variant does not contain a Java String, an attempt is made to
coerce the Variant type into a Java String. | public short | getType() Returns the type of the variant type. | public IUnknown | getUnknown() Returns the IUnknown object represented by this Variant.
If this Variant does not contain an IUnknown object, an attempt is made to
coerce the Variant type into an IUnknown object. | public void | setByRef(boolean val) Update the by reference value of this variant with a new boolean value. | public void | setByRef(float val) Update the by reference value of this variant with a new float value. | public void | setByRef(int val) Update the by reference value of this variant with a new integer value. | public void | setByRef(short val) Update the by reference value of this variant with a new short value. | void | setData(int pData) | public String | toString() Returns a string containing a concise, human-readable
description of the receiver. | public static void | win32_copy(int pVarDest, Variant varSrc) Invokes platform specific functionality to copy a variant
into operating system memory.
IMPORTANT: This method is not part of the public
API for Variant . | public static Variant | win32_new(int pVariant) Invokes platform specific functionality to wrap a variant.
IMPORTANT: This method is not part of the public
API for GC . |
sizeof | final public static int sizeof(Code) | | A variant always takes up 16 bytes, no matter what you
store in it. Objects, strings, and arrays are not physically
stored in the Variant; in these cases, four bytes of the
Variant are used to hold either an object reference, or a
pointer to the string or array. The actual data are stored elsewhere.
|
Variant | public Variant()(Code) | | Create an empty Variant object with type VT_EMPTY.
since: 2.0 |
Variant | public Variant(float val)(Code) | | Create a Variant object which represents a Java float as a VT_R4.
Parameters: val - the Java float value that this Variant represents |
Variant | public Variant(double val)(Code) | | Create a Variant object which represents a Java double as a VT_R8.
Parameters: val - the Java double value that this Variant represents since: 3.2 |
Variant | public Variant(int val)(Code) | | Create a Variant object which represents a Java int as a VT_I4.
Parameters: val - the Java int value that this Variant represents |
Variant | public Variant(int ptr, short byRefType)(Code) | | Create a Variant object which contains a reference to the data being transferred.
When creating a VT_BYREF Variant, you must give the full Variant type
including VT_BYREF such as
short byRefType = OLE.VT_BSTR | OLE.VT_BYREF .
Parameters: ptr - a pointer to the data being transferred. Parameters: byRefType - the type of the data being transferred such as OLE.VT_BSTR | OLE.VT_BYREF |
Variant | public Variant(OleAutomation automation)(Code) | | Create a Variant object which represents an IDispatch interface as a VT_Dispatch.
Parameters: automation - the OleAutomation object that this Variant represents |
Variant | public Variant(IDispatch idispatch)(Code) | | Create a Variant object which represents an IDispatch interface as a VT_Dispatch.
The caller is expected to have appropriately invoked unknown.AddRef() before creating
this Variant.
since: 2.0 Parameters: idispatch - the IDispatch object that this Variant represents |
Variant | public Variant(IUnknown unknown)(Code) | | Create a Variant object which represents an IUnknown interface as a VT_UNKNOWN.
The caller is expected to have appropriately invoked unknown.AddRef() before creating
this Variant.
Parameters: unknown - the IUnknown object that this Variant represents |
Variant | public Variant(long val)(Code) | | Create a Variant object which represents a Java long as a VT_I8.
Parameters: val - the Java long value that this Variant represents since: 3.2 |
Variant | public Variant(String string)(Code) | | Create a Variant object which represents a Java String as a VT_BSTR.
Parameters: string - the Java String value that this Variant represents |
Variant | public Variant(short val)(Code) | | Create a Variant object which represents a Java short as a VT_I2.
Parameters: val - the Java short value that this Variant represents |
Variant | public Variant(boolean val)(Code) | | Create a Variant object which represents a Java boolean as a VT_BOOL.
Parameters: val - the Java boolean value that this Variant represents |
dispose | public void dispose()(Code) | | Calling dispose will release resources associated with this Variant.
If the resource is an IDispatch or IUnknown interface, Release will be called.
If the resource is a ByRef pointer, nothing is released.
since: 2.1 |
getAutomation | public OleAutomation getAutomation()(Code) | | Returns the OleAutomation object represented by this Variant.
If this Variant does not contain an OleAutomation object, an attempt is made to
coerce the Variant type into an OleAutomation object. If this fails, an error is
thrown. Note that OleAutomation objects must be disposed when no longer
needed.
the OleAutomation object represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an OleAutomation object
|
getBoolean | public boolean getBoolean()(Code) | | Returns the Java boolean represented by this Variant.
If this Variant does not contain a Java boolean, an attempt is made to
coerce the Variant type into a Java boolean. If this fails, an error is thrown.
the Java boolean represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a boolean
|
getByRef | public int getByRef()(Code) | | Returns a pointer to the referenced data represented by this Variant.
If this Variant does not contain a reference to data, zero is returned.
a pointer to the referenced data represented by this Variant or 0 |
getByte | public byte getByte()(Code) | | Returns the Java byte represented by this Variant.
If this Variant does not contain a Java byte, an attempt is made to
coerce the Variant type into a Java byte. If this fails, an error is thrown.
the Java byte represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a byte
since: 3.3 |
getChar | public char getChar()(Code) | | Returns the Java char represented by this Variant.
If this Variant does not contain a Java char, an attempt is made to
coerce the Variant type into a Java char. If this fails, an error is thrown.
the Java char represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a char
since: 3.3 |
getData | void getData(int pData)(Code) | | |
getDispatch | public IDispatch getDispatch()(Code) | | Returns the IDispatch object represented by this Variant.
If this Variant does not contain an IDispatch object, an attempt is made to
coerce the Variant type into an IDIspatch object. If this fails, an error is
thrown.
since: 2.0 the IDispatch object represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an IDispatch object
|
getDouble | public double getDouble()(Code) | | Returns the Java double represented by this Variant.
If this Variant does not contain a Java double, an attempt is made to
coerce the Variant type into a Java double. If this fails, an error is thrown.
the Java double represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a double
since: 3.2 |
getFloat | public float getFloat()(Code) | | Returns the Java float represented by this Variant.
If this Variant does not contain a Java float, an attempt is made to
coerce the Variant type into a Java float. If this fails, an error is thrown.
the Java float represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a float
|
getInt | public int getInt()(Code) | | Returns the Java int represented by this Variant.
If this Variant does not contain a Java int, an attempt is made to
coerce the Variant type into a Java int. If this fails, an error is thrown.
the Java int represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a int
|
getLong | public long getLong()(Code) | | Returns the Java long represented by this Variant.
If this Variant does not contain a Java long, an attempt is made to
coerce the Variant type into a Java long. If this fails, an error is thrown.
the Java long represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a long
since: 3.2 |
getShort | public short getShort()(Code) | | Returns the Java short represented by this Variant.
If this Variant does not contain a Java short, an attempt is made to
coerce the Variant type into a Java short. If this fails, an error is thrown.
the Java short represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a short
|
getString | public String getString()(Code) | | Returns the Java String represented by this Variant.
If this Variant does not contain a Java String, an attempt is made to
coerce the Variant type into a Java String. If this fails, an error is thrown.
the Java String represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into a String
|
getType | public short getType()(Code) | | Returns the type of the variant type. This will be an OLE.VT_* value or
a bitwise combination of OLE.VT_* values as in the case of
OLE.VT_BSTR | OLE.VT_BYREF.
the type of the variant data since: 2.0 |
getUnknown | public IUnknown getUnknown()(Code) | | Returns the IUnknown object represented by this Variant.
If this Variant does not contain an IUnknown object, an attempt is made to
coerce the Variant type into an IUnknown object. If this fails, an error is
thrown.
the IUnknown object represented by this Variant exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an IUnknown object
|
setByRef | public void setByRef(boolean val)(Code) | | Update the by reference value of this variant with a new boolean value.
Parameters: val - the new boolean value exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant is not a (VT_BYREF | VT_BOOL) object
since: 2.1 |
setByRef | public void setByRef(float val)(Code) | | Update the by reference value of this variant with a new float value.
Parameters: val - the new float value exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant is not a (VT_BYREF | VT_R4) object
since: 2.1 |
setByRef | public void setByRef(int val)(Code) | | Update the by reference value of this variant with a new integer value.
Parameters: val - the new integer value exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant is not a (VT_BYREF | VT_I4) object
since: 2.1 |
setByRef | public void setByRef(short val)(Code) | | Update the by reference value of this variant with a new short value.
Parameters: val - the new short value exception: SWTException - - ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant is not a (VT_BYREF | VT_I2) object
since: 2.1 |
setData | void setData(int pData)(Code) | | |
toString | public String toString()(Code) | | Returns a string containing a concise, human-readable
description of the receiver.
a string representation of the Variant |
win32_copy | public static void win32_copy(int pVarDest, Variant varSrc)(Code) | | Invokes platform specific functionality to copy a variant
into operating system memory.
IMPORTANT: This method is not part of the public
API for Variant . It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
Parameters: pVarDest - destination pointer to a variant Parameters: varSrc - source Variant since: 3.3 |
win32_new | public static Variant win32_new(int pVariant)(Code) | | Invokes platform specific functionality to wrap a variant.
IMPORTANT: This method is not part of the public
API for GC . It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
Parameters: pVariant - pointer to a variant a new GC since: 3.3 |
|
|