ppDependableFile.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Filename: ppDependableFile.h
  2. // Created by: drose (15Oct00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef PPDEPENDABLEFILE_H
  6. #define PPDEPENDABLEFILE_H
  7. #include "ppremake.h"
  8. #include <set>
  9. #include <vector>
  10. class PPDirectory;
  11. ///////////////////////////////////////////////////////////////////
  12. // Class : PPDependableFile
  13. // Description : Corresponds to a single C/C++ source file, either a
  14. // .c file or a .h file, that can be scanned for a
  15. // number of #include statements. This file may both
  16. // depend on other files, as well as being depended upon
  17. // in turn. This is used to resolved inter-file
  18. // dependencies.
  19. ////////////////////////////////////////////////////////////////////
  20. class PPDependableFile {
  21. public:
  22. PPDependableFile(PPDirectory *directory, const string &filename);
  23. void update_from_cache(const vector<string> &words);
  24. void write_cache(ostream &out);
  25. PPDirectory *get_directory() const;
  26. const string &get_filename() const;
  27. string get_pathname() const;
  28. string get_dirpath() const;
  29. bool exists();
  30. time_t get_mtime();
  31. int get_num_dependencies();
  32. PPDependableFile *get_dependency(int n);
  33. void get_complete_dependencies(vector<PPDependableFile *> &files);
  34. void get_complete_dependencies(set<PPDependableFile *> &files);
  35. bool is_circularity();
  36. string get_circularity();
  37. bool was_examined() const;
  38. private:
  39. void update_dependencies();
  40. PPDependableFile *compute_dependencies(string &circularity);
  41. void stat_file();
  42. PPDirectory *_directory;
  43. string _filename;
  44. enum Flags {
  45. F_updating = 0x001,
  46. F_updated = 0x002,
  47. F_circularity = 0x004,
  48. F_statted = 0x008,
  49. F_exists = 0x010,
  50. F_from_cache = 0x020,
  51. };
  52. int _flags;
  53. string _circularity;
  54. time_t _mtime;
  55. class Dependency {
  56. public:
  57. PPDependableFile *_file;
  58. bool _okcircular;
  59. bool operator < (const Dependency &other) const;
  60. };
  61. typedef vector<Dependency> Dependencies;
  62. Dependencies _dependencies;
  63. typedef vector<string> ExtraIncludes;
  64. ExtraIncludes _extra_includes;
  65. };
  66. #endif