nsContentTestNode.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/. */
  5. #ifndef nsContentTestNode_h__
  6. #define nsContentTestNode_h__
  7. #include "mozilla/Attributes.h"
  8. #include "nscore.h"
  9. #include "nsRuleNetwork.h"
  10. #include "nsIAtom.h"
  11. #include "nsIDOMDocument.h"
  12. class nsXULTemplateQueryProcessorRDF;
  13. /**
  14. * The nsContentTestNode is always the top node in a query's rule network. It
  15. * exists so that Constrain can filter out resources that aren't part of a
  16. * result.
  17. */
  18. class nsContentTestNode : public TestNode
  19. {
  20. public:
  21. nsContentTestNode(nsXULTemplateQueryProcessorRDF* aProcessor,
  22. nsIAtom* aContentVariable);
  23. virtual nsresult FilterInstantiations(InstantiationSet& aInstantiations,
  24. bool* aCantHandleYet) const override;
  25. nsresult
  26. Constrain(InstantiationSet& aInstantiations) override;
  27. void SetTag(nsIAtom* aTag, nsIDOMDocument* aDocument)
  28. {
  29. mTag = aTag;
  30. mDocument = aDocument;
  31. }
  32. protected:
  33. nsXULTemplateQueryProcessorRDF *mProcessor;
  34. nsIDOMDocument* mDocument;
  35. nsCOMPtr<nsIAtom> mRefVariable;
  36. nsCOMPtr<nsIAtom> mTag;
  37. };
  38. #endif // nsContentTestNode_h__