ROSE 0.11.145.192
Formatter.h
1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_Formatter_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_BaseSemantics_Formatter_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
7#include <Rose/BinaryAnalysis/BasicTypes.h>
8
9#include <string>
10
11namespace Rose {
12namespace BinaryAnalysis {
13namespace InstructionSemantics {
14namespace BaseSemantics {
15
19class Formatter {
20protected:
22 bool suppress_initial_values = false;
23 std::string line_prefix;
24 std::string indentation_suffix = " ";
25 bool show_latest_writers = true;
26 bool show_properties = true;
27
28public:
29 virtual ~Formatter();
30
35
39 explicit Formatter(const std::string&);
40
53 bool get_suppress_initial_values() const { return suppress_initial_values; }
54 void set_suppress_initial_values(bool b=true) { suppress_initial_values=b; }
60 std::string get_line_prefix() const { return line_prefix; }
61 void set_line_prefix(const std::string &s) { line_prefix = s; }
66 std::string get_indentation_suffix() const { return indentation_suffix; }
67 void set_indentation_suffix(const std::string &s) { indentation_suffix = s; }
72 bool get_show_latest_writers() const { return show_latest_writers; }
73 void set_show_latest_writers(bool b=true) { show_latest_writers = b; }
74 void clear_show_latest_writers() { show_latest_writers = false; }
79 bool get_show_properties() const { return show_properties; }
80 void set_show_properties(bool b=true) { show_properties = b; }
81 void clear_show_properties() { show_properties = false; }
83};
84
88class Indent {
89private:
90 Formatter &fmt;
91 std::string old_line_prefix;
92public:
93 Indent(Formatter &fmt): fmt(fmt) {
94 old_line_prefix = fmt.get_line_prefix();
95 fmt.set_line_prefix(old_line_prefix + fmt.get_indentation_suffix());
96 }
97 ~Indent() {
98 fmt.set_line_prefix(old_line_prefix);
99 }
100};
101
102} // namespace
103} // namespace
104} // namespace
105} // namespace
106
107#endif
108#endif
Formatter(const std::string &)
Format for indentation.
RegisterDictionaryPtr registerDictionary() const
Property: Register dictionary.
void clear_show_latest_writers()
Whether to show latest writer information for register and memory states.
Definition Formatter.h:74
void set_line_prefix(const std::string &s)
The string to print at the start of each line.
Definition Formatter.h:61
void set_show_properties(bool b=true)
Whether to show register properties.
Definition Formatter.h:80
std::string get_line_prefix() const
The string to print at the start of each line.
Definition Formatter.h:60
void set_indentation_suffix(const std::string &s)
Indentation string appended to the line prefix for multi-level, multi-line outputs.
Definition Formatter.h:67
bool get_show_properties() const
Whether to show register properties.
Definition Formatter.h:79
bool get_show_latest_writers() const
Whether to show latest writer information for register and memory states.
Definition Formatter.h:72
bool get_suppress_initial_values() const
Whether register initial values should be suppressed.
Definition Formatter.h:53
std::string get_indentation_suffix() const
Indentation string appended to the line prefix for multi-level, multi-line outputs.
Definition Formatter.h:66
void set_suppress_initial_values(bool b=true)
Whether register initial values should be suppressed.
Definition Formatter.h:54
void clear_suppress_initial_values()
Whether register initial values should be suppressed.
Definition Formatter.h:55
void clear_show_properties()
Whether to show register properties.
Definition Formatter.h:81
void registerDictionary(const RegisterDictionaryPtr &)
Property: Register dictionary.
void set_show_latest_writers(bool b=true)
Whether to show latest writer information for register and memory states.
Definition Formatter.h:73
Adjusts a Formatter for one additional level of indentation.
Definition Formatter.h:88
Base classes for instruction semantics.
The ROSE library.