]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/unicode/uversion.h
ICU-57165.0.1.tar.gz
[apple/icu.git] / icuSources / common / unicode / uversion.h
index 5bf7fda5965893767e4b166389786c45d1bce29b..74e309105514adf38237a3b7a409801a815a5d56 100644 (file)
@@ -1,6 +1,6 @@
 /*
 *******************************************************************************
-*   Copyright (C) 2000-2008, International Business Machines
+*   Copyright (C) 2000-2011, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *******************************************************************************
 *
 *
 *   Created by: Vladimir Weinstein
 *
-*  Contains all the important version numbers for ICU. 
 *  Gets included by utypes.h and Windows .rc files
 */
 
 /**
  * \file
- * \brief C API: Contains all the important version numbers for ICU
+ * \brief C API: API for accessing ICU version numbers
  */
 /*===========================================================================*/
 /* Main ICU version information                                              */
 #ifndef UVERSION_H
 #define UVERSION_H
 
-/**
- * IMPORTANT: When updating version, the following things need to be done:
- * source/common/unicode/uversion.h - this file: update major, minor,
- *        patchlevel, suffix, version, short version constants, namespace,
- *                                                             and copyright
- * source/common/common.vcproj - update 'Output file name' on the link tab so
- *                   that it contains the new major/minor combination
- * source/i18n/i18n.vcproj - same as for the common.vcproj
- * source/layout/layout.vcproj - same as for the common.vcproj
- * source/layoutex/layoutex.vcproj - same
- * source/stubdata/stubdata.vcproj - same as for the common.vcproj
- * source/io/io.vcproj - same as for the common.vcproj
- * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
- *                            the new major/minor combination
- * source/tools/genren/genren.pl - use this script according to the README
- *                    in that folder                                         
- */
-
 #include "unicode/umachine.h"
 
-/** The standard copyright notice that gets compiled into each library. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_COPYRIGHT_STRING \
-  " Copyright (C) 2008, International Business Machines Corporation and others. All Rights Reserved. "
+/* Actual version info lives in uvernum.h */
+#include "unicode/uvernum.h"
 
 /** Maximum length of the copyright string.
  *  @stable ICU 2.4
  */
 #define U_COPYRIGHT_STRING_LENGTH  128
 
-/** The current ICU major version as an integer. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION_MAJOR_NUM 4
-
-/** The current ICU minor version as an integer. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_MINOR_NUM 0
-
-/** The current ICU patchlevel version as an integer.  
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION_PATCHLEVEL_NUM 0
-
-/** The current ICU build level version as an integer.  
- *  This value is for use by ICU clients. It defaults to 0.
- *  @draft ICU 4.0
- */
-#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
-#define U_ICU_VERSION_BUILDLEVEL_NUM 0
-#endif
-
-/** Glued version suffix for renamers 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_SUFFIX _4_0
-
-/** The current ICU library version as a dotted-decimal string. The patchlevel
- *  only appears in this string if it non-zero. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define U_ICU_VERSION "4.0"
-
-/** The current ICU library major/minor version as a string without dots, for library name suffixes. 
- *  This value will change in the subsequent releases of ICU
- *  @stable ICU 2.6
- */
-#define U_ICU_VERSION_SHORT "40"
-
 /** An ICU version consists of up to 4 numbers from 0..255.
  *  @stable ICU 2.4
  */
 #define U_MAX_VERSION_STRING_LENGTH 20
 
 /** The binary form of a version on ICU APIs is an array of 4 uint8_t.
+ *  To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
  *  @stable ICU 2.4
  */
 typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
@@ -130,14 +63,23 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
 /**
  * \def U_NAMESPACE_BEGIN
  * This is used to begin a declaration of a public ICU C++ API.
- * If the compiler doesn't support namespaces, this does nothing.
+ * When not compiling for C++, it does nothing.
+ * When compiling for C++, it begins an extern "C++" linkage block (to protect
+ * against cases in which an external client includes ICU header files inside
+ * an extern "C" linkage block).
+ *
+ * It also begins a versioned-ICU-namespace block.
  * @stable ICU 2.4
  */
 
 /**
  * \def U_NAMESPACE_END
- * This is used to end a declaration of a public ICU C++ API 
- * If the compiler doesn't support namespaces, this does nothing.
+ * This is used to end a declaration of a public ICU C++ API.
+ * When not compiling for C++, it does nothing.
+ * When compiling for C++, it ends the extern "C++" block begun by
+ * U_NAMESPACE_BEGIN.
+ *
+ * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
  * @stable ICU 2.4
  */
 
@@ -145,7 +87,9 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
  * \def U_NAMESPACE_USE
  * This is used to specify that the rest of the code uses the
  * public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
