Difference between revisions of "Documentation/DevGuide/WritingUNO/Writing the Specification"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
m (1 revision(s))
(No difference)

Revision as of 13:07, 15 February 2008



There are similarities between C++, CORBA IDL and UNOIDL, especially concerning the syntax and the general usage of the compiler. If you are familiar with reading C++ or CORBA IDL, you will be able to understand much of UNOIDL, as well.

As a first example, consider the IDL specification for the com.sun.star.bridge.XUnoUrlResolver interface. An idl file usually starts with a number of preprocessor directives, followed by module instructions and a type definition:

 #ifndef __com_sun_star_bridge_XUnoUrlResolver_idl__ 
 #define __com_sun_star_bridge_XUnoUrlResolver_idl__ 
 
 #include <com/sun/star/uno/XInterface.idl> 
 #include <com/sun/star/lang/IllegalArgumentException.idl> 
 #include <com/sun/star/connection/ConnectionSetupException.idl> 
 #include <com/sun/star/connection/NoConnectException.idl> 
 
 
 module com { module sun { module star { module bridge {
 
 
 /** service <type scope="com::sun::star::bridge">UnoUrlResolver</type> 
         implements this interface.
  */
 published interface XUnoUrlResolver: com::sun::star::uno::XInterface
 { 
     // method com::sun::star::bridge::XUnoUrlResolver::resolve
     /** resolves an object, on the UNO URL.
      */
     com::sun::star::uno::XInterface resolve( [in] string sUnoUrl ) 
         raises (com::sun::star::connection::NoConnectException, 
                 com::sun::star::connection::ConnectionSetupException, 
                 com::sun::star::lang::IllegalArgumentException); 
 }; 
 
 }; }; }; };
 
 #endif 

We will discuss this idl file step by step below, and we will write our own UNOIDL specification as soon as possible. The file specifying com.sun.star.bridge.XUnoUrlResolver is located in the idl folder of your SDK installation, <SDK>/idl/com/sun/star/bridge/XUnoUrlResolver.idl.

UNOIDL definition file names have the extension . idl by convention. The descriptions must use the US ASCII character set without special characters and separate symbols by whitespace, i.e. blanks, tabs or linefeeds.

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