summaryrefslogtreecommitdiffstats
path: root/rdf/base/nsRDFXMLSerializer.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /rdf/base/nsRDFXMLSerializer.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'rdf/base/nsRDFXMLSerializer.h')
-rw-r--r--rdf/base/nsRDFXMLSerializer.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/rdf/base/nsRDFXMLSerializer.h b/rdf/base/nsRDFXMLSerializer.h
new file mode 100644
index 000000000..b31a088cd
--- /dev/null
+++ b/rdf/base/nsRDFXMLSerializer.h
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsRDFXMLSerializer_h__
+#define nsRDFXMLSerializer_h__
+
+#include "nsIRDFLiteral.h"
+#include "nsIRDFXMLSerializer.h"
+#include "nsIRDFXMLSource.h"
+#include "nsNameSpaceMap.h"
+#include "nsXPIDLString.h"
+
+#include "nsDataHashtable.h"
+#include "rdfITripleVisitor.h"
+
+class nsIOutputStream;
+class nsIRDFContainerUtils;
+
+/**
+ * A helper class that can serialize RDF/XML from a
+ * datasource. Implements both nsIRDFXMLSerializer and
+ * nsIRDFXMLSource.
+ */
+class nsRDFXMLSerializer : public nsIRDFXMLSerializer,
+ public nsIRDFXMLSource
+{
+public:
+ static nsresult
+ Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIRDFXMLSERIALIZER
+ NS_DECL_NSIRDFXMLSOURCE
+
+protected:
+ nsRDFXMLSerializer();
+ virtual ~nsRDFXMLSerializer();
+
+ // Implementation methods
+ nsresult
+ RegisterQName(nsIRDFResource* aResource);
+ nsresult
+ GetQName(nsIRDFResource* aResource, nsCString& aQName);
+ already_AddRefed<nsIAtom>
+ EnsureNewPrefix();
+
+ nsresult
+ SerializeInlineAssertion(nsIOutputStream* aStream,
+ nsIRDFResource* aResource,
+ nsIRDFResource* aProperty,
+ nsIRDFLiteral* aValue);
+
+ nsresult
+ SerializeChildAssertion(nsIOutputStream* aStream,
+ nsIRDFResource* aResource,
+ nsIRDFResource* aProperty,
+ nsIRDFNode* aValue);
+
+ nsresult
+ SerializeProperty(nsIOutputStream* aStream,
+ nsIRDFResource* aResource,
+ nsIRDFResource* aProperty,
+ bool aInline,
+ int32_t* aSkipped);
+
+ bool
+ IsContainerProperty(nsIRDFResource* aProperty);
+
+ nsresult
+ SerializeDescription(nsIOutputStream* aStream,
+ nsIRDFResource* aResource);
+
+ nsresult
+ SerializeMember(nsIOutputStream* aStream,
+ nsIRDFResource* aContainer,
+ nsIRDFNode* aMember);
+
+ nsresult
+ SerializeContainer(nsIOutputStream* aStream,
+ nsIRDFResource* aContainer);
+
+ nsresult
+ SerializePrologue(nsIOutputStream* aStream);
+
+ nsresult
+ SerializeEpilogue(nsIOutputStream* aStream);
+
+ nsresult
+ CollectNamespaces();
+
+ bool
+ IsA(nsIRDFDataSource* aDataSource, nsIRDFResource* aResource, nsIRDFResource* aType);
+
+ nsCOMPtr<nsIRDFDataSource> mDataSource;
+ nsNameSpaceMap mNameSpaces;
+ nsXPIDLCString mBaseURLSpec;
+
+ // hash mapping resources to utf8-encoded QNames
+ nsDataHashtable<nsISupportsHashKey, nsCString> mQNames;
+ friend class QNameCollector;
+
+ uint32_t mPrefixID;
+
+ static int32_t gRefCnt;
+ static nsIRDFResource* kRDF_instanceOf;
+ static nsIRDFResource* kRDF_type;
+ static nsIRDFResource* kRDF_nextVal;
+ static nsIRDFResource* kRDF_Bag;
+ static nsIRDFResource* kRDF_Seq;
+ static nsIRDFResource* kRDF_Alt;
+ static nsIRDFContainerUtils* gRDFC;
+};
+
+#endif // nsRDFXMLSerializer_h__