Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GenNode Struct Reference

#include "lib/diff/gen-node.hpp"

Description

generic data element node within a tree

Definition at line 213 of file gen-node.hpp.

Public Types

using ChildDataIter = TransformIter< Rec::scopeIter, DataCap const & >
 
using iterator = ScopeExplorerIterator
 

Public Member Functions

template<typename X >
 GenNode (X &&val)
 
template<typename X >
 GenNode (string const &symbolicID, X &&val)
 
 GenNode (string const &symbolicID, const char *text)
 
 GenNode (const char *text)
 
 GenNode (GenNode const &)=default
 
 GenNode (GenNode &&)=default
 
 GenNode (GenNode &o)
 
 GenNode (Ref const &r)
 
 GenNode (Ref &r)
 
 GenNode (Ref &&r)
 
iterator begin ()
 
iterator begin () const
 
template<typename X >
bool contains (X const &elm) const
 
iterator end ()
 
iterator end () const
 
bool isNamed () const
 
bool isTypeID () const
 
bool matches (GenNode const &o) const
 
bool matches (ID const &id) const
 
bool matches (int number) const
 
bool matches (int64_t number) const
 
bool matches (short number) const
 
bool matches (char number) const
 
bool matches (double number) const
 
bool matches (string text) const
 
bool matches (const char *text) const
 
bool matches (time::TimeValue t) const
 
bool matches (bool b) const
 
bool matches (hash::LuidH h) const
 
bool matches (RecRef const &ref) const
 
bool matches (Rec const &rec) const
 
 operator string () const
 
GenNodeoperator= (GenNode const &o)
 copy assignment More...
 
GenNodeoperator= (GenNode &&o)
 

Public Attributes

DataCap data
 
ID idi
 

Classes

class  ID
 
struct  IDComparator
 allow for storage in ordered containers, ordering based on the human-readable ID within the GenNode. More...
 
class  ScopeExplorer
 Building block for monad-like depth-first expansion of a GenNode. More...
 
struct  ScopeExplorerIterator
 

Friends

ChildDataIter childData (GenNode const &n)
 visit the data of nested child elements More...
 
ChildDataIter childData (Rec::scopeIter &&scopeIter)
 
string name (GenNode const &node)
 
bool operator!= (GenNode const &n1, GenNode const &n2)
 
bool operator== (GenNode const &n1, GenNode const &n2)
 

Protected Member Functions

 GenNode (ID &&id, DataCap &&d)
 

Static Protected Member Functions

template<typename X >
static GenNode::ID fabricateRefID (string const &symbolicID)
 

Static Private Member Functions

template<typename X >
static string buildChildID ()
 

Member Typedef Documentation

Definition at line 355 of file gen-node.hpp.

Definition at line 363 of file gen-node.hpp.

Constructor & Destructor Documentation

GenNode ( X &&  val)
inline

Definition at line 247 of file gen-node.hpp.

GenNode ( string const &  symbolicID,
X &&  val 
)
inline

Definition at line 253 of file gen-node.hpp.

GenNode ( string const &  symbolicID,
const char *  text 
)
inline

Definition at line 258 of file gen-node.hpp.

GenNode ( const char *  text)
inline

Definition at line 262 of file gen-node.hpp.

GenNode ( GenNode const &  )
default
GenNode ( GenNode &&  )
default
GenNode ( GenNode o)
inline

Definition at line 269 of file gen-node.hpp.

GenNode ( Ref const &  r)
inline

Definition at line 762 of file gen-node.hpp.

GenNode ( Ref r)
inline

Definition at line 763 of file gen-node.hpp.

GenNode ( Ref &&  r)
inline

Definition at line 764 of file gen-node.hpp.

GenNode ( ID &&  id,
DataCap &&  d 
)
inlineprotected

for dedicated builder subclasses

Definition at line 438 of file gen-node.hpp.

Member Function Documentation

GenNode& operator= ( GenNode const &  o)
inline

copy assignment

Remarks
we need to define our own version here for sake of sanity. The reason is that we use inline storage (embedded within lib::Variant) and that we deliberately erase the actual type of data stored inline. Because we still do want copy assignment, in case the payload data supports this, we use a "virtual copy operator", where in the end the storage buffer within lib::Variant has to decide if assignment is possible. Only data with the same type may be assigned and we prevent change of the (implicit) data type through assignment. This check might throw, and for that reason we're better off to perform the data assignment first. The probability for EntryID assignment to fail is low (but it may happen!).
Note
the use of inline storage turns swapping of data into an expensive operation, involving a temporary. This rules out the copy-and-swap idiom.

