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_EXPORT_VISITOR_H
0021 #define TIKZ_EXPORT_VISITOR_H
0022 
0023 #include "Visitor.h"
0024 #include "TikzExport.h"
0025 
0026 #include <QVector>
0027 #include <QString>
0028 
0029 namespace tikz {
0030 namespace core {
0031 
0032 class Document;
0033 class Style;
0034 class Node;
0035 class Path;
0036 
0037 /**
0038  * Visitor exporint the tikz::core::Document to PGF/TikZ.
0039  */
0040 class TikzExportVisitor : public Visitor
0041 {
0042     public:
0043         /**
0044          * Default constructor.
0045          */
0046         TikzExportVisitor();
0047 
0048         /**
0049          * Destructor
0050          */
0051         virtual ~TikzExportVisitor();
0052 
0053     //
0054     // extra functions
0055     //
0056     public:
0057         /**
0058          * Convert the tikz::core::Document to tikzCode.
0059          */
0060         QString tikzCode();
0061 
0062     //
0063     // Visitor pattern
0064     //
0065     public:
0066         /**
0067          * Serializes document @p doc document.
0068          */
0069         void visit(Document * doc) override;
0070 
0071         /**
0072          * Serializes @p node.
0073          */
0074         void visit(Node * node) override;
0075 
0076         /**
0077          * Serializes @p path.
0078          */
0079         void visit(Path * path) override;
0080 
0081         /**
0082          * Serializes @p style.
0083          */
0084         void visit(Style * style) override;
0085 
0086     //
0087     // helper functions
0088     //
0089     private:
0090         QStringList styleOptions(Style * style);
0091         QStringList edgeStyleOptions(Style * style);
0092         QStringList nodeStyleOptions(Style * style);
0093 
0094     //
0095     // private data
0096     //
0097     private:
0098         TikzExport m_tikzExport;
0099 };
0100 
0101 }
0102 }
0103 
0104 #endif // TIKZ_EXPORT_VISITOR_H
0105 
0106 // kate: indent-width 4; replace-tabs on;