1223 |
17 Oct 10 |
peter |
1 |
#ifndef _theplu_svndigest_node_visitor_ |
1223 |
17 Oct 10 |
peter |
2 |
#define _theplu_svndigest_node_visitor_ |
1223 |
17 Oct 10 |
peter |
3 |
|
1223 |
17 Oct 10 |
peter |
// $Id$ |
1223 |
17 Oct 10 |
peter |
5 |
|
1223 |
17 Oct 10 |
peter |
6 |
/* |
1223 |
17 Oct 10 |
peter |
Copyright (C) 2010 Peter Johansson |
1223 |
17 Oct 10 |
peter |
8 |
|
1223 |
17 Oct 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1223 |
17 Oct 10 |
peter |
10 |
|
1223 |
17 Oct 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1223 |
17 Oct 10 |
peter |
under the terms of the GNU General Public License as published by |
1223 |
17 Oct 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1223 |
17 Oct 10 |
peter |
(at your option) any later version. |
1223 |
17 Oct 10 |
peter |
15 |
|
1223 |
17 Oct 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1223 |
17 Oct 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1223 |
17 Oct 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1223 |
17 Oct 10 |
peter |
General Public License for more details. |
1223 |
17 Oct 10 |
peter |
20 |
|
1223 |
17 Oct 10 |
peter |
You should have received a copy of the GNU General Public License |
1223 |
17 Oct 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1223 |
17 Oct 10 |
peter |
23 |
*/ |
1223 |
17 Oct 10 |
peter |
24 |
|
1223 |
17 Oct 10 |
peter |
25 |
|
1223 |
17 Oct 10 |
peter |
26 |
namespace theplu{ |
1223 |
17 Oct 10 |
peter |
27 |
namespace svndigest{ |
1223 |
17 Oct 10 |
peter |
28 |
|
1223 |
17 Oct 10 |
peter |
29 |
class Directory; |
1223 |
17 Oct 10 |
peter |
30 |
class File; |
1223 |
17 Oct 10 |
peter |
31 |
|
1223 |
17 Oct 10 |
peter |
32 |
/** |
1223 |
17 Oct 10 |
peter |
Abstract Base Class for Visitors. |
1223 |
17 Oct 10 |
peter |
34 |
*/ |
1223 |
17 Oct 10 |
peter |
35 |
class NodeVisitor |
1223 |
17 Oct 10 |
peter |
36 |
{ |
1223 |
17 Oct 10 |
peter |
37 |
public: |
1223 |
17 Oct 10 |
peter |
38 |
/** |
1223 |
17 Oct 10 |
peter |
\brief Destructor |
1223 |
17 Oct 10 |
peter |
40 |
*/ |
1225 |
17 Oct 10 |
peter |
41 |
virtual ~NodeVisitor(void) {}; |
1223 |
17 Oct 10 |
peter |
42 |
|
1223 |
17 Oct 10 |
peter |
43 |
/** |
1223 |
17 Oct 10 |
peter |
This function is called from Directory::traverse |
1223 |
17 Oct 10 |
peter |
45 |
|
1223 |
17 Oct 10 |
peter |
This is a chance for the visitor to do some action before |
1223 |
17 Oct 10 |
peter |
traversing daughter nodes. |
1225 |
17 Oct 10 |
peter |
48 |
|
1225 |
17 Oct 10 |
peter |
\return true if we should traverse daughter nodes |
1223 |
17 Oct 10 |
peter |
50 |
*/ |
1225 |
17 Oct 10 |
peter |
51 |
virtual bool enter(Directory& dir)=0; |
1223 |
17 Oct 10 |
peter |
52 |
|
1223 |
17 Oct 10 |
peter |
53 |
/** |
1223 |
17 Oct 10 |
peter |
This function is called from Directory::traverse |
1223 |
17 Oct 10 |
peter |
55 |
|
1223 |
17 Oct 10 |
peter |
This is a chance for the visitor to do some action after |
1223 |
17 Oct 10 |
peter |
daughter nodes have been traversed. |
1223 |
17 Oct 10 |
peter |
58 |
*/ |
1223 |
17 Oct 10 |
peter |
59 |
virtual void leave(Directory& dir)=0; |
1223 |
17 Oct 10 |
peter |
60 |
|
1223 |
17 Oct 10 |
peter |
61 |
/** |
1223 |
17 Oct 10 |
peter |
Do some action on the File. This action typically overlaps |
1223 |
17 Oct 10 |
peter |
significantly with enter(1) and/or leave(1) functions above, in |
1223 |
17 Oct 10 |
peter |
which case it is recommended to implement these with underlying |
1223 |
17 Oct 10 |
peter |
functions. To keep the base class flexible, however, the |
1223 |
17 Oct 10 |
peter |
functions for directory and files are kept independent in this |
1223 |
17 Oct 10 |
peter |
base class. |
1223 |
17 Oct 10 |
peter |
68 |
*/ |
1223 |
17 Oct 10 |
peter |
69 |
virtual void visit(File& dir)=0; |
1223 |
17 Oct 10 |
peter |
70 |
}; |
1223 |
17 Oct 10 |
peter |
71 |
}} // end of namespace svndigest and namespace theplu |
1223 |
17 Oct 10 |
peter |
72 |
|
1223 |
17 Oct 10 |
peter |
73 |
#endif |