ppDirectoryTree.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Filename: ppDirectoryTree.h
  2. // Created by: drose (28Sep00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef PPDIRECTORYTREE_H
  6. #define PPDIRECTORYTREE_H
  7. #include "ppremake.h"
  8. #include <vector>
  9. #include <map>
  10. #include <set>
  11. class PPCommandFile;
  12. class PPScope;
  13. class PPNamedScopes;
  14. ///////////////////////////////////////////////////////////////////
  15. // Class : PPDirectoryTree
  16. // Description : Stores the directory hierarchy relationship of the
  17. // source tree. Each PPDirectoryTree object is
  18. // one-to-one associated with a PPCommandFile object,
  19. // that corresponds to the source file found within this
  20. // directory.
  21. ////////////////////////////////////////////////////////////////////
  22. class PPDirectoryTree {
  23. public:
  24. PPDirectoryTree();
  25. ~PPDirectoryTree();
  26. protected:
  27. PPDirectoryTree(const string &dirname, PPDirectoryTree *parent);
  28. public:
  29. bool scan(const string &prefix, PPNamedScopes *named_scopes);
  30. int count_source_files() const;
  31. const string &get_dirname() const;
  32. int get_depends_index() const;
  33. string get_path() const;
  34. string get_rel_to(const PPDirectoryTree *other) const;
  35. PPDirectoryTree *find_dirname(const string &dirname);
  36. PPCommandFile *get_source() const;
  37. int get_num_children() const;
  38. PPDirectoryTree *get_child(int n) const;
  39. string get_child_dirnames() const;
  40. string get_complete_subtree() const;
  41. private:
  42. bool r_scan(const string &prefix);
  43. bool read_source_file(const string &prefix, PPNamedScopes *named_scopes);
  44. bool read_depends_file(PPNamedScopes *named_scopes);
  45. bool resolve_dependencies();
  46. bool compute_depends_index();
  47. string _dirname;
  48. PPScope *_scope;
  49. PPCommandFile *_source;
  50. PPDirectoryTree *_parent;
  51. typedef vector<PPDirectoryTree *> Children;
  52. Children _children;
  53. int _depth;
  54. typedef set<PPDirectoryTree *> Depends;
  55. Depends _i_depend_on;
  56. Depends _depends_on_me;
  57. int _depends_index;
  58. bool _computing_depends_index;
  59. typedef map<string, PPDirectoryTree *> Dirnames;
  60. Dirnames *_dirnames;
  61. };
  62. extern PPDirectoryTree *current_output_directory;
  63. #endif