summaryrefslogtreecommitdiff
path: root/starmath/inc/node.hxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-09-01 11:01:33 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2016-09-02 05:09:54 +0000
commitc9f445d1dee474cf6e7435ba176318735aa2ae67 (patch)
tree07f993feec2fad9b106f90a8526a9cf2435530c2 /starmath/inc/node.hxx
parent91ee1cdce712d50e1e6951bcd7ba82dac50d8038 (diff)
Replace SmNodeIterator with std::vector's iterator
and drop obsolete comments in SmCaretPosGraphBuildingVisitor's ctor. Change-Id: Ibbe5a810ff265eb558906552bb560f9145eaf0cd Reviewed-on: https://gerrit.libreoffice.org/28571 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath/inc/node.hxx')
-rw-r--r--starmath/inc/node.hxx60
1 files changed, 2 insertions, 58 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 3ecacb1988b7..91414ec7244c 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -220,64 +220,6 @@ private:
};
-/** A simple auxiliary iterator class for SmNode
- *
- * Example of iteration over children of pMyNode:
- * \code
- * //Node to iterate over:
- * SmNode* pMyNode = 0;// A pointer from somewhere
- * //The iterator:
- * SmNodeIterator it(pMyNode);
- * //The iteration:
- * while(it.Next()) {
- * it->SetSelected(true);
- * }
- * \endcode
- */
-class SmNodeIterator{
-public:
- SmNodeIterator(SmNode* node, bool bReverse = false){
- pNode = node;
- nSize = pNode->GetNumSubNodes();
- nIndex = 0;
- pChildNode = nullptr;
- bIsReverse = bReverse;
- }
- /** Get the subnode or NULL if none */
- SmNode* Next(){
- while(!bIsReverse && nIndex < nSize){
- if(nullptr != (pChildNode = pNode->GetSubNode(nIndex++)))
- return pChildNode;
- }
- while(bIsReverse && nSize > 0){
- if(nullptr != (pChildNode = pNode->GetSubNode((nSize--)-1)))
- return pChildNode;
- }
- pChildNode = nullptr;
- return nullptr;
- }
- /** Get the current child node, NULL if none */
- SmNode* Current(){
- return pChildNode;
- }
- /** Get the current child node, NULL if none */
- SmNode* operator->(){
- return pChildNode;
- }
-private:
- /** Current child */
- SmNode* pChildNode;
- /** Node whos children we're iterating over */
- SmNode* pNode;
- /** Size of the node */
- sal_uInt16 nSize;
- /** Current index in the node */
- sal_uInt16 nIndex;
- /** Move reverse */
- bool bIsReverse;
-};
-
-
/** Abstract baseclass for all composite node
*
* Subclasses of this class can have subnodes. Nodes that doesn't derivate from
@@ -309,6 +251,8 @@ public:
SmNodeArray::iterator begin() {return aSubNodes.begin();}
SmNodeArray::iterator end() {return aSubNodes.end();}
+ SmNodeArray::reverse_iterator rbegin() {return aSubNodes.rbegin();}
+ SmNodeArray::reverse_iterator rend() {return aSubNodes.rend();}
/** Get the index of a child node
*