Today I wrote a patch for implementing nsIRegExpService (bug 106590), and it occured to me that this would be a good example to write for my XPCOM Cheat Sheet. (Not to mention for implementing the pattern attribute for Web Forms 2.0.)

But later, I started thinking about how C++ code is going to access the members of the returned array, and my head started spinning.

Then I ran into the nsIArray and nsIMutableArray interfaces, which look somewhat simpler (I understand XPCOM somewhat better), but seem to involve a bit more code.

I wandered around and gathered a few references on XPIDL-style arrays:
http://www.mozilla.org/scriptable/faq.html#i11
* http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/tests/ components/xpctest_array.cpp) * http://lxr.mozilla.org/seamonkey/source/js/src/xpconnect/tests/js/old/ xpctest_array.js
http://weblogs.mozillazine.org/weirdal/archives/008213.html
* http://lxr.mozilla.org/seamonkey/source/xpfe/components/extensions/ src/nsExtensionManager.js
* http://lxr.mozilla.org/seamonkey/source/xpcom/components/nsIClassInfo.idl
http://lxr.mozilla.org/seamonkey/search?string=PRUnichar+***

I also gathered a few on nsIArray and nsIMutableArray:
http://developer.mozilla.org/en/docs/XPCOM:Arrays
* http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsIArray.idl
* http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsIMutableArray.idl
http://lxr.mozilla.org/seamonkey/source/toolkit/components/filepicker/ content/filepicker.js#554 http://lxr.mozilla.org/seamonkey/source/toolkit/components/passwordmgr/ base/nsPasswordManager.cpp#467

These two models are very different, and I must ask which I should use, and when?

The answer to this question will matter a great deal to me, and affect both the Cheat Sheet and future patches I submit for reviews and checkin to mozilla.org trunk.

Alex Vincent


_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to