comstl.h
来自「用STL的方式封装了WindowsAPI、COM调用、ACE、ATL、MFC、W」· C头文件 代码 · 共 605 行 · 第 1/2 页
H
605 行
/* /////////////////////////////////////////////////////////////////////////
* File: comstl/comstl.h (formerly comstl.h)
*
* Purpose: Root header for the COMSTL libraries. Performs various compiler
* and platform discriminations, and definitions of types.
*
* Created: 15th January 2002
* Updated: 18th June 2006
*
* Home: http://stlsoft.org/
*
* Copyright (c) 2002-2006, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
* any contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* ////////////////////////////////////////////////////////////////////// */
#ifndef COMSTL_INCL_COMSTL_H_COMSTL
#define COMSTL_INCL_COMSTL_H_COMSTL
#define COMSTL_INCL_H_COMSTL /* Define the old header include guard */
/* File version */
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define COMSTL_VER_COMSTL_H_COMSTL_MAJOR 3
# define COMSTL_VER_COMSTL_H_COMSTL_MINOR 3
# define COMSTL_VER_COMSTL_H_COMSTL_REVISION 1
# define COMSTL_VER_COMSTL_H_COMSTL_EDIT 87
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/** \file comstl/comstl.h \brief [C, C++] The root header for the \ref group__project__comstl "COMSTL" project. */
/* /////////////////////////////////////////////////////////////////////////
* COMSTL version
*
* The libraries version information is comprised of major, minor and revision
* components.
*
* The major version is denoted by the _COMSTL_VER_MAJOR preprocessor symbol.
* A changes to the major version component implies that a dramatic change has
* occurred in the libraries, such that considerable changes to source dependent
* on previous versions would need to be effected.
*
* The minor version is denoted by the _COMSTL_VER_MINOR preprocessor symbol.
* Changes to the minor version component imply that a significant change has
* occurred to the libraries, either in the addition of new functionality or in
* the destructive change to one or more components such that recomplilation and
* code change may be necessitated.
*
* The revision version is denoted by the _COMSTL_VER_REVISIO preprocessor
* symbol. Changes to the revision version component imply that a bug has been
* fixed. Dependent code should be recompiled in order to pick up the changes.
*
* In addition to the individual version symbols - _COMSTL_VER_MAJOR,
* _COMSTL_VER_MINOR and _COMSTL_VER_REVISION - a composite symbol _COMSTL_VER
* is defined, where the upper 8 bits are 0, bits 16-23 represent the major
* component, bits 8-15 represent the minor component, and bits 0-7 represent
* the revision component.
*
* Each release of the libraries will bear a different version, and that version
* will also have its own symbol: Version 1.0.1 specifies _COMSTL_VER_1_0_1.
*
* Thus the symbol _COMSTL_VER may be compared meaningfully with a specific
* version symbol, e.g. #if _COMSTL_VER >= _COMSTL_VER_1_0_1
*/
/** \def _COMSTL_VER_MAJOR
* The major version number of COMSTL
*/
/** \def _COMSTL_VER_MINOR
* The minor version number of COMSTL
*/
/** \def _COMSTL_VER_REVISION
* The revision version number of COMSTL
*/
/** \def _COMSTL_VER
* The current composite version number of COMSTL
*/
#define _COMSTL_VER_MAJOR 1
#define _COMSTL_VER_MINOR 6
#define _COMSTL_VER_REVISION 1
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define _COMSTL_VER_1_0_1 0x00010001 /*!< Version 1.0.1 */
# define _COMSTL_VER_1_1_1 0x00010101 /*!< Version 1.1.1 */
# define _COMSTL_VER_1_2_1 0x00010201 /*!< Version 1.2.1 */
# define _COMSTL_VER_1_2_2 0x00010202 /*!< Version 1.2.2 */
# define _COMSTL_VER_1_2_3 0x00010203 /*!< Version 1.2.3 */
# define _COMSTL_VER_1_2_4 0x00010204 /*!< Version 1.2.4 */
# define _COMSTL_VER_1_2_5 0x00010205 /*!< Version 1.2.5 */
# define _COMSTL_VER_1_3_1 0x00010301 /*!< Version 1.3.1 */
# define _COMSTL_VER_1_4_1 0x00010401 /*!< Version 1.4.1 */
# define _COMSTL_VER_1_5_1 0x00010501 /*!< Version 1.5.1 */
# define _COMSTL_VER_1_5_2 0x00010502 /*!< Version 1.5.2 */
# define _COMSTL_VER_1_5_3 0x00010503 /*!< Version 1.5.3 */
# define _COMSTL_VER_1_5_4 0x00010504 /*!< Version 1.5.4 */
# define _COMSTL_VER_1_6_1 0x00010601 /*!< Version 1.6.1 */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
#define _COMSTL_VER _COMSTL_VER_1_6_1
/* /////////////////////////////////////////////////////////////////////////
* Includes
*/
#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
# include <stlsoft/stlsoft.h>
#endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
#include <objbase.h> // COM types
/* /////////////////////////////////////////////////////////////////////////
* STLSoft version compatibility
*/
#if !defined(_STLSOFT_VER_1_5_1) || \
_STLSOFT_VER < _STLSOFT_VER_1_5_1
# error This version of the COMSTL libraries requires STLSoft version 1.5.1 or later
#endif /* _STLSOFT_VER < _STLSOFT_VER_1_5_1 */
/* /////////////////////////////////////////////////////////////////////////
* Compiler compatibility
*
* Currently the only compilers supported by the COMSTL libraries are
*
* Borland C++ 5.5, 5.51, 5.6
* Digital Mars C/C++ 8.26 - 8.32
* Metrowerks 2.4 & 3.0 (CodeWarrior 7.0 & 8.0)
* Intel C/C++ 6.0
* Visual C++ 4.2, 5.0, 6.0, 7.0
*/
#if defined(STLSOFT_COMPILER_IS_BORLAND)
/* Borland C++ */
# if __BORLANDC__ < 0x0550
# error Versions of Borland C++ prior to 5.5 are not supported by the COMSTL libraries
# endif /* __BORLANDC__ */
#elif defined(STLSOFT_COMPILER_IS_COMO)
/* Comeau C++ */
#elif defined(STLSOFT_COMPILER_IS_DMC)
/* Digital Mars C/C++ */
# if __DMC__ < 0x0826
# error Versions of Digital Mars C/C++ prior to 8.26 are not supported by the COMSTL libraries
# endif /* __DMC__ */
#elif defined(STLSOFT_COMPILER_IS_GCC)
/* Digital Mars C/C++ */
# if __GNUC__ < 3
# error Versions of GNU C/C++ prior to 3 are not supported by the COMSTL libraries
# endif /* __DMC__ */
#elif defined(STLSOFT_COMPILER_IS_INTEL)
/* Intel C++ */
# if (__INTEL_COMPILER < 600)
# error Versions of Intel C++ prior to 6.0 are not supported by the COMSTL libraries
# endif /* __INTEL_COMPILER */
#elif defined(STLSOFT_COMPILER_IS_MWERKS)
/* Metrowerks C++ */
# if (__MWERKS__ & 0xFF00) < 0x2400
# error Versions of Metrowerks CodeWarrior C++ prior to 7.0 are not supported by the COMSTL libraries
# endif /* __MWERKS__ */
#elif defined(STLSOFT_COMPILER_IS_WATCOM)
/* Watcom C/C++ */
# if (__WATCOMC__ < 1230)
# error Versions of Watcom C/C++ prior to 12.3 (Open Watcom 1.3) are not supported by the COMSTL libraries
# endif /* __MWERKS__ */
#elif defined(STLSOFT_COMPILER_IS_MSVC)
/* Visual C++ */
# if _MSC_VER < 1020
# error Versions of Visual C++ prior to 4.2 are not supported by the COMSTL libraries
# endif /* _MSC_VER */
#else /* ? compiler */
/* No recognised compiler */
# ifdef _STLSOFT_FORCE_ANY_COMPILER
# define _COMSTL_COMPILER_IS_UNKNOWN
# ifdef _STLSOFT_COMPILE_VERBOSE
# pragma message("Compiler is unknown to COMSTL")
# endif /* _STLSOFT_COMPILE_VERBOSE */
# else /* ? _STLSOFT_FORCE_ANY_COMPILER */
# error Currently only Borland C++, Comeau, Digital Mars C/C++, Intel C/C++, Metrowerks CodeWarrior C/C++ and Visual C++ compilers are supported by the COMSTL libraries
# endif /* _STLSOFT_FORCE_ANY_COMPILER */
#endif /* compiler tag */
/* /////////////////////////////////////////////////////////////////////////
* Debugging
*
* The macro comstl_assert provides standard debug-mode assert functionality.
*/
/// Defines a runtime assertion
///
/// \param expr Must be non-zero, or an assertion will be fired
#define COMSTL_ASSERT(expr) STLSOFT_ASSERT(expr)
/// Defines a runtime assertion, with message
///
/// \param expr Must be non-zero, or an assertion will be fired
/// \param msg The literal character string message to be included in the assertion
#define COMSTL_MESSAGE_ASSERT(msg, expr) STLSOFT_MESSAGE_ASSERT(msg, expr)
/// Defines a compile-time assertion
///
/// \param expr Must be non-zero, or compilation will fail
#define COMSTL_STATIC_ASSERT(expr) STLSOFT_STATIC_ASSERT(expr)
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define comstl_assert(expr) COMSTL_ASSERT(expr)
# define comstl_message_assert(msg, expr) COMSTL_MESSAGE_ASSERT(msg, expr)
# define comstl_static_assert(expr) COMSTL_STATIC_ASSERT(expr)
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* Compiler language feature support
*/
/* DCOM support
*
* Since some COM APIs are only available, at compile time, when DCOM is
* explicitly discriminated (for Windows this is via _WIN32_WINNT >= 0x0400 or
* presence of _WIN32_DCOM), this must be determined.
*
* Override and always support DCOM by defining _COMSTL_DCOM
*
* Prevent DCOM support by defining _COMSTL_NO_DCOM
*
*/
#ifdef __COMSTL_CF_DCOM_SUPPORT
#undef __COMSTL_CF_DCOM_SUPPORT
#endif /* __COMSTL_CF_DCOM_SUPPORT */
#if !defined(_COMSTL_NO_DCOM) && \
( ( defined(_WIN32_WINNT ) && \
(_WIN32_WINNT >= 0x0400)) || \
defined(_WIN32_DCOM) || \
defined(_COMSTL_DCOM))
# define __COMSTL_CF_DCOM_SUPPORT
#endif /* _WIN32_WINNT >= 0x0400 || _WIN32_DCOM */
/* /////////////////////////////////////////////////////////////////////////
* Namespace
*
* The COMSTL components are contained within the comstl namespace. This is
* usually an alias for stlsoft::comstl_project.
*
* When compilers support namespaces they are defined by default. They can be
* undefined using a cascasing system, as follows:
*
* If _STLSOFT_NO_NAMESPACES is defined, then _COMSTL_NO_NAMESPACES is defined.
*
* If _COMSTL_NO_NAMESPACES is defined, then _COMSTL_NO_NAMESPACE is defined.
*
* If _COMSTL_NO_NAMESPACE is defined, then the COMSTL constructs are defined
* in the global scope.
*
* If _STLSOFT_NO_NAMESPACES, _COMSTL_NO_NAMESPACES and _COMSTL_NO_NAMESPACE are
* all undefined but the symbol _STLSOFT_NO_NAMESPACE is defined (whence the
* namespace stlsoft does not exist), then the COMSTL constructs are defined
* within the comstl namespace. The definition matrix is as follows:
*
* _STLSOFT_NO_NAMESPACE _COMSTL_NO_NAMESPACE comstl definition
* --------------------- -------------------- -----------------
* not defined not defined = stlsoft::comstl_project
* not defined defined not defined
* defined not defined comstl
* defined defined not defined
*
*
*
* The macro comstl_ns_qual() macro can be used to refer to elements in the
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?