cmListFileCache.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmListFileCache_h
  11. #define cmListFileCache_h
  12. #include "cmStandardIncludes.h"
  13. /** \class cmListFileCache
  14. * \brief A class to cache list file contents.
  15. *
  16. * cmListFileCache is a class used to cache the contents of parsed
  17. * cmake list files.
  18. */
  19. class cmMakefile;
  20. struct cmListFileArgument
  21. {
  22. enum Delimiter
  23. {
  24. Unquoted,
  25. Quoted,
  26. Bracket
  27. };
  28. cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {}
  29. cmListFileArgument(const cmListFileArgument& r):
  30. Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {}
  31. cmListFileArgument(const std::string& v, Delimiter d, const char* file,
  32. long line): Value(v), Delim(d),
  33. FilePath(file), Line(line) {}
  34. bool operator == (const cmListFileArgument& r) const
  35. {
  36. return (this->Value == r.Value) && (this->Delim == r.Delim);
  37. }
  38. bool operator != (const cmListFileArgument& r) const
  39. {
  40. return !(*this == r);
  41. }
  42. std::string Value;
  43. Delimiter Delim;
  44. const char* FilePath;
  45. long Line;
  46. };
  47. struct cmListFileContext
  48. {
  49. std::string Name;
  50. std::string FilePath;
  51. long Line;
  52. cmListFileContext(): Name(), FilePath(), Line(0) {}
  53. };
  54. std::ostream& operator<<(std::ostream&, cmListFileContext const&);
  55. struct cmListFileFunction: public cmListFileContext
  56. {
  57. std::vector<cmListFileArgument> Arguments;
  58. };
  59. class cmListFileBacktrace: public std::vector<cmListFileContext> {};
  60. struct cmListFile
  61. {
  62. cmListFile()
  63. :ModifiedTime(0)
  64. {
  65. }
  66. bool ParseFile(const char* path,
  67. bool topLevel,
  68. cmMakefile *mf);
  69. long int ModifiedTime;
  70. std::vector<cmListFileFunction> Functions;
  71. };
  72. struct cmValueWithOrigin {
  73. cmValueWithOrigin(const std::string &value,
  74. const cmListFileBacktrace &bt)
  75. : Value(value), Backtrace(bt)
  76. {}
  77. std::string Value;
  78. cmListFileBacktrace Backtrace;
  79. };
  80. #endif