IDL Author's Guide - Generated Headers
Simple interface
/* starting interface nsIFoo */
class nsIFoo {
public:
};
Interface parent declaration
/* starting interface nsIFoo */
class nsIFoo : public nsIParent {
public:
};
Interfaces with IIDs
/* starting interface nsIFoo */
/* {00000000-0000-0000-c000-000000000046} */
#define NS_IFOO_IID_STR "00000000-0000-0000-c000-000000000046"
#define NS_IFOO_IID \
{0x00000000, 0x0000, 0x0000, \
{ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 }}
class nsIFoo : public nsIParent {
public:
static const nsIID& IID() {
static nsIID iid = NS_IFOO_IID;
return iid;
}
};
Forward interface declarations
class nsIForward; /* forward decl */
Method and attribute
/* starting interface nsIFoo */
class nsIFoo {
public:
/* attribute long attr; */
NS_IMETHOD GetAttr(PRInt32 *aAttr) = 0;
NS_IMETHOD SetAttr(PRInt32 aAttr) = 0;
/* void fun (); */
NS_IMETHOD fun() = 0;
};
Method types
/* starting interface nsIStringStuff */
class nsIStringStuff {
public:
/* void FindStringLength (in string str, out long l); */
NS_IMETHOD FindStringLength(char *str, PRInt32 *l) = 0;
/* void ConcatenateStrings (in string str1, in string str2, out string result); */
NS_IMETHOD ConcatenateStrings(char *str1, char *str2, char **result) = 0;
/* void ReplaceChar (inout string str, in char from, in char to, in boolean foldCase); */
NS_IMETHOD ReplaceChar(char **str, char from, char to, PRBool foldCase) = 0;
};
Non-void return types
/* starting interface nsINonVoidReturn */
class nsINonVoidReturn {
public:
/* string GimmeString (in string str, in long count); */
NS_IMETHOD GimmeString(char *str, PRInt32 count, char **_retval) = 0;
/* long GimmeLong (in boolean prime); */
NS_IMETHOD GimmeLong(PRBool prime, PRInt32 *_retval) = 0;
};
readonly attributes
/* starting interface nsIThing */
class nsIThing {
public:
/* readonly attribute string LookButDontTouch; */
NS_IMETHOD GetLookButDontTouch(char * *aLookButDontTouch) = 0;
};
Mike Shaver
Last modified: Tue Feb 16 07:04:49 EST 1999
|