nsIProperties 编辑
xpcom/ds/nsIProperties.idl
Scriptable This interface provides methods to access a map of named XPCOM object values. Inherits from: nsISupports
Last changed in Gecko 1.2Implemented by: @mozilla.org/file/directory_service;1
. To get an instance, use:
var properties = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties);
Method overview
void get(in string prop, in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result); |
void getKeys(out PRUint32 count, [array, size_is(count), retval] out string keys); |
boolean has(in string prop); |
void set(in string prop, in nsISupports value); |
void undefine(in string prop); |
Methods
get()
Gets the XPCOM object associated with a particular name.
void get( in string prop, in nsIIDRef iid, [iid_is(iid),retval] out nsQIResult result );
Parameters
prop
- The property name.
iid
- The desired interface.
result
- The resulting object instance.
Exceptions thrown
NS_ERROR_FAILURE
- If the property does not exist.
NS_ERROR_NO_INTERFACE
- If the property exists, but does not support the requested interface.
getKeys()
Returns an array of property names.
nsMemory.h defines the macro NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY, which can be used to free aKeys when it is no longer needed.
void getKeys( out PRUint32 count, [array, size_is(count), retval] out string keys );
Parameters
count
- The length of the result array.
keys
- The resulting array of keys.
has()
Tests if a property exists.
boolean has( in string prop );
Parameters
prop
- The property name.
Return value
true
if the property exists, false
if the property does not exist.
set()
Sets the XPCOM object associated with a particular name.
void set( in string prop, in nsISupports value );
Parameters
prop
- The property name.
value
- The XPCOM object value to associate with prop.
undefine()
Undefines a property.
void undefine( in string prop );
Parameters
prop
- The property name.
Remarks
This interface was frozen for Gecko 1.2. See bug 162114 for details. From Gecko 2.0 interfaces are no longer frozen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论