Difference between revisions of "Zh/Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings"
From Apache OpenOffice Wiki
		< Zh | Documentation
		
		
|  (New page: {{Documentation/DevGuide/ProUNOTOC/Zh |ProUNO2c=block |ABridgeSvcMgr=block |ABridgeTM=block |ShowPrevNext=block |PrevPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Mapping of Type |NextPage=...) | |||
| Line 7: | Line 7: | ||
| |NextPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Client-Side Conversions | |NextPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Client-Side Conversions | ||
| }} | }} | ||
| − | + | {{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Bridge/{{SUBPAGENAME}}}} | |
| {{DISPLAYTITLE:转换映射}} | {{DISPLAYTITLE:转换映射}} | ||
Latest revision as of 03:08, 14 May 2009
如上一节所示,Automation 类型在映射表中具有对应的 UNO 类型。如果一个 UNO 函数需要某个特定类型的参数,则可以提供相应的 Automation 类型。这并不总是必需的,因为桥也接受相似的类型。例如:
//UNO IDL void func( long value); // VB Dim value As Byte value = 2 obj.func valLong
下表显示各种 Automation 类型,以及如果没有传送所需的 UNO IDL 类型,如何将 Automation 类型转换为 UNO IDL 类型。
| Automation IDL 类型(源) | UNO IDL 类型(目标) | 
|---|---|
| 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 | 
将一个字符串用于数值时,该字符串必须包含表示该值的适当字符串。
如果将浮点值用于整数值,这些值会被四舍五入。
使用的类型如果值空间大于 UNO 类型时要谨慎。不要提供超出值空间的参数,这会导致错误。例如:
// UNO IDL void func([in] byte value);
// VB Dim value as Integer value= 1000 obj.func value 'causes an error
转换映射只适用于参数,即从 Automation 环境到 UNO 函数的调用期间,直到该 UNO 函数接受参数。
| Content on this page is licensed under the Public Documentation License (PDL). | 

