UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
LatexExporter.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef LATEXEXPORTER_H_
21 #define LATEXEXPORTER_H_
22 
23 #include "../graphs/GTS.h"
24 #include "GraphDrawer.h"
25 #include <fstream>
26 
27 namespace uncover {
28  namespace io {
29 
35  class LatexExporter {
36 
37  public:
38 
43  enum TargetType {
45  PS,
47  PDF};
48 
52  LatexExporter();
53 
57  virtual ~LatexExporter();
58 
69  void writeToLatex(graphs::GTS const& gts,
70  string filename,
71  LatexExporter::TargetType target = TargetType::PDF,
72  unordered_map<IDType, IDType> const* ruleIDSubs = nullptr,
73  unordered_map<IDType, IDType> const* graphIDSubs = nullptr) const;
74 
85  void writeToLatex(vector<graphs::Hypergraph_sp> const& graphs,
86  string filename,
87  LatexExporter::TargetType target = TargetType::PDF,
88  unordered_map<IDType, IDType> const* nameSubs = nullptr) const;
89 
94  void setScale(double scale);
95 
100  double getScale() const;
101 
106  void setCompilation(bool compile);
107 
112  bool willCompile() const;
113 
114  private:
115 
129  void writeToLatex(graphs::GTS const* gts,
130  vector<graphs::Hypergraph_sp> const* graphs,
131  string filename,
133  unordered_map<IDType, IDType> const* ruleIDSubs,
134  unordered_map<IDType, IDType> const* graphIDSubs) const;
135 
142  void writeLatexHeader(std::ofstream& of) const;
143 
154  void writeLatexAndGraphs(vector<graphs::Hypergraph_sp> const& graphs,
155  std::ofstream& of,
156  string filename,
158  unordered_map<IDType, IDType> const* nameSubs) const;
159 
171  void writeLatexBody(graphs::GTS const& gts,
172  std::ofstream& of,
173  string filename,
174  string ext,
175  unordered_map<IDType, IDType> const* ruleIDSubs,
176  unordered_map<IDType, IDType> const* graphIDSubs) const;
177 
185  void writeGraphs(graphs::GTS const& gts, string filename, GraphDrawer::PictureFormat format) const;
186 
192  string getNameOrNoName(string name) const;
193 
197  double scale;
198 
202  bool compile;
203 
204  };
205 
206  } /* namespace io */
207 } /* namespace uncover */
208 
209 #endif /* LATEXEXPORTER_H_ */
void writeLatexHeader(std::ofstream &of) const
Writes the header information of the Latex document (the preamble) to the given filestream.
Definition: LatexExporter.cpp:136
bool compile
Stores whether the generated Latex file will be compiled or not.
Definition: LatexExporter.h:202
PictureFormat
This enumeration specifies all supported picture formats.
Definition: GraphDrawer.h:44
void writeLatexBody(graphs::GTS const &gts, std::ofstream &of, string filename, string ext, unordered_map< IDType, IDType > const *ruleIDSubs, unordered_map< IDType, IDType > const *graphIDSubs) const
Writes the body (including {document} and {document} to the given filestream.
Definition: LatexExporter.cpp:224
void writeLatexAndGraphs(vector< graphs::Hypergraph_sp > const &graphs, std::ofstream &of, string filename, GraphDrawer::PictureFormat format, unordered_map< IDType, IDType > const *nameSubs) const
Creates an image file for each graph in the collection and writes a Latex file including these graphs...
Definition: LatexExporter.cpp:147
void writeToLatex(graphs::GTS const &gts, string filename, LatexExporter::TargetType target=TargetType::PDF, unordered_map< IDType, IDType > const *ruleIDSubs=nullptr, unordered_map< IDType, IDType > const *graphIDSubs=nullptr) const
Creates (and compiles if not deactivated) a Latex file representing the given GTS.
Definition: LatexExporter.cpp:57
pdf file format.
Definition: LatexExporter.h:47
TargetType
This Enumeration Type specifies for which resulting file formats the Latex file will be generated and...
Definition: LatexExporter.h:43
void writeGraphs(graphs::GTS const &gts, string filename, GraphDrawer::PictureFormat format) const
Creates an image file for each graph stored in the given gts object.
Definition: LatexExporter.cpp:388
virtual ~LatexExporter()
Destroys this instance of a LatexExporter.
Definition: LatexExporter.cpp:39
string getNameOrNoName(string name) const
Returns either the string or <noname> if the string was empty.
Definition: LatexExporter.cpp:520
Postscript file format.
Definition: LatexExporter.h:45
void setScale(double scale)
Sets a scaling factor for all images.
Definition: LatexExporter.cpp:41
void setCompilation(bool compile)
Sets whether the Latex file should be compiled after its generation or not.
Definition: LatexExporter.cpp:49
bool willCompile() const
Returns whether the Latex file will be compiled after its generation.
Definition: LatexExporter.cpp:53
Provides a possibility to generate Latex files from GTS objects or graph sets.
Definition: LatexExporter.h:35
The GTS class is the data structure for a graph transformation system.
Definition: GTS.h:36
double scale
Stores a scaling factor used when including the image files.
Definition: LatexExporter.h:197
double getScale() const
Returns the scaling factor currently used.
Definition: LatexExporter.cpp:45
LatexExporter()
Generates a new LatexExporter with default values.
Definition: LatexExporter.cpp:37