souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
37 assert(
width > 0 &&
height > 0 &&
"wrong dimensions");
47 void write(uint32_t x, uint32_t y,
const std::string& s) {
48 assert(x <
width &&
"wrong x dimension");
49 assert(y <
height &&
"wrong y dimension");
50 assert(x + s.length() <=
width &&
"string too long");
51 for (
size_t i = 0;
i < s.length();
i++) {
63 void print(std::ostream& os) {
113 virtual void printJSON(std::ostream& os,
int pos) = 0;
134 children.push_back(std::move(child));
138 void place(uint32_t x, uint32_t y)
override {
140 assert(!
children.empty() &&
"no children");
151 x +=
k->getWidth() + 1;
152 width +=
k->getWidth() + 1;
164 void render(ScreenBuffer& s)
override {
166 for (
const Own<TreeNode>&
k :
children) {
169 std::string separator(
width -
label.length(),
'-');
175 void printJSON(std::ostream& os,
int pos)
override {
176 std::string tab(pos,
'\t');
177 os << tab << R
"({ "premises": ")" << stringify(txt) << "\",\n";
178 os << tab << R
"( "rule-number": ")" << label << "\",\n";
179 os << tab <<
" \"children\": [\n";
187 k->printJSON(os, pos + 1);
201 class LeafNode :
public TreeNode {
208 void place(uint32_t x, uint32_t y)
override {
221 void printJSON(std::ostream& os,
int pos)
override {
222 std::string tab(pos,
'\t');
223 os << tab << R
"({ "axiom": ")" << stringify(txt) << "\"}";
void render(ScreenBuffer &s) override
void printJSON(std::ostream &os, int pos) override
void write(uint32_t x, uint32_t y, const std::string &s)
void place(uint32_t x, uint32_t y) override
void print(std::ostream &os)
TreeNode(std::string t="")
std::string stringify(const std::string &input)
Stringify a string using escapes for escape, newline, tab, double-quotes and semicolons.
virtual void render(ScreenBuffer &s)=0
void add_child(Own< TreeNode > child)
virtual void printJSON(std::ostream &os, int pos)=0
virtual ~TreeNode()=default
VecOwn< TreeNode > children
LeafNode(const std::string &t="")
uint32_t getHeight() const
uint32_t getWidth() const
void place(uint32_t x, uint32_t y) override
InnerNode(const std::string &nodeText="", std::string label="")
void render(ScreenBuffer &s) override
ScreenBuffer(uint32_t w, uint32_t h)
virtual void place(uint32_t xpos, uint32_t ypos)=0
void printJSON(std::ostream &os, int pos) override
class souffle::profile::Tui ss