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