From: <cn...@us...> - 2009-11-18 22:09:31
|
Revision: 622 http://hgengine.svn.sourceforge.net/hgengine/?rev=622&view=rev Author: cnlohr Date: 2009-11-18 22:09:24 +0000 (Wed, 18 Nov 2009) Log Message: ----------- add lastchild Modified Paths: -------------- Mercury2/src/MercuryNode.cpp Mercury2/src/MercuryNode.h Modified: Mercury2/src/MercuryNode.cpp =================================================================== --- Mercury2/src/MercuryNode.cpp 2009-11-18 22:09:16 UTC (rev 621) +++ Mercury2/src/MercuryNode.cpp 2009-11-18 22:09:24 UTC (rev 622) @@ -114,6 +114,15 @@ return NULL; } +MercuryNode* MercuryNode::LastChild() const +{ + if( !m_children.empty() ) + return m_children.back(); + else + return NULL; +} + + MercuryNode* MercuryNode::NextChild(const MercuryNode* child) const { if (child==NULL) return NULL; Modified: Mercury2/src/MercuryNode.h =================================================================== --- Mercury2/src/MercuryNode.h 2009-11-18 22:09:16 UTC (rev 621) +++ Mercury2/src/MercuryNode.h 2009-11-18 22:09:24 UTC (rev 622) @@ -41,6 +41,7 @@ inline MercuryNode* NextSibling() const { return m_nextSibling; } inline MercuryNode* PrevSibling() const { return m_prevSibling; } MercuryNode* FirstChild() const; + MercuryNode* LastChild() const; MercuryNode* NextChild(const MercuryNode* n) const; ///Finds the next child in regards to n MercuryNode* PrevChild(const MercuryNode* n) const; ///Finds the previous child in regards to n const std::list< MercuryNode* >& Children() const { return m_children; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |