cmListFileCache.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. cmListFileArgument(): Value(), Quoted(false), FilePath(0), Line(0) {}
  23. cmListFileArgument(const cmListFileArgument& r):
  24. Value(r.Value), Quoted(r.Quoted), FilePath(r.FilePath), Line(r.Line) {}
  25. cmListFileArgument(const std::string& v, bool q, const char* file,
  26. long line): Value(v), Quoted(q),
  27. FilePath(file), Line(line) {}
  28. bool operator == (const cmListFileArgument& r) const
  29. {
  30. return (this->Value == r.Value) && (this->Quoted == r.Quoted);
  31. }
  32. bool operator != (const cmListFileArgument& r) const
  33. {
  34. return !(*this == r);
  35. }
  36. std::string Value;
  37. bool Quoted;
  38. const char* FilePath;
  39. long Line;
  40. };
  41. struct cmListFileContext
  42. {
  43. std::string Name;
  44. std::string FilePath;
  45. long Line;
  46. cmListFileContext(): Name(), FilePath(), Line(0) {}
  47. };
  48. std::ostream& operator<<(std::ostream&, cmListFileContext const&);
  49. struct cmListFileFunction: public cmListFileContext
  50. {
  51. std::vector<cmListFileArgument> Arguments;
  52. };
  53. class cmListFileBacktrace: public std::vector<cmListFileContext> {};
  54. struct cmListFile
  55. {
  56. cmListFile()
  57. :ModifiedTime(0)
  58. {
  59. }
  60. bool ParseFile(const char* path,
  61. bool topLevel,
  62. cmMakefile *mf);
  63. long int ModifiedTime;
  64. std::vector<cmListFileFunction> Functions;
  65. };
  66. #endif