nsRDFResource.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* -*- Mode: C++; tab-width: 2; 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. #ifndef nsRDFResource_h__
  6. #define nsRDFResource_h__
  7. #include "nsCOMPtr.h"
  8. #include "nsIRDFNode.h"
  9. #include "nsIRDFResource.h"
  10. #include "nscore.h"
  11. #include "nsStringGlue.h"
  12. #include "rdf.h"
  13. class nsIRDFService;
  14. /**
  15. * This simple base class implements nsIRDFResource, and can be used as a
  16. * superclass for more sophisticated resource implementations.
  17. */
  18. class nsRDFResource : public nsIRDFResource {
  19. public:
  20. NS_DECL_THREADSAFE_ISUPPORTS
  21. // nsIRDFNode methods:
  22. NS_IMETHOD EqualsNode(nsIRDFNode* aNode, bool* aResult) override;
  23. // nsIRDFResource methods:
  24. NS_IMETHOD Init(const char* aURI) override;
  25. NS_IMETHOD GetValue(char* *aURI) override;
  26. NS_IMETHOD GetValueUTF8(nsACString& aResult) override;
  27. NS_IMETHOD GetValueConst(const char** aURI) override;
  28. NS_IMETHOD EqualsString(const char* aURI, bool* aResult) override;
  29. NS_IMETHOD GetDelegate(const char* aKey, REFNSIID aIID, void** aResult) override;
  30. NS_IMETHOD ReleaseDelegate(const char* aKey) override;
  31. // nsRDFResource methods:
  32. nsRDFResource(void);
  33. protected:
  34. virtual ~nsRDFResource(void);
  35. static nsIRDFService* gRDFService;
  36. static nsrefcnt gRDFServiceRefCnt;
  37. protected:
  38. nsCString mURI;
  39. struct DelegateEntry {
  40. nsCString mKey;
  41. nsCOMPtr<nsISupports> mDelegate;
  42. DelegateEntry* mNext;
  43. };
  44. DelegateEntry* mDelegates;
  45. };
  46. #endif // nsRDFResource_h__