michael@0: /* -*- Mode: C++; tab-width: 2; 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: #ifndef nsRDFResource_h__ michael@0: #define nsRDFResource_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIRDFNode.h" michael@0: #include "nsIRDFResource.h" michael@0: #include "nscore.h" michael@0: #include "nsStringGlue.h" michael@0: #include "rdf.h" michael@0: michael@0: class nsIRDFService; michael@0: michael@0: /** michael@0: * This simple base class implements nsIRDFResource, and can be used as a michael@0: * superclass for more sophisticated resource implementations. michael@0: */ michael@0: class nsRDFResource : public nsIRDFResource { michael@0: public: michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: // nsIRDFNode methods: michael@0: NS_IMETHOD EqualsNode(nsIRDFNode* aNode, bool* aResult); michael@0: michael@0: // nsIRDFResource methods: michael@0: NS_IMETHOD Init(const char* aURI); michael@0: NS_IMETHOD GetValue(char* *aURI); michael@0: NS_IMETHOD GetValueUTF8(nsACString& aResult); michael@0: NS_IMETHOD GetValueConst(const char** aURI); michael@0: NS_IMETHOD EqualsString(const char* aURI, bool* aResult); michael@0: NS_IMETHOD GetDelegate(const char* aKey, REFNSIID aIID, void** aResult); michael@0: NS_IMETHOD ReleaseDelegate(const char* aKey); michael@0: michael@0: // nsRDFResource methods: michael@0: nsRDFResource(void); michael@0: virtual ~nsRDFResource(void); michael@0: michael@0: protected: michael@0: static nsIRDFService* gRDFService; michael@0: static nsrefcnt gRDFServiceRefCnt; michael@0: michael@0: protected: michael@0: nsCString mURI; michael@0: michael@0: struct DelegateEntry { michael@0: nsCString mKey; michael@0: nsCOMPtr mDelegate; michael@0: DelegateEntry* mNext; michael@0: }; michael@0: michael@0: DelegateEntry* mDelegates; michael@0: }; michael@0: michael@0: #endif // nsRDFResource_h__