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

KHTML

  • khtml
  • xpath
util.h
Go to the documentation of this file.
1/*
2 * util.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 UTIL_H
26#define UTIL_H
27
28#include <QList>
29#include <misc/shared.h>
30#include <dom/dom_string.h>
31
32namespace DOM {
33 class NodeImpl;
34 class StaticNodeListImpl;
35}
36
37namespace khtml {
38namespace XPath {
39
40// ### removeme
41typedef SharedPtr<DOM::StaticNodeListImpl> DomNodeList;
42
43
44/* @return whether the given node is the root node.
45 */
46bool isRootDomNode( DOM::NodeImpl *node );
47
48/* @return the 'string-value' of the given node as specified by
49 http://www.w3.org/TR/xpath
50 */
51DOM::DOMString stringValue( DOM::NodeImpl *node );
52
53/* @return append all descendant nodes of the given node, in document order,
54 to the given set
55 */
56void collectChildrenRecursively( SharedPtr<DOM::StaticNodeListImpl> out,
57 DOM::NodeImpl *root );
58
59/* this one is in reverse order */
60void collectChildrenReverse( SharedPtr<DOM::StaticNodeListImpl> out,
61 DOM::NodeImpl *root );
62
63/* @return whether the given node is a valid context node
64 */
65bool isValidContextNode( DOM::NodeImpl *node );
66
67/* @returns the parent node of the given node under the XPath model
68 (which has some additional links that DOM doesn't
69*/
70DOM::NodeImpl *xpathParentNode( DOM::NodeImpl *node );
71
72/* @returns the first/last kid of the given node under the XPath model,
73 which doesn't have text nodes or the likes under attributes
74*/
75DOM::NodeImpl *xpathFirstChild( DOM::NodeImpl *node );
76DOM::NodeImpl *xpathLastChild( DOM::NodeImpl *node );
77
78/* @returns a slightly generalized notion of a sibling needed to implement
79 the following axis. Essentially, for that axis, and only that axis,
80 if we have something like this:
81 <node attr1 attr2><kid></node>
82 the <kid> is considered to be the next thing following attr1
83*/
84DOM::NodeImpl *nextSiblingForFollowing( DOM::NodeImpl *node );
85
86// Enable for some low debug output.
87// #define XPATH_VERBOSE
88
89
90} // namespace XPath
91
92} // namespace khtml
93
94
95#endif // UTIL_H
96
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
dom_string.h
DOM
This library provides a full-featured HTML parser and widget.
Definition: design.h:55
khtml::XPath::collectChildrenReverse
void collectChildrenReverse(SharedPtr< DOM::StaticNodeListImpl > out, DOM::NodeImpl *root)
Definition: util.cpp:86
khtml::XPath::xpathFirstChild
DOM::NodeImpl * xpathFirstChild(DOM::NodeImpl *node)
Definition: util.cpp:124
khtml::XPath::isRootDomNode
bool isRootDomNode(NodeImpl *node)
Definition: util.cpp:35
khtml::XPath::xpathParentNode
DOM::NodeImpl * xpathParentNode(DOM::NodeImpl *node)
Definition: util.cpp:112
khtml::XPath::stringValue
DOMString stringValue(NodeImpl *node)
Definition: util.cpp:68
khtml::XPath::nextSiblingForFollowing
DOM::NodeImpl * nextSiblingForFollowing(DOM::NodeImpl *node)
Definition: util.cpp:140
khtml::XPath::xpathLastChild
DOM::NodeImpl * xpathLastChild(DOM::NodeImpl *node)
Definition: util.cpp:132
khtml::XPath::isValidContextNode
bool isValidContextNode(NodeImpl *node)
Definition: util.cpp:99
khtml::XPath::collectChildrenRecursively
void collectChildrenRecursively(SharedPtr< DOM::StaticNodeListImpl > out, DOM::NodeImpl *root)
Definition: util.cpp:73
khtml::XPath::DomNodeList
SharedPtr< DOM::StaticNodeListImpl > DomNodeList
Definition: util.h:41
khtml
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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