]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/uprops.h
ICU-59173.0.1.tar.gz
[apple/icu.git] / icuSources / common / uprops.h
index 43f18af32a6b46fe03eaf061b4e14de19953046e..6f67756cd91033b8db018fd32c8a7c15af2a40ec 100644 (file)
@@ -1,12 +1,14 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2002-2010, International Business Machines
+*   Copyright (C) 2002-2016, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
 *   file name:  uprops.h
-*   encoding:   US-ASCII
+*   encoding:   UTF-8
 *   tab size:   8 (not used)
 *   indentation:4
 *
@@ -65,13 +67,36 @@ enum {
 
 /* constants for the storage form of numeric types and values */
 enum {
+    /** No numeric value. */
     UPROPS_NTV_NONE=0,
+    /** Decimal digits: nv=0..9 */
     UPROPS_NTV_DECIMAL_START=1,
+    /** Other digits: nv=0..9 */
     UPROPS_NTV_DIGIT_START=11,
+    /** Small integers: nv=0..154 */
     UPROPS_NTV_NUMERIC_START=21,
+    /** Fractions: ((ntv>>4)-12) / ((ntv&0xf)+1) = -1..17 / 1..16 */
     UPROPS_NTV_FRACTION_START=0xb0,
+    /**
+     * Large integers:
+     * ((ntv>>5)-14) * 10^((ntv&0x1f)+2) = (1..9)*(10^2..10^33)
+     * (only one significant decimal digit)
+     */
     UPROPS_NTV_LARGE_START=0x1e0,
-    UPROPS_NTV_RESERVED_START=0x300,
+    /**
+     * Sexagesimal numbers:
+     * ((ntv>>2)-0xbf) * 60^((ntv&3)+1) = (1..9)*(60^1..60^4)
+     */
+    UPROPS_NTV_BASE60_START=0x300,
+    /**
+     * Fraction-20 values:
+     * frac20 = ntv-0x324 = 0..0x17 -> 1|3|5|7 / 20|40|80|160|320|640
+     * numerator: num = 2*(frac20&3)+1
+     * denominator: den = 20<<(frac20>>2)
+     */
+    UPROPS_NTV_FRACTION20_START=UPROPS_NTV_BASE60_START+36,  // 0x300+9*4=0x324
+    /** No numeric value (yet). */
+    UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION20_START+24,  // 0x324+6*4=0x34c
 
     UPROPS_NTV_MAX_SMALL_INT=UPROPS_NTV_FRACTION_START-UPROPS_NTV_NUMERIC_START-1
 };
@@ -164,20 +189,29 @@ enum {
     UPROPS_VARIATION_SELECTOR,
     UPROPS_PATTERN_SYNTAX,                      /* new in ICU 3.4 and Unicode 4.1 */
     UPROPS_PATTERN_WHITE_SPACE,
-    UPROPS_RESERVED,                            /* reserved & unused */
+    UPROPS_PREPENDED_CONCATENATION_MARK,        // new in ICU 60 and Unicode 10
     UPROPS_BINARY_1_TOP                         /* ==32 - full! */
 };
 
 /*
  * Properties in vector word 2
  * Bits
- * 31..26   reserved
+ * 31..27   http://www.unicode.org/reports/tr51/#Emoji_Properties
+ *     26   reserved
  * 25..20   Line Break
  * 19..15   Sentence Break
  * 14..10   Word Break
  *  9.. 5   Grapheme Cluster Break
  *  4.. 0   Decomposition Type
  */
+enum {
+    UPROPS_2_EMOJI_COMPONENT=27,
+    UPROPS_2_EMOJI,
+    UPROPS_2_EMOJI_PRESENTATION,
+    UPROPS_2_EMOJI_MODIFIER,
+    UPROPS_2_EMOJI_MODIFIER_BASE
+};
+
 #define UPROPS_LB_MASK          0x03f00000
 #define UPROPS_LB_SHIFT         20
 
@@ -192,10 +226,16 @@ enum {
 
 #define UPROPS_DT_MASK          0x0000001f
 
+/**
+ * Gets the main properties value for a code point.
+ * Implemented in uchar.c for uprops.cpp.
+ */
+U_CFUNC uint32_t
+u_getMainProperties(UChar32 c);
+
 /**
  * Get a properties vector word for a code point.
- * Implemented in uchar.c for uprops.c.
- * column==-1 gets the 32-bit main properties word instead.
+ * Implemented in uchar.c for uprops.cpp.
  * @return 0 if no data or illegal argument
  */
 U_CFUNC uint32_t
@@ -397,15 +437,6 @@ upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
 uprv_getInclusions(const USetAdder *sa, UErrorCode *pErrorCode);
 */
 
-/**
- * Swap the ICU Unicode properties file. See uchar.c.
- * @internal
- */
-U_CAPI int32_t U_EXPORT2
-uprops_swap(const UDataSwapper *ds,
-            const void *inData, int32_t length, void *outData,
-            UErrorCode *pErrorCode);
-
 /**
  * Swap the ICU Unicode character names file. See uchar.c.
  * @internal
@@ -415,7 +446,7 @@ uchar_swapNames(const UDataSwapper *ds,
                 const void *inData, int32_t length, void *outData,
                 UErrorCode *pErrorCode);
 
-#ifdef XP_CPLUSPLUS
+#ifdef __cplusplus
 
 U_NAMESPACE_BEGIN