cmStandardIncludes.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. /**
  11. * Include header files as a function of the build process, compiler,
  12. * and operating system.
  13. */
  14. #ifndef cmStandardIncludes_h
  15. #define cmStandardIncludes_h
  16. #include <cmConfigure.h>
  17. // Provide fixed-size integer types.
  18. #include <cm_kwiml.h>
  19. #include <fstream>
  20. #include <iomanip>
  21. #include <iostream>
  22. #include <sstream>
  23. // we must have stl with the standard include style
  24. #include <algorithm>
  25. #include <functional>
  26. #include <iterator>
  27. #include <map>
  28. #include <set>
  29. #include <string>
  30. #include <vector>
  31. // include the "c" string header
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #if defined(_MSC_VER)
  36. typedef unsigned short mode_t;
  37. #else
  38. #include <sys/types.h>
  39. #endif
  40. // use this class to shrink the size of symbols in .o files
  41. // std::string is really basic_string<....lots of stuff....>
  42. // when combined with a map or set, the symbols can be > 2000 chars!
  43. #include <cmsys/String.hxx>
  44. // typedef cmsys::String std::string;
  45. /* Poison this operator to avoid common mistakes. */
  46. extern void operator<<(std::ostream&, const std::ostringstream&);
  47. /** Standard documentation entry for cmDocumentation's formatting. */
  48. struct cmDocumentationEntry
  49. {
  50. std::string Name;
  51. std::string Brief;
  52. cmDocumentationEntry() {}
  53. cmDocumentationEntry(const char* doc[2])
  54. {
  55. if (doc[0]) {
  56. this->Name = doc[0];
  57. }
  58. if (doc[1]) {
  59. this->Brief = doc[1];
  60. }
  61. }
  62. cmDocumentationEntry(const char* n, const char* b)
  63. {
  64. if (n) {
  65. this->Name = n;
  66. }
  67. if (b) {
  68. this->Brief = b;
  69. }
  70. }
  71. };
  72. /** Data structure to represent a single command line. */
  73. class cmCustomCommandLine : public std::vector<std::string>
  74. {
  75. public:
  76. typedef std::vector<std::string> Superclass;
  77. typedef Superclass::iterator iterator;
  78. typedef Superclass::const_iterator const_iterator;
  79. };
  80. /** Data structure to represent a list of command lines. */
  81. class cmCustomCommandLines : public std::vector<cmCustomCommandLine>
  82. {
  83. public:
  84. typedef std::vector<cmCustomCommandLine> Superclass;
  85. typedef Superclass::iterator iterator;
  86. typedef Superclass::const_iterator const_iterator;
  87. };
  88. // All subclasses of cmCommand or cmCTestGenericHandler should
  89. // invoke this macro.
  90. #define cmTypeMacro(thisClass, superclass) \
  91. virtual const char* GetNameOfClass() { return #thisClass; } \
  92. typedef superclass Superclass; \
  93. static bool IsTypeOf(const char* type) \
  94. { \
  95. if (!strcmp(#thisClass, type)) { \
  96. return true; \
  97. } \
  98. return Superclass::IsTypeOf(type); \
  99. } \
  100. virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \
  101. static thisClass* SafeDownCast(cmObject* c) \
  102. { \
  103. if (c && c->IsA(#thisClass)) { \
  104. return static_cast<thisClass*>(c); \
  105. } \
  106. return 0; \
  107. } \
  108. class cmTypeMacro_UseTrailingSemicolon
  109. enum cmTargetLinkLibraryType
  110. {
  111. GENERAL_LibraryType,
  112. DEBUG_LibraryType,
  113. OPTIMIZED_LibraryType
  114. };
  115. #endif