diff options
Diffstat (limited to 'rdf/build')
-rw-r--r-- | rdf/build/moz.build | 20 | ||||
-rw-r--r-- | rdf/build/nsRDFCID.h | 76 | ||||
-rw-r--r-- | rdf/build/nsRDFModule.cpp | 159 |
3 files changed, 255 insertions, 0 deletions
diff --git a/rdf/build/moz.build b/rdf/build/moz.build new file mode 100644 index 000000000..d7be68954 --- /dev/null +++ b/rdf/build/moz.build @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXPORTS += [ + 'nsRDFCID.h', +] + +SOURCES += [ + 'nsRDFModule.cpp', +] + +FINAL_LIBRARY = 'xul' + +LOCAL_INCLUDES += [ + '/rdf/base', + '/rdf/datasource', +] diff --git a/rdf/build/nsRDFCID.h b/rdf/build/nsRDFCID.h new file mode 100644 index 000000000..18d47aed5 --- /dev/null +++ b/rdf/build/nsRDFCID.h @@ -0,0 +1,76 @@ +/* -*- 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/. */ + +/* + + XPCOM Class IDs for RDF objects that can be constructed via the RDF + factory. + + */ + +#ifndef nsRDFCID_h__ +#define nsRDFCID_h__ + +// {0F78DA56-8321-11d2-8EAC-00805F29F370} +#define NS_RDFDEFAULTRESOURCE_CID \ +{ 0xf78da56, 0x8321, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } + +// {BFD05264-834C-11d2-8EAC-00805F29F370} +#define NS_RDFSERVICE_CID \ +{ 0xbfd05264, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } + +// {BFD0526D-834C-11d2-8EAC-00805F29F370} +#define NS_RDFINMEMORYDATASOURCE_CID \ +{ 0xbfd0526d, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } + +// {E638D760-8687-11d2-B530-000000000001} +#define NS_RDFFILESYSTEMDATASOURCE_CID \ +{ 0xe638d760, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x01 } } + +// {6bd1d807-1c67-11d3-9820-ed1b357eb3c4} +#define NS_RDFSEARCHDATASOURCE_CID \ +{ 0x6bd1d807, 0x1c67, 0x11d3, { 0x98, 0x20, 0xed, 0x1b, 0x35, 0x7e, 0xb3, 0xc4 } } + +// {E638D760-8687-11d2-B530-000000000002} +#define NS_RDFFINDDATASOURCE_CID \ +{ 0xe638d760, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x02 } } + +// {E638D761-8687-11d2-B530-000000000000} +#define NS_RDFCOMPOSITEDATASOURCE_CID \ +{ 0xe638d761, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } + +// {7BAF62E0-8E61-11d2-8EB1-00805F29F370} +#define NS_RDFXMLDATASOURCE_CID \ +{ 0x7baf62e0, 0x8e61, 0x11d2, { 0x8e, 0xb1, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } + +// {0958B101-9ADA-11d2-8EBC-00805F29F370} +#define NS_RDFCONTENTSINK_CID \ +{ 0x958b101, 0x9ada, 0x11d2, { 0x8e, 0xbc, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } } + +// {1EAAFD60-D596-11d2-80BE-006097B76B8E} +#define NS_RDFHISTORYDATASOURCE_CID \ +{ 0x1eaafd60, 0xd596, 0x11d2, { 0x80, 0xbe, 0x0, 0x60, 0x97, 0xb7, 0x6b, 0x8e } } + +// {D4214E92-FB94-11d2-BDD8-00104BDE6048} +#define NS_RDFCONTAINERUTILS_CID \ +{ 0xd4214e92, 0xfb94, 0x11d2, { 0xbd, 0xd8, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } } + +// {D4214E93-FB94-11d2-BDD8-00104BDE6048} +#define NS_RDFCONTAINER_CID \ +{ 0xd4214e93, 0xfb94, 0x11d2, { 0xbd, 0xd8, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } } + +// {0032d852-1dd2-11b2-95f7-e0a1910ed2da} +#define NS_RDFXMLSERIALIZER_CID \ +{ 0x0032d852, 0x1dd2, 0x11b2, { 0x95, 0xf7, 0xe0, 0xa1, 0x91, 0x0e, 0xd2, 0xda } } + +// {a4048e94-1dd1-11b2-a676-8a06c086cc7d} +#define NS_RDFXMLPARSER_CID \ +{ 0xa4048e94, 0x1dd1, 0x11b2, { 0xa6, 0x76, 0x8a, 0x06, 0xc0, 0x86, 0xcc, 0x7d } } + +// {0a5cd734-eb65-4d14-88a0-9f0bb2aba206} +#define NS_RDFNTRIPLES_SERIALIZER_CID \ +{ 0x0a5cd734, 0xeb65, 0x4d14, { 0x88, 0xa0, 0x9f, 0x0b, 0xb2, 0xab, 0xa2, 0x06 } } + +#endif // nsRDFCID_h__ diff --git a/rdf/build/nsRDFModule.cpp b/rdf/build/nsRDFModule.cpp new file mode 100644 index 000000000..d1af94bc0 --- /dev/null +++ b/rdf/build/nsRDFModule.cpp @@ -0,0 +1,159 @@ +/* -*- 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/. */ +#include "nsCOMPtr.h" +#include "mozilla/ModuleUtils.h" + +#include "nsIFactory.h" +#include "nsRDFService.h" +#include "nsIRDFContainer.h" +#include "nsIRDFContainerUtils.h" +#include "nsIRDFCompositeDataSource.h" +#include "nsIRDFContentSink.h" +#include "nsISupports.h" +#include "nsRDFBaseDataSources.h" +#include "nsRDFBuiltInDataSources.h" +#include "nsFileSystemDataSource.h" +#include "nsRDFCID.h" +#include "nsIComponentManager.h" +#include "rdf.h" +#include "nsIServiceManager.h" +#include "nsILocalStore.h" +#include "nsRDFXMLParser.h" +#include "nsRDFXMLSerializer.h" + +#include "rdfISerializer.h" + +//---------------------------------------------------------------------- + +// Functions used to create new instances of a given object by the +// generic factory. + +#define MAKE_CTOR(_func,_new,_ifname) \ +static nsresult \ +CreateNew##_func(nsISupports* aOuter, REFNSIID aIID, void **aResult) \ +{ \ + if (!aResult) { \ + return NS_ERROR_INVALID_POINTER; \ + } \ + if (aOuter) { \ + *aResult = nullptr; \ + return NS_ERROR_NO_AGGREGATION; \ + } \ + nsI##_ifname* inst; \ + nsresult rv = NS_New##_new(&inst); \ + if (NS_FAILED(rv)) { \ + *aResult = nullptr; \ + return rv; \ + } \ + rv = inst->QueryInterface(aIID, aResult); \ + if (NS_FAILED(rv)) { \ + *aResult = nullptr; \ + } \ + NS_RELEASE(inst); /* get rid of extra refcnt */ \ + return rv; \ +} + +extern nsresult +NS_NewDefaultResource(nsIRDFResource** aResult); + +MAKE_CTOR(RDFXMLDataSource,RDFXMLDataSource,RDFDataSource) +MAKE_CTOR(RDFCompositeDataSource,RDFCompositeDataSource,RDFCompositeDataSource) +MAKE_CTOR(RDFContainer,RDFContainer,RDFContainer) + +MAKE_CTOR(RDFContainerUtils,RDFContainerUtils,RDFContainerUtils) + +MAKE_CTOR(RDFContentSink,RDFContentSink,RDFContentSink) +MAKE_CTOR(RDFDefaultResource,DefaultResource,RDFResource) + +#define MAKE_RDF_CTOR(_func,_new,_ifname) \ +static nsresult \ +CreateNew##_func(nsISupports* aOuter, REFNSIID aIID, void **aResult) \ +{ \ + if (!aResult) { \ + return NS_ERROR_INVALID_POINTER; \ + } \ + if (aOuter) { \ + *aResult = nullptr; \ + return NS_ERROR_NO_AGGREGATION; \ + } \ + rdfI##_ifname* inst; \ + nsresult rv = NS_New##_new(&inst); \ + if (NS_FAILED(rv)) { \ + *aResult = nullptr; \ + return rv; \ + } \ + rv = inst->QueryInterface(aIID, aResult); \ + if (NS_FAILED(rv)) { \ + *aResult = nullptr; \ + } \ + NS_RELEASE(inst); /* get rid of extra refcnt */ \ + return rv; \ +} + +extern nsresult +NS_NewTriplesSerializer(rdfISerializer** aResult); + +MAKE_RDF_CTOR(TriplesSerializer, TriplesSerializer, Serializer) + +NS_DEFINE_NAMED_CID(NS_RDFCOMPOSITEDATASOURCE_CID); +NS_DEFINE_NAMED_CID(NS_RDFFILESYSTEMDATASOURCE_CID); +NS_DEFINE_NAMED_CID(NS_RDFINMEMORYDATASOURCE_CID); +NS_DEFINE_NAMED_CID(NS_RDFXMLDATASOURCE_CID); +NS_DEFINE_NAMED_CID(NS_RDFDEFAULTRESOURCE_CID); +NS_DEFINE_NAMED_CID(NS_RDFCONTENTSINK_CID); +NS_DEFINE_NAMED_CID(NS_RDFCONTAINER_CID); +NS_DEFINE_NAMED_CID(NS_RDFCONTAINERUTILS_CID); +NS_DEFINE_NAMED_CID(NS_RDFSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_RDFXMLPARSER_CID); +NS_DEFINE_NAMED_CID(NS_RDFXMLSERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_RDFNTRIPLES_SERIALIZER_CID); +NS_DEFINE_NAMED_CID(NS_LOCALSTORE_CID); + + +static const mozilla::Module::CIDEntry kRDFCIDs[] = { + { &kNS_RDFCOMPOSITEDATASOURCE_CID, false, nullptr, CreateNewRDFCompositeDataSource }, + { &kNS_RDFFILESYSTEMDATASOURCE_CID, false, nullptr, FileSystemDataSource::Create }, + { &kNS_RDFINMEMORYDATASOURCE_CID, false, nullptr, NS_NewRDFInMemoryDataSource }, + { &kNS_RDFXMLDATASOURCE_CID, false, nullptr, CreateNewRDFXMLDataSource }, + { &kNS_RDFDEFAULTRESOURCE_CID, false, nullptr, CreateNewRDFDefaultResource }, + { &kNS_RDFCONTENTSINK_CID, false, nullptr, CreateNewRDFContentSink }, + { &kNS_RDFCONTAINER_CID, false, nullptr, CreateNewRDFContainer }, + { &kNS_RDFCONTAINERUTILS_CID, false, nullptr, CreateNewRDFContainerUtils }, + { &kNS_RDFSERVICE_CID, false, nullptr, RDFServiceImpl::CreateSingleton }, + { &kNS_RDFXMLPARSER_CID, false, nullptr, nsRDFXMLParser::Create }, + { &kNS_RDFXMLSERIALIZER_CID, false, nullptr, nsRDFXMLSerializer::Create }, + { &kNS_RDFNTRIPLES_SERIALIZER_CID, false, nullptr, CreateNewTriplesSerializer }, + { &kNS_LOCALSTORE_CID, false, nullptr, NS_NewLocalStore }, + { nullptr } +}; + +static const mozilla::Module::ContractIDEntry kRDFContracts[] = { + { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "composite-datasource", &kNS_RDFCOMPOSITEDATASOURCE_CID }, + { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "files", &kNS_RDFFILESYSTEMDATASOURCE_CID }, + { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "in-memory-datasource", &kNS_RDFINMEMORYDATASOURCE_CID }, + { NS_RDF_DATASOURCE_CONTRACTID_PREFIX "xml-datasource", &kNS_RDFXMLDATASOURCE_CID }, + { NS_RDF_RESOURCE_FACTORY_CONTRACTID, &kNS_RDFDEFAULTRESOURCE_CID }, + { NS_RDF_CONTRACTID "/content-sink;1", &kNS_RDFCONTENTSINK_CID }, + { NS_RDF_CONTRACTID "/container;1", &kNS_RDFCONTAINER_CID }, + { NS_RDF_CONTRACTID "/container-utils;1", &kNS_RDFCONTAINERUTILS_CID }, + { NS_RDF_CONTRACTID "/rdf-service;1", &kNS_RDFSERVICE_CID }, + { NS_RDF_CONTRACTID "/xml-parser;1", &kNS_RDFXMLPARSER_CID }, + { NS_RDF_CONTRACTID "/xml-serializer;1", &kNS_RDFXMLSERIALIZER_CID }, + { NS_RDF_SERIALIZER "ntriples", &kNS_RDFNTRIPLES_SERIALIZER_CID }, + { NS_LOCALSTORE_CONTRACTID, &kNS_LOCALSTORE_CID }, + { nullptr } +}; + +static const mozilla::Module kRDFModule = { + mozilla::Module::kVersion, + kRDFCIDs, + kRDFContracts, + nullptr, + nullptr, + nullptr, + nullptr +}; + +NSMODULE_DEFN(nsRDFModule) = &kRDFModule; |