michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2000-2011, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ******************************************************************************* michael@0: * michael@0: * file name: uversion.h michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * Created by: Vladimir Weinstein michael@0: * michael@0: * Gets included by utypes.h and Windows .rc files michael@0: */ michael@0: michael@0: /** michael@0: * \file michael@0: * \brief C API: API for accessing ICU version numbers. michael@0: */ michael@0: /*===========================================================================*/ michael@0: /* Main ICU version information */ michael@0: /*===========================================================================*/ michael@0: michael@0: #ifndef UVERSION_H michael@0: #define UVERSION_H michael@0: michael@0: #include "unicode/umachine.h" michael@0: michael@0: /* Actual version info lives in uvernum.h */ michael@0: #include "unicode/uvernum.h" michael@0: michael@0: /** Maximum length of the copyright string. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: #define U_COPYRIGHT_STRING_LENGTH 128 michael@0: michael@0: /** An ICU version consists of up to 4 numbers from 0..255. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: #define U_MAX_VERSION_LENGTH 4 michael@0: michael@0: /** In a string, ICU version fields are delimited by dots. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: #define U_VERSION_DELIMITER '.' michael@0: michael@0: /** The maximum length of an ICU version string. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: #define U_MAX_VERSION_STRING_LENGTH 20 michael@0: michael@0: /** The binary form of a version on ICU APIs is an array of 4 uint8_t. michael@0: * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). michael@0: * @stable ICU 2.4 michael@0: */ michael@0: typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; michael@0: michael@0: /*===========================================================================*/ michael@0: /* C++ namespace if supported. Versioned unless versioning is disabled. */ michael@0: /*===========================================================================*/ michael@0: michael@0: /** michael@0: * \def U_NAMESPACE_BEGIN michael@0: * This is used to begin a declaration of a public ICU C++ API. michael@0: * When not compiling for C++, it does nothing. michael@0: * When compiling for C++, it begins an extern "C++" linkage block (to protect michael@0: * against cases in which an external client includes ICU header files inside michael@0: * an extern "C" linkage block). michael@0: * michael@0: * It also begins a versioned-ICU-namespace block. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: michael@0: /** michael@0: * \def U_NAMESPACE_END michael@0: * This is used to end a declaration of a public ICU C++ API. michael@0: * When not compiling for C++, it does nothing. michael@0: * When compiling for C++, it ends the extern "C++" block begun by michael@0: * U_NAMESPACE_BEGIN. michael@0: * michael@0: * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: michael@0: /** michael@0: * \def U_NAMESPACE_USE michael@0: * This is used to specify that the rest of the code uses the michael@0: * public ICU C++ API namespace. michael@0: * This is invoked by default; we recommend that you turn it off: michael@0: * See the "Recommended Build Options" section of the ICU4C readme michael@0: * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild) michael@0: * @stable ICU 2.4 michael@0: */ michael@0: michael@0: /** michael@0: * \def U_NAMESPACE_QUALIFIER michael@0: * This is used to qualify that a function or class is part of michael@0: * the public ICU C++ API namespace. michael@0: * michael@0: * This macro is unnecessary since ICU 49 requires namespace support. michael@0: * You can just use "icu::" instead. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: michael@0: /* Define namespace symbols if the compiler supports it. */ michael@0: #ifdef __cplusplus michael@0: # if U_DISABLE_RENAMING michael@0: # define U_ICU_NAMESPACE icu michael@0: namespace U_ICU_NAMESPACE { } michael@0: # else michael@0: # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) michael@0: namespace U_ICU_NAMESPACE { } michael@0: namespace icu = U_ICU_NAMESPACE; michael@0: # endif michael@0: michael@0: # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { michael@0: # define U_NAMESPACE_END } } michael@0: # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; michael@0: # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: michael@0: michael@0: # ifndef U_USING_ICU_NAMESPACE michael@0: # define U_USING_ICU_NAMESPACE 1 michael@0: # endif michael@0: # if U_USING_ICU_NAMESPACE michael@0: U_NAMESPACE_USE michael@0: # endif michael@0: #else michael@0: # define U_NAMESPACE_BEGIN michael@0: # define U_NAMESPACE_END michael@0: # define U_NAMESPACE_USE michael@0: # define U_NAMESPACE_QUALIFIER michael@0: #endif michael@0: michael@0: /*===========================================================================*/ michael@0: /* General version helper functions. Definitions in putil.c */ michael@0: /*===========================================================================*/ michael@0: michael@0: /** michael@0: * Parse a string with dotted-decimal version information and michael@0: * fill in a UVersionInfo structure with the result. michael@0: * Definition of this function lives in putil.c michael@0: * michael@0: * @param versionArray The destination structure for the version information. michael@0: * @param versionString A string with dotted-decimal version information, michael@0: * with up to four non-negative number fields with michael@0: * values of up to 255 each. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: U_STABLE void U_EXPORT2 michael@0: u_versionFromString(UVersionInfo versionArray, const char *versionString); michael@0: michael@0: /** michael@0: * Parse a Unicode string with dotted-decimal version information and michael@0: * fill in a UVersionInfo structure with the result. michael@0: * Definition of this function lives in putil.c michael@0: * michael@0: * @param versionArray The destination structure for the version information. michael@0: * @param versionString A Unicode string with dotted-decimal version michael@0: * information, with up to four non-negative number michael@0: * fields with values of up to 255 each. michael@0: * @stable ICU 4.2 michael@0: */ michael@0: U_STABLE void U_EXPORT2 michael@0: u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); michael@0: michael@0: michael@0: /** michael@0: * Write a string with dotted-decimal version information according michael@0: * to the input UVersionInfo. michael@0: * Definition of this function lives in putil.c michael@0: * michael@0: * @param versionArray The version information to be written as a string. michael@0: * @param versionString A string buffer that will be filled in with michael@0: * a string corresponding to the numeric version michael@0: * information in versionArray. michael@0: * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. michael@0: * @stable ICU 2.4 michael@0: */ michael@0: U_STABLE void U_EXPORT2 michael@0: u_versionToString(const UVersionInfo versionArray, char *versionString); michael@0: michael@0: /** michael@0: * Gets the ICU release version. The version array stores the version information michael@0: * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. michael@0: * Definition of this function lives in putil.c michael@0: * michael@0: * @param versionArray the version # information, the result will be filled in michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE void U_EXPORT2 michael@0: u_getVersion(UVersionInfo versionArray); michael@0: #endif