FilesTree.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _FilesTree_h_
  2. #define _FilesTree_h_
  3. #include "MirrorPath.h"
  4. class FilesTree
  5. {
  6. private:
  7. struct Node
  8. {
  9. Node();
  10. Node * parent;
  11. string name;
  12. array<MirrorPath *> path;
  13. array<Node *> children;
  14. };
  15. public:
  16. FilesTree();
  17. ~FilesTree();
  18. public:
  19. //Добавить объект отображающий путь
  20. void AddMirrorPath(MirrorPath * mp, const char * on);
  21. //Удалить объект отображающий путь
  22. void DelMirrorPath(MirrorPath * mp);
  23. //Получить список зеркальных путей
  24. dword FindPaths(const char * fullPath);
  25. //Получить путь из списка
  26. const char * GetPath(dword index);
  27. private:
  28. //Добавить новый путь и вернуть конечный узел
  29. Node * AddPath(Node & node, const char * path);
  30. //Поиск всех путей и проверка файлов в паке
  31. void TreeProcess(Node & node, const char * fullPath);
  32. private:
  33. //Сравнить строки
  34. static bool IsEqual(const char * str1, long len1, const char * str2, long len2);
  35. private:
  36. //Дерево путей, на которое отображаются зеркальные пути
  37. Node root;
  38. //Поиск путей
  39. string path;
  40. array<string> paths;
  41. dword pathsCount;
  42. };
  43. #endif