ppDirectory.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Filename: ppDirectory.h
  2. // Created by: drose (28Sep00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef PPDIRECTORY_H
  6. #define PPDIRECTORY_H
  7. #include "ppremake.h"
  8. #include <vector>
  9. #include <map>
  10. #include <set>
  11. class PPCommandFile;
  12. class PPScope;
  13. class PPNamedScopes;
  14. class PPDirectoryTree;
  15. class PPDependableFile;
  16. ///////////////////////////////////////////////////////////////////
  17. // Class : PPDirectory
  18. // Description : Represents a single directory in the source
  19. // hierarchy. Each PPDirectory object is one-to-one
  20. // associated with a PPCommandFile object, that
  21. // corresponds to the source file found within this
  22. // directory.
  23. ////////////////////////////////////////////////////////////////////
  24. class PPDirectory {
  25. public:
  26. PPDirectory(PPDirectoryTree *tree);
  27. PPDirectory(const string &dirname, PPDirectory *parent);
  28. ~PPDirectory();
  29. PPDirectoryTree *get_tree() const;
  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_fullpath() const;
  35. string get_rel_to(const PPDirectory *other) const;
  36. PPCommandFile *get_source() const;
  37. int get_num_children() const;
  38. PPDirectory *get_child(int n) const;
  39. string get_child_dirnames() const;
  40. string get_complete_subtree() const;
  41. PPDependableFile *get_dependable_file(const string &filename,
  42. bool is_header);
  43. void report_depends() const;
  44. void report_reverse_depends() const;
  45. private:
  46. typedef set<PPDirectory *> Depends;
  47. bool r_scan(const string &prefix);
  48. bool scan_extra_depends(const string &cache_filename);
  49. bool read_source_file(const string &prefix, PPNamedScopes *named_scopes);
  50. bool read_depends_file(PPNamedScopes *named_scopes);
  51. bool resolve_dependencies();
  52. bool compute_depends_index();
  53. void read_file_dependencies(const string &cache_filename);
  54. void update_file_dependencies(const string &cache_filename);
  55. void get_complete_i_depend_on(Depends &dep) const;
  56. void get_complete_depends_on_me(Depends &dep) const;
  57. void show_directories(const Depends &dep) const;
  58. string _dirname;
  59. PPScope *_scope;
  60. PPCommandFile *_source;
  61. PPDirectory *_parent;
  62. PPDirectoryTree *_tree;
  63. typedef vector<PPDirectory *> Children;
  64. Children _children;
  65. int _depth;
  66. Depends _i_depend_on;
  67. Depends _depends_on_me;
  68. int _depends_index;
  69. bool _computing_depends_index;
  70. typedef map<string, PPDependableFile *> Dependables;
  71. Dependables _dependables;
  72. friend class PPDirectoryTree;
  73. };
  74. extern PPDirectory *current_output_directory;
  75. #endif