UI-Coordinates: better name the local component UIC_PATH

This commit is contained in:
Fischlurch 2017-10-02 16:51:45 +02:00
parent 286b1829fe
commit 5c113b058d
2 changed files with 23 additions and 23 deletions

View file

@ -90,7 +90,7 @@ namespace interact {
UIC_PANEL,
UIC_VIEW,
UIC_TAB,
UIC_PART
UIC_PATH
};
@ -192,7 +192,7 @@ namespace interact {
{
if (empty()) return "";
size_t end = min (size(), UIC_PART);
size_t end = min (size(), UIC_PATH);
size_t pos = indexOf(*begin());
if (pos >= end)
@ -231,13 +231,13 @@ namespace interact {
getPath() const
{
size_t siz = size();
if (siz <= UIC_PART)
if (siz <= UIC_PATH)
return ""; // no path information
string buff; // heuristic pre-allocation
buff.reserve (10 * (siz - UIC_PART));
buff.reserve (10 * (siz - UIC_PATH));
iterator elm{this, unConst(this)->getPosition(UIC_PART)};
iterator elm{this, unConst(this)->getPosition(UIC_PATH)};
if (isnil (*elm))
{ // irregular case : only a path fragment
elm = this->begin();
@ -455,7 +455,7 @@ namespace interact {
Builder
path (Literal pathDef)
{
uic_.setTailSequence (UIC_PART, pathDef);
uic_.setTailSequence (UIC_PATH, pathDef);
return std::move (*this);
}
};

View file

@ -105,9 +105,9 @@ namespace test {
CHECK ("Θ" == uic[UIC_PANEL]);
CHECK ("Ξ" == uic[UIC_VIEW]);
CHECK ("Σ" == uic[UIC_TAB]);
CHECK ("Ψ" == uic[UIC_PART]);
CHECK ("Φ" == uic[UIC_PART+1]);
CHECK ("Ω" == uic[UIC_PART+2]);
CHECK ("Ψ" == uic[UIC_PATH]);
CHECK ("Φ" == uic[UIC_PATH+1]);
CHECK ("Ω" == uic[UIC_PATH+2]);
// iteration matches index order
uint i=0;
@ -133,9 +133,9 @@ namespace test {
CHECK ("Θ" == uic[UIC_PANEL]);
CHECK ("*" == uic[UIC_VIEW]);
CHECK ("Σ" == uic[UIC_TAB]);
CHECK ("*" == uic[UIC_PART]);
CHECK ("Φ" == uic[UIC_PART+1]);
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART+2]);
CHECK ("*" == uic[UIC_PATH]);
CHECK ("Φ" == uic[UIC_PATH+1]);
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH+2]);
}
@ -235,13 +235,13 @@ namespace test {
CHECK (Symbol::EMPTY == uic[UIC_PANEL]);
CHECK (Symbol::EMPTY == uic[UIC_VIEW]);
CHECK (Symbol::EMPTY == uic[UIC_TAB]);
CHECK ("α" == uic[UIC_PART]);
CHECK ("β" == uic[UIC_PART+1]);
CHECK ("γ" == uic[UIC_PART+2]);
CHECK ("δ" == uic[UIC_PART+3]);
CHECK ("ε" == uic[UIC_PART+4]);
CHECK ("λ" == uic[UIC_PART+5]);
CHECK ("ον" == uic[UIC_PART+6]);
CHECK ("α" == uic[UIC_PATH]);
CHECK ("β" == uic[UIC_PATH+1]);
CHECK ("γ" == uic[UIC_PATH+2]);
CHECK ("δ" == uic[UIC_PATH+3]);
CHECK ("ε" == uic[UIC_PATH+4]);
CHECK ("λ" == uic[UIC_PATH+5]);
CHECK ("ον" == uic[UIC_PATH+6]);
uic = uic.prepend("ειδος");
CHECK ("UI:?.ειδος/α/β/γ/δ/ε/λ/ον" == string(uic));
@ -295,15 +295,15 @@ namespace test {
CHECK ("win[*]-panel.*. " == uic.getComp());
CHECK (" " == uic.getPath());
CHECK (6 == uic.size());
CHECK (" " == uic[UIC_PART]);
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART+1]);
CHECK (" " == uic[UIC_PATH]);
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH+1]);
uic = uic.path(nullptr);
CHECK ("UI:win[*]-panel.*. " == string(uic));
CHECK ("win[*]-panel.*. " == uic.getComp());
CHECK ("" == uic.getPath());
CHECK (5 == uic.size());
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PART]);
VERIFY_ERROR (INDEX_BOUNDS, uic[UIC_PATH]);
uic = uic.append(nullptr);
CHECK ("UI:win[*]-panel.*. " == string(uic));
@ -321,7 +321,7 @@ namespace test {
CHECK ("UI:win[*]-panel.*. /**" == string(uic));
CHECK ("win[*]-panel.*. " == uic.getComp());
CHECK ("**" == uic.getPath());
CHECK ("**" == uic[UIC_PART]);
CHECK ("**" == uic[UIC_PATH]);
CHECK (6 == uic.size());
uic = uic.tab("");