ROSE  0.11.101.0
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/Types.h>
7 #include <Rose/BinaryAnalysis/BasicTypes.h>
8 
9 namespace Rose {
10 namespace BinaryAnalysis {
11 namespace InstructionSemantics {
12 namespace BaseSemantics {
13 
17 class Formatter {
18 public:
19  Formatter();
20  virtual ~Formatter();
21 
34  bool get_suppress_initial_values() const { return suppress_initial_values; }
35  void set_suppress_initial_values(bool b=true) { suppress_initial_values=b; }
41  std::string get_line_prefix() const { return line_prefix; }
42  void set_line_prefix(const std::string &s) { line_prefix = s; }
47  std::string get_indentation_suffix() const { return indentation_suffix; }
48  void set_indentation_suffix(const std::string &s) { indentation_suffix = s; }
53  bool get_show_latest_writers() const { return show_latest_writers; }
54  void set_show_latest_writers(bool b=true) { show_latest_writers = b; }
55  void clear_show_latest_writers() { show_latest_writers = false; }
60  bool get_show_properties() const { return show_properties; }
61  void set_show_properties(bool b=true) { show_properties = b; }
62  void clear_show_properties() { show_properties = false; }
65 protected:
66  RegisterDictionaryPtr regdict;
67  bool suppress_initial_values;
68  std::string line_prefix;
69  std::string indentation_suffix;
70  bool show_latest_writers;
71  bool show_properties;
72 };
73 
77 class Indent {
78 private:
79  Formatter &fmt;
80  std::string old_line_prefix;
81 public:
82  Indent(Formatter &fmt): fmt(fmt) {
83  old_line_prefix = fmt.get_line_prefix();
84  fmt.set_line_prefix(old_line_prefix + fmt.get_indentation_suffix());
85  }
86  ~Indent() {
87  fmt.set_line_prefix(old_line_prefix);
88  }
89 };
90 
91 } // namespace
92 } // namespace
93 } // namespace
94 } // namespace
95 
96 #endif
97 #endif
Base classes for instruction semantics.
Definition: Dispatcher.h:18
RegisterDictionaryPtr registerDictionary() const
Property: Register dictionary.
void set_line_prefix(const std::string &s)
The string to print at the start of each line.
Definition: Formatter.h:42
void clear_show_properties()
Whether to show register properties.
Definition: Formatter.h:62
bool get_show_latest_writers() const
Whether to show latest writer information for register and memory states.
Definition: Formatter.h:53
Main namespace for the ROSE library.
void clear_show_latest_writers()
Whether to show latest writer information for register and memory states.
Definition: Formatter.h:55
Adjusts a Formatter for one additional level of indentation.
Definition: Formatter.h:77
void set_indentation_suffix(const std::string &s)
Indentation string appended to the line prefix for multi-level, multi-line outputs.
Definition: Formatter.h:48
std::string get_line_prefix() const
The string to print at the start of each line.
Definition: Formatter.h:41
bool get_show_properties() const
Whether to show register properties.
Definition: Formatter.h:60
Binary analysis.
void set_show_properties(bool b=true)
Whether to show register properties.
Definition: Formatter.h:61
void clear_suppress_initial_values()
Whether register initial values should be suppressed.
Definition: Formatter.h:36
std::string get_indentation_suffix() const
Indentation string appended to the line prefix for multi-level, multi-line outputs.
Definition: Formatter.h:47
bool get_suppress_initial_values() const
Whether register initial values should be suppressed.
Definition: Formatter.h:34
void set_suppress_initial_values(bool b=true)
Whether register initial values should be suppressed.
Definition: Formatter.h:35
void set_show_latest_writers(bool b=true)
Whether to show latest writer information for register and memory states.
Definition: Formatter.h:54