michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsrootidl.idl" michael@0: #include "nsIRDFNode.idl" michael@0: michael@0: michael@0: /** michael@0: * An nsIRDFResource is an object that has unique identity in the michael@0: * RDF data model. The object's identity is determined by its URI. michael@0: */ michael@0: [scriptable, uuid(fb9686a7-719a-49dc-9107-10dea5739341)] michael@0: interface nsIRDFResource : nsIRDFNode { michael@0: /** michael@0: * The single-byte string value of the resource. michael@0: * @note THIS IS OBSOLETE. C++ should use GetValueConst and script michael@0: * should use .valueUTF8 michael@0: */ michael@0: readonly attribute string Value; michael@0: michael@0: /** michael@0: * The UTF-8 URI of the resource. michael@0: */ michael@0: readonly attribute AUTF8String ValueUTF8; michael@0: michael@0: /** michael@0: * An unscriptable version used to avoid a string copy. Meant michael@0: * for use as a performance optimization. The string is encoded michael@0: * in UTF-8. michael@0: */ michael@0: [noscript] void GetValueConst([shared] out string aConstValue); michael@0: michael@0: /** michael@0: * This method is called by the nsIRDFService after constructing michael@0: * a resource object to initialize its URI. You would not normally michael@0: * call this method directly michael@0: */ michael@0: void Init(in string uri); michael@0: michael@0: /** michael@0: * Determine if the resource has the given URI. michael@0: */ michael@0: boolean EqualsString(in string aURI); michael@0: michael@0: /** michael@0: * Retrieve the "delegate" object for this resource. A resource michael@0: * may have several delegate objects, each of whose lifetimes is michael@0: * bound to the life of the resource object. michael@0: * michael@0: * This method will return the delegate for the given key after michael@0: * QueryInterface()-ing it to the requested IID. michael@0: * michael@0: * If no delegate exists for the specified key, this method will michael@0: * attempt to create one using the component manager. Specifically, michael@0: * it will combine aKey with the resource's URI scheme to produce michael@0: * a ContractID as follows: michael@0: * michael@0: * component:/rdf/delegate-factory/[key]/[scheme] michael@0: * michael@0: * This ContractID will be used to locate a factory using the michael@0: * FindFactory() method of nsIComponentManager. If the nsIFactory michael@0: * exists, it will be used to create a "delegate factory"; that michael@0: * is, an object that supports nsIRDFDelegateFactory. The delegate michael@0: * factory will be used to construct the delegate object. michael@0: */ michael@0: void GetDelegate(in string aKey, in nsIIDRef aIID, michael@0: [iid_is(aIID),retval] out nsQIResult aResult); michael@0: michael@0: /** michael@0: * Force a delegate to be "unbound" from the resource. michael@0: * michael@0: * Normally, a delegate object's lifetime will be identical to michael@0: * that of the resource to which it is bound; this method allows a michael@0: * delegate to unlink itself from an RDF resource prematurely. michael@0: */ michael@0: void ReleaseDelegate(in string aKey); michael@0: }; michael@0: michael@0: