diff --git a/src/gui/interact/ui-coord.hpp b/src/gui/interact/ui-coord.hpp index 8914ec51c..af84f65cc 100644 --- a/src/gui/interact/ui-coord.hpp +++ b/src/gui/interact/ui-coord.hpp @@ -51,9 +51,11 @@ #include "lib/error.hpp" #include "lib/symbol.hpp" +#include "lib/iter-adapter.hpp" //#include #include +#include //#include @@ -103,13 +105,46 @@ namespace interact { UNIMPLEMENTED ("path implementation storage"); } - using iterator = const char*; /////////////TODO placeholder + + protected: /* ==== Iteration control API for IterAdapter ==== */ + + /** Implementation of Iteration-logic: pull next element. */ + friend void + iterNext (const PathArray* src, Literal* pos) + { + ++pos; + checkPoint (src,pos); + } + + /** Implementation of Iteration-logic: detect iteration end. */ + friend bool + checkPoint (const PathArray* src, Literal* pos) + { + REQUIRE (src); + if ((pos != nullptr) && (pos != src->storage_end())) + return true; + else + { + pos = nullptr; + return false; + } } + + public: + using iterator = lib::IterAdapter; + using const_iterator = iterator; iterator begin() const { UNIMPLEMENTED ("content iteration"); } iterator end() const { UNIMPLEMENTED ("content iteration"); } friend iterator begin(PathArray const& pa) { return pa.begin();} friend iterator end (PathArray const& pa) { return pa.end(); } + + private: + Literal* + storage_end() const + { + UNIMPLEMENTED ("path implementation storage"); + } }; enum UIPathElm @@ -151,11 +186,6 @@ namespace interact { UNIMPLEMENTED ("UI coordinate builder function to indicate coordinates rooted within a specific window"); } - static UICoord - view (Literal viewID) - { - UNIMPLEMENTED ("UI coordinate builder function to start a partially defined coordinate path"); - } UICoord persp (Literal perspectiveID) const diff --git a/src/lib/iter-type-binding.hpp b/src/lib/iter-type-binding.hpp index 7ca5c87e3..fa9e85c65 100644 --- a/src/lib/iter-type-binding.hpp +++ b/src/lib/iter-type-binding.hpp @@ -107,6 +107,14 @@ namespace iter { typedef std::shared_ptr* pointer; }; + template<> + struct TypeBinding + { + typedef size_t value_type; + typedef size_t& reference; + typedef size_t* pointer; + }; + }} // namespace lib diff --git a/tests/gui/interact/ui-coord-test.cpp b/tests/gui/interact/ui-coord-test.cpp index d024a307b..4f2b77345 100644 --- a/tests/gui/interact/ui-coord-test.cpp +++ b/tests/gui/interact/ui-coord-test.cpp @@ -140,7 +140,7 @@ namespace test { void verify_builder() { - UICoord uic1 = UICoord::window("window"); + UICoord uic1 = UICoord().window("window"); UICoord uic2 = uic2.view("view"); CHECK ("UI:window" == string(uic1)); CHECK ("UI:window[*]-*.view" == string(uic2)); @@ -166,7 +166,7 @@ namespace test { VERIFY_ERROR (INDEX_BOUNDS, uic1[UIC_PERSP]); VERIFY_ERROR (INDEX_BOUNDS, uic2[UIC_TAB]); - UICoord uic3 = UICoord::view("view"); + UICoord uic3 = UICoord().view("view"); CHECK (4 == uic3.size()); CHECK ("UI:?.view" == string(uic3)); CHECK ("" == uic3.getWindow());