bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / scrptrun.h
blob3d1d706a6f3d0324955f925dd4b984a8c138d71f
1 /*
2 *******************************************************************************
4 * Copyright (c) 1995-2013 International Business Machines Corporation and others
6 * All rights reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a copy of
9 * this software and associated documentation files (the "Software"), to deal in
10 * the Software without restriction, including without limitation the rights to
11 * use, copy, modify, merge, publish, distribute, and/or sell copies of the
12 * Software, and to permit persons to whom the Software is furnished to do so,
13 * provided that the above copyright notice(s) and this permission notice appear
14 * in all copies of the Software and that both the above copyright notice(s) and
15 * this permission notice appear in supporting documentation.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
20 * NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
21 * LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
22 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
24 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26 * Except as contained in this notice, the name of a copyright holder shall not be
27 * used in advertising or otherwise to promote the sale, use or other dealings in
28 * this Software without prior written authorization of the copyright holder.
30 *******************************************************************************
31 * file name: scrptrun.h
33 * created on: 10/17/2001
34 * created by: Eric R. Mader
37 #ifndef INCLUDED_VCL_INC_SCRPTRUN_H
38 #define INCLUDED_VCL_INC_SCRPTRUN_H
40 #include <sal/config.h>
42 #include <unicode/uobject.h>
43 #include <unicode/uscript.h>
44 #include <vector>
46 namespace vcl {
48 struct ParenStackEntry
50 int32_t pairIndex;
51 UScriptCode scriptCode;
52 ParenStackEntry()
53 : pairIndex(0)
54 , scriptCode(USCRIPT_INVALID_CODE)
59 class ScriptRun : public icu::UObject {
60 public:
62 ScriptRun(const UChar chars[], int32_t length);
64 void reset();
66 void reset(int32_t start, int32_t count);
68 void reset(const UChar chars[], int32_t start, int32_t length);
70 int32_t getScriptStart() const;
72 int32_t getScriptEnd() const;
74 UScriptCode getScriptCode() const;
76 UBool next();
78 /**
79 s * ICU "poor man's RTTI", returns a UClassID for the actual class.
81 * @stable ICU 2.2
83 virtual UClassID getDynamicClassID() const override { return getStaticClassID(); }
85 /**
86 * ICU "poor man's RTTI", returns a UClassID for this class.
88 * @stable ICU 2.2
90 static UClassID getStaticClassID() { return static_cast<UClassID>(const_cast<char *>(&fgClassID)); }
92 private:
94 int32_t charStart;
95 int32_t charLimit;
96 const UChar *charArray;
98 int32_t scriptStart;
99 int32_t scriptEnd;
100 UScriptCode scriptCode;
102 std::vector<ParenStackEntry> parenStack;
103 int32_t parenSP;
106 * The address of this static class variable serves as this class's ID
107 * for ICU "poor man's RTTI".
109 static const char fgClassID;
112 inline ScriptRun::ScriptRun(const UChar chars[], int32_t length)
114 reset(chars, 0, length);
117 inline int32_t ScriptRun::getScriptStart() const
119 return scriptStart;
122 inline int32_t ScriptRun::getScriptEnd() const
124 return scriptEnd;
127 inline UScriptCode ScriptRun::getScriptCode() const
129 return scriptCode;
132 inline void ScriptRun::reset()
134 scriptStart = charStart;
135 scriptEnd = charStart;
136 scriptCode = USCRIPT_INVALID_CODE;
137 parenSP = -1;
138 parenStack.resize(128);
141 inline void ScriptRun::reset(int32_t start, int32_t length)
143 charStart = start;
144 charLimit = start + length;
146 reset();
149 inline void ScriptRun::reset(const UChar chars[], int32_t start, int32_t length)
151 charArray = chars;
153 reset(start, length);
158 #endif