Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
gen-node.cpp File Reference

Generic node element (implementation parts). More...

Go to the source code of this file.

Description

Generic node element (implementation parts).

Some of the more technical details regarding value access and comparisons has been moved down within this compilation unit, to cut down compilation time.

comparison and match

The DataCap element provides a set of functions to check for equivalence or match. These are used to build a recursive containment check. To implement such predicates, we need to build a one-way off visitor for use with lib::Variant. These specifically tailored functors only define handle(TY) functions for the cases actually of interest. All other cases invoke the default handling, which returns false.

See also
gen-node-test.cpp

Definition in file gen-node.cpp.

#include "lib/error.hpp"
#include "lib/diff/diff-language.hpp"
#include "lib/diff/gen-node.hpp"
#include "lib/util-quant.hpp"
#include "lib/variant.hpp"
#include <boost/lexical_cast.hpp>

Namespaces

namespace  lib
 Implementation namespace for support and library code.
 
namespace  lib::diff
 

Macros

#define DERIVE_EQUALITY(_TY_)    virtual bool handle (_TY_ const& val) override { return (o_.get<_TY_>() == val); }
 
#define MATCH_NUMBER(_TY_)    virtual bool handle (_TY_ const& val) override { return val == num_; }
 
#define MATCH_DOUBLE(_TY_)    virtual bool handle (_TY_ const& val) override { return almostEqual (double(val), num_); }
 
#define MATCH_STRING(_TY_)    virtual bool handle (_TY_ const& val) override { return lexical_cast<string>(val) == txt_; }
 
#define MATCH_TIME(_TY_)    virtual bool handle (_TY_ const& val) override { return val == t_; }
 
#define RENDER_CONTENT(_TY_)    virtual string handle (_TY_ const& val) override { return util::toString(val); }
 

Functions

string renderCompact (Rec const &rec)
 compact textual representation of a Record<GenNode> (»object«).
 
string renderCompact (RecRef const &ref)
 
string renderCompact (GenNode const &)
 compact textual representation of a GenNode tree
 

Macro Definition Documentation

◆ DERIVE_EQUALITY

#define DERIVE_EQUALITY (   _TY_)     virtual bool handle (_TY_ const& val) override { return (o_.get<_TY_>() == val); }

◆ MATCH_NUMBER

#define MATCH_NUMBER (   _TY_)     virtual bool handle (_TY_ const& val) override { return val == num_; }

◆ MATCH_DOUBLE

#define MATCH_DOUBLE (   _TY_)     virtual bool handle (_TY_ const& val) override { return almostEqual (double(val), num_); }

◆ MATCH_STRING

#define MATCH_STRING (   _TY_)     virtual bool handle (_TY_ const& val) override { return lexical_cast<string>(val) == txt_; }

◆ MATCH_TIME

#define MATCH_TIME (   _TY_)     virtual bool handle (_TY_ const& val) override { return val == t_; }

◆ RENDER_CONTENT

#define RENDER_CONTENT (   _TY_)     virtual string handle (_TY_ const& val) override { return util::toString(val); }