diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-08-20 23:24:19 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-08-20 23:24:19 +0200 |
commit | f5c598b518d1f906148534d015f50075d3e8242d (patch) | |
tree | 21dd70add5b366c3dd80641b77f6b18e0baa009e /dw/iterator.hh | |
parent | e98d02a01ffeb18ede86af025e51ae1ec011c75a (diff) | |
parent | 5f0fc0e48b8cbee7e1795935da0abff6627fd498 (diff) |
merge
Diffstat (limited to 'dw/iterator.hh')
-rw-r--r-- | dw/iterator.hh | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/dw/iterator.hh b/dw/iterator.hh index 605217ec..838d66a1 100644 --- a/dw/iterator.hh +++ b/dw/iterator.hh @@ -16,7 +16,7 @@ namespace core { * * \sa dw::core::Widget::iterator */ -class Iterator: public object::Object, public misc::Comparable +class Iterator: public lout::object::Object, public lout::misc::Comparable { protected: Iterator(Widget *widget, Content::Type mask, bool atEnd); @@ -65,10 +65,10 @@ public: /** * \brief Shrink highlighted region to no longer contain the * current content. - * - * The direction parameter indicates whether the highlighted region should be - * reduced from the start (direction > 0) or from the end (direction < 0). - * If direction is 0 all content is unhighlighted. + * + * The direction parameter indicates whether the highlighted region should + * be reduced from the start (direction > 0) or from the end + * (direction < 0). If direction is 0 all content is unhighlighted. */ virtual void unhighlight (int direction, HighlightLayer layer) = 0; @@ -80,7 +80,7 @@ public: * DwIterator::highlight(). */ virtual void getAllocation (int start, int end, Allocation *allocation) = 0; - + inline Iterator *cloneIterator () { return (Iterator*)clone(); } static void scrollTo (Iterator *it1, Iterator *it2, int start, int end, @@ -96,12 +96,12 @@ class EmptyIterator: public Iterator { private: EmptyIterator (EmptyIterator &it); - + public: EmptyIterator (Widget *widget, Content::Type mask, bool atEnd); - - object::Object *clone(); - int compareTo(misc::Comparable *other); + + lout::object::Object *clone(); + int compareTo(lout::misc::Comparable *other); bool next (); bool prev (); void highlight (int start, int end, HighlightLayer layer); @@ -119,14 +119,14 @@ class TextIterator: public Iterator private: /** May be NULL, in this case, the next is skipped. */ const char *text; - + TextIterator (TextIterator &it); - + public: TextIterator (Widget *widget, Content::Type mask, bool atEnd, const char *text); - - int compareTo(misc::Comparable *other); + + int compareTo(lout::misc::Comparable *other); bool next (); bool prev (); @@ -142,13 +142,13 @@ public: * iterators do not have the limitation, that iteration is only done within * a widget, instead, child widgets are iterated through recursively. */ -class DeepIterator: public object::Object, public misc::Comparable +class DeepIterator: public lout::object::Object, public lout::misc::Comparable { private: - class Stack: public container::typed::Vector<Iterator> + class Stack: public lout::container::typed::Vector<Iterator> { public: - inline Stack (): container::typed::Vector<Iterator> (4, false) { } + inline Stack (): lout::container::typed::Vector<Iterator> (4, false) { } ~Stack (); inline Iterator *getTop () { return get (size () - 1); } inline void push (Iterator *it) { put(it, -1); } @@ -168,14 +168,14 @@ private: inline DeepIterator () { } -public: +public: DeepIterator(Iterator *it); ~DeepIterator(); - object::Object *clone (); + lout::object::Object *clone (); DeepIterator *createVariant(Iterator *it); - inline Iterator *getTopIterator () { return stack.getTop(); } + inline Iterator *getTopIterator () { return stack.getTop(); } inline Content *getContent () { return &content; } bool isEmpty (); @@ -183,12 +183,12 @@ public: bool next (); bool prev (); inline DeepIterator *cloneDeepIterator() { return (DeepIterator*)clone(); } - int compareTo(misc::Comparable *other); + int compareTo(lout::misc::Comparable *other); /** * \brief Highlight a part of the current content. * - * Unhighlight the current content by passing -1 as start (see also + * Unhighlight the current content by passing -1 as start (see also * (dw::core::Iterator::unhighlight). For text, start and end define the * characters, otherwise, the shape is defined as [0, 1], i.e. for * highlighting a whole dw::core::Content, pass 0 and >= 1. @@ -216,10 +216,12 @@ public: start, end, hpos, vpos); } }; -class CharIterator: public object::Object, public misc::Comparable +class CharIterator: public lout::object::Object, public lout::misc::Comparable { public: - enum { START = -1, END = -2 }; + // START and END must not clash with any char value + // neither for signed nor unsigned char. + enum { START = 257, END = 258 }; private: DeepIterator *it; @@ -231,8 +233,8 @@ public: CharIterator (Widget *widget); ~CharIterator (); - object::Object *clone(); - int compareTo(misc::Comparable *other); + lout::object::Object *clone(); + int compareTo(lout::misc::Comparable *other); bool next (); bool prev (); |