X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..57a6839dcb3bba09e8228b822b290604668416fe:/icuSources/common/rbbidata.h diff --git a/icuSources/common/rbbidata.h b/icuSources/common/rbbidata.h index fda2a79d..78a4ac76 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-2013 International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -45,10 +45,11 @@ 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" +#include "umutex.h" #include "utrie.h" U_NAMESPACE_BEGIN @@ -57,17 +58,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 +114,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 +132,8 @@ struct RBBIStateTable { }; typedef enum { - RBBI_LOOKAHEAD_HARD_BREAK = 1 + RBBI_LOOKAHEAD_HARD_BREAK = 1, + RBBI_BOF_REQUIRED = 2 } RBBIStateTableFlags; @@ -135,7 +142,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(); @@ -170,9 +181,10 @@ public: UTrie fTrie; private: - int32_t fRefCount; + u_atomic_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 */