Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / xml / node-iterators.h
1 /*
2  * Node iterators
3  *
4  * Authors:
5  *   MenTaLguY <mental@rydia.net>
6  *
7  * Copyright (C) 2004 MenTaLguY
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef SEEN_INKSCAPE_XML_SP_REPR_ITERATORS_H
13 #define SEEN_INKSCAPE_XML_SP_REPR_ITERATORS_H
15 #include "util/forward-pointer-iterator.h"
16 #include "xml/node.h"
18 namespace Inkscape {
19 namespace XML {
21 struct NodeSiblingIteratorStrategy {
22     static Node const *next(Node const *node) {
23         return ( node ? node->next() : NULL );
24     }
25 };
27 struct NodeParentIteratorStrategy {
28     static Node const *next(Node const *node) {
29         return ( node ? node->parent() : NULL );
30     }
31 };
33 typedef Inkscape::Util::ForwardPointerIterator<Node,
34                                                NodeSiblingIteratorStrategy>
35         NodeSiblingIterator;
37 typedef Inkscape::Util::ForwardPointerIterator<Node const,
38                                                NodeSiblingIteratorStrategy>
39         NodeConstSiblingIterator;
41 typedef Inkscape::Util::ForwardPointerIterator<Node,
42                                                NodeParentIteratorStrategy>
43         NodeParentIterator;
45 typedef Inkscape::Util::ForwardPointerIterator<Node const,
46                                                NodeParentIteratorStrategy>
47         NodeConstParentIterator;
49 }
50 }
52 #endif
53 /*
54   Local Variables:
55   mode:c++
56   c-file-style:"stroustrup"
57   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
58   indent-tabs-mode:nil
59   fill-column:99
60   End:
61 */
62 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :