-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprinter.hpp
95 lines (72 loc) · 2.19 KB
/
printer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
isl-cpp: C++ bindings to the ISL (Integer Set Library)
Copyright (C) 2014 Jakob Leben <jakob.leben@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ISL_CPP_PRINTER_INCLUDED
#define ISL_CPP_PRINTER_INCLUDED
#include "context.hpp"
#include <isl/printer.h>
#include <memory>
#include <iostream>
namespace isl {
class printer
{
public:
enum format
{
isl_format = ISL_FORMAT_ISL,
c_format = ISL_FORMAT_C,
omega_format = ISL_FORMAT_OMEGA,
polylib_format = ISL_FORMAT_POLYLIB,
ext_polylib_format = ISL_FORMAT_EXT_POLYLIB,
latex_format = ISL_FORMAT_LATEX
};
enum yaml_style
{
yaml_block_style = ISL_YAML_STYLE_BLOCK,
yaml_flow_style = ISL_YAML_STYLE_FLOW
};
printer(const context & ctx):
m_ctx(ctx)
{
m_printer = isl_printer_to_file(ctx.get(), stdout);
}
printer(const printer & other) = delete;
~printer()
{
isl_printer_free(m_printer);
}
isl_printer *get() const { return m_printer; }
format current_format() const
{
return (format) isl_printer_get_output_format(m_printer);
}
void set_format(format f)
{
m_printer = isl_printer_set_output_format(m_printer, f);
}
void set_yaml_style(yaml_style s)
{
m_printer = isl_printer_set_yaml_style(m_printer, s);
}
template <typename T>
void print( const T & );
template <typename T>
void print_each_in(const T &);
private:
isl_printer *m_printer;
context m_ctx;
};
}
#endif // ISL_CPP_PRINTER_INCLUDED