1 | #ifndef _theplu_svndigest_directory_ |
---|
2 | #define _theplu_svndigest_directory_ |
---|
3 | |
---|
4 | // $Id: Directory.h 176 2006-09-02 04:17:28Z peter $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson |
---|
8 | |
---|
9 | This file is part of svndigest, http://lev.thep.lu.se/trac/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 2 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 this program; if not, write to the Free Software |
---|
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
24 | 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | #include "Node.h" |
---|
28 | |
---|
29 | #include <list> |
---|
30 | #include <string> |
---|
31 | |
---|
32 | namespace theplu{ |
---|
33 | namespace 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 u_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 | const Stats& parse(const bool verbose=false); |
---|
73 | |
---|
74 | void print(const bool verbose=false) const; |
---|
75 | |
---|
76 | private: |
---|
77 | /// |
---|
78 | /// @brief Copy Constructor, not implemented |
---|
79 | /// |
---|
80 | Directory(const Directory&); |
---|
81 | |
---|
82 | /// |
---|
83 | /// @return false |
---|
84 | /// |
---|
85 | bool binary(void) const; |
---|
86 | |
---|
87 | typedef std::list<Node*> NodeContainer; |
---|
88 | typedef NodeContainer::iterator NodeIterator; |
---|
89 | typedef NodeContainer::const_iterator NodeConstIterator; |
---|
90 | NodeContainer daughters_; |
---|
91 | }; |
---|
92 | |
---|
93 | }} // end of namespace svndigest and namespace theplu |
---|
94 | |
---|
95 | #endif |
---|