CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
structured_data.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Classes for representing generic structured data
4
5Author: 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
16struct labelt
17{
18public:
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
28private:
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
43private:
46 std::map<labelt, structured_data_entryt> children);
47
49 std::map<labelt, structured_data_entryt> _children;
50};
51
74{
75public:
76 explicit structured_datat(std::map<labelt, structured_data_entryt> data);
77 const std::map<labelt, structured_data_entryt> &data() const;
78
79private:
80 std::map<labelt, structured_data_entryt> _data;
81};
82
90std::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
std::map< labelt, structured_data_entryt > _data
std::string camel_case() const
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)
std::string to_pretty(const structured_datat &)
Convert the structured_data into plain text.