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"
27 UScriptCode scriptCode
;
30 struct ParenStackEntry
33 UScriptCode scriptCode
;
36 class ScriptRun
: public UObject
{
40 ScriptRun(const UChar chars
[], int32_t length
);
42 ScriptRun(const UChar chars
[], int32_t start
, int32_t length
);
46 void reset(int32_t start
, int32_t count
);
48 void reset(const UChar chars
[], int32_t start
, int32_t length
);
50 int32_t getScriptStart();
52 int32_t getScriptEnd();
54 UScriptCode
getScriptCode();
59 * ICU "poor man's RTTI", returns a UClassID for the actual class.
63 virtual inline UClassID
getDynamicClassID() const { return getStaticClassID(); }
66 * ICU "poor man's RTTI", returns a UClassID for this class.
70 static inline UClassID
getStaticClassID() { return (UClassID
)&fgClassID
; }
74 static UBool
sameScript(int32_t scriptOne
, int32_t scriptTwo
);
78 const UChar
*charArray
;
82 UScriptCode scriptCode
;
84 ParenStackEntry parenStack
[128];
87 static int8_t highBit(int32_t value
);
88 static int32_t getPairIndex(UChar32 ch
);
90 static UChar32 pairedChars
[];
91 static const int32_t pairedCharCount
;
92 static const int32_t pairedCharPower
;
93 static const int32_t pairedCharExtra
;
96 * The address of this static class variable serves as this class's ID
97 * for ICU "poor man's RTTI".
99 static const char fgClassID
;
102 inline ScriptRun::ScriptRun()
107 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t length
)
109 reset(chars
, 0, length
);
112 inline ScriptRun::ScriptRun(const UChar chars
[], int32_t start
, int32_t length
)
114 reset(chars
, start
, length
);
117 inline int32_t ScriptRun::getScriptStart()
122 inline int32_t ScriptRun::getScriptEnd()
127 inline UScriptCode
ScriptRun::getScriptCode()
132 inline void ScriptRun::reset()
134 scriptStart
= charStart
;
135 scriptEnd
= charStart
;
136 scriptCode
= USCRIPT_INVALID_CODE
;
140 inline void ScriptRun::reset(int32_t start
, int32_t length
)
143 charLimit
= start
+ length
;
148 inline void ScriptRun::reset(const UChar chars
[], int32_t start
, int32_t length
)
152 reset(start
, length
);