source: trunk/lib/SvndigestVisitor.cc @ 1234

Last change on this file since 1234 was 1234, checked in by Peter Johansson, 11 years ago

refs #476. Merged visitor branch into trunk. Used 'svn merge /branches/visitor' because --reintegrate did (currently) not work on our repo. Since I could not merge as suggested in subversion manual, I reverted all mergeinfo properties to avoid future confusion by svn-client. This means (I think) that there will be no connection about this commit and the visitor branch, but to svn-client this will look like a large changeset (just like a merge in the old days).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: SvndigestVisitor.cc 1234 2010-10-23 16:41:33Z peter $
2
3/*
4  Copyright (C) 2010 Peter Johansson
5
6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "SvndigestVisitor.h"
23
24#include "Directory.h"
25#include "File.h"
26#include "NodeVisitor.h"
27
28namespace theplu {
29namespace svndigest {
30
31  SvndigestVisitor::SvndigestVisitor(bool verbose, bool ignore_cache,
32                                     bool report)
33    : verbose_(verbose), ignore_cache_(ignore_cache), report_(report)
34  {}
35
36
37  bool SvndigestVisitor::enter(Directory& dir) 
38  {
39    if (dir.ignore())
40      return false;
41    return true;
42  }
43 
44
45  void SvndigestVisitor::leave(Directory& dir) 
46  {
47    if (report_) {
48      dir.collect_stats();
49      dir.init_tiny_stats();
50      dir.print(verbose_);
51    }
52  }
53 
54
55  void SvndigestVisitor::visit(File& file)
56  {
57    if (!file.ignore())
58      file.parse(verbose_, ignore_cache_);
59    if (report_) {
60      file.init_tiny_stats();
61      if (!file.ignore())
62        file.print(verbose_);
63    }
64  }
65
66}} // end of namespace svndigest and namespace theplu
67
Note: See TracBrowser for help on using the repository browser.