-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.cpp
More file actions
35 lines (28 loc) · 987 Bytes
/
base.cpp
File metadata and controls
35 lines (28 loc) · 987 Bytes
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
#include "base.hpp"
bool Base::abort_unsound = false;
bool Base::add_actions = true;
size_t Base::static_max_size;
std::optional <size_t> Base::max_size;
std::map <std::string, id_t> Unique::next_ids = {};
bool is_terminal_from_arg = false;
bool select_bool (const std::string &caption) {
static const auto l = { false, true };
static const auto l2 = { "false", "true" };
return select_element_caption (l, l2, caption);
}
// It is safe to return a reference because we never remove the
// printers from the internal map.
pprint::PrettyPrinter& get_printer (std::ostream& os) {
static std::map <std::ostream*, std::shared_ptr<pprint::PrettyPrinter>> m;
auto it = m.find (&os);
if (it != m.end ()) {
//std::cout << "Returning existing printer!" << std::endl;
return *it->second;
} else {
auto ptr = std::make_shared<pprint::PrettyPrinter> (os);
ptr->compact (true);
ptr->indent (0);
m.insert (std::make_pair (&os, ptr));
return *ptr;
}
}