• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • xpath
step.h
Go to the documentation of this file.
1 /*
2  * step.h - Copyright 2005 Frerich Raabe <raabe@kde.org>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #ifndef STEP_H
26 #define STEP_H
27 
28 #include "predicate.h"
29 #include "util.h"
30 
31 #include <QList>
32 
33 #include <dom/dom_string.h>
34 
35 namespace DOM {
36  class NodeImpl;
37 }
38 
39 namespace khtml {
40 namespace XPath {
41 
42 class Step
43 {
44  public:
45  enum AxisType {
46  AncestorAxis=1, AncestorOrSelfAxis, AttributeAxis,
47  ChildAxis, DescendantAxis, DescendantOrSelfAxis,
48  FollowingAxis, FollowingSiblingAxis, NamespaceAxis,
49  ParentAxis, PrecedingAxis, PrecedingSiblingAxis,
50  SelfAxis
51  };
52 
53  static QString axisAsString( AxisType axis );
54 
55  Step();
56  Step( AxisType axis,
57  const DOM::DOMString &nodeTest,
58  const QList<Predicate *> &predicates = QList<Predicate *>() );
59  ~Step();
60 
61  DomNodeList evaluate( DOM::NodeImpl *context ) const;
62 
63  void optimize();
64  QString dump() const;
65 
66  private:
67  DomNodeList nodesInAxis( DOM::NodeImpl *context ) const;
68  DomNodeList nodeTestMatches( DOM::NodeImpl* ctx, const DomNodeList &nodes ) const;
69  DOM::DOMString namespaceFromNodetest( const DOM::DOMString &nodeTest ) const;
70  unsigned int primaryNodeType( AxisType axis ) const;
71 
72  // Original axis + nodetest specification
73  AxisType m_axis;
74  DOM::DOMString m_nodeTest;
75 
76  enum CompileState {
77  NotCompiled,
78  CompiledForHTML,
79  CompiledForXML
80  };
81 
82  mutable CompileState m_compileState;
83 
84  void compileNodeTest(bool htmlCompat) const;
85 
86  // Compiled nodetest information. We do this jit'ish due to the
87  // case sensitivity mess.
88  mutable enum {
89  NT_Star, // *
90  NT_LocalName, // NCName
91  NT_Namespace, // NCName:*
92  NT_QName, // Prefix:LocalName
93  NT_Comment, // 'comment'
94  NT_Text, // 'text'
95  NT_PI, // 'processing-instruction'
96  NT_AnyNode, // 'node'
97  NT_PI_Lit // 'processing-instruction' '(' Literal ')'
98  } m_nodeTestType;
99  mutable DOM::LocalName m_localName;
100  mutable DOM::NamespaceName m_namespace;
101  mutable DOM::DOMString m_piInfo;
102 
103  QList<Predicate *> m_predicates;
104 };
105 
106 } // namespace XPath
107 
108 } // namespace khtml
109 
110 
111 #endif // STEP_H
112 
113 // kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
dom_string.h
khtml::XPath::Step::PrecedingAxis
Definition: step.h:49
khtml::XPath::Step::AncestorOrSelfAxis
Definition: step.h:46
khtml::XPath::Step::dump
QString dump() const
Definition: step.cpp:476
khtml::XPath::Step::~Step
~Step()
Definition: step.cpp:124
khtml::XPath::Step::axisAsString
static QString axisAsString(AxisType axis)
Definition: step.cpp:91
QString
khtml::XPath::DomNodeList
SharedPtr< DOM::StaticNodeListImpl > DomNodeList
Definition: util.h:41
khtml::XPath::Step::optimize
void optimize()
Definition: step.cpp:469
khtml::XPath::Step::DescendantAxis
Definition: step.h:47
khtml::XPath::Step::ParentAxis
Definition: step.h:49
khtml::XPath::Step::evaluate
DomNodeList evaluate(DOM::NodeImpl *context) const
Definition: step.cpp:129
khtml::XPath::Step::Step
Step()
Definition: step.cpp:111
khtml::XPath::Step::FollowingAxis
Definition: step.h:48
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
khtml::XPath::Step::AncestorAxis
Definition: step.h:46
util.h
khtml::XPath::Step
Definition: step.h:42
khtml::XPath::Step::ChildAxis
Definition: step.h:47
khtml::XPath::Step::AttributeAxis
Definition: step.h:46
predicate.h
khtml::XPath::Step::SelfAxis
Definition: step.h:50
khtml::XPath::Step::NamespaceAxis
Definition: step.h:48
khtml::XPath::Step::DescendantOrSelfAxis
Definition: step.h:47
khtml::XPath::Step::AxisType
AxisType
Definition: step.h:45
khtml::XPath::Step::FollowingSiblingAxis
Definition: step.h:48
QList
khtml::XPath::Step::PrecedingSiblingAxis
Definition: step.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal