source: trunk/lib/Directory.h @ 693

Last change on this file since 693 was 693, checked in by Jari Häkkinen, 13 years ago

Fixes #339. Change to GPLv3.

  • 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 693 2008-09-11 20:42:56Z jari $
5
6/*
7  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, 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#include "Node.h"
26
27#include <map>
28#include <string>
29#include <vector>
30
31namespace theplu{
32namespace svndigest{
33
34  ///
35  /// Class taking care of directories.
36  ///
37  class Directory : public Node
38  {
39  public:
40
41    ///
42    /// @brief Constructor
43    ///
44    /// Recursively create a directory tree starting from \a path. All
45    /// entries except explicit directories are treated as File nodes,
46    /// i.e. symbolic links to directories are treated as File
47    /// nodes. This will ensure that the directory structure is a tree
48    /// and double counting of branches is avoided.
49    ///
50    /// @note Nodes named '.', '..', and '.svn' are ignored and not
51    /// traversed.
52    ///
53    Directory(const unsigned int level, const std::string& path, 
54              const std::string& output="");
55
56    ///
57    /// @brief Destructor
58    ///
59    ~Directory(void);
60
61    ///
62    /// @return true
63    ///
64    bool dir(void) const;
65
66    ///
67    /// @return directory-name/index.html
68    ///
69    std::string href(void) const;
70
71    /**
72       @return The explicit string "directory", nothing else.
73    */
74    std::string node_type(void) const;
75
76    /**
77       @return output path for example 'lib/File.h.html' for this file
78     */
79    std::string output_path(void) const;
80
81    const StatsCollection& parse(bool verbose, bool ignore);
82
83    using Node::print_copyright;
84    /**
85       virtual function typically called from Node::print_copyright
86    */
87    void print_copyright(std::map<std::string, Alias>&, bool verbose,
88                         const std::map<int, svn_revnum_t>&) const;
89
90  private:
91    /**
92       @return union of logs from daughter nodes.
93    */
94    SVNlog log_core(void) const;
95
96    ///
97    /// @brief Copy Constructor, not implemented
98    ///
99    Directory(const Directory&);
100
101    void print_core(bool verbose=false) const;
102
103    void print_core(const std::string& stats_type, const std::string& user, 
104                    const std::string& line_type, const SVNlog&) const;
105
106
107    typedef std::vector<Node*> NodeContainer;
108    typedef NodeContainer::iterator NodeIterator;
109    typedef NodeContainer::const_iterator NodeConstIterator;
110    NodeContainer daughters_;
111  };
112
113}} // end of namespace svndigest and namespace theplu
114
115#endif
Note: See TracBrowser for help on using the repository browser.