cmSourceFile.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 cmSourceFile_h
  14. #define cmSourceFile_h
  15. #include "cmStandardIncludes.h"
  16. /** \class cmSourceFile
  17. * \brief Represent a class loaded from a makefile.
  18. *
  19. * cmSourceFile is represents a class loaded from
  20. * a makefile.
  21. */
  22. class cmSourceFile
  23. {
  24. public:
  25. /**
  26. * Construct instance as a concrete class with both a
  27. * .h and .cxx file.
  28. */
  29. cmSourceFile()
  30. {
  31. }
  32. /**
  33. * Set the name of the file, given the directory the file should be
  34. * in. The various extensions provided are tried on the name
  35. * (e.g., cxx, cpp) in the directory to find the actual file.
  36. */
  37. void SetName(const char* name, const char* dir,
  38. const std::vector<std::string>& sourceExts,
  39. const std::vector<std::string>& headerExts);
  40. /**
  41. * Set the name of the file, given the directory the file should be in. IN
  42. * this version the extension is provided in the call. This is useful for
  43. * generated files that do not exist prior to the build.
  44. */
  45. void SetName(const char* name, const char* dir, const char *ext,
  46. bool headerFileOnly);
  47. /**
  48. * Print the structure to std::cout.
  49. */
  50. void Print() const;
  51. ///! Set/Get a property of this source file
  52. void SetProperty(const char *prop, const char *value);
  53. const char *GetProperty(const char *prop) const;
  54. bool GetPropertyAsBool(const char *prop) const;
  55. /**
  56. * The full path to the file.
  57. */
  58. const std::string &GetFullPath() const {return m_FullPath;}
  59. void SetFullPath(const char *name) {m_FullPath = name;}
  60. /**
  61. * The file name associated with stripped off directory and extension.
  62. * (In most cases this is the name of the class.)
  63. */
  64. const std::string &GetSourceName() const {return m_SourceName;}
  65. void SetSourceName(const char *name) {m_SourceName = name;}
  66. /**
  67. * The file name associated with stripped off directory and extension.
  68. * (In most cases this is the name of the class.)
  69. */
  70. const std::string &GetSourceExtension() const {return m_SourceExtension;}
  71. void SetSourceExtension(const char *name) {m_SourceExtension = name;}
  72. /**
  73. * Return the vector that holds the list of dependencies
  74. */
  75. const std::vector<std::string> &GetDepends() const {return m_Depends;}
  76. std::vector<std::string> &GetDepends() {return m_Depends;}
  77. private:
  78. std::map<cmStdString,cmStdString> m_Properties;
  79. std::string m_FullPath;
  80. std::string m_SourceName;
  81. std::string m_SourceExtension;
  82. std::vector<std::string> m_Depends;
  83. };
  84. #endif