/win32/shellext/Dirstatecache.h

https://bitbucket.org/tortoisehg/hgtk/ · C Header · 55 lines · 30 code · 10 blank · 15 comment · 0 complexity · 889e6d70b5c09d2de3de48834664ffec 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 _DIRSTATECACHE_H
  17. #define _DIRSTATECACHE_H
  18. #include <string>
  19. #include <list>
  20. class Dirstate;
  21. class Dirstatecache
  22. {
  23. struct E
  24. {
  25. Dirstate* dstate;
  26. __int64 dstate_mtime;
  27. __int64 dstate_size;
  28. std::string hgroot;
  29. unsigned tickcount;
  30. bool unset;
  31. E():
  32. dstate(0),
  33. dstate_mtime(0),
  34. dstate_size(0),
  35. tickcount(0),
  36. unset(false)
  37. {}
  38. };
  39. static std::list<E>& cache();
  40. public:
  41. static Dirstate* get(
  42. const std::string& hgroot, const std::string& cwd, bool& unset);
  43. static void invalidate(const std::string& hgroot);
  44. };
  45. #endif