PageRenderTime 35ms CodeModel.GetById 23ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/win32/shellext/Directory.h

https://bitbucket.org/tortoisehg/hgtk/
C++ Header | 54 lines | 24 code | 15 blank | 15 comment | 0 complexity | 80c08fa7222719bc936b049a4eebe965 MD5 | raw file
 1
 2// Copyright (C) 2009 Benjamin Pollack
 3// Copyright (C) 2009 Adrian Buehlmann
 4//
 5// This program is free software: you can redistribute it and/or modify
 6// it under the terms of the GNU General Public License as published by
 7// the Free Software Foundation, either version 2 of the License, or
 8// (at your option) any later version.
 9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18#ifndef DIRECTORY_H
19#define DIRECTORY_H
20
21#include "Direntry.h"
22
23#include <vector>
24#include <string>
25
26
27class Directory
28{
29    typedef std::vector<Directory*> DirsT;
30    typedef std::vector<Direntry> FilesT;
31
32    Directory* const parent_;
33    const std::string name_;
34    std::string path_;
35
36    DirsT  subdirs_;
37    FilesT files_;
38
39public:
40    Directory(Directory* p, const std::string& n, const std::string& basepath);
41    ~Directory();
42
43    const std::string& path() const { return path_; }
44
45    int add(const std::string& relpath, Direntry& e);
46
47    const Direntry* get(const std::string& relpath) const;
48    Directory* getdir(const std::string& n);
49
50    void print() const;
51};
52
53#endif
54