summaryrefslogtreecommitdiff
path: root/rdf/base/nsIRDFResource.idl
blob: df4d4b8ffd6d1f7e989613772db0bf3d5c443a73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsrootidl.idl"
#include "nsIRDFNode.idl"


/**
 * An nsIRDFResource is an object that has unique identity in the 
 * RDF data model. The object's identity is determined by its URI.
 */
[scriptable, uuid(fb9686a7-719a-49dc-9107-10dea5739341)]
interface nsIRDFResource : nsIRDFNode {
    /**
     * The single-byte string value of the resource.
     * @note THIS IS OBSOLETE. C++ should use GetValueConst and script
     *       should use .valueUTF8
     */
    readonly attribute string Value;

    /**
     * The UTF-8 URI of the resource.
     */
    readonly attribute AUTF8String ValueUTF8;

    /**
     * An unscriptable version used to avoid a string copy. Meant
     * for use as a performance optimization. The string is encoded
     * in UTF-8.
     */
    [noscript] void GetValueConst([shared] out string aConstValue);

    /**
     * This method is called by the nsIRDFService after constructing
     * a resource object to initialize its URI. You would not normally
     * call this method directly
     */
    void Init(in string uri);

    /**
     * Determine if the resource has the given URI.
     */
    boolean EqualsString(in string aURI);

    /**
     * Retrieve the "delegate" object for this resource. A resource
     * may have several delegate objects, each of whose lifetimes is
     * bound to the life of the resource object.
     *
     * This method will return the delegate for the given key after
     * QueryInterface()-ing it to the requested IID.
     *
     * If no delegate exists for the specified key, this method will
     * attempt to create one using the component manager. Specifically,
     * it will combine aKey with the resource's URI scheme to produce
     * a ContractID as follows:
     *
     *   component:/rdf/delegate-factory/[key]/[scheme]
     *
     * This ContractID will be used to locate a factory using the
     * FindFactory() method of nsIComponentManager. If the nsIFactory
     * exists, it will be used to create a "delegate factory"; that
     * is, an object that supports nsIRDFDelegateFactory. The delegate
     * factory will be used to construct the delegate object.
     */
    void GetDelegate(in string aKey, in nsIIDRef aIID,
                     [iid_is(aIID),retval] out nsQIResult aResult);

    /**
     * Force a delegate to be "unbound" from the resource.
     *
     * Normally, a delegate object's lifetime will be identical to
     * that of the resource to which it is bound; this method allows a
     * delegate to unlink itself from an RDF resource prematurely.
     */
    void ReleaseDelegate(in string aKey);
};