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

KHTML

step.h

Go to the documentation of this file.
00001 /*
00002  * step.h - Copyright 2005 Frerich Raabe <raabe@kde.org>
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00015  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00016  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00017  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00018  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00019  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00020  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00021  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00023  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024  */
00025 #ifndef STEP_H
00026 #define STEP_H
00027 
00028 #include "predicate.h"
00029 #include "util.h"
00030 
00031 #include <QList>
00032 
00033 #include <dom/dom_string.h>
00034 
00035 namespace DOM {
00036     class NodeImpl;
00037 }
00038 
00039 namespace khtml {
00040 namespace XPath {
00041 
00042 class Step
00043 {
00044     public:
00045         enum AxisType {
00046             AncestorAxis=1, AncestorOrSelfAxis, AttributeAxis,
00047             ChildAxis, DescendantAxis, DescendantOrSelfAxis,
00048             FollowingAxis, FollowingSiblingAxis, NamespaceAxis,
00049             ParentAxis, PrecedingAxis, PrecedingSiblingAxis,
00050             SelfAxis
00051         };
00052 
00053         static QString axisAsString( AxisType axis );
00054 
00055         Step();
00056         Step( AxisType axis,
00057               const DOM::DOMString &nodeTest,
00058               const QList<Predicate *> &predicates = QList<Predicate *>() );
00059         ~Step();
00060 
00061         DomNodeList evaluate( DOM::NodeImpl *context ) const;
00062 
00063         void optimize();
00064         QString dump() const;
00065 
00066     private:
00067         DomNodeList nodesInAxis( DOM::NodeImpl *context ) const;
00068         DomNodeList nodeTestMatches( DOM::NodeImpl* ctx, const DomNodeList &nodes ) const;
00069         DOM::DOMString namespaceFromNodetest( const DOM::DOMString &nodeTest ) const;
00070         unsigned int primaryNodeType( AxisType axis ) const;
00071 
00072         // Original axis + nodetest specification
00073         AxisType m_axis;
00074         DOM::DOMString m_nodeTest;
00075 
00076         enum CompileState {
00077             NotCompiled,
00078             CompiledForHTML,
00079             CompiledForXML
00080         };
00081 
00082         mutable CompileState m_compileState;
00083 
00084         void compileNodeTest(bool htmlCompat) const;
00085 
00086         // Compiled nodetest information. We do this jit'ish due to the
00087         // case sensitivity mess.
00088         mutable enum {
00089             NT_Star,        // *
00090             NT_LocalName,   // NCName
00091             NT_Namespace,   // NCName:*
00092             NT_QName,       // Prefix:LocalName
00093             NT_Comment,     // 'comment'
00094             NT_Text,        // 'text'
00095             NT_PI,          // 'processing-instruction'
00096             NT_AnyNode,     // 'node'
00097             NT_PI_Lit       // 'processing-instruction' '(' Literal ')'
00098         } m_nodeTestType;
00099         mutable DOM::LocalName     m_localName;
00100         mutable DOM::NamespaceName m_namespace;
00101         mutable DOM::DOMString m_piInfo;
00102 
00103         QList<Predicate *> m_predicates;
00104 };
00105 
00106 } // namespace XPath
00107 
00108 } // namespace khtml
00109 
00110 
00111 #endif // STEP_H
00112 
00113 // kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;

KHTML

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal