C12Adapter Opensource C++ Interface
|
Wrapper class allows creating and using any Automation COM object. More...
Classes | |
class | COMInitializer |
Initialize and uninitialize COM in constructor and destructor. More... | |
Public Member Functions | |
MAutomation (IDispatch *dispatch) | |
Constructor that takes the dispatch interface, used internally by CreateObject method. More... | |
MAutomation (const MAutomation &other) | |
Copy constructor that creates a new dispatch interface. More... | |
virtual | ~MAutomation () |
Destroy the object and decrement reference, as OLE requires. | |
MAutomation & | operator= (const MAutomation &other) |
Assignment operator that makes this automation object point to some other interface. More... | |
IDispatch * | GetDispatch () const |
Access the native dispatch interface of the automation object. | |
MStdString | GetProgId () const |
Program ID, reconstructed from the automation interface. More... | |
virtual MVariant | GetProperty (const MStdString &name) const |
Overloaded to provide access to COM properties. | |
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
Overloaded to allow changing COM properties. | |
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
Overloaded to provide implementation of all Call methods. | |
virtual bool | IsServicePresent (const MStdString &name) const |
Tell if the service with the given name exists in the Automation interface. More... | |
virtual bool | IsPropertyPresent (const MStdString &name) const |
Tell if the property with the given name exists in the Automation interface. More... | |
MVariant | GetAutomationProperty (const MStdString &name) const |
Get proper property of the automation object. More... | |
void | SetAutomationProperty (const MStdString &name, const MVariant &value) |
Set proper property of the automation object. More... | |
![]() | |
virtual | ~MObject () |
Object destructor. | |
virtual const MClass * | GetClass () const =0 |
Get the final class of the object. More... | |
virtual unsigned | GetEmbeddedSizeof () const |
For embedded object types, return the size of the class. More... | |
bool | IsEmbeddedObject () const |
Tell if the object is of embedded kind. More... | |
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
Call the object service with parameters, given as variant. More... | |
MVariant | Call0 (const MStdString &name) |
Call the object service with no parameters. More... | |
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
Call the object service with one parameter. More... | |
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
Call the object service with two parameter. More... | |
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
Call the object service with three parameter. More... | |
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
Call the object service with four parameter. More... | |
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
Call the object service with five parameter. More... | |
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
Call the object service with six parameter. More... | |
virtual MStdStringVector | GetAllPropertyNames () const |
Return the list of publicly available properties, persistent or not. More... | |
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
Return the list of persistent properties. More... | |
virtual void | SetPersistentPropertiesToDefault () |
Set the persistent properties of the object to their default values. More... | |
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
Get the default value of persistent property with the name given. More... | |
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
Set the persistent property with the name given to default value. More... | |
virtual const char * | GetType () const |
Get the name of the type for the object (could be the same as class name). | |
virtual void | SetType (const MStdString &) |
Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More... | |
virtual void | Validate () |
Validate internal structures of the object. More... | |
Static Public Member Functions | |
static MAutomation * | CreateObject (const MStdString &objectNameOrGUID) |
Public creator of the automation object. More... | |
static void | RegisterMeterObjectsComponentCategory () |
Register meter objects component category, as required by COM Registration. More... | |
static SAFEARRAY * | ToSafeArray (const char *data, unsigned size) |
Convert the given buffer and length into a safe array, handled by COM Automation interface. More... | |
static SAFEARRAY * | ToSafeArray (const MByteString &data) |
Convert the given byte string into a safe array, handled by COM Automation interface. More... | |
static MByteString | ToByteString (const SAFEARRAY *safeArray) |
Convert the given COM safe array into a byte string. More... | |
static MByteString | ToByteString (const BSTR b) |
Convert COM BSTR into a byte string using MeteringSDK convention. More... | |
static MByteString | ToByteString (const VARIANT *b) |
Convert COM VARIANT into a byte string using MeteringSDK convention. More... | |
static BSTR | ToBSTR (const MStdString &str) |
Convert the given standard string into COM BSTR. More... | |
static BSTR | ToByteStringBSTR (const MByteString &str) |
Convert the given byte string into COM BSTR according to MeteringSDK rules for Byte String. More... | |
static MStdString | ToStdString (const BSTR b) |
Convert COM BSTR into a string. More... | |
static VARIANT_BOOL | ToOleBool (bool value) |
Convert a boolean into COM boolean type. More... | |
static bool | ToBool (VARIANT_BOOL value) |
Convert COM boolean into C++ bool value. More... | |
static MVariant | ToTimeOrTimeSpan (DATE date) |
Convert COM DATE into MTime or MTimeSpan. More... | |
static DATE | ToOleDate (const MTime &time) |
Convert MTime into COM DATE object. More... | |
static MVariant | ToMVariant (const VARIANT &value) |
Convert the COM/OLE variant into MeteringSDK MVariant type. More... | |
static CComVariant | ToOleVariant (const MVariant &value, bool treatByteStringAsString=false) |
Convert MeteringSDK MVariant into COM/OLE variant type. More... | |
static void | CheckParameterExists (void *o, MConstChars argumentName) |
Check if the parameter is given, defined. More... | |
static MVariant | ToMVariant (const SAFEARRAY *, VARTYPE vt) |
static MVariant | ToMVariant (const SAFEARRAY *) |
![]() | |
static const MClass * | GetStaticClass () |
Get the declared class of this particular object. More... | |
static bool | IsClassPresent (const MStdString &name) |
Tells if the given class name is available. More... | |
Static Public Attributes | |
static CATID | CATID_MeterObjects |
Globally define Meter Objects Category IID. | |
![]() | |
static const MClass | s_class |
Class of MObject. | |
Additional Inherited Members | |
![]() | |
MObject () | |
Object constructor, protected as the class is abstract. | |
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
Set the persistent properties to their default values for one object provided the class for that object. More... | |
Wrapper class allows creating and using any Automation COM object.
As the class is Reflection-enabled, COM properties and methods can be accessed exactly in the same way as native Reflection properties and methods.
This class exists only on Windows.
|
inline |
Constructor that takes the dispatch interface, used internally by CreateObject method.
Use without CreateObject() shall be done with care, as there is no AddRef done here.
dispatch | The dispatch interface to use. Shall be nonzero (checked only in debug mode). |
|
inline |
Copy constructor that creates a new dispatch interface.
other | The Automation interface from which to create a new object. There is a limited debug check present. |
|
static |
Check if the parameter is given, defined.
|
static |
Public creator of the automation object.
objectNameOrGUID | Name of the Automation object such as "Scripting.FileSystemObject", or a GUID string such as "{ABB4186F-9130-11D3-8BD6-005004058322}". The GUID shall be wrapped into curly braces. The object shall exist in the system, or an exception is thrown. |
MVariant MAutomation::GetAutomationProperty | ( | const MStdString & | name | ) | const |
Get proper property of the automation object.
This service is helpful when MObject property has the same name as the automation object property.
MStdString MAutomation::GetProgId | ( | ) | const |
Program ID, reconstructed from the automation interface.
The call is always successful, but it can return a default value "Automation" if something is wrong with the registration of the object.
|
virtual |
Tell if the property with the given name exists in the Automation interface.
Due to OLE restriction, the service name is indistinguishable from property name. This way, the given name could actually be a property.
Reimplemented from MObject.
|
virtual |
Tell if the service with the given name exists in the Automation interface.
Due to OLE restriction, the service name is indistinguishable from property name. This way, the given name could actually be a property.
Reimplemented from MObject.
|
inline |
Assignment operator that makes this automation object point to some other interface.
other | The Automation interface from which to copy a new object. There is a limited debug check present. |
|
static |
Register meter objects component category, as required by COM Registration.
This call is necessary to make from facades that expose the function of the library to COM clients.
void MAutomation::SetAutomationProperty | ( | const MStdString & | name, |
const MVariant & | value | ||
) |
Set proper property of the automation object.
This service is helpful when MObject property has the same name as the automation object property.
|
inlinestatic |
Convert COM boolean into C++ bool value.
value | COM Boolean value to convert. |
|
static |
Convert the given standard string into COM BSTR.
str | String to convert into BSTR |
|
static |
Convert the given COM safe array into a byte string.
safeArray | Safe array to convert. There is a debug check to make sure the given safe array is not zero. The elements of the array should be bytes. |
|
static |
Convert COM BSTR into a byte string using MeteringSDK convention.
b | BSTR string to convert, shall not be NULL and shall only have unicode characters in range 0 .. 255. |
|
static |
Convert COM VARIANT into a byte string using MeteringSDK convention.
b | VARIANT of type byte array, variant array, or BSTR. |
|
static |
Convert the given byte string into COM BSTR according to MeteringSDK rules for Byte String.
str | String to convert into Byte String BSTR |
|
static |
Convert a safe array into a variant.
The specified variant type may have VT_ARRAY bit set (it is ignored).
In Windows CE, there is no way to determine SAFEARRAY's data type on CE, this is why CE version has only one parameter.
|
static |
Convert a safe array into a variant.
The specified variant type may have VT_ARRAY bit set (it is ignored).
In Windows CE, there is no way to determine SAFEARRAY's data type on CE, this is why CE version has only one parameter.
|
static |
Convert the COM/OLE variant into MeteringSDK MVariant type.
The call tries to preserve type information as much as possible, however the conversions are done.
value | Value to convert. The variant has to be of Automation-compatible types, otherwise an exception is thrown. |
|
inlinestatic |
Convert a boolean into COM boolean type.
value | Boolean value to convert. |
|
static |
Convert MTime into COM DATE object.
COM DATE type is just a double precision value.
time | The time and date to convert. If the value is MTime::IsNull, COM DATE is 0.0. |
|
static |
Convert MeteringSDK MVariant into COM/OLE variant type.
The call tries to preserve type information as much as possible, however the conversions are done.
value | Value to convert. The variant has to be of Automation-compatible types, otherwise an exception is thrown. |
treatByteStringAsString | If the given variant is a byte string, this boolean value tells if it has to be converted into a COM UNICODE string where each character will be within range 0 .. 255 to represent a byte. Default value for this parameter is false, do not convert byte string into UNICODE string. |
|
static |
Convert the given buffer and length into a safe array, handled by COM Automation interface.
data | Data buffer to convert. There is a debug check whether the data is not NULL. |
size | Size of the data buffer. |
|
inlinestatic |
Convert the given byte string into a safe array, handled by COM Automation interface.
data | Data array to convert. |
|
static |
Convert COM BSTR into a string.
b | BSTR string to convert, shall not be NULL. |
|
static |
Convert COM DATE into MTime or MTimeSpan.
COM DATE type is just a double precision value.
date | The date parameter, shall be valid, otherwise an MTime::IsNull time is returned. MTime::IsNull will also result if COM DATE is 0.0. |