A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
svg/document.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_DOCUMENT_H_
2 #define GENESIS_UTILS_FORMATS_SVG_DOCUMENT_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
37 
38 #include <iosfwd>
39 #include <vector>
40 
41 namespace genesis {
42 namespace utils {
43 
44 // =================================================================================================
45 // Svg Document
46 // =================================================================================================
47 
49 {
50 public:
51 
52  // -------------------------------------------------------------
53  // Typedefs and Enums
54  // -------------------------------------------------------------
55 
57 
58  static std::string indentation_string;
59 
60  // -------------------------------------------------------------
61  // Constructors and Rule of Five
62  // -------------------------------------------------------------
63 
64  SvgDocument() = default;
65  ~SvgDocument() = default;
66 
67  SvgDocument( SvgDocument const& ) = default;
68  SvgDocument( SvgDocument&& ) = default;
69 
70  SvgDocument& operator= ( SvgDocument const& ) = default;
71  SvgDocument& operator= ( SvgDocument&& ) = default;
72 
73  // -------------------------------------------------------------
74  // Members
75  // -------------------------------------------------------------
76 
77  SvgBox bounding_box() const;
78 
79  void write( std::ostream& out ) const;
80 
86  self_type& add( SvgObject const& object );
87  self_type& add( SvgObject&& object );
88 
92  self_type& operator << ( SvgObject const& object );
93  self_type& operator << ( SvgObject&& object );
94 
95  // -------------------------------------------------------------
96  // Data Members
97  // -------------------------------------------------------------
98 
99 public:
100 
102 
103  std::vector< SvgDefinitions > defs;
104 
105 private:
106 
107  std::vector< SvgObject > content_;
108 
109 };
110 
111 } // namespace utils
112 } // namespace genesis
113 
114 #endif // include guard
std::vector< SvgDefinitions > defs
SvgDocument & operator=(SvgDocument const &)=default
self_type & add(SvgObject const &object)
Add an SvgObject to the document.
void write(std::ostream &out) const
Write the SvgDocument to an output stream.
SvgBox bounding_box() const
self_type & operator<<(SvgObject const &object)
Shortcut operator for add(), which allows an even more fluent interface.
static std::string indentation_string