📄 utypes.h
字号:
/*===========================================================================*//* UClassID-based RTTI *//*===========================================================================*//** * UClassID is used to identify classes without using RTTI, since RTTI * is not yet supported by all C++ compilers. Each class hierarchy which needs * to implement polymorphic clone() or operator==() defines two methods, * described in detail below. UClassID values can be compared using * operator==(). Nothing else should be done with them. * * \par * getDynamicClassID() is declared in the base class of the hierarchy as * a pure virtual. Each concrete subclass implements it in the same way: * * \code * class Base { * public: * virtual UClassID getDynamicClassID() const = 0; * } * * class Derived { * public: * virtual UClassID getDynamicClassID() const * { return Derived::getStaticClassID(); } * } * \endcode * * Each concrete class implements getStaticClassID() as well, which allows * clients to test for a specific type. * * \code * class Derived { * public: * static UClassID U_EXPORT2 getStaticClassID(); * private: * static char fgClassID; * } * * // In Derived.cpp: * UClassID Derived::getStaticClassID() * { return (UClassID)&Derived::fgClassID; } * char Derived::fgClassID = 0; // Value is irrelevant * \endcode * @stable ICU 2.0 */typedef void* UClassID;/*===========================================================================*//* Shared library/DLL import-export API control *//*===========================================================================*//* * Control of symbol import/export. * ICU is separated into three libraries. *//* * \def U_COMBINED_IMPLEMENTATION * Set to export library symbols from inside the ICU library * when all of ICU is in a single library. * This can be set as a compiler option while building ICU, and it * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc. * @stable ICU 2.0 *//** * \def U_DATA_API * Set to export library symbols from inside the stubdata library, * and to import them from outside. * @draft ICU 3.0 *//** * \def U_COMMON_API * Set to export library symbols from inside the common library, * and to import them from outside. * @stable ICU 2.0 *//** * \def U_I18N_API * Set to export library symbols from inside the i18n library, * and to import them from outside. * @stable ICU 2.0 *//** * \def U_LAYOUT_API * Set to export library symbols from inside the layout engine library, * and to import them from outside. * @stable ICU 2.0 *//** * \def U_LAYOUTEX_API * Set to export library symbols from inside the layout extensions library, * and to import them from outside. * @stable ICU 2.6 *//** * \def U_IO_API * Set to export library symbols from inside the ustdio library, * and to import them from outside. * @stable ICU 2.0 */#if defined(U_COMBINED_IMPLEMENTATION)#define U_DATA_API U_EXPORT#define U_COMMON_API U_EXPORT#define U_I18N_API U_EXPORT#define U_LAYOUT_API U_EXPORT#define U_LAYOUTEX_API U_EXPORT#define U_IO_API U_EXPORT#elif defined(U_STATIC_IMPLEMENTATION)#define U_DATA_API#define U_COMMON_API#define U_I18N_API#define U_LAYOUT_API#define U_LAYOUTEX_API#define U_IO_API#elif defined(U_COMMON_IMPLEMENTATION)#define U_DATA_API U_IMPORT#define U_COMMON_API U_EXPORT#define U_I18N_API U_IMPORT#define U_LAYOUT_API U_IMPORT#define U_LAYOUTEX_API U_IMPORT#define U_IO_API U_IMPORT#elif defined(U_I18N_IMPLEMENTATION)#define U_DATA_API U_IMPORT#define U_COMMON_API U_IMPORT#define U_I18N_API U_EXPORT#define U_LAYOUT_API U_IMPORT#define U_LAYOUTEX_API U_IMPORT#define U_IO_API U_IMPORT#elif defined(U_LAYOUT_IMPLEMENTATION)#define U_DATA_API U_IMPORT#define U_COMMON_API U_IMPORT#define U_I18N_API U_IMPORT#define U_LAYOUT_API U_EXPORT#define U_LAYOUTEX_API U_IMPORT#define U_IO_API U_IMPORT#elif defined(U_LAYOUTEX_IMPLEMENTATION)#define U_DATA_API U_IMPORT#define U_COMMON_API U_IMPORT#define U_I18N_API U_IMPORT#define U_LAYOUT_API U_IMPORT#define U_LAYOUTEX_API U_EXPORT#define U_IO_API U_IMPORT#elif defined(U_IO_IMPLEMENTATION)#define U_DATA_API U_IMPORT#define U_COMMON_API U_IMPORT#define U_I18N_API U_IMPORT#define U_LAYOUT_API U_IMPORT#define U_LAYOUTEX_API U_IMPORT#define U_IO_API U_EXPORT#else#define U_DATA_API U_IMPORT#define U_COMMON_API U_IMPORT#define U_I18N_API U_IMPORT#define U_LAYOUT_API U_IMPORT#define U_LAYOUTEX_API U_IMPORT#define U_IO_API U_IMPORT#endif/** * \def U_STANDARD_CPP_NAMESPACE * Control of C++ Namespace * @stable ICU 2.0 */#ifdef __cplusplus#define U_STANDARD_CPP_NAMESPACE ::#else#define U_STANDARD_CPP_NAMESPACE#endif/*===========================================================================*//* Global delete operator *//*===========================================================================*//* * The ICU4C library must not use the global new and delete operators. * These operators here are defined to enable testing for this. * See Jitterbug 2581 for details of why this is necessary. * * Verification that ICU4C's memory usage is correct, i.e., * that global new/delete are not used: * * a) Check for imports of global new/delete (see uobject.cpp for details) * b) Verify that new is never imported. * c) Verify that delete is only imported from object code for interface/mixin classes. * d) Add global delete and delete[] only for the ICU4C library itself * and define them in a way that crashes or otherwise easily shows a problem. * * The following implements d). * The operator implementations crash; this is intentional and used for library debugging. * * Note: This is currently only done on Windows because * some Linux/Unix compilers have problems with defining global new/delete. * On Windows, WIN32 is defined, and it is _MSC_Ver>=1200 for MSVC 6.0 and higher. */#if defined(XP_CPLUSPLUS) && defined(WIN32) && (_MSC_Ver>=1200) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_USTDIO_IMPLEMENTATION))/** * Global operator new, defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */inline void *operator new(size_t /*size*/) { char *q=NULL; *q=5; /* break it */ return q;}/** * Global operator new[], defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */inline void *operator new[](size_t /*size*/) { char *q=NULL; *q=5; /* break it */ return q;}/** * Global operator delete, defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */inline voidoperator delete(void * /*p*/) { char *q=NULL; *q=5; /* break it */}/** * Global operator delete[], defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */inline voidoperator delete[](void * /*p*/) { char *q=NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -