![]() |
Tesseract 0.28.4
|
Fluent builder for constructing PropertyTree schemas with minimal boilerplate. More...
#include <property_tree.h>
Public Member Functions | |
| PropertyTreeBuilder & | oneOf () |
| Mark the current node as a standalone oneOf schema. | |
| PropertyTreeBuilder & | compose (const PropertyTree &source) |
| Copy all children from another PropertyTree into the current scope. | |
| PropertyTreeBuilder & | done () |
| Pop current node, return to parent scope. | |
| PropertyTree | build () |
| Finalize and return the constructed PropertyTree. | |
Type-creating methods – create a typed child and descend into it. | |
| PropertyTreeBuilder & | container (std::string_view name) |
| PropertyTreeBuilder & | string (std::string_view name) |
| PropertyTreeBuilder & | character (std::string_view name) |
| PropertyTreeBuilder & | boolean (std::string_view name) |
| PropertyTreeBuilder & | int32 (std::string_view name) |
| PropertyTreeBuilder & | uint32 (std::string_view name) |
| PropertyTreeBuilder & | int64 (std::string_view name) |
| PropertyTreeBuilder & | uint64 (std::string_view name) |
| PropertyTreeBuilder & | float32 (std::string_view name) |
| PropertyTreeBuilder & | float64 (std::string_view name) |
| PropertyTreeBuilder & | eigenIsometry3d (std::string_view name) |
| PropertyTreeBuilder & | eigenVectorXd (std::string_view name) |
| PropertyTreeBuilder & | eigenVector2d (std::string_view name) |
| PropertyTreeBuilder & | eigenVector3d (std::string_view name) |
| PropertyTreeBuilder & | customType (std::string_view name, std::string_view type_str) |
| PropertyTreeBuilder & | beginOneOf () |
| Begin an inline oneOf group inside a container. | |
| PropertyTreeBuilder & | endOneOf () |
| Close an inline oneOf group opened by beginOneOf(). | |
Attribute setters – apply to the current node. | |
| PropertyTreeBuilder & | doc (std::string_view text) |
| PropertyTreeBuilder & | required () |
| PropertyTreeBuilder & | defaultVal (bool val) |
| PropertyTreeBuilder & | defaultVal (int val) |
| PropertyTreeBuilder & | defaultVal (double val) |
| PropertyTreeBuilder & | defaultVal (const char *val) |
| PropertyTreeBuilder & | defaultVal (std::string_view val) |
| PropertyTreeBuilder & | defaultVal (const YAML::Node &val) |
| PropertyTreeBuilder & | enumValues (const std::vector< std::string > &values) |
| PropertyTreeBuilder & | minimum (int val) |
| PropertyTreeBuilder & | minimum (double val) |
| PropertyTreeBuilder & | maximum (int val) |
| PropertyTreeBuilder & | maximum (double val) |
| PropertyTreeBuilder & | minimumLength (std::size_t length) |
| PropertyTreeBuilder & | maximumLength (std::size_t length) |
| PropertyTreeBuilder & | label (std::string_view text) |
| PropertyTreeBuilder & | placeholder (std::string_view text) |
| PropertyTreeBuilder & | group (std::string_view text) |
| PropertyTreeBuilder & | readOnly (bool val=true) |
| PropertyTreeBuilder & | hidden (bool val=true) |
| PropertyTreeBuilder & | validator (PropertyTree::ValidatorFn fn) |
| PropertyTreeBuilder & | attribute (std::string_view name, const YAML::Node &value) |
| PropertyTreeBuilder & | attribute (std::string_view name, std::string_view value) |
| PropertyTreeBuilder & | acceptsDerivedTypes () |
| Mark that this field accepts the base type and any registered derived types. Only applicable when the type attribute is a registered custom type. | |
Plugin helpers – self-closing convenience methods for PluginInfoContainer schemas. | |
| PropertyTreeBuilder & | pluginContainer (std::string_view name, std::string_view factory_base_type, std::string_view plugin_section) |
| Create a PluginInfoContainer child with plugin discovery metadata. | |
| PropertyTreeBuilder & | pluginContainerMap (std::string_view name, std::string_view factory_base_type, std::string_view plugin_section) |
| Create a Map[string, PluginInfoContainer] child with plugin discovery metadata. | |
Fluent builder for constructing PropertyTree schemas with minimal boilerplate.
Usage:
Schema composition example (reuse base schemas):
Inline oneOf example (shared fields with mutually exclusive parts):
Type-creating methods (container, string, boolean, etc.) create a child node, set its type, and push it as the current scope. Attribute setters (doc, required, defaultVal, etc.) apply to the current scope. done() pops back to the parent. Use compose() to copy all children from an existing PropertyTree into the current scope. Use beginOneOf()/endOneOf() to define mutually exclusive branches inline within a container — shared fields are defined outside the oneOf block.
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::oneOf | ( | ) |
Mark the current node as a standalone oneOf schema.
Define each mutually exclusive branch as a child of the current node. Branches may describe scalar, sequence, or map values. During applyConfig() exactly one branch is selected based on the configuration shape and replaces the current node.
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::beginOneOf | ( | ) |
Begin an inline oneOf group inside a container.
Define mutually exclusive branches as container children within this group. During applyConfig() the parent's full config is used for branch selection, and the chosen branch's children are hoisted into the parent. Close with endOneOf().
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::acceptsDerivedTypes | ( | ) |
Mark that this field accepts the base type and any registered derived types. Only applicable when the type attribute is a registered custom type.
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::pluginContainer | ( | std::string_view | name, |
| std::string_view | factory_base_type, | ||
| std::string_view | plugin_section ) |
Create a PluginInfoContainer child with plugin discovery metadata.
| name | Child property name. |
| factory_base_type | Fully-qualified factory base class. |
| plugin_section | boost_plugin_loader export section containing compatible plugins. |
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::pluginContainerMap | ( | std::string_view | name, |
| std::string_view | factory_base_type, | ||
| std::string_view | plugin_section ) |
Create a Map[string, PluginInfoContainer] child with plugin discovery metadata.
| name | Child property name. |
| factory_base_type | Fully-qualified factory base class. |
| plugin_section | boost_plugin_loader export section containing compatible plugins. |
| PropertyTreeBuilder & tesseract::common::PropertyTreeBuilder::compose | ( | const PropertyTree & | source | ) |
Copy all children from another PropertyTree into the current scope.
This allows composing schemas together. The source tree's immediate children (with their full subtrees, attributes, and validators) are appended to the current builder scope. The source tree's own root-level attributes are ignored; only its children are composed.
| source | The PropertyTree whose children should be copied into this scope. |