Jump to: navigation, search


2,410 bytes added, 12:19, 4 October 2006
no edit summary
placeholder Paul St-Denis & Michael Lau = Short Description =XPCOM stands for Cross Platform Component Object Model. XPCOM is a framework for developing cross platform software. = Detailed Discussion =XPCOM is a framework for developing cross platform software that can be written in C, C++, JavaScript with extensions for Perl and Python. It supports any platform with a C++ compiler.   You can access the XPCOM component through the web or any Mozilla application (paul stdenis similar to the idea of accessing web services).  Some of the tools needed for development are:* a C++ compiler* a Perl interpreter* some GNU tools  XPCOM provides the following features for cross platform development:* Component management* File abstraction* Object message passing* Memory management  Application that want to access Mozilla XPCOM libraries can use an XPCOM layer called XPConnect. = External Links =*[ API Reference]*[ MDC - XPCOM]*[ IBM - An introduction to XPCOM]*[ Wikipedia - XPCOM]*[ MozillaZine - File IO Sample]*[ LXR - nsFileInputStream.h] = Examples =[ nsFileInputStream on LXR] Sample code for XPCOM component<pre> 77 class nsFileInputStream : public nsFileStream, 78 public nsIFileInputStream, 79 public nsILineInputStream 80 { 81 public: 82 NS_DECL_ISUPPORTS_INHERITED 83 NS_DECL_NSIINPUTSTREAM 84 NS_DECL_NSIFILEINPUTSTREAM 85 NS_DECL_NSILINEINPUTSTREAM 86 87 // Overrided from nsFileStream 88 NS_IMETHOD Seek(PRInt32 aWhence, PRInt64 aOffset); 89 90 nsFileInputStream() : nsFileStream() 91 { 92 mLineBuffer = nsnull; 93 mBehaviorFlags = 0; 94 } 95 virtual ~nsFileInputStream() 96 { 97 Close(); 98 }...135 nsresult Reopen() { return Open(mFile, mIOFlags, mPerm); }136 };</ michael laupre> Sample use of XPCOM component<pre>var fstream = Components.classes[";1"] .createInstance(Components.interfaces.nsIFileInputStream);</pre>

Navigation menu