content/xul/templates/src/nsRDFPropertyTestNode.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsRDFPropertyTestNode_h__
michael@0 7 #define nsRDFPropertyTestNode_h__
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nscore.h"
michael@0 11 #include "nsRDFTestNode.h"
michael@0 12 #include "nsIRDFDataSource.h"
michael@0 13 #include "nsIRDFResource.h"
michael@0 14 #include "nsXULTemplateQueryProcessorRDF.h"
michael@0 15
michael@0 16 class nsRDFPropertyTestNode : public nsRDFTestNode
michael@0 17 {
michael@0 18 public:
michael@0 19 /**
michael@0 20 * Both source and target unbound (?source ^property ?target)
michael@0 21 */
michael@0 22 nsRDFPropertyTestNode(TestNode* aParent,
michael@0 23 nsXULTemplateQueryProcessorRDF* aProcessor,
michael@0 24 nsIAtom* aSourceVariable,
michael@0 25 nsIRDFResource* aProperty,
michael@0 26 nsIAtom* aTargetVariable);
michael@0 27
michael@0 28 /**
michael@0 29 * Source bound, target unbound (source ^property ?target)
michael@0 30 */
michael@0 31 nsRDFPropertyTestNode(TestNode* aParent,
michael@0 32 nsXULTemplateQueryProcessorRDF* aProcessor,
michael@0 33 nsIRDFResource* aSource,
michael@0 34 nsIRDFResource* aProperty,
michael@0 35 nsIAtom* aTargetVariable);
michael@0 36
michael@0 37 /**
michael@0 38 * Source unbound, target bound (?source ^property target)
michael@0 39 */
michael@0 40 nsRDFPropertyTestNode(TestNode* aParent,
michael@0 41 nsXULTemplateQueryProcessorRDF* aProcessor,
michael@0 42 nsIAtom* aSourceVariable,
michael@0 43 nsIRDFResource* aProperty,
michael@0 44 nsIRDFNode* aTarget);
michael@0 45
michael@0 46 virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations,
michael@0 47 bool* aCantHandleYet) const MOZ_OVERRIDE;
michael@0 48
michael@0 49 virtual bool
michael@0 50 CanPropagate(nsIRDFResource* aSource,
michael@0 51 nsIRDFResource* aProperty,
michael@0 52 nsIRDFNode* aTarget,
michael@0 53 Instantiation& aInitialBindings) const MOZ_OVERRIDE;
michael@0 54
michael@0 55 virtual void
michael@0 56 Retract(nsIRDFResource* aSource,
michael@0 57 nsIRDFResource* aProperty,
michael@0 58 nsIRDFNode* aTarget) const MOZ_OVERRIDE;
michael@0 59
michael@0 60
michael@0 61 class Element : public MemoryElement {
michael@0 62 public:
michael@0 63 Element(nsIRDFResource* aSource,
michael@0 64 nsIRDFResource* aProperty,
michael@0 65 nsIRDFNode* aTarget)
michael@0 66 : mSource(aSource),
michael@0 67 mProperty(aProperty),
michael@0 68 mTarget(aTarget) {
michael@0 69 MOZ_COUNT_CTOR(nsRDFPropertyTestNode::Element); }
michael@0 70
michael@0 71 virtual ~Element() { MOZ_COUNT_DTOR(nsRDFPropertyTestNode::Element); }
michael@0 72
michael@0 73 virtual const char* Type() const MOZ_OVERRIDE {
michael@0 74 return "nsRDFPropertyTestNode::Element"; }
michael@0 75
michael@0 76 virtual PLHashNumber Hash() const MOZ_OVERRIDE {
michael@0 77 return mozilla::HashGeneric(mSource.get(), mProperty.get(), mTarget.get());
michael@0 78 }
michael@0 79
michael@0 80 virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE {
michael@0 81 if (aElement.Type() == Type()) {
michael@0 82 const Element& element = static_cast<const Element&>(aElement);
michael@0 83 return mSource == element.mSource
michael@0 84 && mProperty == element.mProperty
michael@0 85 && mTarget == element.mTarget;
michael@0 86 }
michael@0 87 return false; }
michael@0 88
michael@0 89 protected:
michael@0 90 nsCOMPtr<nsIRDFResource> mSource;
michael@0 91 nsCOMPtr<nsIRDFResource> mProperty;
michael@0 92 nsCOMPtr<nsIRDFNode> mTarget;
michael@0 93 };
michael@0 94
michael@0 95 protected:
michael@0 96 nsXULTemplateQueryProcessorRDF* mProcessor;
michael@0 97 nsCOMPtr<nsIAtom> mSourceVariable;
michael@0 98 nsCOMPtr<nsIRDFResource> mSource;
michael@0 99 nsCOMPtr<nsIRDFResource> mProperty;
michael@0 100 nsCOMPtr<nsIAtom> mTargetVariable;
michael@0 101 nsCOMPtr<nsIRDFNode> mTarget;
michael@0 102 };
michael@0 103
michael@0 104 #endif // nsRDFPropertyTestNode_h__

mercurial