Difference between revisions of "Zh/Documentation/DevGuide/ProUNO/Bridge/Client-Side Conversions"

From Apache OpenOffice Wiki
Jump to: navigation, search
(New page: {{Documentation/DevGuide/ProUNOTOC/Zh |ProUNO2c=block |ABridgeSvcMgr=block |ABridgeTM=block |ShowPrevNext=block |PrevPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings |NextP...)
 
m
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
|ShowPrevNext=block
 
|ShowPrevNext=block
 
|PrevPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings
 
|PrevPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Conversion Mappings
|NextPage=Documentation/DevGuide/ProUNO/Bridge/Value Objects
+
|NextPage=Zh/Documentation/DevGuide/ProUNO/Bridge/Value Objects
 
}}
 
}}
[[zh: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



UNO IDL 说明和定义的映射表明调用某个特定 UNO 函数时,需要返回什么值。但是,在值通过桥后,使用的语言可能还会应用另一个转换。

 // UNO IDL 
 float func();
 // VB
 Dim ret As Single
 ret= obj.func() 'no conversion by VB
 
 Dim ret2 As String
 ret2= obj.func() 'VB converts float to string


函数返回时,VB 将 float 值转换成 string,并将其指定给 ret2。当函数返回的是一个字符,并且 希望返回字符串而不是 VB 整数值时,这样的转换就会非常有用。

 // UNO IDL
 char func();
 // VB
 Dim ret As String
 ret= obj.func()'VB converts the returned short into a string


如果使用这些转换,请注意不同的值空间。也就是说,如果接收返回值的变量的值空间小于 UNO 类型,并且该值不适合于提供的变量,就可能发生运行时错误。有关客户机端转换的信息,请参阅相应语言的文档。


客户机端转换仅适用于返回值,而不适用于 out 或 inout 参数。如果当前的桥实现没有提供默认映射中所需的类型,就无法将 out 或 inout 参数传回 Automation。


另一种转换为隐式转换。用户不会影响转换种类。例如,与 Windows Scripting Host 或 Internet Explorer 配合使用的脚本引擎将 double 值用于所有浮点值。因此,当 UNO 函数返回一个 float 值时,该值就会被转换成 double,这可能会产生一个稍微不同的值。例如:

 // UNO IDL
 float func(); //returns 3.14
 // JScript
 var ret= obj.func(); // implicit conversion from float to double, ret= 3.14000010490417


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages