|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsrootidl.idl" |
|
7 #include "nsIRDFNode.idl" |
|
8 |
|
9 |
|
10 /** |
|
11 * An nsIRDFResource is an object that has unique identity in the |
|
12 * RDF data model. The object's identity is determined by its URI. |
|
13 */ |
|
14 [scriptable, uuid(fb9686a7-719a-49dc-9107-10dea5739341)] |
|
15 interface nsIRDFResource : nsIRDFNode { |
|
16 /** |
|
17 * The single-byte string value of the resource. |
|
18 * @note THIS IS OBSOLETE. C++ should use GetValueConst and script |
|
19 * should use .valueUTF8 |
|
20 */ |
|
21 readonly attribute string Value; |
|
22 |
|
23 /** |
|
24 * The UTF-8 URI of the resource. |
|
25 */ |
|
26 readonly attribute AUTF8String ValueUTF8; |
|
27 |
|
28 /** |
|
29 * An unscriptable version used to avoid a string copy. Meant |
|
30 * for use as a performance optimization. The string is encoded |
|
31 * in UTF-8. |
|
32 */ |
|
33 [noscript] void GetValueConst([shared] out string aConstValue); |
|
34 |
|
35 /** |
|
36 * This method is called by the nsIRDFService after constructing |
|
37 * a resource object to initialize its URI. You would not normally |
|
38 * call this method directly |
|
39 */ |
|
40 void Init(in string uri); |
|
41 |
|
42 /** |
|
43 * Determine if the resource has the given URI. |
|
44 */ |
|
45 boolean EqualsString(in string aURI); |
|
46 |
|
47 /** |
|
48 * Retrieve the "delegate" object for this resource. A resource |
|
49 * may have several delegate objects, each of whose lifetimes is |
|
50 * bound to the life of the resource object. |
|
51 * |
|
52 * This method will return the delegate for the given key after |
|
53 * QueryInterface()-ing it to the requested IID. |
|
54 * |
|
55 * If no delegate exists for the specified key, this method will |
|
56 * attempt to create one using the component manager. Specifically, |
|
57 * it will combine aKey with the resource's URI scheme to produce |
|
58 * a ContractID as follows: |
|
59 * |
|
60 * component:/rdf/delegate-factory/[key]/[scheme] |
|
61 * |
|
62 * This ContractID will be used to locate a factory using the |
|
63 * FindFactory() method of nsIComponentManager. If the nsIFactory |
|
64 * exists, it will be used to create a "delegate factory"; that |
|
65 * is, an object that supports nsIRDFDelegateFactory. The delegate |
|
66 * factory will be used to construct the delegate object. |
|
67 */ |
|
68 void GetDelegate(in string aKey, in nsIIDRef aIID, |
|
69 [iid_is(aIID),retval] out nsQIResult aResult); |
|
70 |
|
71 /** |
|
72 * Force a delegate to be "unbound" from the resource. |
|
73 * |
|
74 * Normally, a delegate object's lifetime will be identical to |
|
75 * that of the resource to which it is bound; this method allows a |
|
76 * delegate to unlink itself from an RDF resource prematurely. |
|
77 */ |
|
78 void ReleaseDelegate(in string aKey); |
|
79 }; |
|
80 |
|
81 |