Definition at line 291 of file gen-node.hpp.

References GenNode::data, and GenNode::idi.

GenNode& operator= ( GenNode &&  o)
inline

Definition at line 302 of file gen-node.hpp.

operator string ( ) const
inline

diagnostics helper

Definition at line 316 of file gen-node.hpp.

bool isNamed ( ) const
inline

Definition at line 322 of file gen-node.hpp.

References BareEntryID::getSym(), and util::startsWith().

Referenced by MockElm::buildMutator(), and GenNodeBasic_test::simpleUsage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool isTypeID ( ) const
inline

Definition at line 328 of file gen-node.hpp.

References BareEntryID::getSym().

+ Here is the call graph for this function:

bool contains ( X const &  elm) const
inline

Definition at line 635 of file gen-node.hpp.

bool matches ( GenNode const &  o) const
inline
Note
not comparing payload data. Use equality for that…

Definition at line 337 of file gen-node.hpp.

References GenNode::idi, and GenNode::matches().

Referenced by GenNodeBasic_test::equalityMatch(), and GenNode::matches().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool matches ( ID const &  id) const
inline

Definition at line 338 of file gen-node.hpp.

bool matches ( int  number) const
inline

Definition at line 339 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

bool matches ( int64_t  number) const
inline

Definition at line 340 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

bool matches ( short  number) const
inline

Definition at line 341 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

bool matches ( char  number) const
inline

Definition at line 342 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

bool matches ( double  number) const
inline

Definition at line 343 of file gen-node.hpp.

References DataCap::matchDbl().

+ Here is the call graph for this function:

bool matches ( string  text) const
inline

Definition at line 344 of file gen-node.hpp.

References DataCap::matchTxt().

+ Here is the call graph for this function:

bool matches ( const char *  text) const
inline

Definition at line 345 of file gen-node.hpp.

References DataCap::matchTxt().

+ Here is the call graph for this function:

bool matches ( time::TimeValue  t) const
inline

Definition at line 346 of file gen-node.hpp.

References DataCap::matchTime().

+ Here is the call graph for this function:

bool matches ( bool  b) const
inline

Definition at line 347 of file gen-node.hpp.

References DataCap::matchBool().

+ Here is the call graph for this function:

bool matches ( hash::LuidH  h) const
inline

Definition at line 348 of file gen-node.hpp.

References DataCap::matchLuid().

+ Here is the call graph for this function:

bool matches ( RecRef const &  ref) const
inline

Definition at line 349 of file gen-node.hpp.

References DataCap::matchRec().

+ Here is the call graph for this function:

bool matches ( Rec const &  rec) const
inline

Definition at line 350 of file gen-node.hpp.

References DataCap::matchRec().

+ Here is the call graph for this function:

GenNode::iterator begin ( )
inline

Definition at line 628 of file gen-node.hpp.

GenNode::iterator begin ( ) const
inline

Definition at line 629 of file gen-node.hpp.

GenNode::iterator end ( )
inline

Definition at line 630 of file gen-node.hpp.

GenNode::iterator end ( ) const
inline

Definition at line 631 of file gen-node.hpp.

static GenNode::ID fabricateRefID ( string const &  symbolicID)
inlinestaticprotected

Definition at line 445 of file gen-node.hpp.

static string buildChildID ( )
inlinestaticprivate

Definition at line 454 of file gen-node.hpp.

Member Data Documentation

Friends And Related Function Documentation

ChildDataIter childData ( GenNode const &  n)
friend

visit the data of nested child elements

Returns
an iterator over the DataCap elements of all children, in case this GenNode actually holds a Record. Otherwise an empty iterator.
Note
this iterator visits only the children, which are by definition unnamed. It does not visit attributes.

Definition at line 373 of file gen-node.hpp.

ChildDataIter childData ( Rec::scopeIter &&  scopeIter)
friend

Definition at line 384 of file gen-node.hpp.

string name ( GenNode const &  node)
friend

Definition at line 396 of file gen-node.hpp.

bool operator== ( GenNode const &  n1,
GenNode const &  n2 
)
friend

Definition at line 402 of file gen-node.hpp.

bool operator!= ( GenNode const &  n1,
GenNode const &  n2 
)
friend

Definition at line 409 of file gen-node.hpp.

+ Inheritance diagram for GenNode:
+ Collaboration diagram for GenNode:

The documentation for this struct was generated from the following file: