PageRenderTime 28ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/win32/shellext/dirstate.h

https://bitbucket.org/tortoisehg/hgtk/
C Header | 56 lines | 26 code | 15 blank | 15 comment | 0 complexity | 024c80935ac56e1dc629b263df4ec38b MD5 | raw file
Possible License(s): GPL-2.0
  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 _DIRSTATE_H
  17. #define _DIRSTATE_H
  18. #include "Directory.h"
  19. #include <string>
  20. #define HASH_LENGTH 20
  21. class Dirstate
  22. {
  23. Directory root_;
  24. unsigned num_added_; // number of entries that have state 'a'
  25. unsigned num_entries_;
  26. public:
  27. char parent1[HASH_LENGTH];
  28. char parent2[HASH_LENGTH];
  29. static std::auto_ptr<Dirstate> read(const std::string& path, bool& unset);
  30. Directory& root() { return root_; }
  31. void add(const std::string& relpath, Direntry& e) {
  32. root_.add(relpath, e);
  33. ++num_entries_;
  34. }
  35. unsigned num_added() const { return num_added_; }
  36. unsigned size() const { return num_entries_; }
  37. private:
  38. Dirstate()
  39. : root_(0, "", ""), num_added_(0), num_entries_(0) {}
  40. };
  41. #endif