2 *******************************************************************************
4 * Copyright (C) 1999-2003, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: scrptrun.h
10 * created on: 10/17/2001
11 * created by: Eric R. Mader
17 #include "unicode/utypes.h"
18 #include "unicode/uobject.h"
19 #include "unicode/uscript.h"
25 UScriptCode scriptCode
;
28 struct ParenStackEntry
31 UScriptCode scriptCode
;
34 class ScriptRun
: public UObject
{
38 ScriptRun(const UChar chars
[], int32_t length
);
40 ScriptRun(const UChar chars
[], int32_t start
, int32_t length
);
44 void reset(int32_t start
, int32_t count
);
46 void reset(const UChar chars
[], int32_t start
, int32_t length
);
48 int32_t getScriptStart();
50 int32_t getScriptEnd();
52 UScriptCode
getScriptCode();
57 * ICU "poor man's RTTI", returns a UClassID for the actual class.
61 virtual inline UClassID
getDynamicClassID() const { return getStaticClassID(); }
64 * ICU "poor man's RTTI", returns a UClassID for this class.
68 static inline UClassID
getStaticClassID() { return (UClassID
)&fgClassID
; }
72 static UBool
sameScript(int32_t scriptOne
, int32_t scriptTwo
);
76 const UChar
*charArray
;
80 UScriptCode scriptCode
;
82 ParenStackEntry parenStack
[128];
85 static int8_t highBit(int32_t value
);
86 static int32_t getPairIndex(UChar32 ch
);
88 static UChar32 pairedChars
[];
89 static const int32_t pairedCharCount
;
90 static const int32_t pairedCharPower
;
91 static const int32_t pairedCharExtra
;
94 * The address of this static class variable serves as this class's ID
95 * for ICU "poor man's RTTI".
97 static const char fgClassID
;
100 inline ScriptRun::ScriptRun()
105 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t length
)
107 reset(chars
, 0, length
);
110 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t start
, int32_t length
)
112 reset(chars
, start
, length
);
115 inline int32_t ScriptRun::getScriptStart()
120 inline int32_t ScriptRun::getScriptEnd()
125 inline UScriptCode
ScriptRun::getScriptCode()
130 inline void ScriptRun::reset()
132 scriptStart
= charStart
;
133 scriptEnd
= charStart
;
134 scriptCode
= USCRIPT_INVALID_CODE
;
138 inline void ScriptRun::reset(int32_t start
, int32_t length
)
141 charLimit
= start
+ length
;
146 inline void ScriptRun::reset(const UChar chars
[], int32_t start
, int32_t length
)
150 reset(start
, length
);