tdf#130857 qt weld: Hide widget marked for deletion
[LibreOffice.git] / vcl / inc / scrptrun.h
blob09a5abc28478431da4cf0012f56108a25e69df28
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 <config_options.h>
41 #include <sal/config.h>
43 #include <vcl/dllapi.h>
45 #include <unicode/uobject.h>
46 #include <unicode/uscript.h>
47 #include <vector>
49 namespace vcl
51 struct ParenStackEntry
53 int32_t pairIndex;
54 UScriptCode scriptCode;
55 ParenStackEntry()
56 : pairIndex(0)
57 , scriptCode(USCRIPT_INVALID_CODE)
62 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) ScriptRun final : public icu::UObject
64 public:
65 ScriptRun(const UChar chars[], int32_t length);
67 void reset();
69 void reset(int32_t start, int32_t count);
71 void reset(const UChar chars[], int32_t start, int32_t length);
73 int32_t getScriptStart() const;
75 int32_t getScriptEnd() const;
77 UScriptCode getScriptCode() const;
79 UBool next();
81 /**
82 s * ICU "poor man's RTTI", returns a UClassID for the actual class.
84 * @stable ICU 2.2
86 virtual UClassID getDynamicClassID() const override { return getStaticClassID(); }
88 /**
89 * ICU "poor man's RTTI", returns a UClassID for this class.
91 * @stable ICU 2.2
93 static UClassID getStaticClassID()
95 return static_cast<UClassID>(const_cast<char*>(&fgClassID));
98 private:
99 int32_t charStart;
100 int32_t charLimit;
101 const UChar* charArray;
103 int32_t scriptStart;
104 int32_t scriptEnd;
105 UScriptCode scriptCode;
107 std::vector<ParenStackEntry> parenStack;
108 int32_t parenSP;
111 * The address of this static class variable serves as this class's ID
112 * for ICU "poor man's RTTI".
114 static const char fgClassID;
117 inline ScriptRun::ScriptRun(const UChar chars[], int32_t length)
119 parenStack.reserve(128);
120 reset(chars, 0, length);
123 inline int32_t ScriptRun::getScriptStart() const { return scriptStart; }
125 inline int32_t ScriptRun::getScriptEnd() const { return scriptEnd; }
127 inline UScriptCode ScriptRun::getScriptCode() const { return scriptCode; }
129 inline void ScriptRun::reset()
131 scriptStart = charStart;
132 scriptEnd = charStart;
133 scriptCode = USCRIPT_INVALID_CODE;
134 parenSP = -1;
135 parenStack.clear();
138 inline void ScriptRun::reset(int32_t start, int32_t length)
140 charStart = start;
141 charLimit = start + length;
143 reset();
146 inline void ScriptRun::reset(const UChar chars[], int32_t start, int32_t length)
148 charArray = chars;
150 reset(start, length);
154 #endif