1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 1999-2003, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
10 * file name: scrptrun.h
12 * created on: 10/17/2001
13 * created by: Eric R. Mader
19 #include "unicode/utypes.h"
20 #include "unicode/uobject.h"
21 #include "unicode/uscript.h"
29 UScriptCode scriptCode
;
32 struct ParenStackEntry
35 UScriptCode scriptCode
;
38 class ScriptRun
: public UObject
{
42 ScriptRun(const UChar chars
[], int32_t length
);
44 ScriptRun(const UChar chars
[], int32_t start
, int32_t length
);
48 void reset(int32_t start
, int32_t count
);
50 void reset(const UChar chars
[], int32_t start
, int32_t length
);
52 int32_t getScriptStart();
54 int32_t getScriptEnd();
56 UScriptCode
getScriptCode();
61 * ICU "poor man's RTTI", returns a UClassID for the actual class.
65 virtual inline UClassID
getDynamicClassID() const { return getStaticClassID(); }
68 * ICU "poor man's RTTI", returns a UClassID for this class.
72 static inline UClassID
getStaticClassID() { return (UClassID
)&fgClassID
; }
76 static UBool
sameScript(int32_t scriptOne
, int32_t scriptTwo
);
80 const UChar
*charArray
;
84 UScriptCode scriptCode
;
86 ParenStackEntry parenStack
[128];
89 static int8_t highBit(int32_t value
);
90 static int32_t getPairIndex(UChar32 ch
);
92 static UChar32 pairedChars
[];
93 static const int32_t pairedCharCount
;
94 static const int32_t pairedCharPower
;
95 static const int32_t pairedCharExtra
;
98 * The address of this static class variable serves as this class's ID
99 * for ICU "poor man's RTTI".
101 static const char fgClassID
;
104 inline ScriptRun::ScriptRun()
109 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t length
)
111 reset(chars
, 0, length
);
114 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t start
, int32_t length
)
116 reset(chars
, start
, length
);
119 inline int32_t ScriptRun::getScriptStart()
124 inline int32_t ScriptRun::getScriptEnd()
129 inline UScriptCode
ScriptRun::getScriptCode()
134 inline void ScriptRun::reset()
136 scriptStart
= charStart
;
137 scriptEnd
= charStart
;
138 scriptCode
= USCRIPT_INVALID_CODE
;
142 inline void ScriptRun::reset(int32_t start
, int32_t length
)
145 charLimit
= start
+ length
;
150 inline void ScriptRun::reset(const UChar chars
[], int32_t start
, int32_t length
)
154 reset(start
, length
);