Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Member Functions
gmx::KeyValueTreeTransformRuleBuilder Class Reference

#include <gromacs/utility/keyvaluetreetransform.h>

Description

Provides methods to specify one transformation rule.

The builder is implemented as a set of nested objects, each of which is provides methods for setting a particular property of the rule. Setting a property returns another object that has relevant methods for the context. This provides some structure to the methods, and catches at least some types of incorrect rules already at compile time. Additionally, if you use an IDE with completion facilities, it can nicely guide you through which values you need to specify. All values are stored within the main builder object, and the rule is created at the end of the statement.

Classes

class  AfterFrom
 Properties that can be specified after from(). More...
 
class  Base
 Base class used for implementing parameter provider objects. More...
 
class  ToObject
 Properties that can be specified after from().toObject(). More...
 
class  ToValue
 Properties that can be specified after from().to(). More...
 

Public Member Functions

 KeyValueTreeTransformRuleBuilder (internal::KeyValueTreeTransformerImpl *impl, const KeyValueTreePath &prefix)
 Internal constructor for creating a builder.
 
 KeyValueTreeTransformRuleBuilder (KeyValueTreeTransformRuleBuilder &&)=default
 Supports returning the builder from IKeyValueTreeTransformRules::addRule().
 
KeyValueTreeTransformRuleBuilderoperator= (KeyValueTreeTransformRuleBuilder &&)=default
 Supports returning the builder from IKeyValueTreeTransformRules::addRule().
 
template<typename FromType >
AfterFrom< FromType > from (const KeyValueTreePath &path)
 Specifies a rule that maps a value at given path. More...
 
void keyMatchType (const KeyValueTreePath &path, StringCompareType keyMatchType)
 Specifies how strings are matched when matching rules against a path. More...
 

Member Function Documentation

template<typename FromType >
AfterFrom<FromType> gmx::KeyValueTreeTransformRuleBuilder::from ( const KeyValueTreePath path)
inline

Specifies a rule that maps a value at given path.

Template Parameters
FromTypeType of value expected at path.
Parameters
[in]pathPath to map in this rule.

If the input tree has path, but it is not of type FromType, the transform will produce an error.

It is an error to use the same path in two from() rules. Similarly, it is an error to use a child path of a path used in a different from() rule.

void gmx::KeyValueTreeTransformRuleBuilder::keyMatchType ( const KeyValueTreePath path,
StringCompareType  keyMatchType 
)
inline

Specifies how strings are matched when matching rules against a path.

For properties of the object at path, keyMatchType is used for string comparison.

This rule must be specified first for a path, before any other from() rule specifies the path or a subpath. The rule only applies to immediate properties at the given path, not recursively. It is an error to specify the match type multiple times for a path.


The documentation for this class was generated from the following files: