LocationQuery: now able to handle perspective info properly

...which was deliberately represented in an asymmetric way, to verify the
design's ability to cope with such implementation intricacies. So basically
we have to kick in at LEVEL == 1 and access the implementation differently.

This exercise just shows again, that treating tree structures recursively
is the way to go, and we should do similar when coding up the query-API
for the real GTK toolkit based window elements...
This commit is contained in:
Fischlurch 2017-10-29 16:00:08 +01:00
parent 750b124f88
commit 4b6b4ad708
2 changed files with 14 additions and 9 deletions

View file

@ -148,12 +148,12 @@ namespace interact {
throw error::State(_Fmt{"unable to drill down to depth %d: "
"element %s at pos %d in path %s is in "
"contradiction to actual UI structure"}
% (pos+1)
% pos
% (depth<path.size()? path[depth] : Symbol::BOTTOM)
% depth
% path
);
return childSequence(node);
return childSequence(node, depth);
}
private:
@ -177,14 +177,15 @@ namespace interact {
}
static ChildIter
childSequence (Rec const& node)
childSequence (Rec const& node, size_t& depth)
{
auto internedString = [](string const& id) -> Literal
{
return Symbol{id};
};
///////////////////////////////////////////////////////////////TICKET #1113 : could just use lib::wrapIter when GenNode exposes Literal as ID
return lib::transform (node.keys(), internedString);
return depth==UIC_PERSP? lib::singleVal (internedString (node.getType()))
: lib::transform (node.keys(), internedString);
/////////////////////////////////////////////////////////////////////TICKET #1113 : could just use lib::wrapIter when GenNode exposes Literal as ID
}

View file

@ -4575,8 +4575,8 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1506984645745" ID="ID_244163155" MODIFIED="1506984665826" TEXT="verify_simpleUsage">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1506984645747" ID="ID_517262443" MODIFIED="1508625810426" TEXT="verify_backingQuery">
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1506984645747" ID="ID_517262443" MODIFIED="1509288984297" TEXT="verify_backingQuery">
<icon BUILTIN="button_ok"/>
<node CREATED="1508809610790" FOLDED="true" ID="ID_1860790851" MODIFIED="1509145537374" TEXT="Builder-Syntax war falsch">
<icon BUILTIN="button_ok"/>
<node CREATED="1508809620762" ID="ID_236111511" MODIFIED="1508809630860" TEXT="mu&#xdf; die Attribute-Collection nutzen"/>
@ -4683,11 +4683,15 @@
<icon BUILTIN="ksmiletris"/>
</node>
</node>
<node CREATED="1509151268071" ID="ID_38582779" MODIFIED="1509151422017" TEXT="getChildren aufbohren">
<icon BUILTIN="pencil"/>
<node CREATED="1509151268071" ID="ID_38582779" MODIFIED="1509288960092" TEXT="getChildren aufbohren">
<icon BUILTIN="button_ok"/>
<node CREATED="1509151285749" ID="ID_1826645914" MODIFIED="1509287428715" TEXT="eigentlich einfach">
<icon BUILTIN="idea"/>
</node>
<node CREATED="1509287527705" ID="ID_1588631568" MODIFIED="1509287562960" TEXT="mu&#xdf; blo&#xdf; in einem Fall explizit was anderes liefern..."/>
<node CREATED="1509287541919" ID="ID_58868223" MODIFIED="1509287552668" TEXT="Aua! Iterator ist im weg">
<icon BUILTIN="messagebox_warning"/>
</node>
<node COLOR="#338800" CREATED="1509151289637" FOLDED="true" ID="ID_892381116" MODIFIED="1509287431815" TEXT="brauche singletonIter">
<icon BUILTIN="button_ok"/>
<node CREATED="1509151296292" ID="ID_1050274308" MODIFIED="1509151411655" TEXT="liefert ein einziges Element"/>