KHtml

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

KDE's Doxygen guidelines are available online.