Open main menu

CDOT Wiki β

Changes

Researching XPIDL and IDL Technologies

1,228 bytes added, 12:24, 4 October 2006
Built In Types
string char*
wstring PRUnichar*
 
==== Native Types ====
 
It is possible to use native types in XPIDL by declaring then using the native declaration syntax which works similar to a typedef in C++.
A native type can be given a name using the following syntax:
native name(native_type);
Reference and pointer types can be defined by combining [ref] or [ptr] with native languages
 
XPIDL code Generated C++
 
[ref] native nsNativeFileRef(nsFileSpec);
[ptr] native nsNativeFilePtr(nsFileSpec);
 
interface foo {
void openByRef(in nsNativeFileRef aFileSpecRef);
void openByPtr(in nsNativeFilePtr aFileSpecPtr);
};
 
 
/* starting interface: foo */
class foo {
public:
 
/* void openByRef (in nsNativeFileRef aFileSpecRef); */
NS_IMETHOD OpenByRef(nsFileSpec & aFileSpecRef) = 0;
 
/* void openByPtr (in nsNativeFilePtr aFileSpecPtr); */
NS_IMETHOD OpenByPtr(nsFileSpec * aFileSpecPtr) = 0;
};
 
Native types in your code can be a good way to migrate existing interfaces. However, using
native types in a method will mean that method is not scriptable.
=== Include Terminology ===
#include
1
edit