2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2001-03-23 07:39:31 +00:00
|
|
|
|
|
|
|
#ifndef nsRDFConMemberTestNode_h__
|
|
|
|
#define nsRDFConMemberTestNode_h__
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-08-14 07:59:59 +00:00
|
|
|
#include "nscore.h"
|
2001-03-23 07:39:31 +00:00
|
|
|
#include "nsRDFTestNode.h"
|
|
|
|
#include "nsIRDFDataSource.h"
|
2006-02-13 16:02:08 +00:00
|
|
|
#include "nsXULTemplateQueryProcessorRDF.h"
|
2001-03-23 07:39:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Rule network node that test if a resource is a member of an RDF
|
|
|
|
* container, or is ``contained'' by another resource that refers to
|
|
|
|
* it using a ``containment'' attribute.
|
|
|
|
*/
|
|
|
|
class nsRDFConMemberTestNode : public nsRDFTestNode
|
|
|
|
{
|
|
|
|
public:
|
2006-02-13 16:02:08 +00:00
|
|
|
nsRDFConMemberTestNode(TestNode* aParent,
|
|
|
|
nsXULTemplateQueryProcessorRDF* aProcessor,
|
|
|
|
nsIAtom* aContainerVariable,
|
|
|
|
nsIAtom* aMemberVariable);
|
2001-03-23 07:39:31 +00:00
|
|
|
|
2006-03-27 13:53:27 +00:00
|
|
|
virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool* aCantHandleYet) const MOZ_OVERRIDE;
|
2001-03-23 07:39:31 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool
|
2001-11-07 04:25:41 +00:00
|
|
|
CanPropagate(nsIRDFResource* aSource,
|
2001-03-23 07:39:31 +00:00
|
|
|
nsIRDFResource* aProperty,
|
|
|
|
nsIRDFNode* aTarget,
|
2013-05-29 20:43:41 +00:00
|
|
|
Instantiation& aInitialBindings) const MOZ_OVERRIDE;
|
2001-03-23 07:39:31 +00:00
|
|
|
|
|
|
|
virtual void
|
|
|
|
Retract(nsIRDFResource* aSource,
|
|
|
|
nsIRDFResource* aProperty,
|
2013-05-29 20:43:41 +00:00
|
|
|
nsIRDFNode* aTarget) const MOZ_OVERRIDE;
|
2001-03-23 07:39:31 +00:00
|
|
|
|
|
|
|
class Element : public MemoryElement {
|
2001-04-04 05:00:08 +00:00
|
|
|
public:
|
2001-03-23 07:39:31 +00:00
|
|
|
Element(nsIRDFResource* aContainer,
|
|
|
|
nsIRDFNode* aMember)
|
|
|
|
: mContainer(aContainer),
|
|
|
|
mMember(aMember) {
|
|
|
|
MOZ_COUNT_CTOR(nsRDFConMemberTestNode::Element); }
|
|
|
|
|
|
|
|
virtual ~Element() { MOZ_COUNT_DTOR(nsRDFConMemberTestNode::Element); }
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual const char* Type() const MOZ_OVERRIDE {
|
2001-03-23 07:39:31 +00:00
|
|
|
return "nsRDFConMemberTestNode::Element"; }
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual PLHashNumber Hash() const MOZ_OVERRIDE {
|
2001-08-14 07:59:59 +00:00
|
|
|
return PLHashNumber(NS_PTR_TO_INT32(mContainer.get())) ^
|
|
|
|
(PLHashNumber(NS_PTR_TO_INT32(mMember.get())) >> 12); }
|
2001-03-23 07:39:31 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual bool Equals(const MemoryElement& aElement) const MOZ_OVERRIDE {
|
2001-03-23 07:39:31 +00:00
|
|
|
if (aElement.Type() == Type()) {
|
2007-07-08 07:08:04 +00:00
|
|
|
const Element& element = static_cast<const Element&>(aElement);
|
2001-03-23 07:39:31 +00:00
|
|
|
return mContainer == element.mContainer && mMember == element.mMember;
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return false; }
|
2001-03-23 07:39:31 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIRDFResource> mContainer;
|
|
|
|
nsCOMPtr<nsIRDFNode> mMember;
|
|
|
|
};
|
|
|
|
|
|
|
|
protected:
|
2006-02-13 16:02:08 +00:00
|
|
|
nsXULTemplateQueryProcessorRDF* mProcessor;
|
|
|
|
nsCOMPtr<nsIAtom> mContainerVariable;
|
|
|
|
nsCOMPtr<nsIAtom> mMemberVariable;
|
2001-03-23 07:39:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsRDFConMemberTestNode_h__
|