cmListFileCache.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmListFileCache_h
  14. #define cmListFileCache_h
  15. #include "cmStandardIncludes.h"
  16. /** \class cmListFileCache
  17. * \brief A class to cache list file contents.
  18. *
  19. * cmListFileCache is a class used to cache the contents of parsed
  20. * cmake list files.
  21. */
  22. class cmMakefile;
  23. struct cmListFileArgument
  24. {
  25. cmListFileArgument(): Value(), Quoted(false), FilePath(0), Line(0) {}
  26. cmListFileArgument(const cmListFileArgument& r):
  27. Value(r.Value), Quoted(r.Quoted), FilePath(r.FilePath), Line(r.Line) {}
  28. cmListFileArgument(const std::string& v, bool q, const char* file,
  29. long line): Value(v), Quoted(q),
  30. FilePath(file), Line(line) {}
  31. bool operator == (const cmListFileArgument& r) const
  32. {
  33. return (this->Value == r.Value) && (this->Quoted == r.Quoted);
  34. }
  35. bool operator != (const cmListFileArgument& r) const
  36. {
  37. return !(*this == r);
  38. }
  39. std::string Value;
  40. bool Quoted;
  41. const char* FilePath;
  42. long Line;
  43. };
  44. struct cmListFileContext
  45. {
  46. std::string Name;
  47. std::string FilePath;
  48. long Line;
  49. cmListFileContext(): Name(), FilePath(), Line(0) {}
  50. };
  51. std::ostream& operator<<(std::ostream&, cmListFileContext const&);
  52. struct cmListFileFunction: public cmListFileContext
  53. {
  54. std::vector<cmListFileArgument> Arguments;
  55. };
  56. class cmListFileBacktrace: public std::vector<cmListFileContext> {};
  57. struct cmListFile
  58. {
  59. cmListFile()
  60. :ModifiedTime(0)
  61. {
  62. }
  63. bool ParseFile(const char* path,
  64. bool topLevel,
  65. cmMakefile *mf);
  66. long int ModifiedTime;
  67. std::vector<cmListFileFunction> Functions;
  68. };
  69. #endif