michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsXULTemplateResultRDF_h__ michael@0: #define nsXULTemplateResultRDF_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIRDFResource.h" michael@0: #include "nsXULTemplateQueryProcessorRDF.h" michael@0: #include "nsRDFQuery.h" michael@0: #include "nsRuleNetwork.h" michael@0: #include "nsIXULTemplateResult.h" michael@0: #include "nsRDFBinding.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: /** michael@0: * A single result of a query on an RDF graph michael@0: */ michael@0: class nsXULTemplateResultRDF MOZ_FINAL : public nsIXULTemplateResult michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(nsXULTemplateResultRDF) michael@0: michael@0: NS_DECL_NSIXULTEMPLATERESULT michael@0: michael@0: nsXULTemplateResultRDF(nsIRDFResource* aNode); michael@0: michael@0: nsXULTemplateResultRDF(nsRDFQuery* aQuery, michael@0: const Instantiation& aInst, michael@0: nsIRDFResource* aNode); michael@0: michael@0: ~nsXULTemplateResultRDF(); michael@0: michael@0: nsITemplateRDFQuery* Query() { return mQuery; } michael@0: michael@0: nsXULTemplateQueryProcessorRDF* GetProcessor() michael@0: { michael@0: return (mQuery ? mQuery->Processor() : nullptr); michael@0: } michael@0: michael@0: /** michael@0: * Get the value of a variable, first by looking in the assignments and michael@0: * then the bindings michael@0: */ michael@0: void michael@0: GetAssignment(nsIAtom* aVar, nsIRDFNode** aValue); michael@0: michael@0: /** michael@0: * Synchronize the bindings after a change in the RDF graph. Bindings that michael@0: * would be affected will be assigned appropriately based on the change. michael@0: */ michael@0: bool michael@0: SyncAssignments(nsIRDFResource* aSubject, michael@0: nsIRDFResource* aPredicate, michael@0: nsIRDFNode* aTarget); michael@0: michael@0: /** michael@0: * Return true if the result has an instantiation involving a particular michael@0: * memory element. michael@0: */ michael@0: bool michael@0: HasMemoryElement(const MemoryElement& aMemoryElement); michael@0: michael@0: protected: michael@0: michael@0: // query that generated the result michael@0: nsCOMPtr mQuery; michael@0: michael@0: // resource node michael@0: nsCOMPtr mNode; michael@0: michael@0: // data computed from query michael@0: Instantiation mInst; michael@0: michael@0: // extra assignments made by rules ( tags) michael@0: nsBindingValues mBindingValues; michael@0: }; michael@0: michael@0: #endif // nsXULTemplateResultRDF_h__