diff --git a/src/gui/ctrl/elem-access-dir.hpp b/src/gui/ctrl/elem-access-dir.hpp index b8863dc6b..6eb3b62e0 100644 --- a/src/gui/ctrl/elem-access-dir.hpp +++ b/src/gui/ctrl/elem-access-dir.hpp @@ -80,8 +80,14 @@ namespace ctrl{ + /* == ElementAccess interface == */ + + void* + performAccessTo (UICoord, size_t limitCreation) override + { + UNIMPLEMENTED ("implementation of access function based on real UI widgets"); + } - /* == Adapter interface for == */ #if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1134 if (isDeaf()) diff --git a/src/gui/model/element-access.hpp b/src/gui/model/element-access.hpp index 42479a5c0..1eaa95279 100644 --- a/src/gui/model/element-access.hpp +++ b/src/gui/model/element-access.hpp @@ -55,20 +55,24 @@ #include "lib/error.hpp" #include "lib/nocopy.hpp" #include "lib/result.hpp" +#include "include/limits.h" +#include "lib/access-casted.hpp" #include "gui/interact/ui-coord.hpp" +//#include "lib/format-string.hpp" //#include "lib/symbol.hpp" //#include "lib/util.hpp" -//#include +#include namespace gui { namespace model { + namespace error = lumiera::error; using interact::UICoord; // using util::isnil; -// using std::string; + using std::string; /** @@ -94,14 +98,12 @@ namespace model { Result access (UICoord destination); template - Result access_or_create (UICoord destination); + Result access_or_create (UICoord destination, size_t limitCreation = LUMIERA_MAX_ORDINAL_NUMBER); protected: -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1134 - if (isDeaf()) - this->transmogrify (solution); -#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1134 + /** @internal drill down according to coordinates, maybe create element */ + virtual void* performAccessTo (UICoord, size_t limitCreation) =0; }; @@ -109,9 +111,12 @@ namespace model { - /** Navigate the UI topology to access the designated component + /** Navigate the UI topology to access the designated component. + * @tparam TAR type of result element expected at the designated location * @return suitably converted direct (language) reference to the desired element * wrapped as _result proxy_ + * @throw error::Invalid when the designated element exists, but is not + * type or conversion compatible to the expected result type * @note when access was not possible because the element does not exist, * the result proxy is empty and convertible to `bool(false)` */ @@ -119,7 +124,11 @@ namespace model { inline ElementAccess::Result ElementAccess::access (UICoord destination) { - UNIMPLEMENTED ("delegate to a suitable polymorphic navigation function"); + void* targetElm = performAccessTo (destination, 0); + if (targetElm) + return *util::AccessCasted::access (targetElm); + else + return "In current UI, there is no element at location "+string(destination); } @@ -131,7 +140,7 @@ namespace model { */ template inline ElementAccess::Result - ElementAccess::access_or_create (UICoord destination) + ElementAccess::access_or_create (UICoord destination, size_t limitCreation) { UNIMPLEMENTED ("delegate to a suitable polymorphic navigation/creation function"); } diff --git a/src/lib/result.hpp b/src/lib/result.hpp index 5757e1d0c..7060c39ad 100644 --- a/src/lib/result.hpp +++ b/src/lib/result.hpp @@ -42,6 +42,7 @@ #include "lib/wrapper.hpp" #include "lib/util.hpp" +#include #include @@ -71,8 +72,8 @@ namespace lib { public: /** mark an invalid/failed result */ - Result () - : failureLog_{"no result"} + Result (string const& failureReason ="no result") + : failureLog_{failureReason} { } /** failed result, with reason given.*/ @@ -81,9 +82,9 @@ namespace lib { { } /** standard case: valid result */ - Result (RES const& value) + Result (RES&& value) : failureLog_{} - , value_{value} + , value_{std::forward (value)} { } diff --git a/tests/gui/ctrl/element-access-test.cpp b/tests/gui/ctrl/element-access-test.cpp index 96f273c24..b8d98fcf2 100644 --- a/tests/gui/ctrl/element-access-test.cpp +++ b/tests/gui/ctrl/element-access-test.cpp @@ -64,7 +64,7 @@ namespace test { namespace { //Test fixture... class DummyWidget - : ::util::NonCopyable + : util::NonCopyable { protected: virtual ~DummyWidget() { } ///< is an interface diff --git a/tests/gui/test/test-element-access.hpp b/tests/gui/test/test-element-access.hpp index 158c98fec..eb7711415 100644 --- a/tests/gui/test/test-element-access.hpp +++ b/tests/gui/test/test-element-access.hpp @@ -87,6 +87,11 @@ namespace model { /* == ElementAccess interface == */ + void* + performAccessTo (UICoord, size_t limitCreation) override + { + UNIMPLEMENTED ("internal access function"); + } protected: diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index e67abd2a1..4e055df2b 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -12740,13 +12740,75 @@ - + + + + + + + + + + + + + + + + + + + + +

+ Zwei Fälle sind hier zu unterscheiden: +

+
    +
  1. + der gewünschte Wert existiert nicht, und das ist auch das Ergebnis der Anfrage +
  2. +
  3. + es liegt eine Fehleinschätzung der Situation vor, insofern fest mit einem Ergebnis gerechnet wurde +
  4. +
+

+ In Fall-1 wird man eine bool-Abfrage machen wollen, und man kann auch mit einer false-Antwort umgehen. In Fall-2 dagegen bleibt nur noch der Tod. Und davon ist im Regelfall nicht auszugehen. Im Moment sehe ich Fall-2 als den standard-use-Case +

+ + +
+
+ + + + + + +
    +
  • + im Fall-1 weiß der Client, daß er prüfen muß +
  • +
  • + im Fall-2 marschiert der Client einfach durch +
  • +
+ + +
+
+ + + + + + +
@@ -12758,11 +12820,60 @@ + + + + + + + + + + + + + + + + + + + + +

+ das mag überraschend klingen, +

+

+ aber in der (zu erwartenden) Nutzsituation interessiert sich keine Sau dafür, +

+

+ was denn nun konkret gemacht wurde, um den Dienst zu erbringen. +

+

+ Die einzig interessante Information ist, ob es gelungen ist +

+ + +
+ + +
+ + + + + + + + + + +
- + - + @@ -12781,8 +12892,8 @@ - - + +