The Mozilla
Organization
At A Glance
Feedback
Get Involved
Newsgroups
License Terms
Newsbot
Developer Docs
Roadmap
Projects
Ports
Module Owners
Hacking
Get the Source
Build It
Testing
Download
Bugzilla
Bug Writing
Tools
View Source
Tree Status
New Checkins
Submit A Bug
FAQ
Search

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 Oct 5 15:33:12 PDT 1999
Copyright © 1998-1999 The Mozilla Organization.
Last modified October 5, 1999.