CBMC
help_formatter.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Help Formatter
4 
5 Author: Daniel Kroening, dkr@amazon.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_UTIL_HELP_FORMATTER_H
13 #define CPROVER_UTIL_HELP_FORMATTER_H
14 
15 #include <iosfwd>
16 #include <string>
17 
19 {
20 public:
21  explicit help_formattert(const std::string &_s) : s(_s)
22  {
23  }
24 
25  const std::string &s;
26  void operator()(std::ostream &) const;
27 
28 protected:
29  struct statet
30  {
31  std::size_t column = 0;
32  bool aligning = false;
33  std::string word = "";
34  };
35 
36  static void emit_word(statet &, std::ostream &);
37  static const std::size_t first_column_width = 29;
38 };
39 
40 static inline help_formattert help_formatter(const std::string &s)
41 {
42  return help_formattert(s);
43 }
44 
45 static inline std::ostream &
46 operator<<(std::ostream &out, const help_formattert &h)
47 {
48  h(out);
49  return out;
50 }
51 
52 #endif // CPROVER_UTIL_HELP_FORMATTER_H
static const std::size_t first_column_width
void operator()(std::ostream &) const
help_formattert(const std::string &_s)
static void emit_word(statet &, std::ostream &)
const std::string & s
static std::ostream & operator<<(std::ostream &out, const help_formattert &h)
static help_formattert help_formatter(const std::string &s)