+ * This is invoked by default; we recommend that you turn it off:
+ * See the "Recommended Build Options" section of the ICU4C readme
+ * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild)
  * @stable ICU 2.4
  */
 
@@ -153,23 +97,25 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
  * \def U_NAMESPACE_QUALIFIER
  * This is used to qualify that a function or class is part of
  * the public ICU C++ API namespace.
- * If the compiler doesn't support namespaces, this does nothing.
+ *
+ * This macro is unnecessary since ICU 49 requires namespace support.
+ * You can just use "icu::" instead.
  * @stable ICU 2.4
  */
 
 /* Define namespace symbols if the compiler supports it. */
-#if U_HAVE_NAMESPACE && defined(XP_CPLUSPLUS)
+#ifdef __cplusplus
 #   if U_DISABLE_RENAMING
 #       define U_ICU_NAMESPACE icu
         namespace U_ICU_NAMESPACE { }
 #   else
-#       define U_ICU_NAMESPACE icu_4_0
+#       define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
         namespace U_ICU_NAMESPACE { }
         namespace icu = U_ICU_NAMESPACE;
 #   endif
 
-#   define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
-#   define U_NAMESPACE_END  }
+#   define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
+#   define U_NAMESPACE_END } }
 #   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
 #   define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
 
@@ -186,7 +132,6 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
 #   define U_NAMESPACE_QUALIFIER
 #endif
 
-
 /*===========================================================================*/
 /* General version helper functions. Definitions in putil.c                  */
 /*===========================================================================*/
@@ -205,6 +150,21 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
 U_STABLE void U_EXPORT2
 u_versionFromString(UVersionInfo versionArray, const char *versionString);
 
+/**
+ * Parse a Unicode string with dotted-decimal version information and
+ * fill in a UVersionInfo structure with the result.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The destination structure for the version information.
+ * @param versionString A Unicode string with dotted-decimal version
+ *                      information, with up to four non-negative number
+ *                      fields with values of up to 255 each.
+ * @stable ICU 4.2
+ */
+U_STABLE void U_EXPORT2
+u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
+
+
 /**
  * Write a string with dotted-decimal version information according
  * to the input UVersionInfo.
@@ -218,7 +178,7 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString);
  * @stable ICU 2.4
  */
 U_STABLE void U_EXPORT2
-u_versionToString(UVersionInfo versionArray, char *versionString);
+u_versionToString(const UVersionInfo versionArray, char *versionString);
 
 /**
  * Gets the ICU release version.  The version array stores the version information
@@ -230,46 +190,4 @@ u_versionToString(UVersionInfo versionArray, char *versionString);
  */
 U_STABLE void U_EXPORT2
 u_getVersion(UVersionInfo versionArray);
-
-
-/*===========================================================================
- * ICU collation framework version information                               
- * Version info that can be obtained from a collator is affected by these    
- * numbers in a secret and magic way. Please use collator version as whole
- *===========================================================================
- */
-
-/** Collation runtime version (sort key generator, strcoll). 
- * If the version is different, sortkeys for the same string could be different 
- * version 2 was in ICU 1.8.1. changed is: compression intervals, French secondary 
- * compression, generating quad level always when strength is quad or more 
- * version 4 - ICU 2.2 - tracking UCA changes, ignore completely ignorables 
- * in contractions, ignore primary ignorables after shifted 
- * version 5 - ICU 2.8 - changed implicit generation code
- * version 6 - ICU 3.4 - with the UCA 4.1, Thai tag is no longer generated or used
- * This value may change in the subsequent releases of ICU
- * @stable ICU 2.4
- */
-#define UCOL_RUNTIME_VERSION 6
-
-/** Builder code version. When this is different, same tailoring might result
- * in assigning different collation elements to code points                  
- * version 2 was in ICU 1.8.1. added support for prefixes, tweaked canonical 
- * closure. However, the tailorings should probably get same CEs assigned    
- * version 5 - ICU 2.2 - fixed some bugs, renamed some indirect values.      
- * version 6 - ICU 2.8 - fixed bug in builder that allowed 0xFF in primary values
- * version 7 - ICU 3.4 - with the UCA 4.1 Thai tag is no longer processed, complete ignorables
- *                       now break contractions
- * Backward compatible with the old rules. 
- * This value may change in the subsequent releases of ICU
- * @stable ICU 2.4
- */
-#define UCOL_BUILDER_VERSION 7
-
-/** This is the version of the tailorings 
- *  This value may change in the subsequent releases of ICU
- *  @stable ICU 2.4
- */
-#define UCOL_TAILORINGS_VERSION 1
-
 #endif