X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/common/rbbidata.h?ds=sidebyside diff --git a/icuSources/common/rbbidata.h b/icuSources/common/rbbidata.h index fda2a79d..7073b8d9 100644 --- a/icuSources/common/rbbidata.h +++ b/icuSources/common/rbbidata.h @@ -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 */