|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.ole.win32.Variant
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 | |
static int |
sizeof
|
Constructor Summary | |
Variant()
Create an empty Variant object with type VT_EMPTY. |
|
Variant(boolean val)
Create a Variant object which represents a Java boolean as a VT_BOOL. |
|
Variant(float val)
Create a Variant object which represents a Java float as a VT_R4. |
|
Variant(org.eclipse.swt.internal.ole.win32.IDispatch idispatch)
Create a Variant object which represents an IDispatch interface as a VT_Dispatch. |
|
Variant(int val)
Create a Variant object which represents a Java int as a VT_I4. |
|
Variant(int ptr,
short byRefType)
Create a Variant object which contains a reference to the data being transferred. |
|
Variant(org.eclipse.swt.internal.ole.win32.IUnknown unknown)
Create a Variant object which represents an IUnknown interface as a VT_UNKNOWN. |
|
Variant(OleAutomation automation)
Create a Variant object which represents an IDispatch interface as a VT_Dispatch. |
|
Variant(short val)
Create a Variant object which represents a Java short as a VT_I2. |
|
Variant(String string)
Create a Variant object which represents a Java String as a VT_BSTR. |
Method Summary | |
void |
dispose()
Calling dispose will release resources associated with this Variant. |
OleAutomation |
getAutomation()
Returns the OleAutomation object represented by this Variant. |
boolean |
getBoolean()
Returns the Java boolean represented by this Variant. |
int |
getByRef()
Returns a pointer to the referenced data represented by this Variant. |
org.eclipse.swt.internal.ole.win32.IDispatch |
getDispatch()
Returns the IDispatch object represented by this Variant. |
float |
getFloat()
Returns the Java float represented by this Variant. |
int |
getInt()
Returns the Java int represented by this Variant. |
short |
getShort()
Returns the Java short represented by this Variant. |
String |
getString()
Returns the Java String represented by this Variant. |
short |
getType()
Returns the ytpe of the variant type. |
org.eclipse.swt.internal.ole.win32.IUnknown |
getUnknown()
Returns the IUnknown object represented by this Variant. |
void |
setByRef(boolean val)
Update the by reference value of this variant with a new boolean value. |
void |
setByRef(float val)
Update the by reference value of this variant with a new float value. |
void |
setByRef(int val)
Update the by reference value of this variant with a new integer value. |
void |
setByRef(short val)
Update the by reference value of this variant with a new short value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int sizeof
Constructor Detail |
public Variant()
public Variant(float val)
val
- the Java float value that this Variant representspublic Variant(int val)
val
- the Java int value that this Variant representspublic Variant(int ptr, short byRefType)
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
.
ptr
- a pointer to the data being transferred.byRefType
- the type of the data being transferred such as OLE.VT_BSTR | OLE.VT_BYREFpublic Variant(OleAutomation automation)
automation
- the OleAutomation object that this Variant representspublic Variant(org.eclipse.swt.internal.ole.win32.IDispatch idispatch)
The caller is expected to have appropriately invoked unknown.AddRef() before creating this Variant.
idispatch
- the IDispatch object that this Variant representspublic Variant(org.eclipse.swt.internal.ole.win32.IUnknown unknown)
The caller is expected to have appropriately invoked unknown.AddRef() before creating this Variant.
unknown
- the IUnknown object that this Variant representspublic Variant(String string)
string
- the Java String value that this Variant representspublic Variant(short val)
val
- the Java short value that this Variant representspublic Variant(boolean val)
val
- the Java boolean value that this Variant representsMethod Detail |
public void dispose()
public OleAutomation getAutomation()
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.
SWTError
- ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an OleAutomation objectpublic org.eclipse.swt.internal.ole.win32.IDispatch getDispatch()
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.
SWTError
- ERROR_CANNOT_CHANGE_VARIANT_TYPE when type of Variant can not be coerced into an IDispatch objectpublic boolean getBoolean()
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.
SWTError
- public int getByRef()
If this Variant does not contain a reference to data, zero is returned.
public float getFloat()
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.
SWTError
- public int getInt()
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.
SWTError
- public short getShort()
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.
SWTError
- public String getString()
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.
SWTError
- public short getType()
public org.eclipse.swt.internal.ole.win32.IUnknown getUnknown()
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.
SWTError
- public void setByRef(boolean val)
val
- the new boolean value
SWTError
- public void setByRef(float val)
val
- the new float value
SWTError
- public void setByRef(int val)
val
- the new integer value
SWTError
- public void setByRef(short val)
val
- the new short value
SWTError
-
|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.