source: branches/visitor/lib/NodeVisitor.h @ 1225

Last change on this file since 1225 was 1225, checked in by Peter Johansson, 12 years ago

refs #476. Inital version of a CopyrightVisitor?.

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