CBMC
structured_data.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Classes for representing generic structured data
4 
5 Author: Thomas Kiley
6 
7 \*******************************************************************/
8 #ifndef CPROVER_UTIL_STRUCTURED_DATA_H
9 #define CPROVER_UTIL_STRUCTURED_DATA_H
10 
11 #include "json.h"
12 
13 #include <string>
14 #include <vector>
15 
16 struct labelt
17 {
18 public:
19  explicit labelt(std::vector<std::string> components);
20 
21  std::string camel_case() const;
22  std::string snake_case() const;
23  std::string kebab_case() const;
24  std::string pretty() const;
25 
26  bool operator<(const labelt &other) const;
27 
28 private:
29  std::vector<std::string> components;
30 };
31 
33 {
36  entry(std::map<labelt, structured_data_entryt> children);
37 
38  bool is_leaf() const;
39  std::string leaf_data() const;
40  jsont leaf_object() const;
41  const std::map<labelt, structured_data_entryt> &children() const;
42 
43 private:
45  explicit structured_data_entryt(
46  std::map<labelt, structured_data_entryt> children);
47 
49  std::map<labelt, structured_data_entryt> _children;
50 };
51 
74 {
75 public:
76  explicit structured_datat(std::map<labelt, structured_data_entryt> data);
77  const std::map<labelt, structured_data_entryt> &data() const;
78 
79 private:
80  std::map<labelt, structured_data_entryt> _data;
81 };
82 
90 std::string to_pretty(const structured_datat &);
91 
92 #endif // CPROVER_UTIL_STRUCTURED_DATA_H
Definition: json.h:27
A way of representing nested key/value data.
const std::map< labelt, structured_data_entryt > & data() const
structured_datat(std::map< labelt, structured_data_entryt > data)
std::map< labelt, structured_data_entryt > _data
std::string camel_case() const
labelt(std::vector< std::string > components)
std::string kebab_case() const
std::vector< std::string > components
std::string snake_case() const
std::string pretty() const
bool operator<(const labelt &other) const
static structured_data_entryt data_node(const jsont &data)
std::string leaf_data() const
std::map< labelt, structured_data_entryt > _children
const std::map< labelt, structured_data_entryt > & children() const
static structured_data_entryt entry(std::map< labelt, structured_data_entryt > children)
structured_data_entryt(jsont data)
std::string to_pretty(const structured_datat &)
Convert the structured_data into plain text.