From d54f0605a9951edb38c21e7987ef3d9ea7a2011c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 27 Aug 2011 16:44:47 +0000 Subject: [PATCH] More understandable symbolic constants in generic wxDVC's DoJob class. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 8eb2d721da..13233aa7e8 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1959,10 +1959,13 @@ public: virtual ~DoJob() { } // The return value control how the tree-walker tranverse the tree - // 0: Job done, stop tranverse and return - // 1: Ignore the current node's subtree and continue - // 2: Job not done, continue - enum { OK = 0 , IGR = 1, CONT = 2 }; + enum + { + DONE, // Job done, stop traversing and return + SKIP_SUBTREE, // Ignore the current node's subtree and continue + CONTINUE // Job not done, continue + }; + virtual int operator() ( wxDataViewTreeNode * node ) = 0; }; @@ -1972,11 +1975,11 @@ bool Walker( wxDataViewTreeNode * node, DoJob & func ) switch( func( node ) ) { - case DoJob::OK: + case DoJob::DONE: return true; - case DoJob::IGR: + case DoJob::SKIP_SUBTREE: return false; - case DoJob::CONT: + case DoJob::CONTINUE: break; } @@ -2761,13 +2764,13 @@ public: if( current == static_cast(row)) { ret = node; - return DoJob::OK; + return DoJob::DONE; } if( node->GetSubTreeCount() + current < static_cast(row) ) { current += node->GetSubTreeCount(); - return DoJob::IGR; + return DoJob::SKIP_SUBTREE; } else { @@ -2781,10 +2784,10 @@ public: { const int index = static_cast(row) - current - 1; ret = node->GetChildNodes()[index]; - return DoJob::OK; + return DoJob::DONE; } - return DoJob::CONT; + return DoJob::CONTINUE; } } @@ -3168,18 +3171,18 @@ public: ret ++; if( node->GetItem() == item ) { - return DoJob::OK; + return DoJob::DONE; } if( node->GetItem() == *m_iter ) { m_iter++; - return DoJob::CONT; + return DoJob::CONTINUE; } else { ret += node->GetSubTreeCount(); - return DoJob::IGR; + return DoJob::SKIP_SUBTREE; } }