source: trunk/lib/Directory.h @ 757

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

closes #185 and avoid copying in recursive log function

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1#ifndef _theplu_svndigest_directory_
2#define _theplu_svndigest_directory_
3
4// $Id: Directory.h 757 2009-01-27 23:00:58Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009 Peter Johansson
9
10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
11
12  svndigest is free software; you can redistribute it and/or modify it
13  under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 3 of the License, or
15  (at your option) any later version.
16
17  svndigest is distributed in the hope that it will be useful, but
18  WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include "Node.h"
27
28#include <map>
29#include <string>
30#include <vector>
31
32namespace theplu{
33namespace svndigest{
34
35  ///
36  /// Class taking care of directories.
37  ///
38  class Directory : public Node
39  {
40  public:
41
42    ///
43    /// @brief Constructor
44    ///
45    /// Recursively create a directory tree starting from \a path. All
46    /// entries except explicit directories are treated as File nodes,
47    /// i.e. symbolic links to directories are treated as File
48    /// nodes. This will ensure that the directory structure is a tree
49    /// and double counting of branches is avoided.
50    ///
51    /// @note Nodes named '.', '..', and '.svn' are ignored and not
52    /// traversed.
53    ///
54    Directory(const unsigned int level, const std::string& path, 
55              const std::string& output="");
56
57    ///
58    /// @brief Destructor
59    ///
60    ~Directory(void);
61
62    ///
63    /// @return true
64    ///
65    bool dir(void) const;
66
67    ///
68    /// @return directory-name/index.html
69    ///
70    std::string href(void) const;
71
72    /**
73       @return The explicit string "directory", nothing else.
74    */
75    std::string node_type(void) const;
76
77    /**
78       @return output path for example 'lib/File.h.html' for this file
79     */
80    std::string output_path(void) const;
81
82    const StatsCollection& parse(bool verbose, bool ignore);
83
84    using Node::print_copyright;
85    /**
86       virtual function typically called from Node::print_copyright
87    */
88    void print_copyright(std::map<std::string, Alias>&, bool verbose,
89                         const std::map<int, svn_revnum_t>&) const;
90
91  private:
92    /**
93       add union of logs from daughter nodes.
94    */
95    void log_core(SVNlog&) const;
96
97    ///
98    /// @brief Copy Constructor, not implemented
99    ///
100    Directory(const Directory&);
101
102    void print_core(bool verbose=false) const;
103
104    void print_core(const std::string& stats_type, const std::string& user, 
105                    const std::string& line_type, const SVNlog&) const;
106
107
108    typedef std::vector<Node*> NodeContainer;
109    typedef NodeContainer::iterator NodeIterator;
110    typedef NodeContainer::const_iterator NodeConstIterator;
111    NodeContainer daughters_;
112  };
113
114}} // end of namespace svndigest and namespace theplu
115
116#endif
Note: See TracBrowser for help on using the repository browser.