XPCOM primitive 编辑
An XPCOM primitive is an XPCOM object that "boxes" a value of a primitive type. All XPCOM primitives are scriptable, and they all implement an XPCOM interface from the table below.
Primitives are rarely useful. The main use case is to store primitive values in a data structure that can only store XPCOM objects, such as nsIArray
. Also, certain APIs, such as nsITransferable.setTransferData()
, require primitives. (However, if you are designing that kind of API today, you should probably use nsIVariant instead.)
IDL data type | Interface | Component | IDL |
---|---|---|---|
nsIDPtr |
| @mozilla.org/supports-id;1 | [scriptable, uuid(d18290a0-4a1c-11d3-9890-006008962422)] interface nsISupportsID : nsISupportsPrimitive { attribute nsIDPtr data; string toString(); }; |
AString |
| @mozilla.org/supports-string;1 | [scriptable, uuid(d79dc970-4a1c-11d3-9890-006008962422)] interface nsISupportsString : nsISupportsPrimitive { attribute AString data; wstring toString(); }; |
PRBool |
| @mozilla.org/supports-PRBool;1 | [scriptable, uuid(ddc3b490-4a1c-11d3-9890-006008962422)] interface nsISupportsPRBool : nsISupportsPrimitive { attribute PRBool data; string toString(); }; |
PRUint8 |
| @mozilla.org/supports-PRUint8;1 | [scriptable, uuid(dec2e4e0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRUint8 : nsISupportsPrimitive { attribute PRUint8 data; string toString(); }; |
PRUint16 |
| @mozilla.org/supports-PRUint16;1 | [scriptable, uuid(dfacb090-4a1c-11d3-9890-006008962422)] interface nsISupportsPRUint16 : nsISupportsPrimitive { attribute PRUint16 data; string toString(); }; |
PRUint32 |
| @mozilla.org/supports-PRUint32;1 | [scriptable, uuid(e01dc470-4a1c-11d3-9890-006008962422)] interface nsISupportsPRUint32 : nsISupportsPrimitive { attribute PRUint32 data; string toString(); }; |
PRUint64 |
| @mozilla.org/supports-PRUint64;1 | [scriptable, uuid(e13567c0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRUint64 : nsISupportsPrimitive { attribute PRUint64 data; string toString(); }; |
PRTime |
| @mozilla.org/supports-PRTime;1 | [scriptable, uuid(e2563630-4a1c-11d3-9890-006008962422)] interface nsISupportsPRTime : nsISupportsPrimitive { attribute PRTime data; string toString(); }; |
char |
| @mozilla.org/supports-char;1 | [scriptable, uuid(e2b05e40-4a1c-11d3-9890-006008962422)] interface nsISupportsChar : nsISupportsPrimitive { attribute char data; string toString(); }; |
PRInt16 |
| @mozilla.org/supports-PRInt16;1 | [scriptable, uuid(e30d94b0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRInt16 : nsISupportsPrimitive { attribute PRInt16 data; string toString(); }; |
PRInt32 |
| @mozilla.org/supports-PRInt32;1 | [scriptable, uuid(e36c5250-4a1c-11d3-9890-006008962422)] interface nsISupportsPRInt32 : nsISupportsPrimitive { attribute PRInt32 data; string toString(); }; |
PRInt64 |
| @mozilla.org/supports-PRInt64;1 | [scriptable, uuid(e3cb0ff0-4a1c-11d3-9890-006008962422)] interface nsISupportsPRInt64 : nsISupportsPrimitive { attribute PRInt64 data; string toString(); }; |
float |
| @mozilla.org/supports-float;1 | [scriptable, uuid(abeaa390-4ac0-11d3-baea-00805f8a5dd7)] interface nsISupportsFloat : nsISupportsPrimitive { attribute float data; string toString(); }; |
double |
| @mozilla.org/supports-double;1 | [scriptable, uuid(b32523a0-4ac0-11d3-baea-00805f8a5dd7)] interface nsISupportsDouble : nsISupportsPrimitive { attribute double data; string toString(); }; |
voidPtr |
| @mozilla.org/supports-void;1 | [scriptable, uuid(464484f0-568d-11d3-baf8-00805f8a5dd7)] interface nsISupportsVoid : nsISupportsPrimitive { [noscript] attribute voidPtr data; string toString(); }; |
nsISupports |
| @mozilla.org/supports-interface-pointer;1 | [scriptable, uuid(995ea724-1dd1-11b2-9211-c21bdd3e7ed0)] interface nsISupportsInterfacePointer : nsISupportsPrimitive { attribute nsISupports data; attribute nsIDPtr dataIID; string toString(); }; |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论