cmStandardIncludes.h 3.5 KB

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