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