File indexing completed on 2024-05-12 04:35:07

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU Library General Public License as published
0007  * by the Free Software Foundation, either version 2 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, see
0017  * <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef TIKZ_VISITOR_H
0021 #define TIKZ_VISITOR_H
0022 
0023 #include "tikz_export.h"
0024 
0025 namespace tikz {
0026 namespace core {
0027 
0028 class Document;
0029 class Style;
0030 class Node;
0031 class Path;
0032 
0033 /**
0034  * Visitor pattern.
0035  * Visits all elements of a tikz::document.
0036  */
0037 class TIKZKITCORE_EXPORT Visitor
0038 {
0039     public:
0040         /**
0041          * Default constructor.
0042          */
0043         Visitor();
0044 
0045         /**
0046          * Destructor
0047          */
0048         virtual ~Visitor();
0049 
0050     //
0051     // Visitor pattern
0052     //
0053     public:
0054         /**
0055          * This function is called exactly once for the tikz::core::Document
0056          * of the tikz::core::Document.
0057          */
0058         virtual void visit(tikz::core::Document * doc) = 0;
0059 
0060         /**
0061          * This function is called for every tikz::core::Node in the document.
0062          */
0063         virtual void visit(tikz::core::Node * node) = 0;
0064 
0065         /**
0066          * This function is called for every tikz::core::Path in the document.
0067          */
0068         virtual void visit(tikz::core::Path * path) = 0;
0069 
0070         /**
0071          * This function is called for every tikz::core::Style in the document.
0072          */
0073         virtual void visit(tikz::core::Style * style) = 0;
0074 };
0075 
0076 }
0077 }
0078 
0079 #endif // TIKZ_VISITOR_H
0080 
0081 // kate: indent-width 4; replace-tabs on;