614 #ifndef _TREE_GEN_HPP_INCLUDED_ 615 #define _TREE_GEN_HPP_INCLUDED_ 778 std::vector<Field> all_fields()
const;
785 using Nodes = std::vector<std::shared_ptr<Node>>;
791 std::string
replace_all(std::string str,
const std::string& from,
const std::string& to);
812 NodeBuilder *derive_from(std::shared_ptr<Node> parent);
819 const std::string &node_name,
820 const std::string &
name,
821 const std::string &
doc =
"" 828 const std::string &prim,
829 const std::string &
name,
830 const std::string &
doc =
"",
838 NodeBuilder *with_order(std::list<std::string> &&order);
856 std::map<std::string, std::shared_ptr<NodeBuilder>> builders;
959 void set_source_doc(
const std::string &
doc);
964 void set_header_doc(
const std::string &
doc);
969 void set_header_fname(
const std::string &fname);
974 void set_python_doc(
const std::string &
doc);
979 void set_tree_namespace(
const std::string &name_space);
984 void set_support_namespace(
const std::string &name_space);
989 void set_initialize_function(
const std::string &init_fn);
994 void set_serdes_functions(
const std::string &ser_fn,
const std::string &des_fn);
999 void set_source_location(
const std::string &ident);
1004 void add_include(
const std::string &include);
1009 void add_src_include(
const std::string &include);
1014 void add_python_include(
const std::string &include);
1019 void add_namespace(
const std::string &name_space,
const std::string &
doc =
"");
1024 void add_node(std::shared_ptr<NodeBuilder> &node_builder);
std::string support_namespace
The namespace to take support stuff like tree::cbor from.
std::vector< std::shared_ptr< Node > > Nodes
List of nodes.
Represents a type of AST node.
Struct containing everything needed for a complete specification.
std::vector< std::string > src_includes
The include statements to stick at the top of the source file.
std::string py_multi_type
The primitive Multi* type name in the Python world, if any (depends on type and ext_type).
std::vector< std::weak_ptr< Node > > derived
Node types derived from this one.
std::string doc
Class member documentation.
Namespace for the tree-gen program.
std::vector< std::string > includes
The include statements to stick at the top of the header file.
std::string namespace_doc
Namespace documentation.
std::string tree_namespace
The namespace to take the tree base types from.
std::string header_fname
Explicit filename for the header, in case it will not end up in the same directory that the source is...
std::vector< std::string > namespaces
The C++ namespaces to use.
std::string initialize_function
The initialization function to use for default values of members.
std::string title_case_name
Name in TitleCase.
std::string header_doc
Header file documentation.
Link to zero or one nodes elsewhere in the tree.
std::string prim_type
The primitive type name, if any (depends on type).
EdgeType
Types of edges between nodes and primitives.
std::string source_location
Annotation object used for source location info, or empty if source locations are not used or are not...
std::string py_prim_type
The primitive type name, if any (depends on type).
std::string doc
Class documentation.
std::shared_ptr< Node > node_type
The field type, if any (depends on type).
EdgeType ext_type
External node type.
std::string replace_all(std::string str, const std::string &from, const std::string &to)
Convenience method for replacing all occurrences of a substring in a string with another string...
Convenience class for constructing a node.
std::string serialize_fn
The serialization function to use when serializing primitives.
bool is_error_marker
Whether this node represents a recovered parse error.
std::vector< std::string > python_includes
The include statements to stick at the top of the Python file.
std::vector< Field > fields
Child nodes.
EdgeType type
The edge type for the field.
std::list< std::string > order
Optional override for field order as returned by all_fields().
std::string source_doc
Source file documentation.
std::string python_doc
Python file documentation.
std::string snake_case_name
Name in snake_case.
std::string py_deserialize_fn
Deserialization function to use when serializing primitives in the Python domain, using ...
std::string deserialize_fn
The serialization function to use when deserializing primitives.
std::string name
Class member name.
std::shared_ptr< Node > parent
The node type this is derived from, if any.
std::shared_ptr< Node > node
The node being constructed.
Nodes nodes
All the nodes.
std::string py_serialize_fn
Serialization function to use when serializing primitives in the Python domain, using ...
Link to exactly one node elsewhere in the tree.