UI-Coordinates: stub basic path element iteration

This commit is contained in:
Fischlurch 2017-09-24 21:14:26 +02:00
parent 6073dbfcaf
commit 4082526ec6
3 changed files with 46 additions and 8 deletions

View file

@ -51,9 +51,11 @@
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/iter-adapter.hpp"
//#include <boost/noncopyable.hpp>
#include <string>
#include <limits>
//#include <memory>
@ -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<Literal*, PathArray*>;
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

View file

@ -107,6 +107,14 @@ namespace iter {
typedef std::shared_ptr<TY>* pointer;
};
template<>
struct TypeBinding<size_t>
{
typedef size_t value_type;
typedef size_t& reference;
typedef size_t* pointer;
};
}} // namespace lib

View file

@ -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());