Connect++ 0.5.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
vic_strings.cpp
1/*
2
3Copyright © 2023-24 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#include "vic_strings.hpp"
26
27namespace unicode_symbols {
28 std::string LogSym::neg = std::string("\u00ac");
29 std::string LogSym::unicode_space = std::string("\u00a0");
30 std::string LogSym::or_sym = std::string("\u22c1");
31 std::string LogSym::and_sym = std::string("\u22c0");
32 std::string LogSym::true_sym = std::string("\u22a4");
33 std::string LogSym::false_sym = std::string("\u22a5");
34 std::string LogSym::forall = std::string("\u2200");
35 std::string LogSym::exists = std::string("\u2203");
36 std::string LogSym::ifthen = std::string("\u2192");
37 std::string LogSym::iff = std::string("\u2194");
38}
39//--------------------------------------------------------------
40namespace ansi_escape_colours {
41 uint8_t Colour::num_colours = 10;
42 std::string Colour::nocol = std::string("\033[0m");
43 std::string Colour::red = std::string("\033[38;5;9m");
44 std::string Colour::green = std::string("\033[38;5;10m");
45 std::string Colour::blue = std::string("\033[38;5;12m");
46 std::string Colour::lblue = std::string("\033[38;5;14m");
47 std::string Colour::orange = std::string("\033[38;5;208m");
48 std::string Colour::yellow = std::string("\033[38;5;11m");
49 std::string Colour::purple = std::string("\033[38;5;13m");
50 std::string Colour::grey = std::string("\033[38;5;242m");
51 std::string Colour::lgrey = std::string("\033[38;5;248m");
52
53 std::string Colour::name_to_string(const ColourName& name) {
54 switch(name) {
55 case ColourName::NOCOL:
56 return Colour::nocol;
57 break;
58 case ColourName::RED:
59 return Colour::red;
60 break;
61 case ColourName::GREEN:
62 return Colour::green;
63 break;
64 case ColourName::BLUE:
65 return Colour::blue;
66 break;
67 case ColourName::LBLUE:
68 return Colour::lblue;
69 break;
70 case ColourName::ORANGE:
71 return Colour::orange;
72 break;
73 case ColourName::YELLOW:
74 return Colour::yellow;
75 break;
76 case ColourName::PURPLE:
77 return Colour::purple;
78 break;
79 case ColourName::GREY:
80 return Colour::grey;
81 break;
82 case ColourName::LGREY:
83 return Colour::lgrey;
84 break;
85 default:
86 return Colour::nocol;
87 break;
88 }
89 }
90}
91//--------------------------------------------------------------
92namespace verbose_print {
93
94uint8_t VPrint::verbosity = 0;
95
96//--------------------------------------------------------------
106void VPrint::operator()(uint8_t v, const string& s, bool n, uint8_t nl) {
107 if (v <= verbosity) {
108 std::cout << s;
109 if (n) {
110 for (uint8_t i = 0; i < nl; i++) {
111 std::cout << std::endl;
112 }
113 }
114 }
115}
116//--------------------------------------------------------------
126void VPrint::operator()(uint8_t v, char* s, bool n, uint8_t nl) {
127 if (v <= verbosity) {
128 std::cout << s;
129 if (n) {
130 for (uint8_t i = 0; i < nl; i++) {
131 std::cout << std::endl;
132 }
133 }
134 }
135}
136//--------------------------------------------------------------
140void VPrint::nl(uint8_t v, uint8_t nl) {
141 if (v <= verbosity) {
142 for (uint8_t i = 0; i < nl; i++) {
143 std::cout << std::endl;
144 }
145 }
146}
147}
void nl(uint8_t, uint8_t=1)
void operator()(uint8_t, const string &, bool=false, uint8_t=1)
vic_string - "verbose/indented/coloured"