Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings"
OOoWikiBot (Talk | contribs) m (Robot: Changing Category:Documentation/Developers Guide/Professional UNO) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
|NextPage=Documentation/DevGuide/ProUNO/Bridge/Client-Side Conversions | |NextPage=Documentation/DevGuide/ProUNO/Bridge/Client-Side Conversions | ||
}} | }} | ||
+ | {{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Bridge/{{SUBPAGENAME}}}} | ||
{{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: | ||
− | + | <syntaxhighlight lang="idl"> | |
//UNO IDL | //UNO IDL | ||
void func( long value); | void func( long value); | ||
− | + | </syntaxhighlight> | |
+ | |||
+ | <syntaxhighlight lang="vb"> | ||
+ | ' VB | ||
Dim value As Byte | Dim value As Byte | ||
value = 2 | value = 2 | ||
obj.func valLong | obj.func valLong | ||
+ | </syntaxhighlight> | ||
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 59: | Line 64: | ||
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: | ||
− | + | <syntaxhighlight lang="idl"> | |
// UNO IDL | // UNO IDL | ||
void func([in] byte value); | void func([in] byte value); | ||
+ | </syntaxhighlight> | ||
− | + | <syntaxhighlight 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 | ||
− | + | </syntaxhighlight> | |
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. | ||
Latest revision as of 15:09, 23 December 2020
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). |