nsIRDFResource.idl 2.8 KB

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