/*
*******************************************************************************
*
-* Copyright (C) 1999-2004, International Business Machines
+* Copyright (C) 1999-2013 International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
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
* 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. */
/* 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. */
};
};
typedef enum {
- RBBI_LOOKAHEAD_HARD_BREAK = 1
+ RBBI_LOOKAHEAD_HARD_BREAK = 1,
+ RBBI_BOF_REQUIRED = 2
} RBBIStateTableFlags;
/* */
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();
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 */