Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings"
OOoWikiBot (Talk | contribs) m (FINAL VERSION FOR L10N) |
m |
||
Line 10: | Line 10: | ||
{{DISPLAYTITLE:Conversion Mappings}} | {{DISPLAYTITLE:Conversion Mappings}} | ||
As shown in the previous section, Automation types have a UNO counterpart according to the mapping tables. If a UNO function expects a particular type as an argument, then supply the corresponding Automation type. This is not always necessary as the bridge also accepts similar types. For example: | As shown in the previous section, Automation types have a UNO counterpart according to the mapping tables. If a UNO function expects a particular type as an argument, then supply the corresponding Automation type. This is not always necessary as the bridge also accepts similar types. For example: | ||
− | + | <source lang="idl"> | |
//UNO IDL | //UNO IDL | ||
void func( long value); | void func( long value); | ||
− | + | </source> | |
+ | <source lang="vb"> | ||
+ | ' VB | ||
Dim value As Byte | Dim value As Byte | ||
value = 2 | value = 2 | ||
obj.func valLong | obj.func valLong | ||
+ | </source> | ||
The following table shows the various Automation types, and how they are converted to UNO IDL types if the expected UNO IDL type has not been passed. | The following table shows the various Automation types, and how they are converted to UNO IDL types if the expected UNO IDL type has not been passed. | ||
Line 60: | Line 63: | ||
Be careful using types that have a greater value space than the UNO type. Do not provide an argument that exceeds the value space which would result in an error. For example: | Be careful using types that have a greater value space than the UNO type. Do not provide an argument that exceeds the value space which would result in an error. For example: | ||
− | + | <source lang="idl"> | |
// UNO IDL | // UNO IDL | ||
void func([in] byte value); | void func([in] byte value); | ||
− | + | </source> | |
− | + | <source lang="vb"> | |
− | + | ' VB | |
Dim value as Integer | Dim value as Integer | ||
value= 1000 | value= 1000 | ||
obj.func value 'causes an error | obj.func value 'causes an error | ||
− | + | </source> | |
The conversion mappings only work with in parameters, that is, during calls from an Automation environment to a UNO function, as far as the UNO function takes in parameters. | The conversion mappings only work with in parameters, that is, during calls from an Automation environment to a UNO function, as far as the UNO function takes in parameters. | ||
Revision as of 12:54, 22 October 2009
As shown in the previous section, Automation types have a UNO counterpart according to the mapping tables. If a UNO function expects a particular type as an argument, then supply the corresponding Automation type. This is not always necessary as the bridge also accepts similar types. For example:
//UNO IDL void func( long value);
' VB Dim value As Byte value = 2 obj.func valLong
The following table shows the various Automation types, and how they are converted to UNO IDL types if the expected UNO IDL type has not been passed.
Automation IDL Types (source) | UNO IDL Types (target) |
---|---|
boolean (true, false) unsigned char, short, long, float, double: 0 = false, > 0 = true
string: "true" = true, "false" = false |
boolean |
boolean, unsigned char, short, long, float, double, string | byte |
double, boolean, unsigned char, short, long, float, string | double |
float, boolean, unsigned char, short, string | float |
short, unsigned char, long, float, double, string | short |
long, unsigned char, long, float, double, string | long |
BSTR, boolean, unsigned char, short, long, float, double | string |
short, boolean, unsigned char, long, float, double, string (1 character long) | char |
long, boolean, unsigned char, short, float, double, string | enum |
When you use a string for a numeric value, it must contain an appropriate string representation of that value.
Floating point values are rounded if they are used for integer values.
Be careful using types that have a greater value space than the UNO type. Do not provide an argument that exceeds the value space which would result in an error. For example:
// UNO IDL void func([in] byte value);
' VB Dim value as Integer value= 1000 obj.func value 'causes an error
The conversion mappings only work with in parameters, that is, during calls from an Automation environment to a UNO function, as far as the UNO function takes in parameters.
Content on this page is licensed under the Public Documentation License (PDL). |