]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/rbbidata.h
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / common / rbbidata.h
index fda2a79d55080f7cbf0ddb4a4d643e75c432afba..7073b8d931ddc9da09f99d7df30f6f9ffe255c39 100644 (file)
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 1999-2004, International Business Machines
+*   Copyright (C) 1999-2011 International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -45,7 +45,7 @@ ubrk_swap(const UDataSwapper *ds,
           const void *inData, int32_t length, void *outData,
           UErrorCode *pErrorCode);
 
-#ifdef XP_CPLUSPLUS
+#ifdef __cplusplus
 
 #include "unicode/uobject.h"
 #include "unicode/unistr.h"
@@ -57,17 +57,22 @@ U_NAMESPACE_BEGIN
  *   The following structs map exactly onto the raw data from ICU common data file. 
  */
 struct RBBIDataHeader {
-    uint32_t         fMagic;       /*  == 0xbla0 */
-    uint32_t         fVersion;     /*  == 1 */
-    uint32_t         fLength;      /*  Total length in bytes of this RBBI Data, */
-                                   /*      including all sections, not just the header. */
-    uint32_t         fCatCount;    /*  Number of character categories. */
-
-    /*  */
-    /*  Offsets and sizes of each of the subsections within the RBBI data. */
-    /*  All offsets are bytes from the start of the RBBIDataHeader. */
-    /*  All sizes are in bytes. */
-    /*  */
+    uint32_t         fMagic;           /*  == 0xbla0                                               */
+    uint8_t          fFormatVersion[4]; /* Data Format.  Same as the value in struct UDataInfo      */
+                                       /*   if there is one associated with this data.             */
+                                       /*     (version originates in rbbi, is copied to UDataInfo) */
+                                       /*   For ICU 3.2 and earlier, this field was                */
+                                       /*       uint32_t  fVersion                                 */
+                                       /*   with a value of 1.                                     */
+    uint32_t         fLength;          /*  Total length in bytes of this RBBI Data,                */
+                                       /*      including all sections, not just the header.        */
+    uint32_t         fCatCount;        /*  Number of character categories.                         */
+
+    /*                                                                        */
+    /*  Offsets and sizes of each of the subsections within the RBBI data.    */
+    /*  All offsets are bytes from the start of the RBBIDataHeader.           */
+    /*  All sizes are in bytes.                                               */
+    /*                                                                        */
     uint32_t         fFTable;         /*  forward state transition table. */
     uint32_t         fFTableLen;
     uint32_t         fRTable;         /*  Offset to the reverse state transition table. */
@@ -108,8 +113,8 @@ struct  RBBIStateTableRow {
                                     /*     tags (rule status values)                      */
     int16_t          fReserved;
     uint16_t         fNextState[2]; /*  Next State, indexed by char category.             */
-                                    /*    Array Size is fNumCols from the                 */
-                                    /*    state table header.                             */
+                                    /*  This array does not have two elements             */
+                                    /*    Array Size is actually fData->fHeader->fCatCount         */
                                     /*    CAUTION:  see RBBITableBuilder::getTableSize()  */
                                     /*              before changing anything here.        */
 };
@@ -126,7 +131,8 @@ struct RBBIStateTable {
 };
 
 typedef enum {
-    RBBI_LOOKAHEAD_HARD_BREAK = 1
+    RBBI_LOOKAHEAD_HARD_BREAK = 1,
+    RBBI_BOF_REQUIRED = 2
 } RBBIStateTableFlags;
 
 
@@ -135,7 +141,11 @@ typedef enum {
 /*                                        */
 class RBBIDataWrapper : public UMemory {
 public:
+    enum EDontAdopt {
+        kDontAdopt
+    };
     RBBIDataWrapper(const RBBIDataHeader *data, UErrorCode &status);
+    RBBIDataWrapper(const RBBIDataHeader *data, enum EDontAdopt dontAdopt, UErrorCode &status);
     RBBIDataWrapper(UDataMemory* udm, UErrorCode &status);
     ~RBBIDataWrapper();
 
@@ -173,6 +183,7 @@ private:
     int32_t             fRefCount;
     UDataMemory        *fUDataMem;
     UnicodeString       fRuleString;
+    UBool               fDontFreeData;
 
     RBBIDataWrapper(const RBBIDataWrapper &other); /*  forbid copying of this class */
     RBBIDataWrapper &operator=(const RBBIDataWrapper &other); /*  forbid copying of this class */