rdf/base/src/nsRDFXMLSerializer.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsRDFXMLSerializer_h__
michael@0 8 #define nsRDFXMLSerializer_h__
michael@0 9
michael@0 10 #include "nsIRDFLiteral.h"
michael@0 11 #include "nsIRDFXMLSerializer.h"
michael@0 12 #include "nsIRDFXMLSource.h"
michael@0 13 #include "nsNameSpaceMap.h"
michael@0 14 #include "nsXPIDLString.h"
michael@0 15
michael@0 16 #include "nsDataHashtable.h"
michael@0 17 #include "rdfITripleVisitor.h"
michael@0 18
michael@0 19 class nsString;
michael@0 20 class nsIOutputStream;
michael@0 21 class nsIRDFContainerUtils;
michael@0 22
michael@0 23 /**
michael@0 24 * A helper class that can serialize RDF/XML from a
michael@0 25 * datasource. Implements both nsIRDFXMLSerializer and
michael@0 26 * nsIRDFXMLSource.
michael@0 27 */
michael@0 28 class nsRDFXMLSerializer : public nsIRDFXMLSerializer,
michael@0 29 public nsIRDFXMLSource
michael@0 30 {
michael@0 31 public:
michael@0 32 static nsresult
michael@0 33 Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
michael@0 34
michael@0 35 NS_DECL_ISUPPORTS
michael@0 36 NS_DECL_NSIRDFXMLSERIALIZER
michael@0 37 NS_DECL_NSIRDFXMLSOURCE
michael@0 38
michael@0 39 protected:
michael@0 40 nsRDFXMLSerializer();
michael@0 41 virtual ~nsRDFXMLSerializer();
michael@0 42
michael@0 43 // Implementation methods
michael@0 44 nsresult
michael@0 45 RegisterQName(nsIRDFResource* aResource);
michael@0 46 nsresult
michael@0 47 GetQName(nsIRDFResource* aResource, nsCString& aQName);
michael@0 48 already_AddRefed<nsIAtom>
michael@0 49 EnsureNewPrefix();
michael@0 50
michael@0 51 nsresult
michael@0 52 SerializeInlineAssertion(nsIOutputStream* aStream,
michael@0 53 nsIRDFResource* aResource,
michael@0 54 nsIRDFResource* aProperty,
michael@0 55 nsIRDFLiteral* aValue);
michael@0 56
michael@0 57 nsresult
michael@0 58 SerializeChildAssertion(nsIOutputStream* aStream,
michael@0 59 nsIRDFResource* aResource,
michael@0 60 nsIRDFResource* aProperty,
michael@0 61 nsIRDFNode* aValue);
michael@0 62
michael@0 63 nsresult
michael@0 64 SerializeProperty(nsIOutputStream* aStream,
michael@0 65 nsIRDFResource* aResource,
michael@0 66 nsIRDFResource* aProperty,
michael@0 67 bool aInline,
michael@0 68 int32_t* aSkipped);
michael@0 69
michael@0 70 bool
michael@0 71 IsContainerProperty(nsIRDFResource* aProperty);
michael@0 72
michael@0 73 nsresult
michael@0 74 SerializeDescription(nsIOutputStream* aStream,
michael@0 75 nsIRDFResource* aResource);
michael@0 76
michael@0 77 nsresult
michael@0 78 SerializeMember(nsIOutputStream* aStream,
michael@0 79 nsIRDFResource* aContainer,
michael@0 80 nsIRDFNode* aMember);
michael@0 81
michael@0 82 nsresult
michael@0 83 SerializeContainer(nsIOutputStream* aStream,
michael@0 84 nsIRDFResource* aContainer);
michael@0 85
michael@0 86 nsresult
michael@0 87 SerializePrologue(nsIOutputStream* aStream);
michael@0 88
michael@0 89 nsresult
michael@0 90 SerializeEpilogue(nsIOutputStream* aStream);
michael@0 91
michael@0 92 nsresult
michael@0 93 CollectNamespaces();
michael@0 94
michael@0 95 bool
michael@0 96 IsA(nsIRDFDataSource* aDataSource, nsIRDFResource* aResource, nsIRDFResource* aType);
michael@0 97
michael@0 98 nsCOMPtr<nsIRDFDataSource> mDataSource;
michael@0 99 nsNameSpaceMap mNameSpaces;
michael@0 100 nsXPIDLCString mBaseURLSpec;
michael@0 101
michael@0 102 // hash mapping resources to utf8-encoded QNames
michael@0 103 nsDataHashtable<nsISupportsHashKey, nsCString> mQNames;
michael@0 104 friend class QNameCollector;
michael@0 105
michael@0 106 uint32_t mPrefixID;
michael@0 107
michael@0 108 static int32_t gRefCnt;
michael@0 109 static nsIRDFResource* kRDF_instanceOf;
michael@0 110 static nsIRDFResource* kRDF_type;
michael@0 111 static nsIRDFResource* kRDF_nextVal;
michael@0 112 static nsIRDFResource* kRDF_Bag;
michael@0 113 static nsIRDFResource* kRDF_Seq;
michael@0 114 static nsIRDFResource* kRDF_Alt;
michael@0 115 static nsIRDFContainerUtils* gRDFC;
michael@0 116 };
michael@0 117
michael@0 118 #endif // nsRDFXMLSerializer_h__

mercurial