Difference between revisions of "Documentation/DevGuide/FirstSteps/Struct"
(New page: <maintab>First Steps||Programming||Applications||Get Started||Get Objects||[[Work with Objects|Wor...) |
|||
Line 1: | Line 1: | ||
− | <maintab>[[Development Concepts| | + | <maintab>[[Development Concepts|Concepts]]||[[Programming|Programming]]||[[Applications|Applications]]||[[Get Started|Get Started]]||[[Get Objects|Get Objects]]||[[Work with Objects|Work with Objects]]||[[Types|Types]]||[[Example|Example]]</maintab> |
<subtab>[[Objects, Interfaces, and Services|Objects, Interfaces, and Services]]||[[Using Services|Using Services]]||[[Example Spreadsheet|Example Spreadsheet]]||[[Common Types|Types]]||[[Struct|Struct]]||[[Any|Any]]||[[Sequence|Sequence]]||[[Elements|Elements]]</subtab> | <subtab>[[Objects, Interfaces, and Services|Objects, Interfaces, and Services]]||[[Using Services|Using Services]]||[[Example Spreadsheet|Example Spreadsheet]]||[[Common Types|Types]]||[[Struct|Struct]]||[[Any|Any]]||[[Sequence|Sequence]]||[[Elements|Elements]]</subtab> | ||
Structs in the [PRODUCTNAME] API are used to create compounds of other UNO types. They correspond to C structs or Java classes consisting of public member variables only. | Structs in the [PRODUCTNAME] API are used to create compounds of other UNO types. They correspond to C structs or Java classes consisting of public member variables only. |
Revision as of 10:39, 5 April 2007
<maintab>Concepts||Programming||Applications||Get Started||Get Objects||Work with Objects||Types||Example</maintab> <subtab>Objects, Interfaces, and Services||Using Services||Example Spreadsheet||Types||Struct||Any||Sequence||Elements</subtab> Structs in the [PRODUCTNAME] API are used to create compounds of other UNO types. They correspond to C structs or Java classes consisting of public member variables only. While structs do not encapsulate data, they are easier to transport as a whole, instead of marshalling get() and set() calls back and forth. In particular, this has advantages for remote communication. You gain access to struct members through the . (dot) operator as in
aProperty.Name = "ReadOnly";
In Java, C++ und [PRODUCTNAME] Basic, the keyword new instantiates structs. In OLE automation, use [IDL:com.sun.star.reflection.CoreReflection] to get a UNO struct. Do not use the service manager to create structs.
//In Java: com.sun.star.beans.PropertyValue aProperty = new com.sun.star.beans.PropertyValue();
'In StarBasic Dim aProperty as new com.sun.star.beans.PropertyValue