source: trunk/lib/Directory.h

Last change on this file was 1538, checked in by Peter Johansson, 9 years ago

refs #334. implement --update also for directories. For Directories the 'revision: ' tag in html output reflects the lowest revision of the nodes (Directory and sub-nodes). Directory is not reprinted if this revision is at least last_changed_rev, in other words, there is no node by node comparison but a more easily implemented collective comparison. In case of homogenous revision (no mixtures) this is is the same thing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#ifndef _theplu_svndigest_directory_
2#define _theplu_svndigest_directory_
3
4// $Id: Directory.h 1538 2012-10-07 09:29:04Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2012 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  class NodeVisitor;
36
37  ///
38  /// Class taking care of directories.
39  ///
40  class Directory : public Node
41  {
42  public:
43    ///
44    /// @brief Constructor
45    ///
46    /// Recursively create a directory tree starting from \a path. All
47    /// entries except explicit directories are treated as File nodes,
48    /// i.e. symbolic links to directories are treated as File
49    /// nodes. This will ensure that the directory structure is a tree
50    /// and double counting of branches is avoided.
51    ///
52    /// @note Nodes named '.', '..', and '.svn' are ignored and not
53    /// traversed.
54    ///
55    Directory(const unsigned int level, const std::string& path,
56              const std::string& output="", const std::string& project="");
57
58    ///
59    /// @brief Destructor
60    ///
61    ~Directory(void);
62
63    /**
64       Collect stats from daughter nodes and reset stats in daughter
65       nodes.
66     */
67    void collect_stats(void);
68
69    ///
70    /// @return true
71    ///
72    bool dir(void) const;
73
74    ///
75    /// @return directory-name/index.html
76    ///
77    std::string href(void) const;
78
79    /**
80       \brief Get the revision number of the latest commit.
81
82       Does not only check this directory but also daughter nodes.
83    */
84    svn_revnum_t last_changed_rev(void) const;
85
86    /**
87       @return The explicit string "directory", nothing else.
88    */
89    std::string node_type(void) const;
90
91    /**
92       @return output path for example 'lib/File.h.html' for this file
93     */
94    std::string output_path(void) const;
95
96    /**
97       \return min of revision of this Directory and its sub-nodes
98     */
99    svn_revnum_t revision_min(void) const;
100
101    /**
102       Calls visitor.enter(*this). If enter returns true, daughter
103       nodes are traverses. Finally visitor visitor.leave(*this) i called.
104     */
105    void traverse(NodeVisitor& visitor);
106
107  private:
108    /**
109       add union of logs from daughter nodes.
110    */
111    void log_core(SVNlog&) const;
112
113    ///
114    /// @brief Copy Constructor, not implemented
115    ///
116    Directory(const Directory&);
117
118    typedef std::vector<Node*> NodeContainer;
119    typedef NodeContainer::iterator NodeIterator;
120    typedef NodeContainer::const_iterator NodeConstIterator;
121    NodeContainer daughters_;
122
123    friend class DirectoryPrinter;
124  };
125
126}} // end of namespace svndigest and namespace theplu
127
128#endif
Note: See TracBrowser for help on using the repository browser.