1 | #ifndef _theplu_svndigest_directory_ |
---|
2 | #define _theplu_svndigest_directory_ |
---|
3 | |
---|
4 | // $Id: Directory.h 380 2007-06-21 19:25:39Z jari $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson |
---|
8 | Copyright (C) 2007 Peter Johansson |
---|
9 | |
---|
10 | This file is part of svndigest, http://lev.thep.lu.se/trac/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 2 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 this program; if not, write to the Free Software |
---|
24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
25 | 02111-1307, USA. |
---|
26 | */ |
---|
27 | |
---|
28 | #include "Node.h" |
---|
29 | |
---|
30 | #include <list> |
---|
31 | #include <map> |
---|
32 | #include <string> |
---|
33 | |
---|
34 | namespace theplu{ |
---|
35 | namespace svndigest{ |
---|
36 | |
---|
37 | /// |
---|
38 | /// Class taking care of directories. |
---|
39 | /// |
---|
40 | class Directory : public Node |
---|
41 | { |
---|
42 | public: |
---|
43 | |
---|
44 | /// |
---|
45 | /// @brief Constructor |
---|
46 | /// |
---|
47 | /// Recursively create a directory tree starting from \a path. All |
---|
48 | /// entries except explicit directories are treated as File nodes, |
---|
49 | /// i.e. symbolic links to directories are treated as File |
---|
50 | /// nodes. This will ensure that the directory structure is a tree |
---|
51 | /// and double counting of branches is avoided. |
---|
52 | /// |
---|
53 | /// @note Nodes named '.', '..', and '.svn' are ignored and not |
---|
54 | /// traversed. |
---|
55 | /// |
---|
56 | Directory(const u_int level, const std::string& path, |
---|
57 | const std::string& output=""); |
---|
58 | |
---|
59 | /// |
---|
60 | /// @brief Destructor |
---|
61 | /// |
---|
62 | ~Directory(void); |
---|
63 | |
---|
64 | /// |
---|
65 | /// @return true |
---|
66 | /// |
---|
67 | bool dir(void) const; |
---|
68 | |
---|
69 | /// |
---|
70 | /// @return directory-name/index.html |
---|
71 | /// |
---|
72 | std::string href(void) const; |
---|
73 | |
---|
74 | /** |
---|
75 | @return The explicit string "directory", nothing else. |
---|
76 | */ |
---|
77 | std::string node_type(void) const; |
---|
78 | |
---|
79 | /** |
---|
80 | @return output path for example 'lib/File.h.html' for this file |
---|
81 | */ |
---|
82 | std::string output_path(void) const; |
---|
83 | |
---|
84 | const Stats& parse(const bool verbose=false); |
---|
85 | |
---|
86 | void print_copyright(std::map<std::string, Alias>&) const; |
---|
87 | |
---|
88 | private: |
---|
89 | /// |
---|
90 | /// @brief Copy Constructor, not implemented |
---|
91 | /// |
---|
92 | Directory(const Directory&); |
---|
93 | |
---|
94 | void print_core(bool verbose=false) const; |
---|
95 | |
---|
96 | void print_core(const std::string& user, const std::string& line_type, |
---|
97 | const SVNlog&) const; |
---|
98 | |
---|
99 | |
---|
100 | typedef std::list<Node*> NodeContainer; |
---|
101 | typedef NodeContainer::iterator NodeIterator; |
---|
102 | typedef NodeContainer::const_iterator NodeConstIterator; |
---|
103 | NodeContainer daughters_; |
---|
104 | }; |
---|
105 | |
---|
106 | }} // end of namespace svndigest and namespace theplu |
---|
107 | |
---|
108 | #endif |
---|