Code

disable Rectangle and Ellipse (Bug 407394)
[inkscape.git] / src / xml / node-fns.h
1 /** @file
2  * @brief Helper functions for XML nodes
3  */
4 /* Authors:
5  *   Unknown author
6  *   Krzysztof KosiƄski <tweenk.pl@gmail.com> (documentation)
7  *
8  * Copyright 2008 Authors
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * See the file COPYING for details.
16  */
18 #ifndef SEEN_XML_NODE_FNS_H
19 #define SEEN_XML_NODE_FNS_H
21 #include "xml/node.h"
23 namespace Inkscape {
24 namespace XML {
26 bool id_permitted(Node const *node);
28 //@{
29 /**
30  * @brief Get the next node in sibling order
31  * @param node The origin node
32  * @return The next node in sibling order
33  * @relates Inkscape::XML::Node
34  */
35 inline Node *next_node(Node *node) {
36     return ( node ? node->next() : NULL );
37 }
38 inline Node const *next_node(Node const *node) {
39     return ( node ? node->next() : NULL );
40 }
41 //@}
43 //@{
44 /**
45  * @brief Get the previous node in sibling order
46  *
47  * This method, unlike Node::next(), is a linear search over the children of @c node's parent.
48  * The return value is NULL when the node has no parent or is first in the sibling order.
49  *
50  * @param node The origin node
51  * @return The previous node in sibling order, or NULL
52  * @relates Inkscape::XML::Node
53  */
54 Node *previous_node(Node *node);
55 inline Node const *previous_node(Node const *node) {
56     return previous_node(const_cast<Node *>(node));
57 }
58 //@}
60 //@{
61 /**
62  * @brief Get the node's parent
63  * @param node The origin node
64  * @return The node's parent
65  * @relates Inkscape::XML::Node
66  */
67 inline Node *parent_node(Node *node) {
68     return ( node ? node->parent() : NULL );
69 }
70 inline Node const *parent_node(Node const *node) {
71     return ( node ? node->parent() : NULL );
72 }
73 //@}
75 }
76 }
78 #endif /* !SEEN_XML_NODE_FNS_H */
79 /*
80   Local Variables:
81   mode:c++
82   c-file-style:"stroustrup"
83   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84   indent-tabs-mode:nil
85   fill-column:99
86   End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :