ppDependableFile.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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(set<PPDependableFile *> &files);
  34. bool is_circularity();
  35. string get_circularity();
  36. bool was_examined() const;
  37. private:
  38. void update_dependencies();
  39. PPDependableFile *compute_dependencies(string &circularity);
  40. void stat_file();
  41. PPDirectory *_directory;
  42. string _filename;
  43. enum Flags {
  44. F_updating = 0x001,
  45. F_updated = 0x002,
  46. F_circularity = 0x004,
  47. F_statted = 0x008,
  48. F_exists = 0x010,
  49. F_from_cache = 0x020,
  50. };
  51. int _flags;
  52. string _circularity;
  53. time_t _mtime;
  54. class Dependency {
  55. public:
  56. PPDependableFile *_file;
  57. bool _okcircular;
  58. };
  59. typedef vector<Dependency> Dependencies;
  60. Dependencies _dependencies;
  61. typedef vector<string> ExtraIncludes;
  62. ExtraIncludes _extra_includes;
  63. };
  64. #endif