ppDirectory.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_rel_to(const PPDirectory *other) const;
  35. PPCommandFile *get_source() const;
  36. int get_num_children() const;
  37. PPDirectory *get_child(int n) const;
  38. string get_child_dirnames() const;
  39. string get_complete_subtree() const;
  40. PPDependableFile *get_dependable_file(const string &filename,
  41. bool is_header);
  42. void report_depends() const;
  43. void report_needs() const;
  44. private:
  45. typedef set<PPDirectory *> Depends;
  46. bool r_scan(const string &prefix);
  47. bool read_source_file(const string &prefix, PPNamedScopes *named_scopes);
  48. bool read_depends_file(PPNamedScopes *named_scopes);
  49. bool resolve_dependencies();
  50. bool compute_depends_index();
  51. void read_file_dependencies(const string &cache_filename);
  52. void update_file_dependencies(const string &cache_filename);
  53. void get_complete_i_depend_on(Depends &dep) const;
  54. void get_complete_depends_on_me(Depends &dep) const;
  55. void show_directories(const Depends &dep) const;
  56. string _dirname;
  57. PPScope *_scope;
  58. PPCommandFile *_source;
  59. PPDirectory *_parent;
  60. PPDirectoryTree *_tree;
  61. typedef vector<PPDirectory *> Children;
  62. Children _children;
  63. int _depth;
  64. Depends _i_depend_on;
  65. Depends _depends_on_me;
  66. int _depends_index;
  67. bool _computing_depends_index;
  68. typedef map<string, PPDependableFile *> Dependables;
  69. Dependables _dependables;
  70. friend class PPDirectoryTree;
  71. };
  72. extern PPDirectory *current_output_directory;
  73. #endif