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.

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

mercurial