cppFile.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Filename: cppFile.h
  2. // Created by: drose (11Nov99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef CPPFILE_H
  6. #define CPPFILE_H
  7. #include <dtoolbase.h>
  8. #include <filename.h>
  9. ///////////////////////////////////////////////////////////////////
  10. // Class : CPPFile
  11. // Description : This defines a source file (typically a C++ header
  12. // file) that is parsed by the CPPParser. Each
  13. // declaration indicates the source file where it
  14. // appeared.
  15. ////////////////////////////////////////////////////////////////////
  16. class CPPFile {
  17. public:
  18. enum Source {
  19. S_local, // File resides in the current directory
  20. S_alternate, // File resides in some other directory
  21. S_system, // File resides in a system directory
  22. S_none, // File is internally generated
  23. };
  24. CPPFile(const Filename &filename = "",
  25. const Filename &filename_as_referenced = "",
  26. Source source = S_none);
  27. CPPFile(const CPPFile &copy);
  28. void operator = (const CPPFile &copy);
  29. ~CPPFile();
  30. bool is_c_or_i_file() const;
  31. static bool is_c_or_i_file(const Filename &filename);
  32. bool is_c_file() const;
  33. static bool is_c_file(const Filename &filename);
  34. void replace_nearer(const CPPFile &other);
  35. bool operator < (const CPPFile &other) const;
  36. bool operator == (const CPPFile &other) const;
  37. bool operator != (const CPPFile &other) const;
  38. const char *c_str() const;
  39. bool empty() const;
  40. Filename _filename;
  41. Filename _filename_as_referenced;
  42. Source _source;
  43. };
  44. inline ostream &operator << (ostream &out, const CPPFile &file) {
  45. return out << file._filename;
  46. }
  47. #endif