get the first diff verb to work
surprise surprise, no catastrophe thus far....
This commit is contained in:
parent
6e829e3f22
commit
43f3560b15
3 changed files with 16 additions and 16 deletions
|
|
@ -692,7 +692,7 @@ namespace diff{
|
|||
|
||||
/**
|
||||
* @return either the contents of a nested record's type field
|
||||
* or the Rec::TYPE_NIL marker.
|
||||
* or the util::BOTTOM_INDICATOR, when not a record.
|
||||
* @remarks this function never raises an error, even if the element
|
||||
* in fact doesn't constitute a nested scope. Effectively this
|
||||
* allows to "peek" into the contents to some degree.
|
||||
|
|
@ -709,7 +709,7 @@ namespace diff{
|
|||
}
|
||||
|
||||
return nested? nested->getType()
|
||||
: Rec::TYPE_NIL;
|
||||
: util::BOTTOM_INDICATOR;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -133,18 +133,13 @@ namespace diff{
|
|||
inline string
|
||||
render (DataCap const& content)
|
||||
{
|
||||
class StringRenderer
|
||||
: public string
|
||||
, public Variant<DataValues>::Visitor
|
||||
struct StringRenderer
|
||||
: public Variant<DataValues>::Visitor
|
||||
{
|
||||
void
|
||||
renderAs (string const& representation)
|
||||
{
|
||||
string::operator= (representation);
|
||||
}
|
||||
string representation{""};
|
||||
|
||||
#define STRINGIFY_CONTENT(_TY_) \
|
||||
virtual void handle (_TY_& val) override { renderAs (util::toString (val)); }
|
||||
virtual void handle (_TY_& val) override { representation = util::toString (val); }
|
||||
|
||||
STRINGIFY_CONTENT (int)
|
||||
STRINGIFY_CONTENT (int64_t)
|
||||
|
|
@ -164,22 +159,22 @@ namespace diff{
|
|||
virtual void
|
||||
handle (Rec & rec) override
|
||||
{
|
||||
renderAs (renderRecord (rec));
|
||||
representation = renderRecord (rec);
|
||||
}
|
||||
|
||||
virtual void
|
||||
handle (RecRef & ref) override
|
||||
{
|
||||
if (ref)
|
||||
renderAs (renderRecord (ref));
|
||||
representation = renderRecord (ref);
|
||||
else
|
||||
renderAs (util::BOTTOM_INDICATOR);
|
||||
representation = util::BOTTOM_INDICATOR;
|
||||
}
|
||||
};
|
||||
|
||||
StringRenderer visitor;
|
||||
unConst(content).accept (visitor);
|
||||
return string(visitor);
|
||||
return visitor.representation;
|
||||
}
|
||||
|
||||
}//(End)diagnostic helpers
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ using std::make_unique;
|
|||
using std::string;
|
||||
using std::vector;
|
||||
using lib::time::Time;
|
||||
using util::BOTTOM_INDICATOR;
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -166,6 +167,10 @@ namespace test{
|
|||
{
|
||||
return not spec.isNamed(); // »Selector« : accept anything unnamed value-like
|
||||
})
|
||||
.constructFrom ([&](GenNode const& spec) -> string
|
||||
{
|
||||
return string(spec);
|
||||
})
|
||||
.assignElement ([&](string& target, GenNode const& spec) -> bool
|
||||
{
|
||||
target = render(spec.data);
|
||||
|
|
@ -174,7 +179,7 @@ namespace test{
|
|||
.attach (collection(nestedObj_)
|
||||
.isApplicableIf ([&](GenNode const& spec) -> bool
|
||||
{
|
||||
return type_ == spec.data.recordType(); // »Selector« : require object-like sub scope with matching typeID
|
||||
return BOTTOM_INDICATOR != spec.data.recordType(); // »Selector« : require object-like sub scope
|
||||
})
|
||||
.constructFrom ([&](GenNode const& spec) -> Opaque
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue