Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / 3rdparty / icu / scriptrun.h
blob0a000010527d330064d74778efe70b1d06bdb05f
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
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
16 #ifndef __SCRPTRUN_H
17 #define __SCRPTRUN_H
19 #include <unicode/utypes.h>
20 #include <unicode/uobject.h>
21 #include <unicode/uscript.h>
23 U_NAMESPACE_BEGIN
25 struct ScriptRecord
27 UChar32 startChar;
28 UChar32 endChar;
29 UScriptCode scriptCode;
32 struct ParenStackEntry
34 int32_t pairIndex;
35 UScriptCode scriptCode;
38 class ScriptRun : public UObject {
39 public:
40 ScriptRun();
42 ScriptRun(const char16_t *chars, int32_t length);
44 ScriptRun(const char16_t *chars, int32_t start, int32_t length);
46 void reset();
48 void reset(int32_t start, int32_t count);
50 void reset(const char16_t *chars, int32_t start, int32_t length);
52 int32_t getScriptStart();
54 int32_t getScriptEnd();
56 UScriptCode getScriptCode();
58 UBool next();
60 /**
61 * ICU "poor man's RTTI", returns a UClassID for the actual class.
63 * @stable ICU 2.2
65 virtual inline UClassID getDynamicClassID() const override { return getStaticClassID(); }
67 /**
68 * ICU "poor man's RTTI", returns a UClassID for this class.
70 * @stable ICU 2.2
72 static inline UClassID getStaticClassID() { return (UClassID)const_cast<char *>(&fgClassID); }
74 private:
76 static UBool sameScript(int32_t scriptOne, int32_t scriptTwo);
78 int32_t charStart;
79 int32_t charLimit;
80 const char16_t *charArray;
82 int32_t scriptStart;
83 int32_t scriptEnd;
84 UScriptCode scriptCode;
86 ParenStackEntry parenStack[128];
87 int32_t parenSP;
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;
97 /**
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()
106 reset(nullptr, 0, 0);
109 inline ScriptRun::ScriptRun(const char16_t *chars, int32_t length)
111 reset(chars, 0, length);
114 inline ScriptRun::ScriptRun(const char16_t *chars, int32_t start, int32_t length)
116 reset(chars, start, length);
119 inline int32_t ScriptRun::getScriptStart()
121 return scriptStart;
124 inline int32_t ScriptRun::getScriptEnd()
126 return scriptEnd;
129 inline UScriptCode ScriptRun::getScriptCode()
131 return scriptCode;
134 inline void ScriptRun::reset()
136 scriptStart = charStart;
137 scriptEnd = charStart;
138 scriptCode = USCRIPT_INVALID_CODE;
139 parenSP = -1;
142 inline void ScriptRun::reset(int32_t start, int32_t length)
144 charStart = start;
145 charLimit = start + length;
147 reset();
150 inline void ScriptRun::reset(const char16_t *chars, int32_t start, int32_t length)
152 charArray = chars;
154 reset(start, length);
157 U_NAMESPACE_END
159 #endif