Syndication

nodevisitor.h
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef SYNDICATION_RDF_NODEVISITOR_H
9 #define SYNDICATION_RDF_NODEVISITOR_H
10 
11 #include <QSharedPointer>
12 
13 #include <syndication_export.h>
14 
15 namespace Syndication
16 {
17 namespace RDF
18 {
19 //@cond PRIVATE
20 class Literal;
21 typedef QSharedPointer<Literal> LiteralPtr;
22 class Node;
23 typedef QSharedPointer<Node> NodePtr;
24 class Property;
25 typedef QSharedPointer<Property> PropertyPtr;
26 class Resource;
27 typedef QSharedPointer<Resource> ResourcePtr;
28 class Sequence;
29 typedef QSharedPointer<Sequence> SequencePtr;
30 //@endcond
31 
32 /**
33  * Visitor interface, following the Visitor design pattern. Use this if you
34  * want to process nodes and the way how to handle the nodes depends
35  * on it's concrete type (e.g. Resource or Literal).
36  *
37  * TODO: insert code example
38  *
39  * @author Frank Osterfeld
40  */
41 class SYNDICATION_EXPORT NodeVisitor // krazy:exclude=dpointer
42 {
43 public:
44  /**
45  * destructor
46  */
47  virtual ~NodeVisitor();
48 
49  /**
50  * call this method to handle a node. Depending on the concrete type
51  * of the node, a specialized visit method is called.
52  *
53  * @param node the node to process
54  */
55  virtual void visit(NodePtr node);
56 
57  /**
58  * reimplement this method to handle literals.
59  *
60  * @param item the literal to visit
61  * @return whether the visitor handled the literal.
62  * Reimplementations of this method must return @p true.
63  */
64  virtual bool visitLiteral(LiteralPtr);
65 
66  /**
67  * reimplement this method to handle nodes that weren't handled
68  * by the more specific method.
69  *
70  * @param node the node to visit
71  * @return whether the visitor handled the node.
72  * Reimplementations of this method must return @p true.
73  */
74  virtual bool visitNode(NodePtr node);
75 
76  /**
77  * reimplement this method to handle properties.
78  *
79  * @param property the property to visit
80  * @return whether the visitor handled the property.
81  * Reimplementations of this method must return @p true.
82  */
83  virtual bool visitProperty(PropertyPtr property);
84 
85  /**
86  * reimplement this method to handle resources.
87  *
88  * @param resource the resource to visit
89  * @return whether the visitor handled the resource.
90  * Reimplementations of this method must return @p true.
91  */
92  virtual bool visitResource(ResourcePtr resource);
93 
94  /**
95  * reimplement this method to handle sequences.
96  *
97  * @param seq the sequence to visit
98  * @return whether the visitor handled the sequence.
99  * Reimplementations of this method must return @p true.
100  */
101  virtual bool visitSequence(SequencePtr seq);
102 };
103 
104 } // namespace RDF
105 } // namespace Syndication
106 
107 #endif // SYNDICATION_RDF_NODEVISITOR_H
Visitor interface, following the Visitor design pattern.
Definition: nodevisitor.h:41
Property
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:57:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.