cmSourceFile.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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. m_AbstractClass = false;
  32. m_HeaderFileOnly = false;
  33. m_WrapExclude = false;
  34. }
  35. /**
  36. * Set the name of the file, given the directory the file should be
  37. * in. The various extensions provided are tried on the name
  38. * (e.g., cxx, cpp) in the directory to find the actual file.
  39. */
  40. void SetName(const char* name, const char* dir,
  41. const std::vector<std::string>& sourceExts,
  42. const std::vector<std::string>& headerExts);
  43. /**
  44. * Set the name of the file, given the directory the file should be in. IN
  45. * this version the extension is provided in the call. This is useful for
  46. * generated files that do not exist prior to the build.
  47. */
  48. void SetName(const char* name, const char* dir, const char *ext,
  49. bool headerFileOnly);
  50. /**
  51. * Print the structure to std::cout.
  52. */
  53. void Print() const;
  54. /**
  55. * Indicate whether the class is abstract (non-instantiable).
  56. */
  57. bool IsAnAbstractClass() const { return m_AbstractClass; }
  58. bool GetIsAnAbstractClass() const { return m_AbstractClass; }
  59. void SetIsAnAbstractClass(bool f) { m_AbstractClass = f; }
  60. /**
  61. * Indicate whether the class should not be wrapped
  62. */
  63. bool GetWrapExclude() const { return m_WrapExclude; }
  64. void SetWrapExclude(bool f) { m_WrapExclude = f; }
  65. /**
  66. * Indicate whether this class is defined with only the header file.
  67. */
  68. bool IsAHeaderFileOnly() const { return m_HeaderFileOnly; }
  69. bool GetIsAHeaderFileOnly() const { return m_HeaderFileOnly; }
  70. void SetIsAHeaderFileOnly(bool f) { m_HeaderFileOnly = f; }
  71. /**
  72. * The full path to the file.
  73. */
  74. std::string GetFullPath() const {return m_FullPath;}
  75. void SetFullPath(const char *name) {m_FullPath = name;}
  76. /**
  77. * The file name associated with stripped off directory and extension.
  78. * (In most cases this is the name of the class.)
  79. */
  80. const std::string &GetSourceName() const {return m_SourceName;}
  81. void SetSourceName(const char *name) {m_SourceName = name;}
  82. /**
  83. * The file name associated with stripped off directory and extension.
  84. * (In most cases this is the name of the class.)
  85. */
  86. std::string GetSourceExtension() const {return m_SourceExtension;}
  87. void SetSourceExtension(const char *name) {m_SourceExtension = name;}
  88. /**
  89. * Return the vector that holds the list of dependencies
  90. */
  91. const std::vector<std::string> &GetDepends() const {return m_Depends;}
  92. std::vector<std::string> &GetDepends() {return m_Depends;}
  93. ///! Set/Get per file compiler flags
  94. void SetCompileFlags(const char* f) { m_CompileFlags = f;}
  95. const char* GetCompileFlags() const { return m_CompileFlags.size() ? m_CompileFlags.c_str(): 0; }
  96. private:
  97. bool m_AbstractClass;
  98. bool m_WrapExclude;
  99. bool m_HeaderFileOnly;
  100. std::string m_CompileFlags;
  101. std::string m_FullPath;
  102. std::string m_SourceName;
  103. std::string m_SourceExtension;
  104. std::vector<std::string> m_Depends;
  105. };
  106. #endif