rdf/util/public/nsRDFResource.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rdf/util/public/nsRDFResource.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsRDFResource_h__
    1.10 +#define nsRDFResource_h__
    1.11 +
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsIRDFNode.h"
    1.14 +#include "nsIRDFResource.h"
    1.15 +#include "nscore.h"
    1.16 +#include "nsStringGlue.h"
    1.17 +#include "rdf.h"
    1.18 +
    1.19 +class nsIRDFService;
    1.20 +
    1.21 +/**
    1.22 + * This simple base class implements nsIRDFResource, and can be used as a
    1.23 + * superclass for more sophisticated resource implementations.
    1.24 + */
    1.25 +class nsRDFResource : public nsIRDFResource {
    1.26 +public:
    1.27 +
    1.28 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.29 +
    1.30 +    // nsIRDFNode methods:
    1.31 +    NS_IMETHOD EqualsNode(nsIRDFNode* aNode, bool* aResult);
    1.32 +
    1.33 +    // nsIRDFResource methods:
    1.34 +    NS_IMETHOD Init(const char* aURI);
    1.35 +    NS_IMETHOD GetValue(char* *aURI);
    1.36 +    NS_IMETHOD GetValueUTF8(nsACString& aResult);
    1.37 +    NS_IMETHOD GetValueConst(const char** aURI);
    1.38 +    NS_IMETHOD EqualsString(const char* aURI, bool* aResult);
    1.39 +    NS_IMETHOD GetDelegate(const char* aKey, REFNSIID aIID, void** aResult);
    1.40 +    NS_IMETHOD ReleaseDelegate(const char* aKey);
    1.41 +
    1.42 +    // nsRDFResource methods:
    1.43 +    nsRDFResource(void);
    1.44 +    virtual ~nsRDFResource(void);
    1.45 +
    1.46 +protected:
    1.47 +    static nsIRDFService* gRDFService;
    1.48 +    static nsrefcnt gRDFServiceRefCnt;
    1.49 +
    1.50 +protected:
    1.51 +    nsCString mURI;
    1.52 +
    1.53 +    struct DelegateEntry {
    1.54 +        nsCString             mKey;
    1.55 +        nsCOMPtr<nsISupports> mDelegate;
    1.56 +        DelegateEntry*        mNext;
    1.57 +    };
    1.58 +
    1.59 +    DelegateEntry* mDelegates;
    1.60 +};
    1.61 +
    1.62 +#endif // nsRDFResource_h__

mercurial