Syndication

nodevisitor.h
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
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
15namespace Syndication
16{
17namespace RDF
18{
19//@cond PRIVATE
20class Literal;
21typedef QSharedPointer<Literal> LiteralPtr;
22class Node;
23typedef QSharedPointer<Node> NodePtr;
24class Property;
25typedef QSharedPointer<Property> PropertyPtr;
26class Resource;
27typedef QSharedPointer<Resource> ResourcePtr;
28class Sequence;
29typedef 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 */
41class NodeVisitor // krazy:exclude=dpointer
42{
43public:
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:42
virtual bool visitProperty(PropertyPtr property)
reimplement this method to handle properties.
virtual bool visitSequence(SequencePtr seq)
reimplement this method to handle sequences.
virtual bool visitNode(NodePtr node)
reimplement this method to handle nodes that weren't handled by the more specific method.
virtual bool visitLiteral(LiteralPtr)
reimplement this method to handle literals.
virtual void visit(NodePtr node)
call this method to handle a node.
virtual bool visitResource(ResourcePtr resource)
reimplement this method to handle resources.
virtual ~NodeVisitor()
destructor
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:15 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.