]> git.wh0rd.org - ICEs.git/blob - bfin-5624/qfontengine.i.1
add bfin ice
[ICEs.git] / bfin-5624 / qfontengine.i.1
1 typedef long int ptrdiff_t;
2 typedef long unsigned int size_t;
3 typedef signed char qint8;
4 typedef unsigned char quint8;
5 typedef short qint16;
6 typedef unsigned short quint16;
7 typedef int qint32;
8 typedef unsigned int quint32;
9 typedef long long qint64;
10 typedef unsigned long long quint64;
11 typedef qint64 qlonglong;
12 typedef quint64 qulonglong;
13 template <int> class QUintForSize { private: typedef void Type; };
14 template <> class QUintForSize<4> { public: typedef quint32 Type; };
15 template <> class QUintForSize<8> { public: typedef quint64 Type; };
16 template <typename T> class QUintForType : public QUintForSize<sizeof(T)> { };
17 typedef QUintForType<void *>::Type quintptr;
18 template <int> class QIntForSize { private: typedef void Type; };
19 template <> class QIntForSize<4> { public: typedef qint32 Type; };
20 template <> class QIntForSize<8> { public: typedef qint64 Type; };
21 template <typename T> class QIntForType : public QIntForSize<sizeof(T)> { };
22 typedef QIntForType<void *>::Type qptrdiff;
23 typedef unsigned char uchar;
24 typedef unsigned short ushort;
25 typedef unsigned int uint;
26 typedef unsigned long ulong;
27 typedef int QNoImplicitBoolCast;
28 typedef double qreal;
29 template <typename T>
30 inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
31 inline int qRound(qreal d)
32 { return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); }
33 inline qint64 qRound64(qreal d)
34 { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); }
35 template <typename T>
36 inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; }
37 template <typename T>
38 inline const T &qMax(const T &a, const T &b) { if (a < b) return b; return a; }
39 template <typename T>
40 inline const T &qBound(const T &min, const T &val, const T &max)
41 { return qMax(min, qMin(max, val)); }
42 class QDataStream;
43 class QString;
44 class __attribute__((visibility("default"))) QSysInfo {
45 public:
46 enum Sizes {
47 WordSize = (sizeof(void *)<<3)
48 };
49 enum Endian {
50 BigEndian,
51 LittleEndian
52 , ByteOrder = LittleEndian
53 };
54 };
55 __attribute__((visibility("default"))) const char *qVersion();
56 __attribute__((visibility("default"))) bool qSharedBuild();
57 __attribute__((visibility("default"))) void qDebug(const char *, ...)
58 __attribute__ ((format (printf, 1, 2)))
59 ;
60 __attribute__((visibility("default"))) void qWarning(const char *, ...)
61 __attribute__ ((format (printf, 1, 2)))
62 ;
63 class QString;
64 __attribute__((visibility("default"))) QString qt_error_string(int errorCode = -1);
65 __attribute__((visibility("default"))) void qCritical(const char *, ...)
66 __attribute__ ((format (printf, 1, 2)))
67 ;
68 __attribute__((visibility("default"))) void qFatal(const char *, ...)
69 __attribute__ ((format (printf, 1, 2)))
70 ;
71 __attribute__((visibility("default"))) void qErrnoWarning(int code, const char *msg, ...);
72 __attribute__((visibility("default"))) void qErrnoWarning(const char *msg, ...);
73 class QDebug;
74 class QNoDebug;
75 __attribute__((visibility("default"))) inline QDebug qDebug();
76 __attribute__((visibility("default"))) inline QDebug qWarning();
77 __attribute__((visibility("default"))) inline QDebug qCritical();
78 inline void qt_noop() {}
79 __attribute__((visibility("default"))) void qt_assert(const char *assertion, const char *file, int line);
80 __attribute__((visibility("default"))) void qt_assert_x(const char *where, const char *what, const char *file, int line);
81 __attribute__((visibility("default"))) void qt_check_pointer(const char *, int);
82 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };
83 __attribute__((visibility("default"))) void qt_message_output(QtMsgType, const char *buf);
84 typedef void (*QtMsgHandler)(QtMsgType, const char *);
85 __attribute__((visibility("default"))) QtMsgHandler qInstallMsgHandler(QtMsgHandler);
86 template <typename T> class QBasicAtomicPointer;
87 template <typename T>
88 class QGlobalStatic
89 {
90 public:
91 QBasicAtomicPointer<T> pointer;
92 bool destroyed;
93 };
94 template <typename T>
95 class QGlobalStaticDeleter
96 {
97 public:
98 QGlobalStatic<T> &globalStatic;
99 QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic)
100 : globalStatic(_globalStatic)
101 { }
102 inline ~QGlobalStaticDeleter()
103 {
104 delete globalStatic.pointer;
105 globalStatic.pointer = 0;
106 globalStatic.destroyed = true;
107 }
108 };
109 class QBool
110 {
111 bool b;
112 public:
113 inline explicit QBool(bool B) : b(B) {}
114 inline operator const void *() const
115 { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); }
116 };
117 inline bool operator==(QBool b1, bool b2) { return !b1 == !b2; }
118 inline bool operator==(bool b1, QBool b2) { return !b1 == !b2; }
119 inline bool operator==(QBool b1, QBool b2) { return !b1 == !b2; }
120 inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; }
121 inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }
122 inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }
123 static inline bool qFuzzyCompare(double p1, double p2)
124 {
125 return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
126 }
127 static inline bool qFuzzyCompare(float p1, float p2)
128 {
129 return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
130 }
131 static inline bool qIsNull(double d)
132 {
133 union U {
134 double d;
135 quint64 u;
136 };
137 U val;
138 val.d = d;
139 return val.u == quint64(0);
140 }
141 static inline bool qIsNull(float f)
142 {
143 union U {
144 float f;
145 quint32 u;
146 };
147 U val;
148 val.f = f;
149 return val.u == 0u;
150 }
151 template <typename T> inline bool qIsDetached(T &) { return true; }
152 template <typename T>
153 class QTypeInfo
154 {
155 public:
156 enum {
157 isPointer = false,
158 isComplex = true,
159 isStatic = true,
160 isLarge = (sizeof(T)>sizeof(void*)),
161 isDummy = false
162 };
163 };
164 template <typename T>
165 class QTypeInfo<T*>
166 {
167 public:
168 enum {
169 isPointer = true,
170 isComplex = false,
171 isStatic = false,
172 isLarge = false,
173 isDummy = false
174 };
175 };
176 enum {
177 Q_COMPLEX_TYPE = 0,
178 Q_PRIMITIVE_TYPE = 0x1,
179 Q_STATIC_TYPE = 0,
180 Q_MOVABLE_TYPE = 0x2,
181 Q_DUMMY_TYPE = 0x4
182 };
183 template <> class QTypeInfo<bool> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(bool)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "bool"; } };
184 template <> class QTypeInfo<char> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(char)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "char"; } };
185 template <> class QTypeInfo<signed char> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(signed char)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "signed char"; } };
186 template <> class QTypeInfo<uchar> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(uchar)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "uchar"; } };
187 template <> class QTypeInfo<short> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(short)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "short"; } };
188 template <> class QTypeInfo<ushort> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(ushort)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "ushort"; } };
189 template <> class QTypeInfo<int> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(int)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "int"; } };
190 template <> class QTypeInfo<uint> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(uint)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "uint"; } };
191 template <> class QTypeInfo<long> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(long)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "long"; } };
192 template <> class QTypeInfo<ulong> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(ulong)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "ulong"; } };
193 template <> class QTypeInfo<qint64> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(qint64)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "qint64"; } };
194 template <> class QTypeInfo<quint64> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(quint64)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "quint64"; } };
195 template <> class QTypeInfo<float> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(float)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "float"; } };
196 template <> class QTypeInfo<double> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(double)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "double"; } };
197 template <> class QTypeInfo<long double> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(long double)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "long double"; } };
198 __attribute__((visibility("default"))) void *qMalloc(size_t size);
199 __attribute__((visibility("default"))) void qFree(void *ptr);
200 __attribute__((visibility("default"))) void *qRealloc(void *ptr, size_t size);
201 __attribute__((visibility("default"))) void *qMemCopy(void *dest, const void *src, size_t n);
202 __attribute__((visibility("default"))) void *qMemSet(void *dest, int c, size_t n);
203 class __attribute__((visibility("default"))) QFlag
204 {
205 int i;
206 public:
207 inline QFlag(int i);
208 inline operator int() const { return i; }
209 };
210 inline QFlag::QFlag(int ai) : i(ai) {}
211 class __attribute__((visibility("default"))) QIncompatibleFlag
212 {
213 int i;
214 public:
215 inline explicit QIncompatibleFlag(int i);
216 inline operator int() const { return i; }
217 };
218 inline QIncompatibleFlag::QIncompatibleFlag(int ai) : i(ai) {}
219 template<typename Enum>
220 class QFlags
221 {
222 typedef void **Zero;
223 int i;
224 public:
225 typedef Enum enum_type;
226 inline QFlags(const QFlags &f) : i(f.i) {}
227 inline QFlags(Enum f) : i(f) {}
228 inline QFlags(Zero = 0) : i(0) {}
229 inline QFlags(QFlag f) : i(f) {}
230 inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
231 inline QFlags &operator&=(int mask) { i &= mask; return *this; }
232 inline QFlags &operator&=(uint mask) { i &= mask; return *this; }
233 inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; }
234 inline QFlags &operator|=(Enum f) { i |= f; return *this; }
235 inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
236 inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
237 inline operator int() const { return i; }
238 inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; }
239 inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; }
240 inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; }
241 inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; }
242 inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; }
243 inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; }
244 inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; }
245 inline QFlags operator~() const { QFlags g; g.i = ~i; return g; }
246 inline bool operator!() const { return !i; }
247 inline bool testFlag(Enum f) const { return (i & f) == f; }
248 };
249 template <typename T>
250 class QForeachContainer {
251 public:
252 inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
253 const T c;
254 int brk;
255 typename T::const_iterator i, e;
256 };
257 class QByteArray;
258 __attribute__((visibility("default"))) QByteArray qgetenv(const char *varName);
259 __attribute__((visibility("default"))) bool qputenv(const char *varName, const QByteArray& value);
260 inline int qIntCast(double f) { return int(f); }
261 inline int qIntCast(float f) { return int(f); }
262 __attribute__((visibility("default"))) void qsrand(uint seed);
263 __attribute__((visibility("default"))) int qrand();
264 enum QtValidLicenseForCoreModule { LicensedCore = true };
265 enum QtValidLicenseForGuiModule { LicensedGui = true };
266 enum QtValidLicenseForNetworkModule { LicensedNetwork = true };
267 enum QtValidLicenseForOpenGLModule { LicensedOpenGL = true };
268 enum QtValidLicenseForSqlModule { LicensedSql = true };
269 enum QtValidLicenseForXmlModule { LicensedXml = true };
270 enum QtValidLicenseForXmlPatternsModule { LicensedXmlPatterns = true };
271 enum QtValidLicenseForHelpModule { LicensedHelp = true };
272 enum QtValidLicenseForScriptModule { LicensedScript = true };
273 enum QtValidLicenseForScriptToolsModule { LicensedScriptTools = true };
274 enum QtValidLicenseForQt3SupportLightModule { LicensedQt3SupportLight = true };
275 enum QtValidLicenseForQt3SupportModule { LicensedQt3Support = true };
276 enum QtValidLicenseForSvgModule { LicensedSvg = true };
277 enum QtValidLicenseForTestModule { LicensedTest = true };
278 enum QtValidLicenseForDBusModule { LicensedDBus = true };
279 typedef QtValidLicenseForCoreModule QtCoreModule;
280 namespace QAlgorithmsPrivate {
281 template <typename RandomAccessIterator, typename T, typename LessThan>
282 void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan);
283 template <typename RandomAccessIterator, typename T>
284 inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy);
285 template <typename RandomAccessIterator, typename T, typename LessThan>
286 void qStableSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan);
287 template <typename RandomAccessIterator, typename T>
288 inline void qStableSortHelper(RandomAccessIterator, RandomAccessIterator, const T &);
289 template <typename RandomAccessIterator, typename T, typename LessThan>
290 RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);
291 template <typename RandomAccessIterator, typename T, typename LessThan>
292 RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);
293 template <typename RandomAccessIterator, typename T, typename LessThan>
294 RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);
295 }
296 template <typename InputIterator, typename OutputIterator>
297 inline OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest)
298 {
299 while (begin != end)
300 *dest++ = *begin++;
301 return dest;
302 }
303 template <typename BiIterator1, typename BiIterator2>
304 inline BiIterator2 qCopyBackward(BiIterator1 begin, BiIterator1 end, BiIterator2 dest)
305 {
306 while (begin != end)
307 *--dest = *--end;
308 return dest;
309 }
310 template <typename InputIterator1, typename InputIterator2>
311 inline bool qEqual(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
312 {
313 for (; first1 != last1; ++first1, ++first2)
314 if (!(*first1 == *first2))
315 return false;
316 return true;
317 }
318 template <typename ForwardIterator, typename T>
319 inline void qFill(ForwardIterator first, ForwardIterator last, const T &val)
320 {
321 for (; first != last; ++first)
322 *first = val;
323 }
324 template <typename Container, typename T>
325 inline void qFill(Container &container, const T &val)
326 {
327 qFill(container.begin(), container.end(), val);
328 }
329 template <typename InputIterator, typename T>
330 inline InputIterator qFind(InputIterator first, InputIterator last, const T &val)
331 {
332 while (first != last && !(*first == val))
333 ++first;
334 return first;
335 }
336 template <typename Container, typename T>
337 inline typename Container::const_iterator qFind(const Container &container, const T &val)
338 {
339 return qFind(container.constBegin(), container.constEnd(), val);
340 }
341 template <typename InputIterator, typename T, typename Size>
342 inline void qCount(InputIterator first, InputIterator last, const T &value, Size &n)
343 {
344 for (; first != last; ++first)
345 if (*first == value)
346 ++n;
347 }
348 template <typename Container, typename T, typename Size>
349 inline void qCount(const Container &container, const T &value, Size &n)
350 {
351 qCount(container.constBegin(), container.constEnd(), value, n);
352 }
353 template <typename T>
354 inline void qSwap(T &value1, T &value2)
355 {
356 T t = value1;
357 value1 = value2;
358 value2 = t;
359 }
360 template <typename T>
361 class qLess
362 {
363 public:
364 inline bool operator()(const T &t1, const T &t2) const
365 {
366 return (t1 < t2);
367 }
368 };
369 template <typename T>
370 class qGreater
371 {
372 public:
373 inline bool operator()(const T &t1, const T &t2) const
374 {
375 return (t2 < t1);
376 }
377 };
378 template <typename RandomAccessIterator>
379 inline void qSort(RandomAccessIterator start, RandomAccessIterator end)
380 {
381 if (start != end)
382 QAlgorithmsPrivate::qSortHelper(start, end, *start);
383 }
384 template <typename RandomAccessIterator, typename LessThan>
385 inline void qSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan)
386 {
387 if (start != end)
388 QAlgorithmsPrivate::qSortHelper(start, end, *start, lessThan);
389 }
390 template<typename Container>
391 inline void qSort(Container &c)
392 {
393 if (!c.empty())
394 QAlgorithmsPrivate::qSortHelper(c.begin(), c.end(), *c.begin());
395 }
396 template <typename RandomAccessIterator>
397 inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end)
398 {
399 if (start != end)
400 QAlgorithmsPrivate::qStableSortHelper(start, end, *start);
401 }
402 template <typename RandomAccessIterator, typename LessThan>
403 inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan)
404 {
405 if (start != end)
406 QAlgorithmsPrivate::qStableSortHelper(start, end, *start, lessThan);
407 }
408 template<typename Container>
409 inline void qStableSort(Container &c)
410 {
411 if (!c.empty())
412 QAlgorithmsPrivate::qStableSortHelper(c.begin(), c.end(), *c.begin());
413 }
414 template <typename RandomAccessIterator, typename T>
415 RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
416 {
417 RandomAccessIterator middle;
418 int n = end - begin;
419 int half;
420 while (n > 0) {
421 half = n >> 1;
422 middle = begin + half;
423 if (*middle < value) {
424 begin = middle + 1;
425 n -= half + 1;
426 } else {
427 n = half;
428 }
429 }
430 return begin;
431 }
432 template <typename RandomAccessIterator, typename T, typename LessThan>
433 RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
434 {
435 return QAlgorithmsPrivate::qLowerBoundHelper(begin, end, value, lessThan);
436 }
437 template <typename Container, typename T>
438 typename Container::const_iterator qLowerBound(const Container &container, const T &value)
439 {
440 return QAlgorithmsPrivate::qLowerBoundHelper(container.constBegin(), container.constEnd(), value, qLess<T>());
441 }
442 template <typename RandomAccessIterator, typename T>
443 RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
444 {
445 RandomAccessIterator middle;
446 int n = end - begin;
447 int half;
448 while (n > 0) {
449 half = n >> 1;
450 middle = begin + half;
451 if (value < *middle) {
452 n = half;
453 } else {
454 begin = middle + 1;
455 n -= half + 1;
456 }
457 }
458 return begin;
459 }
460 template <typename RandomAccessIterator, typename T, typename LessThan>
461 RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
462 {
463 return QAlgorithmsPrivate::qUpperBoundHelper(begin, end, value, lessThan);
464 }
465 template <typename Container, typename T>
466 typename Container::const_iterator qUpperBound(const Container &container, const T &value)
467 {
468 return QAlgorithmsPrivate::qUpperBoundHelper(container.constBegin(), container.constEnd(), value, qLess<T>());
469 }
470 template <typename RandomAccessIterator, typename T>
471 RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
472 {
473 qint64 l = 0;
474 qint64 r = end - begin - 1;
475 if (r < 0)
476 return end;
477 qint64 i = (l + r + 1) / 2;
478 while (r != l) {
479 if (value < begin[i])
480 r = i - 1;
481 else
482 l = i;
483 i = (l + r + 1) / 2;
484 }
485 if (begin[i] < value || value < begin[i])
486 return end;
487 else
488 return begin + i;
489 }
490 template <typename RandomAccessIterator, typename T, typename LessThan>
491 RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
492 {
493 return QAlgorithmsPrivate::qBinaryFindHelper(begin, end, value, lessThan);
494 }
495 template <typename Container, typename T>
496 typename Container::const_iterator qBinaryFind(const Container &container, const T &value)
497 {
498 return QAlgorithmsPrivate::qBinaryFindHelper(container.constBegin(), container.constEnd(), value, qLess<T>());
499 }
500 template <typename ForwardIterator>
501 void qDeleteAll(ForwardIterator begin, ForwardIterator end)
502 {
503 while (begin != end) {
504 delete *begin;
505 ++begin;
506 }
507 }
508 template <typename Container>
509 inline void qDeleteAll(const Container &c)
510 {
511 qDeleteAll(c.begin(), c.end());
512 }
513 namespace QAlgorithmsPrivate {
514 template <typename RandomAccessIterator, typename T, typename LessThan>
515 void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan)
516 {
517 top:
518 int span = end - start;
519 if (span < 2)
520 return;
521 --end;
522 RandomAccessIterator low = start, high = end - 1;
523 RandomAccessIterator pivot = start + span / 2;
524 if (lessThan(*end, *start))
525 qSwap(*end, *start);
526 if (span == 2)
527 return;
528 if (lessThan(*pivot, *start))
529 qSwap(*pivot, *start);
530 if (lessThan(*end, *pivot))
531 qSwap(*end, *pivot);
532 if (span == 3)
533 return;
534 qSwap(*pivot, *end);
535 while (low < high) {
536 while (low < high && lessThan(*low, *end))
537 ++low;
538 while (high > low && lessThan(*end, *high))
539 --high;
540 if (low < high) {
541 qSwap(*low, *high);
542 ++low;
543 --high;
544 } else {
545 break;
546 }
547 }
548 if (lessThan(*low, *end))
549 ++low;
550 qSwap(*end, *low);
551 qSortHelper(start, low, t, lessThan);
552 start = low + 1;
553 ++end;
554 goto top;
555 }
556 template <typename RandomAccessIterator, typename T>
557 inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy)
558 {
559 qSortHelper(begin, end, dummy, qLess<T>());
560 }
561 template <typename RandomAccessIterator>
562 void qReverse(RandomAccessIterator begin, RandomAccessIterator end)
563 {
564 --end;
565 while (begin < end)
566 qSwap(*begin++, *end--);
567 }
568 template <typename RandomAccessIterator>
569 void qRotate(RandomAccessIterator begin, RandomAccessIterator middle, RandomAccessIterator end)
570 {
571 qReverse(begin, middle);
572 qReverse(middle, end);
573 qReverse(begin, end);
574 }
575 template <typename RandomAccessIterator, typename T, typename LessThan>
576 void qMerge(RandomAccessIterator begin, RandomAccessIterator pivot, RandomAccessIterator end, T &t, LessThan lessThan)
577 {
578 const int len1 = pivot - begin;
579 const int len2 = end - pivot;
580 if (len1 == 0 || len2 == 0)
581 return;
582 if (len1 + len2 == 2) {
583 if (lessThan(*(begin + 1), *(begin)))
584 qSwap(*begin, *(begin + 1));
585 return;
586 }
587 RandomAccessIterator firstCut;
588 RandomAccessIterator secondCut;
589 int len2Half;
590 if (len1 > len2) {
591 const int len1Half = len1 / 2;
592 firstCut = begin + len1Half;
593 secondCut = qLowerBound(pivot, end, *firstCut, lessThan);
594 len2Half = secondCut - pivot;
595 } else {
596 len2Half = len2 / 2;
597 secondCut = pivot + len2Half;
598 firstCut = qUpperBound(begin, pivot, *secondCut, lessThan);
599 }
600 qRotate(firstCut, pivot, secondCut);
601 const RandomAccessIterator newPivot = firstCut + len2Half;
602 qMerge(begin, firstCut, newPivot, t, lessThan);
603 qMerge(newPivot, secondCut, end, t, lessThan);
604 }
605 template <typename RandomAccessIterator, typename T, typename LessThan>
606 void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &t, LessThan lessThan)
607 {
608 const int span = end - begin;
609 if (span < 2)
610 return;
611 const RandomAccessIterator middle = begin + span / 2;
612 qStableSortHelper(begin, middle, t, lessThan);
613 qStableSortHelper(middle, end, t, lessThan);
614 qMerge(begin, middle, end, t, lessThan);
615 }
616 template <typename RandomAccessIterator, typename T>
617 inline void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy)
618 {
619 qStableSortHelper(begin, end, dummy, qLess<T>());
620 }
621 template <typename RandomAccessIterator, typename T, typename LessThan>
622 RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
623 {
624 RandomAccessIterator middle;
625 int n = end - begin;
626 int half;
627 while (n > 0) {
628 half = n >> 1;
629 middle = begin + half;
630 if (lessThan(*middle, value)) {
631 begin = middle + 1;
632 n -= half + 1;
633 } else {
634 n = half;
635 }
636 }
637 return begin;
638 }
639 template <typename RandomAccessIterator, typename T, typename LessThan>
640 RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
641 {
642 RandomAccessIterator middle;
643 int n = end - begin;
644 int half;
645 while (n > 0) {
646 half = n >> 1;
647 middle = begin + half;
648 if (lessThan(value, *middle)) {
649 n = half;
650 } else {
651 begin = middle + 1;
652 n -= half + 1;
653 }
654 }
655 return begin;
656 }
657 template <typename RandomAccessIterator, typename T, typename LessThan>
658 RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
659 {
660 qint64 l = 0;
661 qint64 r = end - begin - 1;
662 if (r < 0)
663 return end;
664 qint64 i = (l + r + 1) / 2;
665 while (r != l) {
666 if (lessThan(value, begin[i]))
667 r = i - 1;
668 else
669 l = i;
670 i = (l + r + 1) / 2;
671 }
672 if (lessThan(begin[i], value) || lessThan(value, begin[i]))
673 return end;
674 else
675 return begin + i;
676 }
677 }
678 typedef QtValidLicenseForCoreModule QtCoreModule;
679 class __attribute__((visibility("default"))) QBasicAtomicInt
680 {
681 public:
682 volatile int _q_value;
683 inline bool operator==(int value) const
684 {
685 return _q_value == value;
686 }
687 inline bool operator!=(int value) const
688 {
689 return _q_value != value;
690 }
691 inline bool operator!() const
692 {
693 return _q_value == 0;
694 }
695 inline operator int() const
696 {
697 return _q_value;
698 }
699 inline QBasicAtomicInt &operator=(int value)
700 {
701 _q_value = value;
702 return *this;
703 }
704 static bool isReferenceCountingNative();
705 static bool isReferenceCountingWaitFree();
706 bool ref();
707 bool deref();
708 static bool isTestAndSetNative();
709 static bool isTestAndSetWaitFree();
710 bool testAndSetRelaxed(int expectedValue, int newValue);
711 bool testAndSetAcquire(int expectedValue, int newValue);
712 bool testAndSetRelease(int expectedValue, int newValue);
713 bool testAndSetOrdered(int expectedValue, int newValue);
714 static bool isFetchAndStoreNative();
715 static bool isFetchAndStoreWaitFree();
716 int fetchAndStoreRelaxed(int newValue);
717 int fetchAndStoreAcquire(int newValue);
718 int fetchAndStoreRelease(int newValue);
719 int fetchAndStoreOrdered(int newValue);
720 static bool isFetchAndAddNative();
721 static bool isFetchAndAddWaitFree();
722 int fetchAndAddRelaxed(int valueToAdd);
723 int fetchAndAddAcquire(int valueToAdd);
724 int fetchAndAddRelease(int valueToAdd);
725 int fetchAndAddOrdered(int valueToAdd);
726 };
727 template <typename T>
728 class QBasicAtomicPointer
729 {
730 public:
731 T * volatile _q_value;
732 inline bool operator==(T *value) const
733 {
734 return _q_value == value;
735 }
736 inline bool operator!=(T *value) const
737 {
738 return !operator==(value);
739 }
740 inline bool operator!() const
741 {
742 return operator==(0);
743 }
744 inline operator T *() const
745 {
746 return _q_value;
747 }
748 inline T *operator->() const
749 {
750 return _q_value;
751 }
752 inline QBasicAtomicPointer<T> &operator=(T *value)
753 {
754 _q_value = value;
755 return *this;
756 }
757 static bool isTestAndSetNative();
758 static bool isTestAndSetWaitFree();
759 bool testAndSetRelaxed(T *expectedValue, T *newValue);
760 bool testAndSetAcquire(T *expectedValue, T *newValue);
761 bool testAndSetRelease(T *expectedValue, T *newValue);
762 bool testAndSetOrdered(T *expectedValue, T *newValue);
763 static bool isFetchAndStoreNative();
764 static bool isFetchAndStoreWaitFree();
765 T *fetchAndStoreRelaxed(T *newValue);
766 T *fetchAndStoreAcquire(T *newValue);
767 T *fetchAndStoreRelease(T *newValue);
768 T *fetchAndStoreOrdered(T *newValue);
769 static bool isFetchAndAddNative();
770 static bool isFetchAndAddWaitFree();
771 T *fetchAndAddRelaxed(qptrdiff valueToAdd);
772 T *fetchAndAddAcquire(qptrdiff valueToAdd);
773 T *fetchAndAddRelease(qptrdiff valueToAdd);
774 T *fetchAndAddOrdered(qptrdiff valueToAdd);
775 };
776 inline bool QBasicAtomicInt::isReferenceCountingNative()
777 { return false; }
778 inline bool QBasicAtomicInt::isReferenceCountingWaitFree()
779 { return false; }
780 inline bool QBasicAtomicInt::isTestAndSetNative()
781 { return false; }
782 inline bool QBasicAtomicInt::isTestAndSetWaitFree()
783 { return false; }
784 inline bool QBasicAtomicInt::isFetchAndStoreNative()
785 { return false; }
786 inline bool QBasicAtomicInt::isFetchAndStoreWaitFree()
787 { return false; }
788 inline bool QBasicAtomicInt::isFetchAndAddNative()
789 { return false; }
790 inline bool QBasicAtomicInt::isFetchAndAddWaitFree()
791 { return false; }
792 template <typename T>
793 inline bool QBasicAtomicPointer<T>::isTestAndSetNative()
794 { return false; }
795 template <typename T>
796 inline bool QBasicAtomicPointer<T>::isTestAndSetWaitFree()
797 { return false; }
798 template <typename T>
799 inline bool QBasicAtomicPointer<T>::isFetchAndStoreNative()
800 { return false; }
801 template <typename T>
802 inline bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree()
803 { return false; }
804 template <typename T>
805 inline bool QBasicAtomicPointer<T>::isFetchAndAddNative()
806 { return false; }
807 template <typename T>
808 inline bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
809 { return false; }
810 __attribute__((visibility("default"))) bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int);
811 __attribute__((visibility("default"))) int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int);
812 __attribute__((visibility("default"))) int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int);
813 __attribute__((visibility("default"))) bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *);
814 __attribute__((visibility("default"))) void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *);
815 __attribute__((visibility("default"))) void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff);
816 inline bool QBasicAtomicInt::ref()
817 {
818 return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, 1) != -1;
819 }
820 inline bool QBasicAtomicInt::deref()
821 {
822 return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, -1) != 1;
823 }
824 inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
825 {
826 return QBasicAtomicInt_testAndSetOrdered(&_q_value, expectedValue, newValue);
827 }
828 inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
829 {
830 return testAndSetOrdered(expectedValue, newValue);
831 }
832 inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
833 {
834 return testAndSetOrdered(expectedValue, newValue);
835 }
836 inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
837 {
838 return testAndSetOrdered(expectedValue, newValue);
839 }
840 inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
841 {
842 return QBasicAtomicInt_fetchAndStoreOrdered(&_q_value, newValue);
843 }
844 inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
845 {
846 return fetchAndStoreOrdered(newValue);
847 }
848 inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
849 {
850 return fetchAndStoreOrdered(newValue);
851 }
852 inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
853 {
854 return fetchAndStoreOrdered(newValue);
855 }
856 inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
857 {
858 return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, valueToAdd);
859 }
860 inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
861 {
862 return fetchAndAddOrdered(valueToAdd);
863 }
864 inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
865 {
866 return fetchAndAddOrdered(valueToAdd);
867 }
868 inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
869 {
870 return fetchAndAddOrdered(valueToAdd);
871 }
872 template <typename T>
873 inline bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
874 {
875 union { T * volatile * typed; void * volatile * voidp; } pointer;
876 pointer.typed = &_q_value;
877 return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue);
878 }
879 template <typename T>
880 inline bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
881 {
882 return testAndSetOrdered(expectedValue, newValue);
883 }
884 template <typename T>
885 inline bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue)
886 {
887 return testAndSetOrdered(expectedValue, newValue);
888 }
889 template <typename T>
890 inline bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue)
891 {
892 return testAndSetOrdered(expectedValue, newValue);
893 }
894 template <typename T>
895 inline T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
896 {
897 union { T * volatile * typed; void * volatile * voidp; } pointer;
898 union { T *typed; void *voidp; } returnValue;
899 pointer.typed = &_q_value;
900 returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue);
901 return returnValue.typed;
902 }
903 template <typename T>
904 inline T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
905 {
906 return fetchAndStoreOrdered(newValue);
907 }
908 template <typename T>
909 inline T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
910 {
911 return fetchAndStoreOrdered(newValue);
912 }
913 template <typename T>
914 inline T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
915 {
916 return fetchAndStoreOrdered(newValue);
917 }
918 template <typename T>
919 inline T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
920 {
921 union { T * volatile *typed; void * volatile *voidp; } pointer;
922 union { T *typed; void *voidp; } returnValue;
923 pointer.typed = &_q_value;
924 returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T));
925 return returnValue.typed;
926 }
927 template <typename T>
928 inline T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd)
929 {
930 return fetchAndAddOrdered(valueToAdd);
931 }
932 template <typename T>
933 inline T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd)
934 {
935 return fetchAndAddOrdered(valueToAdd);
936 }
937 template <typename T>
938 inline T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd)
939 {
940 return fetchAndAddOrdered(valueToAdd);
941 }
942 typedef QtValidLicenseForCoreModule QtCoreModule;
943 class __attribute__((visibility("default"))) QAtomicInt : public QBasicAtomicInt
944 {
945 public:
946 inline QAtomicInt(int value = 0)
947 {
948 _q_value = value;
949 }
950 inline QAtomicInt(const QAtomicInt &other)
951 {
952 _q_value = other._q_value;
953 }
954 inline QAtomicInt &operator=(int value)
955 {
956 (void) QBasicAtomicInt::operator=(value);
957 return *this;
958 }
959 inline QAtomicInt &operator=(const QAtomicInt &other)
960 {
961 (void) QBasicAtomicInt::operator=(other);
962 return *this;
963 }
964 };
965 template <typename T>
966 class QAtomicPointer : public QBasicAtomicPointer<T>
967 {
968 public:
969 inline QAtomicPointer(T *value = 0)
970 {
971 QBasicAtomicPointer<T>::_q_value = value;
972 }
973 inline QAtomicPointer(const QAtomicPointer<T> &other)
974 {
975 QBasicAtomicPointer<T>::_q_value = other._q_value;
976 }
977 inline QAtomicPointer<T> &operator=(T *value)
978 {
979 (void) QBasicAtomicPointer<T>::operator=(value);
980 return *this;
981 }
982 inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other)
983 {
984 (void) QBasicAtomicPointer<T>::operator=(other);
985 return *this;
986 }
987 };
988 template <typename T>
989 inline void qAtomicAssign(T *&d, T *x)
990 {
991 if (d == x)
992 return;
993 x->ref.ref();
994 if (!d->ref.deref())
995 delete d;
996 d = x;
997 }
998 template <typename T>
999 inline void qAtomicDetach(T *&d)
1000 {
1001 if (d->ref == 1)
1002 return;
1003 T *x = d;
1004 d = new T(*d);
1005 if (!x->ref.deref())
1006 delete x;
1007 }
1008 typedef QtValidLicenseForCoreModule QtCoreModule;
1009 class QString;
1010 struct QLatin1Char
1011 {
1012 public:
1013 inline explicit QLatin1Char(char c) : ch(c) {}
1014 inline char toLatin1() const { return ch; }
1015 inline ushort unicode() const { return ushort(uchar(ch)); }
1016 private:
1017 char ch;
1018 };
1019 class __attribute__((visibility("default"))) QChar {
1020 public:
1021 QChar();
1022 __attribute__ ((__deprecated__)) QChar(char c);
1023 __attribute__ ((__deprecated__)) QChar(uchar c);
1024 QChar(QLatin1Char ch);
1025 QChar(uchar c, uchar r);
1026 inline QChar(ushort rc) : ucs(rc){}
1027 QChar(short rc);
1028 QChar(uint rc);
1029 QChar(int rc);
1030 enum SpecialCharacter {
1031 Null = 0x0000,
1032 Nbsp = 0x00a0,
1033 ReplacementCharacter = 0xfffd,
1034 ObjectReplacementCharacter = 0xfffc,
1035 ByteOrderMark = 0xfeff,
1036 ByteOrderSwapped = 0xfffe,
1037 ParagraphSeparator = 0x2029,
1038 LineSeparator = 0x2028
1039 };
1040 QChar(SpecialCharacter sc);
1041 enum Category
1042 {
1043 NoCategory,
1044 Mark_NonSpacing,
1045 Mark_SpacingCombining,
1046 Mark_Enclosing,
1047 Number_DecimalDigit,
1048 Number_Letter,
1049 Number_Other,
1050 Separator_Space,
1051 Separator_Line,
1052 Separator_Paragraph,
1053 Other_Control,
1054 Other_Format,
1055 Other_Surrogate,
1056 Other_PrivateUse,
1057 Other_NotAssigned,
1058 Letter_Uppercase,
1059 Letter_Lowercase,
1060 Letter_Titlecase,
1061 Letter_Modifier,
1062 Letter_Other,
1063 Punctuation_Connector,
1064 Punctuation_Dash,
1065 Punctuation_Open,
1066 Punctuation_Close,
1067 Punctuation_InitialQuote,
1068 Punctuation_FinalQuote,
1069 Punctuation_Other,
1070 Symbol_Math,
1071 Symbol_Currency,
1072 Symbol_Modifier,
1073 Symbol_Other,
1074 Punctuation_Dask = Punctuation_Dash
1075 };
1076 enum Direction
1077 {
1078 DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
1079 DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
1080 };
1081 enum Decomposition
1082 {
1083 NoDecomposition,
1084 Canonical,
1085 Font,
1086 NoBreak,
1087 Initial,
1088 Medial,
1089 Final,
1090 Isolated,
1091 Circle,
1092 Super,
1093 Sub,
1094 Vertical,
1095 Wide,
1096 Narrow,
1097 Small,
1098 Square,
1099 Compat,
1100 Fraction
1101 };
1102 enum Joining
1103 {
1104 OtherJoining, Dual, Right, Center
1105 };
1106 enum CombiningClass
1107 {
1108 Combining_BelowLeftAttached = 200,
1109 Combining_BelowAttached = 202,
1110 Combining_BelowRightAttached = 204,
1111 Combining_LeftAttached = 208,
1112 Combining_RightAttached = 210,
1113 Combining_AboveLeftAttached = 212,
1114 Combining_AboveAttached = 214,
1115 Combining_AboveRightAttached = 216,
1116 Combining_BelowLeft = 218,
1117 Combining_Below = 220,
1118 Combining_BelowRight = 222,
1119 Combining_Left = 224,
1120 Combining_Right = 226,
1121 Combining_AboveLeft = 228,
1122 Combining_Above = 230,
1123 Combining_AboveRight = 232,
1124 Combining_DoubleBelow = 233,
1125 Combining_DoubleAbove = 234,
1126 Combining_IotaSubscript = 240
1127 };
1128 enum UnicodeVersion {
1129 Unicode_Unassigned,
1130 Unicode_1_1,
1131 Unicode_2_0,
1132 Unicode_2_1_2,
1133 Unicode_3_0,
1134 Unicode_3_1,
1135 Unicode_3_2,
1136 Unicode_4_0,
1137 Unicode_4_1,
1138 Unicode_5_0
1139 };
1140 Category category() const;
1141 Direction direction() const;
1142 Joining joining() const;
1143 bool hasMirrored() const;
1144 unsigned char combiningClass() const;
1145 QChar mirroredChar() const;
1146 QString decomposition() const;
1147 Decomposition decompositionTag() const;
1148 int digitValue() const;
1149 QChar toLower() const;
1150 QChar toUpper() const;
1151 QChar toTitleCase() const;
1152 QChar toCaseFolded() const;
1153 UnicodeVersion unicodeVersion() const;
1154 char toAscii() const;
1155 inline char toLatin1() const;
1156 inline ushort unicode() const { return ucs; }
1157 inline ushort &unicode() { return const_cast<ushort&>(ucs); }
1158 static QChar fromAscii(char c);
1159 static QChar fromLatin1(char c);
1160 inline bool isNull() const { return ucs == 0; }
1161 bool isPrint() const;
1162 bool isPunct() const;
1163 bool isSpace() const;
1164 bool isMark() const;
1165 bool isLetter() const;
1166 bool isNumber() const;
1167 bool isLetterOrNumber() const;
1168 bool isDigit() const;
1169 bool isSymbol() const;
1170 inline bool isLower() const { return category() == Letter_Lowercase; }
1171 inline bool isUpper() const { return category() == Letter_Uppercase; }
1172 inline bool isTitleCase() const { return category() == Letter_Titlecase; }
1173 inline bool isHighSurrogate() const {
1174 return ((ucs & 0xfc00) == 0xd800);
1175 }
1176 inline bool isLowSurrogate() const {
1177 return ((ucs & 0xfc00) == 0xdc00);
1178 }
1179 inline uchar cell() const { return uchar(ucs & 0xff); }
1180 inline uchar row() const { return uchar((ucs>>8)&0xff); }
1181 inline void setCell(uchar cell);
1182 inline void setRow(uchar row);
1183 static inline uint surrogateToUcs4(ushort high, ushort low) {
1184 return (uint(high)<<10) + low - 0x35fdc00;
1185 }
1186 static inline uint surrogateToUcs4(QChar high, QChar low) {
1187 return (uint(high.ucs)<<10) + low.ucs - 0x35fdc00;
1188 }
1189 static inline ushort highSurrogate(uint ucs4) {
1190 return (ucs4>>10) + 0xd7c0;
1191 }
1192 static inline ushort lowSurrogate(uint ucs4) {
1193 return ucs4%0x400 + 0xdc00;
1194 }
1195 static Category category(uint ucs4);
1196 static Category category(ushort ucs2);
1197 static Direction direction(uint ucs4);
1198 static Direction direction(ushort ucs2);
1199 static Joining joining(uint ucs4);
1200 static Joining joining(ushort ucs2);
1201 static unsigned char combiningClass(uint ucs4);
1202 static unsigned char combiningClass(ushort ucs2);
1203 static uint mirroredChar(uint ucs4);
1204 static ushort mirroredChar(ushort ucs2);
1205 static Decomposition decompositionTag(uint ucs4);
1206 static int digitValue(uint ucs4);
1207 static int digitValue(ushort ucs2);
1208 static uint toLower(uint ucs4);
1209 static ushort toLower(ushort ucs2);
1210 static uint toUpper(uint ucs4);
1211 static ushort toUpper(ushort ucs2);
1212 static uint toTitleCase(uint ucs4);
1213 static ushort toTitleCase(ushort ucs2);
1214 static uint toCaseFolded(uint ucs4);
1215 static ushort toCaseFolded(ushort ucs2);
1216 static UnicodeVersion unicodeVersion(uint ucs4);
1217 static UnicodeVersion unicodeVersion(ushort ucs2);
1218 static QString decomposition(uint ucs4);
1219 private:
1220 ushort ucs;
1221 }
1222 ;
1223 template <> class QTypeInfo<QChar> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QChar)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QChar"; } };
1224 inline QChar::QChar() : ucs(0) {}
1225 inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
1226 inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
1227 inline QChar::QChar(uchar c, uchar r) : ucs((r << 8) | c){}
1228 inline QChar::QChar(short rc) : ucs(ushort(rc)){}
1229 inline QChar::QChar(uint rc) : ucs(ushort(rc & 0xffff)){}
1230 inline QChar::QChar(int rc) : ucs(ushort(rc & 0xffff)){}
1231 inline QChar::QChar(SpecialCharacter s) : ucs(ushort(s)) {}
1232 inline QChar::QChar(QLatin1Char ch) : ucs(ch.unicode()) {}
1233 inline void QChar::setCell(uchar acell)
1234 { ucs = (ucs & 0xff00) + acell; }
1235 inline void QChar::setRow(uchar arow)
1236 { ucs = (ushort(arow)<<8) + (ucs&0xff); }
1237 inline bool operator==(QChar c1, QChar c2) { return c1.unicode() == c2.unicode(); }
1238 inline bool operator!=(QChar c1, QChar c2) { return c1.unicode() != c2.unicode(); }
1239 inline bool operator<=(QChar c1, QChar c2) { return c1.unicode() <= c2.unicode(); }
1240 inline bool operator>=(QChar c1, QChar c2) { return c1.unicode() >= c2.unicode(); }
1241 inline bool operator<(QChar c1, QChar c2) { return c1.unicode() < c2.unicode(); }
1242 inline bool operator>(QChar c1, QChar c2) { return c1.unicode() > c2.unicode(); }
1243 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QChar &);
1244 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QChar &);
1245 namespace std {
1246 struct bidirectional_iterator_tag;
1247 struct random_access_iterator_tag;
1248 }
1249 typedef QtValidLicenseForCoreModule QtCoreModule;
1250 namespace std __attribute__ ((__visibility__ ("default"))) {
1251 }
1252 namespace std __attribute__ ((__visibility__ ("default"))) {
1253 using ::ptrdiff_t;
1254 using ::size_t;
1255 }
1256 namespace std __attribute__ ((__visibility__ ("default"))) {
1257 struct input_iterator_tag {};
1258 struct output_iterator_tag {};
1259 struct forward_iterator_tag : public input_iterator_tag {};
1260 struct bidirectional_iterator_tag : public forward_iterator_tag {};
1261 struct random_access_iterator_tag : public bidirectional_iterator_tag {};
1262 template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
1263 typename _Pointer = _Tp*, typename _Reference = _Tp&>
1264 struct iterator
1265 {
1266 typedef _Category iterator_category;
1267 typedef _Tp value_type;
1268 typedef _Distance difference_type;
1269 typedef _Pointer pointer;
1270 typedef _Reference reference;
1271 };
1272 template<typename _Iterator>
1273 struct iterator_traits
1274 {
1275 typedef typename _Iterator::iterator_category iterator_category;
1276 typedef typename _Iterator::value_type value_type;
1277 typedef typename _Iterator::difference_type difference_type;
1278 typedef typename _Iterator::pointer pointer;
1279 typedef typename _Iterator::reference reference;
1280 };
1281 template<typename _Tp>
1282 struct iterator_traits<_Tp*>
1283 {
1284 typedef random_access_iterator_tag iterator_category;
1285 typedef _Tp value_type;
1286 typedef ptrdiff_t difference_type;
1287 typedef _Tp* pointer;
1288 typedef _Tp& reference;
1289 };
1290 template<typename _Tp>
1291 struct iterator_traits<const _Tp*>
1292 {
1293 typedef random_access_iterator_tag iterator_category;
1294 typedef _Tp value_type;
1295 typedef ptrdiff_t difference_type;
1296 typedef const _Tp* pointer;
1297 typedef const _Tp& reference;
1298 };
1299 template<typename _Iter>
1300 inline typename iterator_traits<_Iter>::iterator_category
1301 __iterator_category(const _Iter&)
1302 { return typename iterator_traits<_Iter>::iterator_category(); }
1303 }
1304 namespace std __attribute__ ((__visibility__ ("default"))) {
1305 template<typename _InputIterator>
1306 inline typename iterator_traits<_InputIterator>::difference_type
1307 __distance(_InputIterator __first, _InputIterator __last,
1308 input_iterator_tag)
1309 {
1310 typename iterator_traits<_InputIterator>::difference_type __n = 0;
1311 while (__first != __last)
1312 {
1313 ++__first;
1314 ++__n;
1315 }
1316 return __n;
1317 }
1318 template<typename _RandomAccessIterator>
1319 inline typename iterator_traits<_RandomAccessIterator>::difference_type
1320 __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
1321 random_access_iterator_tag)
1322 {
1323 return __last - __first;
1324 }
1325 template<typename _InputIterator>
1326 inline typename iterator_traits<_InputIterator>::difference_type
1327 distance(_InputIterator __first, _InputIterator __last)
1328 {
1329 return std::__distance(__first, __last,
1330 std::__iterator_category(__first));
1331 }
1332 template<typename _InputIterator, typename _Distance>
1333 inline void
1334 __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
1335 {
1336 while (__n--)
1337 ++__i;
1338 }
1339 template<typename _BidirectionalIterator, typename _Distance>
1340 inline void
1341 __advance(_BidirectionalIterator& __i, _Distance __n,
1342 bidirectional_iterator_tag)
1343 {
1344 if (__n > 0)
1345 while (__n--)
1346 ++__i;
1347 else
1348 while (__n++)
1349 --__i;
1350 }
1351 template<typename _RandomAccessIterator, typename _Distance>
1352 inline void
1353 __advance(_RandomAccessIterator& __i, _Distance __n,
1354 random_access_iterator_tag)
1355 {
1356 __i += __n;
1357 }
1358 template<typename _InputIterator, typename _Distance>
1359 inline void
1360 advance(_InputIterator& __i, _Distance __n)
1361 {
1362 typename iterator_traits<_InputIterator>::difference_type __d = __n;
1363 std::__advance(__i, __d, std::__iterator_category(__i));
1364 }
1365 }
1366 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
1367 template<typename _Iterator, typename _Container>
1368 class __normal_iterator;
1369 }
1370 namespace std __attribute__ ((__visibility__ ("default"))) {
1371 struct __true_type { };
1372 struct __false_type { };
1373 template<bool>
1374 struct __truth_type
1375 { typedef __false_type __type; };
1376 template<>
1377 struct __truth_type<true>
1378 { typedef __true_type __type; };
1379 template<class _Sp, class _Tp>
1380 struct __traitor
1381 {
1382 enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
1383 typedef typename __truth_type<__value>::__type __type;
1384 };
1385 template<class _Sp, class _Tp>
1386 struct __traitand
1387 {
1388 enum { __value = bool(_Sp::__value) && bool(_Tp::__value) };
1389 typedef typename __truth_type<__value>::__type __type;
1390 };
1391 template<typename, typename>
1392 struct __are_same
1393 {
1394 enum { __value = 0 };
1395 typedef __false_type __type;
1396 };
1397 template<typename _Tp>
1398 struct __are_same<_Tp, _Tp>
1399 {
1400 enum { __value = 1 };
1401 typedef __true_type __type;
1402 };
1403 template<typename _Tp>
1404 struct __is_void
1405 {
1406 enum { __value = 0 };
1407 typedef __false_type __type;
1408 };
1409 template<>
1410 struct __is_void<void>
1411 {
1412 enum { __value = 1 };
1413 typedef __true_type __type;
1414 };
1415 template<typename _Tp>
1416 struct __is_integer
1417 {
1418 enum { __value = 0 };
1419 typedef __false_type __type;
1420 };
1421 template<>
1422 struct __is_integer<bool>
1423 {
1424 enum { __value = 1 };
1425 typedef __true_type __type;
1426 };
1427 template<>
1428 struct __is_integer<char>
1429 {
1430 enum { __value = 1 };
1431 typedef __true_type __type;
1432 };
1433 template<>
1434 struct __is_integer<signed char>
1435 {
1436 enum { __value = 1 };
1437 typedef __true_type __type;
1438 };
1439 template<>
1440 struct __is_integer<unsigned char>
1441 {
1442 enum { __value = 1 };
1443 typedef __true_type __type;
1444 };
1445 template<>
1446 struct __is_integer<short>
1447 {
1448 enum { __value = 1 };
1449 typedef __true_type __type;
1450 };
1451 template<>
1452 struct __is_integer<unsigned short>
1453 {
1454 enum { __value = 1 };
1455 typedef __true_type __type;
1456 };
1457 template<>
1458 struct __is_integer<int>
1459 {
1460 enum { __value = 1 };
1461 typedef __true_type __type;
1462 };
1463 template<>
1464 struct __is_integer<unsigned int>
1465 {
1466 enum { __value = 1 };
1467 typedef __true_type __type;
1468 };
1469 template<>
1470 struct __is_integer<long>
1471 {
1472 enum { __value = 1 };
1473 typedef __true_type __type;
1474 };
1475 template<>
1476 struct __is_integer<unsigned long>
1477 {
1478 enum { __value = 1 };
1479 typedef __true_type __type;
1480 };
1481 template<>
1482 struct __is_integer<long long>
1483 {
1484 enum { __value = 1 };
1485 typedef __true_type __type;
1486 };
1487 template<>
1488 struct __is_integer<unsigned long long>
1489 {
1490 enum { __value = 1 };
1491 typedef __true_type __type;
1492 };
1493 template<typename _Tp>
1494 struct __is_floating
1495 {
1496 enum { __value = 0 };
1497 typedef __false_type __type;
1498 };
1499 template<>
1500 struct __is_floating<float>
1501 {
1502 enum { __value = 1 };
1503 typedef __true_type __type;
1504 };
1505 template<>
1506 struct __is_floating<double>
1507 {
1508 enum { __value = 1 };
1509 typedef __true_type __type;
1510 };
1511 template<>
1512 struct __is_floating<long double>
1513 {
1514 enum { __value = 1 };
1515 typedef __true_type __type;
1516 };
1517 template<typename _Tp>
1518 struct __is_pointer
1519 {
1520 enum { __value = 0 };
1521 typedef __false_type __type;
1522 };
1523 template<typename _Tp>
1524 struct __is_pointer<_Tp*>
1525 {
1526 enum { __value = 1 };
1527 typedef __true_type __type;
1528 };
1529 template<typename _Tp>
1530 struct __is_normal_iterator
1531 {
1532 enum { __value = 0 };
1533 typedef __false_type __type;
1534 };
1535 template<typename _Iterator, typename _Container>
1536 struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
1537 _Container> >
1538 {
1539 enum { __value = 1 };
1540 typedef __true_type __type;
1541 };
1542 template<typename _Tp>
1543 struct __is_arithmetic
1544 : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
1545 { };
1546 template<typename _Tp>
1547 struct __is_fundamental
1548 : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> >
1549 { };
1550 template<typename _Tp>
1551 struct __is_scalar
1552 : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
1553 { };
1554 template<typename _Tp>
1555 struct __is_char
1556 {
1557 enum { __value = 0 };
1558 typedef __false_type __type;
1559 };
1560 template<>
1561 struct __is_char<char>
1562 {
1563 enum { __value = 1 };
1564 typedef __true_type __type;
1565 };
1566 template<typename _Tp>
1567 struct __is_byte
1568 {
1569 enum { __value = 0 };
1570 typedef __false_type __type;
1571 };
1572 template<>
1573 struct __is_byte<char>
1574 {
1575 enum { __value = 1 };
1576 typedef __true_type __type;
1577 };
1578 template<>
1579 struct __is_byte<signed char>
1580 {
1581 enum { __value = 1 };
1582 typedef __true_type __type;
1583 };
1584 template<>
1585 struct __is_byte<unsigned char>
1586 {
1587 enum { __value = 1 };
1588 typedef __true_type __type;
1589 };
1590 template<typename _Tp>
1591 struct __is_move_iterator
1592 {
1593 enum { __value = 0 };
1594 typedef __false_type __type;
1595 };
1596 }
1597 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
1598 template<bool, typename>
1599 struct __enable_if
1600 { };
1601 template<typename _Tp>
1602 struct __enable_if<true, _Tp>
1603 { typedef _Tp __type; };
1604 template<bool _Cond, typename _Iftrue, typename _Iffalse>
1605 struct __conditional_type
1606 { typedef _Iftrue __type; };
1607 template<typename _Iftrue, typename _Iffalse>
1608 struct __conditional_type<false, _Iftrue, _Iffalse>
1609 { typedef _Iffalse __type; };
1610 template<typename _Tp>
1611 struct __add_unsigned
1612 {
1613 private:
1614 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
1615 public:
1616 typedef typename __if_type::__type __type;
1617 };
1618 template<>
1619 struct __add_unsigned<char>
1620 { typedef unsigned char __type; };
1621 template<>
1622 struct __add_unsigned<signed char>
1623 { typedef unsigned char __type; };
1624 template<>
1625 struct __add_unsigned<short>
1626 { typedef unsigned short __type; };
1627 template<>
1628 struct __add_unsigned<int>
1629 { typedef unsigned int __type; };
1630 template<>
1631 struct __add_unsigned<long>
1632 { typedef unsigned long __type; };
1633 template<>
1634 struct __add_unsigned<long long>
1635 { typedef unsigned long long __type; };
1636 template<>
1637 struct __add_unsigned<bool>;
1638 template<>
1639 struct __add_unsigned<wchar_t>;
1640 template<typename _Tp>
1641 struct __remove_unsigned
1642 {
1643 private:
1644 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
1645 public:
1646 typedef typename __if_type::__type __type;
1647 };
1648 template<>
1649 struct __remove_unsigned<char>
1650 { typedef signed char __type; };
1651 template<>
1652 struct __remove_unsigned<unsigned char>
1653 { typedef signed char __type; };
1654 template<>
1655 struct __remove_unsigned<unsigned short>
1656 { typedef short __type; };
1657 template<>
1658 struct __remove_unsigned<unsigned int>
1659 { typedef int __type; };
1660 template<>
1661 struct __remove_unsigned<unsigned long>
1662 { typedef long __type; };
1663 template<>
1664 struct __remove_unsigned<unsigned long long>
1665 { typedef long long __type; };
1666 template<>
1667 struct __remove_unsigned<bool>;
1668 template<>
1669 struct __remove_unsigned<wchar_t>;
1670 template<typename _Type>
1671 inline bool
1672 __is_null_pointer(_Type* __ptr)
1673 { return __ptr == 0; }
1674 template<typename _Type>
1675 inline bool
1676 __is_null_pointer(_Type)
1677 { return false; }
1678 template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
1679 struct __promote
1680 { typedef double __type; };
1681 template<typename _Tp>
1682 struct __promote<_Tp, false>
1683 { typedef _Tp __type; };
1684 template<typename _Tp, typename _Up>
1685 struct __promote_2
1686 {
1687 private:
1688 typedef typename __promote<_Tp>::__type __type1;
1689 typedef typename __promote<_Up>::__type __type2;
1690 public:
1691 typedef __typeof__(__type1() + __type2()) __type;
1692 };
1693 template<typename _Tp, typename _Up, typename _Vp>
1694 struct __promote_3
1695 {
1696 private:
1697 typedef typename __promote<_Tp>::__type __type1;
1698 typedef typename __promote<_Up>::__type __type2;
1699 typedef typename __promote<_Vp>::__type __type3;
1700 public:
1701 typedef __typeof__(__type1() + __type2() + __type3()) __type;
1702 };
1703 template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
1704 struct __promote_4
1705 {
1706 private:
1707 typedef typename __promote<_Tp>::__type __type1;
1708 typedef typename __promote<_Up>::__type __type2;
1709 typedef typename __promote<_Vp>::__type __type3;
1710 typedef typename __promote<_Wp>::__type __type4;
1711 public:
1712 typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type;
1713 };
1714 }
1715 namespace std __attribute__ ((__visibility__ ("default"))) {
1716 template<typename _Tp>
1717 inline void
1718 swap(_Tp& __a, _Tp& __b)
1719 {
1720 _Tp __tmp = (__a);
1721 __a = (__b);
1722 __b = (__tmp);
1723 }
1724 }
1725 namespace std __attribute__ ((__visibility__ ("default"))) {
1726 template<typename _Iterator>
1727 class reverse_iterator
1728 : public iterator<typename iterator_traits<_Iterator>::iterator_category,
1729 typename iterator_traits<_Iterator>::value_type,
1730 typename iterator_traits<_Iterator>::difference_type,
1731 typename iterator_traits<_Iterator>::pointer,
1732 typename iterator_traits<_Iterator>::reference>
1733 {
1734 protected:
1735 _Iterator current;
1736 public:
1737 typedef _Iterator iterator_type;
1738 typedef typename iterator_traits<_Iterator>::difference_type
1739 difference_type;
1740 typedef typename iterator_traits<_Iterator>::reference reference;
1741 typedef typename iterator_traits<_Iterator>::pointer pointer;
1742 public:
1743 reverse_iterator() : current() { }
1744 explicit
1745 reverse_iterator(iterator_type __x) : current(__x) { }
1746 reverse_iterator(const reverse_iterator& __x)
1747 : current(__x.current) { }
1748 template<typename _Iter>
1749 reverse_iterator(const reverse_iterator<_Iter>& __x)
1750 : current(__x.base()) { }
1751 iterator_type
1752 base() const
1753 { return current; }
1754 reference
1755 operator*() const
1756 {
1757 _Iterator __tmp = current;
1758 return *--__tmp;
1759 }
1760 pointer
1761 operator->() const
1762 { return &(operator*()); }
1763 reverse_iterator&
1764 operator++()
1765 {
1766 --current;
1767 return *this;
1768 }
1769 reverse_iterator
1770 operator++(int)
1771 {
1772 reverse_iterator __tmp = *this;
1773 --current;
1774 return __tmp;
1775 }
1776 reverse_iterator&
1777 operator--()
1778 {
1779 ++current;
1780 return *this;
1781 }
1782 reverse_iterator
1783 operator--(int)
1784 {
1785 reverse_iterator __tmp = *this;
1786 ++current;
1787 return __tmp;
1788 }
1789 reverse_iterator
1790 operator+(difference_type __n) const
1791 { return reverse_iterator(current - __n); }
1792 reverse_iterator&
1793 operator+=(difference_type __n)
1794 {
1795 current -= __n;
1796 return *this;
1797 }
1798 reverse_iterator
1799 operator-(difference_type __n) const
1800 { return reverse_iterator(current + __n); }
1801 reverse_iterator&
1802 operator-=(difference_type __n)
1803 {
1804 current += __n;
1805 return *this;
1806 }
1807 reference
1808 operator[](difference_type __n) const
1809 { return *(*this + __n); }
1810 };
1811 template<typename _Iterator>
1812 inline bool
1813 operator==(const reverse_iterator<_Iterator>& __x,
1814 const reverse_iterator<_Iterator>& __y)
1815 { return __x.base() == __y.base(); }
1816 template<typename _Iterator>
1817 inline bool
1818 operator<(const reverse_iterator<_Iterator>& __x,
1819 const reverse_iterator<_Iterator>& __y)
1820 { return __y.base() < __x.base(); }
1821 template<typename _Iterator>
1822 inline bool
1823 operator!=(const reverse_iterator<_Iterator>& __x,
1824 const reverse_iterator<_Iterator>& __y)
1825 { return !(__x == __y); }
1826 template<typename _Iterator>
1827 inline bool
1828 operator>(const reverse_iterator<_Iterator>& __x,
1829 const reverse_iterator<_Iterator>& __y)
1830 { return __y < __x; }
1831 template<typename _Iterator>
1832 inline bool
1833 operator<=(const reverse_iterator<_Iterator>& __x,
1834 const reverse_iterator<_Iterator>& __y)
1835 { return !(__y < __x); }
1836 template<typename _Iterator>
1837 inline bool
1838 operator>=(const reverse_iterator<_Iterator>& __x,
1839 const reverse_iterator<_Iterator>& __y)
1840 { return !(__x < __y); }
1841 template<typename _Iterator>
1842 inline typename reverse_iterator<_Iterator>::difference_type
1843 operator-(const reverse_iterator<_Iterator>& __x,
1844 const reverse_iterator<_Iterator>& __y)
1845 { return __y.base() - __x.base(); }
1846 template<typename _Iterator>
1847 inline reverse_iterator<_Iterator>
1848 operator+(typename reverse_iterator<_Iterator>::difference_type __n,
1849 const reverse_iterator<_Iterator>& __x)
1850 { return reverse_iterator<_Iterator>(__x.base() - __n); }
1851 template<typename _IteratorL, typename _IteratorR>
1852 inline bool
1853 operator==(const reverse_iterator<_IteratorL>& __x,
1854 const reverse_iterator<_IteratorR>& __y)
1855 { return __x.base() == __y.base(); }
1856 template<typename _IteratorL, typename _IteratorR>
1857 inline bool
1858 operator<(const reverse_iterator<_IteratorL>& __x,
1859 const reverse_iterator<_IteratorR>& __y)
1860 { return __y.base() < __x.base(); }
1861 template<typename _IteratorL, typename _IteratorR>
1862 inline bool
1863 operator!=(const reverse_iterator<_IteratorL>& __x,
1864 const reverse_iterator<_IteratorR>& __y)
1865 { return !(__x == __y); }
1866 template<typename _IteratorL, typename _IteratorR>
1867 inline bool
1868 operator>(const reverse_iterator<_IteratorL>& __x,
1869 const reverse_iterator<_IteratorR>& __y)
1870 { return __y < __x; }
1871 template<typename _IteratorL, typename _IteratorR>
1872 inline bool
1873 operator<=(const reverse_iterator<_IteratorL>& __x,
1874 const reverse_iterator<_IteratorR>& __y)
1875 { return !(__y < __x); }
1876 template<typename _IteratorL, typename _IteratorR>
1877 inline bool
1878 operator>=(const reverse_iterator<_IteratorL>& __x,
1879 const reverse_iterator<_IteratorR>& __y)
1880 { return !(__x < __y); }
1881 template<typename _IteratorL, typename _IteratorR>
1882 inline typename reverse_iterator<_IteratorL>::difference_type
1883 operator-(const reverse_iterator<_IteratorL>& __x,
1884 const reverse_iterator<_IteratorR>& __y)
1885 { return __y.base() - __x.base(); }
1886 template<typename _Container>
1887 class back_insert_iterator
1888 : public iterator<output_iterator_tag, void, void, void, void>
1889 {
1890 protected:
1891 _Container* container;
1892 public:
1893 typedef _Container container_type;
1894 explicit
1895 back_insert_iterator(_Container& __x) : container(&__x) { }
1896 back_insert_iterator&
1897 operator=(typename _Container::const_reference __value)
1898 {
1899 container->push_back(__value);
1900 return *this;
1901 }
1902 back_insert_iterator&
1903 operator*()
1904 { return *this; }
1905 back_insert_iterator&
1906 operator++()
1907 { return *this; }
1908 back_insert_iterator
1909 operator++(int)
1910 { return *this; }
1911 };
1912 template<typename _Container>
1913 inline back_insert_iterator<_Container>
1914 back_inserter(_Container& __x)
1915 { return back_insert_iterator<_Container>(__x); }
1916 template<typename _Container>
1917 class front_insert_iterator
1918 : public iterator<output_iterator_tag, void, void, void, void>
1919 {
1920 protected:
1921 _Container* container;
1922 public:
1923 typedef _Container container_type;
1924 explicit front_insert_iterator(_Container& __x) : container(&__x) { }
1925 front_insert_iterator&
1926 operator=(typename _Container::const_reference __value)
1927 {
1928 container->push_front(__value);
1929 return *this;
1930 }
1931 front_insert_iterator&
1932 operator*()
1933 { return *this; }
1934 front_insert_iterator&
1935 operator++()
1936 { return *this; }
1937 front_insert_iterator
1938 operator++(int)
1939 { return *this; }
1940 };
1941 template<typename _Container>
1942 inline front_insert_iterator<_Container>
1943 front_inserter(_Container& __x)
1944 { return front_insert_iterator<_Container>(__x); }
1945 template<typename _Container>
1946 class insert_iterator
1947 : public iterator<output_iterator_tag, void, void, void, void>
1948 {
1949 protected:
1950 _Container* container;
1951 typename _Container::iterator iter;
1952 public:
1953 typedef _Container container_type;
1954 insert_iterator(_Container& __x, typename _Container::iterator __i)
1955 : container(&__x), iter(__i) {}
1956 insert_iterator&
1957 operator=(typename _Container::const_reference __value)
1958 {
1959 iter = container->insert(iter, __value);
1960 ++iter;
1961 return *this;
1962 }
1963 insert_iterator&
1964 operator*()
1965 { return *this; }
1966 insert_iterator&
1967 operator++()
1968 { return *this; }
1969 insert_iterator&
1970 operator++(int)
1971 { return *this; }
1972 };
1973 template<typename _Container, typename _Iterator>
1974 inline insert_iterator<_Container>
1975 inserter(_Container& __x, _Iterator __i)
1976 {
1977 return insert_iterator<_Container>(__x,
1978 typename _Container::iterator(__i));
1979 }
1980 }
1981 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
1982 using std::iterator_traits;
1983 using std::iterator;
1984 template<typename _Iterator, typename _Container>
1985 class __normal_iterator
1986 {
1987 protected:
1988 _Iterator _M_current;
1989 public:
1990 typedef _Iterator iterator_type;
1991 typedef typename iterator_traits<_Iterator>::iterator_category
1992 iterator_category;
1993 typedef typename iterator_traits<_Iterator>::value_type value_type;
1994 typedef typename iterator_traits<_Iterator>::difference_type
1995 difference_type;
1996 typedef typename iterator_traits<_Iterator>::reference reference;
1997 typedef typename iterator_traits<_Iterator>::pointer pointer;
1998 __normal_iterator() : _M_current(_Iterator()) { }
1999 explicit
2000 __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
2001 template<typename _Iter>
2002 __normal_iterator(const __normal_iterator<_Iter,
2003 typename __enable_if<
2004 (std::__are_same<_Iter, typename _Container::pointer>::__value),
2005 _Container>::__type>& __i)
2006 : _M_current(__i.base()) { }
2007 reference
2008 operator*() const
2009 { return *_M_current; }
2010 pointer
2011 operator->() const
2012 { return _M_current; }
2013 __normal_iterator&
2014 operator++()
2015 {
2016 ++_M_current;
2017 return *this;
2018 }
2019 __normal_iterator
2020 operator++(int)
2021 { return __normal_iterator(_M_current++); }
2022 __normal_iterator&
2023 operator--()
2024 {
2025 --_M_current;
2026 return *this;
2027 }
2028 __normal_iterator
2029 operator--(int)
2030 { return __normal_iterator(_M_current--); }
2031 reference
2032 operator[](const difference_type& __n) const
2033 { return _M_current[__n]; }
2034 __normal_iterator&
2035 operator+=(const difference_type& __n)
2036 { _M_current += __n; return *this; }
2037 __normal_iterator
2038 operator+(const difference_type& __n) const
2039 { return __normal_iterator(_M_current + __n); }
2040 __normal_iterator&
2041 operator-=(const difference_type& __n)
2042 { _M_current -= __n; return *this; }
2043 __normal_iterator
2044 operator-(const difference_type& __n) const
2045 { return __normal_iterator(_M_current - __n); }
2046 const _Iterator&
2047 base() const
2048 { return _M_current; }
2049 };
2050 template<typename _IteratorL, typename _IteratorR, typename _Container>
2051 inline bool
2052 operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
2053 const __normal_iterator<_IteratorR, _Container>& __rhs)
2054 { return __lhs.base() == __rhs.base(); }
2055 template<typename _Iterator, typename _Container>
2056 inline bool
2057 operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
2058 const __normal_iterator<_Iterator, _Container>& __rhs)
2059 { return __lhs.base() == __rhs.base(); }
2060 template<typename _IteratorL, typename _IteratorR, typename _Container>
2061 inline bool
2062 operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
2063 const __normal_iterator<_IteratorR, _Container>& __rhs)
2064 { return __lhs.base() != __rhs.base(); }
2065 template<typename _Iterator, typename _Container>
2066 inline bool
2067 operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
2068 const __normal_iterator<_Iterator, _Container>& __rhs)
2069 { return __lhs.base() != __rhs.base(); }
2070 template<typename _IteratorL, typename _IteratorR, typename _Container>
2071 inline bool
2072 operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
2073 const __normal_iterator<_IteratorR, _Container>& __rhs)
2074 { return __lhs.base() < __rhs.base(); }
2075 template<typename _Iterator, typename _Container>
2076 inline bool
2077 operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
2078 const __normal_iterator<_Iterator, _Container>& __rhs)
2079 { return __lhs.base() < __rhs.base(); }
2080 template<typename _IteratorL, typename _IteratorR, typename _Container>
2081 inline bool
2082 operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
2083 const __normal_iterator<_IteratorR, _Container>& __rhs)
2084 { return __lhs.base() > __rhs.base(); }
2085 template<typename _Iterator, typename _Container>
2086 inline bool
2087 operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
2088 const __normal_iterator<_Iterator, _Container>& __rhs)
2089 { return __lhs.base() > __rhs.base(); }
2090 template<typename _IteratorL, typename _IteratorR, typename _Container>
2091 inline bool
2092 operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
2093 const __normal_iterator<_IteratorR, _Container>& __rhs)
2094 { return __lhs.base() <= __rhs.base(); }
2095 template<typename _Iterator, typename _Container>
2096 inline bool
2097 operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
2098 const __normal_iterator<_Iterator, _Container>& __rhs)
2099 { return __lhs.base() <= __rhs.base(); }
2100 template<typename _IteratorL, typename _IteratorR, typename _Container>
2101 inline bool
2102 operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
2103 const __normal_iterator<_IteratorR, _Container>& __rhs)
2104 { return __lhs.base() >= __rhs.base(); }
2105 template<typename _Iterator, typename _Container>
2106 inline bool
2107 operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
2108 const __normal_iterator<_Iterator, _Container>& __rhs)
2109 { return __lhs.base() >= __rhs.base(); }
2110 template<typename _IteratorL, typename _IteratorR, typename _Container>
2111 inline typename __normal_iterator<_IteratorL, _Container>::difference_type
2112 operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
2113 const __normal_iterator<_IteratorR, _Container>& __rhs)
2114 { return __lhs.base() - __rhs.base(); }
2115 template<typename _Iterator, typename _Container>
2116 inline typename __normal_iterator<_Iterator, _Container>::difference_type
2117 operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
2118 const __normal_iterator<_Iterator, _Container>& __rhs)
2119 { return __lhs.base() - __rhs.base(); }
2120 template<typename _Iterator, typename _Container>
2121 inline __normal_iterator<_Iterator, _Container>
2122 operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
2123 __n, const __normal_iterator<_Iterator, _Container>& __i)
2124 { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
2125 }
2126 namespace std __attribute__ ((__visibility__ ("default"))) {
2127 template<typename _Alloc>
2128 class allocator;
2129 template<class _CharT>
2130 struct char_traits;
2131 template<typename _CharT, typename _Traits = char_traits<_CharT>,
2132 typename _Alloc = allocator<_CharT> >
2133 class basic_string;
2134 template<> struct char_traits<char>;
2135 typedef basic_string<char> string;
2136 }
2137 extern "C"
2138 {
2139 typedef struct
2140 {
2141 int __fill[6];
2142 } mbstate_t;
2143 }
2144 namespace std __attribute__ ((__visibility__ ("default"))) {
2145 using ::mbstate_t;
2146 }
2147 typedef signed char int8_t;
2148 typedef short int int16_t;
2149 typedef int int32_t;
2150 __extension__
2151 typedef long long int int64_t;
2152 typedef unsigned char uint8_t;
2153 typedef unsigned short int uint16_t;
2154 typedef unsigned int uint32_t;
2155 __extension__
2156 typedef unsigned long long int uint64_t;
2157 typedef signed char int_least8_t;
2158 typedef short int int_least16_t;
2159 typedef int int_least32_t;
2160 __extension__
2161 typedef long long int int_least64_t;
2162 typedef unsigned char uint_least8_t;
2163 typedef unsigned short int uint_least16_t;
2164 typedef unsigned int uint_least32_t;
2165 __extension__
2166 typedef unsigned long long int uint_least64_t;
2167 typedef signed char int_fast8_t;
2168 typedef int int_fast16_t;
2169 typedef int int_fast32_t;
2170 __extension__
2171 typedef long long int int_fast64_t;
2172 typedef unsigned char uint_fast8_t;
2173 typedef unsigned int uint_fast16_t;
2174 typedef unsigned int uint_fast32_t;
2175 __extension__
2176 typedef unsigned long long int uint_fast64_t;
2177 typedef int intptr_t;
2178 typedef unsigned int uintptr_t;
2179 __extension__
2180 typedef long long int intmax_t;
2181 __extension__
2182 typedef unsigned long long int uintmax_t;
2183 namespace std __attribute__ ((__visibility__ ("default"))) {
2184 typedef int64_t streamoff;
2185 typedef ptrdiff_t streamsize;
2186 template<typename _StateT>
2187 class fpos
2188 {
2189 private:
2190 streamoff _M_off;
2191 _StateT _M_state;
2192 public:
2193 fpos()
2194 : _M_off(0), _M_state() { }
2195 fpos(streamoff __off)
2196 : _M_off(__off), _M_state() { }
2197 operator streamoff() const { return _M_off; }
2198 void
2199 state(_StateT __st)
2200 { _M_state = __st; }
2201 _StateT
2202 state() const
2203 { return _M_state; }
2204 fpos&
2205 operator+=(streamoff __off)
2206 {
2207 _M_off += __off;
2208 return *this;
2209 }
2210 fpos&
2211 operator-=(streamoff __off)
2212 {
2213 _M_off -= __off;
2214 return *this;
2215 }
2216 fpos
2217 operator+(streamoff __off) const
2218 {
2219 fpos __pos(*this);
2220 __pos += __off;
2221 return __pos;
2222 }
2223 fpos
2224 operator-(streamoff __off) const
2225 {
2226 fpos __pos(*this);
2227 __pos -= __off;
2228 return __pos;
2229 }
2230 streamoff
2231 operator-(const fpos& __other) const
2232 { return _M_off - __other._M_off; }
2233 };
2234 template<typename _StateT>
2235 inline bool
2236 operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
2237 { return streamoff(__lhs) == streamoff(__rhs); }
2238 template<typename _StateT>
2239 inline bool
2240 operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
2241 { return streamoff(__lhs) != streamoff(__rhs); }
2242 typedef fpos<mbstate_t> streampos;
2243 typedef fpos<mbstate_t> wstreampos;
2244 }
2245 namespace std __attribute__ ((__visibility__ ("default"))) {
2246 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2247 class basic_ios;
2248 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2249 class basic_streambuf;
2250 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2251 class basic_istream;
2252 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2253 class basic_ostream;
2254 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2255 class basic_iostream;
2256 template<typename _CharT, typename _Traits = char_traits<_CharT>,
2257 typename _Alloc = allocator<_CharT> >
2258 class basic_stringbuf;
2259 template<typename _CharT, typename _Traits = char_traits<_CharT>,
2260 typename _Alloc = allocator<_CharT> >
2261 class basic_istringstream;
2262 template<typename _CharT, typename _Traits = char_traits<_CharT>,
2263 typename _Alloc = allocator<_CharT> >
2264 class basic_ostringstream;
2265 template<typename _CharT, typename _Traits = char_traits<_CharT>,
2266 typename _Alloc = allocator<_CharT> >
2267 class basic_stringstream;
2268 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2269 class basic_filebuf;
2270 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2271 class basic_ifstream;
2272 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2273 class basic_ofstream;
2274 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2275 class basic_fstream;
2276 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2277 class istreambuf_iterator;
2278 template<typename _CharT, typename _Traits = char_traits<_CharT> >
2279 class ostreambuf_iterator;
2280 class ios_base;
2281 typedef basic_ios<char> ios;
2282 typedef basic_streambuf<char> streambuf;
2283 typedef basic_istream<char> istream;
2284 typedef basic_ostream<char> ostream;
2285 typedef basic_iostream<char> iostream;
2286 typedef basic_stringbuf<char> stringbuf;
2287 typedef basic_istringstream<char> istringstream;
2288 typedef basic_ostringstream<char> ostringstream;
2289 typedef basic_stringstream<char> stringstream;
2290 typedef basic_filebuf<char> filebuf;
2291 typedef basic_ifstream<char> ifstream;
2292 typedef basic_ofstream<char> ofstream;
2293 typedef basic_fstream<char> fstream;
2294 }
2295 extern "C++" {
2296 namespace std
2297 {
2298 class exception
2299 {
2300 public:
2301 exception() throw() { }
2302 virtual ~exception() throw();
2303 virtual const char* what() const throw();
2304 };
2305 class bad_exception : public exception
2306 {
2307 public:
2308 bad_exception() throw() { }
2309 virtual ~bad_exception() throw();
2310 virtual const char* what() const throw();
2311 };
2312 typedef void (*terminate_handler) ();
2313 typedef void (*unexpected_handler) ();
2314 terminate_handler set_terminate(terminate_handler) throw();
2315 void terminate() __attribute__ ((__noreturn__));
2316 unexpected_handler set_unexpected(unexpected_handler) throw();
2317 void unexpected() __attribute__ ((__noreturn__));
2318 bool uncaught_exception() throw();
2319 }
2320 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
2321 void __verbose_terminate_handler ();
2322 }
2323 }
2324 namespace std __attribute__ ((__visibility__ ("default"))) {
2325 void
2326 __throw_bad_exception(void) __attribute__((__noreturn__));
2327 void
2328 __throw_bad_alloc(void) __attribute__((__noreturn__));
2329 void
2330 __throw_bad_cast(void) __attribute__((__noreturn__));
2331 void
2332 __throw_bad_typeid(void) __attribute__((__noreturn__));
2333 void
2334 __throw_logic_error(const char*) __attribute__((__noreturn__));
2335 void
2336 __throw_domain_error(const char*) __attribute__((__noreturn__));
2337 void
2338 __throw_invalid_argument(const char*) __attribute__((__noreturn__));
2339 void
2340 __throw_length_error(const char*) __attribute__((__noreturn__));
2341 void
2342 __throw_out_of_range(const char*) __attribute__((__noreturn__));
2343 void
2344 __throw_runtime_error(const char*) __attribute__((__noreturn__));
2345 void
2346 __throw_range_error(const char*) __attribute__((__noreturn__));
2347 void
2348 __throw_overflow_error(const char*) __attribute__((__noreturn__));
2349 void
2350 __throw_underflow_error(const char*) __attribute__((__noreturn__));
2351 void
2352 __throw_ios_failure(const char*) __attribute__((__noreturn__));
2353 }
2354 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
2355 template<typename _Value>
2356 struct __numeric_traits_integer
2357 {
2358 static const _Value __min = (((_Value)(-1) < 0) ? (_Value)1 << (sizeof(_Value) * 8 - ((_Value)(-1) < 0)) : (_Value)0);
2359 static const _Value __max = (((_Value)(-1) < 0) ? (((((_Value)1 << ((sizeof(_Value) * 8 - ((_Value)(-1) < 0)) - 1)) - 1) << 1) + 1) : ~(_Value)0);
2360 static const bool __is_signed = ((_Value)(-1) < 0);
2361 static const int __digits = (sizeof(_Value) * 8 - ((_Value)(-1) < 0));
2362 };
2363 template<typename _Value>
2364 const _Value __numeric_traits_integer<_Value>::__min;
2365 template<typename _Value>
2366 const _Value __numeric_traits_integer<_Value>::__max;
2367 template<typename _Value>
2368 const bool __numeric_traits_integer<_Value>::__is_signed;
2369 template<typename _Value>
2370 const int __numeric_traits_integer<_Value>::__digits;
2371 template<typename _Value>
2372 struct __numeric_traits_floating
2373 {
2374 static const int __max_digits10 = (2 + (std::__are_same<_Value, float>::__value ? 24 : std::__are_same<_Value, double>::__value ? 53 : 53) * 3010 / 10000);
2375 static const bool __is_signed = true;
2376 static const int __digits10 = (std::__are_same<_Value, float>::__value ? 6 : std::__are_same<_Value, double>::__value ? 15 : 15);
2377 static const int __max_exponent10 = (std::__are_same<_Value, float>::__value ? 38 : std::__are_same<_Value, double>::__value ? 308 : 308);
2378 };
2379 template<typename _Value>
2380 const int __numeric_traits_floating<_Value>::__max_digits10;
2381 template<typename _Value>
2382 const bool __numeric_traits_floating<_Value>::__is_signed;
2383 template<typename _Value>
2384 const int __numeric_traits_floating<_Value>::__digits10;
2385 template<typename _Value>
2386 const int __numeric_traits_floating<_Value>::__max_exponent10;
2387 template<typename _Value>
2388 struct __numeric_traits
2389 : public __conditional_type<std::__is_integer<_Value>::__value,
2390 __numeric_traits_integer<_Value>,
2391 __numeric_traits_floating<_Value> >::__type
2392 { };
2393 }
2394 namespace std __attribute__ ((__visibility__ ("default"))) {
2395 template<class _T1, class _T2>
2396 struct pair
2397 {
2398 typedef _T1 first_type;
2399 typedef _T2 second_type;
2400 _T1 first;
2401 _T2 second;
2402 pair()
2403 : first(), second() { }
2404 pair(const _T1& __a, const _T2& __b)
2405 : first(__a), second(__b) { }
2406 template<class _U1, class _U2>
2407 pair(const pair<_U1, _U2>& __p)
2408 : first(__p.first),
2409 second(__p.second) { }
2410 };
2411 template<class _T1, class _T2>
2412 inline bool
2413 operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2414 { return __x.first == __y.first && __x.second == __y.second; }
2415 template<class _T1, class _T2>
2416 inline bool
2417 operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2418 { return __x.first < __y.first
2419 || (!(__y.first < __x.first) && __x.second < __y.second); }
2420 template<class _T1, class _T2>
2421 inline bool
2422 operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2423 { return !(__x == __y); }
2424 template<class _T1, class _T2>
2425 inline bool
2426 operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2427 { return __y < __x; }
2428 template<class _T1, class _T2>
2429 inline bool
2430 operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2431 { return !(__y < __x); }
2432 template<class _T1, class _T2>
2433 inline bool
2434 operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
2435 { return !(__x < __y); }
2436 template<class _T1, class _T2>
2437 inline pair<_T1, _T2>
2438 make_pair(_T1 __x, _T2 __y)
2439 { return pair<_T1, _T2>(__x, __y); }
2440 }
2441 namespace std
2442 {
2443 namespace __debug { }
2444 }
2445 namespace __gnu_debug
2446 {
2447 using namespace std::__debug;
2448 }
2449 namespace std __attribute__ ((__visibility__ ("default"))) {
2450 template<bool _BoolType>
2451 struct __iter_swap
2452 {
2453 template<typename _ForwardIterator1, typename _ForwardIterator2>
2454 static void
2455 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
2456 {
2457 typedef typename iterator_traits<_ForwardIterator1>::value_type
2458 _ValueType1;
2459 _ValueType1 __tmp = (*__a);
2460 *__a = (*__b);
2461 *__b = (__tmp);
2462 }
2463 };
2464 template<>
2465 struct __iter_swap<true>
2466 {
2467 template<typename _ForwardIterator1, typename _ForwardIterator2>
2468 static void
2469 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
2470 {
2471 swap(*__a, *__b);
2472 }
2473 };
2474 template<typename _ForwardIterator1, typename _ForwardIterator2>
2475 inline void
2476 iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
2477 {
2478 typedef typename iterator_traits<_ForwardIterator1>::value_type
2479 _ValueType1;
2480 typedef typename iterator_traits<_ForwardIterator2>::value_type
2481 _ValueType2;
2482 typedef typename iterator_traits<_ForwardIterator1>::reference
2483 _ReferenceType1;
2484 typedef typename iterator_traits<_ForwardIterator2>::reference
2485 _ReferenceType2;
2486 std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value
2487 && __are_same<_ValueType1&, _ReferenceType1>::__value
2488 && __are_same<_ValueType2&, _ReferenceType2>::__value>::
2489 iter_swap(__a, __b);
2490 }
2491 template<typename _ForwardIterator1, typename _ForwardIterator2>
2492 _ForwardIterator2
2493 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
2494 _ForwardIterator2 __first2)
2495 {
2496 ;
2497 for (; __first1 != __last1; ++__first1, ++__first2)
2498 std::iter_swap(__first1, __first2);
2499 return __first2;
2500 }
2501 template<typename _Tp>
2502 inline const _Tp&
2503 min(const _Tp& __a, const _Tp& __b)
2504 {
2505 if (__b < __a)
2506 return __b;
2507 return __a;
2508 }
2509 template<typename _Tp>
2510 inline const _Tp&
2511 max(const _Tp& __a, const _Tp& __b)
2512 {
2513 if (__a < __b)
2514 return __b;
2515 return __a;
2516 }
2517 template<typename _Tp, typename _Compare>
2518 inline const _Tp&
2519 min(const _Tp& __a, const _Tp& __b, _Compare __comp)
2520 {
2521 if (__comp(__b, __a))
2522 return __b;
2523 return __a;
2524 }
2525 template<typename _Tp, typename _Compare>
2526 inline const _Tp&
2527 max(const _Tp& __a, const _Tp& __b, _Compare __comp)
2528 {
2529 if (__comp(__a, __b))
2530 return __b;
2531 return __a;
2532 }
2533 template<typename _Iterator,
2534 bool _IsNormal = __is_normal_iterator<_Iterator>::__value>
2535 struct __niter_base
2536 {
2537 static _Iterator
2538 __b(_Iterator __it)
2539 { return __it; }
2540 };
2541 template<typename _Iterator>
2542 struct __niter_base<_Iterator, true>
2543 {
2544 static typename _Iterator::iterator_type
2545 __b(_Iterator __it)
2546 { return __it.base(); }
2547 };
2548 template<typename _Iterator,
2549 bool _IsMove = __is_move_iterator<_Iterator>::__value>
2550 struct __miter_base
2551 {
2552 static _Iterator
2553 __b(_Iterator __it)
2554 { return __it; }
2555 };
2556 template<typename _Iterator>
2557 struct __miter_base<_Iterator, true>
2558 {
2559 static typename _Iterator::iterator_type
2560 __b(_Iterator __it)
2561 { return __it.base(); }
2562 };
2563 template<bool, bool, typename>
2564 struct __copy_move
2565 {
2566 template<typename _II, typename _OI>
2567 static _OI
2568 __copy_m(_II __first, _II __last, _OI __result)
2569 {
2570 for (; __first != __last; ++__result, ++__first)
2571 *__result = *__first;
2572 return __result;
2573 }
2574 };
2575 template<>
2576 struct __copy_move<false, false, random_access_iterator_tag>
2577 {
2578 template<typename _II, typename _OI>
2579 static _OI
2580 __copy_m(_II __first, _II __last, _OI __result)
2581 {
2582 typedef typename iterator_traits<_II>::difference_type _Distance;
2583 for(_Distance __n = __last - __first; __n > 0; --__n)
2584 {
2585 *__result = *__first;
2586 ++__first;
2587 ++__result;
2588 }
2589 return __result;
2590 }
2591 };
2592 template<bool _IsMove>
2593 struct __copy_move<_IsMove, true, random_access_iterator_tag>
2594 {
2595 template<typename _Tp>
2596 static _Tp*
2597 __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
2598 {
2599 __builtin_memmove(__result, __first,
2600 sizeof(_Tp) * (__last - __first));
2601 return __result + (__last - __first);
2602 }
2603 };
2604 template<bool _IsMove, typename _II, typename _OI>
2605 inline _OI
2606 __copy_move_a(_II __first, _II __last, _OI __result)
2607 {
2608 typedef typename iterator_traits<_II>::value_type _ValueTypeI;
2609 typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
2610 typedef typename iterator_traits<_II>::iterator_category _Category;
2611 const bool __simple = (__is_pod(_ValueTypeI)
2612 && __is_pointer<_II>::__value
2613 && __is_pointer<_OI>::__value
2614 && __are_same<_ValueTypeI, _ValueTypeO>::__value);
2615 return std::__copy_move<_IsMove, __simple,
2616 _Category>::__copy_m(__first, __last, __result);
2617 }
2618 template<typename _CharT>
2619 struct char_traits;
2620 template<typename _CharT, typename _Traits>
2621 class istreambuf_iterator;
2622 template<typename _CharT, typename _Traits>
2623 class ostreambuf_iterator;
2624 template<bool _IsMove, typename _CharT>
2625 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
2626 ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
2627 __copy_move_a2(_CharT*, _CharT*,
2628 ostreambuf_iterator<_CharT, char_traits<_CharT> >);
2629 template<bool _IsMove, typename _CharT>
2630 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
2631 ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
2632 __copy_move_a2(const _CharT*, const _CharT*,
2633 ostreambuf_iterator<_CharT, char_traits<_CharT> >);
2634 template<bool _IsMove, typename _CharT>
2635 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
2636 _CharT*>::__type
2637 __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >,
2638 istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
2639 template<bool _IsMove, typename _II, typename _OI>
2640 inline _OI
2641 __copy_move_a2(_II __first, _II __last, _OI __result)
2642 {
2643 return _OI(std::__copy_move_a<_IsMove>
2644 (std::__niter_base<_II>::__b(__first),
2645 std::__niter_base<_II>::__b(__last),
2646 std::__niter_base<_OI>::__b(__result)));
2647 }
2648 template<typename _II, typename _OI>
2649 inline _OI
2650 copy(_II __first, _II __last, _OI __result)
2651 {
2652 ;
2653 return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
2654 (std::__miter_base<_II>::__b(__first),
2655 std::__miter_base<_II>::__b(__last), __result));
2656 }
2657 template<bool, bool, typename>
2658 struct __copy_move_backward
2659 {
2660 template<typename _BI1, typename _BI2>
2661 static _BI2
2662 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
2663 {
2664 while (__first != __last)
2665 *--__result = *--__last;
2666 return __result;
2667 }
2668 };
2669 template<>
2670 struct __copy_move_backward<false, false, random_access_iterator_tag>
2671 {
2672 template<typename _BI1, typename _BI2>
2673 static _BI2
2674 __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
2675 {
2676 typename iterator_traits<_BI1>::difference_type __n;
2677 for (__n = __last - __first; __n > 0; --__n)
2678 *--__result = *--__last;
2679 return __result;
2680 }
2681 };
2682 template<bool _IsMove>
2683 struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
2684 {
2685 template<typename _Tp>
2686 static _Tp*
2687 __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
2688 {
2689 const ptrdiff_t _Num = __last - __first;
2690 __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
2691 return __result - _Num;
2692 }
2693 };
2694 template<bool _IsMove, typename _BI1, typename _BI2>
2695 inline _BI2
2696 __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
2697 {
2698 typedef typename iterator_traits<_BI1>::value_type _ValueType1;
2699 typedef typename iterator_traits<_BI2>::value_type _ValueType2;
2700 typedef typename iterator_traits<_BI1>::iterator_category _Category;
2701 const bool __simple = (__is_pod(_ValueType1)
2702 && __is_pointer<_BI1>::__value
2703 && __is_pointer<_BI2>::__value
2704 && __are_same<_ValueType1, _ValueType2>::__value);
2705 return std::__copy_move_backward<_IsMove, __simple,
2706 _Category>::__copy_move_b(__first,
2707 __last,
2708 __result);
2709 }
2710 template<bool _IsMove, typename _BI1, typename _BI2>
2711 inline _BI2
2712 __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
2713 {
2714 return _BI2(std::__copy_move_backward_a<_IsMove>
2715 (std::__niter_base<_BI1>::__b(__first),
2716 std::__niter_base<_BI1>::__b(__last),
2717 std::__niter_base<_BI2>::__b(__result)));
2718 }
2719 template<typename _BI1, typename _BI2>
2720 inline _BI2
2721 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
2722 {
2723 ;
2724 return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value>
2725 (std::__miter_base<_BI1>::__b(__first),
2726 std::__miter_base<_BI1>::__b(__last), __result));
2727 }
2728 template<typename _ForwardIterator, typename _Tp>
2729 inline typename
2730 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
2731 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
2732 const _Tp& __value)
2733 {
2734 for (; __first != __last; ++__first)
2735 *__first = __value;
2736 }
2737 template<typename _ForwardIterator, typename _Tp>
2738 inline typename
2739 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
2740 __fill_a(_ForwardIterator __first, _ForwardIterator __last,
2741 const _Tp& __value)
2742 {
2743 const _Tp __tmp = __value;
2744 for (; __first != __last; ++__first)
2745 *__first = __tmp;
2746 }
2747 template<typename _Tp>
2748 inline typename
2749 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type
2750 __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c)
2751 {
2752 const _Tp __tmp = __c;
2753 __builtin_memset(__first, static_cast<unsigned char>(__tmp),
2754 __last - __first);
2755 }
2756 template<typename _ForwardIterator, typename _Tp>
2757 inline void
2758 fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
2759 {
2760 ;
2761 std::__fill_a(std::__niter_base<_ForwardIterator>::__b(__first),
2762 std::__niter_base<_ForwardIterator>::__b(__last), __value);
2763 }
2764 template<typename _OutputIterator, typename _Size, typename _Tp>
2765 inline typename
2766 __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
2767 __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
2768 {
2769 for (; __n > 0; --__n, ++__first)
2770 *__first = __value;
2771 return __first;
2772 }
2773 template<typename _OutputIterator, typename _Size, typename _Tp>
2774 inline typename
2775 __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
2776 __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
2777 {
2778 const _Tp __tmp = __value;
2779 for (; __n > 0; --__n, ++__first)
2780 *__first = __tmp;
2781 return __first;
2782 }
2783 template<typename _Size, typename _Tp>
2784 inline typename
2785 __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
2786 __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c)
2787 {
2788 std::__fill_a(__first, __first + __n, __c);
2789 return __first + __n;
2790 }
2791 template<typename _OI, typename _Size, typename _Tp>
2792 inline _OI
2793 fill_n(_OI __first, _Size __n, const _Tp& __value)
2794 {
2795 return _OI(std::__fill_n_a(std::__niter_base<_OI>::__b(__first),
2796 __n, __value));
2797 }
2798 template<bool _BoolType>
2799 struct __equal
2800 {
2801 template<typename _II1, typename _II2>
2802 static bool
2803 equal(_II1 __first1, _II1 __last1, _II2 __first2)
2804 {
2805 for (; __first1 != __last1; ++__first1, ++__first2)
2806 if (!(*__first1 == *__first2))
2807 return false;
2808 return true;
2809 }
2810 };
2811 template<>
2812 struct __equal<true>
2813 {
2814 template<typename _Tp>
2815 static bool
2816 equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
2817 {
2818 return !__builtin_memcmp(__first1, __first2, sizeof(_Tp)
2819 * (__last1 - __first1));
2820 }
2821 };
2822 template<typename _II1, typename _II2>
2823 inline bool
2824 __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
2825 {
2826 typedef typename iterator_traits<_II1>::value_type _ValueType1;
2827 typedef typename iterator_traits<_II2>::value_type _ValueType2;
2828 const bool __simple = (__is_integer<_ValueType1>::__value
2829 && __is_pointer<_II1>::__value
2830 && __is_pointer<_II2>::__value
2831 && __are_same<_ValueType1, _ValueType2>::__value);
2832 return std::__equal<__simple>::equal(__first1, __last1, __first2);
2833 }
2834 template<typename, typename>
2835 struct __lc_rai
2836 {
2837 template<typename _II1, typename _II2>
2838 static _II1
2839 __newlast1(_II1, _II1 __last1, _II2, _II2)
2840 { return __last1; }
2841 template<typename _II>
2842 static bool
2843 __cnd2(_II __first, _II __last)
2844 { return __first != __last; }
2845 };
2846 template<>
2847 struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
2848 {
2849 template<typename _RAI1, typename _RAI2>
2850 static _RAI1
2851 __newlast1(_RAI1 __first1, _RAI1 __last1,
2852 _RAI2 __first2, _RAI2 __last2)
2853 {
2854 const typename iterator_traits<_RAI1>::difference_type
2855 __diff1 = __last1 - __first1;
2856 const typename iterator_traits<_RAI2>::difference_type
2857 __diff2 = __last2 - __first2;
2858 return __diff2 < __diff1 ? __first1 + __diff2 : __last1;
2859 }
2860 template<typename _RAI>
2861 static bool
2862 __cnd2(_RAI, _RAI)
2863 { return true; }
2864 };
2865 template<bool _BoolType>
2866 struct __lexicographical_compare
2867 {
2868 template<typename _II1, typename _II2>
2869 static bool __lc(_II1, _II1, _II2, _II2);
2870 };
2871 template<bool _BoolType>
2872 template<typename _II1, typename _II2>
2873 bool
2874 __lexicographical_compare<_BoolType>::
2875 __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
2876 {
2877 typedef typename iterator_traits<_II1>::iterator_category _Category1;
2878 typedef typename iterator_traits<_II2>::iterator_category _Category2;
2879 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
2880 __last1 = __rai_type::__newlast1(__first1, __last1,
2881 __first2, __last2);
2882 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
2883 ++__first1, ++__first2)
2884 {
2885 if (*__first1 < *__first2)
2886 return true;
2887 if (*__first2 < *__first1)
2888 return false;
2889 }
2890 return __first1 == __last1 && __first2 != __last2;
2891 }
2892 template<>
2893 struct __lexicographical_compare<true>
2894 {
2895 template<typename _Tp, typename _Up>
2896 static bool
2897 __lc(const _Tp* __first1, const _Tp* __last1,
2898 const _Up* __first2, const _Up* __last2)
2899 {
2900 const size_t __len1 = __last1 - __first1;
2901 const size_t __len2 = __last2 - __first2;
2902 const int __result = __builtin_memcmp(__first1, __first2,
2903 std::min(__len1, __len2));
2904 return __result != 0 ? __result < 0 : __len1 < __len2;
2905 }
2906 };
2907 template<typename _II1, typename _II2>
2908 inline bool
2909 __lexicographical_compare_aux(_II1 __first1, _II1 __last1,
2910 _II2 __first2, _II2 __last2)
2911 {
2912 typedef typename iterator_traits<_II1>::value_type _ValueType1;
2913 typedef typename iterator_traits<_II2>::value_type _ValueType2;
2914 const bool __simple =
2915 (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value
2916 && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed
2917 && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed
2918 && __is_pointer<_II1>::__value
2919 && __is_pointer<_II2>::__value);
2920 return std::__lexicographical_compare<__simple>::__lc(__first1, __last1,
2921 __first2, __last2);
2922 }
2923 }
2924 namespace std __attribute__ ((__visibility__ ("default"))) {
2925 template<typename _II1, typename _II2>
2926 inline bool
2927 equal(_II1 __first1, _II1 __last1, _II2 __first2)
2928 {
2929 ;
2930 return std::__equal_aux(std::__niter_base<_II1>::__b(__first1),
2931 std::__niter_base<_II1>::__b(__last1),
2932 std::__niter_base<_II2>::__b(__first2));
2933 }
2934 template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
2935 inline bool
2936 equal(_IIter1 __first1, _IIter1 __last1,
2937 _IIter2 __first2, _BinaryPredicate __binary_pred)
2938 {
2939 ;
2940 for (; __first1 != __last1; ++__first1, ++__first2)
2941 if (!bool(__binary_pred(*__first1, *__first2)))
2942 return false;
2943 return true;
2944 }
2945 template<typename _II1, typename _II2>
2946 inline bool
2947 lexicographical_compare(_II1 __first1, _II1 __last1,
2948 _II2 __first2, _II2 __last2)
2949 {
2950 typedef typename iterator_traits<_II1>::value_type _ValueType1;
2951 typedef typename iterator_traits<_II2>::value_type _ValueType2;
2952 ;
2953 ;
2954 return std::__lexicographical_compare_aux
2955 (std::__niter_base<_II1>::__b(__first1),
2956 std::__niter_base<_II1>::__b(__last1),
2957 std::__niter_base<_II2>::__b(__first2),
2958 std::__niter_base<_II2>::__b(__last2));
2959 }
2960 template<typename _II1, typename _II2, typename _Compare>
2961 bool
2962 lexicographical_compare(_II1 __first1, _II1 __last1,
2963 _II2 __first2, _II2 __last2, _Compare __comp)
2964 {
2965 typedef typename iterator_traits<_II1>::iterator_category _Category1;
2966 typedef typename iterator_traits<_II2>::iterator_category _Category2;
2967 typedef std::__lc_rai<_Category1, _Category2> __rai_type;
2968 ;
2969 ;
2970 __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
2971 for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
2972 ++__first1, ++__first2)
2973 {
2974 if (__comp(*__first1, *__first2))
2975 return true;
2976 if (__comp(*__first2, *__first1))
2977 return false;
2978 }
2979 return __first1 == __last1 && __first2 != __last2;
2980 }
2981 template<typename _InputIterator1, typename _InputIterator2>
2982 pair<_InputIterator1, _InputIterator2>
2983 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
2984 _InputIterator2 __first2)
2985 {
2986 ;
2987 while (__first1 != __last1 && *__first1 == *__first2)
2988 {
2989 ++__first1;
2990 ++__first2;
2991 }
2992 return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
2993 }
2994 template<typename _InputIterator1, typename _InputIterator2,
2995 typename _BinaryPredicate>
2996 pair<_InputIterator1, _InputIterator2>
2997 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
2998 _InputIterator2 __first2, _BinaryPredicate __binary_pred)
2999 {
3000 ;
3001 while (__first1 != __last1 && bool(__binary_pred(*__first1, *__first2)))
3002 {
3003 ++__first1;
3004 ++__first2;
3005 }
3006 return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
3007 }
3008 }
3009 extern "C" {
3010 typedef unsigned short __kernel_dev_t;
3011 typedef unsigned long __kernel_ino_t;
3012 typedef unsigned short __kernel_mode_t;
3013 typedef unsigned short __kernel_nlink_t;
3014 typedef long __kernel_off_t;
3015 typedef int __kernel_pid_t;
3016 typedef unsigned int __kernel_ipc_pid_t;
3017 typedef unsigned int __kernel_uid_t;
3018 typedef unsigned int __kernel_gid_t;
3019 typedef unsigned int __kernel_size_t;
3020 typedef int __kernel_ssize_t;
3021 typedef int __kernel_ptrdiff_t;
3022 typedef long __kernel_time_t;
3023 typedef long __kernel_suseconds_t;
3024 typedef long __kernel_clock_t;
3025 typedef int __kernel_daddr_t;
3026 typedef char * __kernel_caddr_t;
3027 typedef unsigned short __kernel_uid16_t;
3028 typedef unsigned short __kernel_gid16_t;
3029 typedef unsigned int __kernel_uid32_t;
3030 typedef unsigned int __kernel_gid32_t;
3031 typedef unsigned short __kernel_old_uid_t;
3032 typedef unsigned short __kernel_old_gid_t;
3033 typedef long long __kernel_loff_t;
3034 typedef __kernel_dev_t __kernel_old_dev_t;
3035 typedef struct {
3036 int __val[2];
3037 } __kernel_fsid_t;
3038 typedef unsigned char __u_char;
3039 typedef unsigned short int __u_short;
3040 typedef unsigned int __u_int;
3041 typedef unsigned long int __u_long;
3042 typedef signed char __int8_t;
3043 typedef unsigned char __uint8_t;
3044 typedef signed short int __int16_t;
3045 typedef unsigned short int __uint16_t;
3046 typedef signed int __int32_t;
3047 typedef unsigned int __uint32_t;
3048 __extension__ typedef signed long long int __int64_t;
3049 __extension__ typedef unsigned long long int __uint64_t;
3050 __extension__ typedef long long int __quad_t;
3051 __extension__ typedef unsigned long long int __u_quad_t;
3052 __extension__ typedef __u_quad_t __dev_t;
3053 __extension__ typedef unsigned int __uid_t;
3054 __extension__ typedef unsigned int __gid_t;
3055 __extension__ typedef unsigned long int __ino_t;
3056 __extension__ typedef __u_quad_t __ino64_t;
3057 __extension__ typedef unsigned int __mode_t;
3058 __extension__ typedef unsigned int __nlink_t;
3059 __extension__ typedef long int __off_t;
3060 __extension__ typedef __quad_t __off64_t;
3061 __extension__ typedef int __pid_t;
3062 __extension__ typedef struct { int __val[2]; } __fsid_t;
3063 __extension__ typedef long int __clock_t;
3064 __extension__ typedef unsigned long int __rlim_t;
3065 __extension__ typedef __u_quad_t __rlim64_t;
3066 __extension__ typedef unsigned int __id_t;
3067 __extension__ typedef long int __time_t;
3068 __extension__ typedef unsigned int __useconds_t;
3069 __extension__ typedef long int __suseconds_t;
3070 __extension__ typedef int __daddr_t;
3071 __extension__ typedef long int __swblk_t;
3072 __extension__ typedef int __key_t;
3073 __extension__ typedef int __clockid_t;
3074 __extension__ typedef void * __timer_t;
3075 __extension__ typedef long int __blksize_t;
3076 __extension__ typedef long int __blkcnt_t;
3077 __extension__ typedef __quad_t __blkcnt64_t;
3078 __extension__ typedef unsigned long int __fsblkcnt_t;
3079 __extension__ typedef __u_quad_t __fsblkcnt64_t;
3080 __extension__ typedef unsigned long int __fsfilcnt_t;
3081 __extension__ typedef __u_quad_t __fsfilcnt64_t;
3082 __extension__ typedef long int __ssize_t;
3083 typedef __off64_t __loff_t;
3084 typedef __quad_t *__qaddr_t;
3085 typedef char *__caddr_t;
3086 __extension__ typedef int __intptr_t;
3087 __extension__ typedef unsigned int __socklen_t;
3088 typedef __kernel_ipc_pid_t __ipc_pid_t;
3089 struct __sched_param
3090 {
3091 int __sched_priority;
3092 };
3093 struct _pthread_fastlock
3094 {
3095 long int __status;
3096 int __spinlock;
3097 };
3098 typedef struct _pthread_descr_struct *_pthread_descr;
3099 typedef struct __pthread_attr_s
3100 {
3101 int __detachstate;
3102 int __schedpolicy;
3103 struct __sched_param __schedparam;
3104 int __inheritsched;
3105 int __scope;
3106 size_t __guardsize;
3107 int __stackaddr_set;
3108 void *__stackaddr;
3109 size_t __stacksize;
3110 } pthread_attr_t;
3111 typedef struct
3112 {
3113 struct _pthread_fastlock __c_lock;
3114 _pthread_descr __c_waiting;
3115 } pthread_cond_t;
3116 typedef struct
3117 {
3118 int __dummy;
3119 } pthread_condattr_t;
3120 typedef unsigned int pthread_key_t;
3121 typedef struct
3122 {
3123 int __m_reserved;
3124 int __m_count;
3125 _pthread_descr __m_owner;
3126 int __m_kind;
3127 struct _pthread_fastlock __m_lock;
3128 } pthread_mutex_t;
3129 typedef struct
3130 {
3131 int __mutexkind;
3132 } pthread_mutexattr_t;
3133 typedef int pthread_once_t;
3134 typedef struct _pthread_rwlock_t
3135 {
3136 struct _pthread_fastlock __rw_lock;
3137 int __rw_readers;
3138 _pthread_descr __rw_writer;
3139 _pthread_descr __rw_read_waiting;
3140 _pthread_descr __rw_write_waiting;
3141 int __rw_kind;
3142 int __rw_pshared;
3143 } pthread_rwlock_t;
3144 typedef struct
3145 {
3146 int __lockkind;
3147 int __pshared;
3148 } pthread_rwlockattr_t;
3149 typedef volatile int pthread_spinlock_t;
3150 typedef struct {
3151 struct _pthread_fastlock __ba_lock;
3152 int __ba_required;
3153 int __ba_present;
3154 _pthread_descr __ba_waiting;
3155 } pthread_barrier_t;
3156 typedef struct {
3157 int __pshared;
3158 } pthread_barrierattr_t;
3159 typedef unsigned long int pthread_t;
3160 typedef struct __STDIO_FILE_STRUCT FILE;
3161 typedef struct __STDIO_FILE_STRUCT __FILE;
3162 struct timespec
3163 {
3164 __time_t tv_sec;
3165 long int tv_nsec;
3166 };
3167 struct sched_param
3168 {
3169 int __sched_priority;
3170 };
3171 extern "C" {
3172 extern int clone (int (*__fn) (void *__arg), void *__child_stack,
3173 int __flags, void *__arg, ...) throw ();
3174 }
3175 typedef unsigned long int __cpu_mask;
3176 typedef struct
3177 {
3178 __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
3179 } cpu_set_t;
3180 extern "C" {
3181 extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
3182 throw ();
3183 extern int sched_getparam (__pid_t __pid, struct sched_param *__param) throw ();
3184 extern int sched_setscheduler (__pid_t __pid, int __policy,
3185 __const struct sched_param *__param) throw ();
3186 extern int sched_getscheduler (__pid_t __pid) throw ();
3187 extern int sched_yield (void) throw ();
3188 extern int sched_get_priority_max (int __algorithm) throw ();
3189 extern int sched_get_priority_min (int __algorithm) throw ();
3190 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) throw ();
3191 extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
3192 __const cpu_set_t *__cpuset) throw ();
3193 extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
3194 cpu_set_t *__cpuset) throw ();
3195 }
3196 extern "C" {
3197 typedef __clock_t clock_t;
3198 typedef __time_t time_t;
3199 typedef __clockid_t clockid_t;
3200 typedef __timer_t timer_t;
3201 struct tm
3202 {
3203 int tm_sec;
3204 int tm_min;
3205 int tm_hour;
3206 int tm_mday;
3207 int tm_mon;
3208 int tm_year;
3209 int tm_wday;
3210 int tm_yday;
3211 int tm_isdst;
3212 long int tm_gmtoff;
3213 __const char *tm_zone;
3214 };
3215 struct itimerspec
3216 {
3217 struct timespec it_interval;
3218 struct timespec it_value;
3219 };
3220 struct sigevent;
3221 typedef __pid_t pid_t;
3222 extern clock_t clock (void) throw ();
3223 extern time_t time (time_t *__timer) throw ();
3224 extern double difftime (time_t __time1, time_t __time0)
3225 throw () __attribute__ ((__const__));
3226 extern time_t mktime (struct tm *__tp) throw ();
3227 extern size_t strftime (char *__restrict __s, size_t __maxsize,
3228 __const char *__restrict __format,
3229 __const struct tm *__restrict __tp) throw ();
3230 extern char *strptime (__const char *__restrict __s,
3231 __const char *__restrict __fmt, struct tm *__tp)
3232 throw ();
3233 extern struct tm *gmtime (__const time_t *__timer) throw ();
3234 extern struct tm *localtime (__const time_t *__timer) throw ();
3235 extern struct tm *gmtime_r (__const time_t *__restrict __timer,
3236 struct tm *__restrict __tp) throw ();
3237 extern struct tm *localtime_r (__const time_t *__restrict __timer,
3238 struct tm *__restrict __tp) throw ();
3239 extern char *asctime (__const struct tm *__tp) throw ();
3240 extern char *ctime (__const time_t *__timer) throw ();
3241 extern char *asctime_r (__const struct tm *__restrict __tp,
3242 char *__restrict __buf) throw ();
3243 extern char *ctime_r (__const time_t *__restrict __timer,
3244 char *__restrict __buf) throw ();
3245 extern char *tzname[2];
3246 extern void tzset (void) throw ();
3247 extern int daylight;
3248 extern long int timezone;
3249 extern int stime (__const time_t *__when) throw ();
3250 extern time_t timegm (struct tm *__tp) throw ();
3251 extern time_t timelocal (struct tm *__tp) throw ();
3252 extern int dysize (int __year) throw () __attribute__ ((__const__));
3253 extern int nanosleep (__const struct timespec *__requested_time,
3254 struct timespec *__remaining);
3255 extern int clock_getres (clockid_t __clock_id, struct timespec *__res) throw ();
3256 extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) throw ();
3257 extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
3258 throw ();
3259 extern int timer_create (clockid_t __clock_id,
3260 struct sigevent *__restrict __evp,
3261 timer_t *__restrict __timerid) throw ();
3262 extern int timer_delete (timer_t __timerid) throw ();
3263 extern int timer_settime (timer_t __timerid, int __flags,
3264 __const struct itimerspec *__restrict __value,
3265 struct itimerspec *__restrict __ovalue) throw ();
3266 extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
3267 throw ();
3268 extern int timer_getoverrun (timer_t __timerid) throw ();
3269 }
3270 extern "C" {
3271 typedef int __sig_atomic_t;
3272 typedef struct
3273 {
3274 unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
3275 } __sigset_t;
3276 typedef __sigset_t sigset_t;
3277 }
3278 extern "C" {
3279 enum
3280 {
3281 PTHREAD_CREATE_JOINABLE,
3282 PTHREAD_CREATE_DETACHED
3283 };
3284 enum
3285 {
3286 PTHREAD_INHERIT_SCHED,
3287 PTHREAD_EXPLICIT_SCHED
3288 };
3289 enum
3290 {
3291 PTHREAD_SCOPE_SYSTEM,
3292 PTHREAD_SCOPE_PROCESS
3293 };
3294 enum
3295 {
3296 PTHREAD_MUTEX_ADAPTIVE_NP,
3297 PTHREAD_MUTEX_RECURSIVE_NP,
3298 PTHREAD_MUTEX_ERRORCHECK_NP,
3299 PTHREAD_MUTEX_TIMED_NP
3300 ,
3301 PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_ADAPTIVE_NP,
3302 PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
3303 PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
3304 PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
3305 , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_ADAPTIVE_NP
3306 };
3307 enum
3308 {
3309 PTHREAD_PROCESS_PRIVATE,
3310 PTHREAD_PROCESS_SHARED
3311 };
3312 enum
3313 {
3314 PTHREAD_RWLOCK_PREFER_READER_NP,
3315 PTHREAD_RWLOCK_PREFER_WRITER_NP,
3316 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
3317 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_WRITER_NP
3318 };
3319 struct _pthread_cleanup_buffer
3320 {
3321 void (*__routine) (void *);
3322 void *__arg;
3323 int __canceltype;
3324 struct _pthread_cleanup_buffer *__prev;
3325 };
3326 enum
3327 {
3328 PTHREAD_CANCEL_ENABLE,
3329 PTHREAD_CANCEL_DISABLE
3330 };
3331 enum
3332 {
3333 PTHREAD_CANCEL_DEFERRED,
3334 PTHREAD_CANCEL_ASYNCHRONOUS
3335 };
3336 extern int pthread_create (pthread_t *__restrict __threadp,
3337 __const pthread_attr_t *__restrict __attr,
3338 void *(*__start_routine) (void *),
3339 void *__restrict __arg) throw ();
3340 extern pthread_t pthread_self (void) throw ();
3341 extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) throw ();
3342 extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
3343 extern int pthread_join (pthread_t __th, void **__thread_return);
3344 extern int pthread_detach (pthread_t __th) throw ();
3345 extern int pthread_attr_init (pthread_attr_t *__attr) throw ();
3346 extern int pthread_attr_destroy (pthread_attr_t *__attr) throw ();
3347 extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
3348 int __detachstate) throw ();
3349 extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
3350 int *__detachstate) throw ();
3351 extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
3352 __const struct sched_param *__restrict
3353 __param) throw ();
3354 extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
3355 __attr,
3356 struct sched_param *__restrict __param)
3357 throw ();
3358 extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
3359 throw ();
3360 extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
3361 __attr, int *__restrict __policy)
3362 throw ();
3363 extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
3364 int __inherit) throw ();
3365 extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
3366 __attr, int *__restrict __inherit)
3367 throw ();
3368 extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
3369 throw ();
3370 extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
3371 int *__restrict __scope) throw ();
3372 extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
3373 size_t __guardsize) throw ();
3374 extern int pthread_attr_getguardsize (__const pthread_attr_t *__restrict
3375 __attr, size_t *__restrict __guardsize)
3376 throw ();
3377 extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
3378 void *__stackaddr) throw ();
3379 extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
3380 __attr, void **__restrict __stackaddr)
3381 throw ();
3382 extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
3383 size_t __stacksize) throw ();
3384 extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
3385 void **__restrict __stackaddr,
3386 size_t *__restrict __stacksize) throw ();
3387 extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
3388 size_t __stacksize) throw ();
3389 extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
3390 __attr, size_t *__restrict __stacksize)
3391 throw ();
3392 extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
3393 __const struct sched_param *__param)
3394 throw ();
3395 extern int pthread_getschedparam (pthread_t __target_thread,
3396 int *__restrict __policy,
3397 struct sched_param *__restrict __param)
3398 throw ();
3399 extern int pthread_getconcurrency (void) throw ();
3400 extern int pthread_setconcurrency (int __level) throw ();
3401 extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex,
3402 __const pthread_mutexattr_t *__restrict
3403 __mutex_attr) throw ();
3404 extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) throw ();
3405 extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) throw ();
3406 extern int pthread_mutex_lock (pthread_mutex_t *__mutex) throw ();
3407 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
3408 __const struct timespec *__restrict
3409 __abstime) throw ();
3410 extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) throw ();
3411 extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) throw ();
3412 extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) throw ();
3413 extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
3414 __restrict __attr,
3415 int *__restrict __pshared) throw ();
3416 extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
3417 int __pshared) throw ();
3418 extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
3419 throw ();
3420 extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
3421 __attr, int *__restrict __kind) throw ();
3422 extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
3423 __const pthread_condattr_t *__restrict
3424 __cond_attr) throw ();
3425 extern int pthread_cond_destroy (pthread_cond_t *__cond) throw ();
3426 extern int pthread_cond_signal (pthread_cond_t *__cond) throw ();
3427 extern int pthread_cond_broadcast (pthread_cond_t *__cond) throw ();
3428 extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
3429 pthread_mutex_t *__restrict __mutex);
3430 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
3431 pthread_mutex_t *__restrict __mutex,
3432 __const struct timespec *__restrict
3433 __abstime);
3434 extern int pthread_condattr_init (pthread_condattr_t *__attr) throw ();
3435 extern int pthread_condattr_destroy (pthread_condattr_t *__attr) throw ();
3436 extern int pthread_condattr_getpshared (__const pthread_condattr_t *
3437 __restrict __attr,
3438 int *__restrict __pshared) throw ();
3439 extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
3440 int __pshared) throw ();
3441 extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
3442 __const pthread_rwlockattr_t *__restrict
3443 __attr) throw ();
3444 extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) throw ();
3445 extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) throw ();
3446 extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) throw ();
3447 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
3448 __const struct timespec *__restrict
3449 __abstime) throw ();
3450 extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) throw ();
3451 extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) throw ();
3452 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
3453 __const struct timespec *__restrict
3454 __abstime) throw ();
3455 extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) throw ();
3456 extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) throw ();
3457 extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) throw ();
3458 extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
3459 __restrict __attr,
3460 int *__restrict __pshared) throw ();
3461 extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
3462 int __pshared) throw ();
3463 extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *__attr,
3464 int *__pref) throw ();
3465 extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
3466 int __pref) throw ();
3467 extern int pthread_key_create (pthread_key_t *__key,
3468 void (*__destr_function) (void *)) throw ();
3469 extern int pthread_key_delete (pthread_key_t __key) throw ();
3470 extern int pthread_setspecific (pthread_key_t __key,
3471 __const void *__pointer) throw ();
3472 extern void *pthread_getspecific (pthread_key_t __key) throw ();
3473 extern int pthread_once (pthread_once_t *__once_control,
3474 void (*__init_routine) (void));
3475 extern int pthread_setcancelstate (int __state, int *__oldstate);
3476 extern int pthread_setcanceltype (int __type, int *__oldtype);
3477 extern int pthread_cancel (pthread_t __cancelthread);
3478 extern void pthread_testcancel (void);
3479 extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
3480 void (*__routine) (void *),
3481 void *__arg) throw ();
3482 extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
3483 int __execute) throw ();
3484 extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
3485 void (*__routine) (void *),
3486 void *__arg) throw ();
3487 extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
3488 void (*__routine) (void *),
3489 void *__arg) throw ();
3490 extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
3491 int __execute) throw ();
3492 extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
3493 int __execute) throw ();
3494 extern int pthread_sigmask (int __how,
3495 __const __sigset_t *__restrict __newmask,
3496 __sigset_t *__restrict __oldmask)throw ();
3497 extern int pthread_kill (pthread_t __threadid, int __signo) throw ();
3498 extern int pthread_atfork (void (*__prepare) (void),
3499 void (*__parent) (void),
3500 void (*__child) (void)) throw ();
3501 extern void pthread_kill_other_threads_np (void) throw ();
3502 }
3503 typedef struct {
3504 __off_t __pos;
3505 } __STDIO_fpos_t;
3506 typedef struct {
3507 __off64_t __pos;
3508 } __STDIO_fpos64_t;
3509 typedef __off64_t __offmax_t;
3510 struct __STDIO_FILE_STRUCT {
3511 unsigned short __modeflags;
3512 unsigned char __ungot[2];
3513 int __filedes;
3514 unsigned char *__bufstart;
3515 unsigned char *__bufend;
3516 unsigned char *__bufpos;
3517 unsigned char *__bufread;
3518 unsigned char *__bufgetc_u;
3519 unsigned char *__bufputc_u;
3520 struct __STDIO_FILE_STRUCT *__nextopen;
3521 int __user_locking;
3522 pthread_mutex_t __lock;
3523 };
3524 extern int __fgetc_unlocked(FILE *__stream);
3525 extern int __fputc_unlocked(int __c, FILE *__stream);
3526 extern FILE *__stdin;
3527 extern FILE *__stdout;
3528 typedef __builtin_va_list __gnuc_va_list;
3529 typedef __STDIO_fpos_t fpos_t;
3530 typedef __STDIO_fpos64_t fpos64_t;
3531 extern FILE *stdin;
3532 extern FILE *stdout;
3533 extern FILE *stderr;
3534 extern int remove (__const char *__filename) throw ();
3535 extern int rename (__const char *__old, __const char *__new) throw ();
3536 extern FILE *tmpfile (void) ;
3537 extern FILE *tmpfile64 (void) ;
3538 extern char *tmpnam (char *__s) throw () ;
3539 extern char *tmpnam_r (char *__s) throw () ;
3540 extern char *tempnam (__const char *__dir, __const char *__pfx)
3541 throw () __attribute__ ((__malloc__)) ;
3542 extern int fclose (FILE *__stream);
3543 extern int fflush (FILE *__stream);
3544 extern int fflush_unlocked (FILE *__stream);
3545 extern int fcloseall (void);
3546 extern FILE *fopen (__const char *__restrict __filename,
3547 __const char *__restrict __modes) ;
3548 extern FILE *freopen (__const char *__restrict __filename,
3549 __const char *__restrict __modes,
3550 FILE *__restrict __stream) ;
3551 extern FILE *fopen64 (__const char *__restrict __filename,
3552 __const char *__restrict __modes) ;
3553 extern FILE *freopen64 (__const char *__restrict __filename,
3554 __const char *__restrict __modes,
3555 FILE *__restrict __stream) ;
3556 extern FILE *fdopen (int __fd, __const char *__modes) throw () ;
3557 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) throw ();
3558 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
3559 int __modes, size_t __n) throw ();
3560 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
3561 size_t __size) throw ();
3562 extern void setlinebuf (FILE *__stream) throw ();
3563 extern int fprintf (FILE *__restrict __stream,
3564 __const char *__restrict __format, ...);
3565 extern int printf (__const char *__restrict __format, ...);
3566 extern int sprintf (char *__restrict __s,
3567 __const char *__restrict __format, ...) throw ();
3568 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
3569 __gnuc_va_list __arg);
3570 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
3571 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
3572 __gnuc_va_list __arg) throw ();
3573 extern int snprintf (char *__restrict __s, size_t __maxlen,
3574 __const char *__restrict __format, ...)
3575 throw () __attribute__ ((__format__ (__printf__, 3, 4)));
3576 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
3577 __const char *__restrict __format, __gnuc_va_list __arg)
3578 throw () __attribute__ ((__format__ (__printf__, 3, 0)));
3579 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
3580 __gnuc_va_list __arg)
3581 throw () __attribute__ ((__format__ (__printf__, 2, 0))) ;
3582 extern int asprintf (char **__restrict __ptr,
3583 __const char *__restrict __fmt, ...)
3584 throw () __attribute__ ((__format__ (__printf__, 2, 3))) ;
3585 extern int vdprintf (int __fd, __const char *__restrict __fmt,
3586 __gnuc_va_list __arg)
3587 __attribute__ ((__format__ (__printf__, 2, 0)));
3588 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
3589 __attribute__ ((__format__ (__printf__, 2, 3)));
3590 extern int fscanf (FILE *__restrict __stream,
3591 __const char *__restrict __format, ...) ;
3592 extern int scanf (__const char *__restrict __format, ...) ;
3593 extern int sscanf (__const char *__restrict __s,
3594 __const char *__restrict __format, ...) throw ();
3595 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
3596 __gnuc_va_list __arg)
3597 __attribute__ ((__format__ (__scanf__, 2, 0))) ;
3598 extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
3599 __attribute__ ((__format__ (__scanf__, 1, 0))) ;
3600 extern int vsscanf (__const char *__restrict __s,
3601 __const char *__restrict __format, __gnuc_va_list __arg)
3602 throw () __attribute__ ((__format__ (__scanf__, 2, 0)));
3603 extern int fgetc (FILE *__stream);
3604 extern int getc (FILE *__stream);
3605 extern int getchar (void);
3606 extern int getc_unlocked (FILE *__stream);
3607 extern int getchar_unlocked (void);
3608 extern int fgetc_unlocked (FILE *__stream);
3609 extern int fputc (int __c, FILE *__stream);
3610 extern int putc (int __c, FILE *__stream);
3611 extern int putchar (int __c);
3612 extern int fputc_unlocked (int __c, FILE *__stream);
3613 extern int putc_unlocked (int __c, FILE *__stream);
3614 extern int putchar_unlocked (int __c);
3615 extern int getw (FILE *__stream);
3616 extern int putw (int __w, FILE *__stream);
3617 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
3618 ;
3619 extern char *gets (char *__s) ;
3620 extern char *fgets_unlocked (char *__restrict __s, int __n,
3621 FILE *__restrict __stream) ;
3622 extern __ssize_t getdelim (char **__restrict __lineptr,
3623 size_t *__restrict __n, int __delimiter,
3624 FILE *__restrict __stream) ;
3625 extern __ssize_t getline (char **__restrict __lineptr,
3626 size_t *__restrict __n,
3627 FILE *__restrict __stream) ;
3628 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
3629 extern int puts (__const char *__s);
3630 extern int ungetc (int __c, FILE *__stream);
3631 extern size_t fread (void *__restrict __ptr, size_t __size,
3632 size_t __n, FILE *__restrict __stream) ;
3633 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
3634 size_t __n, FILE *__restrict __s) ;
3635 extern int fputs_unlocked (__const char *__restrict __s,
3636 FILE *__restrict __stream);
3637 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
3638 size_t __n, FILE *__restrict __stream) ;
3639 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
3640 size_t __n, FILE *__restrict __stream) ;
3641 extern int fseek (FILE *__stream, long int __off, int __whence);
3642 extern long int ftell (FILE *__stream) ;
3643 extern void rewind (FILE *__stream);
3644 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
3645 extern __off_t ftello (FILE *__stream) ;
3646 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
3647 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
3648 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
3649 extern __off64_t ftello64 (FILE *__stream) ;
3650 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
3651 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
3652 extern void clearerr (FILE *__stream) throw ();
3653 extern int feof (FILE *__stream) throw () ;
3654 extern int ferror (FILE *__stream) throw () ;
3655 extern void clearerr_unlocked (FILE *__stream) throw ();
3656 extern int feof_unlocked (FILE *__stream) throw () ;
3657 extern int ferror_unlocked (FILE *__stream) throw () ;
3658 extern void perror (__const char *__s);
3659 extern int fileno (FILE *__stream) throw () ;
3660 extern int fileno_unlocked (FILE *__stream) throw () ;
3661 extern FILE *popen (__const char *__command, __const char *__modes) ;
3662 extern int pclose (FILE *__stream);
3663 extern char *ctermid (char *__s) throw ();
3664 extern char *cuserid (char *__s);
3665 extern void flockfile (FILE *__stream) throw ();
3666 extern int ftrylockfile (FILE *__stream) throw () ;
3667 extern void funlockfile (FILE *__stream) throw ();
3668 }
3669 namespace std __attribute__ ((__visibility__ ("default"))) {
3670 using ::FILE;
3671 using ::fpos_t;
3672 using ::clearerr;
3673 using ::fclose;
3674 using ::feof;
3675 using ::ferror;
3676 using ::fflush;
3677 using ::fgetc;
3678 using ::fgetpos;
3679 using ::fgets;
3680 using ::fopen;
3681 using ::fprintf;
3682 using ::fputc;
3683 using ::fputs;
3684 using ::fread;
3685 using ::freopen;
3686 using ::fscanf;
3687 using ::fseek;
3688 using ::fsetpos;
3689 using ::ftell;
3690 using ::fwrite;
3691 using ::getc;
3692 using ::getchar;
3693 using ::gets;
3694 using ::perror;
3695 using ::printf;
3696 using ::putc;
3697 using ::putchar;
3698 using ::puts;
3699 using ::remove;
3700 using ::rename;
3701 using ::rewind;
3702 using ::scanf;
3703 using ::setbuf;
3704 using ::setvbuf;
3705 using ::sprintf;
3706 using ::sscanf;
3707 using ::tmpfile;
3708 using ::tmpnam;
3709 using ::ungetc;
3710 using ::vfprintf;
3711 using ::vprintf;
3712 using ::vsprintf;
3713 }
3714 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
3715 template<typename _CharT>
3716 struct _Char_types
3717 {
3718 typedef unsigned long int_type;
3719 typedef std::streampos pos_type;
3720 typedef std::streamoff off_type;
3721 typedef std::mbstate_t state_type;
3722 };
3723 template<typename _CharT>
3724 struct char_traits
3725 {
3726 typedef _CharT char_type;
3727 typedef typename _Char_types<_CharT>::int_type int_type;
3728 typedef typename _Char_types<_CharT>::pos_type pos_type;
3729 typedef typename _Char_types<_CharT>::off_type off_type;
3730 typedef typename _Char_types<_CharT>::state_type state_type;
3731 static void
3732 assign(char_type& __c1, const char_type& __c2)
3733 { __c1 = __c2; }
3734 static bool
3735 eq(const char_type& __c1, const char_type& __c2)
3736 { return __c1 == __c2; }
3737 static bool
3738 lt(const char_type& __c1, const char_type& __c2)
3739 { return __c1 < __c2; }
3740 static int
3741 compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
3742 static std::size_t
3743 length(const char_type* __s);
3744 static const char_type*
3745 find(const char_type* __s, std::size_t __n, const char_type& __a);
3746 static char_type*
3747 move(char_type* __s1, const char_type* __s2, std::size_t __n);
3748 static char_type*
3749 copy(char_type* __s1, const char_type* __s2, std::size_t __n);
3750 static char_type*
3751 assign(char_type* __s, std::size_t __n, char_type __a);
3752 static char_type
3753 to_char_type(const int_type& __c)
3754 { return static_cast<char_type>(__c); }
3755 static int_type
3756 to_int_type(const char_type& __c)
3757 { return static_cast<int_type>(__c); }
3758 static bool
3759 eq_int_type(const int_type& __c1, const int_type& __c2)
3760 { return __c1 == __c2; }
3761 static int_type
3762 eof()
3763 { return static_cast<int_type>((-1)); }
3764 static int_type
3765 not_eof(const int_type& __c)
3766 { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
3767 };
3768 template<typename _CharT>
3769 int
3770 char_traits<_CharT>::
3771 compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
3772 {
3773 for (std::size_t __i = 0; __i < __n; ++__i)
3774 if (lt(__s1[__i], __s2[__i]))
3775 return -1;
3776 else if (lt(__s2[__i], __s1[__i]))
3777 return 1;
3778 return 0;
3779 }
3780 template<typename _CharT>
3781 std::size_t
3782 char_traits<_CharT>::
3783 length(const char_type* __p)
3784 {
3785 std::size_t __i = 0;
3786 while (!eq(__p[__i], char_type()))
3787 ++__i;
3788 return __i;
3789 }
3790 template<typename _CharT>
3791 const typename char_traits<_CharT>::char_type*
3792 char_traits<_CharT>::
3793 find(const char_type* __s, std::size_t __n, const char_type& __a)
3794 {
3795 for (std::size_t __i = 0; __i < __n; ++__i)
3796 if (eq(__s[__i], __a))
3797 return __s + __i;
3798 return 0;
3799 }
3800 template<typename _CharT>
3801 typename char_traits<_CharT>::char_type*
3802 char_traits<_CharT>::
3803 move(char_type* __s1, const char_type* __s2, std::size_t __n)
3804 {
3805 return static_cast<_CharT*>(__builtin_memmove(__s1, __s2,
3806 __n * sizeof(char_type)));
3807 }
3808 template<typename _CharT>
3809 typename char_traits<_CharT>::char_type*
3810 char_traits<_CharT>::
3811 copy(char_type* __s1, const char_type* __s2, std::size_t __n)
3812 {
3813 std::copy(__s2, __s2 + __n, __s1);
3814 return __s1;
3815 }
3816 template<typename _CharT>
3817 typename char_traits<_CharT>::char_type*
3818 char_traits<_CharT>::
3819 assign(char_type* __s, std::size_t __n, char_type __a)
3820 {
3821 std::fill_n(__s, __n, __a);
3822 return __s;
3823 }
3824 }
3825 namespace std __attribute__ ((__visibility__ ("default"))) {
3826 template<class _CharT>
3827 struct char_traits : public __gnu_cxx::char_traits<_CharT>
3828 { };
3829 template<>
3830 struct char_traits<char>
3831 {
3832 typedef char char_type;
3833 typedef int int_type;
3834 typedef streampos pos_type;
3835 typedef streamoff off_type;
3836 typedef mbstate_t state_type;
3837 static void
3838 assign(char_type& __c1, const char_type& __c2)
3839 { __c1 = __c2; }
3840 static bool
3841 eq(const char_type& __c1, const char_type& __c2)
3842 { return __c1 == __c2; }
3843 static bool
3844 lt(const char_type& __c1, const char_type& __c2)
3845 { return __c1 < __c2; }
3846 static int
3847 compare(const char_type* __s1, const char_type* __s2, size_t __n)
3848 { return __builtin_memcmp(__s1, __s2, __n); }
3849 static size_t
3850 length(const char_type* __s)
3851 { return __builtin_strlen(__s); }
3852 static const char_type*
3853 find(const char_type* __s, size_t __n, const char_type& __a)
3854 { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); }
3855 static char_type*
3856 move(char_type* __s1, const char_type* __s2, size_t __n)
3857 { return static_cast<char_type*>(__builtin_memmove(__s1, __s2, __n)); }
3858 static char_type*
3859 copy(char_type* __s1, const char_type* __s2, size_t __n)
3860 { return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); }
3861 static char_type*
3862 assign(char_type* __s, size_t __n, char_type __a)
3863 { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); }
3864 static char_type
3865 to_char_type(const int_type& __c)
3866 { return static_cast<char_type>(__c); }
3867 static int_type
3868 to_int_type(const char_type& __c)
3869 { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
3870 static bool
3871 eq_int_type(const int_type& __c1, const int_type& __c2)
3872 { return __c1 == __c2; }
3873 static int_type
3874 eof() { return static_cast<int_type>((-1)); }
3875 static int_type
3876 not_eof(const int_type& __c)
3877 { return (__c == eof()) ? 0 : __c; }
3878 };
3879 }
3880 extern "C" {
3881 struct lconv
3882 {
3883 char *decimal_point;
3884 char *thousands_sep;
3885 char *grouping;
3886 char *int_curr_symbol;
3887 char *currency_symbol;
3888 char *mon_decimal_point;
3889 char *mon_thousands_sep;
3890 char *mon_grouping;
3891 char *positive_sign;
3892 char *negative_sign;
3893 char int_frac_digits;
3894 char frac_digits;
3895 char p_cs_precedes;
3896 char p_sep_by_space;
3897 char n_cs_precedes;
3898 char n_sep_by_space;
3899 char p_sign_posn;
3900 char n_sign_posn;
3901 char int_p_cs_precedes;
3902 char int_p_sep_by_space;
3903 char int_n_cs_precedes;
3904 char int_n_sep_by_space;
3905 char int_p_sign_posn;
3906 char int_n_sign_posn;
3907 };
3908 extern char *setlocale (int __category, __const char *__locale) throw ();
3909 extern struct lconv *localeconv (void) throw ();
3910 }
3911 namespace std __attribute__ ((__visibility__ ("default"))) {
3912 using ::lconv;
3913 using ::setlocale;
3914 using ::localeconv;
3915 }
3916 namespace std __attribute__ ((__visibility__ ("default"))) {
3917 typedef int* __c_locale;
3918 inline int
3919 __convert_from_v(const __c_locale&, char* __out,
3920 const int __size __attribute__((__unused__)),
3921 const char* __fmt, ...)
3922 {
3923 char* __old = std::setlocale(1, __null);
3924 char* __sav = __null;
3925 if (__builtin_strcmp(__old, "C"))
3926 {
3927 const size_t __len = __builtin_strlen(__old) + 1;
3928 __sav = new char[__len];
3929 __builtin_memcpy(__sav, __old, __len);
3930 std::setlocale(1, "C");
3931 }
3932 __builtin_va_list __args;
3933 __builtin_va_start(__args, __fmt);
3934 const int __ret = __builtin_vsprintf(__out, __fmt, __args);
3935 __builtin_va_end(__args);
3936 if (__sav)
3937 {
3938 std::setlocale(1, __sav);
3939 delete [] __sav;
3940 }
3941 return __ret;
3942 }
3943 }
3944 extern "C" {
3945 enum
3946 {
3947 _ISupper = (1 << (0)),
3948 _ISlower = (1 << (1)),
3949 _ISalpha = (1 << (2)),
3950 _ISdigit = (1 << (3)),
3951 _ISxdigit = (1 << (4)),
3952 _ISspace = (1 << (5)),
3953 _ISprint = (1 << (6)),
3954 _ISgraph = (1 << (7)),
3955 _ISblank = (1 << (8)),
3956 _IScntrl = (1 << (9)),
3957 _ISpunct = (1 << (10)),
3958 _ISalnum = (1 << (11))
3959 };
3960 typedef __uint16_t __ctype_mask_t;
3961 typedef __int16_t __ctype_touplow_t;
3962 extern const __ctype_mask_t *__C_ctype_b;
3963 extern const __ctype_touplow_t *__C_ctype_toupper;
3964 extern const __ctype_touplow_t *__C_ctype_tolower;
3965 extern const __ctype_mask_t *__ctype_b;
3966 extern const __ctype_touplow_t *__ctype_toupper;
3967 extern const __ctype_touplow_t *__ctype_tolower;
3968 extern int isalnum (int) throw ();
3969 extern int isalpha (int) throw ();
3970 extern int iscntrl (int) throw ();
3971 extern int isdigit (int) throw ();
3972 extern int islower (int) throw ();
3973 extern int isgraph (int) throw ();
3974 extern int isprint (int) throw ();
3975 extern int ispunct (int) throw ();
3976 extern int isspace (int) throw ();
3977 extern int isupper (int) throw ();
3978 extern int isxdigit (int) throw ();
3979 extern int tolower (int __c) throw ();
3980 extern int toupper (int __c) throw ();
3981 extern int isblank (int) throw ();
3982 extern int isctype (int __c, int __mask) throw ();
3983 extern int isascii (int __c) throw ();
3984 extern int toascii (int __c) throw ();
3985 extern int _toupper (int) throw ();
3986 extern int _tolower (int) throw ();
3987 }
3988 namespace std __attribute__ ((__visibility__ ("default"))) {
3989 using ::isalnum;
3990 using ::isalpha;
3991 using ::iscntrl;
3992 using ::isdigit;
3993 using ::isgraph;
3994 using ::islower;
3995 using ::isprint;
3996 using ::ispunct;
3997 using ::isspace;
3998 using ::isupper;
3999 using ::isxdigit;
4000 using ::tolower;
4001 using ::toupper;
4002 }
4003 namespace std __attribute__ ((__visibility__ ("default"))) {
4004 class locale;
4005 template<typename _Facet>
4006 bool
4007 has_facet(const locale&) throw();
4008 template<typename _Facet>
4009 const _Facet&
4010 use_facet(const locale&);
4011 template<typename _CharT>
4012 bool
4013 isspace(_CharT, const locale&);
4014 template<typename _CharT>
4015 bool
4016 isprint(_CharT, const locale&);
4017 template<typename _CharT>
4018 bool
4019 iscntrl(_CharT, const locale&);
4020 template<typename _CharT>
4021 bool
4022 isupper(_CharT, const locale&);
4023 template<typename _CharT>
4024 bool
4025 islower(_CharT, const locale&);
4026 template<typename _CharT>
4027 bool
4028 isalpha(_CharT, const locale&);
4029 template<typename _CharT>
4030 bool
4031 isdigit(_CharT, const locale&);
4032 template<typename _CharT>
4033 bool
4034 ispunct(_CharT, const locale&);
4035 template<typename _CharT>
4036 bool
4037 isxdigit(_CharT, const locale&);
4038 template<typename _CharT>
4039 bool
4040 isalnum(_CharT, const locale&);
4041 template<typename _CharT>
4042 bool
4043 isgraph(_CharT, const locale&);
4044 template<typename _CharT>
4045 _CharT
4046 toupper(_CharT, const locale&);
4047 template<typename _CharT>
4048 _CharT
4049 tolower(_CharT, const locale&);
4050 class ctype_base;
4051 template<typename _CharT>
4052 class ctype;
4053 template<> class ctype<char>;
4054 template<typename _CharT>
4055 class ctype_byname;
4056 class codecvt_base;
4057 template<typename _InternT, typename _ExternT, typename _StateT>
4058 class codecvt;
4059 template<> class codecvt<char, char, mbstate_t>;
4060 template<typename _InternT, typename _ExternT, typename _StateT>
4061 class codecvt_byname;
4062 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
4063 class num_get;
4064 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
4065 class num_put;
4066 template<typename _CharT> class numpunct;
4067 template<typename _CharT> class numpunct_byname;
4068 template<typename _CharT>
4069 class collate;
4070 template<typename _CharT> class
4071 collate_byname;
4072 class time_base;
4073 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
4074 class time_get;
4075 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
4076 class time_get_byname;
4077 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
4078 class time_put;
4079 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
4080 class time_put_byname;
4081 class money_base;
4082 template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
4083 class money_get;
4084 template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
4085 class money_put;
4086 template<typename _CharT, bool _Intl = false>
4087 class moneypunct;
4088 template<typename _CharT, bool _Intl = false>
4089 class moneypunct_byname;
4090 class messages_base;
4091 template<typename _CharT>
4092 class messages;
4093 template<typename _CharT>
4094 class messages_byname;
4095 }
4096 extern "C" {
4097 typedef __ssize_t ssize_t;
4098 typedef __gid_t gid_t;
4099 typedef __uid_t uid_t;
4100 typedef __off_t off_t;
4101 typedef __off64_t off64_t;
4102 typedef __useconds_t useconds_t;
4103 typedef __socklen_t socklen_t;
4104 extern int access (__const char *__name, int __type) throw () __attribute__ ((__nonnull__ (1)));
4105 extern __off_t lseek (int __fd, __off_t __offset, int __whence) throw ();
4106 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
4107 throw ();
4108 extern int close (int __fd);
4109 extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ;
4110 extern ssize_t write (int __fd, __const void *__buf, size_t __n) ;
4111 extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
4112 __off_t __offset) ;
4113 extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
4114 __off_t __offset) ;
4115 extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
4116 __off64_t __offset) ;
4117 extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
4118 __off64_t __offset) ;
4119 extern int pipe (int __pipedes[2]) throw () ;
4120 extern unsigned int alarm (unsigned int __seconds) throw ();
4121 extern unsigned int sleep (unsigned int __seconds);
4122 extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
4123 throw ();
4124 extern int usleep (__useconds_t __useconds);
4125 extern int pause (void);
4126 extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
4127 throw () __attribute__ ((__nonnull__ (1))) ;
4128 extern int fchown (int __fd, __uid_t __owner, __gid_t __group) throw () ;
4129 extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
4130 throw () __attribute__ ((__nonnull__ (1))) ;
4131 extern int chdir (__const char *__path) throw () __attribute__ ((__nonnull__ (1))) ;
4132 extern int fchdir (int __fd) throw () ;
4133 extern char *getcwd (char *__buf, size_t __size) throw () ;
4134 extern char *get_current_dir_name (void) throw ();
4135 extern int dup (int __fd) throw () ;
4136 extern int dup2 (int __fd, int __fd2) throw ();
4137 extern char **__environ;
4138 extern char **environ;
4139 extern int execve (__const char *__path, char *__const __argv[],
4140 char *__const __envp[]) throw () __attribute__ ((__nonnull__ (1)));
4141 extern int execv (__const char *__path, char *__const __argv[])
4142 throw () __attribute__ ((__nonnull__ (1)));
4143 extern int execle (__const char *__path, __const char *__arg, ...)
4144 throw () __attribute__ ((__nonnull__ (1)));
4145 extern int execl (__const char *__path, __const char *__arg, ...)
4146 throw () __attribute__ ((__nonnull__ (1)));
4147 extern int execvp (__const char *__file, char *__const __argv[])
4148 throw () __attribute__ ((__nonnull__ (1)));
4149 extern int execlp (__const char *__file, __const char *__arg, ...)
4150 throw () __attribute__ ((__nonnull__ (1)));
4151 extern int nice (int __inc) throw () ;
4152 extern void _exit (int __status) __attribute__ ((__noreturn__));
4153 enum
4154 {
4155 _PC_LINK_MAX,
4156 _PC_MAX_CANON,
4157 _PC_MAX_INPUT,
4158 _PC_NAME_MAX,
4159 _PC_PATH_MAX,
4160 _PC_PIPE_BUF,
4161 _PC_CHOWN_RESTRICTED,
4162 _PC_NO_TRUNC,
4163 _PC_VDISABLE,
4164 _PC_SYNC_IO,
4165 _PC_ASYNC_IO,
4166 _PC_PRIO_IO,
4167 _PC_SOCK_MAXBUF,
4168 _PC_FILESIZEBITS,
4169 _PC_REC_INCR_XFER_SIZE,
4170 _PC_REC_MAX_XFER_SIZE,
4171 _PC_REC_MIN_XFER_SIZE,
4172 _PC_REC_XFER_ALIGN,
4173 _PC_ALLOC_SIZE_MIN,
4174 _PC_SYMLINK_MAX,
4175 _PC_2_SYMLINKS
4176 };
4177 enum
4178 {
4179 _SC_ARG_MAX,
4180 _SC_CHILD_MAX,
4181 _SC_CLK_TCK,
4182 _SC_NGROUPS_MAX,
4183 _SC_OPEN_MAX,
4184 _SC_STREAM_MAX,
4185 _SC_TZNAME_MAX,
4186 _SC_JOB_CONTROL,
4187 _SC_SAVED_IDS,
4188 _SC_REALTIME_SIGNALS,
4189 _SC_PRIORITY_SCHEDULING,
4190 _SC_TIMERS,
4191 _SC_ASYNCHRONOUS_IO,
4192 _SC_PRIORITIZED_IO,
4193 _SC_SYNCHRONIZED_IO,
4194 _SC_FSYNC,
4195 _SC_MAPPED_FILES,
4196 _SC_MEMLOCK,
4197 _SC_MEMLOCK_RANGE,
4198 _SC_MEMORY_PROTECTION,
4199 _SC_MESSAGE_PASSING,
4200 _SC_SEMAPHORES,
4201 _SC_SHARED_MEMORY_OBJECTS,
4202 _SC_AIO_LISTIO_MAX,
4203 _SC_AIO_MAX,
4204 _SC_AIO_PRIO_DELTA_MAX,
4205 _SC_DELAYTIMER_MAX,
4206 _SC_MQ_OPEN_MAX,
4207 _SC_MQ_PRIO_MAX,
4208 _SC_VERSION,
4209 _SC_PAGESIZE,
4210 _SC_RTSIG_MAX,
4211 _SC_SEM_NSEMS_MAX,
4212 _SC_SEM_VALUE_MAX,
4213 _SC_SIGQUEUE_MAX,
4214 _SC_TIMER_MAX,
4215 _SC_BC_BASE_MAX,
4216 _SC_BC_DIM_MAX,
4217 _SC_BC_SCALE_MAX,
4218 _SC_BC_STRING_MAX,
4219 _SC_COLL_WEIGHTS_MAX,
4220 _SC_EQUIV_CLASS_MAX,
4221 _SC_EXPR_NEST_MAX,
4222 _SC_LINE_MAX,
4223 _SC_RE_DUP_MAX,
4224 _SC_CHARCLASS_NAME_MAX,
4225 _SC_2_VERSION,
4226 _SC_2_C_BIND,
4227 _SC_2_C_DEV,
4228 _SC_2_FORT_DEV,
4229 _SC_2_FORT_RUN,
4230 _SC_2_SW_DEV,
4231 _SC_2_LOCALEDEF,
4232 _SC_PII,
4233 _SC_PII_XTI,
4234 _SC_PII_SOCKET,
4235 _SC_PII_INTERNET,
4236 _SC_PII_OSI,
4237 _SC_POLL,
4238 _SC_SELECT,
4239 _SC_UIO_MAXIOV,
4240 _SC_IOV_MAX = _SC_UIO_MAXIOV,
4241 _SC_PII_INTERNET_STREAM,
4242 _SC_PII_INTERNET_DGRAM,
4243 _SC_PII_OSI_COTS,
4244 _SC_PII_OSI_CLTS,
4245 _SC_PII_OSI_M,
4246 _SC_T_IOV_MAX,
4247 _SC_THREADS,
4248 _SC_THREAD_SAFE_FUNCTIONS,
4249 _SC_GETGR_R_SIZE_MAX,
4250 _SC_GETPW_R_SIZE_MAX,
4251 _SC_LOGIN_NAME_MAX,
4252 _SC_TTY_NAME_MAX,
4253 _SC_THREAD_DESTRUCTOR_ITERATIONS,
4254 _SC_THREAD_KEYS_MAX,
4255 _SC_THREAD_STACK_MIN,
4256 _SC_THREAD_THREADS_MAX,
4257 _SC_THREAD_ATTR_STACKADDR,
4258 _SC_THREAD_ATTR_STACKSIZE,
4259 _SC_THREAD_PRIORITY_SCHEDULING,
4260 _SC_THREAD_PRIO_INHERIT,
4261 _SC_THREAD_PRIO_PROTECT,
4262 _SC_THREAD_PROCESS_SHARED,
4263 _SC_NPROCESSORS_CONF,
4264 _SC_NPROCESSORS_ONLN,
4265 _SC_PHYS_PAGES,
4266 _SC_AVPHYS_PAGES,
4267 _SC_ATEXIT_MAX,
4268 _SC_PASS_MAX,
4269 _SC_XOPEN_VERSION,
4270 _SC_XOPEN_XCU_VERSION,
4271 _SC_XOPEN_UNIX,
4272 _SC_XOPEN_CRYPT,
4273 _SC_XOPEN_ENH_I18N,
4274 _SC_XOPEN_SHM,
4275 _SC_2_CHAR_TERM,
4276 _SC_2_C_VERSION,
4277 _SC_2_UPE,
4278 _SC_XOPEN_XPG2,
4279 _SC_XOPEN_XPG3,
4280 _SC_XOPEN_XPG4,
4281 _SC_CHAR_BIT,
4282 _SC_CHAR_MAX,
4283 _SC_CHAR_MIN,
4284 _SC_INT_MAX,
4285 _SC_INT_MIN,
4286 _SC_LONG_BIT,
4287 _SC_WORD_BIT,
4288 _SC_MB_LEN_MAX,
4289 _SC_NZERO,
4290 _SC_SSIZE_MAX,
4291 _SC_SCHAR_MAX,
4292 _SC_SCHAR_MIN,
4293 _SC_SHRT_MAX,
4294 _SC_SHRT_MIN,
4295 _SC_UCHAR_MAX,
4296 _SC_UINT_MAX,
4297 _SC_ULONG_MAX,
4298 _SC_USHRT_MAX,
4299 _SC_NL_ARGMAX,
4300 _SC_NL_LANGMAX,
4301 _SC_NL_MSGMAX,
4302 _SC_NL_NMAX,
4303 _SC_NL_SETMAX,
4304 _SC_NL_TEXTMAX,
4305 _SC_XBS5_ILP32_OFF32,
4306 _SC_XBS5_ILP32_OFFBIG,
4307 _SC_XBS5_LP64_OFF64,
4308 _SC_XBS5_LPBIG_OFFBIG,
4309 _SC_XOPEN_LEGACY,
4310 _SC_XOPEN_REALTIME,
4311 _SC_XOPEN_REALTIME_THREADS,
4312 _SC_ADVISORY_INFO,
4313 _SC_BARRIERS,
4314 _SC_BASE,
4315 _SC_C_LANG_SUPPORT,
4316 _SC_C_LANG_SUPPORT_R,
4317 _SC_CLOCK_SELECTION,
4318 _SC_CPUTIME,
4319 _SC_THREAD_CPUTIME,
4320 _SC_DEVICE_IO,
4321 _SC_DEVICE_SPECIFIC,
4322 _SC_DEVICE_SPECIFIC_R,
4323 _SC_FD_MGMT,
4324 _SC_FIFO,
4325 _SC_PIPE,
4326 _SC_FILE_ATTRIBUTES,
4327 _SC_FILE_LOCKING,
4328 _SC_FILE_SYSTEM,
4329 _SC_MONOTONIC_CLOCK,
4330 _SC_MULTI_PROCESS,
4331 _SC_SINGLE_PROCESS,
4332 _SC_NETWORKING,
4333 _SC_READER_WRITER_LOCKS,
4334 _SC_SPIN_LOCKS,
4335 _SC_REGEXP,
4336 _SC_REGEX_VERSION,
4337 _SC_SHELL,
4338 _SC_SIGNALS,
4339 _SC_SPAWN,
4340 _SC_SPORADIC_SERVER,
4341 _SC_THREAD_SPORADIC_SERVER,
4342 _SC_SYSTEM_DATABASE,
4343 _SC_SYSTEM_DATABASE_R,
4344 _SC_TIMEOUTS,
4345 _SC_TYPED_MEMORY_OBJECTS,
4346 _SC_USER_GROUPS,
4347 _SC_USER_GROUPS_R,
4348 _SC_2_PBS,
4349 _SC_2_PBS_ACCOUNTING,
4350 _SC_2_PBS_LOCATE,
4351 _SC_2_PBS_MESSAGE,
4352 _SC_2_PBS_TRACK,
4353 _SC_SYMLOOP_MAX,
4354 _SC_STREAMS,
4355 _SC_2_PBS_CHECKPOINT,
4356 _SC_V6_ILP32_OFF32,
4357 _SC_V6_ILP32_OFFBIG,
4358 _SC_V6_LP64_OFF64,
4359 _SC_V6_LPBIG_OFFBIG,
4360 _SC_HOST_NAME_MAX,
4361 _SC_TRACE,
4362 _SC_TRACE_EVENT_FILTER,
4363 _SC_TRACE_INHERIT,
4364 _SC_TRACE_LOG,
4365 _SC_LEVEL1_ICACHE_SIZE,
4366 _SC_LEVEL1_ICACHE_ASSOC,
4367 _SC_LEVEL1_ICACHE_LINESIZE,
4368 _SC_LEVEL1_DCACHE_SIZE,
4369 _SC_LEVEL1_DCACHE_ASSOC,
4370 _SC_LEVEL1_DCACHE_LINESIZE,
4371 _SC_LEVEL2_CACHE_SIZE,
4372 _SC_LEVEL2_CACHE_ASSOC,
4373 _SC_LEVEL2_CACHE_LINESIZE,
4374 _SC_LEVEL3_CACHE_SIZE,
4375 _SC_LEVEL3_CACHE_ASSOC,
4376 _SC_LEVEL3_CACHE_LINESIZE,
4377 _SC_LEVEL4_CACHE_SIZE,
4378 _SC_LEVEL4_CACHE_ASSOC,
4379 _SC_LEVEL4_CACHE_LINESIZE,
4380 _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
4381 _SC_RAW_SOCKETS
4382 };
4383 enum
4384 {
4385 _CS_PATH,
4386 _CS_V6_WIDTH_RESTRICTED_ENVS,
4387 _CS_LFS_CFLAGS = 1000,
4388 _CS_LFS_LDFLAGS,
4389 _CS_LFS_LIBS,
4390 _CS_LFS_LINTFLAGS,
4391 _CS_LFS64_CFLAGS,
4392 _CS_LFS64_LDFLAGS,
4393 _CS_LFS64_LIBS,
4394 _CS_LFS64_LINTFLAGS,
4395 _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
4396 _CS_XBS5_ILP32_OFF32_LDFLAGS,
4397 _CS_XBS5_ILP32_OFF32_LIBS,
4398 _CS_XBS5_ILP32_OFF32_LINTFLAGS,
4399 _CS_XBS5_ILP32_OFFBIG_CFLAGS,
4400 _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
4401 _CS_XBS5_ILP32_OFFBIG_LIBS,
4402 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
4403 _CS_XBS5_LP64_OFF64_CFLAGS,
4404 _CS_XBS5_LP64_OFF64_LDFLAGS,
4405 _CS_XBS5_LP64_OFF64_LIBS,
4406 _CS_XBS5_LP64_OFF64_LINTFLAGS,
4407 _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
4408 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
4409 _CS_XBS5_LPBIG_OFFBIG_LIBS,
4410 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
4411 _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
4412 _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
4413 _CS_POSIX_V6_ILP32_OFF32_LIBS,
4414 _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
4415 _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
4416 _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
4417 _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
4418 _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
4419 _CS_POSIX_V6_LP64_OFF64_CFLAGS,
4420 _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
4421 _CS_POSIX_V6_LP64_OFF64_LIBS,
4422 _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
4423 _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
4424 _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
4425 _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
4426 _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
4427 };
4428 extern long int pathconf (__const char *__path, int __name)
4429 throw () __attribute__ ((__nonnull__ (1)));
4430 extern long int fpathconf (int __fd, int __name) throw ();
4431 extern long int sysconf (int __name) throw ();
4432 extern size_t confstr (int __name, char *__buf, size_t __len) throw ();
4433 extern __pid_t getpid (void) throw ();
4434 extern __pid_t getppid (void) throw ();
4435 extern __pid_t getpgrp (void) throw ();
4436 extern __pid_t __getpgid (__pid_t __pid) throw ();
4437 extern __pid_t getpgid (__pid_t __pid) throw ();
4438 extern int setpgid (__pid_t __pid, __pid_t __pgid) throw ();
4439 extern int setpgrp (void) throw ();
4440 extern __pid_t setsid (void) throw ();
4441 extern __pid_t getsid (__pid_t __pid) throw ();
4442 extern __uid_t getuid (void) throw ();
4443 extern __uid_t geteuid (void) throw ();
4444 extern __gid_t getgid (void) throw ();
4445 extern __gid_t getegid (void) throw ();
4446 extern int getgroups (int __size, __gid_t __list[]) throw () ;
4447 extern int setuid (__uid_t __uid) throw ();
4448 extern int setreuid (__uid_t __ruid, __uid_t __euid) throw ();
4449 extern int seteuid (__uid_t __uid) throw ();
4450 extern int setgid (__gid_t __gid) throw ();
4451 extern int setregid (__gid_t __rgid, __gid_t __egid) throw ();
4452 extern int setegid (__gid_t __gid) throw ();
4453 extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid)
4454 throw ();
4455 extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
4456 throw ();
4457 extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
4458 throw ();
4459 extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
4460 throw ();
4461 extern __pid_t vfork (void) throw ();
4462 extern char *ttyname (int __fd) throw ();
4463 extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
4464 throw () __attribute__ ((__nonnull__ (2))) ;
4465 extern int isatty (int __fd) throw ();
4466 extern int link (__const char *__from, __const char *__to)
4467 throw () __attribute__ ((__nonnull__ (1, 2))) ;
4468 extern int symlink (__const char *__from, __const char *__to)
4469 throw () __attribute__ ((__nonnull__ (1, 2))) ;
4470 extern ssize_t readlink (__const char *__restrict __path,
4471 char *__restrict __buf, size_t __len)
4472 throw () __attribute__ ((__nonnull__ (1, 2))) ;
4473 extern int unlink (__const char *__name) throw () __attribute__ ((__nonnull__ (1)));
4474 extern int rmdir (__const char *__path) throw () __attribute__ ((__nonnull__ (1)));
4475 extern __pid_t tcgetpgrp (int __fd) throw ();
4476 extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) throw ();
4477 extern char *getlogin (void);
4478 extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1)));
4479 extern "C" {
4480 extern char *optarg;
4481 extern int optind;
4482 extern int opterr;
4483 extern int optopt;
4484 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
4485 throw ();
4486 }
4487 extern int gethostname (char *__name, size_t __len) throw () __attribute__ ((__nonnull__ (1)));
4488 extern int sethostname (__const char *__name, size_t __len)
4489 throw () __attribute__ ((__nonnull__ (1))) ;
4490 extern int sethostid (long int __id) throw () ;
4491 extern int getdomainname (char *__name, size_t __len)
4492 throw () __attribute__ ((__nonnull__ (1))) ;
4493 extern int setdomainname (__const char *__name, size_t __len)
4494 throw () __attribute__ ((__nonnull__ (1))) ;
4495 extern int vhangup (void) throw ();
4496 extern int acct (__const char *__name) throw ();
4497 extern char *getusershell (void) throw ();
4498 extern void endusershell (void) throw ();
4499 extern void setusershell (void) throw ();
4500 extern int daemon (int __nochdir, int __noclose) throw () ;
4501 extern int chroot (__const char *__path) throw () __attribute__ ((__nonnull__ (1))) ;
4502 extern char *getpass (__const char *__prompt) __attribute__ ((__nonnull__ (1)));
4503 extern int fsync (int __fd);
4504 extern long int gethostid (void);
4505 extern void sync (void) throw ();
4506 extern int getpagesize (void) throw () __attribute__ ((__const__));
4507 extern int getdtablesize (void) throw ();
4508 extern int truncate (__const char *__file, __off_t __length)
4509 throw () __attribute__ ((__nonnull__ (1))) ;
4510 extern int truncate64 (__const char *__file, __off64_t __length)
4511 throw () __attribute__ ((__nonnull__ (1))) ;
4512 extern int ftruncate (int __fd, __off_t __length) throw () ;
4513 extern int ftruncate64 (int __fd, __off64_t __length) throw () ;
4514 extern int brk (void *__addr) throw () ;
4515 extern void *sbrk (intptr_t __delta) throw ();
4516 extern long int syscall (long int __sysno, ...) throw ();
4517 extern int lockf (int __fd, int __cmd, __off_t __len) ;
4518 extern int lockf64 (int __fd, int __cmd, __off64_t __len) ;
4519 extern int fdatasync (int __fildes) throw ();
4520 extern char *crypt (__const char *__key, __const char *__salt)
4521 throw () __attribute__ ((__nonnull__ (1, 2)));
4522 extern void encrypt (char *__block, int __edflag) throw () __attribute__ ((__nonnull__ (1)));
4523 extern void swab (__const void *__restrict __from, void *__restrict __to,
4524 ssize_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));
4525 extern char *ctermid (char *__s) throw ();
4526 }
4527 typedef pthread_key_t __gthread_key_t;
4528 typedef pthread_once_t __gthread_once_t;
4529 typedef pthread_mutex_t __gthread_mutex_t;
4530 typedef pthread_mutex_t __gthread_recursive_mutex_t;
4531 typedef pthread_cond_t __gthread_cond_t;
4532 static __typeof(pthread_once) __gthrw_pthread_once __attribute__ ((__weakref__("pthread_once")));
4533 static __typeof(pthread_getspecific) __gthrw_pthread_getspecific __attribute__ ((__weakref__("pthread_getspecific")));
4534 static __typeof(pthread_setspecific) __gthrw_pthread_setspecific __attribute__ ((__weakref__("pthread_setspecific")));
4535 static __typeof(pthread_create) __gthrw_pthread_create __attribute__ ((__weakref__("pthread_create")));
4536 static __typeof(pthread_cancel) __gthrw_pthread_cancel __attribute__ ((__weakref__("pthread_cancel")));
4537 static __typeof(pthread_mutex_lock) __gthrw_pthread_mutex_lock __attribute__ ((__weakref__("pthread_mutex_lock")));
4538 static __typeof(pthread_mutex_trylock) __gthrw_pthread_mutex_trylock __attribute__ ((__weakref__("pthread_mutex_trylock")));
4539 static __typeof(pthread_mutex_unlock) __gthrw_pthread_mutex_unlock __attribute__ ((__weakref__("pthread_mutex_unlock")));
4540 static __typeof(pthread_mutex_init) __gthrw_pthread_mutex_init __attribute__ ((__weakref__("pthread_mutex_init")));
4541 static __typeof(pthread_cond_broadcast) __gthrw_pthread_cond_broadcast __attribute__ ((__weakref__("pthread_cond_broadcast")));
4542 static __typeof(pthread_cond_wait) __gthrw_pthread_cond_wait __attribute__ ((__weakref__("pthread_cond_wait")));
4543 static __typeof(pthread_key_create) __gthrw_pthread_key_create __attribute__ ((__weakref__("pthread_key_create")));
4544 static __typeof(pthread_key_delete) __gthrw_pthread_key_delete __attribute__ ((__weakref__("pthread_key_delete")));
4545 static __typeof(pthread_mutexattr_init) __gthrw_pthread_mutexattr_init __attribute__ ((__weakref__("pthread_mutexattr_init")));
4546 static __typeof(pthread_mutexattr_settype) __gthrw_pthread_mutexattr_settype __attribute__ ((__weakref__("pthread_mutexattr_settype")));
4547 static __typeof(pthread_mutexattr_destroy) __gthrw_pthread_mutexattr_destroy __attribute__ ((__weakref__("pthread_mutexattr_destroy")));
4548 static inline int
4549 __gthread_active_p (void)
4550 {
4551 static void *const __gthread_active_ptr
4552 = __extension__ (void *) &__gthrw_pthread_cancel;
4553 return __gthread_active_ptr != 0;
4554 }
4555 static inline int
4556 __gthread_once (__gthread_once_t *once, void (*func) (void))
4557 {
4558 if (__gthread_active_p ())
4559 return __gthrw_pthread_once (once, func);
4560 else
4561 return -1;
4562 }
4563 static inline int
4564 __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
4565 {
4566 return __gthrw_pthread_key_create (key, dtor);
4567 }
4568 static inline int
4569 __gthread_key_delete (__gthread_key_t key)
4570 {
4571 return __gthrw_pthread_key_delete (key);
4572 }
4573 static inline void *
4574 __gthread_getspecific (__gthread_key_t key)
4575 {
4576 return __gthrw_pthread_getspecific (key);
4577 }
4578 static inline int
4579 __gthread_setspecific (__gthread_key_t key, const void *ptr)
4580 {
4581 return __gthrw_pthread_setspecific (key, ptr);
4582 }
4583 static inline int
4584 __gthread_mutex_lock (__gthread_mutex_t *mutex)
4585 {
4586 if (__gthread_active_p ())
4587 return __gthrw_pthread_mutex_lock (mutex);
4588 else
4589 return 0;
4590 }
4591 static inline int
4592 __gthread_mutex_trylock (__gthread_mutex_t *mutex)
4593 {
4594 if (__gthread_active_p ())
4595 return __gthrw_pthread_mutex_trylock (mutex);
4596 else
4597 return 0;
4598 }
4599 static inline int
4600 __gthread_mutex_unlock (__gthread_mutex_t *mutex)
4601 {
4602 if (__gthread_active_p ())
4603 return __gthrw_pthread_mutex_unlock (mutex);
4604 else
4605 return 0;
4606 }
4607 static inline int
4608 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
4609 {
4610 return __gthread_mutex_lock (mutex);
4611 }
4612 static inline int
4613 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
4614 {
4615 return __gthread_mutex_trylock (mutex);
4616 }
4617 static inline int
4618 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
4619 {
4620 return __gthread_mutex_unlock (mutex);
4621 }
4622 static inline int
4623 __gthread_cond_broadcast (__gthread_cond_t *cond)
4624 {
4625 return __gthrw_pthread_cond_broadcast (cond);
4626 }
4627 static inline int
4628 __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex)
4629 {
4630 return __gthrw_pthread_cond_wait (cond, mutex);
4631 }
4632 static inline int
4633 __gthread_cond_wait_recursive (__gthread_cond_t *cond,
4634 __gthread_recursive_mutex_t *mutex)
4635 {
4636 return __gthread_cond_wait (cond, mutex);
4637 }
4638 typedef int _Atomic_word;
4639 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
4640 static inline _Atomic_word
4641 __exchange_and_add(volatile _Atomic_word* __mem, int __val)
4642 { return __sync_fetch_and_add(__mem, __val); }
4643 static inline void
4644 __atomic_add(volatile _Atomic_word* __mem, int __val)
4645 { __sync_fetch_and_add(__mem, __val); }
4646 static inline _Atomic_word
4647 __exchange_and_add_single(_Atomic_word* __mem, int __val)
4648 {
4649 _Atomic_word __result = *__mem;
4650 *__mem += __val;
4651 return __result;
4652 }
4653 static inline void
4654 __atomic_add_single(_Atomic_word* __mem, int __val)
4655 { *__mem += __val; }
4656 static inline _Atomic_word
4657 __attribute__ ((__unused__))
4658 __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)
4659 {
4660 if (__gthread_active_p())
4661 return __exchange_and_add(__mem, __val);
4662 else
4663 return __exchange_and_add_single(__mem, __val);
4664 }
4665 static inline void
4666 __attribute__ ((__unused__))
4667 __atomic_add_dispatch(_Atomic_word* __mem, int __val)
4668 {
4669 if (__gthread_active_p())
4670 __atomic_add(__mem, __val);
4671 else
4672 __atomic_add_single(__mem, __val);
4673 }
4674 }
4675 extern "C++" {
4676 namespace std
4677 {
4678 class bad_alloc : public exception
4679 {
4680 public:
4681 bad_alloc() throw() { }
4682 virtual ~bad_alloc() throw();
4683 virtual const char* what() const throw();
4684 };
4685 struct nothrow_t { };
4686 extern const nothrow_t nothrow;
4687 typedef void (*new_handler)();
4688 new_handler set_new_handler(new_handler) throw();
4689 }
4690 void* operator new(std::size_t) throw (std::bad_alloc);
4691 void* operator new[](std::size_t) throw (std::bad_alloc);
4692 void operator delete(void*) throw();
4693 void operator delete[](void*) throw();
4694 void* operator new(std::size_t, const std::nothrow_t&) throw();
4695 void* operator new[](std::size_t, const std::nothrow_t&) throw();
4696 void operator delete(void*, const std::nothrow_t&) throw();
4697 void operator delete[](void*, const std::nothrow_t&) throw();
4698 inline void* operator new(std::size_t, void* __p) throw() { return __p; }
4699 inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
4700 inline void operator delete (void*, void*) throw() { }
4701 inline void operator delete[](void*, void*) throw() { }
4702 }
4703 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
4704 using std::size_t;
4705 using std::ptrdiff_t;
4706 template<typename _Tp>
4707 class new_allocator
4708 {
4709 public:
4710 typedef size_t size_type;
4711 typedef ptrdiff_t difference_type;
4712 typedef _Tp* pointer;
4713 typedef const _Tp* const_pointer;
4714 typedef _Tp& reference;
4715 typedef const _Tp& const_reference;
4716 typedef _Tp value_type;
4717 template<typename _Tp1>
4718 struct rebind
4719 { typedef new_allocator<_Tp1> other; };
4720 new_allocator() throw() { }
4721 new_allocator(const new_allocator&) throw() { }
4722 template<typename _Tp1>
4723 new_allocator(const new_allocator<_Tp1>&) throw() { }
4724 ~new_allocator() throw() { }
4725 pointer
4726 address(reference __x) const { return &__x; }
4727 const_pointer
4728 address(const_reference __x) const { return &__x; }
4729 pointer
4730 allocate(size_type __n, const void* = 0)
4731 {
4732 if (__builtin_expect(__n > this->max_size(), false))
4733 std::__throw_bad_alloc();
4734 return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
4735 }
4736 void
4737 deallocate(pointer __p, size_type)
4738 { ::operator delete(__p); }
4739 size_type
4740 max_size() const throw()
4741 { return size_t(-1) / sizeof(_Tp); }
4742 void
4743 construct(pointer __p, const _Tp& __val)
4744 { ::new((void *)__p) _Tp(__val); }
4745 void
4746 destroy(pointer __p) { __p->~_Tp(); }
4747 };
4748 template<typename _Tp>
4749 inline bool
4750 operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
4751 { return true; }
4752 template<typename _Tp>
4753 inline bool
4754 operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
4755 { return false; }
4756 }
4757 namespace std __attribute__ ((__visibility__ ("default"))) {
4758 template<typename _Tp>
4759 class allocator;
4760 template<>
4761 class allocator<void>
4762 {
4763 public:
4764 typedef size_t size_type;
4765 typedef ptrdiff_t difference_type;
4766 typedef void* pointer;
4767 typedef const void* const_pointer;
4768 typedef void value_type;
4769 template<typename _Tp1>
4770 struct rebind
4771 { typedef allocator<_Tp1> other; };
4772 };
4773 template<typename _Tp>
4774 class allocator: public __gnu_cxx::new_allocator<_Tp>
4775 {
4776 public:
4777 typedef size_t size_type;
4778 typedef ptrdiff_t difference_type;
4779 typedef _Tp* pointer;
4780 typedef const _Tp* const_pointer;
4781 typedef _Tp& reference;
4782 typedef const _Tp& const_reference;
4783 typedef _Tp value_type;
4784 template<typename _Tp1>
4785 struct rebind
4786 { typedef allocator<_Tp1> other; };
4787 allocator() throw() { }
4788 allocator(const allocator& __a) throw()
4789 : __gnu_cxx::new_allocator<_Tp>(__a) { }
4790 template<typename _Tp1>
4791 allocator(const allocator<_Tp1>&) throw() { }
4792 ~allocator() throw() { }
4793 };
4794 template<typename _T1, typename _T2>
4795 inline bool
4796 operator==(const allocator<_T1>&, const allocator<_T2>&)
4797 { return true; }
4798 template<typename _Tp>
4799 inline bool
4800 operator==(const allocator<_Tp>&, const allocator<_Tp>&)
4801 { return true; }
4802 template<typename _T1, typename _T2>
4803 inline bool
4804 operator!=(const allocator<_T1>&, const allocator<_T2>&)
4805 { return false; }
4806 template<typename _Tp>
4807 inline bool
4808 operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
4809 { return false; }
4810 extern template class allocator<char>;
4811 extern template class allocator<wchar_t>;
4812 template<typename _Alloc, bool = __is_empty(_Alloc)>
4813 struct __alloc_swap
4814 { static void _S_do_it(_Alloc&, _Alloc&) { } };
4815 template<typename _Alloc>
4816 struct __alloc_swap<_Alloc, false>
4817 {
4818 static void
4819 _S_do_it(_Alloc& __one, _Alloc& __two)
4820 {
4821 if (__one != __two)
4822 swap(__one, __two);
4823 }
4824 };
4825 template<typename _Alloc, bool = __is_empty(_Alloc)>
4826 struct __alloc_neq
4827 {
4828 static bool
4829 _S_do_it(const _Alloc&, const _Alloc&)
4830 { return false; }
4831 };
4832 template<typename _Alloc>
4833 struct __alloc_neq<_Alloc, false>
4834 {
4835 static bool
4836 _S_do_it(const _Alloc& __one, const _Alloc& __two)
4837 { return __one != __two; }
4838 };
4839 }
4840 namespace __cxxabiv1
4841 {
4842 class __forced_unwind
4843 {
4844 virtual ~__forced_unwind() throw();
4845 virtual void __pure_dummy() = 0;
4846 };
4847 }
4848 namespace std __attribute__ ((__visibility__ ("default"))) {
4849 template<typename _CharT, typename _Traits>
4850 inline void
4851 __ostream_write(basic_ostream<_CharT, _Traits>& __out,
4852 const _CharT* __s, streamsize __n)
4853 {
4854 typedef basic_ostream<_CharT, _Traits> __ostream_type;
4855 typedef typename __ostream_type::ios_base __ios_base;
4856 const streamsize __put = __out.rdbuf()->sputn(__s, __n);
4857 if (__put != __n)
4858 __out.setstate(__ios_base::badbit);
4859 }
4860 template<typename _CharT, typename _Traits>
4861 inline void
4862 __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n)
4863 {
4864 typedef basic_ostream<_CharT, _Traits> __ostream_type;
4865 typedef typename __ostream_type::ios_base __ios_base;
4866 const _CharT __c = __out.fill();
4867 for (; __n > 0; --__n)
4868 {
4869 const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c);
4870 if (_Traits::eq_int_type(__put, _Traits::eof()))
4871 {
4872 __out.setstate(__ios_base::badbit);
4873 break;
4874 }
4875 }
4876 }
4877 template<typename _CharT, typename _Traits>
4878 basic_ostream<_CharT, _Traits>&
4879 __ostream_insert(basic_ostream<_CharT, _Traits>& __out,
4880 const _CharT* __s, streamsize __n)
4881 {
4882 typedef basic_ostream<_CharT, _Traits> __ostream_type;
4883 typedef typename __ostream_type::ios_base __ios_base;
4884 typename __ostream_type::sentry __cerb(__out);
4885 if (__cerb)
4886 {
4887 try
4888 {
4889 const streamsize __w = __out.width();
4890 if (__w > __n)
4891 {
4892 const bool __left = ((__out.flags()
4893 & __ios_base::adjustfield)
4894 == __ios_base::left);
4895 if (!__left)
4896 __ostream_fill(__out, __w - __n);
4897 if (__out.good())
4898 __ostream_write(__out, __s, __n);
4899 if (__left && __out.good())
4900 __ostream_fill(__out, __w - __n);
4901 }
4902 else
4903 __ostream_write(__out, __s, __n);
4904 __out.width(0);
4905 }
4906 catch(__cxxabiv1::__forced_unwind&)
4907 {
4908 __out._M_setstate(__ios_base::badbit);
4909 throw;
4910 }
4911 catch(...)
4912 { __out._M_setstate(__ios_base::badbit); }
4913 }
4914 return __out;
4915 }
4916 extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
4917 }
4918 namespace std __attribute__ ((__visibility__ ("default"))) {
4919 template<typename _Arg, typename _Result>
4920 struct unary_function
4921 {
4922 typedef _Arg argument_type;
4923 typedef _Result result_type;
4924 };
4925 template<typename _Arg1, typename _Arg2, typename _Result>
4926 struct binary_function
4927 {
4928 typedef _Arg1 first_argument_type;
4929 typedef _Arg2 second_argument_type;
4930 typedef _Result result_type;
4931 };
4932 template<typename _Tp>
4933 struct plus : public binary_function<_Tp, _Tp, _Tp>
4934 {
4935 _Tp
4936 operator()(const _Tp& __x, const _Tp& __y) const
4937 { return __x + __y; }
4938 };
4939 template<typename _Tp>
4940 struct minus : public binary_function<_Tp, _Tp, _Tp>
4941 {
4942 _Tp
4943 operator()(const _Tp& __x, const _Tp& __y) const
4944 { return __x - __y; }
4945 };
4946 template<typename _Tp>
4947 struct multiplies : public binary_function<_Tp, _Tp, _Tp>
4948 {
4949 _Tp
4950 operator()(const _Tp& __x, const _Tp& __y) const
4951 { return __x * __y; }
4952 };
4953 template<typename _Tp>
4954 struct divides : public binary_function<_Tp, _Tp, _Tp>
4955 {
4956 _Tp
4957 operator()(const _Tp& __x, const _Tp& __y) const
4958 { return __x / __y; }
4959 };
4960 template<typename _Tp>
4961 struct modulus : public binary_function<_Tp, _Tp, _Tp>
4962 {
4963 _Tp
4964 operator()(const _Tp& __x, const _Tp& __y) const
4965 { return __x % __y; }
4966 };
4967 template<typename _Tp>
4968 struct negate : public unary_function<_Tp, _Tp>
4969 {
4970 _Tp
4971 operator()(const _Tp& __x) const
4972 { return -__x; }
4973 };
4974 template<typename _Tp>
4975 struct equal_to : public binary_function<_Tp, _Tp, bool>
4976 {
4977 bool
4978 operator()(const _Tp& __x, const _Tp& __y) const
4979 { return __x == __y; }
4980 };
4981 template<typename _Tp>
4982 struct not_equal_to : public binary_function<_Tp, _Tp, bool>
4983 {
4984 bool
4985 operator()(const _Tp& __x, const _Tp& __y) const
4986 { return __x != __y; }
4987 };
4988 template<typename _Tp>
4989 struct greater : public binary_function<_Tp, _Tp, bool>
4990 {
4991 bool
4992 operator()(const _Tp& __x, const _Tp& __y) const
4993 { return __x > __y; }
4994 };
4995 template<typename _Tp>
4996 struct less : public binary_function<_Tp, _Tp, bool>
4997 {
4998 bool
4999 operator()(const _Tp& __x, const _Tp& __y) const
5000 { return __x < __y; }
5001 };
5002 template<typename _Tp>
5003 struct greater_equal : public binary_function<_Tp, _Tp, bool>
5004 {
5005 bool
5006 operator()(const _Tp& __x, const _Tp& __y) const
5007 { return __x >= __y; }
5008 };
5009 template<typename _Tp>
5010 struct less_equal : public binary_function<_Tp, _Tp, bool>
5011 {
5012 bool
5013 operator()(const _Tp& __x, const _Tp& __y) const
5014 { return __x <= __y; }
5015 };
5016 template<typename _Tp>
5017 struct logical_and : public binary_function<_Tp, _Tp, bool>
5018 {
5019 bool
5020 operator()(const _Tp& __x, const _Tp& __y) const
5021 { return __x && __y; }
5022 };
5023 template<typename _Tp>
5024 struct logical_or : public binary_function<_Tp, _Tp, bool>
5025 {
5026 bool
5027 operator()(const _Tp& __x, const _Tp& __y) const
5028 { return __x || __y; }
5029 };
5030 template<typename _Tp>
5031 struct logical_not : public unary_function<_Tp, bool>
5032 {
5033 bool
5034 operator()(const _Tp& __x) const
5035 { return !__x; }
5036 };
5037 template<typename _Tp>
5038 struct bit_and : public binary_function<_Tp, _Tp, _Tp>
5039 {
5040 _Tp
5041 operator()(const _Tp& __x, const _Tp& __y) const
5042 { return __x & __y; }
5043 };
5044 template<typename _Tp>
5045 struct bit_or : public binary_function<_Tp, _Tp, _Tp>
5046 {
5047 _Tp
5048 operator()(const _Tp& __x, const _Tp& __y) const
5049 { return __x | __y; }
5050 };
5051 template<typename _Tp>
5052 struct bit_xor : public binary_function<_Tp, _Tp, _Tp>
5053 {
5054 _Tp
5055 operator()(const _Tp& __x, const _Tp& __y) const
5056 { return __x ^ __y; }
5057 };
5058 template<typename _Predicate>
5059 class unary_negate
5060 : public unary_function<typename _Predicate::argument_type, bool>
5061 {
5062 protected:
5063 _Predicate _M_pred;
5064 public:
5065 explicit
5066 unary_negate(const _Predicate& __x) : _M_pred(__x) { }
5067 bool
5068 operator()(const typename _Predicate::argument_type& __x) const
5069 { return !_M_pred(__x); }
5070 };
5071 template<typename _Predicate>
5072 inline unary_negate<_Predicate>
5073 not1(const _Predicate& __pred)
5074 { return unary_negate<_Predicate>(__pred); }
5075 template<typename _Predicate>
5076 class binary_negate
5077 : public binary_function<typename _Predicate::first_argument_type,
5078 typename _Predicate::second_argument_type, bool>
5079 {
5080 protected:
5081 _Predicate _M_pred;
5082 public:
5083 explicit
5084 binary_negate(const _Predicate& __x) : _M_pred(__x) { }
5085 bool
5086 operator()(const typename _Predicate::first_argument_type& __x,
5087 const typename _Predicate::second_argument_type& __y) const
5088 { return !_M_pred(__x, __y); }
5089 };
5090 template<typename _Predicate>
5091 inline binary_negate<_Predicate>
5092 not2(const _Predicate& __pred)
5093 { return binary_negate<_Predicate>(__pred); }
5094 template<typename _Arg, typename _Result>
5095 class pointer_to_unary_function : public unary_function<_Arg, _Result>
5096 {
5097 protected:
5098 _Result (*_M_ptr)(_Arg);
5099 public:
5100 pointer_to_unary_function() { }
5101 explicit
5102 pointer_to_unary_function(_Result (*__x)(_Arg))
5103 : _M_ptr(__x) { }
5104 _Result
5105 operator()(_Arg __x) const
5106 { return _M_ptr(__x); }
5107 };
5108 template<typename _Arg, typename _Result>
5109 inline pointer_to_unary_function<_Arg, _Result>
5110 ptr_fun(_Result (*__x)(_Arg))
5111 { return pointer_to_unary_function<_Arg, _Result>(__x); }
5112 template<typename _Arg1, typename _Arg2, typename _Result>
5113 class pointer_to_binary_function
5114 : public binary_function<_Arg1, _Arg2, _Result>
5115 {
5116 protected:
5117 _Result (*_M_ptr)(_Arg1, _Arg2);
5118 public:
5119 pointer_to_binary_function() { }
5120 explicit
5121 pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
5122 : _M_ptr(__x) { }
5123 _Result
5124 operator()(_Arg1 __x, _Arg2 __y) const
5125 { return _M_ptr(__x, __y); }
5126 };
5127 template<typename _Arg1, typename _Arg2, typename _Result>
5128 inline pointer_to_binary_function<_Arg1, _Arg2, _Result>
5129 ptr_fun(_Result (*__x)(_Arg1, _Arg2))
5130 { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); }
5131 template<typename _Tp>
5132 struct _Identity : public unary_function<_Tp,_Tp>
5133 {
5134 _Tp&
5135 operator()(_Tp& __x) const
5136 { return __x; }
5137 const _Tp&
5138 operator()(const _Tp& __x) const
5139 { return __x; }
5140 };
5141 template<typename _Pair>
5142 struct _Select1st : public unary_function<_Pair,
5143 typename _Pair::first_type>
5144 {
5145 typename _Pair::first_type&
5146 operator()(_Pair& __x) const
5147 { return __x.first; }
5148 const typename _Pair::first_type&
5149 operator()(const _Pair& __x) const
5150 { return __x.first; }
5151 };
5152 template<typename _Pair>
5153 struct _Select2nd : public unary_function<_Pair,
5154 typename _Pair::second_type>
5155 {
5156 typename _Pair::second_type&
5157 operator()(_Pair& __x) const
5158 { return __x.second; }
5159 const typename _Pair::second_type&
5160 operator()(const _Pair& __x) const
5161 { return __x.second; }
5162 };
5163 template<typename _Ret, typename _Tp>
5164 class mem_fun_t : public unary_function<_Tp*, _Ret>
5165 {
5166 public:
5167 explicit
5168 mem_fun_t(_Ret (_Tp::*__pf)())
5169 : _M_f(__pf) { }
5170 _Ret
5171 operator()(_Tp* __p) const
5172 { return (__p->*_M_f)(); }
5173 private:
5174 _Ret (_Tp::*_M_f)();
5175 };
5176 template<typename _Ret, typename _Tp>
5177 class const_mem_fun_t : public unary_function<const _Tp*, _Ret>
5178 {
5179 public:
5180 explicit
5181 const_mem_fun_t(_Ret (_Tp::*__pf)() const)
5182 : _M_f(__pf) { }
5183 _Ret
5184 operator()(const _Tp* __p) const
5185 { return (__p->*_M_f)(); }
5186 private:
5187 _Ret (_Tp::*_M_f)() const;
5188 };
5189 template<typename _Ret, typename _Tp>
5190 class mem_fun_ref_t : public unary_function<_Tp, _Ret>
5191 {
5192 public:
5193 explicit
5194 mem_fun_ref_t(_Ret (_Tp::*__pf)())
5195 : _M_f(__pf) { }
5196 _Ret
5197 operator()(_Tp& __r) const
5198 { return (__r.*_M_f)(); }
5199 private:
5200 _Ret (_Tp::*_M_f)();
5201 };
5202 template<typename _Ret, typename _Tp>
5203 class const_mem_fun_ref_t : public unary_function<_Tp, _Ret>
5204 {
5205 public:
5206 explicit
5207 const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
5208 : _M_f(__pf) { }
5209 _Ret
5210 operator()(const _Tp& __r) const
5211 { return (__r.*_M_f)(); }
5212 private:
5213 _Ret (_Tp::*_M_f)() const;
5214 };
5215 template<typename _Ret, typename _Tp, typename _Arg>
5216 class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret>
5217 {
5218 public:
5219 explicit
5220 mem_fun1_t(_Ret (_Tp::*__pf)(_Arg))
5221 : _M_f(__pf) { }
5222 _Ret
5223 operator()(_Tp* __p, _Arg __x) const
5224 { return (__p->*_M_f)(__x); }
5225 private:
5226 _Ret (_Tp::*_M_f)(_Arg);
5227 };
5228 template<typename _Ret, typename _Tp, typename _Arg>
5229 class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret>
5230 {
5231 public:
5232 explicit
5233 const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
5234 : _M_f(__pf) { }
5235 _Ret
5236 operator()(const _Tp* __p, _Arg __x) const
5237 { return (__p->*_M_f)(__x); }
5238 private:
5239 _Ret (_Tp::*_M_f)(_Arg) const;
5240 };
5241 template<typename _Ret, typename _Tp, typename _Arg>
5242 class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
5243 {
5244 public:
5245 explicit
5246 mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg))
5247 : _M_f(__pf) { }
5248 _Ret
5249 operator()(_Tp& __r, _Arg __x) const
5250 { return (__r.*_M_f)(__x); }
5251 private:
5252 _Ret (_Tp::*_M_f)(_Arg);
5253 };
5254 template<typename _Ret, typename _Tp, typename _Arg>
5255 class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
5256 {
5257 public:
5258 explicit
5259 const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
5260 : _M_f(__pf) { }
5261 _Ret
5262 operator()(const _Tp& __r, _Arg __x) const
5263 { return (__r.*_M_f)(__x); }
5264 private:
5265 _Ret (_Tp::*_M_f)(_Arg) const;
5266 };
5267 template<typename _Ret, typename _Tp>
5268 inline mem_fun_t<_Ret, _Tp>
5269 mem_fun(_Ret (_Tp::*__f)())
5270 { return mem_fun_t<_Ret, _Tp>(__f); }
5271 template<typename _Ret, typename _Tp>
5272 inline const_mem_fun_t<_Ret, _Tp>
5273 mem_fun(_Ret (_Tp::*__f)() const)
5274 { return const_mem_fun_t<_Ret, _Tp>(__f); }
5275 template<typename _Ret, typename _Tp>
5276 inline mem_fun_ref_t<_Ret, _Tp>
5277 mem_fun_ref(_Ret (_Tp::*__f)())
5278 { return mem_fun_ref_t<_Ret, _Tp>(__f); }
5279 template<typename _Ret, typename _Tp>
5280 inline const_mem_fun_ref_t<_Ret, _Tp>
5281 mem_fun_ref(_Ret (_Tp::*__f)() const)
5282 { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
5283 template<typename _Ret, typename _Tp, typename _Arg>
5284 inline mem_fun1_t<_Ret, _Tp, _Arg>
5285 mem_fun(_Ret (_Tp::*__f)(_Arg))
5286 { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
5287 template<typename _Ret, typename _Tp, typename _Arg>
5288 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
5289 mem_fun(_Ret (_Tp::*__f)(_Arg) const)
5290 { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
5291 template<typename _Ret, typename _Tp, typename _Arg>
5292 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
5293 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
5294 { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
5295 template<typename _Ret, typename _Tp, typename _Arg>
5296 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
5297 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
5298 { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
5299 }
5300 namespace std __attribute__ ((__visibility__ ("default"))) {
5301 template<typename _Operation>
5302 class binder1st
5303 : public unary_function<typename _Operation::second_argument_type,
5304 typename _Operation::result_type>
5305 {
5306 protected:
5307 _Operation op;
5308 typename _Operation::first_argument_type value;
5309 public:
5310 binder1st(const _Operation& __x,
5311 const typename _Operation::first_argument_type& __y)
5312 : op(__x), value(__y) { }
5313 typename _Operation::result_type
5314 operator()(const typename _Operation::second_argument_type& __x) const
5315 { return op(value, __x); }
5316 typename _Operation::result_type
5317 operator()(typename _Operation::second_argument_type& __x) const
5318 { return op(value, __x); }
5319 } ;
5320 template<typename _Operation, typename _Tp>
5321 inline binder1st<_Operation>
5322 bind1st(const _Operation& __fn, const _Tp& __x)
5323 {
5324 typedef typename _Operation::first_argument_type _Arg1_type;
5325 return binder1st<_Operation>(__fn, _Arg1_type(__x));
5326 }
5327 template<typename _Operation>
5328 class binder2nd
5329 : public unary_function<typename _Operation::first_argument_type,
5330 typename _Operation::result_type>
5331 {
5332 protected:
5333 _Operation op;
5334 typename _Operation::second_argument_type value;
5335 public:
5336 binder2nd(const _Operation& __x,
5337 const typename _Operation::second_argument_type& __y)
5338 : op(__x), value(__y) { }
5339 typename _Operation::result_type
5340 operator()(const typename _Operation::first_argument_type& __x) const
5341 { return op(__x, value); }
5342 typename _Operation::result_type
5343 operator()(typename _Operation::first_argument_type& __x) const
5344 { return op(__x, value); }
5345 } ;
5346 template<typename _Operation, typename _Tp>
5347 inline binder2nd<_Operation>
5348 bind2nd(const _Operation& __fn, const _Tp& __x)
5349 {
5350 typedef typename _Operation::second_argument_type _Arg2_type;
5351 return binder2nd<_Operation>(__fn, _Arg2_type(__x));
5352 }
5353 }
5354 namespace std __attribute__ ((__visibility__ ("default"))) {
5355 template<typename _CharT, typename _Traits, typename _Alloc>
5356 class basic_string
5357 {
5358 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
5359 public:
5360 typedef _Traits traits_type;
5361 typedef typename _Traits::char_type value_type;
5362 typedef _Alloc allocator_type;
5363 typedef typename _CharT_alloc_type::size_type size_type;
5364 typedef typename _CharT_alloc_type::difference_type difference_type;
5365 typedef typename _CharT_alloc_type::reference reference;
5366 typedef typename _CharT_alloc_type::const_reference const_reference;
5367 typedef typename _CharT_alloc_type::pointer pointer;
5368 typedef typename _CharT_alloc_type::const_pointer const_pointer;
5369 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
5370 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
5371 const_iterator;
5372 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
5373 typedef std::reverse_iterator<iterator> reverse_iterator;
5374 private:
5375 struct _Rep_base
5376 {
5377 size_type _M_length;
5378 size_type _M_capacity;
5379 _Atomic_word _M_refcount;
5380 };
5381 struct _Rep : _Rep_base
5382 {
5383 typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
5384 static const size_type _S_max_size;
5385 static const _CharT _S_terminal;
5386 static size_type _S_empty_rep_storage[];
5387 static _Rep&
5388 _S_empty_rep()
5389 {
5390 void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
5391 return *reinterpret_cast<_Rep*>(__p);
5392 }
5393 bool
5394 _M_is_leaked() const
5395 { return this->_M_refcount < 0; }
5396 bool
5397 _M_is_shared() const
5398 { return this->_M_refcount > 0; }
5399 void
5400 _M_set_leaked()
5401 { this->_M_refcount = -1; }
5402 void
5403 _M_set_sharable()
5404 { this->_M_refcount = 0; }
5405 void
5406 _M_set_length_and_sharable(size_type __n)
5407 {
5408 this->_M_set_sharable();
5409 this->_M_length = __n;
5410 traits_type::assign(this->_M_refdata()[__n], _S_terminal);
5411 }
5412 _CharT*
5413 _M_refdata() throw()
5414 { return reinterpret_cast<_CharT*>(this + 1); }
5415 _CharT*
5416 _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2)
5417 {
5418 return (!_M_is_leaked() && __alloc1 == __alloc2)
5419 ? _M_refcopy() : _M_clone(__alloc1);
5420 }
5421 static _Rep*
5422 _S_create(size_type, size_type, const _Alloc&);
5423 void
5424 _M_dispose(const _Alloc& __a)
5425 {
5426 if (__builtin_expect(this != &_S_empty_rep(), false))
5427 if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
5428 -1) <= 0)
5429 _M_destroy(__a);
5430 }
5431 void
5432 _M_destroy(const _Alloc&) throw();
5433 _CharT*
5434 _M_refcopy() throw()
5435 {
5436 if (__builtin_expect(this != &_S_empty_rep(), false))
5437 __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
5438 return _M_refdata();
5439 }
5440 _CharT*
5441 _M_clone(const _Alloc&, size_type __res = 0);
5442 };
5443 struct _Alloc_hider : _Alloc
5444 {
5445 _Alloc_hider(_CharT* __dat, const _Alloc& __a)
5446 : _Alloc(__a), _M_p(__dat) { }
5447 _CharT* _M_p;
5448 };
5449 public:
5450 static const size_type npos = static_cast<size_type>(-1);
5451 private:
5452 mutable _Alloc_hider _M_dataplus;
5453 _CharT*
5454 _M_data() const
5455 { return _M_dataplus._M_p; }
5456 _CharT*
5457 _M_data(_CharT* __p)
5458 { return (_M_dataplus._M_p = __p); }
5459 _Rep*
5460 _M_rep() const
5461 { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
5462 iterator
5463 _M_ibegin() const
5464 { return iterator(_M_data()); }
5465 iterator
5466 _M_iend() const
5467 { return iterator(_M_data() + this->size()); }
5468 void
5469 _M_leak()
5470 {
5471 if (!_M_rep()->_M_is_leaked())
5472 _M_leak_hard();
5473 }
5474 size_type
5475 _M_check(size_type __pos, const char* __s) const
5476 {
5477 if (__pos > this->size())
5478 __throw_out_of_range((__s));
5479 return __pos;
5480 }
5481 void
5482 _M_check_length(size_type __n1, size_type __n2, const char* __s) const
5483 {
5484 if (this->max_size() - (this->size() - __n1) < __n2)
5485 __throw_length_error((__s));
5486 }
5487 size_type
5488 _M_limit(size_type __pos, size_type __off) const
5489 {
5490 const bool __testoff = __off < this->size() - __pos;
5491 return __testoff ? __off : this->size() - __pos;
5492 }
5493 bool
5494 _M_disjunct(const _CharT* __s) const
5495 {
5496 return (less<const _CharT*>()(__s, _M_data())
5497 || less<const _CharT*>()(_M_data() + this->size(), __s));
5498 }
5499 static void
5500 _M_copy(_CharT* __d, const _CharT* __s, size_type __n)
5501 {
5502 if (__n == 1)
5503 traits_type::assign(*__d, *__s);
5504 else
5505 traits_type::copy(__d, __s, __n);
5506 }
5507 static void
5508 _M_move(_CharT* __d, const _CharT* __s, size_type __n)
5509 {
5510 if (__n == 1)
5511 traits_type::assign(*__d, *__s);
5512 else
5513 traits_type::move(__d, __s, __n);
5514 }
5515 static void
5516 _M_assign(_CharT* __d, size_type __n, _CharT __c)
5517 {
5518 if (__n == 1)
5519 traits_type::assign(*__d, __c);
5520 else
5521 traits_type::assign(__d, __n, __c);
5522 }
5523 template<class _Iterator>
5524 static void
5525 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
5526 {
5527 for (; __k1 != __k2; ++__k1, ++__p)
5528 traits_type::assign(*__p, *__k1);
5529 }
5530 static void
5531 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)
5532 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
5533 static void
5534 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
5535 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
5536 static void
5537 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
5538 { _M_copy(__p, __k1, __k2 - __k1); }
5539 static void
5540 _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
5541 { _M_copy(__p, __k1, __k2 - __k1); }
5542 static int
5543 _S_compare(size_type __n1, size_type __n2)
5544 {
5545 const difference_type __d = difference_type(__n1 - __n2);
5546 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
5547 return __gnu_cxx::__numeric_traits<int>::__max;
5548 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
5549 return __gnu_cxx::__numeric_traits<int>::__min;
5550 else
5551 return int(__d);
5552 }
5553 void
5554 _M_mutate(size_type __pos, size_type __len1, size_type __len2);
5555 void
5556 _M_leak_hard();
5557 static _Rep&
5558 _S_empty_rep()
5559 { return _Rep::_S_empty_rep(); }
5560 public:
5561 inline
5562 basic_string();
5563 explicit
5564 basic_string(const _Alloc& __a);
5565 basic_string(const basic_string& __str);
5566 basic_string(const basic_string& __str, size_type __pos,
5567 size_type __n = npos);
5568 basic_string(const basic_string& __str, size_type __pos,
5569 size_type __n, const _Alloc& __a);
5570 basic_string(const _CharT* __s, size_type __n,
5571 const _Alloc& __a = _Alloc());
5572 basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
5573 basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
5574 template<class _InputIterator>
5575 basic_string(_InputIterator __beg, _InputIterator __end,
5576 const _Alloc& __a = _Alloc());
5577 ~basic_string()
5578 { _M_rep()->_M_dispose(this->get_allocator()); }
5579 basic_string&
5580 operator=(const basic_string& __str)
5581 { return this->assign(__str); }
5582 basic_string&
5583 operator=(const _CharT* __s)
5584 { return this->assign(__s); }
5585 basic_string&
5586 operator=(_CharT __c)
5587 {
5588 this->assign(1, __c);
5589 return *this;
5590 }
5591 iterator
5592 begin()
5593 {
5594 _M_leak();
5595 return iterator(_M_data());
5596 }
5597 const_iterator
5598 begin() const
5599 { return const_iterator(_M_data()); }
5600 iterator
5601 end()
5602 {
5603 _M_leak();
5604 return iterator(_M_data() + this->size());
5605 }
5606 const_iterator
5607 end() const
5608 { return const_iterator(_M_data() + this->size()); }
5609 reverse_iterator
5610 rbegin()
5611 { return reverse_iterator(this->end()); }
5612 const_reverse_iterator
5613 rbegin() const
5614 { return const_reverse_iterator(this->end()); }
5615 reverse_iterator
5616 rend()
5617 { return reverse_iterator(this->begin()); }
5618 const_reverse_iterator
5619 rend() const
5620 { return const_reverse_iterator(this->begin()); }
5621 public:
5622 size_type
5623 size() const
5624 { return _M_rep()->_M_length; }
5625 size_type
5626 length() const
5627 { return _M_rep()->_M_length; }
5628 size_type
5629 max_size() const
5630 { return _Rep::_S_max_size; }
5631 void
5632 resize(size_type __n, _CharT __c);
5633 void
5634 resize(size_type __n)
5635 { this->resize(__n, _CharT()); }
5636 size_type
5637 capacity() const
5638 { return _M_rep()->_M_capacity; }
5639 void
5640 reserve(size_type __res_arg = 0);
5641 void
5642 clear()
5643 { _M_mutate(0, this->size(), 0); }
5644 bool
5645 empty() const
5646 { return this->size() == 0; }
5647 const_reference
5648 operator[] (size_type __pos) const
5649 {
5650 ;
5651 return _M_data()[__pos];
5652 }
5653 reference
5654 operator[](size_type __pos)
5655 {
5656 ;
5657 ;
5658 _M_leak();
5659 return _M_data()[__pos];
5660 }
5661 const_reference
5662 at(size_type __n) const
5663 {
5664 if (__n >= this->size())
5665 __throw_out_of_range(("basic_string::at"));
5666 return _M_data()[__n];
5667 }
5668 reference
5669 at(size_type __n)
5670 {
5671 if (__n >= size())
5672 __throw_out_of_range(("basic_string::at"));
5673 _M_leak();
5674 return _M_data()[__n];
5675 }
5676 basic_string&
5677 operator+=(const basic_string& __str)
5678 { return this->append(__str); }
5679 basic_string&
5680 operator+=(const _CharT* __s)
5681 { return this->append(__s); }
5682 basic_string&
5683 operator+=(_CharT __c)
5684 {
5685 this->push_back(__c);
5686 return *this;
5687 }
5688 basic_string&
5689 append(const basic_string& __str);
5690 basic_string&
5691 append(const basic_string& __str, size_type __pos, size_type __n);
5692 basic_string&
5693 append(const _CharT* __s, size_type __n);
5694 basic_string&
5695 append(const _CharT* __s)
5696 {
5697 ;
5698 return this->append(__s, traits_type::length(__s));
5699 }
5700 basic_string&
5701 append(size_type __n, _CharT __c);
5702 template<class _InputIterator>
5703 basic_string&
5704 append(_InputIterator __first, _InputIterator __last)
5705 { return this->replace(_M_iend(), _M_iend(), __first, __last); }
5706 void
5707 push_back(_CharT __c)
5708 {
5709 const size_type __len = 1 + this->size();
5710 if (__len > this->capacity() || _M_rep()->_M_is_shared())
5711 this->reserve(__len);
5712 traits_type::assign(_M_data()[this->size()], __c);
5713 _M_rep()->_M_set_length_and_sharable(__len);
5714 }
5715 basic_string&
5716 assign(const basic_string& __str);
5717 basic_string&
5718 assign(const basic_string& __str, size_type __pos, size_type __n)
5719 { return this->assign(__str._M_data()
5720 + __str._M_check(__pos, "basic_string::assign"),
5721 __str._M_limit(__pos, __n)); }
5722 basic_string&
5723 assign(const _CharT* __s, size_type __n);
5724 basic_string&
5725 assign(const _CharT* __s)
5726 {
5727 ;
5728 return this->assign(__s, traits_type::length(__s));
5729 }
5730 basic_string&
5731 assign(size_type __n, _CharT __c)
5732 { return _M_replace_aux(size_type(0), this->size(), __n, __c); }
5733 template<class _InputIterator>
5734 basic_string&
5735 assign(_InputIterator __first, _InputIterator __last)
5736 { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
5737 void
5738 insert(iterator __p, size_type __n, _CharT __c)
5739 { this->replace(__p, __p, __n, __c); }
5740 template<class _InputIterator>
5741 void
5742 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
5743 { this->replace(__p, __p, __beg, __end); }
5744 basic_string&
5745 insert(size_type __pos1, const basic_string& __str)
5746 { return this->insert(__pos1, __str, size_type(0), __str.size()); }
5747 basic_string&
5748 insert(size_type __pos1, const basic_string& __str,
5749 size_type __pos2, size_type __n)
5750 { return this->insert(__pos1, __str._M_data()
5751 + __str._M_check(__pos2, "basic_string::insert"),
5752 __str._M_limit(__pos2, __n)); }
5753 basic_string&
5754 insert(size_type __pos, const _CharT* __s, size_type __n);
5755 basic_string&
5756 insert(size_type __pos, const _CharT* __s)
5757 {
5758 ;
5759 return this->insert(__pos, __s, traits_type::length(__s));
5760 }
5761 basic_string&
5762 insert(size_type __pos, size_type __n, _CharT __c)
5763 { return _M_replace_aux(_M_check(__pos, "basic_string::insert"),
5764 size_type(0), __n, __c); }
5765 iterator
5766 insert(iterator __p, _CharT __c)
5767 {
5768 ;
5769 const size_type __pos = __p - _M_ibegin();
5770 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
5771 _M_rep()->_M_set_leaked();
5772 return iterator(_M_data() + __pos);
5773 }
5774 basic_string&
5775 erase(size_type __pos = 0, size_type __n = npos)
5776 {
5777 _M_mutate(_M_check(__pos, "basic_string::erase"),
5778 _M_limit(__pos, __n), size_type(0));
5779 return *this;
5780 }
5781 iterator
5782 erase(iterator __position)
5783 {
5784 ;
5785 const size_type __pos = __position - _M_ibegin();
5786 _M_mutate(__pos, size_type(1), size_type(0));
5787 _M_rep()->_M_set_leaked();
5788 return iterator(_M_data() + __pos);
5789 }
5790 iterator
5791 erase(iterator __first, iterator __last)
5792 {
5793 ;
5794 const size_type __pos = __first - _M_ibegin();
5795 _M_mutate(__pos, __last - __first, size_type(0));
5796 _M_rep()->_M_set_leaked();
5797 return iterator(_M_data() + __pos);
5798 }
5799 basic_string&
5800 replace(size_type __pos, size_type __n, const basic_string& __str)
5801 { return this->replace(__pos, __n, __str._M_data(), __str.size()); }
5802 basic_string&
5803 replace(size_type __pos1, size_type __n1, const basic_string& __str,
5804 size_type __pos2, size_type __n2)
5805 { return this->replace(__pos1, __n1, __str._M_data()
5806 + __str._M_check(__pos2, "basic_string::replace"),
5807 __str._M_limit(__pos2, __n2)); }
5808 basic_string&
5809 replace(size_type __pos, size_type __n1, const _CharT* __s,
5810 size_type __n2);
5811 basic_string&
5812 replace(size_type __pos, size_type __n1, const _CharT* __s)
5813 {
5814 ;
5815 return this->replace(__pos, __n1, __s, traits_type::length(__s));
5816 }
5817 basic_string&
5818 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
5819 { return _M_replace_aux(_M_check(__pos, "basic_string::replace"),
5820 _M_limit(__pos, __n1), __n2, __c); }
5821 basic_string&
5822 replace(iterator __i1, iterator __i2, const basic_string& __str)
5823 { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
5824 basic_string&
5825 replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
5826 {
5827 ;
5828 return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
5829 }
5830 basic_string&
5831 replace(iterator __i1, iterator __i2, const _CharT* __s)
5832 {
5833 ;
5834 return this->replace(__i1, __i2, __s, traits_type::length(__s));
5835 }
5836 basic_string&
5837 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
5838 {
5839 ;
5840 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
5841 }
5842 template<class _InputIterator>
5843 basic_string&
5844 replace(iterator __i1, iterator __i2,
5845 _InputIterator __k1, _InputIterator __k2)
5846 {
5847 ;
5848 ;
5849 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
5850 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
5851 }
5852 basic_string&
5853 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
5854 {
5855 ;
5856 ;
5857 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
5858 __k1, __k2 - __k1);
5859 }
5860 basic_string&
5861 replace(iterator __i1, iterator __i2,
5862 const _CharT* __k1, const _CharT* __k2)
5863 {
5864 ;
5865 ;
5866 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
5867 __k1, __k2 - __k1);
5868 }
5869 basic_string&
5870 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
5871 {
5872 ;
5873 ;
5874 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
5875 __k1.base(), __k2 - __k1);
5876 }
5877 basic_string&
5878 replace(iterator __i1, iterator __i2,
5879 const_iterator __k1, const_iterator __k2)
5880 {
5881 ;
5882 ;
5883 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
5884 __k1.base(), __k2 - __k1);
5885 }
5886 private:
5887 template<class _Integer>
5888 basic_string&
5889 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
5890 _Integer __val, __true_type)
5891 { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
5892 template<class _InputIterator>
5893 basic_string&
5894 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
5895 _InputIterator __k2, __false_type);
5896 basic_string&
5897 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
5898 _CharT __c);
5899 basic_string&
5900 _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
5901 size_type __n2);
5902 template<class _InIterator>
5903 static _CharT*
5904 _S_construct_aux(_InIterator __beg, _InIterator __end,
5905 const _Alloc& __a, __false_type)
5906 {
5907 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
5908 return _S_construct(__beg, __end, __a, _Tag());
5909 }
5910 template<class _Integer>
5911 static _CharT*
5912 _S_construct_aux(_Integer __beg, _Integer __end,
5913 const _Alloc& __a, __true_type)
5914 { return _S_construct(static_cast<size_type>(__beg), __end, __a); }
5915 template<class _InIterator>
5916 static _CharT*
5917 _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
5918 {
5919 typedef typename std::__is_integer<_InIterator>::__type _Integral;
5920 return _S_construct_aux(__beg, __end, __a, _Integral());
5921 }
5922 template<class _InIterator>
5923 static _CharT*
5924 _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
5925 input_iterator_tag);
5926 template<class _FwdIterator>
5927 static _CharT*
5928 _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,
5929 forward_iterator_tag);
5930 static _CharT*
5931 _S_construct(size_type __req, _CharT __c, const _Alloc& __a);
5932 public:
5933 size_type
5934 copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
5935 void
5936 swap(basic_string& __s);
5937 const _CharT*
5938 c_str() const
5939 { return _M_data(); }
5940 const _CharT*
5941 data() const
5942 { return _M_data(); }
5943 allocator_type
5944 get_allocator() const
5945 { return _M_dataplus; }
5946 size_type
5947 find(const _CharT* __s, size_type __pos, size_type __n) const;
5948 size_type
5949 find(const basic_string& __str, size_type __pos = 0) const
5950 { return this->find(__str.data(), __pos, __str.size()); }
5951 size_type
5952 find(const _CharT* __s, size_type __pos = 0) const
5953 {
5954 ;
5955 return this->find(__s, __pos, traits_type::length(__s));
5956 }
5957 size_type
5958 find(_CharT __c, size_type __pos = 0) const;
5959 size_type
5960 rfind(const basic_string& __str, size_type __pos = npos) const
5961 { return this->rfind(__str.data(), __pos, __str.size()); }
5962 size_type
5963 rfind(const _CharT* __s, size_type __pos, size_type __n) const;
5964 size_type
5965 rfind(const _CharT* __s, size_type __pos = npos) const
5966 {
5967 ;
5968 return this->rfind(__s, __pos, traits_type::length(__s));
5969 }
5970 size_type
5971 rfind(_CharT __c, size_type __pos = npos) const;
5972 size_type
5973 find_first_of(const basic_string& __str, size_type __pos = 0) const
5974 { return this->find_first_of(__str.data(), __pos, __str.size()); }
5975 size_type
5976 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
5977 size_type
5978 find_first_of(const _CharT* __s, size_type __pos = 0) const
5979 {
5980 ;
5981 return this->find_first_of(__s, __pos, traits_type::length(__s));
5982 }
5983 size_type
5984 find_first_of(_CharT __c, size_type __pos = 0) const
5985 { return this->find(__c, __pos); }
5986 size_type
5987 find_last_of(const basic_string& __str, size_type __pos = npos) const
5988 { return this->find_last_of(__str.data(), __pos, __str.size()); }
5989 size_type
5990 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
5991 size_type
5992 find_last_of(const _CharT* __s, size_type __pos = npos) const
5993 {
5994 ;
5995 return this->find_last_of(__s, __pos, traits_type::length(__s));
5996 }
5997 size_type
5998 find_last_of(_CharT __c, size_type __pos = npos) const
5999 { return this->rfind(__c, __pos); }
6000 size_type
6001 find_first_not_of(const basic_string& __str, size_type __pos = 0) const
6002 { return this->find_first_not_of(__str.data(), __pos, __str.size()); }
6003 size_type
6004 find_first_not_of(const _CharT* __s, size_type __pos,
6005 size_type __n) const;
6006 size_type
6007 find_first_not_of(const _CharT* __s, size_type __pos = 0) const
6008 {
6009 ;
6010 return this->find_first_not_of(__s, __pos, traits_type::length(__s));
6011 }
6012 size_type
6013 find_first_not_of(_CharT __c, size_type __pos = 0) const;
6014 size_type
6015 find_last_not_of(const basic_string& __str, size_type __pos = npos) const
6016 { return this->find_last_not_of(__str.data(), __pos, __str.size()); }
6017 size_type
6018 find_last_not_of(const _CharT* __s, size_type __pos,
6019 size_type __n) const;
6020 size_type
6021 find_last_not_of(const _CharT* __s, size_type __pos = npos) const
6022 {
6023 ;
6024 return this->find_last_not_of(__s, __pos, traits_type::length(__s));
6025 }
6026 size_type
6027 find_last_not_of(_CharT __c, size_type __pos = npos) const;
6028 basic_string
6029 substr(size_type __pos = 0, size_type __n = npos) const
6030 { return basic_string(*this,
6031 _M_check(__pos, "basic_string::substr"), __n); }
6032 int
6033 compare(const basic_string& __str) const
6034 {
6035 const size_type __size = this->size();
6036 const size_type __osize = __str.size();
6037 const size_type __len = std::min(__size, __osize);
6038 int __r = traits_type::compare(_M_data(), __str.data(), __len);
6039 if (!__r)
6040 __r = _S_compare(__size, __osize);
6041 return __r;
6042 }
6043 int
6044 compare(size_type __pos, size_type __n, const basic_string& __str) const;
6045 int
6046 compare(size_type __pos1, size_type __n1, const basic_string& __str,
6047 size_type __pos2, size_type __n2) const;
6048 int
6049 compare(const _CharT* __s) const;
6050 int
6051 compare(size_type __pos, size_type __n1, const _CharT* __s) const;
6052 int
6053 compare(size_type __pos, size_type __n1, const _CharT* __s,
6054 size_type __n2) const;
6055 };
6056 template<typename _CharT, typename _Traits, typename _Alloc>
6057 inline basic_string<_CharT, _Traits, _Alloc>::
6058 basic_string()
6059 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
6060 template<typename _CharT, typename _Traits, typename _Alloc>
6061 basic_string<_CharT, _Traits, _Alloc>
6062 operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6063 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6064 {
6065 basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
6066 __str.append(__rhs);
6067 return __str;
6068 }
6069 template<typename _CharT, typename _Traits, typename _Alloc>
6070 basic_string<_CharT,_Traits,_Alloc>
6071 operator+(const _CharT* __lhs,
6072 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
6073 template<typename _CharT, typename _Traits, typename _Alloc>
6074 basic_string<_CharT,_Traits,_Alloc>
6075 operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs);
6076 template<typename _CharT, typename _Traits, typename _Alloc>
6077 inline basic_string<_CharT, _Traits, _Alloc>
6078 operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6079 const _CharT* __rhs)
6080 {
6081 basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
6082 __str.append(__rhs);
6083 return __str;
6084 }
6085 template<typename _CharT, typename _Traits, typename _Alloc>
6086 inline basic_string<_CharT, _Traits, _Alloc>
6087 operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
6088 {
6089 typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
6090 typedef typename __string_type::size_type __size_type;
6091 __string_type __str(__lhs);
6092 __str.append(__size_type(1), __rhs);
6093 return __str;
6094 }
6095 template<typename _CharT, typename _Traits, typename _Alloc>
6096 inline bool
6097 operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6098 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6099 { return __lhs.compare(__rhs) == 0; }
6100 template<typename _CharT>
6101 inline
6102 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type
6103 operator==(const basic_string<_CharT>& __lhs,
6104 const basic_string<_CharT>& __rhs)
6105 { return (__lhs.size() == __rhs.size()
6106 && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(),
6107 __lhs.size())); }
6108 template<typename _CharT, typename _Traits, typename _Alloc>
6109 inline bool
6110 operator==(const _CharT* __lhs,
6111 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6112 { return __rhs.compare(__lhs) == 0; }
6113 template<typename _CharT, typename _Traits, typename _Alloc>
6114 inline bool
6115 operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6116 const _CharT* __rhs)
6117 { return __lhs.compare(__rhs) == 0; }
6118 template<typename _CharT, typename _Traits, typename _Alloc>
6119 inline bool
6120 operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6121 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6122 { return !(__lhs == __rhs); }
6123 template<typename _CharT, typename _Traits, typename _Alloc>
6124 inline bool
6125 operator!=(const _CharT* __lhs,
6126 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6127 { return !(__lhs == __rhs); }
6128 template<typename _CharT, typename _Traits, typename _Alloc>
6129 inline bool
6130 operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6131 const _CharT* __rhs)
6132 { return !(__lhs == __rhs); }
6133 template<typename _CharT, typename _Traits, typename _Alloc>
6134 inline bool
6135 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6136 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6137 { return __lhs.compare(__rhs) < 0; }
6138 template<typename _CharT, typename _Traits, typename _Alloc>
6139 inline bool
6140 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6141 const _CharT* __rhs)
6142 { return __lhs.compare(__rhs) < 0; }
6143 template<typename _CharT, typename _Traits, typename _Alloc>
6144 inline bool
6145 operator<(const _CharT* __lhs,
6146 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6147 { return __rhs.compare(__lhs) > 0; }
6148 template<typename _CharT, typename _Traits, typename _Alloc>
6149 inline bool
6150 operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6151 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6152 { return __lhs.compare(__rhs) > 0; }
6153 template<typename _CharT, typename _Traits, typename _Alloc>
6154 inline bool
6155 operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6156 const _CharT* __rhs)
6157 { return __lhs.compare(__rhs) > 0; }
6158 template<typename _CharT, typename _Traits, typename _Alloc>
6159 inline bool
6160 operator>(const _CharT* __lhs,
6161 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6162 { return __rhs.compare(__lhs) < 0; }
6163 template<typename _CharT, typename _Traits, typename _Alloc>
6164 inline bool
6165 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6166 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6167 { return __lhs.compare(__rhs) <= 0; }
6168 template<typename _CharT, typename _Traits, typename _Alloc>
6169 inline bool
6170 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6171 const _CharT* __rhs)
6172 { return __lhs.compare(__rhs) <= 0; }
6173 template<typename _CharT, typename _Traits, typename _Alloc>
6174 inline bool
6175 operator<=(const _CharT* __lhs,
6176 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6177 { return __rhs.compare(__lhs) >= 0; }
6178 template<typename _CharT, typename _Traits, typename _Alloc>
6179 inline bool
6180 operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6181 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6182 { return __lhs.compare(__rhs) >= 0; }
6183 template<typename _CharT, typename _Traits, typename _Alloc>
6184 inline bool
6185 operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
6186 const _CharT* __rhs)
6187 { return __lhs.compare(__rhs) >= 0; }
6188 template<typename _CharT, typename _Traits, typename _Alloc>
6189 inline bool
6190 operator>=(const _CharT* __lhs,
6191 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6192 { return __rhs.compare(__lhs) <= 0; }
6193 template<typename _CharT, typename _Traits, typename _Alloc>
6194 inline void
6195 swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
6196 basic_string<_CharT, _Traits, _Alloc>& __rhs)
6197 { __lhs.swap(__rhs); }
6198 template<typename _CharT, typename _Traits, typename _Alloc>
6199 basic_istream<_CharT, _Traits>&
6200 operator>>(basic_istream<_CharT, _Traits>& __is,
6201 basic_string<_CharT, _Traits, _Alloc>& __str);
6202 template<>
6203 basic_istream<char>&
6204 operator>>(basic_istream<char>& __is, basic_string<char>& __str);
6205 template<typename _CharT, typename _Traits, typename _Alloc>
6206 inline basic_ostream<_CharT, _Traits>&
6207 operator<<(basic_ostream<_CharT, _Traits>& __os,
6208 const basic_string<_CharT, _Traits, _Alloc>& __str)
6209 {
6210 return __ostream_insert(__os, __str.data(), __str.size());
6211 }
6212 template<typename _CharT, typename _Traits, typename _Alloc>
6213 basic_istream<_CharT, _Traits>&
6214 getline(basic_istream<_CharT, _Traits>& __is,
6215 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
6216 template<typename _CharT, typename _Traits, typename _Alloc>
6217 inline basic_istream<_CharT, _Traits>&
6218 getline(basic_istream<_CharT, _Traits>& __is,
6219 basic_string<_CharT, _Traits, _Alloc>& __str)
6220 { return getline(__is, __str, __is.widen('\n')); }
6221 template<>
6222 basic_istream<char>&
6223 getline(basic_istream<char>& __in, basic_string<char>& __str,
6224 char __delim);
6225 }
6226 namespace std __attribute__ ((__visibility__ ("default"))) {
6227 template<typename _CharT, typename _Traits, typename _Alloc>
6228 const typename basic_string<_CharT, _Traits, _Alloc>::size_type
6229 basic_string<_CharT, _Traits, _Alloc>::
6230 _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;
6231 template<typename _CharT, typename _Traits, typename _Alloc>
6232 const _CharT
6233 basic_string<_CharT, _Traits, _Alloc>::
6234 _Rep::_S_terminal = _CharT();
6235 template<typename _CharT, typename _Traits, typename _Alloc>
6236 const typename basic_string<_CharT, _Traits, _Alloc>::size_type
6237 basic_string<_CharT, _Traits, _Alloc>::npos;
6238 template<typename _CharT, typename _Traits, typename _Alloc>
6239 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6240 basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[
6241 (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) /
6242 sizeof(size_type)];
6243 template<typename _CharT, typename _Traits, typename _Alloc>
6244 template<typename _InIterator>
6245 _CharT*
6246 basic_string<_CharT, _Traits, _Alloc>::
6247 _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
6248 input_iterator_tag)
6249 {
6250 if (__beg == __end && __a == _Alloc())
6251 return _S_empty_rep()._M_refdata();
6252 _CharT __buf[128];
6253 size_type __len = 0;
6254 while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))
6255 {
6256 __buf[__len++] = *__beg;
6257 ++__beg;
6258 }
6259 _Rep* __r = _Rep::_S_create(__len, size_type(0), __a);
6260 _M_copy(__r->_M_refdata(), __buf, __len);
6261 try
6262 {
6263 while (__beg != __end)
6264 {
6265 if (__len == __r->_M_capacity)
6266 {
6267 _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);
6268 _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len);
6269 __r->_M_destroy(__a);
6270 __r = __another;
6271 }
6272 __r->_M_refdata()[__len++] = *__beg;
6273 ++__beg;
6274 }
6275 }
6276 catch(...)
6277 {
6278 __r->_M_destroy(__a);
6279 throw;
6280 }
6281 __r->_M_set_length_and_sharable(__len);
6282 return __r->_M_refdata();
6283 }
6284 template<typename _CharT, typename _Traits, typename _Alloc>
6285 template <typename _InIterator>
6286 _CharT*
6287 basic_string<_CharT, _Traits, _Alloc>::
6288 _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
6289 forward_iterator_tag)
6290 {
6291 if (__beg == __end && __a == _Alloc())
6292 return _S_empty_rep()._M_refdata();
6293 if (__builtin_expect(__gnu_cxx::__is_null_pointer(__beg)
6294 && __beg != __end, 0))
6295 __throw_logic_error(("basic_string::_S_construct NULL not valid"));
6296 const size_type __dnew = static_cast<size_type>(std::distance(__beg,
6297 __end));
6298 _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
6299 try
6300 { _S_copy_chars(__r->_M_refdata(), __beg, __end); }
6301 catch(...)
6302 {
6303 __r->_M_destroy(__a);
6304 throw;
6305 }
6306 __r->_M_set_length_and_sharable(__dnew);
6307 return __r->_M_refdata();
6308 }
6309 template<typename _CharT, typename _Traits, typename _Alloc>
6310 _CharT*
6311 basic_string<_CharT, _Traits, _Alloc>::
6312 _S_construct(size_type __n, _CharT __c, const _Alloc& __a)
6313 {
6314 if (__n == 0 && __a == _Alloc())
6315 return _S_empty_rep()._M_refdata();
6316 _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
6317 if (__n)
6318 _M_assign(__r->_M_refdata(), __n, __c);
6319 __r->_M_set_length_and_sharable(__n);
6320 return __r->_M_refdata();
6321 }
6322 template<typename _CharT, typename _Traits, typename _Alloc>
6323 basic_string<_CharT, _Traits, _Alloc>::
6324 basic_string(const basic_string& __str)
6325 : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()),
6326 __str.get_allocator()),
6327 __str.get_allocator())
6328 { }
6329 template<typename _CharT, typename _Traits, typename _Alloc>
6330 basic_string<_CharT, _Traits, _Alloc>::
6331 basic_string(const _Alloc& __a)
6332 : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)
6333 { }
6334 template<typename _CharT, typename _Traits, typename _Alloc>
6335 basic_string<_CharT, _Traits, _Alloc>::
6336 basic_string(const basic_string& __str, size_type __pos, size_type __n)
6337 : _M_dataplus(_S_construct(__str._M_data()
6338 + __str._M_check(__pos,
6339 "basic_string::basic_string"),
6340 __str._M_data() + __str._M_limit(__pos, __n)
6341 + __pos, _Alloc()), _Alloc())
6342 { }
6343 template<typename _CharT, typename _Traits, typename _Alloc>
6344 basic_string<_CharT, _Traits, _Alloc>::
6345 basic_string(const basic_string& __str, size_type __pos,
6346 size_type __n, const _Alloc& __a)
6347 : _M_dataplus(_S_construct(__str._M_data()
6348 + __str._M_check(__pos,
6349 "basic_string::basic_string"),
6350 __str._M_data() + __str._M_limit(__pos, __n)
6351 + __pos, __a), __a)
6352 { }
6353 template<typename _CharT, typename _Traits, typename _Alloc>
6354 basic_string<_CharT, _Traits, _Alloc>::
6355 basic_string(const _CharT* __s, size_type __n, const _Alloc& __a)
6356 : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)
6357 { }
6358 template<typename _CharT, typename _Traits, typename _Alloc>
6359 basic_string<_CharT, _Traits, _Alloc>::
6360 basic_string(const _CharT* __s, const _Alloc& __a)
6361 : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :
6362 __s + npos, __a), __a)
6363 { }
6364 template<typename _CharT, typename _Traits, typename _Alloc>
6365 basic_string<_CharT, _Traits, _Alloc>::
6366 basic_string(size_type __n, _CharT __c, const _Alloc& __a)
6367 : _M_dataplus(_S_construct(__n, __c, __a), __a)
6368 { }
6369 template<typename _CharT, typename _Traits, typename _Alloc>
6370 template<typename _InputIterator>
6371 basic_string<_CharT, _Traits, _Alloc>::
6372 basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a)
6373 : _M_dataplus(_S_construct(__beg, __end, __a), __a)
6374 { }
6375 template<typename _CharT, typename _Traits, typename _Alloc>
6376 basic_string<_CharT, _Traits, _Alloc>&
6377 basic_string<_CharT, _Traits, _Alloc>::
6378 assign(const basic_string& __str)
6379 {
6380 if (_M_rep() != __str._M_rep())
6381 {
6382 const allocator_type __a = this->get_allocator();
6383 _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());
6384 _M_rep()->_M_dispose(__a);
6385 _M_data(__tmp);
6386 }
6387 return *this;
6388 }
6389 template<typename _CharT, typename _Traits, typename _Alloc>
6390 basic_string<_CharT, _Traits, _Alloc>&
6391 basic_string<_CharT, _Traits, _Alloc>::
6392 assign(const _CharT* __s, size_type __n)
6393 {
6394 ;
6395 _M_check_length(this->size(), __n, "basic_string::assign");
6396 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
6397 return _M_replace_safe(size_type(0), this->size(), __s, __n);
6398 else
6399 {
6400 const size_type __pos = __s - _M_data();
6401 if (__pos >= __n)
6402 _M_copy(_M_data(), __s, __n);
6403 else if (__pos)
6404 _M_move(_M_data(), __s, __n);
6405 _M_rep()->_M_set_length_and_sharable(__n);
6406 return *this;
6407 }
6408 }
6409 template<typename _CharT, typename _Traits, typename _Alloc>
6410 basic_string<_CharT, _Traits, _Alloc>&
6411 basic_string<_CharT, _Traits, _Alloc>::
6412 append(size_type __n, _CharT __c)
6413 {
6414 if (__n)
6415 {
6416 _M_check_length(size_type(0), __n, "basic_string::append");
6417 const size_type __len = __n + this->size();
6418 if (__len > this->capacity() || _M_rep()->_M_is_shared())
6419 this->reserve(__len);
6420 _M_assign(_M_data() + this->size(), __n, __c);
6421 _M_rep()->_M_set_length_and_sharable(__len);
6422 }
6423 return *this;
6424 }
6425 template<typename _CharT, typename _Traits, typename _Alloc>
6426 basic_string<_CharT, _Traits, _Alloc>&
6427 basic_string<_CharT, _Traits, _Alloc>::
6428 append(const _CharT* __s, size_type __n)
6429 {
6430 ;
6431 if (__n)
6432 {
6433 _M_check_length(size_type(0), __n, "basic_string::append");
6434 const size_type __len = __n + this->size();
6435 if (__len > this->capacity() || _M_rep()->_M_is_shared())
6436 {
6437 if (_M_disjunct(__s))
6438 this->reserve(__len);
6439 else
6440 {
6441 const size_type __off = __s - _M_data();
6442 this->reserve(__len);
6443 __s = _M_data() + __off;
6444 }
6445 }
6446 _M_copy(_M_data() + this->size(), __s, __n);
6447 _M_rep()->_M_set_length_and_sharable(__len);
6448 }
6449 return *this;
6450 }
6451 template<typename _CharT, typename _Traits, typename _Alloc>
6452 basic_string<_CharT, _Traits, _Alloc>&
6453 basic_string<_CharT, _Traits, _Alloc>::
6454 append(const basic_string& __str)
6455 {
6456 const size_type __size = __str.size();
6457 if (__size)
6458 {
6459 const size_type __len = __size + this->size();
6460 if (__len > this->capacity() || _M_rep()->_M_is_shared())
6461 this->reserve(__len);
6462 _M_copy(_M_data() + this->size(), __str._M_data(), __size);
6463 _M_rep()->_M_set_length_and_sharable(__len);
6464 }
6465 return *this;
6466 }
6467 template<typename _CharT, typename _Traits, typename _Alloc>
6468 basic_string<_CharT, _Traits, _Alloc>&
6469 basic_string<_CharT, _Traits, _Alloc>::
6470 append(const basic_string& __str, size_type __pos, size_type __n)
6471 {
6472 __str._M_check(__pos, "basic_string::append");
6473 __n = __str._M_limit(__pos, __n);
6474 if (__n)
6475 {
6476 const size_type __len = __n + this->size();
6477 if (__len > this->capacity() || _M_rep()->_M_is_shared())
6478 this->reserve(__len);
6479 _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n);
6480 _M_rep()->_M_set_length_and_sharable(__len);
6481 }
6482 return *this;
6483 }
6484 template<typename _CharT, typename _Traits, typename _Alloc>
6485 basic_string<_CharT, _Traits, _Alloc>&
6486 basic_string<_CharT, _Traits, _Alloc>::
6487 insert(size_type __pos, const _CharT* __s, size_type __n)
6488 {
6489 ;
6490 _M_check(__pos, "basic_string::insert");
6491 _M_check_length(size_type(0), __n, "basic_string::insert");
6492 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
6493 return _M_replace_safe(__pos, size_type(0), __s, __n);
6494 else
6495 {
6496 const size_type __off = __s - _M_data();
6497 _M_mutate(__pos, 0, __n);
6498 __s = _M_data() + __off;
6499 _CharT* __p = _M_data() + __pos;
6500 if (__s + __n <= __p)
6501 _M_copy(__p, __s, __n);
6502 else if (__s >= __p)
6503 _M_copy(__p, __s + __n, __n);
6504 else
6505 {
6506 const size_type __nleft = __p - __s;
6507 _M_copy(__p, __s, __nleft);
6508 _M_copy(__p + __nleft, __p + __n, __n - __nleft);
6509 }
6510 return *this;
6511 }
6512 }
6513 template<typename _CharT, typename _Traits, typename _Alloc>
6514 basic_string<_CharT, _Traits, _Alloc>&
6515 basic_string<_CharT, _Traits, _Alloc>::
6516 replace(size_type __pos, size_type __n1, const _CharT* __s,
6517 size_type __n2)
6518 {
6519 ;
6520 _M_check(__pos, "basic_string::replace");
6521 __n1 = _M_limit(__pos, __n1);
6522 _M_check_length(__n1, __n2, "basic_string::replace");
6523 bool __left;
6524 if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
6525 return _M_replace_safe(__pos, __n1, __s, __n2);
6526 else if ((__left = __s + __n2 <= _M_data() + __pos)
6527 || _M_data() + __pos + __n1 <= __s)
6528 {
6529 size_type __off = __s - _M_data();
6530 __left ? __off : (__off += __n2 - __n1);
6531 _M_mutate(__pos, __n1, __n2);
6532 _M_copy(_M_data() + __pos, _M_data() + __off, __n2);
6533 return *this;
6534 }
6535 else
6536 {
6537 const basic_string __tmp(__s, __n2);
6538 return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2);
6539 }
6540 }
6541 template<typename _CharT, typename _Traits, typename _Alloc>
6542 void
6543 basic_string<_CharT, _Traits, _Alloc>::_Rep::
6544 _M_destroy(const _Alloc& __a) throw ()
6545 {
6546 const size_type __size = sizeof(_Rep_base) +
6547 (this->_M_capacity + 1) * sizeof(_CharT);
6548 _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
6549 }
6550 template<typename _CharT, typename _Traits, typename _Alloc>
6551 void
6552 basic_string<_CharT, _Traits, _Alloc>::
6553 _M_leak_hard()
6554 {
6555 if (_M_rep() == &_S_empty_rep())
6556 return;
6557 if (_M_rep()->_M_is_shared())
6558 _M_mutate(0, 0, 0);
6559 _M_rep()->_M_set_leaked();
6560 }
6561 template<typename _CharT, typename _Traits, typename _Alloc>
6562 void
6563 basic_string<_CharT, _Traits, _Alloc>::
6564 _M_mutate(size_type __pos, size_type __len1, size_type __len2)
6565 {
6566 const size_type __old_size = this->size();
6567 const size_type __new_size = __old_size + __len2 - __len1;
6568 const size_type __how_much = __old_size - __pos - __len1;
6569 if (__new_size > this->capacity() || _M_rep()->_M_is_shared())
6570 {
6571 const allocator_type __a = get_allocator();
6572 _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a);
6573 if (__pos)
6574 _M_copy(__r->_M_refdata(), _M_data(), __pos);
6575 if (__how_much)
6576 _M_copy(__r->_M_refdata() + __pos + __len2,
6577 _M_data() + __pos + __len1, __how_much);
6578 _M_rep()->_M_dispose(__a);
6579 _M_data(__r->_M_refdata());
6580 }
6581 else if (__how_much && __len1 != __len2)
6582 {
6583 _M_move(_M_data() + __pos + __len2,
6584 _M_data() + __pos + __len1, __how_much);
6585 }
6586 _M_rep()->_M_set_length_and_sharable(__new_size);
6587 }
6588 template<typename _CharT, typename _Traits, typename _Alloc>
6589 void
6590 basic_string<_CharT, _Traits, _Alloc>::
6591 reserve(size_type __res)
6592 {
6593 if (__res != this->capacity() || _M_rep()->_M_is_shared())
6594 {
6595 if (__res < this->size())
6596 __res = this->size();
6597 const allocator_type __a = get_allocator();
6598 _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());
6599 _M_rep()->_M_dispose(__a);
6600 _M_data(__tmp);
6601 }
6602 }
6603 template<typename _CharT, typename _Traits, typename _Alloc>
6604 void
6605 basic_string<_CharT, _Traits, _Alloc>::
6606 swap(basic_string& __s)
6607 {
6608 if (_M_rep()->_M_is_leaked())
6609 _M_rep()->_M_set_sharable();
6610 if (__s._M_rep()->_M_is_leaked())
6611 __s._M_rep()->_M_set_sharable();
6612 if (this->get_allocator() == __s.get_allocator())
6613 {
6614 _CharT* __tmp = _M_data();
6615 _M_data(__s._M_data());
6616 __s._M_data(__tmp);
6617 }
6618 else
6619 {
6620 const basic_string __tmp1(_M_ibegin(), _M_iend(),
6621 __s.get_allocator());
6622 const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),
6623 this->get_allocator());
6624 *this = __tmp2;
6625 __s = __tmp1;
6626 }
6627 }
6628 template<typename _CharT, typename _Traits, typename _Alloc>
6629 typename basic_string<_CharT, _Traits, _Alloc>::_Rep*
6630 basic_string<_CharT, _Traits, _Alloc>::_Rep::
6631 _S_create(size_type __capacity, size_type __old_capacity,
6632 const _Alloc& __alloc)
6633 {
6634 if (__capacity > _S_max_size)
6635 __throw_length_error(("basic_string::_S_create"));
6636 const size_type __pagesize = 4096;
6637 const size_type __malloc_header_size = 4 * sizeof(void*);
6638 if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
6639 __capacity = 2 * __old_capacity;
6640 size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
6641 const size_type __adj_size = __size + __malloc_header_size;
6642 if (__adj_size > __pagesize && __capacity > __old_capacity)
6643 {
6644 const size_type __extra = __pagesize - __adj_size % __pagesize;
6645 __capacity += __extra / sizeof(_CharT);
6646 if (__capacity > _S_max_size)
6647 __capacity = _S_max_size;
6648 __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
6649 }
6650 void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);
6651 _Rep *__p = new (__place) _Rep;
6652 __p->_M_capacity = __capacity;
6653 __p->_M_set_sharable();
6654 return __p;
6655 }
6656 template<typename _CharT, typename _Traits, typename _Alloc>
6657 _CharT*
6658 basic_string<_CharT, _Traits, _Alloc>::_Rep::
6659 _M_clone(const _Alloc& __alloc, size_type __res)
6660 {
6661 const size_type __requested_cap = this->_M_length + __res;
6662 _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity,
6663 __alloc);
6664 if (this->_M_length)
6665 _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length);
6666 __r->_M_set_length_and_sharable(this->_M_length);
6667 return __r->_M_refdata();
6668 }
6669 template<typename _CharT, typename _Traits, typename _Alloc>
6670 void
6671 basic_string<_CharT, _Traits, _Alloc>::
6672 resize(size_type __n, _CharT __c)
6673 {
6674 const size_type __size = this->size();
6675 _M_check_length(__size, __n, "basic_string::resize");
6676 if (__size < __n)
6677 this->append(__n - __size, __c);
6678 else if (__n < __size)
6679 this->erase(__n);
6680 }
6681 template<typename _CharT, typename _Traits, typename _Alloc>
6682 template<typename _InputIterator>
6683 basic_string<_CharT, _Traits, _Alloc>&
6684 basic_string<_CharT, _Traits, _Alloc>::
6685 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
6686 _InputIterator __k2, __false_type)
6687 {
6688 const basic_string __s(__k1, __k2);
6689 const size_type __n1 = __i2 - __i1;
6690 _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch");
6691 return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(),
6692 __s.size());
6693 }
6694 template<typename _CharT, typename _Traits, typename _Alloc>
6695 basic_string<_CharT, _Traits, _Alloc>&
6696 basic_string<_CharT, _Traits, _Alloc>::
6697 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
6698 _CharT __c)
6699 {
6700 _M_check_length(__n1, __n2, "basic_string::_M_replace_aux");
6701 _M_mutate(__pos1, __n1, __n2);
6702 if (__n2)
6703 _M_assign(_M_data() + __pos1, __n2, __c);
6704 return *this;
6705 }
6706 template<typename _CharT, typename _Traits, typename _Alloc>
6707 basic_string<_CharT, _Traits, _Alloc>&
6708 basic_string<_CharT, _Traits, _Alloc>::
6709 _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
6710 size_type __n2)
6711 {
6712 _M_mutate(__pos1, __n1, __n2);
6713 if (__n2)
6714 _M_copy(_M_data() + __pos1, __s, __n2);
6715 return *this;
6716 }
6717 template<typename _CharT, typename _Traits, typename _Alloc>
6718 basic_string<_CharT, _Traits, _Alloc>
6719 operator+(const _CharT* __lhs,
6720 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6721 {
6722 ;
6723 typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
6724 typedef typename __string_type::size_type __size_type;
6725 const __size_type __len = _Traits::length(__lhs);
6726 __string_type __str;
6727 __str.reserve(__len + __rhs.size());
6728 __str.append(__lhs, __len);
6729 __str.append(__rhs);
6730 return __str;
6731 }
6732 template<typename _CharT, typename _Traits, typename _Alloc>
6733 basic_string<_CharT, _Traits, _Alloc>
6734 operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
6735 {
6736 typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
6737 typedef typename __string_type::size_type __size_type;
6738 __string_type __str;
6739 const __size_type __len = __rhs.size();
6740 __str.reserve(__len + 1);
6741 __str.append(__size_type(1), __lhs);
6742 __str.append(__rhs);
6743 return __str;
6744 }
6745 template<typename _CharT, typename _Traits, typename _Alloc>
6746 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6747 basic_string<_CharT, _Traits, _Alloc>::
6748 copy(_CharT* __s, size_type __n, size_type __pos) const
6749 {
6750 _M_check(__pos, "basic_string::copy");
6751 __n = _M_limit(__pos, __n);
6752 ;
6753 if (__n)
6754 _M_copy(__s, _M_data() + __pos, __n);
6755 return __n;
6756 }
6757 template<typename _CharT, typename _Traits, typename _Alloc>
6758 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6759 basic_string<_CharT, _Traits, _Alloc>::
6760 find(const _CharT* __s, size_type __pos, size_type __n) const
6761 {
6762 ;
6763 const size_type __size = this->size();
6764 const _CharT* __data = _M_data();
6765 if (__n == 0)
6766 return __pos <= __size ? __pos : npos;
6767 if (__n <= __size)
6768 {
6769 for (; __pos <= __size - __n; ++__pos)
6770 if (traits_type::eq(__data[__pos], __s[0])
6771 && traits_type::compare(__data + __pos + 1,
6772 __s + 1, __n - 1) == 0)
6773 return __pos;
6774 }
6775 return npos;
6776 }
6777 template<typename _CharT, typename _Traits, typename _Alloc>
6778 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6779 basic_string<_CharT, _Traits, _Alloc>::
6780 find(_CharT __c, size_type __pos) const
6781 {
6782 size_type __ret = npos;
6783 const size_type __size = this->size();
6784 if (__pos < __size)
6785 {
6786 const _CharT* __data = _M_data();
6787 const size_type __n = __size - __pos;
6788 const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
6789 if (__p)
6790 __ret = __p - __data;
6791 }
6792 return __ret;
6793 }
6794 template<typename _CharT, typename _Traits, typename _Alloc>
6795 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6796 basic_string<_CharT, _Traits, _Alloc>::
6797 rfind(const _CharT* __s, size_type __pos, size_type __n) const
6798 {
6799 ;
6800 const size_type __size = this->size();
6801 if (__n <= __size)
6802 {
6803 __pos = std::min(size_type(__size - __n), __pos);
6804 const _CharT* __data = _M_data();
6805 do
6806 {
6807 if (traits_type::compare(__data + __pos, __s, __n) == 0)
6808 return __pos;
6809 }
6810 while (__pos-- > 0);
6811 }
6812 return npos;
6813 }
6814 template<typename _CharT, typename _Traits, typename _Alloc>
6815 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6816 basic_string<_CharT, _Traits, _Alloc>::
6817 rfind(_CharT __c, size_type __pos) const
6818 {
6819 size_type __size = this->size();
6820 if (__size)
6821 {
6822 if (--__size > __pos)
6823 __size = __pos;
6824 for (++__size; __size-- > 0; )
6825 if (traits_type::eq(_M_data()[__size], __c))
6826 return __size;
6827 }
6828 return npos;
6829 }
6830 template<typename _CharT, typename _Traits, typename _Alloc>
6831 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6832 basic_string<_CharT, _Traits, _Alloc>::
6833 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
6834 {
6835 ;
6836 for (; __n && __pos < this->size(); ++__pos)
6837 {
6838 const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
6839 if (__p)
6840 return __pos;
6841 }
6842 return npos;
6843 }
6844 template<typename _CharT, typename _Traits, typename _Alloc>
6845 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6846 basic_string<_CharT, _Traits, _Alloc>::
6847 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
6848 {
6849 ;
6850 size_type __size = this->size();
6851 if (__size && __n)
6852 {
6853 if (--__size > __pos)
6854 __size = __pos;
6855 do
6856 {
6857 if (traits_type::find(__s, __n, _M_data()[__size]))
6858 return __size;
6859 }
6860 while (__size-- != 0);
6861 }
6862 return npos;
6863 }
6864 template<typename _CharT, typename _Traits, typename _Alloc>
6865 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6866 basic_string<_CharT, _Traits, _Alloc>::
6867 find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
6868 {
6869 ;
6870 for (; __pos < this->size(); ++__pos)
6871 if (!traits_type::find(__s, __n, _M_data()[__pos]))
6872 return __pos;
6873 return npos;
6874 }
6875 template<typename _CharT, typename _Traits, typename _Alloc>
6876 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6877 basic_string<_CharT, _Traits, _Alloc>::
6878 find_first_not_of(_CharT __c, size_type __pos) const
6879 {
6880 for (; __pos < this->size(); ++__pos)
6881 if (!traits_type::eq(_M_data()[__pos], __c))
6882 return __pos;
6883 return npos;
6884 }
6885 template<typename _CharT, typename _Traits, typename _Alloc>
6886 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6887 basic_string<_CharT, _Traits, _Alloc>::
6888 find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
6889 {
6890 ;
6891 size_type __size = this->size();
6892 if (__size)
6893 {
6894 if (--__size > __pos)
6895 __size = __pos;
6896 do
6897 {
6898 if (!traits_type::find(__s, __n, _M_data()[__size]))
6899 return __size;
6900 }
6901 while (__size--);
6902 }
6903 return npos;
6904 }
6905 template<typename _CharT, typename _Traits, typename _Alloc>
6906 typename basic_string<_CharT, _Traits, _Alloc>::size_type
6907 basic_string<_CharT, _Traits, _Alloc>::
6908 find_last_not_of(_CharT __c, size_type __pos) const
6909 {
6910 size_type __size = this->size();
6911 if (__size)
6912 {
6913 if (--__size > __pos)
6914 __size = __pos;
6915 do
6916 {
6917 if (!traits_type::eq(_M_data()[__size], __c))
6918 return __size;
6919 }
6920 while (__size--);
6921 }
6922 return npos;
6923 }
6924 template<typename _CharT, typename _Traits, typename _Alloc>
6925 int
6926 basic_string<_CharT, _Traits, _Alloc>::
6927 compare(size_type __pos, size_type __n, const basic_string& __str) const
6928 {
6929 _M_check(__pos, "basic_string::compare");
6930 __n = _M_limit(__pos, __n);
6931 const size_type __osize = __str.size();
6932 const size_type __len = std::min(__n, __osize);
6933 int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
6934 if (!__r)
6935 __r = _S_compare(__n, __osize);
6936 return __r;
6937 }
6938 template<typename _CharT, typename _Traits, typename _Alloc>
6939 int
6940 basic_string<_CharT, _Traits, _Alloc>::
6941 compare(size_type __pos1, size_type __n1, const basic_string& __str,
6942 size_type __pos2, size_type __n2) const
6943 {
6944 _M_check(__pos1, "basic_string::compare");
6945 __str._M_check(__pos2, "basic_string::compare");
6946 __n1 = _M_limit(__pos1, __n1);
6947 __n2 = __str._M_limit(__pos2, __n2);
6948 const size_type __len = std::min(__n1, __n2);
6949 int __r = traits_type::compare(_M_data() + __pos1,
6950 __str.data() + __pos2, __len);
6951 if (!__r)
6952 __r = _S_compare(__n1, __n2);
6953 return __r;
6954 }
6955 template<typename _CharT, typename _Traits, typename _Alloc>
6956 int
6957 basic_string<_CharT, _Traits, _Alloc>::
6958 compare(const _CharT* __s) const
6959 {
6960 ;
6961 const size_type __size = this->size();
6962 const size_type __osize = traits_type::length(__s);
6963 const size_type __len = std::min(__size, __osize);
6964 int __r = traits_type::compare(_M_data(), __s, __len);
6965 if (!__r)
6966 __r = _S_compare(__size, __osize);
6967 return __r;
6968 }
6969 template<typename _CharT, typename _Traits, typename _Alloc>
6970 int
6971 basic_string <_CharT, _Traits, _Alloc>::
6972 compare(size_type __pos, size_type __n1, const _CharT* __s) const
6973 {
6974 ;
6975 _M_check(__pos, "basic_string::compare");
6976 __n1 = _M_limit(__pos, __n1);
6977 const size_type __osize = traits_type::length(__s);
6978 const size_type __len = std::min(__n1, __osize);
6979 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
6980 if (!__r)
6981 __r = _S_compare(__n1, __osize);
6982 return __r;
6983 }
6984 template<typename _CharT, typename _Traits, typename _Alloc>
6985 int
6986 basic_string <_CharT, _Traits, _Alloc>::
6987 compare(size_type __pos, size_type __n1, const _CharT* __s,
6988 size_type __n2) const
6989 {
6990 ;
6991 _M_check(__pos, "basic_string::compare");
6992 __n1 = _M_limit(__pos, __n1);
6993 const size_type __len = std::min(__n1, __n2);
6994 int __r = traits_type::compare(_M_data() + __pos, __s, __len);
6995 if (!__r)
6996 __r = _S_compare(__n1, __n2);
6997 return __r;
6998 }
6999 template<typename _CharT, typename _Traits, typename _Alloc>
7000 basic_istream<_CharT, _Traits>&
7001 operator>>(basic_istream<_CharT, _Traits>& __in,
7002 basic_string<_CharT, _Traits, _Alloc>& __str)
7003 {
7004 typedef basic_istream<_CharT, _Traits> __istream_type;
7005 typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
7006 typedef typename __istream_type::ios_base __ios_base;
7007 typedef typename __istream_type::int_type __int_type;
7008 typedef typename __string_type::size_type __size_type;
7009 typedef ctype<_CharT> __ctype_type;
7010 typedef typename __ctype_type::ctype_base __ctype_base;
7011 __size_type __extracted = 0;
7012 typename __ios_base::iostate __err = __ios_base::goodbit;
7013 typename __istream_type::sentry __cerb(__in, false);
7014 if (__cerb)
7015 {
7016 try
7017 {
7018 __str.erase();
7019 _CharT __buf[128];
7020 __size_type __len = 0;
7021 const streamsize __w = __in.width();
7022 const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
7023 : __str.max_size();
7024 const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
7025 const __int_type __eof = _Traits::eof();
7026 __int_type __c = __in.rdbuf()->sgetc();
7027 while (__extracted < __n
7028 && !_Traits::eq_int_type(__c, __eof)
7029 && !__ct.is(__ctype_base::space,
7030 _Traits::to_char_type(__c)))
7031 {
7032 if (__len == sizeof(__buf) / sizeof(_CharT))
7033 {
7034 __str.append(__buf, sizeof(__buf) / sizeof(_CharT));
7035 __len = 0;
7036 }
7037 __buf[__len++] = _Traits::to_char_type(__c);
7038 ++__extracted;
7039 __c = __in.rdbuf()->snextc();
7040 }
7041 __str.append(__buf, __len);
7042 if (_Traits::eq_int_type(__c, __eof))
7043 __err |= __ios_base::eofbit;
7044 __in.width(0);
7045 }
7046 catch(__cxxabiv1::__forced_unwind&)
7047 {
7048 __in._M_setstate(__ios_base::badbit);
7049 throw;
7050 }
7051 catch(...)
7052 {
7053 __in._M_setstate(__ios_base::badbit);
7054 }
7055 }
7056 if (!__extracted)
7057 __err |= __ios_base::failbit;
7058 if (__err)
7059 __in.setstate(__err);
7060 return __in;
7061 }
7062 template<typename _CharT, typename _Traits, typename _Alloc>
7063 basic_istream<_CharT, _Traits>&
7064 getline(basic_istream<_CharT, _Traits>& __in,
7065 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)
7066 {
7067 typedef basic_istream<_CharT, _Traits> __istream_type;
7068 typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
7069 typedef typename __istream_type::ios_base __ios_base;
7070 typedef typename __istream_type::int_type __int_type;
7071 typedef typename __string_type::size_type __size_type;
7072 __size_type __extracted = 0;
7073 const __size_type __n = __str.max_size();
7074 typename __ios_base::iostate __err = __ios_base::goodbit;
7075 typename __istream_type::sentry __cerb(__in, true);
7076 if (__cerb)
7077 {
7078 try
7079 {
7080 __str.erase();
7081 const __int_type __idelim = _Traits::to_int_type(__delim);
7082 const __int_type __eof = _Traits::eof();
7083 __int_type __c = __in.rdbuf()->sgetc();
7084 while (__extracted < __n
7085 && !_Traits::eq_int_type(__c, __eof)
7086 && !_Traits::eq_int_type(__c, __idelim))
7087 {
7088 __str += _Traits::to_char_type(__c);
7089 ++__extracted;
7090 __c = __in.rdbuf()->snextc();
7091 }
7092 if (_Traits::eq_int_type(__c, __eof))
7093 __err |= __ios_base::eofbit;
7094 else if (_Traits::eq_int_type(__c, __idelim))
7095 {
7096 ++__extracted;
7097 __in.rdbuf()->sbumpc();
7098 }
7099 else
7100 __err |= __ios_base::failbit;
7101 }
7102 catch(__cxxabiv1::__forced_unwind&)
7103 {
7104 __in._M_setstate(__ios_base::badbit);
7105 throw;
7106 }
7107 catch(...)
7108 {
7109 __in._M_setstate(__ios_base::badbit);
7110 }
7111 }
7112 if (!__extracted)
7113 __err |= __ios_base::failbit;
7114 if (__err)
7115 __in.setstate(__err);
7116 return __in;
7117 }
7118 extern template class basic_string<char>;
7119 extern template
7120 basic_istream<char>&
7121 operator>>(basic_istream<char>&, string&);
7122 extern template
7123 basic_ostream<char>&
7124 operator<<(basic_ostream<char>&, const string&);
7125 extern template
7126 basic_istream<char>&
7127 getline(basic_istream<char>&, string&, char);
7128 extern template
7129 basic_istream<char>&
7130 getline(basic_istream<char>&, string&);
7131 }
7132 namespace std __attribute__ ((__visibility__ ("default"))) {
7133 class locale
7134 {
7135 public:
7136 typedef int category;
7137 class facet;
7138 class id;
7139 class _Impl;
7140 friend class facet;
7141 friend class _Impl;
7142 template<typename _Facet>
7143 friend bool
7144 has_facet(const locale&) throw();
7145 template<typename _Facet>
7146 friend const _Facet&
7147 use_facet(const locale&);
7148 template<typename _Cache>
7149 friend struct __use_cache;
7150 static const category none = 0;
7151 static const category ctype = 1L << 0;
7152 static const category numeric = 1L << 1;
7153 static const category collate = 1L << 2;
7154 static const category time = 1L << 3;
7155 static const category monetary = 1L << 4;
7156 static const category messages = 1L << 5;
7157 static const category all = (ctype | numeric | collate |
7158 time | monetary | messages);
7159 locale() throw();
7160 locale(const locale& __other) throw();
7161 explicit
7162 locale(const char* __s);
7163 locale(const locale& __base, const char* __s, category __cat);
7164 locale(const locale& __base, const locale& __add, category __cat);
7165 template<typename _Facet>
7166 locale(const locale& __other, _Facet* __f);
7167 ~locale() throw();
7168 const locale&
7169 operator=(const locale& __other) throw();
7170 template<typename _Facet>
7171 locale
7172 combine(const locale& __other) const;
7173 string
7174 name() const;
7175 bool
7176 operator==(const locale& __other) const throw ();
7177 bool
7178 operator!=(const locale& __other) const throw ()
7179 { return !(this->operator==(__other)); }
7180 template<typename _Char, typename _Traits, typename _Alloc>
7181 bool
7182 operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
7183 const basic_string<_Char, _Traits, _Alloc>& __s2) const;
7184 static locale
7185 global(const locale&);
7186 static const locale&
7187 classic();
7188 private:
7189 _Impl* _M_impl;
7190 static _Impl* _S_classic;
7191 static _Impl* _S_global;
7192 static const char* const* const _S_categories;
7193 enum { _S_categories_size = 6 + 0 };
7194 static __gthread_once_t _S_once;
7195 explicit
7196 locale(_Impl*) throw();
7197 static void
7198 _S_initialize();
7199 static void
7200 _S_initialize_once();
7201 static category
7202 _S_normalize_category(category);
7203 void
7204 _M_coalesce(const locale& __base, const locale& __add, category __cat);
7205 };
7206 class locale::facet
7207 {
7208 private:
7209 friend class locale;
7210 friend class locale::_Impl;
7211 mutable _Atomic_word _M_refcount;
7212 static __c_locale _S_c_locale;
7213 static const char _S_c_name[2];
7214 static __gthread_once_t _S_once;
7215 static void
7216 _S_initialize_once();
7217 protected:
7218 explicit
7219 facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
7220 { }
7221 virtual
7222 ~facet();
7223 static void
7224 _S_create_c_locale(__c_locale& __cloc, const char* __s,
7225 __c_locale __old = 0);
7226 static __c_locale
7227 _S_clone_c_locale(__c_locale& __cloc);
7228 static void
7229 _S_destroy_c_locale(__c_locale& __cloc);
7230 static __c_locale
7231 _S_get_c_locale();
7232 static const char*
7233 _S_get_c_name();
7234 private:
7235 void
7236 _M_add_reference() const throw()
7237 { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
7238 void
7239 _M_remove_reference() const throw()
7240 {
7241 if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
7242 {
7243 try
7244 { delete this; }
7245 catch(...)
7246 { }
7247 }
7248 }
7249 facet(const facet&);
7250 facet&
7251 operator=(const facet&);
7252 };
7253 class locale::id
7254 {
7255 private:
7256 friend class locale;
7257 friend class locale::_Impl;
7258 template<typename _Facet>
7259 friend const _Facet&
7260 use_facet(const locale&);
7261 template<typename _Facet>
7262 friend bool
7263 has_facet(const locale&) throw ();
7264 mutable size_t _M_index;
7265 static _Atomic_word _S_refcount;
7266 void
7267 operator=(const id&);
7268 id(const id&);
7269 public:
7270 id() { }
7271 size_t
7272 _M_id() const;
7273 };
7274 class locale::_Impl
7275 {
7276 public:
7277 friend class locale;
7278 friend class locale::facet;
7279 template<typename _Facet>
7280 friend bool
7281 has_facet(const locale&) throw();
7282 template<typename _Facet>
7283 friend const _Facet&
7284 use_facet(const locale&);
7285 template<typename _Cache>
7286 friend struct __use_cache;
7287 private:
7288 _Atomic_word _M_refcount;
7289 const facet** _M_facets;
7290 size_t _M_facets_size;
7291 const facet** _M_caches;
7292 char** _M_names;
7293 static const locale::id* const _S_id_ctype[];
7294 static const locale::id* const _S_id_numeric[];
7295 static const locale::id* const _S_id_collate[];
7296 static const locale::id* const _S_id_time[];
7297 static const locale::id* const _S_id_monetary[];
7298 static const locale::id* const _S_id_messages[];
7299 static const locale::id* const* const _S_facet_categories[];
7300 void
7301 _M_add_reference() throw()
7302 { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
7303 void
7304 _M_remove_reference() throw()
7305 {
7306 if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
7307 {
7308 try
7309 { delete this; }
7310 catch(...)
7311 { }
7312 }
7313 }
7314 _Impl(const _Impl&, size_t);
7315 _Impl(const char*, size_t);
7316 _Impl(size_t) throw();
7317 ~_Impl() throw();
7318 _Impl(const _Impl&);
7319 void
7320 operator=(const _Impl&);
7321 bool
7322 _M_check_same_name()
7323 {
7324 bool __ret = true;
7325 if (_M_names[1])
7326 for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
7327 __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0;
7328 return __ret;
7329 }
7330 void
7331 _M_replace_categories(const _Impl*, category);
7332 void
7333 _M_replace_category(const _Impl*, const locale::id* const*);
7334 void
7335 _M_replace_facet(const _Impl*, const locale::id*);
7336 void
7337 _M_install_facet(const locale::id*, const facet*);
7338 template<typename _Facet>
7339 void
7340 _M_init_facet(_Facet* __facet)
7341 { _M_install_facet(&_Facet::id, __facet); }
7342 void
7343 _M_install_cache(const facet*, size_t);
7344 };
7345 template<typename _Facet>
7346 bool
7347 has_facet(const locale& __loc) throw();
7348 template<typename _Facet>
7349 const _Facet&
7350 use_facet(const locale& __loc);
7351 template<typename _CharT>
7352 class collate : public locale::facet
7353 {
7354 public:
7355 typedef _CharT char_type;
7356 typedef basic_string<_CharT> string_type;
7357 protected:
7358 __c_locale _M_c_locale_collate;
7359 public:
7360 static locale::id id;
7361 explicit
7362 collate(size_t __refs = 0)
7363 : facet(__refs), _M_c_locale_collate(_S_get_c_locale())
7364 { }
7365 explicit
7366 collate(__c_locale __cloc, size_t __refs = 0)
7367 : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
7368 { }
7369 int
7370 compare(const _CharT* __lo1, const _CharT* __hi1,
7371 const _CharT* __lo2, const _CharT* __hi2) const
7372 { return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
7373 string_type
7374 transform(const _CharT* __lo, const _CharT* __hi) const
7375 { return this->do_transform(__lo, __hi); }
7376 long
7377 hash(const _CharT* __lo, const _CharT* __hi) const
7378 { return this->do_hash(__lo, __hi); }
7379 int
7380 _M_compare(const _CharT*, const _CharT*) const;
7381 size_t
7382 _M_transform(_CharT*, const _CharT*, size_t) const;
7383 protected:
7384 virtual
7385 ~collate()
7386 { _S_destroy_c_locale(_M_c_locale_collate); }
7387 virtual int
7388 do_compare(const _CharT* __lo1, const _CharT* __hi1,
7389 const _CharT* __lo2, const _CharT* __hi2) const;
7390 virtual string_type
7391 do_transform(const _CharT* __lo, const _CharT* __hi) const;
7392 virtual long
7393 do_hash(const _CharT* __lo, const _CharT* __hi) const;
7394 };
7395 template<typename _CharT>
7396 locale::id collate<_CharT>::id;
7397 template<>
7398 int
7399 collate<char>::_M_compare(const char*, const char*) const;
7400 template<>
7401 size_t
7402 collate<char>::_M_transform(char*, const char*, size_t) const;
7403 template<typename _CharT>
7404 class collate_byname : public collate<_CharT>
7405 {
7406 public:
7407 typedef _CharT char_type;
7408 typedef basic_string<_CharT> string_type;
7409 explicit
7410 collate_byname(const char* __s, size_t __refs = 0)
7411 : collate<_CharT>(__refs)
7412 {
7413 if (__builtin_strcmp(__s, "C") != 0
7414 && __builtin_strcmp(__s, "POSIX") != 0)
7415 {
7416 this->_S_destroy_c_locale(this->_M_c_locale_collate);
7417 this->_S_create_c_locale(this->_M_c_locale_collate, __s);
7418 }
7419 }
7420 protected:
7421 virtual
7422 ~collate_byname() { }
7423 };
7424 }
7425 namespace std __attribute__ ((__visibility__ ("default"))) {
7426 template<typename _Facet>
7427 locale::
7428 locale(const locale& __other, _Facet* __f)
7429 {
7430 _M_impl = new _Impl(*__other._M_impl, 1);
7431 try
7432 { _M_impl->_M_install_facet(&_Facet::id, __f); }
7433 catch(...)
7434 {
7435 _M_impl->_M_remove_reference();
7436 throw;
7437 }
7438 delete [] _M_impl->_M_names[0];
7439 _M_impl->_M_names[0] = 0;
7440 }
7441 template<typename _Facet>
7442 locale
7443 locale::
7444 combine(const locale& __other) const
7445 {
7446 _Impl* __tmp = new _Impl(*_M_impl, 1);
7447 try
7448 {
7449 __tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
7450 }
7451 catch(...)
7452 {
7453 __tmp->_M_remove_reference();
7454 throw;
7455 }
7456 return locale(__tmp);
7457 }
7458 template<typename _CharT, typename _Traits, typename _Alloc>
7459 bool
7460 locale::
7461 operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1,
7462 const basic_string<_CharT, _Traits, _Alloc>& __s2) const
7463 {
7464 typedef std::collate<_CharT> __collate_type;
7465 const __collate_type& __collate = use_facet<__collate_type>(*this);
7466 return (__collate.compare(__s1.data(), __s1.data() + __s1.length(),
7467 __s2.data(), __s2.data() + __s2.length()) < 0);
7468 }
7469 template<typename _Facet>
7470 bool
7471 has_facet(const locale& __loc) throw()
7472 {
7473 const size_t __i = _Facet::id._M_id();
7474 const locale::facet** __facets = __loc._M_impl->_M_facets;
7475 return (__i < __loc._M_impl->_M_facets_size
7476 && dynamic_cast<const _Facet*>(__facets[__i]));
7477 }
7478 template<typename _Facet>
7479 const _Facet&
7480 use_facet(const locale& __loc)
7481 {
7482 const size_t __i = _Facet::id._M_id();
7483 const locale::facet** __facets = __loc._M_impl->_M_facets;
7484 if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i])
7485 __throw_bad_cast();
7486 return dynamic_cast<const _Facet&>(*__facets[__i]);
7487 }
7488 template<typename _CharT>
7489 int
7490 collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const
7491 { return 0; }
7492 template<typename _CharT>
7493 size_t
7494 collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const
7495 { return 0; }
7496 template<typename _CharT>
7497 int
7498 collate<_CharT>::
7499 do_compare(const _CharT* __lo1, const _CharT* __hi1,
7500 const _CharT* __lo2, const _CharT* __hi2) const
7501 {
7502 const string_type __one(__lo1, __hi1);
7503 const string_type __two(__lo2, __hi2);
7504 const _CharT* __p = __one.c_str();
7505 const _CharT* __pend = __one.data() + __one.length();
7506 const _CharT* __q = __two.c_str();
7507 const _CharT* __qend = __two.data() + __two.length();
7508 for (;;)
7509 {
7510 const int __res = _M_compare(__p, __q);
7511 if (__res)
7512 return __res;
7513 __p += char_traits<_CharT>::length(__p);
7514 __q += char_traits<_CharT>::length(__q);
7515 if (__p == __pend && __q == __qend)
7516 return 0;
7517 else if (__p == __pend)
7518 return -1;
7519 else if (__q == __qend)
7520 return 1;
7521 __p++;
7522 __q++;
7523 }
7524 }
7525 template<typename _CharT>
7526 typename collate<_CharT>::string_type
7527 collate<_CharT>::
7528 do_transform(const _CharT* __lo, const _CharT* __hi) const
7529 {
7530 string_type __ret;
7531 const string_type __str(__lo, __hi);
7532 const _CharT* __p = __str.c_str();
7533 const _CharT* __pend = __str.data() + __str.length();
7534 size_t __len = (__hi - __lo) * 2;
7535 _CharT* __c = new _CharT[__len];
7536 try
7537 {
7538 for (;;)
7539 {
7540 size_t __res = _M_transform(__c, __p, __len);
7541 if (__res >= __len)
7542 {
7543 __len = __res + 1;
7544 delete [] __c, __c = 0;
7545 __c = new _CharT[__len];
7546 __res = _M_transform(__c, __p, __len);
7547 }
7548 __ret.append(__c, __res);
7549 __p += char_traits<_CharT>::length(__p);
7550 if (__p == __pend)
7551 break;
7552 __p++;
7553 __ret.push_back(_CharT());
7554 }
7555 }
7556 catch(...)
7557 {
7558 delete [] __c;
7559 throw;
7560 }
7561 delete [] __c;
7562 return __ret;
7563 }
7564 template<typename _CharT>
7565 long
7566 collate<_CharT>::
7567 do_hash(const _CharT* __lo, const _CharT* __hi) const
7568 {
7569 unsigned long __val = 0;
7570 for (; __lo < __hi; ++__lo)
7571 __val =
7572 *__lo + ((__val << 7)
7573 | (__val >> (__gnu_cxx::__numeric_traits<unsigned long>::
7574 __digits - 7)));
7575 return static_cast<long>(__val);
7576 }
7577 extern template class collate<char>;
7578 extern template class collate_byname<char>;
7579 extern template
7580 const collate<char>&
7581 use_facet<collate<char> >(const locale&);
7582 extern template
7583 bool
7584 has_facet<collate<char> >(const locale&);
7585 }
7586 namespace std __attribute__ ((__visibility__ ("default"))) {
7587 enum _Ios_Fmtflags
7588 {
7589 _S_boolalpha = 1L << 0,
7590 _S_dec = 1L << 1,
7591 _S_fixed = 1L << 2,
7592 _S_hex = 1L << 3,
7593 _S_internal = 1L << 4,
7594 _S_left = 1L << 5,
7595 _S_oct = 1L << 6,
7596 _S_right = 1L << 7,
7597 _S_scientific = 1L << 8,
7598 _S_showbase = 1L << 9,
7599 _S_showpoint = 1L << 10,
7600 _S_showpos = 1L << 11,
7601 _S_skipws = 1L << 12,
7602 _S_unitbuf = 1L << 13,
7603 _S_uppercase = 1L << 14,
7604 _S_adjustfield = _S_left | _S_right | _S_internal,
7605 _S_basefield = _S_dec | _S_oct | _S_hex,
7606 _S_floatfield = _S_scientific | _S_fixed,
7607 _S_ios_fmtflags_end = 1L << 16
7608 };
7609 inline _Ios_Fmtflags
7610 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
7611 { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
7612 inline _Ios_Fmtflags
7613 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
7614 { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
7615 inline _Ios_Fmtflags
7616 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
7617 { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
7618 inline _Ios_Fmtflags&
7619 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
7620 { return __a = __a | __b; }
7621 inline _Ios_Fmtflags&
7622 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
7623 { return __a = __a & __b; }
7624 inline _Ios_Fmtflags&
7625 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
7626 { return __a = __a ^ __b; }
7627 inline _Ios_Fmtflags
7628 operator~(_Ios_Fmtflags __a)
7629 { return _Ios_Fmtflags(~static_cast<int>(__a)); }
7630 enum _Ios_Openmode
7631 {
7632 _S_app = 1L << 0,
7633 _S_ate = 1L << 1,
7634 _S_bin = 1L << 2,
7635 _S_in = 1L << 3,
7636 _S_out = 1L << 4,
7637 _S_trunc = 1L << 5,
7638 _S_ios_openmode_end = 1L << 16
7639 };
7640 inline _Ios_Openmode
7641 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
7642 { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
7643 inline _Ios_Openmode
7644 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
7645 { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
7646 inline _Ios_Openmode
7647 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
7648 { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
7649 inline _Ios_Openmode&
7650 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
7651 { return __a = __a | __b; }
7652 inline _Ios_Openmode&
7653 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
7654 { return __a = __a & __b; }
7655 inline _Ios_Openmode&
7656 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
7657 { return __a = __a ^ __b; }
7658 inline _Ios_Openmode
7659 operator~(_Ios_Openmode __a)
7660 { return _Ios_Openmode(~static_cast<int>(__a)); }
7661 enum _Ios_Iostate
7662 {
7663 _S_goodbit = 0,
7664 _S_badbit = 1L << 0,
7665 _S_eofbit = 1L << 1,
7666 _S_failbit = 1L << 2,
7667 _S_ios_iostate_end = 1L << 16
7668 };
7669 inline _Ios_Iostate
7670 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
7671 { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
7672 inline _Ios_Iostate
7673 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
7674 { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
7675 inline _Ios_Iostate
7676 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
7677 { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
7678 inline _Ios_Iostate&
7679 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
7680 { return __a = __a | __b; }
7681 inline _Ios_Iostate&
7682 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
7683 { return __a = __a & __b; }
7684 inline _Ios_Iostate&
7685 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
7686 { return __a = __a ^ __b; }
7687 inline _Ios_Iostate
7688 operator~(_Ios_Iostate __a)
7689 { return _Ios_Iostate(~static_cast<int>(__a)); }
7690 enum _Ios_Seekdir
7691 {
7692 _S_beg = 0,
7693 _S_cur = 1,
7694 _S_end = 2,
7695 _S_ios_seekdir_end = 1L << 16
7696 };
7697 class ios_base
7698 {
7699 public:
7700 class failure : public exception
7701 {
7702 public:
7703 explicit
7704 failure(const string& __str) throw();
7705 virtual
7706 ~failure() throw();
7707 virtual const char*
7708 what() const throw();
7709 private:
7710 string _M_msg;
7711 };
7712 typedef _Ios_Fmtflags fmtflags;
7713 static const fmtflags boolalpha = _S_boolalpha;
7714 static const fmtflags dec = _S_dec;
7715 static const fmtflags fixed = _S_fixed;
7716 static const fmtflags hex = _S_hex;
7717 static const fmtflags internal = _S_internal;
7718 static const fmtflags left = _S_left;
7719 static const fmtflags oct = _S_oct;
7720 static const fmtflags right = _S_right;
7721 static const fmtflags scientific = _S_scientific;
7722 static const fmtflags showbase = _S_showbase;
7723 static const fmtflags showpoint = _S_showpoint;
7724 static const fmtflags showpos = _S_showpos;
7725 static const fmtflags skipws = _S_skipws;
7726 static const fmtflags unitbuf = _S_unitbuf;
7727 static const fmtflags uppercase = _S_uppercase;
7728 static const fmtflags adjustfield = _S_adjustfield;
7729 static const fmtflags basefield = _S_basefield;
7730 static const fmtflags floatfield = _S_floatfield;
7731 typedef _Ios_Iostate iostate;
7732 static const iostate badbit = _S_badbit;
7733 static const iostate eofbit = _S_eofbit;
7734 static const iostate failbit = _S_failbit;
7735 static const iostate goodbit = _S_goodbit;
7736 typedef _Ios_Openmode openmode;
7737 static const openmode app = _S_app;
7738 static const openmode ate = _S_ate;
7739 static const openmode binary = _S_bin;
7740 static const openmode in = _S_in;
7741 static const openmode out = _S_out;
7742 static const openmode trunc = _S_trunc;
7743 typedef _Ios_Seekdir seekdir;
7744 static const seekdir beg = _S_beg;
7745 static const seekdir cur = _S_cur;
7746 static const seekdir end = _S_end;
7747 typedef int io_state;
7748 typedef int open_mode;
7749 typedef int seek_dir;
7750 typedef std::streampos streampos;
7751 typedef std::streamoff streamoff;
7752 enum event
7753 {
7754 erase_event,
7755 imbue_event,
7756 copyfmt_event
7757 };
7758 typedef void (*event_callback) (event, ios_base&, int);
7759 void
7760 register_callback(event_callback __fn, int __index);
7761 protected:
7762 streamsize _M_precision;
7763 streamsize _M_width;
7764 fmtflags _M_flags;
7765 iostate _M_exception;
7766 iostate _M_streambuf_state;
7767 struct _Callback_list
7768 {
7769 _Callback_list* _M_next;
7770 ios_base::event_callback _M_fn;
7771 int _M_index;
7772 _Atomic_word _M_refcount;
7773 _Callback_list(ios_base::event_callback __fn, int __index,
7774 _Callback_list* __cb)
7775 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
7776 void
7777 _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
7778 int
7779 _M_remove_reference()
7780 { return __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); }
7781 };
7782 _Callback_list* _M_callbacks;
7783 void
7784 _M_call_callbacks(event __ev) throw();
7785 void
7786 _M_dispose_callbacks(void);
7787 struct _Words
7788 {
7789 void* _M_pword;
7790 long _M_iword;
7791 _Words() : _M_pword(0), _M_iword(0) { }
7792 };
7793 _Words _M_word_zero;
7794 enum { _S_local_word_size = 8 };
7795 _Words _M_local_word[_S_local_word_size];
7796 int _M_word_size;
7797 _Words* _M_word;
7798 _Words&
7799 _M_grow_words(int __index, bool __iword);
7800 locale _M_ios_locale;
7801 void
7802 _M_init();
7803 public:
7804 class Init
7805 {
7806 friend class ios_base;
7807 public:
7808 Init();
7809 ~Init();
7810 private:
7811 static _Atomic_word _S_refcount;
7812 static bool _S_synced_with_stdio;
7813 };
7814 fmtflags
7815 flags() const
7816 { return _M_flags; }
7817 fmtflags
7818 flags(fmtflags __fmtfl)
7819 {
7820 fmtflags __old = _M_flags;
7821 _M_flags = __fmtfl;
7822 return __old;
7823 }
7824 fmtflags
7825 setf(fmtflags __fmtfl)
7826 {
7827 fmtflags __old = _M_flags;
7828 _M_flags |= __fmtfl;
7829 return __old;
7830 }
7831 fmtflags
7832 setf(fmtflags __fmtfl, fmtflags __mask)
7833 {
7834 fmtflags __old = _M_flags;
7835 _M_flags &= ~__mask;
7836 _M_flags |= (__fmtfl & __mask);
7837 return __old;
7838 }
7839 void
7840 unsetf(fmtflags __mask)
7841 { _M_flags &= ~__mask; }
7842 streamsize
7843 precision() const
7844 { return _M_precision; }
7845 streamsize
7846 precision(streamsize __prec)
7847 {
7848 streamsize __old = _M_precision;
7849 _M_precision = __prec;
7850 return __old;
7851 }
7852 streamsize
7853 width() const
7854 { return _M_width; }
7855 streamsize
7856 width(streamsize __wide)
7857 {
7858 streamsize __old = _M_width;
7859 _M_width = __wide;
7860 return __old;
7861 }
7862 static bool
7863 sync_with_stdio(bool __sync = true);
7864 locale
7865 imbue(const locale& __loc);
7866 locale
7867 getloc() const
7868 { return _M_ios_locale; }
7869 const locale&
7870 _M_getloc() const
7871 { return _M_ios_locale; }
7872 static int
7873 xalloc() throw();
7874 long&
7875 iword(int __ix)
7876 {
7877 _Words& __word = (__ix < _M_word_size)
7878 ? _M_word[__ix] : _M_grow_words(__ix, true);
7879 return __word._M_iword;
7880 }
7881 void*&
7882 pword(int __ix)
7883 {
7884 _Words& __word = (__ix < _M_word_size)
7885 ? _M_word[__ix] : _M_grow_words(__ix, false);
7886 return __word._M_pword;
7887 }
7888 virtual ~ios_base();
7889 protected:
7890 ios_base();
7891 private:
7892 ios_base(const ios_base&);
7893 ios_base&
7894 operator=(const ios_base&);
7895 };
7896 inline ios_base&
7897 boolalpha(ios_base& __base)
7898 {
7899 __base.setf(ios_base::boolalpha);
7900 return __base;
7901 }
7902 inline ios_base&
7903 noboolalpha(ios_base& __base)
7904 {
7905 __base.unsetf(ios_base::boolalpha);
7906 return __base;
7907 }
7908 inline ios_base&
7909 showbase(ios_base& __base)
7910 {
7911 __base.setf(ios_base::showbase);
7912 return __base;
7913 }
7914 inline ios_base&
7915 noshowbase(ios_base& __base)
7916 {
7917 __base.unsetf(ios_base::showbase);
7918 return __base;
7919 }
7920 inline ios_base&
7921 showpoint(ios_base& __base)
7922 {
7923 __base.setf(ios_base::showpoint);
7924 return __base;
7925 }
7926 inline ios_base&
7927 noshowpoint(ios_base& __base)
7928 {
7929 __base.unsetf(ios_base::showpoint);
7930 return __base;
7931 }
7932 inline ios_base&
7933 showpos(ios_base& __base)
7934 {
7935 __base.setf(ios_base::showpos);
7936 return __base;
7937 }
7938 inline ios_base&
7939 noshowpos(ios_base& __base)
7940 {
7941 __base.unsetf(ios_base::showpos);
7942 return __base;
7943 }
7944 inline ios_base&
7945 skipws(ios_base& __base)
7946 {
7947 __base.setf(ios_base::skipws);
7948 return __base;
7949 }
7950 inline ios_base&
7951 noskipws(ios_base& __base)
7952 {
7953 __base.unsetf(ios_base::skipws);
7954 return __base;
7955 }
7956 inline ios_base&
7957 uppercase(ios_base& __base)
7958 {
7959 __base.setf(ios_base::uppercase);
7960 return __base;
7961 }
7962 inline ios_base&
7963 nouppercase(ios_base& __base)
7964 {
7965 __base.unsetf(ios_base::uppercase);
7966 return __base;
7967 }
7968 inline ios_base&
7969 unitbuf(ios_base& __base)
7970 {
7971 __base.setf(ios_base::unitbuf);
7972 return __base;
7973 }
7974 inline ios_base&
7975 nounitbuf(ios_base& __base)
7976 {
7977 __base.unsetf(ios_base::unitbuf);
7978 return __base;
7979 }
7980 inline ios_base&
7981 internal(ios_base& __base)
7982 {
7983 __base.setf(ios_base::internal, ios_base::adjustfield);
7984 return __base;
7985 }
7986 inline ios_base&
7987 left(ios_base& __base)
7988 {
7989 __base.setf(ios_base::left, ios_base::adjustfield);
7990 return __base;
7991 }
7992 inline ios_base&
7993 right(ios_base& __base)
7994 {
7995 __base.setf(ios_base::right, ios_base::adjustfield);
7996 return __base;
7997 }
7998 inline ios_base&
7999 dec(ios_base& __base)
8000 {
8001 __base.setf(ios_base::dec, ios_base::basefield);
8002 return __base;
8003 }
8004 inline ios_base&
8005 hex(ios_base& __base)
8006 {
8007 __base.setf(ios_base::hex, ios_base::basefield);
8008 return __base;
8009 }
8010 inline ios_base&
8011 oct(ios_base& __base)
8012 {
8013 __base.setf(ios_base::oct, ios_base::basefield);
8014 return __base;
8015 }
8016 inline ios_base&
8017 fixed(ios_base& __base)
8018 {
8019 __base.setf(ios_base::fixed, ios_base::floatfield);
8020 return __base;
8021 }
8022 inline ios_base&
8023 scientific(ios_base& __base)
8024 {
8025 __base.setf(ios_base::scientific, ios_base::floatfield);
8026 return __base;
8027 }
8028 }
8029 namespace std __attribute__ ((__visibility__ ("default"))) {
8030 template<typename _CharT, typename _Traits>
8031 streamsize
8032 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
8033 basic_streambuf<_CharT, _Traits>*, bool&);
8034 template<typename _CharT, typename _Traits>
8035 class basic_streambuf
8036 {
8037 public:
8038 typedef _CharT char_type;
8039 typedef _Traits traits_type;
8040 typedef typename traits_type::int_type int_type;
8041 typedef typename traits_type::pos_type pos_type;
8042 typedef typename traits_type::off_type off_type;
8043 typedef basic_streambuf<char_type, traits_type> __streambuf_type;
8044 friend class basic_ios<char_type, traits_type>;
8045 friend class basic_istream<char_type, traits_type>;
8046 friend class basic_ostream<char_type, traits_type>;
8047 friend class istreambuf_iterator<char_type, traits_type>;
8048 friend class ostreambuf_iterator<char_type, traits_type>;
8049 friend streamsize
8050 __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&);
8051 template<bool _IsMove, typename _CharT2>
8052 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8053 _CharT2*>::__type
8054 __copy_move_a2(istreambuf_iterator<_CharT2>,
8055 istreambuf_iterator<_CharT2>, _CharT2*);
8056 template<typename _CharT2>
8057 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8058 istreambuf_iterator<_CharT2> >::__type
8059 find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
8060 const _CharT2&);
8061 template<typename _CharT2, typename _Traits2>
8062 friend basic_istream<_CharT2, _Traits2>&
8063 operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);
8064 template<typename _CharT2, typename _Traits2, typename _Alloc>
8065 friend basic_istream<_CharT2, _Traits2>&
8066 operator>>(basic_istream<_CharT2, _Traits2>&,
8067 basic_string<_CharT2, _Traits2, _Alloc>&);
8068 template<typename _CharT2, typename _Traits2, typename _Alloc>
8069 friend basic_istream<_CharT2, _Traits2>&
8070 getline(basic_istream<_CharT2, _Traits2>&,
8071 basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2);
8072 protected:
8073 char_type* _M_in_beg;
8074 char_type* _M_in_cur;
8075 char_type* _M_in_end;
8076 char_type* _M_out_beg;
8077 char_type* _M_out_cur;
8078 char_type* _M_out_end;
8079 locale _M_buf_locale;
8080 public:
8081 virtual
8082 ~basic_streambuf()
8083 { }
8084 locale
8085 pubimbue(const locale &__loc)
8086 {
8087 locale __tmp(this->getloc());
8088 this->imbue(__loc);
8089 _M_buf_locale = __loc;
8090 return __tmp;
8091 }
8092 locale
8093 getloc() const
8094 { return _M_buf_locale; }
8095 __streambuf_type*
8096 pubsetbuf(char_type* __s, streamsize __n)
8097 { return this->setbuf(__s, __n); }
8098 pos_type
8099 pubseekoff(off_type __off, ios_base::seekdir __way,
8100 ios_base::openmode __mode = ios_base::in | ios_base::out)
8101 { return this->seekoff(__off, __way, __mode); }
8102 pos_type
8103 pubseekpos(pos_type __sp,
8104 ios_base::openmode __mode = ios_base::in | ios_base::out)
8105 { return this->seekpos(__sp, __mode); }
8106 int
8107 pubsync() { return this->sync(); }
8108 streamsize
8109 in_avail()
8110 {
8111 const streamsize __ret = this->egptr() - this->gptr();
8112 return __ret ? __ret : this->showmanyc();
8113 }
8114 int_type
8115 snextc()
8116 {
8117 int_type __ret = traits_type::eof();
8118 if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(),
8119 __ret), true))
8120 __ret = this->sgetc();
8121 return __ret;
8122 }
8123 int_type
8124 sbumpc()
8125 {
8126 int_type __ret;
8127 if (__builtin_expect(this->gptr() < this->egptr(), true))
8128 {
8129 __ret = traits_type::to_int_type(*this->gptr());
8130 this->gbump(1);
8131 }
8132 else
8133 __ret = this->uflow();
8134 return __ret;
8135 }
8136 int_type
8137 sgetc()
8138 {
8139 int_type __ret;
8140 if (__builtin_expect(this->gptr() < this->egptr(), true))
8141 __ret = traits_type::to_int_type(*this->gptr());
8142 else
8143 __ret = this->underflow();
8144 return __ret;
8145 }
8146 streamsize
8147 sgetn(char_type* __s, streamsize __n)
8148 { return this->xsgetn(__s, __n); }
8149 int_type
8150 sputbackc(char_type __c)
8151 {
8152 int_type __ret;
8153 const bool __testpos = this->eback() < this->gptr();
8154 if (__builtin_expect(!__testpos ||
8155 !traits_type::eq(__c, this->gptr()[-1]), false))
8156 __ret = this->pbackfail(traits_type::to_int_type(__c));
8157 else
8158 {
8159 this->gbump(-1);
8160 __ret = traits_type::to_int_type(*this->gptr());
8161 }
8162 return __ret;
8163 }
8164 int_type
8165 sungetc()
8166 {
8167 int_type __ret;
8168 if (__builtin_expect(this->eback() < this->gptr(), true))
8169 {
8170 this->gbump(-1);
8171 __ret = traits_type::to_int_type(*this->gptr());
8172 }
8173 else
8174 __ret = this->pbackfail();
8175 return __ret;
8176 }
8177 int_type
8178 sputc(char_type __c)
8179 {
8180 int_type __ret;
8181 if (__builtin_expect(this->pptr() < this->epptr(), true))
8182 {
8183 *this->pptr() = __c;
8184 this->pbump(1);
8185 __ret = traits_type::to_int_type(__c);
8186 }
8187 else
8188 __ret = this->overflow(traits_type::to_int_type(__c));
8189 return __ret;
8190 }
8191 streamsize
8192 sputn(const char_type* __s, streamsize __n)
8193 { return this->xsputn(__s, __n); }
8194 protected:
8195 basic_streambuf()
8196 : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
8197 _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
8198 _M_buf_locale(locale())
8199 { }
8200 char_type*
8201 eback() const { return _M_in_beg; }
8202 char_type*
8203 gptr() const { return _M_in_cur; }
8204 char_type*
8205 egptr() const { return _M_in_end; }
8206 void
8207 gbump(int __n) { _M_in_cur += __n; }
8208 void
8209 setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
8210 {
8211 _M_in_beg = __gbeg;
8212 _M_in_cur = __gnext;
8213 _M_in_end = __gend;
8214 }
8215 char_type*
8216 pbase() const { return _M_out_beg; }
8217 char_type*
8218 pptr() const { return _M_out_cur; }
8219 char_type*
8220 epptr() const { return _M_out_end; }
8221 void
8222 pbump(int __n) { _M_out_cur += __n; }
8223 void
8224 setp(char_type* __pbeg, char_type* __pend)
8225 {
8226 _M_out_beg = _M_out_cur = __pbeg;
8227 _M_out_end = __pend;
8228 }
8229 virtual void
8230 imbue(const locale&)
8231 { }
8232 virtual basic_streambuf<char_type,_Traits>*
8233 setbuf(char_type*, streamsize)
8234 { return this; }
8235 virtual pos_type
8236 seekoff(off_type, ios_base::seekdir,
8237 ios_base::openmode = ios_base::in | ios_base::out)
8238 { return pos_type(off_type(-1)); }
8239 virtual pos_type
8240 seekpos(pos_type,
8241 ios_base::openmode = ios_base::in | ios_base::out)
8242 { return pos_type(off_type(-1)); }
8243 virtual int
8244 sync() { return 0; }
8245 virtual streamsize
8246 showmanyc() { return 0; }
8247 virtual streamsize
8248 xsgetn(char_type* __s, streamsize __n);
8249 virtual int_type
8250 underflow()
8251 { return traits_type::eof(); }
8252 virtual int_type
8253 uflow()
8254 {
8255 int_type __ret = traits_type::eof();
8256 const bool __testeof = traits_type::eq_int_type(this->underflow(),
8257 __ret);
8258 if (!__testeof)
8259 {
8260 __ret = traits_type::to_int_type(*this->gptr());
8261 this->gbump(1);
8262 }
8263 return __ret;
8264 }
8265 virtual int_type
8266 pbackfail(int_type = traits_type::eof())
8267 { return traits_type::eof(); }
8268 virtual streamsize
8269 xsputn(const char_type* __s, streamsize __n);
8270 virtual int_type
8271 overflow(int_type = traits_type::eof())
8272 { return traits_type::eof(); }
8273 public:
8274 void
8275 stossc()
8276 {
8277 if (this->gptr() < this->egptr())
8278 this->gbump(1);
8279 else
8280 this->uflow();
8281 }
8282 private:
8283 basic_streambuf(const __streambuf_type& __sb)
8284 : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
8285 _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
8286 _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
8287 _M_buf_locale(__sb._M_buf_locale)
8288 { }
8289 __streambuf_type&
8290 operator=(const __streambuf_type&) { return *this; };
8291 };
8292 template<>
8293 streamsize
8294 __copy_streambufs_eof(basic_streambuf<char>* __sbin,
8295 basic_streambuf<char>* __sbout, bool& __ineof);
8296 }
8297 namespace std __attribute__ ((__visibility__ ("default"))) {
8298 template<typename _CharT, typename _Traits>
8299 streamsize
8300 basic_streambuf<_CharT, _Traits>::
8301 xsgetn(char_type* __s, streamsize __n)
8302 {
8303 streamsize __ret = 0;
8304 while (__ret < __n)
8305 {
8306 const streamsize __buf_len = this->egptr() - this->gptr();
8307 if (__buf_len)
8308 {
8309 const streamsize __remaining = __n - __ret;
8310 const streamsize __len = std::min(__buf_len, __remaining);
8311 traits_type::copy(__s, this->gptr(), __len);
8312 __ret += __len;
8313 __s += __len;
8314 this->gbump(__len);
8315 }
8316 if (__ret < __n)
8317 {
8318 const int_type __c = this->uflow();
8319 if (!traits_type::eq_int_type(__c, traits_type::eof()))
8320 {
8321 traits_type::assign(*__s++, traits_type::to_char_type(__c));
8322 ++__ret;
8323 }
8324 else
8325 break;
8326 }
8327 }
8328 return __ret;
8329 }
8330 template<typename _CharT, typename _Traits>
8331 streamsize
8332 basic_streambuf<_CharT, _Traits>::
8333 xsputn(const char_type* __s, streamsize __n)
8334 {
8335 streamsize __ret = 0;
8336 while (__ret < __n)
8337 {
8338 const streamsize __buf_len = this->epptr() - this->pptr();
8339 if (__buf_len)
8340 {
8341 const streamsize __remaining = __n - __ret;
8342 const streamsize __len = std::min(__buf_len, __remaining);
8343 traits_type::copy(this->pptr(), __s, __len);
8344 __ret += __len;
8345 __s += __len;
8346 this->pbump(__len);
8347 }
8348 if (__ret < __n)
8349 {
8350 int_type __c = this->overflow(traits_type::to_int_type(*__s));
8351 if (!traits_type::eq_int_type(__c, traits_type::eof()))
8352 {
8353 ++__ret;
8354 ++__s;
8355 }
8356 else
8357 break;
8358 }
8359 }
8360 return __ret;
8361 }
8362 template<typename _CharT, typename _Traits>
8363 streamsize
8364 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin,
8365 basic_streambuf<_CharT, _Traits>* __sbout,
8366 bool& __ineof)
8367 {
8368 streamsize __ret = 0;
8369 __ineof = true;
8370 typename _Traits::int_type __c = __sbin->sgetc();
8371 while (!_Traits::eq_int_type(__c, _Traits::eof()))
8372 {
8373 __c = __sbout->sputc(_Traits::to_char_type(__c));
8374 if (_Traits::eq_int_type(__c, _Traits::eof()))
8375 {
8376 __ineof = false;
8377 break;
8378 }
8379 ++__ret;
8380 __c = __sbin->snextc();
8381 }
8382 return __ret;
8383 }
8384 template<typename _CharT, typename _Traits>
8385 inline streamsize
8386 __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,
8387 basic_streambuf<_CharT, _Traits>* __sbout)
8388 {
8389 bool __ineof;
8390 return __copy_streambufs_eof(__sbin, __sbout, __ineof);
8391 }
8392 extern template class basic_streambuf<char>;
8393 extern template
8394 streamsize
8395 __copy_streambufs(basic_streambuf<char>*,
8396 basic_streambuf<char>*);
8397 extern template
8398 streamsize
8399 __copy_streambufs_eof(basic_streambuf<char>*,
8400 basic_streambuf<char>*, bool&);
8401 }
8402 namespace std __attribute__ ((__visibility__ ("default"))) {
8403 struct ctype_base
8404 {
8405 typedef const __ctype_touplow_t* __to_type;
8406 typedef __ctype_mask_t mask;
8407 static const mask upper = _ISupper;
8408 static const mask lower = _ISlower;
8409 static const mask alpha = _ISalpha;
8410 static const mask digit = _ISdigit;
8411 static const mask xdigit = _ISxdigit;
8412 static const mask space = _ISspace;
8413 static const mask print = _ISprint;
8414 static const mask graph = _ISalpha | _ISdigit | _ISpunct;
8415 static const mask cntrl = _IScntrl;
8416 static const mask punct = _ISpunct;
8417 static const mask alnum = _ISalpha | _ISdigit;
8418 };
8419 }
8420 namespace std __attribute__ ((__visibility__ ("default"))) {
8421 template<typename _CharT, typename _Traits>
8422 class istreambuf_iterator
8423 : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type,
8424 _CharT*, _CharT&>
8425 {
8426 public:
8427 typedef _CharT char_type;
8428 typedef _Traits traits_type;
8429 typedef typename _Traits::int_type int_type;
8430 typedef basic_streambuf<_CharT, _Traits> streambuf_type;
8431 typedef basic_istream<_CharT, _Traits> istream_type;
8432 template<typename _CharT2>
8433 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8434 ostreambuf_iterator<_CharT2> >::__type
8435 copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
8436 ostreambuf_iterator<_CharT2>);
8437 template<bool _IsMove, typename _CharT2>
8438 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8439 _CharT2*>::__type
8440 __copy_move_a2(istreambuf_iterator<_CharT2>,
8441 istreambuf_iterator<_CharT2>, _CharT2*);
8442 template<typename _CharT2>
8443 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8444 istreambuf_iterator<_CharT2> >::__type
8445 find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
8446 const _CharT2&);
8447 private:
8448 mutable streambuf_type* _M_sbuf;
8449 mutable int_type _M_c;
8450 public:
8451 istreambuf_iterator() throw()
8452 : _M_sbuf(0), _M_c(traits_type::eof()) { }
8453 istreambuf_iterator(istream_type& __s) throw()
8454 : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { }
8455 istreambuf_iterator(streambuf_type* __s) throw()
8456 : _M_sbuf(__s), _M_c(traits_type::eof()) { }
8457 char_type
8458 operator*() const
8459 {
8460 return traits_type::to_char_type(_M_get());
8461 }
8462 istreambuf_iterator&
8463 operator++()
8464 {
8465 ;
8466 if (_M_sbuf)
8467 {
8468 _M_sbuf->sbumpc();
8469 _M_c = traits_type::eof();
8470 }
8471 return *this;
8472 }
8473 istreambuf_iterator
8474 operator++(int)
8475 {
8476 ;
8477 istreambuf_iterator __old = *this;
8478 if (_M_sbuf)
8479 {
8480 __old._M_c = _M_sbuf->sbumpc();
8481 _M_c = traits_type::eof();
8482 }
8483 return __old;
8484 }
8485 bool
8486 equal(const istreambuf_iterator& __b) const
8487 { return _M_at_eof() == __b._M_at_eof(); }
8488 private:
8489 int_type
8490 _M_get() const
8491 {
8492 const int_type __eof = traits_type::eof();
8493 int_type __ret = __eof;
8494 if (_M_sbuf)
8495 {
8496 if (!traits_type::eq_int_type(_M_c, __eof))
8497 __ret = _M_c;
8498 else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()),
8499 __eof))
8500 _M_c = __ret;
8501 else
8502 _M_sbuf = 0;
8503 }
8504 return __ret;
8505 }
8506 bool
8507 _M_at_eof() const
8508 {
8509 const int_type __eof = traits_type::eof();
8510 return traits_type::eq_int_type(_M_get(), __eof);
8511 }
8512 };
8513 template<typename _CharT, typename _Traits>
8514 inline bool
8515 operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
8516 const istreambuf_iterator<_CharT, _Traits>& __b)
8517 { return __a.equal(__b); }
8518 template<typename _CharT, typename _Traits>
8519 inline bool
8520 operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
8521 const istreambuf_iterator<_CharT, _Traits>& __b)
8522 { return !__a.equal(__b); }
8523 template<typename _CharT, typename _Traits>
8524 class ostreambuf_iterator
8525 : public iterator<output_iterator_tag, void, void, void, void>
8526 {
8527 public:
8528 typedef _CharT char_type;
8529 typedef _Traits traits_type;
8530 typedef basic_streambuf<_CharT, _Traits> streambuf_type;
8531 typedef basic_ostream<_CharT, _Traits> ostream_type;
8532 template<typename _CharT2>
8533 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
8534 ostreambuf_iterator<_CharT2> >::__type
8535 copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
8536 ostreambuf_iterator<_CharT2>);
8537 private:
8538 streambuf_type* _M_sbuf;
8539 bool _M_failed;
8540 public:
8541 ostreambuf_iterator(ostream_type& __s) throw ()
8542 : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { }
8543 ostreambuf_iterator(streambuf_type* __s) throw ()
8544 : _M_sbuf(__s), _M_failed(!_M_sbuf) { }
8545 ostreambuf_iterator&
8546 operator=(_CharT __c)
8547 {
8548 if (!_M_failed &&
8549 _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof()))
8550 _M_failed = true;
8551 return *this;
8552 }
8553 ostreambuf_iterator&
8554 operator*()
8555 { return *this; }
8556 ostreambuf_iterator&
8557 operator++(int)
8558 { return *this; }
8559 ostreambuf_iterator&
8560 operator++()
8561 { return *this; }
8562 bool
8563 failed() const throw()
8564 { return _M_failed; }
8565 ostreambuf_iterator&
8566 _M_put(const _CharT* __ws, streamsize __len)
8567 {
8568 if (__builtin_expect(!_M_failed, true)
8569 && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len,
8570 false))
8571 _M_failed = true;
8572 return *this;
8573 }
8574 };
8575 template<typename _CharT>
8576 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
8577 ostreambuf_iterator<_CharT> >::__type
8578 copy(istreambuf_iterator<_CharT> __first,
8579 istreambuf_iterator<_CharT> __last,
8580 ostreambuf_iterator<_CharT> __result)
8581 {
8582 if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed)
8583 {
8584 bool __ineof;
8585 __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof);
8586 if (!__ineof)
8587 __result._M_failed = true;
8588 }
8589 return __result;
8590 }
8591 template<bool _IsMove, typename _CharT>
8592 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
8593 ostreambuf_iterator<_CharT> >::__type
8594 __copy_move_a2(_CharT* __first, _CharT* __last,
8595 ostreambuf_iterator<_CharT> __result)
8596 {
8597 const streamsize __num = __last - __first;
8598 if (__num > 0)
8599 __result._M_put(__first, __num);
8600 return __result;
8601 }
8602 template<bool _IsMove, typename _CharT>
8603 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
8604 ostreambuf_iterator<_CharT> >::__type
8605 __copy_move_a2(const _CharT* __first, const _CharT* __last,
8606 ostreambuf_iterator<_CharT> __result)
8607 {
8608 const streamsize __num = __last - __first;
8609 if (__num > 0)
8610 __result._M_put(__first, __num);
8611 return __result;
8612 }
8613 template<bool _IsMove, typename _CharT>
8614 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
8615 _CharT*>::__type
8616 __copy_move_a2(istreambuf_iterator<_CharT> __first,
8617 istreambuf_iterator<_CharT> __last, _CharT* __result)
8618 {
8619 typedef istreambuf_iterator<_CharT> __is_iterator_type;
8620 typedef typename __is_iterator_type::traits_type traits_type;
8621 typedef typename __is_iterator_type::streambuf_type streambuf_type;
8622 typedef typename traits_type::int_type int_type;
8623 if (__first._M_sbuf && !__last._M_sbuf)
8624 {
8625 streambuf_type* __sb = __first._M_sbuf;
8626 int_type __c = __sb->sgetc();
8627 while (!traits_type::eq_int_type(__c, traits_type::eof()))
8628 {
8629 const streamsize __n = __sb->egptr() - __sb->gptr();
8630 if (__n > 1)
8631 {
8632 traits_type::copy(__result, __sb->gptr(), __n);
8633 __sb->gbump(__n);
8634 __result += __n;
8635 __c = __sb->underflow();
8636 }
8637 else
8638 {
8639 *__result++ = traits_type::to_char_type(__c);
8640 __c = __sb->snextc();
8641 }
8642 }
8643 }
8644 return __result;
8645 }
8646 template<typename _CharT>
8647 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
8648 istreambuf_iterator<_CharT> >::__type
8649 find(istreambuf_iterator<_CharT> __first,
8650 istreambuf_iterator<_CharT> __last, const _CharT& __val)
8651 {
8652 typedef istreambuf_iterator<_CharT> __is_iterator_type;
8653 typedef typename __is_iterator_type::traits_type traits_type;
8654 typedef typename __is_iterator_type::streambuf_type streambuf_type;
8655 typedef typename traits_type::int_type int_type;
8656 if (__first._M_sbuf && !__last._M_sbuf)
8657 {
8658 const int_type __ival = traits_type::to_int_type(__val);
8659 streambuf_type* __sb = __first._M_sbuf;
8660 int_type __c = __sb->sgetc();
8661 while (!traits_type::eq_int_type(__c, traits_type::eof())
8662 && !traits_type::eq_int_type(__c, __ival))
8663 {
8664 streamsize __n = __sb->egptr() - __sb->gptr();
8665 if (__n > 1)
8666 {
8667 const _CharT* __p = traits_type::find(__sb->gptr(),
8668 __n, __val);
8669 if (__p)
8670 __n = __p - __sb->gptr();
8671 __sb->gbump(__n);
8672 __c = __sb->sgetc();
8673 }
8674 else
8675 __c = __sb->snextc();
8676 }
8677 if (!traits_type::eq_int_type(__c, traits_type::eof()))
8678 __first._M_c = __c;
8679 else
8680 __first._M_sbuf = 0;
8681 }
8682 return __first;
8683 }
8684 }
8685 namespace std __attribute__ ((__visibility__ ("default"))) {
8686 template<typename _Tv>
8687 void
8688 __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
8689 const __c_locale& __cloc);
8690 template<>
8691 void
8692 __convert_to_v(const char*, float&, ios_base::iostate&,
8693 const __c_locale&);
8694 template<>
8695 void
8696 __convert_to_v(const char*, double&, ios_base::iostate&,
8697 const __c_locale&);
8698 template<>
8699 void
8700 __convert_to_v(const char*, long double&, ios_base::iostate&,
8701 const __c_locale&);
8702 template<typename _CharT, typename _Traits>
8703 struct __pad
8704 {
8705 static void
8706 _S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
8707 const _CharT* __olds, const streamsize __newlen,
8708 const streamsize __oldlen);
8709 };
8710 template<typename _CharT>
8711 _CharT*
8712 __add_grouping(_CharT* __s, _CharT __sep,
8713 const char* __gbeg, size_t __gsize,
8714 const _CharT* __first, const _CharT* __last);
8715 template<typename _CharT>
8716 inline
8717 ostreambuf_iterator<_CharT>
8718 __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len)
8719 {
8720 __s._M_put(__ws, __len);
8721 return __s;
8722 }
8723 template<typename _CharT, typename _OutIter>
8724 inline
8725 _OutIter
8726 __write(_OutIter __s, const _CharT* __ws, int __len)
8727 {
8728 for (int __j = 0; __j < __len; __j++, ++__s)
8729 *__s = __ws[__j];
8730 return __s;
8731 }
8732 template<typename _CharT>
8733 class __ctype_abstract_base : public locale::facet, public ctype_base
8734 {
8735 public:
8736 typedef _CharT char_type;
8737 bool
8738 is(mask __m, char_type __c) const
8739 { return this->do_is(__m, __c); }
8740 const char_type*
8741 is(const char_type *__lo, const char_type *__hi, mask *__vec) const
8742 { return this->do_is(__lo, __hi, __vec); }
8743 const char_type*
8744 scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
8745 { return this->do_scan_is(__m, __lo, __hi); }
8746 const char_type*
8747 scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
8748 { return this->do_scan_not(__m, __lo, __hi); }
8749 char_type
8750 toupper(char_type __c) const
8751 { return this->do_toupper(__c); }
8752 const char_type*
8753 toupper(char_type *__lo, const char_type* __hi) const
8754 { return this->do_toupper(__lo, __hi); }
8755 char_type
8756 tolower(char_type __c) const
8757 { return this->do_tolower(__c); }
8758 const char_type*
8759 tolower(char_type* __lo, const char_type* __hi) const
8760 { return this->do_tolower(__lo, __hi); }
8761 char_type
8762 widen(char __c) const
8763 { return this->do_widen(__c); }
8764 const char*
8765 widen(const char* __lo, const char* __hi, char_type* __to) const
8766 { return this->do_widen(__lo, __hi, __to); }
8767 char
8768 narrow(char_type __c, char __dfault) const
8769 { return this->do_narrow(__c, __dfault); }
8770 const char_type*
8771 narrow(const char_type* __lo, const char_type* __hi,
8772 char __dfault, char *__to) const
8773 { return this->do_narrow(__lo, __hi, __dfault, __to); }
8774 protected:
8775 explicit
8776 __ctype_abstract_base(size_t __refs = 0): facet(__refs) { }
8777 virtual
8778 ~__ctype_abstract_base() { }
8779 virtual bool
8780 do_is(mask __m, char_type __c) const = 0;
8781 virtual const char_type*
8782 do_is(const char_type* __lo, const char_type* __hi,
8783 mask* __vec) const = 0;
8784 virtual const char_type*
8785 do_scan_is(mask __m, const char_type* __lo,
8786 const char_type* __hi) const = 0;
8787 virtual const char_type*
8788 do_scan_not(mask __m, const char_type* __lo,
8789 const char_type* __hi) const = 0;
8790 virtual char_type
8791 do_toupper(char_type) const = 0;
8792 virtual const char_type*
8793 do_toupper(char_type* __lo, const char_type* __hi) const = 0;
8794 virtual char_type
8795 do_tolower(char_type) const = 0;
8796 virtual const char_type*
8797 do_tolower(char_type* __lo, const char_type* __hi) const = 0;
8798 virtual char_type
8799 do_widen(char) const = 0;
8800 virtual const char*
8801 do_widen(const char* __lo, const char* __hi,
8802 char_type* __dest) const = 0;
8803 virtual char
8804 do_narrow(char_type, char __dfault) const = 0;
8805 virtual const char_type*
8806 do_narrow(const char_type* __lo, const char_type* __hi,
8807 char __dfault, char* __dest) const = 0;
8808 };
8809 template<typename _CharT>
8810 class ctype : public __ctype_abstract_base<_CharT>
8811 {
8812 public:
8813 typedef _CharT char_type;
8814 typedef typename __ctype_abstract_base<_CharT>::mask mask;
8815 static locale::id id;
8816 explicit
8817 ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
8818 protected:
8819 virtual
8820 ~ctype();
8821 virtual bool
8822 do_is(mask __m, char_type __c) const;
8823 virtual const char_type*
8824 do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
8825 virtual const char_type*
8826 do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
8827 virtual const char_type*
8828 do_scan_not(mask __m, const char_type* __lo,
8829 const char_type* __hi) const;
8830 virtual char_type
8831 do_toupper(char_type __c) const;
8832 virtual const char_type*
8833 do_toupper(char_type* __lo, const char_type* __hi) const;
8834 virtual char_type
8835 do_tolower(char_type __c) const;
8836 virtual const char_type*
8837 do_tolower(char_type* __lo, const char_type* __hi) const;
8838 virtual char_type
8839 do_widen(char __c) const;
8840 virtual const char*
8841 do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
8842 virtual char
8843 do_narrow(char_type, char __dfault) const;
8844 virtual const char_type*
8845 do_narrow(const char_type* __lo, const char_type* __hi,
8846 char __dfault, char* __dest) const;
8847 };
8848 template<typename _CharT>
8849 locale::id ctype<_CharT>::id;
8850 template<>
8851 class ctype<char> : public locale::facet, public ctype_base
8852 {
8853 public:
8854 typedef char char_type;
8855 protected:
8856 __c_locale _M_c_locale_ctype;
8857 bool _M_del;
8858 __to_type _M_toupper;
8859 __to_type _M_tolower;
8860 const mask* _M_table;
8861 mutable char _M_widen_ok;
8862 mutable char _M_widen[1 + static_cast<unsigned char>(-1)];
8863 mutable char _M_narrow[1 + static_cast<unsigned char>(-1)];
8864 mutable char _M_narrow_ok;
8865 public:
8866 static locale::id id;
8867 static const size_t table_size = 1 + static_cast<unsigned char>(-1);
8868 explicit
8869 ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
8870 explicit
8871 ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
8872 size_t __refs = 0);
8873 inline bool
8874 is(mask __m, char __c) const;
8875 inline const char*
8876 is(const char* __lo, const char* __hi, mask* __vec) const;
8877 inline const char*
8878 scan_is(mask __m, const char* __lo, const char* __hi) const;
8879 inline const char*
8880 scan_not(mask __m, const char* __lo, const char* __hi) const;
8881 char_type
8882 toupper(char_type __c) const
8883 { return this->do_toupper(__c); }
8884 const char_type*
8885 toupper(char_type *__lo, const char_type* __hi) const
8886 { return this->do_toupper(__lo, __hi); }
8887 char_type
8888 tolower(char_type __c) const
8889 { return this->do_tolower(__c); }
8890 const char_type*
8891 tolower(char_type* __lo, const char_type* __hi) const
8892 { return this->do_tolower(__lo, __hi); }
8893 char_type
8894 widen(char __c) const
8895 {
8896 if (_M_widen_ok)
8897 return _M_widen[static_cast<unsigned char>(__c)];
8898 this->_M_widen_init();
8899 return this->do_widen(__c);
8900 }
8901 const char*
8902 widen(const char* __lo, const char* __hi, char_type* __to) const
8903 {
8904 if (_M_widen_ok == 1)
8905 {
8906 __builtin_memcpy(__to, __lo, __hi - __lo);
8907 return __hi;
8908 }
8909 if (!_M_widen_ok)
8910 _M_widen_init();
8911 return this->do_widen(__lo, __hi, __to);
8912 }
8913 char
8914 narrow(char_type __c, char __dfault) const
8915 {
8916 if (_M_narrow[static_cast<unsigned char>(__c)])
8917 return _M_narrow[static_cast<unsigned char>(__c)];
8918 const char __t = do_narrow(__c, __dfault);
8919 if (__t != __dfault)
8920 _M_narrow[static_cast<unsigned char>(__c)] = __t;
8921 return __t;
8922 }
8923 const char_type*
8924 narrow(const char_type* __lo, const char_type* __hi,
8925 char __dfault, char *__to) const
8926 {
8927 if (__builtin_expect(_M_narrow_ok == 1, true))
8928 {
8929 __builtin_memcpy(__to, __lo, __hi - __lo);
8930 return __hi;
8931 }
8932 if (!_M_narrow_ok)
8933 _M_narrow_init();
8934 return this->do_narrow(__lo, __hi, __dfault, __to);
8935 }
8936 const mask*
8937 table() const throw()
8938 { return _M_table; }
8939 static const mask*
8940 classic_table() throw();
8941 protected:
8942 virtual
8943 ~ctype();
8944 virtual char_type
8945 do_toupper(char_type) const;
8946 virtual const char_type*
8947 do_toupper(char_type* __lo, const char_type* __hi) const;
8948 virtual char_type
8949 do_tolower(char_type) const;
8950 virtual const char_type*
8951 do_tolower(char_type* __lo, const char_type* __hi) const;
8952 virtual char_type
8953 do_widen(char __c) const
8954 { return __c; }
8955 virtual const char*
8956 do_widen(const char* __lo, const char* __hi, char_type* __dest) const
8957 {
8958 __builtin_memcpy(__dest, __lo, __hi - __lo);
8959 return __hi;
8960 }
8961 virtual char
8962 do_narrow(char_type __c, char) const
8963 { return __c; }
8964 virtual const char_type*
8965 do_narrow(const char_type* __lo, const char_type* __hi,
8966 char, char* __dest) const
8967 {
8968 __builtin_memcpy(__dest, __lo, __hi - __lo);
8969 return __hi;
8970 }
8971 private:
8972 void _M_widen_init() const
8973 {
8974 char __tmp[sizeof(_M_widen)];
8975 for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
8976 __tmp[__i] = __i;
8977 do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
8978 _M_widen_ok = 1;
8979 if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen)))
8980 _M_widen_ok = 2;
8981 }
8982 void _M_narrow_init() const
8983 {
8984 char __tmp[sizeof(_M_narrow)];
8985 for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
8986 __tmp[__i] = __i;
8987 do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
8988 _M_narrow_ok = 1;
8989 if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
8990 _M_narrow_ok = 2;
8991 else
8992 {
8993 char __c;
8994 do_narrow(__tmp, __tmp + 1, 1, &__c);
8995 if (__c == 1)
8996 _M_narrow_ok = 2;
8997 }
8998 }
8999 };
9000 template<>
9001 const ctype<char>&
9002 use_facet<ctype<char> >(const locale& __loc);
9003 template<typename _CharT>
9004 class ctype_byname : public ctype<_CharT>
9005 {
9006 public:
9007 typedef typename ctype<_CharT>::mask mask;
9008 explicit
9009 ctype_byname(const char* __s, size_t __refs = 0);
9010 protected:
9011 virtual
9012 ~ctype_byname() { };
9013 };
9014 template<>
9015 class ctype_byname<char> : public ctype<char>
9016 {
9017 public:
9018 explicit
9019 ctype_byname(const char* __s, size_t __refs = 0);
9020 protected:
9021 virtual
9022 ~ctype_byname();
9023 };
9024 }
9025 namespace std __attribute__ ((__visibility__ ("default"))) {
9026 bool
9027 ctype<char>::
9028 is(mask __m, char __c) const
9029 { return _M_table[static_cast<unsigned char>(__c)] & __m; }
9030 const char*
9031 ctype<char>::
9032 is(const char* __low, const char* __high, mask* __vec) const
9033 {
9034 while (__low < __high)
9035 *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
9036 return __high;
9037 }
9038 const char*
9039 ctype<char>::
9040 scan_is(mask __m, const char* __low, const char* __high) const
9041 {
9042 while (__low < __high
9043 && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
9044 ++__low;
9045 return __low;
9046 }
9047 const char*
9048 ctype<char>::
9049 scan_not(mask __m, const char* __low, const char* __high) const
9050 {
9051 while (__low < __high
9052 && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
9053 ++__low;
9054 return __low;
9055 }
9056 }
9057 namespace std __attribute__ ((__visibility__ ("default"))) {
9058 class __num_base
9059 {
9060 public:
9061 enum
9062 {
9063 _S_ominus,
9064 _S_oplus,
9065 _S_ox,
9066 _S_oX,
9067 _S_odigits,
9068 _S_odigits_end = _S_odigits + 16,
9069 _S_oudigits = _S_odigits_end,
9070 _S_oudigits_end = _S_oudigits + 16,
9071 _S_oe = _S_odigits + 14,
9072 _S_oE = _S_oudigits + 14,
9073 _S_oend = _S_oudigits_end
9074 };
9075 static const char* _S_atoms_out;
9076 static const char* _S_atoms_in;
9077 enum
9078 {
9079 _S_iminus,
9080 _S_iplus,
9081 _S_ix,
9082 _S_iX,
9083 _S_izero,
9084 _S_ie = _S_izero + 14,
9085 _S_iE = _S_izero + 20,
9086 _S_iend = 26
9087 };
9088 static void
9089 _S_format_float(const ios_base& __io, char* __fptr, char __mod);
9090 };
9091 template<typename _CharT>
9092 struct __numpunct_cache : public locale::facet
9093 {
9094 const char* _M_grouping;
9095 size_t _M_grouping_size;
9096 bool _M_use_grouping;
9097 const _CharT* _M_truename;
9098 size_t _M_truename_size;
9099 const _CharT* _M_falsename;
9100 size_t _M_falsename_size;
9101 _CharT _M_decimal_point;
9102 _CharT _M_thousands_sep;
9103 _CharT _M_atoms_out[__num_base::_S_oend];
9104 _CharT _M_atoms_in[__num_base::_S_iend];
9105 bool _M_allocated;
9106 __numpunct_cache(size_t __refs = 0) : facet(__refs),
9107 _M_grouping(__null), _M_grouping_size(0), _M_use_grouping(false),
9108 _M_truename(__null), _M_truename_size(0), _M_falsename(__null),
9109 _M_falsename_size(0), _M_decimal_point(_CharT()),
9110 _M_thousands_sep(_CharT()), _M_allocated(false)
9111 { }
9112 ~__numpunct_cache();
9113 void
9114 _M_cache(const locale& __loc);
9115 private:
9116 __numpunct_cache&
9117 operator=(const __numpunct_cache&);
9118 explicit
9119 __numpunct_cache(const __numpunct_cache&);
9120 };
9121 template<typename _CharT>
9122 __numpunct_cache<_CharT>::~__numpunct_cache()
9123 {
9124 if (_M_allocated)
9125 {
9126 delete [] _M_grouping;
9127 delete [] _M_truename;
9128 delete [] _M_falsename;
9129 }
9130 }
9131 template<typename _CharT>
9132 class numpunct : public locale::facet
9133 {
9134 public:
9135 typedef _CharT char_type;
9136 typedef basic_string<_CharT> string_type;
9137 typedef __numpunct_cache<_CharT> __cache_type;
9138 protected:
9139 __cache_type* _M_data;
9140 public:
9141 static locale::id id;
9142 explicit
9143 numpunct(size_t __refs = 0) : facet(__refs), _M_data(__null)
9144 { _M_initialize_numpunct(); }
9145 explicit
9146 numpunct(__cache_type* __cache, size_t __refs = 0)
9147 : facet(__refs), _M_data(__cache)
9148 { _M_initialize_numpunct(); }
9149 explicit
9150 numpunct(__c_locale __cloc, size_t __refs = 0)
9151 : facet(__refs), _M_data(__null)
9152 { _M_initialize_numpunct(__cloc); }
9153 char_type
9154 decimal_point() const
9155 { return this->do_decimal_point(); }
9156 char_type
9157 thousands_sep() const
9158 { return this->do_thousands_sep(); }
9159 string
9160 grouping() const
9161 { return this->do_grouping(); }
9162 string_type
9163 truename() const
9164 { return this->do_truename(); }
9165 string_type
9166 falsename() const
9167 { return this->do_falsename(); }
9168 protected:
9169 virtual
9170 ~numpunct();
9171 virtual char_type
9172 do_decimal_point() const
9173 { return _M_data->_M_decimal_point; }
9174 virtual char_type
9175 do_thousands_sep() const
9176 { return _M_data->_M_thousands_sep; }
9177 virtual string
9178 do_grouping() const
9179 { return _M_data->_M_grouping; }
9180 virtual string_type
9181 do_truename() const
9182 { return _M_data->_M_truename; }
9183 virtual string_type
9184 do_falsename() const
9185 { return _M_data->_M_falsename; }
9186 void
9187 _M_initialize_numpunct(__c_locale __cloc = __null);
9188 };
9189 template<typename _CharT>
9190 locale::id numpunct<_CharT>::id;
9191 template<>
9192 numpunct<char>::~numpunct();
9193 template<>
9194 void
9195 numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
9196 template<typename _CharT>
9197 class numpunct_byname : public numpunct<_CharT>
9198 {
9199 public:
9200 typedef _CharT char_type;
9201 typedef basic_string<_CharT> string_type;
9202 explicit
9203 numpunct_byname(const char* __s, size_t __refs = 0)
9204 : numpunct<_CharT>(__refs)
9205 {
9206 if (__builtin_strcmp(__s, "C") != 0
9207 && __builtin_strcmp(__s, "POSIX") != 0)
9208 {
9209 __c_locale __tmp;
9210 this->_S_create_c_locale(__tmp, __s);
9211 this->_M_initialize_numpunct(__tmp);
9212 this->_S_destroy_c_locale(__tmp);
9213 }
9214 }
9215 protected:
9216 virtual
9217 ~numpunct_byname() { }
9218 };
9219 template<typename _CharT, typename _InIter>
9220 class num_get : public locale::facet
9221 {
9222 public:
9223 typedef _CharT char_type;
9224 typedef _InIter iter_type;
9225 static locale::id id;
9226 explicit
9227 num_get(size_t __refs = 0) : facet(__refs) { }
9228 iter_type
9229 get(iter_type __in, iter_type __end, ios_base& __io,
9230 ios_base::iostate& __err, bool& __v) const
9231 { return this->do_get(__in, __end, __io, __err, __v); }
9232 iter_type
9233 get(iter_type __in, iter_type __end, ios_base& __io,
9234 ios_base::iostate& __err, long& __v) const
9235 { return this->do_get(__in, __end, __io, __err, __v); }
9236 iter_type
9237 get(iter_type __in, iter_type __end, ios_base& __io,
9238 ios_base::iostate& __err, unsigned short& __v) const
9239 { return this->do_get(__in, __end, __io, __err, __v); }
9240 iter_type
9241 get(iter_type __in, iter_type __end, ios_base& __io,
9242 ios_base::iostate& __err, unsigned int& __v) const
9243 { return this->do_get(__in, __end, __io, __err, __v); }
9244 iter_type
9245 get(iter_type __in, iter_type __end, ios_base& __io,
9246 ios_base::iostate& __err, unsigned long& __v) const
9247 { return this->do_get(__in, __end, __io, __err, __v); }
9248 iter_type
9249 get(iter_type __in, iter_type __end, ios_base& __io,
9250 ios_base::iostate& __err, long long& __v) const
9251 { return this->do_get(__in, __end, __io, __err, __v); }
9252 iter_type
9253 get(iter_type __in, iter_type __end, ios_base& __io,
9254 ios_base::iostate& __err, unsigned long long& __v) const
9255 { return this->do_get(__in, __end, __io, __err, __v); }
9256 iter_type
9257 get(iter_type __in, iter_type __end, ios_base& __io,
9258 ios_base::iostate& __err, float& __v) const
9259 { return this->do_get(__in, __end, __io, __err, __v); }
9260 iter_type
9261 get(iter_type __in, iter_type __end, ios_base& __io,
9262 ios_base::iostate& __err, double& __v) const
9263 { return this->do_get(__in, __end, __io, __err, __v); }
9264 iter_type
9265 get(iter_type __in, iter_type __end, ios_base& __io,
9266 ios_base::iostate& __err, long double& __v) const
9267 { return this->do_get(__in, __end, __io, __err, __v); }
9268 iter_type
9269 get(iter_type __in, iter_type __end, ios_base& __io,
9270 ios_base::iostate& __err, void*& __v) const
9271 { return this->do_get(__in, __end, __io, __err, __v); }
9272 protected:
9273 virtual ~num_get() { }
9274 iter_type
9275 _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
9276 string& __xtrc) const;
9277 template<typename _ValueT>
9278 iter_type
9279 _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
9280 _ValueT& __v) const;
9281 template<typename _CharT2>
9282 typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type
9283 _M_find(const _CharT2*, size_t __len, _CharT2 __c) const
9284 {
9285 int __ret = -1;
9286 if (__len <= 10)
9287 {
9288 if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len))
9289 __ret = __c - _CharT2('0');
9290 }
9291 else
9292 {
9293 if (__c >= _CharT2('0') && __c <= _CharT2('9'))
9294 __ret = __c - _CharT2('0');
9295 else if (__c >= _CharT2('a') && __c <= _CharT2('f'))
9296 __ret = 10 + (__c - _CharT2('a'));
9297 else if (__c >= _CharT2('A') && __c <= _CharT2('F'))
9298 __ret = 10 + (__c - _CharT2('A'));
9299 }
9300 return __ret;
9301 }
9302 template<typename _CharT2>
9303 typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
9304 int>::__type
9305 _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const
9306 {
9307 int __ret = -1;
9308 const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c);
9309 if (__q)
9310 {
9311 __ret = __q - __zero;
9312 if (__ret > 15)
9313 __ret -= 6;
9314 }
9315 return __ret;
9316 }
9317 virtual iter_type
9318 do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
9319 virtual iter_type
9320 do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
9321 virtual iter_type
9322 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9323 unsigned short&) const;
9324 virtual iter_type
9325 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9326 unsigned int&) const;
9327 virtual iter_type
9328 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9329 unsigned long&) const;
9330 virtual iter_type
9331 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9332 long long&) const;
9333 virtual iter_type
9334 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9335 unsigned long long&) const;
9336 virtual iter_type
9337 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9338 float&) const;
9339 virtual iter_type
9340 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9341 double&) const;
9342 virtual iter_type
9343 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9344 long double&) const;
9345 virtual iter_type
9346 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
9347 void*&) const;
9348 };
9349 template<typename _CharT, typename _InIter>
9350 locale::id num_get<_CharT, _InIter>::id;
9351 template<typename _CharT, typename _OutIter>
9352 class num_put : public locale::facet
9353 {
9354 public:
9355 typedef _CharT char_type;
9356 typedef _OutIter iter_type;
9357 static locale::id id;
9358 explicit
9359 num_put(size_t __refs = 0) : facet(__refs) { }
9360 iter_type
9361 put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
9362 { return this->do_put(__s, __f, __fill, __v); }
9363 iter_type
9364 put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
9365 { return this->do_put(__s, __f, __fill, __v); }
9366 iter_type
9367 put(iter_type __s, ios_base& __f, char_type __fill,
9368 unsigned long __v) const
9369 { return this->do_put(__s, __f, __fill, __v); }
9370 iter_type
9371 put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
9372 { return this->do_put(__s, __f, __fill, __v); }
9373 iter_type
9374 put(iter_type __s, ios_base& __f, char_type __fill,
9375 unsigned long long __v) const
9376 { return this->do_put(__s, __f, __fill, __v); }
9377 iter_type
9378 put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
9379 { return this->do_put(__s, __f, __fill, __v); }
9380 iter_type
9381 put(iter_type __s, ios_base& __f, char_type __fill,
9382 long double __v) const
9383 { return this->do_put(__s, __f, __fill, __v); }
9384 iter_type
9385 put(iter_type __s, ios_base& __f, char_type __fill,
9386 const void* __v) const
9387 { return this->do_put(__s, __f, __fill, __v); }
9388 protected:
9389 template<typename _ValueT>
9390 iter_type
9391 _M_insert_float(iter_type, ios_base& __io, char_type __fill,
9392 char __mod, _ValueT __v) const;
9393 void
9394 _M_group_float(const char* __grouping, size_t __grouping_size,
9395 char_type __sep, const char_type* __p, char_type* __new,
9396 char_type* __cs, int& __len) const;
9397 template<typename _ValueT>
9398 iter_type
9399 _M_insert_int(iter_type, ios_base& __io, char_type __fill,
9400 _ValueT __v) const;
9401 void
9402 _M_group_int(const char* __grouping, size_t __grouping_size,
9403 char_type __sep, ios_base& __io, char_type* __new,
9404 char_type* __cs, int& __len) const;
9405 void
9406 _M_pad(char_type __fill, streamsize __w, ios_base& __io,
9407 char_type* __new, const char_type* __cs, int& __len) const;
9408 virtual
9409 ~num_put() { };
9410 virtual iter_type
9411 do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
9412 virtual iter_type
9413 do_put(iter_type, ios_base&, char_type __fill, long __v) const;
9414 virtual iter_type
9415 do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
9416 virtual iter_type
9417 do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
9418 virtual iter_type
9419 do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
9420 virtual iter_type
9421 do_put(iter_type, ios_base&, char_type __fill, double __v) const;
9422 virtual iter_type
9423 do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
9424 virtual iter_type
9425 do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
9426 };
9427 template <typename _CharT, typename _OutIter>
9428 locale::id num_put<_CharT, _OutIter>::id;
9429 template<typename _CharT>
9430 inline bool
9431 isspace(_CharT __c, const locale& __loc)
9432 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
9433 template<typename _CharT>
9434 inline bool
9435 isprint(_CharT __c, const locale& __loc)
9436 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
9437 template<typename _CharT>
9438 inline bool
9439 iscntrl(_CharT __c, const locale& __loc)
9440 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
9441 template<typename _CharT>
9442 inline bool
9443 isupper(_CharT __c, const locale& __loc)
9444 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
9445 template<typename _CharT>
9446 inline bool
9447 islower(_CharT __c, const locale& __loc)
9448 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
9449 template<typename _CharT>
9450 inline bool
9451 isalpha(_CharT __c, const locale& __loc)
9452 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
9453 template<typename _CharT>
9454 inline bool
9455 isdigit(_CharT __c, const locale& __loc)
9456 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
9457 template<typename _CharT>
9458 inline bool
9459 ispunct(_CharT __c, const locale& __loc)
9460 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
9461 template<typename _CharT>
9462 inline bool
9463 isxdigit(_CharT __c, const locale& __loc)
9464 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
9465 template<typename _CharT>
9466 inline bool
9467 isalnum(_CharT __c, const locale& __loc)
9468 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
9469 template<typename _CharT>
9470 inline bool
9471 isgraph(_CharT __c, const locale& __loc)
9472 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
9473 template<typename _CharT>
9474 inline _CharT
9475 toupper(_CharT __c, const locale& __loc)
9476 { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
9477 template<typename _CharT>
9478 inline _CharT
9479 tolower(_CharT __c, const locale& __loc)
9480 { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
9481 }
9482 namespace std __attribute__ ((__visibility__ ("default"))) {
9483 template<typename _Facet>
9484 struct __use_cache
9485 {
9486 const _Facet*
9487 operator() (const locale& __loc) const;
9488 };
9489 template<typename _CharT>
9490 struct __use_cache<__numpunct_cache<_CharT> >
9491 {
9492 const __numpunct_cache<_CharT>*
9493 operator() (const locale& __loc) const
9494 {
9495 const size_t __i = numpunct<_CharT>::id._M_id();
9496 const locale::facet** __caches = __loc._M_impl->_M_caches;
9497 if (!__caches[__i])
9498 {
9499 __numpunct_cache<_CharT>* __tmp = __null;
9500 try
9501 {
9502 __tmp = new __numpunct_cache<_CharT>;
9503 __tmp->_M_cache(__loc);
9504 }
9505 catch(...)
9506 {
9507 delete __tmp;
9508 throw;
9509 }
9510 __loc._M_impl->_M_install_cache(__tmp, __i);
9511 }
9512 return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]);
9513 }
9514 };
9515 template<typename _CharT>
9516 void
9517 __numpunct_cache<_CharT>::_M_cache(const locale& __loc)
9518 {
9519 _M_allocated = true;
9520 const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
9521 _M_grouping_size = __np.grouping().size();
9522 char* __grouping = new char[_M_grouping_size];
9523 __np.grouping().copy(__grouping, _M_grouping_size);
9524 _M_grouping = __grouping;
9525 _M_use_grouping = (_M_grouping_size
9526 && static_cast<signed char>(__np.grouping()[0]) > 0);
9527 _M_truename_size = __np.truename().size();
9528 _CharT* __truename = new _CharT[_M_truename_size];
9529 __np.truename().copy(__truename, _M_truename_size);
9530 _M_truename = __truename;
9531 _M_falsename_size = __np.falsename().size();
9532 _CharT* __falsename = new _CharT[_M_falsename_size];
9533 __np.falsename().copy(__falsename, _M_falsename_size);
9534 _M_falsename = __falsename;
9535 _M_decimal_point = __np.decimal_point();
9536 _M_thousands_sep = __np.thousands_sep();
9537 const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
9538 __ct.widen(__num_base::_S_atoms_out,
9539 __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out);
9540 __ct.widen(__num_base::_S_atoms_in,
9541 __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in);
9542 }
9543 bool
9544 __verify_grouping(const char* __grouping, size_t __grouping_size,
9545 const string& __grouping_tmp);
9546 template<typename _CharT, typename _InIter>
9547 _InIter
9548 num_get<_CharT, _InIter>::
9549 _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
9550 ios_base::iostate& __err, string& __xtrc) const
9551 {
9552 typedef char_traits<_CharT> __traits_type;
9553 typedef __numpunct_cache<_CharT> __cache_type;
9554 __use_cache<__cache_type> __uc;
9555 const locale& __loc = __io._M_getloc();
9556 const __cache_type* __lc = __uc(__loc);
9557 const _CharT* __lit = __lc->_M_atoms_in;
9558 char_type __c = char_type();
9559 bool __testeof = __beg == __end;
9560 if (!__testeof)
9561 {
9562 __c = *__beg;
9563 const bool __plus = __c == __lit[__num_base::_S_iplus];
9564 if ((__plus || __c == __lit[__num_base::_S_iminus])
9565 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9566 && !(__c == __lc->_M_decimal_point))
9567 {
9568 __xtrc += __plus ? '+' : '-';
9569 if (++__beg != __end)
9570 __c = *__beg;
9571 else
9572 __testeof = true;
9573 }
9574 }
9575 bool __found_mantissa = false;
9576 int __sep_pos = 0;
9577 while (!__testeof)
9578 {
9579 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9580 || __c == __lc->_M_decimal_point)
9581 break;
9582 else if (__c == __lit[__num_base::_S_izero])
9583 {
9584 if (!__found_mantissa)
9585 {
9586 __xtrc += '0';
9587 __found_mantissa = true;
9588 }
9589 ++__sep_pos;
9590 if (++__beg != __end)
9591 __c = *__beg;
9592 else
9593 __testeof = true;
9594 }
9595 else
9596 break;
9597 }
9598 bool __found_dec = false;
9599 bool __found_sci = false;
9600 string __found_grouping;
9601 if (__lc->_M_use_grouping)
9602 __found_grouping.reserve(32);
9603 const char_type* __lit_zero = __lit + __num_base::_S_izero;
9604 if (!__lc->_M_allocated)
9605 while (!__testeof)
9606 {
9607 const int __digit = _M_find(__lit_zero, 10, __c);
9608 if (__digit != -1)
9609 {
9610 __xtrc += '0' + __digit;
9611 __found_mantissa = true;
9612 }
9613 else if (__c == __lc->_M_decimal_point
9614 && !__found_dec && !__found_sci)
9615 {
9616 __xtrc += '.';
9617 __found_dec = true;
9618 }
9619 else if ((__c == __lit[__num_base::_S_ie]
9620 || __c == __lit[__num_base::_S_iE])
9621 && !__found_sci && __found_mantissa)
9622 {
9623 __xtrc += 'e';
9624 __found_sci = true;
9625 if (++__beg != __end)
9626 {
9627 __c = *__beg;
9628 const bool __plus = __c == __lit[__num_base::_S_iplus];
9629 if (__plus || __c == __lit[__num_base::_S_iminus])
9630 __xtrc += __plus ? '+' : '-';
9631 else
9632 continue;
9633 }
9634 else
9635 {
9636 __testeof = true;
9637 break;
9638 }
9639 }
9640 else
9641 break;
9642 if (++__beg != __end)
9643 __c = *__beg;
9644 else
9645 __testeof = true;
9646 }
9647 else
9648 while (!__testeof)
9649 {
9650 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9651 {
9652 if (!__found_dec && !__found_sci)
9653 {
9654 if (__sep_pos)
9655 {
9656 __found_grouping += static_cast<char>(__sep_pos);
9657 __sep_pos = 0;
9658 }
9659 else
9660 {
9661 __xtrc.clear();
9662 break;
9663 }
9664 }
9665 else
9666 break;
9667 }
9668 else if (__c == __lc->_M_decimal_point)
9669 {
9670 if (!__found_dec && !__found_sci)
9671 {
9672 if (__found_grouping.size())
9673 __found_grouping += static_cast<char>(__sep_pos);
9674 __xtrc += '.';
9675 __found_dec = true;
9676 }
9677 else
9678 break;
9679 }
9680 else
9681 {
9682 const char_type* __q =
9683 __traits_type::find(__lit_zero, 10, __c);
9684 if (__q)
9685 {
9686 __xtrc += '0' + (__q - __lit_zero);
9687 __found_mantissa = true;
9688 ++__sep_pos;
9689 }
9690 else if ((__c == __lit[__num_base::_S_ie]
9691 || __c == __lit[__num_base::_S_iE])
9692 && !__found_sci && __found_mantissa)
9693 {
9694 if (__found_grouping.size() && !__found_dec)
9695 __found_grouping += static_cast<char>(__sep_pos);
9696 __xtrc += 'e';
9697 __found_sci = true;
9698 if (++__beg != __end)
9699 {
9700 __c = *__beg;
9701 const bool __plus = __c == __lit[__num_base::_S_iplus];
9702 if ((__plus || __c == __lit[__num_base::_S_iminus])
9703 && !(__lc->_M_use_grouping
9704 && __c == __lc->_M_thousands_sep)
9705 && !(__c == __lc->_M_decimal_point))
9706 __xtrc += __plus ? '+' : '-';
9707 else
9708 continue;
9709 }
9710 else
9711 {
9712 __testeof = true;
9713 break;
9714 }
9715 }
9716 else
9717 break;
9718 }
9719 if (++__beg != __end)
9720 __c = *__beg;
9721 else
9722 __testeof = true;
9723 }
9724 if (__found_grouping.size())
9725 {
9726 if (!__found_dec && !__found_sci)
9727 __found_grouping += static_cast<char>(__sep_pos);
9728 if (!std::__verify_grouping(__lc->_M_grouping,
9729 __lc->_M_grouping_size,
9730 __found_grouping))
9731 __err |= ios_base::failbit;
9732 }
9733 if (__testeof)
9734 __err |= ios_base::eofbit;
9735 return __beg;
9736 }
9737 template<typename _CharT, typename _InIter>
9738 template<typename _ValueT>
9739 _InIter
9740 num_get<_CharT, _InIter>::
9741 _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
9742 ios_base::iostate& __err, _ValueT& __v) const
9743 {
9744 typedef char_traits<_CharT> __traits_type;
9745 using __gnu_cxx::__add_unsigned;
9746 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
9747 typedef __numpunct_cache<_CharT> __cache_type;
9748 __use_cache<__cache_type> __uc;
9749 const locale& __loc = __io._M_getloc();
9750 const __cache_type* __lc = __uc(__loc);
9751 const _CharT* __lit = __lc->_M_atoms_in;
9752 char_type __c = char_type();
9753 const ios_base::fmtflags __basefield = __io.flags()
9754 & ios_base::basefield;
9755 const bool __oct = __basefield == ios_base::oct;
9756 int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10);
9757 bool __testeof = __beg == __end;
9758 bool __negative = false;
9759 if (!__testeof)
9760 {
9761 __c = *__beg;
9762 if (__gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
9763 __negative = __c == __lit[__num_base::_S_iminus];
9764 if ((__negative || __c == __lit[__num_base::_S_iplus])
9765 && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9766 && !(__c == __lc->_M_decimal_point))
9767 {
9768 if (++__beg != __end)
9769 __c = *__beg;
9770 else
9771 __testeof = true;
9772 }
9773 }
9774 bool __found_zero = false;
9775 int __sep_pos = 0;
9776 while (!__testeof)
9777 {
9778 if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9779 || __c == __lc->_M_decimal_point)
9780 break;
9781 else if (__c == __lit[__num_base::_S_izero]
9782 && (!__found_zero || __base == 10))
9783 {
9784 __found_zero = true;
9785 ++__sep_pos;
9786 if (__basefield == 0)
9787 __base = 8;
9788 if (__base == 8)
9789 __sep_pos = 0;
9790 }
9791 else if (__found_zero
9792 && (__c == __lit[__num_base::_S_ix]
9793 || __c == __lit[__num_base::_S_iX]))
9794 {
9795 if (__basefield == 0)
9796 __base = 16;
9797 if (__base == 16)
9798 {
9799 __found_zero = false;
9800 __sep_pos = 0;
9801 }
9802 else
9803 break;
9804 }
9805 else
9806 break;
9807 if (++__beg != __end)
9808 {
9809 __c = *__beg;
9810 if (!__found_zero)
9811 break;
9812 }
9813 else
9814 __testeof = true;
9815 }
9816 const size_t __len = (__base == 16 ? __num_base::_S_iend
9817 - __num_base::_S_izero : __base);
9818 string __found_grouping;
9819 if (__lc->_M_use_grouping)
9820 __found_grouping.reserve(32);
9821 bool __testfail = false;
9822 const __unsigned_type __max = __negative
9823 ? -__gnu_cxx::__numeric_traits<_ValueT>::__min
9824 : __gnu_cxx::__numeric_traits<_ValueT>::__max;
9825 const __unsigned_type __smax = __max / __base;
9826 __unsigned_type __result = 0;
9827 int __digit = 0;
9828 const char_type* __lit_zero = __lit + __num_base::_S_izero;
9829 if (!__lc->_M_allocated)
9830 while (!__testeof)
9831 {
9832 __digit = _M_find(__lit_zero, __len, __c);
9833 if (__digit == -1)
9834 break;
9835 if (__result > __smax)
9836 __testfail = true;
9837 else
9838 {
9839 __result *= __base;
9840 __testfail |= __result > __max - __digit;
9841 __result += __digit;
9842 ++__sep_pos;
9843 }
9844 if (++__beg != __end)
9845 __c = *__beg;
9846 else
9847 __testeof = true;
9848 }
9849 else
9850 while (!__testeof)
9851 {
9852 if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
9853 {
9854 if (__sep_pos)
9855 {
9856 __found_grouping += static_cast<char>(__sep_pos);
9857 __sep_pos = 0;
9858 }
9859 else
9860 {
9861 __testfail = true;
9862 break;
9863 }
9864 }
9865 else if (__c == __lc->_M_decimal_point)
9866 break;
9867 else
9868 {
9869 const char_type* __q =
9870 __traits_type::find(__lit_zero, __len, __c);
9871 if (!__q)
9872 break;
9873 __digit = __q - __lit_zero;
9874 if (__digit > 15)
9875 __digit -= 6;
9876 if (__result > __smax)
9877 __testfail = true;
9878 else
9879 {
9880 __result *= __base;
9881 __testfail |= __result > __max - __digit;
9882 __result += __digit;
9883 ++__sep_pos;
9884 }
9885 }
9886 if (++__beg != __end)
9887 __c = *__beg;
9888 else
9889 __testeof = true;
9890 }
9891 if (__found_grouping.size())
9892 {
9893 __found_grouping += static_cast<char>(__sep_pos);
9894 if (!std::__verify_grouping(__lc->_M_grouping,
9895 __lc->_M_grouping_size,
9896 __found_grouping))
9897 __err |= ios_base::failbit;
9898 }
9899 if (!__testfail && (__sep_pos || __found_zero
9900 || __found_grouping.size()))
9901 __v = __negative ? -__result : __result;
9902 else
9903 __err |= ios_base::failbit;
9904 if (__testeof)
9905 __err |= ios_base::eofbit;
9906 return __beg;
9907 }
9908 template<typename _CharT, typename _InIter>
9909 _InIter
9910 num_get<_CharT, _InIter>::
9911 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9912 ios_base::iostate& __err, bool& __v) const
9913 {
9914 if (!(__io.flags() & ios_base::boolalpha))
9915 {
9916 long __l = -1;
9917 __beg = _M_extract_int(__beg, __end, __io, __err, __l);
9918 if (__l == 0 || __l == 1)
9919 __v = bool(__l);
9920 else
9921 __err |= ios_base::failbit;
9922 }
9923 else
9924 {
9925 typedef __numpunct_cache<_CharT> __cache_type;
9926 __use_cache<__cache_type> __uc;
9927 const locale& __loc = __io._M_getloc();
9928 const __cache_type* __lc = __uc(__loc);
9929 bool __testf = true;
9930 bool __testt = true;
9931 size_t __n;
9932 bool __testeof = __beg == __end;
9933 for (__n = 0; !__testeof; ++__n)
9934 {
9935 const char_type __c = *__beg;
9936 if (__testf)
9937 {
9938 if (__n < __lc->_M_falsename_size)
9939 __testf = __c == __lc->_M_falsename[__n];
9940 else
9941 break;
9942 }
9943 if (__testt)
9944 {
9945 if (__n < __lc->_M_truename_size)
9946 __testt = __c == __lc->_M_truename[__n];
9947 else
9948 break;
9949 }
9950 if (!__testf && !__testt)
9951 break;
9952 if (++__beg == __end)
9953 __testeof = true;
9954 }
9955 if (__testf && __n == __lc->_M_falsename_size)
9956 __v = false;
9957 else if (__testt && __n == __lc->_M_truename_size)
9958 __v = true;
9959 else
9960 __err |= ios_base::failbit;
9961 if (__testeof)
9962 __err |= ios_base::eofbit;
9963 }
9964 return __beg;
9965 }
9966 template<typename _CharT, typename _InIter>
9967 _InIter
9968 num_get<_CharT, _InIter>::
9969 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9970 ios_base::iostate& __err, long& __v) const
9971 { return _M_extract_int(__beg, __end, __io, __err, __v); }
9972 template<typename _CharT, typename _InIter>
9973 _InIter
9974 num_get<_CharT, _InIter>::
9975 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9976 ios_base::iostate& __err, unsigned short& __v) const
9977 { return _M_extract_int(__beg, __end, __io, __err, __v); }
9978 template<typename _CharT, typename _InIter>
9979 _InIter
9980 num_get<_CharT, _InIter>::
9981 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9982 ios_base::iostate& __err, unsigned int& __v) const
9983 { return _M_extract_int(__beg, __end, __io, __err, __v); }
9984 template<typename _CharT, typename _InIter>
9985 _InIter
9986 num_get<_CharT, _InIter>::
9987 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9988 ios_base::iostate& __err, unsigned long& __v) const
9989 { return _M_extract_int(__beg, __end, __io, __err, __v); }
9990 template<typename _CharT, typename _InIter>
9991 _InIter
9992 num_get<_CharT, _InIter>::
9993 do_get(iter_type __beg, iter_type __end, ios_base& __io,
9994 ios_base::iostate& __err, long long& __v) const
9995 { return _M_extract_int(__beg, __end, __io, __err, __v); }
9996 template<typename _CharT, typename _InIter>
9997 _InIter
9998 num_get<_CharT, _InIter>::
9999 do_get(iter_type __beg, iter_type __end, ios_base& __io,
10000 ios_base::iostate& __err, unsigned long long& __v) const
10001 { return _M_extract_int(__beg, __end, __io, __err, __v); }
10002 template<typename _CharT, typename _InIter>
10003 _InIter
10004 num_get<_CharT, _InIter>::
10005 do_get(iter_type __beg, iter_type __end, ios_base& __io,
10006 ios_base::iostate& __err, float& __v) const
10007 {
10008 string __xtrc;
10009 __xtrc.reserve(32);
10010 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
10011 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
10012 return __beg;
10013 }
10014 template<typename _CharT, typename _InIter>
10015 _InIter
10016 num_get<_CharT, _InIter>::
10017 do_get(iter_type __beg, iter_type __end, ios_base& __io,
10018 ios_base::iostate& __err, double& __v) const
10019 {
10020 string __xtrc;
10021 __xtrc.reserve(32);
10022 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
10023 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
10024 return __beg;
10025 }
10026 template<typename _CharT, typename _InIter>
10027 _InIter
10028 num_get<_CharT, _InIter>::
10029 do_get(iter_type __beg, iter_type __end, ios_base& __io,
10030 ios_base::iostate& __err, long double& __v) const
10031 {
10032 string __xtrc;
10033 __xtrc.reserve(32);
10034 __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
10035 std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
10036 return __beg;
10037 }
10038 template<typename _CharT, typename _InIter>
10039 _InIter
10040 num_get<_CharT, _InIter>::
10041 do_get(iter_type __beg, iter_type __end, ios_base& __io,
10042 ios_base::iostate& __err, void*& __v) const
10043 {
10044 typedef ios_base::fmtflags fmtflags;
10045 const fmtflags __fmt = __io.flags();
10046 __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex);
10047 typedef __gnu_cxx::__conditional_type<(sizeof(void*)
10048 <= sizeof(unsigned long)),
10049 unsigned long, unsigned long long>::__type _UIntPtrType;
10050 _UIntPtrType __ul;
10051 __beg = _M_extract_int(__beg, __end, __io, __err, __ul);
10052 __io.flags(__fmt);
10053 if (!(__err & ios_base::failbit))
10054 __v = reinterpret_cast<void*>(__ul);
10055 return __beg;
10056 }
10057 template<typename _CharT, typename _OutIter>
10058 void
10059 num_put<_CharT, _OutIter>::
10060 _M_pad(_CharT __fill, streamsize __w, ios_base& __io,
10061 _CharT* __new, const _CharT* __cs, int& __len) const
10062 {
10063 __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new,
10064 __cs, __w, __len);
10065 __len = static_cast<int>(__w);
10066 }
10067 template<typename _CharT, typename _ValueT>
10068 int
10069 __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
10070 ios_base::fmtflags __flags, bool __dec)
10071 {
10072 _CharT* __buf = __bufend;
10073 if (__builtin_expect(__dec, true))
10074 {
10075 do
10076 {
10077 *--__buf = __lit[(__v % 10) + __num_base::_S_odigits];
10078 __v /= 10;
10079 }
10080 while (__v != 0);
10081 }
10082 else if ((__flags & ios_base::basefield) == ios_base::oct)
10083 {
10084 do
10085 {
10086 *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];
10087 __v >>= 3;
10088 }
10089 while (__v != 0);
10090 }
10091 else
10092 {
10093 const bool __uppercase = __flags & ios_base::uppercase;
10094 const int __case_offset = __uppercase ? __num_base::_S_oudigits
10095 : __num_base::_S_odigits;
10096 do
10097 {
10098 *--__buf = __lit[(__v & 0xf) + __case_offset];
10099 __v >>= 4;
10100 }
10101 while (__v != 0);
10102 }
10103 return __bufend - __buf;
10104 }
10105 template<typename _CharT, typename _OutIter>
10106 void
10107 num_put<_CharT, _OutIter>::
10108 _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep,
10109 ios_base&, _CharT* __new, _CharT* __cs, int& __len) const
10110 {
10111 _CharT* __p = std::__add_grouping(__new, __sep, __grouping,
10112 __grouping_size, __cs, __cs + __len);
10113 __len = __p - __new;
10114 }
10115 template<typename _CharT, typename _OutIter>
10116 template<typename _ValueT>
10117 _OutIter
10118 num_put<_CharT, _OutIter>::
10119 _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
10120 _ValueT __v) const
10121 {
10122 using __gnu_cxx::__add_unsigned;
10123 typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
10124 typedef __numpunct_cache<_CharT> __cache_type;
10125 __use_cache<__cache_type> __uc;
10126 const locale& __loc = __io._M_getloc();
10127 const __cache_type* __lc = __uc(__loc);
10128 const _CharT* __lit = __lc->_M_atoms_out;
10129 const ios_base::fmtflags __flags = __io.flags();
10130 const int __ilen = 5 * sizeof(_ValueT);
10131 _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10132 * __ilen));
10133 const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
10134 const bool __dec = (__basefield != ios_base::oct
10135 && __basefield != ios_base::hex);
10136 const __unsigned_type __u = ((__v > 0 || !__dec)
10137 ? __unsigned_type(__v)
10138 : -__unsigned_type(__v));
10139 int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
10140 __cs += __ilen - __len;
10141 if (__lc->_M_use_grouping)
10142 {
10143 _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10144 * (__len + 1)
10145 * 2));
10146 _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
10147 __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);
10148 __cs = __cs2 + 2;
10149 }
10150 if (__builtin_expect(__dec, true))
10151 {
10152 if (__v >= 0)
10153 {
10154 if (bool(__flags & ios_base::showpos)
10155 && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
10156 *--__cs = __lit[__num_base::_S_oplus], ++__len;
10157 }
10158 else
10159 *--__cs = __lit[__num_base::_S_ominus], ++__len;
10160 }
10161 else if (bool(__flags & ios_base::showbase) && __v)
10162 {
10163 if (__basefield == ios_base::oct)
10164 *--__cs = __lit[__num_base::_S_odigits], ++__len;
10165 else
10166 {
10167 const bool __uppercase = __flags & ios_base::uppercase;
10168 *--__cs = __lit[__num_base::_S_ox + __uppercase];
10169 *--__cs = __lit[__num_base::_S_odigits];
10170 __len += 2;
10171 }
10172 }
10173 const streamsize __w = __io.width();
10174 if (__w > static_cast<streamsize>(__len))
10175 {
10176 _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10177 * __w));
10178 _M_pad(__fill, __w, __io, __cs3, __cs, __len);
10179 __cs = __cs3;
10180 }
10181 __io.width(0);
10182 return std::__write(__s, __cs, __len);
10183 }
10184 template<typename _CharT, typename _OutIter>
10185 void
10186 num_put<_CharT, _OutIter>::
10187 _M_group_float(const char* __grouping, size_t __grouping_size,
10188 _CharT __sep, const _CharT* __p, _CharT* __new,
10189 _CharT* __cs, int& __len) const
10190 {
10191 const int __declen = __p ? __p - __cs : __len;
10192 _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,
10193 __grouping_size,
10194 __cs, __cs + __declen);
10195 int __newlen = __p2 - __new;
10196 if (__p)
10197 {
10198 char_traits<_CharT>::copy(__p2, __p, __len - __declen);
10199 __newlen += __len - __declen;
10200 }
10201 __len = __newlen;
10202 }
10203 template<typename _CharT, typename _OutIter>
10204 template<typename _ValueT>
10205 _OutIter
10206 num_put<_CharT, _OutIter>::
10207 _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,
10208 _ValueT __v) const
10209 {
10210 typedef __numpunct_cache<_CharT> __cache_type;
10211 __use_cache<__cache_type> __uc;
10212 const locale& __loc = __io._M_getloc();
10213 const __cache_type* __lc = __uc(__loc);
10214 const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();
10215 const int __max_digits =
10216 __gnu_cxx::__numeric_traits<_ValueT>::__digits10;
10217 int __len;
10218 char __fbuf[16];
10219 __num_base::_S_format_float(__io, __fbuf, __mod);
10220 const bool __fixed = __io.flags() & ios_base::fixed;
10221 const int __max_exp =
10222 __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10;
10223 const int __cs_size = __fixed ? __max_exp + __prec + 4
10224 : __max_digits * 2 + __prec;
10225 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
10226 __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
10227 __prec, __v);
10228 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
10229 _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10230 * __len));
10231 __ctype.widen(__cs, __cs + __len, __ws);
10232 _CharT* __wp = 0;
10233 const char* __p = char_traits<char>::find(__cs, __len, '.');
10234 if (__p)
10235 {
10236 __wp = __ws + (__p - __cs);
10237 *__wp = __lc->_M_decimal_point;
10238 }
10239 if (__lc->_M_use_grouping
10240 && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9'
10241 && __cs[1] >= '0' && __cs[2] >= '0')))
10242 {
10243 _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10244 * __len * 2));
10245 streamsize __off = 0;
10246 if (__cs[0] == '-' || __cs[0] == '+')
10247 {
10248 __off = 1;
10249 __ws2[0] = __ws[0];
10250 __len -= 1;
10251 }
10252 _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,
10253 __lc->_M_thousands_sep, __wp, __ws2 + __off,
10254 __ws + __off, __len);
10255 __len += __off;
10256 __ws = __ws2;
10257 }
10258 const streamsize __w = __io.width();
10259 if (__w > static_cast<streamsize>(__len))
10260 {
10261 _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10262 * __w));
10263 _M_pad(__fill, __w, __io, __ws3, __ws, __len);
10264 __ws = __ws3;
10265 }
10266 __io.width(0);
10267 return std::__write(__s, __ws, __len);
10268 }
10269 template<typename _CharT, typename _OutIter>
10270 _OutIter
10271 num_put<_CharT, _OutIter>::
10272 do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
10273 {
10274 const ios_base::fmtflags __flags = __io.flags();
10275 if ((__flags & ios_base::boolalpha) == 0)
10276 {
10277 const long __l = __v;
10278 __s = _M_insert_int(__s, __io, __fill, __l);
10279 }
10280 else
10281 {
10282 typedef __numpunct_cache<_CharT> __cache_type;
10283 __use_cache<__cache_type> __uc;
10284 const locale& __loc = __io._M_getloc();
10285 const __cache_type* __lc = __uc(__loc);
10286 const _CharT* __name = __v ? __lc->_M_truename
10287 : __lc->_M_falsename;
10288 int __len = __v ? __lc->_M_truename_size
10289 : __lc->_M_falsename_size;
10290 const streamsize __w = __io.width();
10291 if (__w > static_cast<streamsize>(__len))
10292 {
10293 _CharT* __cs
10294 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
10295 * __w));
10296 _M_pad(__fill, __w, __io, __cs, __name, __len);
10297 __name = __cs;
10298 }
10299 __io.width(0);
10300 __s = std::__write(__s, __name, __len);
10301 }
10302 return __s;
10303 }
10304 template<typename _CharT, typename _OutIter>
10305 _OutIter
10306 num_put<_CharT, _OutIter>::
10307 do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
10308 { return _M_insert_int(__s, __io, __fill, __v); }
10309 template<typename _CharT, typename _OutIter>
10310 _OutIter
10311 num_put<_CharT, _OutIter>::
10312 do_put(iter_type __s, ios_base& __io, char_type __fill,
10313 unsigned long __v) const
10314 { return _M_insert_int(__s, __io, __fill, __v); }
10315 template<typename _CharT, typename _OutIter>
10316 _OutIter
10317 num_put<_CharT, _OutIter>::
10318 do_put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const
10319 { return _M_insert_int(__s, __io, __fill, __v); }
10320 template<typename _CharT, typename _OutIter>
10321 _OutIter
10322 num_put<_CharT, _OutIter>::
10323 do_put(iter_type __s, ios_base& __io, char_type __fill,
10324 unsigned long long __v) const
10325 { return _M_insert_int(__s, __io, __fill, __v); }
10326 template<typename _CharT, typename _OutIter>
10327 _OutIter
10328 num_put<_CharT, _OutIter>::
10329 do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
10330 { return _M_insert_float(__s, __io, __fill, char(), __v); }
10331 template<typename _CharT, typename _OutIter>
10332 _OutIter
10333 num_put<_CharT, _OutIter>::
10334 do_put(iter_type __s, ios_base& __io, char_type __fill,
10335 long double __v) const
10336 { return _M_insert_float(__s, __io, __fill, 'L', __v); }
10337 template<typename _CharT, typename _OutIter>
10338 _OutIter
10339 num_put<_CharT, _OutIter>::
10340 do_put(iter_type __s, ios_base& __io, char_type __fill,
10341 const void* __v) const
10342 {
10343 const ios_base::fmtflags __flags = __io.flags();
10344 const ios_base::fmtflags __fmt = ~(ios_base::basefield
10345 | ios_base::uppercase
10346 | ios_base::internal);
10347 __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase));
10348 typedef __gnu_cxx::__conditional_type<(sizeof(const void*)
10349 <= sizeof(unsigned long)),
10350 unsigned long, unsigned long long>::__type _UIntPtrType;
10351 __s = _M_insert_int(__s, __io, __fill,
10352 reinterpret_cast<_UIntPtrType>(__v));
10353 __io.flags(__flags);
10354 return __s;
10355 }
10356 template<typename _CharT, typename _Traits>
10357 void
10358 __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
10359 _CharT* __news, const _CharT* __olds,
10360 const streamsize __newlen,
10361 const streamsize __oldlen)
10362 {
10363 const size_t __plen = static_cast<size_t>(__newlen - __oldlen);
10364 const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;
10365 if (__adjust == ios_base::left)
10366 {
10367 _Traits::copy(__news, __olds, __oldlen);
10368 _Traits::assign(__news + __oldlen, __plen, __fill);
10369 return;
10370 }
10371 size_t __mod = 0;
10372 if (__adjust == ios_base::internal)
10373 {
10374 const locale& __loc = __io._M_getloc();
10375 const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
10376 if (__ctype.widen('-') == __olds[0]
10377 || __ctype.widen('+') == __olds[0])
10378 {
10379 __news[0] = __olds[0];
10380 __mod = 1;
10381 ++__news;
10382 }
10383 else if (__ctype.widen('0') == __olds[0]
10384 && __oldlen > 1
10385 && (__ctype.widen('x') == __olds[1]
10386 || __ctype.widen('X') == __olds[1]))
10387 {
10388 __news[0] = __olds[0];
10389 __news[1] = __olds[1];
10390 __mod = 2;
10391 __news += 2;
10392 }
10393 }
10394 _Traits::assign(__news, __plen, __fill);
10395 _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
10396 }
10397 template<typename _CharT>
10398 _CharT*
10399 __add_grouping(_CharT* __s, _CharT __sep,
10400 const char* __gbeg, size_t __gsize,
10401 const _CharT* __first, const _CharT* __last)
10402 {
10403 size_t __idx = 0;
10404 size_t __ctr = 0;
10405 while (__last - __first > __gbeg[__idx]
10406 && static_cast<signed char>(__gbeg[__idx]) > 0)
10407 {
10408 __last -= __gbeg[__idx];
10409 __idx < __gsize - 1 ? ++__idx : ++__ctr;
10410 }
10411 while (__first != __last)
10412 *__s++ = *__first++;
10413 while (__ctr--)
10414 {
10415 *__s++ = __sep;
10416 for (char __i = __gbeg[__idx]; __i > 0; --__i)
10417 *__s++ = *__first++;
10418 }
10419 while (__idx--)
10420 {
10421 *__s++ = __sep;
10422 for (char __i = __gbeg[__idx]; __i > 0; --__i)
10423 *__s++ = *__first++;
10424 }
10425 return __s;
10426 }
10427 extern template class numpunct<char>;
10428 extern template class numpunct_byname<char>;
10429 extern template class num_get<char>;
10430 extern template class num_put<char>;
10431 extern template class ctype_byname<char>;
10432 extern template
10433 const numpunct<char>&
10434 use_facet<numpunct<char> >(const locale&);
10435 extern template
10436 const num_put<char>&
10437 use_facet<num_put<char> >(const locale&);
10438 extern template
10439 const num_get<char>&
10440 use_facet<num_get<char> >(const locale&);
10441 extern template
10442 bool
10443 has_facet<ctype<char> >(const locale&);
10444 extern template
10445 bool
10446 has_facet<numpunct<char> >(const locale&);
10447 extern template
10448 bool
10449 has_facet<num_put<char> >(const locale&);
10450 extern template
10451 bool
10452 has_facet<num_get<char> >(const locale&);
10453 }
10454 namespace std __attribute__ ((__visibility__ ("default"))) {
10455 template<typename _Facet>
10456 inline const _Facet&
10457 __check_facet(const _Facet* __f)
10458 {
10459 if (!__f)
10460 __throw_bad_cast();
10461 return *__f;
10462 }
10463 template<typename _CharT, typename _Traits>
10464 class basic_ios : public ios_base
10465 {
10466 public:
10467 typedef _CharT char_type;
10468 typedef typename _Traits::int_type int_type;
10469 typedef typename _Traits::pos_type pos_type;
10470 typedef typename _Traits::off_type off_type;
10471 typedef _Traits traits_type;
10472 typedef ctype<_CharT> __ctype_type;
10473 typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
10474 __num_put_type;
10475 typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
10476 __num_get_type;
10477 protected:
10478 basic_ostream<_CharT, _Traits>* _M_tie;
10479 mutable char_type _M_fill;
10480 mutable bool _M_fill_init;
10481 basic_streambuf<_CharT, _Traits>* _M_streambuf;
10482 const __ctype_type* _M_ctype;
10483 const __num_put_type* _M_num_put;
10484 const __num_get_type* _M_num_get;
10485 public:
10486 operator void*() const
10487 { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
10488 bool
10489 operator!() const
10490 { return this->fail(); }
10491 iostate
10492 rdstate() const
10493 { return _M_streambuf_state; }
10494 void
10495 clear(iostate __state = goodbit);
10496 void
10497 setstate(iostate __state)
10498 { this->clear(this->rdstate() | __state); }
10499 void
10500 _M_setstate(iostate __state)
10501 {
10502 _M_streambuf_state |= __state;
10503 if (this->exceptions() & __state)
10504 throw;
10505 }
10506 bool
10507 good() const
10508 { return this->rdstate() == 0; }
10509 bool
10510 eof() const
10511 { return (this->rdstate() & eofbit) != 0; }
10512 bool
10513 fail() const
10514 { return (this->rdstate() & (badbit | failbit)) != 0; }
10515 bool
10516 bad() const
10517 { return (this->rdstate() & badbit) != 0; }
10518 iostate
10519 exceptions() const
10520 { return _M_exception; }
10521 void
10522 exceptions(iostate __except)
10523 {
10524 _M_exception = __except;
10525 this->clear(_M_streambuf_state);
10526 }
10527 explicit
10528 basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
10529 : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
10530 _M_ctype(0), _M_num_put(0), _M_num_get(0)
10531 { this->init(__sb); }
10532 virtual
10533 ~basic_ios() { }
10534 basic_ostream<_CharT, _Traits>*
10535 tie() const
10536 { return _M_tie; }
10537 basic_ostream<_CharT, _Traits>*
10538 tie(basic_ostream<_CharT, _Traits>* __tiestr)
10539 {
10540 basic_ostream<_CharT, _Traits>* __old = _M_tie;
10541 _M_tie = __tiestr;
10542 return __old;
10543 }
10544 basic_streambuf<_CharT, _Traits>*
10545 rdbuf() const
10546 { return _M_streambuf; }
10547 basic_streambuf<_CharT, _Traits>*
10548 rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
10549 basic_ios&
10550 copyfmt(const basic_ios& __rhs);
10551 char_type
10552 fill() const
10553 {
10554 if (!_M_fill_init)
10555 {
10556 _M_fill = this->widen(' ');
10557 _M_fill_init = true;
10558 }
10559 return _M_fill;
10560 }
10561 char_type
10562 fill(char_type __ch)
10563 {
10564 char_type __old = this->fill();
10565 _M_fill = __ch;
10566 return __old;
10567 }
10568 locale
10569 imbue(const locale& __loc);
10570 char
10571 narrow(char_type __c, char __dfault) const
10572 { return __check_facet(_M_ctype).narrow(__c, __dfault); }
10573 char_type
10574 widen(char __c) const
10575 { return __check_facet(_M_ctype).widen(__c); }
10576 protected:
10577 basic_ios()
10578 : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false),
10579 _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
10580 { }
10581 void
10582 init(basic_streambuf<_CharT, _Traits>* __sb);
10583 void
10584 _M_cache_locale(const locale& __loc);
10585 };
10586 }
10587 namespace std __attribute__ ((__visibility__ ("default"))) {
10588 template<typename _CharT, typename _Traits>
10589 void
10590 basic_ios<_CharT, _Traits>::clear(iostate __state)
10591 {
10592 if (this->rdbuf())
10593 _M_streambuf_state = __state;
10594 else
10595 _M_streambuf_state = __state | badbit;
10596 if (this->exceptions() & this->rdstate())
10597 __throw_ios_failure(("basic_ios::clear"));
10598 }
10599 template<typename _CharT, typename _Traits>
10600 basic_streambuf<_CharT, _Traits>*
10601 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
10602 {
10603 basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
10604 _M_streambuf = __sb;
10605 this->clear();
10606 return __old;
10607 }
10608 template<typename _CharT, typename _Traits>
10609 basic_ios<_CharT, _Traits>&
10610 basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
10611 {
10612 if (this != &__rhs)
10613 {
10614 _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
10615 _M_local_word : new _Words[__rhs._M_word_size];
10616 _Callback_list* __cb = __rhs._M_callbacks;
10617 if (__cb)
10618 __cb->_M_add_reference();
10619 _M_call_callbacks(erase_event);
10620 if (_M_word != _M_local_word)
10621 {
10622 delete [] _M_word;
10623 _M_word = 0;
10624 }
10625 _M_dispose_callbacks();
10626 _M_callbacks = __cb;
10627 for (int __i = 0; __i < __rhs._M_word_size; ++__i)
10628 __words[__i] = __rhs._M_word[__i];
10629 _M_word = __words;
10630 _M_word_size = __rhs._M_word_size;
10631 this->flags(__rhs.flags());
10632 this->width(__rhs.width());
10633 this->precision(__rhs.precision());
10634 this->tie(__rhs.tie());
10635 this->fill(__rhs.fill());
10636 _M_ios_locale = __rhs.getloc();
10637 _M_cache_locale(_M_ios_locale);
10638 _M_call_callbacks(copyfmt_event);
10639 this->exceptions(__rhs.exceptions());
10640 }
10641 return *this;
10642 }
10643 template<typename _CharT, typename _Traits>
10644 locale
10645 basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
10646 {
10647 locale __old(this->getloc());
10648 ios_base::imbue(__loc);
10649 _M_cache_locale(__loc);
10650 if (this->rdbuf() != 0)
10651 this->rdbuf()->pubimbue(__loc);
10652 return __old;
10653 }
10654 template<typename _CharT, typename _Traits>
10655 void
10656 basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
10657 {
10658 ios_base::_M_init();
10659 _M_cache_locale(_M_ios_locale);
10660 _M_fill = _CharT();
10661 _M_fill_init = false;
10662 _M_tie = 0;
10663 _M_exception = goodbit;
10664 _M_streambuf = __sb;
10665 _M_streambuf_state = __sb ? goodbit : badbit;
10666 }
10667 template<typename _CharT, typename _Traits>
10668 void
10669 basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc)
10670 {
10671 if (__builtin_expect(has_facet<__ctype_type>(__loc), true))
10672 _M_ctype = &use_facet<__ctype_type>(__loc);
10673 else
10674 _M_ctype = 0;
10675 if (__builtin_expect(has_facet<__num_put_type>(__loc), true))
10676 _M_num_put = &use_facet<__num_put_type>(__loc);
10677 else
10678 _M_num_put = 0;
10679 if (__builtin_expect(has_facet<__num_get_type>(__loc), true))
10680 _M_num_get = &use_facet<__num_get_type>(__loc);
10681 else
10682 _M_num_get = 0;
10683 }
10684 extern template class basic_ios<char>;
10685 }
10686 namespace std __attribute__ ((__visibility__ ("default"))) {
10687 template<typename _CharT, typename _Traits>
10688 class basic_ostream : virtual public basic_ios<_CharT, _Traits>
10689 {
10690 public:
10691 typedef _CharT char_type;
10692 typedef typename _Traits::int_type int_type;
10693 typedef typename _Traits::pos_type pos_type;
10694 typedef typename _Traits::off_type off_type;
10695 typedef _Traits traits_type;
10696 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
10697 typedef basic_ios<_CharT, _Traits> __ios_type;
10698 typedef basic_ostream<_CharT, _Traits> __ostream_type;
10699 typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
10700 __num_put_type;
10701 typedef ctype<_CharT> __ctype_type;
10702 explicit
10703 basic_ostream(__streambuf_type* __sb)
10704 { this->init(__sb); }
10705 virtual
10706 ~basic_ostream() { }
10707 class sentry;
10708 friend class sentry;
10709 __ostream_type&
10710 operator<<(__ostream_type& (*__pf)(__ostream_type&))
10711 {
10712 return __pf(*this);
10713 }
10714 __ostream_type&
10715 operator<<(__ios_type& (*__pf)(__ios_type&))
10716 {
10717 __pf(*this);
10718 return *this;
10719 }
10720 __ostream_type&
10721 operator<<(ios_base& (*__pf) (ios_base&))
10722 {
10723 __pf(*this);
10724 return *this;
10725 }
10726 __ostream_type&
10727 operator<<(long __n)
10728 { return _M_insert(__n); }
10729 __ostream_type&
10730 operator<<(unsigned long __n)
10731 { return _M_insert(__n); }
10732 __ostream_type&
10733 operator<<(bool __n)
10734 { return _M_insert(__n); }
10735 __ostream_type&
10736 operator<<(short __n);
10737 __ostream_type&
10738 operator<<(unsigned short __n)
10739 {
10740 return _M_insert(static_cast<unsigned long>(__n));
10741 }
10742 __ostream_type&
10743 operator<<(int __n);
10744 __ostream_type&
10745 operator<<(unsigned int __n)
10746 {
10747 return _M_insert(static_cast<unsigned long>(__n));
10748 }
10749 __ostream_type&
10750 operator<<(long long __n)
10751 { return _M_insert(__n); }
10752 __ostream_type&
10753 operator<<(unsigned long long __n)
10754 { return _M_insert(__n); }
10755 __ostream_type&
10756 operator<<(double __f)
10757 { return _M_insert(__f); }
10758 __ostream_type&
10759 operator<<(float __f)
10760 {
10761 return _M_insert(static_cast<double>(__f));
10762 }
10763 __ostream_type&
10764 operator<<(long double __f)
10765 { return _M_insert(__f); }
10766 __ostream_type&
10767 operator<<(const void* __p)
10768 { return _M_insert(__p); }
10769 __ostream_type&
10770 operator<<(__streambuf_type* __sb);
10771 __ostream_type&
10772 put(char_type __c);
10773 void
10774 _M_write(const char_type* __s, streamsize __n)
10775 {
10776 const streamsize __put = this->rdbuf()->sputn(__s, __n);
10777 if (__put != __n)
10778 this->setstate(ios_base::badbit);
10779 }
10780 __ostream_type&
10781 write(const char_type* __s, streamsize __n);
10782 __ostream_type&
10783 flush();
10784 pos_type
10785 tellp();
10786 __ostream_type&
10787 seekp(pos_type);
10788 __ostream_type&
10789 seekp(off_type, ios_base::seekdir);
10790 protected:
10791 basic_ostream()
10792 { this->init(0); }
10793 template<typename _ValueT>
10794 __ostream_type&
10795 _M_insert(_ValueT __v);
10796 };
10797 template <typename _CharT, typename _Traits>
10798 class basic_ostream<_CharT, _Traits>::sentry
10799 {
10800 bool _M_ok;
10801 basic_ostream<_CharT, _Traits>& _M_os;
10802 public:
10803 explicit
10804 sentry(basic_ostream<_CharT, _Traits>& __os);
10805 ~sentry()
10806 {
10807 if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception())
10808 {
10809 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
10810 _M_os.setstate(ios_base::badbit);
10811 }
10812 }
10813 operator bool() const
10814 { return _M_ok; }
10815 };
10816 template<typename _CharT, typename _Traits>
10817 inline basic_ostream<_CharT, _Traits>&
10818 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
10819 { return __ostream_insert(__out, &__c, 1); }
10820 template<typename _CharT, typename _Traits>
10821 inline basic_ostream<_CharT, _Traits>&
10822 operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
10823 { return (__out << __out.widen(__c)); }
10824 template <class _Traits>
10825 inline basic_ostream<char, _Traits>&
10826 operator<<(basic_ostream<char, _Traits>& __out, char __c)
10827 { return __ostream_insert(__out, &__c, 1); }
10828 template<class _Traits>
10829 inline basic_ostream<char, _Traits>&
10830 operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
10831 { return (__out << static_cast<char>(__c)); }
10832 template<class _Traits>
10833 inline basic_ostream<char, _Traits>&
10834 operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
10835 { return (__out << static_cast<char>(__c)); }
10836 template<typename _CharT, typename _Traits>
10837 inline basic_ostream<_CharT, _Traits>&
10838 operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
10839 {
10840 if (!__s)
10841 __out.setstate(ios_base::badbit);
10842 else
10843 __ostream_insert(__out, __s,
10844 static_cast<streamsize>(_Traits::length(__s)));
10845 return __out;
10846 }
10847 template<typename _CharT, typename _Traits>
10848 basic_ostream<_CharT, _Traits> &
10849 operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
10850 template<class _Traits>
10851 inline basic_ostream<char, _Traits>&
10852 operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
10853 {
10854 if (!__s)
10855 __out.setstate(ios_base::badbit);
10856 else
10857 __ostream_insert(__out, __s,
10858 static_cast<streamsize>(_Traits::length(__s)));
10859 return __out;
10860 }
10861 template<class _Traits>
10862 inline basic_ostream<char, _Traits>&
10863 operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
10864 { return (__out << reinterpret_cast<const char*>(__s)); }
10865 template<class _Traits>
10866 inline basic_ostream<char, _Traits> &
10867 operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
10868 { return (__out << reinterpret_cast<const char*>(__s)); }
10869 template<typename _CharT, typename _Traits>
10870 inline basic_ostream<_CharT, _Traits>&
10871 endl(basic_ostream<_CharT, _Traits>& __os)
10872 { return flush(__os.put(__os.widen('\n'))); }
10873 template<typename _CharT, typename _Traits>
10874 inline basic_ostream<_CharT, _Traits>&
10875 ends(basic_ostream<_CharT, _Traits>& __os)
10876 { return __os.put(_CharT()); }
10877 template<typename _CharT, typename _Traits>
10878 inline basic_ostream<_CharT, _Traits>&
10879 flush(basic_ostream<_CharT, _Traits>& __os)
10880 { return __os.flush(); }
10881 }
10882 namespace std __attribute__ ((__visibility__ ("default"))) {
10883 template<typename _CharT, typename _Traits>
10884 basic_ostream<_CharT, _Traits>::sentry::
10885 sentry(basic_ostream<_CharT, _Traits>& __os)
10886 : _M_ok(false), _M_os(__os)
10887 {
10888 if (__os.tie() && __os.good())
10889 __os.tie()->flush();
10890 if (__os.good())
10891 _M_ok = true;
10892 else
10893 __os.setstate(ios_base::failbit);
10894 }
10895 template<typename _CharT, typename _Traits>
10896 template<typename _ValueT>
10897 basic_ostream<_CharT, _Traits>&
10898 basic_ostream<_CharT, _Traits>::
10899 _M_insert(_ValueT __v)
10900 {
10901 sentry __cerb(*this);
10902 if (__cerb)
10903 {
10904 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
10905 try
10906 {
10907 const __num_put_type& __np = __check_facet(this->_M_num_put);
10908 if (__np.put(*this, *this, this->fill(), __v).failed())
10909 __err |= ios_base::badbit;
10910 }
10911 catch(__cxxabiv1::__forced_unwind&)
10912 {
10913 this->_M_setstate(ios_base::badbit);
10914 throw;
10915 }
10916 catch(...)
10917 { this->_M_setstate(ios_base::badbit); }
10918 if (__err)
10919 this->setstate(__err);
10920 }
10921 return *this;
10922 }
10923 template<typename _CharT, typename _Traits>
10924 basic_ostream<_CharT, _Traits>&
10925 basic_ostream<_CharT, _Traits>::
10926 operator<<(short __n)
10927 {
10928 const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
10929 if (__fmt == ios_base::oct || __fmt == ios_base::hex)
10930 return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
10931 else
10932 return _M_insert(static_cast<long>(__n));
10933 }
10934 template<typename _CharT, typename _Traits>
10935 basic_ostream<_CharT, _Traits>&
10936 basic_ostream<_CharT, _Traits>::
10937 operator<<(int __n)
10938 {
10939 const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
10940 if (__fmt == ios_base::oct || __fmt == ios_base::hex)
10941 return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
10942 else
10943 return _M_insert(static_cast<long>(__n));
10944 }
10945 template<typename _CharT, typename _Traits>
10946 basic_ostream<_CharT, _Traits>&
10947 basic_ostream<_CharT, _Traits>::
10948 operator<<(__streambuf_type* __sbin)
10949 {
10950 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
10951 sentry __cerb(*this);
10952 if (__cerb && __sbin)
10953 {
10954 try
10955 {
10956 if (!__copy_streambufs(__sbin, this->rdbuf()))
10957 __err |= ios_base::failbit;
10958 }
10959 catch(__cxxabiv1::__forced_unwind&)
10960 {
10961 this->_M_setstate(ios_base::badbit);
10962 throw;
10963 }
10964 catch(...)
10965 { this->_M_setstate(ios_base::failbit); }
10966 }
10967 else if (!__sbin)
10968 __err |= ios_base::badbit;
10969 if (__err)
10970 this->setstate(__err);
10971 return *this;
10972 }
10973 template<typename _CharT, typename _Traits>
10974 basic_ostream<_CharT, _Traits>&
10975 basic_ostream<_CharT, _Traits>::
10976 put(char_type __c)
10977 {
10978 sentry __cerb(*this);
10979 if (__cerb)
10980 {
10981 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
10982 try
10983 {
10984 const int_type __put = this->rdbuf()->sputc(__c);
10985 if (traits_type::eq_int_type(__put, traits_type::eof()))
10986 __err |= ios_base::badbit;
10987 }
10988 catch(__cxxabiv1::__forced_unwind&)
10989 {
10990 this->_M_setstate(ios_base::badbit);
10991 throw;
10992 }
10993 catch(...)
10994 { this->_M_setstate(ios_base::badbit); }
10995 if (__err)
10996 this->setstate(__err);
10997 }
10998 return *this;
10999 }
11000 template<typename _CharT, typename _Traits>
11001 basic_ostream<_CharT, _Traits>&
11002 basic_ostream<_CharT, _Traits>::
11003 write(const _CharT* __s, streamsize __n)
11004 {
11005 sentry __cerb(*this);
11006 if (__cerb)
11007 {
11008 try
11009 { _M_write(__s, __n); }
11010 catch(__cxxabiv1::__forced_unwind&)
11011 {
11012 this->_M_setstate(ios_base::badbit);
11013 throw;
11014 }
11015 catch(...)
11016 { this->_M_setstate(ios_base::badbit); }
11017 }
11018 return *this;
11019 }
11020 template<typename _CharT, typename _Traits>
11021 basic_ostream<_CharT, _Traits>&
11022 basic_ostream<_CharT, _Traits>::
11023 flush()
11024 {
11025 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11026 try
11027 {
11028 if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
11029 __err |= ios_base::badbit;
11030 }
11031 catch(__cxxabiv1::__forced_unwind&)
11032 {
11033 this->_M_setstate(ios_base::badbit);
11034 throw;
11035 }
11036 catch(...)
11037 { this->_M_setstate(ios_base::badbit); }
11038 if (__err)
11039 this->setstate(__err);
11040 return *this;
11041 }
11042 template<typename _CharT, typename _Traits>
11043 typename basic_ostream<_CharT, _Traits>::pos_type
11044 basic_ostream<_CharT, _Traits>::
11045 tellp()
11046 {
11047 pos_type __ret = pos_type(-1);
11048 try
11049 {
11050 if (!this->fail())
11051 __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
11052 }
11053 catch(__cxxabiv1::__forced_unwind&)
11054 {
11055 this->_M_setstate(ios_base::badbit);
11056 throw;
11057 }
11058 catch(...)
11059 { this->_M_setstate(ios_base::badbit); }
11060 return __ret;
11061 }
11062 template<typename _CharT, typename _Traits>
11063 basic_ostream<_CharT, _Traits>&
11064 basic_ostream<_CharT, _Traits>::
11065 seekp(pos_type __pos)
11066 {
11067 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11068 try
11069 {
11070 if (!this->fail())
11071 {
11072 const pos_type __p = this->rdbuf()->pubseekpos(__pos,
11073 ios_base::out);
11074 if (__p == pos_type(off_type(-1)))
11075 __err |= ios_base::failbit;
11076 }
11077 }
11078 catch(__cxxabiv1::__forced_unwind&)
11079 {
11080 this->_M_setstate(ios_base::badbit);
11081 throw;
11082 }
11083 catch(...)
11084 { this->_M_setstate(ios_base::badbit); }
11085 if (__err)
11086 this->setstate(__err);
11087 return *this;
11088 }
11089 template<typename _CharT, typename _Traits>
11090 basic_ostream<_CharT, _Traits>&
11091 basic_ostream<_CharT, _Traits>::
11092 seekp(off_type __off, ios_base::seekdir __dir)
11093 {
11094 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11095 try
11096 {
11097 if (!this->fail())
11098 {
11099 const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
11100 ios_base::out);
11101 if (__p == pos_type(off_type(-1)))
11102 __err |= ios_base::failbit;
11103 }
11104 }
11105 catch(__cxxabiv1::__forced_unwind&)
11106 {
11107 this->_M_setstate(ios_base::badbit);
11108 throw;
11109 }
11110 catch(...)
11111 { this->_M_setstate(ios_base::badbit); }
11112 if (__err)
11113 this->setstate(__err);
11114 return *this;
11115 }
11116 template<typename _CharT, typename _Traits>
11117 basic_ostream<_CharT, _Traits>&
11118 operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
11119 {
11120 if (!__s)
11121 __out.setstate(ios_base::badbit);
11122 else
11123 {
11124 const size_t __clen = char_traits<char>::length(__s);
11125 try
11126 {
11127 struct __ptr_guard
11128 {
11129 _CharT *__p;
11130 __ptr_guard (_CharT *__ip): __p(__ip) { }
11131 ~__ptr_guard() { delete[] __p; }
11132 _CharT* __get() { return __p; }
11133 } __pg (new _CharT[__clen]);
11134 _CharT *__ws = __pg.__get();
11135 for (size_t __i = 0; __i < __clen; ++__i)
11136 __ws[__i] = __out.widen(__s[__i]);
11137 __ostream_insert(__out, __ws, __clen);
11138 }
11139 catch(__cxxabiv1::__forced_unwind&)
11140 {
11141 __out._M_setstate(ios_base::badbit);
11142 throw;
11143 }
11144 catch(...)
11145 { __out._M_setstate(ios_base::badbit); }
11146 }
11147 return __out;
11148 }
11149 extern template class basic_ostream<char>;
11150 extern template ostream& endl(ostream&);
11151 extern template ostream& ends(ostream&);
11152 extern template ostream& flush(ostream&);
11153 extern template ostream& operator<<(ostream&, char);
11154 extern template ostream& operator<<(ostream&, unsigned char);
11155 extern template ostream& operator<<(ostream&, signed char);
11156 extern template ostream& operator<<(ostream&, const char*);
11157 extern template ostream& operator<<(ostream&, const unsigned char*);
11158 extern template ostream& operator<<(ostream&, const signed char*);
11159 extern template ostream& ostream::_M_insert(long);
11160 extern template ostream& ostream::_M_insert(unsigned long);
11161 extern template ostream& ostream::_M_insert(bool);
11162 extern template ostream& ostream::_M_insert(long long);
11163 extern template ostream& ostream::_M_insert(unsigned long long);
11164 extern template ostream& ostream::_M_insert(double);
11165 extern template ostream& ostream::_M_insert(long double);
11166 extern template ostream& ostream::_M_insert(const void*);
11167 }
11168 namespace std __attribute__ ((__visibility__ ("default"))) {
11169 template<typename _CharT, typename _Traits>
11170 class basic_istream : virtual public basic_ios<_CharT, _Traits>
11171 {
11172 public:
11173 typedef _CharT char_type;
11174 typedef typename _Traits::int_type int_type;
11175 typedef typename _Traits::pos_type pos_type;
11176 typedef typename _Traits::off_type off_type;
11177 typedef _Traits traits_type;
11178 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
11179 typedef basic_ios<_CharT, _Traits> __ios_type;
11180 typedef basic_istream<_CharT, _Traits> __istream_type;
11181 typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
11182 __num_get_type;
11183 typedef ctype<_CharT> __ctype_type;
11184 protected:
11185 streamsize _M_gcount;
11186 public:
11187 explicit
11188 basic_istream(__streambuf_type* __sb)
11189 : _M_gcount(streamsize(0))
11190 { this->init(__sb); }
11191 virtual
11192 ~basic_istream()
11193 { _M_gcount = streamsize(0); }
11194 class sentry;
11195 friend class sentry;
11196 __istream_type&
11197 operator>>(__istream_type& (*__pf)(__istream_type&))
11198 { return __pf(*this); }
11199 __istream_type&
11200 operator>>(__ios_type& (*__pf)(__ios_type&))
11201 {
11202 __pf(*this);
11203 return *this;
11204 }
11205 __istream_type&
11206 operator>>(ios_base& (*__pf)(ios_base&))
11207 {
11208 __pf(*this);
11209 return *this;
11210 }
11211 __istream_type&
11212 operator>>(bool& __n)
11213 { return _M_extract(__n); }
11214 __istream_type&
11215 operator>>(short& __n);
11216 __istream_type&
11217 operator>>(unsigned short& __n)
11218 { return _M_extract(__n); }
11219 __istream_type&
11220 operator>>(int& __n);
11221 __istream_type&
11222 operator>>(unsigned int& __n)
11223 { return _M_extract(__n); }
11224 __istream_type&
11225 operator>>(long& __n)
11226 { return _M_extract(__n); }
11227 __istream_type&
11228 operator>>(unsigned long& __n)
11229 { return _M_extract(__n); }
11230 __istream_type&
11231 operator>>(long long& __n)
11232 { return _M_extract(__n); }
11233 __istream_type&
11234 operator>>(unsigned long long& __n)
11235 { return _M_extract(__n); }
11236 __istream_type&
11237 operator>>(float& __f)
11238 { return _M_extract(__f); }
11239 __istream_type&
11240 operator>>(double& __f)
11241 { return _M_extract(__f); }
11242 __istream_type&
11243 operator>>(long double& __f)
11244 { return _M_extract(__f); }
11245 __istream_type&
11246 operator>>(void*& __p)
11247 { return _M_extract(__p); }
11248 __istream_type&
11249 operator>>(__streambuf_type* __sb);
11250 streamsize
11251 gcount() const
11252 { return _M_gcount; }
11253 int_type
11254 get();
11255 __istream_type&
11256 get(char_type& __c);
11257 __istream_type&
11258 get(char_type* __s, streamsize __n, char_type __delim);
11259 __istream_type&
11260 get(char_type* __s, streamsize __n)
11261 { return this->get(__s, __n, this->widen('\n')); }
11262 __istream_type&
11263 get(__streambuf_type& __sb, char_type __delim);
11264 __istream_type&
11265 get(__streambuf_type& __sb)
11266 { return this->get(__sb, this->widen('\n')); }
11267 __istream_type&
11268 getline(char_type* __s, streamsize __n, char_type __delim);
11269 __istream_type&
11270 getline(char_type* __s, streamsize __n)
11271 { return this->getline(__s, __n, this->widen('\n')); }
11272 __istream_type&
11273 ignore();
11274 __istream_type&
11275 ignore(streamsize __n);
11276 __istream_type&
11277 ignore(streamsize __n, int_type __delim);
11278 int_type
11279 peek();
11280 __istream_type&
11281 read(char_type* __s, streamsize __n);
11282 streamsize
11283 readsome(char_type* __s, streamsize __n);
11284 __istream_type&
11285 putback(char_type __c);
11286 __istream_type&
11287 unget();
11288 int
11289 sync();
11290 pos_type
11291 tellg();
11292 __istream_type&
11293 seekg(pos_type);
11294 __istream_type&
11295 seekg(off_type, ios_base::seekdir);
11296 protected:
11297 basic_istream()
11298 : _M_gcount(streamsize(0))
11299 { this->init(0); }
11300 template<typename _ValueT>
11301 __istream_type&
11302 _M_extract(_ValueT& __v);
11303 };
11304 template<>
11305 basic_istream<char>&
11306 basic_istream<char>::
11307 getline(char_type* __s, streamsize __n, char_type __delim);
11308 template<>
11309 basic_istream<char>&
11310 basic_istream<char>::
11311 ignore(streamsize __n);
11312 template<>
11313 basic_istream<char>&
11314 basic_istream<char>::
11315 ignore(streamsize __n, int_type __delim);
11316 template<typename _CharT, typename _Traits>
11317 class basic_istream<_CharT, _Traits>::sentry
11318 {
11319 public:
11320 typedef _Traits traits_type;
11321 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
11322 typedef basic_istream<_CharT, _Traits> __istream_type;
11323 typedef typename __istream_type::__ctype_type __ctype_type;
11324 typedef typename _Traits::int_type __int_type;
11325 explicit
11326 sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
11327 operator bool() const
11328 { return _M_ok; }
11329 private:
11330 bool _M_ok;
11331 };
11332 template<typename _CharT, typename _Traits>
11333 basic_istream<_CharT, _Traits>&
11334 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
11335 template<class _Traits>
11336 inline basic_istream<char, _Traits>&
11337 operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
11338 { return (__in >> reinterpret_cast<char&>(__c)); }
11339 template<class _Traits>
11340 inline basic_istream<char, _Traits>&
11341 operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
11342 { return (__in >> reinterpret_cast<char&>(__c)); }
11343 template<typename _CharT, typename _Traits>
11344 basic_istream<_CharT, _Traits>&
11345 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
11346 template<>
11347 basic_istream<char>&
11348 operator>>(basic_istream<char>& __in, char* __s);
11349 template<class _Traits>
11350 inline basic_istream<char, _Traits>&
11351 operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
11352 { return (__in >> reinterpret_cast<char*>(__s)); }
11353 template<class _Traits>
11354 inline basic_istream<char, _Traits>&
11355 operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
11356 { return (__in >> reinterpret_cast<char*>(__s)); }
11357 template<typename _CharT, typename _Traits>
11358 class basic_iostream
11359 : public basic_istream<_CharT, _Traits>,
11360 public basic_ostream<_CharT, _Traits>
11361 {
11362 public:
11363 typedef _CharT char_type;
11364 typedef typename _Traits::int_type int_type;
11365 typedef typename _Traits::pos_type pos_type;
11366 typedef typename _Traits::off_type off_type;
11367 typedef _Traits traits_type;
11368 typedef basic_istream<_CharT, _Traits> __istream_type;
11369 typedef basic_ostream<_CharT, _Traits> __ostream_type;
11370 explicit
11371 basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
11372 : __istream_type(__sb), __ostream_type(__sb) { }
11373 virtual
11374 ~basic_iostream() { }
11375 protected:
11376 basic_iostream()
11377 : __istream_type(), __ostream_type() { }
11378 };
11379 template<typename _CharT, typename _Traits>
11380 basic_istream<_CharT, _Traits>&
11381 ws(basic_istream<_CharT, _Traits>& __is);
11382 }
11383 namespace std __attribute__ ((__visibility__ ("default"))) {
11384 template<typename _CharT, typename _Traits>
11385 basic_istream<_CharT, _Traits>::sentry::
11386 sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false)
11387 {
11388 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11389 if (__in.good())
11390 {
11391 if (__in.tie())
11392 __in.tie()->flush();
11393 if (!__noskip && bool(__in.flags() & ios_base::skipws))
11394 {
11395 const __int_type __eof = traits_type::eof();
11396 __streambuf_type* __sb = __in.rdbuf();
11397 __int_type __c = __sb->sgetc();
11398 const __ctype_type& __ct = __check_facet(__in._M_ctype);
11399 while (!traits_type::eq_int_type(__c, __eof)
11400 && __ct.is(ctype_base::space,
11401 traits_type::to_char_type(__c)))
11402 __c = __sb->snextc();
11403 if (traits_type::eq_int_type(__c, __eof))
11404 __err |= ios_base::eofbit;
11405 }
11406 }
11407 if (__in.good() && __err == ios_base::goodbit)
11408 _M_ok = true;
11409 else
11410 {
11411 __err |= ios_base::failbit;
11412 __in.setstate(__err);
11413 }
11414 }
11415 template<typename _CharT, typename _Traits>
11416 template<typename _ValueT>
11417 basic_istream<_CharT, _Traits>&
11418 basic_istream<_CharT, _Traits>::
11419 _M_extract(_ValueT& __v)
11420 {
11421 sentry __cerb(*this, false);
11422 if (__cerb)
11423 {
11424 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11425 try
11426 {
11427 const __num_get_type& __ng = __check_facet(this->_M_num_get);
11428 __ng.get(*this, 0, *this, __err, __v);
11429 }
11430 catch(__cxxabiv1::__forced_unwind&)
11431 {
11432 this->_M_setstate(ios_base::badbit);
11433 throw;
11434 }
11435 catch(...)
11436 { this->_M_setstate(ios_base::badbit); }
11437 if (__err)
11438 this->setstate(__err);
11439 }
11440 return *this;
11441 }
11442 template<typename _CharT, typename _Traits>
11443 basic_istream<_CharT, _Traits>&
11444 basic_istream<_CharT, _Traits>::
11445 operator>>(short& __n)
11446 {
11447 long __l;
11448 _M_extract(__l);
11449 if (!this->fail())
11450 {
11451 if (__gnu_cxx::__numeric_traits<short>::__min <= __l
11452 && __l <= __gnu_cxx::__numeric_traits<short>::__max)
11453 __n = short(__l);
11454 else
11455 this->setstate(ios_base::failbit);
11456 }
11457 return *this;
11458 }
11459 template<typename _CharT, typename _Traits>
11460 basic_istream<_CharT, _Traits>&
11461 basic_istream<_CharT, _Traits>::
11462 operator>>(int& __n)
11463 {
11464 long __l;
11465 _M_extract(__l);
11466 if (!this->fail())
11467 {
11468 if (__gnu_cxx::__numeric_traits<int>::__min <= __l
11469 && __l <= __gnu_cxx::__numeric_traits<int>::__max)
11470 __n = int(__l);
11471 else
11472 this->setstate(ios_base::failbit);
11473 }
11474 return *this;
11475 }
11476 template<typename _CharT, typename _Traits>
11477 basic_istream<_CharT, _Traits>&
11478 basic_istream<_CharT, _Traits>::
11479 operator>>(__streambuf_type* __sbout)
11480 {
11481 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11482 sentry __cerb(*this, false);
11483 if (__cerb && __sbout)
11484 {
11485 try
11486 {
11487 bool __ineof;
11488 if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof))
11489 __err |= ios_base::failbit;
11490 if (__ineof)
11491 __err |= ios_base::eofbit;
11492 }
11493 catch(__cxxabiv1::__forced_unwind&)
11494 {
11495 this->_M_setstate(ios_base::failbit);
11496 throw;
11497 }
11498 catch(...)
11499 { this->_M_setstate(ios_base::failbit); }
11500 }
11501 else if (!__sbout)
11502 __err |= ios_base::failbit;
11503 if (__err)
11504 this->setstate(__err);
11505 return *this;
11506 }
11507 template<typename _CharT, typename _Traits>
11508 typename basic_istream<_CharT, _Traits>::int_type
11509 basic_istream<_CharT, _Traits>::
11510 get(void)
11511 {
11512 const int_type __eof = traits_type::eof();
11513 int_type __c = __eof;
11514 _M_gcount = 0;
11515 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11516 sentry __cerb(*this, true);
11517 if (__cerb)
11518 {
11519 try
11520 {
11521 __c = this->rdbuf()->sbumpc();
11522 if (!traits_type::eq_int_type(__c, __eof))
11523 _M_gcount = 1;
11524 else
11525 __err |= ios_base::eofbit;
11526 }
11527 catch(__cxxabiv1::__forced_unwind&)
11528 {
11529 this->_M_setstate(ios_base::badbit);
11530 throw;
11531 }
11532 catch(...)
11533 { this->_M_setstate(ios_base::badbit); }
11534 }
11535 if (!_M_gcount)
11536 __err |= ios_base::failbit;
11537 if (__err)
11538 this->setstate(__err);
11539 return __c;
11540 }
11541 template<typename _CharT, typename _Traits>
11542 basic_istream<_CharT, _Traits>&
11543 basic_istream<_CharT, _Traits>::
11544 get(char_type& __c)
11545 {
11546 _M_gcount = 0;
11547 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11548 sentry __cerb(*this, true);
11549 if (__cerb)
11550 {
11551 try
11552 {
11553 const int_type __cb = this->rdbuf()->sbumpc();
11554 if (!traits_type::eq_int_type(__cb, traits_type::eof()))
11555 {
11556 _M_gcount = 1;
11557 __c = traits_type::to_char_type(__cb);
11558 }
11559 else
11560 __err |= ios_base::eofbit;
11561 }
11562 catch(__cxxabiv1::__forced_unwind&)
11563 {
11564 this->_M_setstate(ios_base::badbit);
11565 throw;
11566 }
11567 catch(...)
11568 { this->_M_setstate(ios_base::badbit); }
11569 }
11570 if (!_M_gcount)
11571 __err |= ios_base::failbit;
11572 if (__err)
11573 this->setstate(__err);
11574 return *this;
11575 }
11576 template<typename _CharT, typename _Traits>
11577 basic_istream<_CharT, _Traits>&
11578 basic_istream<_CharT, _Traits>::
11579 get(char_type* __s, streamsize __n, char_type __delim)
11580 {
11581 _M_gcount = 0;
11582 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11583 sentry __cerb(*this, true);
11584 if (__cerb)
11585 {
11586 try
11587 {
11588 const int_type __idelim = traits_type::to_int_type(__delim);
11589 const int_type __eof = traits_type::eof();
11590 __streambuf_type* __sb = this->rdbuf();
11591 int_type __c = __sb->sgetc();
11592 while (_M_gcount + 1 < __n
11593 && !traits_type::eq_int_type(__c, __eof)
11594 && !traits_type::eq_int_type(__c, __idelim))
11595 {
11596 *__s++ = traits_type::to_char_type(__c);
11597 ++_M_gcount;
11598 __c = __sb->snextc();
11599 }
11600 if (traits_type::eq_int_type(__c, __eof))
11601 __err |= ios_base::eofbit;
11602 }
11603 catch(__cxxabiv1::__forced_unwind&)
11604 {
11605 this->_M_setstate(ios_base::badbit);
11606 throw;
11607 }
11608 catch(...)
11609 { this->_M_setstate(ios_base::badbit); }
11610 }
11611 if (__n > 0)
11612 *__s = char_type();
11613 if (!_M_gcount)
11614 __err |= ios_base::failbit;
11615 if (__err)
11616 this->setstate(__err);
11617 return *this;
11618 }
11619 template<typename _CharT, typename _Traits>
11620 basic_istream<_CharT, _Traits>&
11621 basic_istream<_CharT, _Traits>::
11622 get(__streambuf_type& __sb, char_type __delim)
11623 {
11624 _M_gcount = 0;
11625 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11626 sentry __cerb(*this, true);
11627 if (__cerb)
11628 {
11629 try
11630 {
11631 const int_type __idelim = traits_type::to_int_type(__delim);
11632 const int_type __eof = traits_type::eof();
11633 __streambuf_type* __this_sb = this->rdbuf();
11634 int_type __c = __this_sb->sgetc();
11635 char_type __c2 = traits_type::to_char_type(__c);
11636 while (!traits_type::eq_int_type(__c, __eof)
11637 && !traits_type::eq_int_type(__c, __idelim)
11638 && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))
11639 {
11640 ++_M_gcount;
11641 __c = __this_sb->snextc();
11642 __c2 = traits_type::to_char_type(__c);
11643 }
11644 if (traits_type::eq_int_type(__c, __eof))
11645 __err |= ios_base::eofbit;
11646 }
11647 catch(__cxxabiv1::__forced_unwind&)
11648 {
11649 this->_M_setstate(ios_base::badbit);
11650 throw;
11651 }
11652 catch(...)
11653 { this->_M_setstate(ios_base::badbit); }
11654 }
11655 if (!_M_gcount)
11656 __err |= ios_base::failbit;
11657 if (__err)
11658 this->setstate(__err);
11659 return *this;
11660 }
11661 template<typename _CharT, typename _Traits>
11662 basic_istream<_CharT, _Traits>&
11663 basic_istream<_CharT, _Traits>::
11664 getline(char_type* __s, streamsize __n, char_type __delim)
11665 {
11666 _M_gcount = 0;
11667 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11668 sentry __cerb(*this, true);
11669 if (__cerb)
11670 {
11671 try
11672 {
11673 const int_type __idelim = traits_type::to_int_type(__delim);
11674 const int_type __eof = traits_type::eof();
11675 __streambuf_type* __sb = this->rdbuf();
11676 int_type __c = __sb->sgetc();
11677 while (_M_gcount + 1 < __n
11678 && !traits_type::eq_int_type(__c, __eof)
11679 && !traits_type::eq_int_type(__c, __idelim))
11680 {
11681 *__s++ = traits_type::to_char_type(__c);
11682 __c = __sb->snextc();
11683 ++_M_gcount;
11684 }
11685 if (traits_type::eq_int_type(__c, __eof))
11686 __err |= ios_base::eofbit;
11687 else
11688 {
11689 if (traits_type::eq_int_type(__c, __idelim))
11690 {
11691 __sb->sbumpc();
11692 ++_M_gcount;
11693 }
11694 else
11695 __err |= ios_base::failbit;
11696 }
11697 }
11698 catch(__cxxabiv1::__forced_unwind&)
11699 {
11700 this->_M_setstate(ios_base::badbit);
11701 throw;
11702 }
11703 catch(...)
11704 { this->_M_setstate(ios_base::badbit); }
11705 }
11706 if (__n > 0)
11707 *__s = char_type();
11708 if (!_M_gcount)
11709 __err |= ios_base::failbit;
11710 if (__err)
11711 this->setstate(__err);
11712 return *this;
11713 }
11714 template<typename _CharT, typename _Traits>
11715 basic_istream<_CharT, _Traits>&
11716 basic_istream<_CharT, _Traits>::
11717 ignore(void)
11718 {
11719 _M_gcount = 0;
11720 sentry __cerb(*this, true);
11721 if (__cerb)
11722 {
11723 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11724 try
11725 {
11726 const int_type __eof = traits_type::eof();
11727 __streambuf_type* __sb = this->rdbuf();
11728 if (traits_type::eq_int_type(__sb->sbumpc(), __eof))
11729 __err |= ios_base::eofbit;
11730 else
11731 _M_gcount = 1;
11732 }
11733 catch(__cxxabiv1::__forced_unwind&)
11734 {
11735 this->_M_setstate(ios_base::badbit);
11736 throw;
11737 }
11738 catch(...)
11739 { this->_M_setstate(ios_base::badbit); }
11740 if (__err)
11741 this->setstate(__err);
11742 }
11743 return *this;
11744 }
11745 template<typename _CharT, typename _Traits>
11746 basic_istream<_CharT, _Traits>&
11747 basic_istream<_CharT, _Traits>::
11748 ignore(streamsize __n)
11749 {
11750 _M_gcount = 0;
11751 sentry __cerb(*this, true);
11752 if (__cerb && __n > 0)
11753 {
11754 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11755 try
11756 {
11757 const int_type __eof = traits_type::eof();
11758 __streambuf_type* __sb = this->rdbuf();
11759 int_type __c = __sb->sgetc();
11760 bool __large_ignore = false;
11761 while (true)
11762 {
11763 while (_M_gcount < __n
11764 && !traits_type::eq_int_type(__c, __eof))
11765 {
11766 ++_M_gcount;
11767 __c = __sb->snextc();
11768 }
11769 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
11770 && !traits_type::eq_int_type(__c, __eof))
11771 {
11772 _M_gcount =
11773 __gnu_cxx::__numeric_traits<streamsize>::__min;
11774 __large_ignore = true;
11775 }
11776 else
11777 break;
11778 }
11779 if (__large_ignore)
11780 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
11781 if (traits_type::eq_int_type(__c, __eof))
11782 __err |= ios_base::eofbit;
11783 }
11784 catch(__cxxabiv1::__forced_unwind&)
11785 {
11786 this->_M_setstate(ios_base::badbit);
11787 throw;
11788 }
11789 catch(...)
11790 { this->_M_setstate(ios_base::badbit); }
11791 if (__err)
11792 this->setstate(__err);
11793 }
11794 return *this;
11795 }
11796 template<typename _CharT, typename _Traits>
11797 basic_istream<_CharT, _Traits>&
11798 basic_istream<_CharT, _Traits>::
11799 ignore(streamsize __n, int_type __delim)
11800 {
11801 _M_gcount = 0;
11802 sentry __cerb(*this, true);
11803 if (__cerb && __n > 0)
11804 {
11805 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11806 try
11807 {
11808 const int_type __eof = traits_type::eof();
11809 __streambuf_type* __sb = this->rdbuf();
11810 int_type __c = __sb->sgetc();
11811 bool __large_ignore = false;
11812 while (true)
11813 {
11814 while (_M_gcount < __n
11815 && !traits_type::eq_int_type(__c, __eof)
11816 && !traits_type::eq_int_type(__c, __delim))
11817 {
11818 ++_M_gcount;
11819 __c = __sb->snextc();
11820 }
11821 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
11822 && !traits_type::eq_int_type(__c, __eof)
11823 && !traits_type::eq_int_type(__c, __delim))
11824 {
11825 _M_gcount =
11826 __gnu_cxx::__numeric_traits<streamsize>::__min;
11827 __large_ignore = true;
11828 }
11829 else
11830 break;
11831 }
11832 if (__large_ignore)
11833 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
11834 if (traits_type::eq_int_type(__c, __eof))
11835 __err |= ios_base::eofbit;
11836 else if (traits_type::eq_int_type(__c, __delim))
11837 {
11838 if (_M_gcount
11839 < __gnu_cxx::__numeric_traits<streamsize>::__max)
11840 ++_M_gcount;
11841 __sb->sbumpc();
11842 }
11843 }
11844 catch(__cxxabiv1::__forced_unwind&)
11845 {
11846 this->_M_setstate(ios_base::badbit);
11847 throw;
11848 }
11849 catch(...)
11850 { this->_M_setstate(ios_base::badbit); }
11851 if (__err)
11852 this->setstate(__err);
11853 }
11854 return *this;
11855 }
11856 template<typename _CharT, typename _Traits>
11857 typename basic_istream<_CharT, _Traits>::int_type
11858 basic_istream<_CharT, _Traits>::
11859 peek(void)
11860 {
11861 int_type __c = traits_type::eof();
11862 _M_gcount = 0;
11863 sentry __cerb(*this, true);
11864 if (__cerb)
11865 {
11866 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11867 try
11868 {
11869 __c = this->rdbuf()->sgetc();
11870 if (traits_type::eq_int_type(__c, traits_type::eof()))
11871 __err |= ios_base::eofbit;
11872 }
11873 catch(__cxxabiv1::__forced_unwind&)
11874 {
11875 this->_M_setstate(ios_base::badbit);
11876 throw;
11877 }
11878 catch(...)
11879 { this->_M_setstate(ios_base::badbit); }
11880 if (__err)
11881 this->setstate(__err);
11882 }
11883 return __c;
11884 }
11885 template<typename _CharT, typename _Traits>
11886 basic_istream<_CharT, _Traits>&
11887 basic_istream<_CharT, _Traits>::
11888 read(char_type* __s, streamsize __n)
11889 {
11890 _M_gcount = 0;
11891 sentry __cerb(*this, true);
11892 if (__cerb)
11893 {
11894 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11895 try
11896 {
11897 _M_gcount = this->rdbuf()->sgetn(__s, __n);
11898 if (_M_gcount != __n)
11899 __err |= (ios_base::eofbit | ios_base::failbit);
11900 }
11901 catch(__cxxabiv1::__forced_unwind&)
11902 {
11903 this->_M_setstate(ios_base::badbit);
11904 throw;
11905 }
11906 catch(...)
11907 { this->_M_setstate(ios_base::badbit); }
11908 if (__err)
11909 this->setstate(__err);
11910 }
11911 return *this;
11912 }
11913 template<typename _CharT, typename _Traits>
11914 streamsize
11915 basic_istream<_CharT, _Traits>::
11916 readsome(char_type* __s, streamsize __n)
11917 {
11918 _M_gcount = 0;
11919 sentry __cerb(*this, true);
11920 if (__cerb)
11921 {
11922 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11923 try
11924 {
11925 const streamsize __num = this->rdbuf()->in_avail();
11926 if (__num > 0)
11927 _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n));
11928 else if (__num == -1)
11929 __err |= ios_base::eofbit;
11930 }
11931 catch(__cxxabiv1::__forced_unwind&)
11932 {
11933 this->_M_setstate(ios_base::badbit);
11934 throw;
11935 }
11936 catch(...)
11937 { this->_M_setstate(ios_base::badbit); }
11938 if (__err)
11939 this->setstate(__err);
11940 }
11941 return _M_gcount;
11942 }
11943 template<typename _CharT, typename _Traits>
11944 basic_istream<_CharT, _Traits>&
11945 basic_istream<_CharT, _Traits>::
11946 putback(char_type __c)
11947 {
11948 _M_gcount = 0;
11949 sentry __cerb(*this, true);
11950 if (__cerb)
11951 {
11952 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11953 try
11954 {
11955 const int_type __eof = traits_type::eof();
11956 __streambuf_type* __sb = this->rdbuf();
11957 if (!__sb
11958 || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))
11959 __err |= ios_base::badbit;
11960 }
11961 catch(__cxxabiv1::__forced_unwind&)
11962 {
11963 this->_M_setstate(ios_base::badbit);
11964 throw;
11965 }
11966 catch(...)
11967 { this->_M_setstate(ios_base::badbit); }
11968 if (__err)
11969 this->setstate(__err);
11970 }
11971 return *this;
11972 }
11973 template<typename _CharT, typename _Traits>
11974 basic_istream<_CharT, _Traits>&
11975 basic_istream<_CharT, _Traits>::
11976 unget(void)
11977 {
11978 _M_gcount = 0;
11979 sentry __cerb(*this, true);
11980 if (__cerb)
11981 {
11982 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
11983 try
11984 {
11985 const int_type __eof = traits_type::eof();
11986 __streambuf_type* __sb = this->rdbuf();
11987 if (!__sb
11988 || traits_type::eq_int_type(__sb->sungetc(), __eof))
11989 __err |= ios_base::badbit;
11990 }
11991 catch(__cxxabiv1::__forced_unwind&)
11992 {
11993 this->_M_setstate(ios_base::badbit);
11994 throw;
11995 }
11996 catch(...)
11997 { this->_M_setstate(ios_base::badbit); }
11998 if (__err)
11999 this->setstate(__err);
12000 }
12001 return *this;
12002 }
12003 template<typename _CharT, typename _Traits>
12004 int
12005 basic_istream<_CharT, _Traits>::
12006 sync(void)
12007 {
12008 int __ret = -1;
12009 sentry __cerb(*this, true);
12010 if (__cerb)
12011 {
12012 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
12013 try
12014 {
12015 __streambuf_type* __sb = this->rdbuf();
12016 if (__sb)
12017 {
12018 if (__sb->pubsync() == -1)
12019 __err |= ios_base::badbit;
12020 else
12021 __ret = 0;
12022 }
12023 }
12024 catch(__cxxabiv1::__forced_unwind&)
12025 {
12026 this->_M_setstate(ios_base::badbit);
12027 throw;
12028 }
12029 catch(...)
12030 { this->_M_setstate(ios_base::badbit); }
12031 if (__err)
12032 this->setstate(__err);
12033 }
12034 return __ret;
12035 }
12036 template<typename _CharT, typename _Traits>
12037 typename basic_istream<_CharT, _Traits>::pos_type
12038 basic_istream<_CharT, _Traits>::
12039 tellg(void)
12040 {
12041 pos_type __ret = pos_type(-1);
12042 try
12043 {
12044 if (!this->fail())
12045 __ret = this->rdbuf()->pubseekoff(0, ios_base::cur,
12046 ios_base::in);
12047 }
12048 catch(__cxxabiv1::__forced_unwind&)
12049 {
12050 this->_M_setstate(ios_base::badbit);
12051 throw;
12052 }
12053 catch(...)
12054 { this->_M_setstate(ios_base::badbit); }
12055 return __ret;
12056 }
12057 template<typename _CharT, typename _Traits>
12058 basic_istream<_CharT, _Traits>&
12059 basic_istream<_CharT, _Traits>::
12060 seekg(pos_type __pos)
12061 {
12062 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
12063 try
12064 {
12065 if (!this->fail())
12066 {
12067 const pos_type __p = this->rdbuf()->pubseekpos(__pos,
12068 ios_base::in);
12069 if (__p == pos_type(off_type(-1)))
12070 __err |= ios_base::failbit;
12071 }
12072 }
12073 catch(__cxxabiv1::__forced_unwind&)
12074 {
12075 this->_M_setstate(ios_base::badbit);
12076 throw;
12077 }
12078 catch(...)
12079 { this->_M_setstate(ios_base::badbit); }
12080 if (__err)
12081 this->setstate(__err);
12082 return *this;
12083 }
12084 template<typename _CharT, typename _Traits>
12085 basic_istream<_CharT, _Traits>&
12086 basic_istream<_CharT, _Traits>::
12087 seekg(off_type __off, ios_base::seekdir __dir)
12088 {
12089 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
12090 try
12091 {
12092 if (!this->fail())
12093 {
12094 const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
12095 ios_base::in);
12096 if (__p == pos_type(off_type(-1)))
12097 __err |= ios_base::failbit;
12098 }
12099 }
12100 catch(__cxxabiv1::__forced_unwind&)
12101 {
12102 this->_M_setstate(ios_base::badbit);
12103 throw;
12104 }
12105 catch(...)
12106 { this->_M_setstate(ios_base::badbit); }
12107 if (__err)
12108 this->setstate(__err);
12109 return *this;
12110 }
12111 template<typename _CharT, typename _Traits>
12112 basic_istream<_CharT, _Traits>&
12113 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
12114 {
12115 typedef basic_istream<_CharT, _Traits> __istream_type;
12116 typedef typename __istream_type::int_type __int_type;
12117 typename __istream_type::sentry __cerb(__in, false);
12118 if (__cerb)
12119 {
12120 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
12121 try
12122 {
12123 const __int_type __cb = __in.rdbuf()->sbumpc();
12124 if (!_Traits::eq_int_type(__cb, _Traits::eof()))
12125 __c = _Traits::to_char_type(__cb);
12126 else
12127 __err |= (ios_base::eofbit | ios_base::failbit);
12128 }
12129 catch(__cxxabiv1::__forced_unwind&)
12130 {
12131 __in._M_setstate(ios_base::badbit);
12132 throw;
12133 }
12134 catch(...)
12135 { __in._M_setstate(ios_base::badbit); }
12136 if (__err)
12137 __in.setstate(__err);
12138 }
12139 return __in;
12140 }
12141 template<typename _CharT, typename _Traits>
12142 basic_istream<_CharT, _Traits>&
12143 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
12144 {
12145 typedef basic_istream<_CharT, _Traits> __istream_type;
12146 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
12147 typedef typename _Traits::int_type int_type;
12148 typedef _CharT char_type;
12149 typedef ctype<_CharT> __ctype_type;
12150 streamsize __extracted = 0;
12151 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
12152 typename __istream_type::sentry __cerb(__in, false);
12153 if (__cerb)
12154 {
12155 try
12156 {
12157 streamsize __num = __in.width();
12158 if (__num <= 0)
12159 __num = __gnu_cxx::__numeric_traits<streamsize>::__max;
12160 const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
12161 const int_type __eof = _Traits::eof();
12162 __streambuf_type* __sb = __in.rdbuf();
12163 int_type __c = __sb->sgetc();
12164 while (__extracted < __num - 1
12165 && !_Traits::eq_int_type(__c, __eof)
12166 && !__ct.is(ctype_base::space,
12167 _Traits::to_char_type(__c)))
12168 {
12169 *__s++ = _Traits::to_char_type(__c);
12170 ++__extracted;
12171 __c = __sb->snextc();
12172 }
12173 if (_Traits::eq_int_type(__c, __eof))
12174 __err |= ios_base::eofbit;
12175 *__s = char_type();
12176 __in.width(0);
12177 }
12178 catch(__cxxabiv1::__forced_unwind&)
12179 {
12180 __in._M_setstate(ios_base::badbit);
12181 throw;
12182 }
12183 catch(...)
12184 { __in._M_setstate(ios_base::badbit); }
12185 }
12186 if (!__extracted)
12187 __err |= ios_base::failbit;
12188 if (__err)
12189 __in.setstate(__err);
12190 return __in;
12191 }
12192 template<typename _CharT, typename _Traits>
12193 basic_istream<_CharT, _Traits>&
12194 ws(basic_istream<_CharT, _Traits>& __in)
12195 {
12196 typedef basic_istream<_CharT, _Traits> __istream_type;
12197 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
12198 typedef typename __istream_type::int_type __int_type;
12199 typedef ctype<_CharT> __ctype_type;
12200 const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
12201 const __int_type __eof = _Traits::eof();
12202 __streambuf_type* __sb = __in.rdbuf();
12203 __int_type __c = __sb->sgetc();
12204 while (!_Traits::eq_int_type(__c, __eof)
12205 && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))
12206 __c = __sb->snextc();
12207 if (_Traits::eq_int_type(__c, __eof))
12208 __in.setstate(ios_base::eofbit);
12209 return __in;
12210 }
12211 extern template class basic_istream<char>;
12212 extern template istream& ws(istream&);
12213 extern template istream& operator>>(istream&, char&);
12214 extern template istream& operator>>(istream&, char*);
12215 extern template istream& operator>>(istream&, unsigned char&);
12216 extern template istream& operator>>(istream&, signed char&);
12217 extern template istream& operator>>(istream&, unsigned char*);
12218 extern template istream& operator>>(istream&, signed char*);
12219 extern template istream& istream::_M_extract(unsigned short&);
12220 extern template istream& istream::_M_extract(unsigned int&);
12221 extern template istream& istream::_M_extract(long&);
12222 extern template istream& istream::_M_extract(unsigned long&);
12223 extern template istream& istream::_M_extract(bool&);
12224 extern template istream& istream::_M_extract(long long&);
12225 extern template istream& istream::_M_extract(unsigned long long&);
12226 extern template istream& istream::_M_extract(float&);
12227 extern template istream& istream::_M_extract(double&);
12228 extern template istream& istream::_M_extract(long double&);
12229 extern template istream& istream::_M_extract(void*&);
12230 extern template class basic_iostream<char>;
12231 }
12232 namespace std __attribute__ ((__visibility__ ("default"))) {
12233 template<typename _Tp, typename _CharT = char,
12234 typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t>
12235 class istream_iterator
12236 : public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&>
12237 {
12238 public:
12239 typedef _CharT char_type;
12240 typedef _Traits traits_type;
12241 typedef basic_istream<_CharT, _Traits> istream_type;
12242 private:
12243 istream_type* _M_stream;
12244 _Tp _M_value;
12245 bool _M_ok;
12246 public:
12247 istream_iterator()
12248 : _M_stream(0), _M_value(), _M_ok(false) {}
12249 istream_iterator(istream_type& __s)
12250 : _M_stream(&__s)
12251 { _M_read(); }
12252 istream_iterator(const istream_iterator& __obj)
12253 : _M_stream(__obj._M_stream), _M_value(__obj._M_value),
12254 _M_ok(__obj._M_ok)
12255 { }
12256 const _Tp&
12257 operator*() const
12258 {
12259 ;
12260 return _M_value;
12261 }
12262 const _Tp*
12263 operator->() const { return &(operator*()); }
12264 istream_iterator&
12265 operator++()
12266 {
12267 ;
12268 _M_read();
12269 return *this;
12270 }
12271 istream_iterator
12272 operator++(int)
12273 {
12274 ;
12275 istream_iterator __tmp = *this;
12276 _M_read();
12277 return __tmp;
12278 }
12279 bool
12280 _M_equal(const istream_iterator& __x) const
12281 { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }
12282 private:
12283 void
12284 _M_read()
12285 {
12286 _M_ok = (_M_stream && *_M_stream) ? true : false;
12287 if (_M_ok)
12288 {
12289 *_M_stream >> _M_value;
12290 _M_ok = *_M_stream ? true : false;
12291 }
12292 }
12293 };
12294 template<typename _Tp, typename _CharT, typename _Traits, typename _Dist>
12295 inline bool
12296 operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
12297 const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
12298 { return __x._M_equal(__y); }
12299 template <class _Tp, class _CharT, class _Traits, class _Dist>
12300 inline bool
12301 operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
12302 const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
12303 { return !__x._M_equal(__y); }
12304 template<typename _Tp, typename _CharT = char,
12305 typename _Traits = char_traits<_CharT> >
12306 class ostream_iterator
12307 : public iterator<output_iterator_tag, void, void, void, void>
12308 {
12309 public:
12310 typedef _CharT char_type;
12311 typedef _Traits traits_type;
12312 typedef basic_ostream<_CharT, _Traits> ostream_type;
12313 private:
12314 ostream_type* _M_stream;
12315 const _CharT* _M_string;
12316 public:
12317 ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
12318 ostream_iterator(ostream_type& __s, const _CharT* __c)
12319 : _M_stream(&__s), _M_string(__c) { }
12320 ostream_iterator(const ostream_iterator& __obj)
12321 : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
12322 ostream_iterator&
12323 operator=(const _Tp& __value)
12324 {
12325 ;
12326 *_M_stream << __value;
12327 if (_M_string) *_M_stream << _M_string;
12328 return *this;
12329 }
12330 ostream_iterator&
12331 operator*()
12332 { return *this; }
12333 ostream_iterator&
12334 operator++()
12335 { return *this; }
12336 ostream_iterator&
12337 operator++(int)
12338 { return *this; }
12339 };
12340 }
12341 namespace std __attribute__ ((__visibility__ ("default"))) {
12342 struct _List_node_base
12343 {
12344 _List_node_base* _M_next;
12345 _List_node_base* _M_prev;
12346 static void
12347 swap(_List_node_base& __x, _List_node_base& __y);
12348 void
12349 transfer(_List_node_base * const __first,
12350 _List_node_base * const __last);
12351 void
12352 reverse();
12353 void
12354 hook(_List_node_base * const __position);
12355 void
12356 unhook();
12357 };
12358 template<typename _Tp>
12359 struct _List_node : public _List_node_base
12360 {
12361 _Tp _M_data;
12362 };
12363 template<typename _Tp>
12364 struct _List_iterator
12365 {
12366 typedef _List_iterator<_Tp> _Self;
12367 typedef _List_node<_Tp> _Node;
12368 typedef ptrdiff_t difference_type;
12369 typedef std::bidirectional_iterator_tag iterator_category;
12370 typedef _Tp value_type;
12371 typedef _Tp* pointer;
12372 typedef _Tp& reference;
12373 _List_iterator()
12374 : _M_node() { }
12375 explicit
12376 _List_iterator(_List_node_base* __x)
12377 : _M_node(__x) { }
12378 reference
12379 operator*() const
12380 { return static_cast<_Node*>(_M_node)->_M_data; }
12381 pointer
12382 operator->() const
12383 { return &static_cast<_Node*>(_M_node)->_M_data; }
12384 _Self&
12385 operator++()
12386 {
12387 _M_node = _M_node->_M_next;
12388 return *this;
12389 }
12390 _Self
12391 operator++(int)
12392 {
12393 _Self __tmp = *this;
12394 _M_node = _M_node->_M_next;
12395 return __tmp;
12396 }
12397 _Self&
12398 operator--()
12399 {
12400 _M_node = _M_node->_M_prev;
12401 return *this;
12402 }
12403 _Self
12404 operator--(int)
12405 {
12406 _Self __tmp = *this;
12407 _M_node = _M_node->_M_prev;
12408 return __tmp;
12409 }
12410 bool
12411 operator==(const _Self& __x) const
12412 { return _M_node == __x._M_node; }
12413 bool
12414 operator!=(const _Self& __x) const
12415 { return _M_node != __x._M_node; }
12416 _List_node_base* _M_node;
12417 };
12418 template<typename _Tp>
12419 struct _List_const_iterator
12420 {
12421 typedef _List_const_iterator<_Tp> _Self;
12422 typedef const _List_node<_Tp> _Node;
12423 typedef _List_iterator<_Tp> iterator;
12424 typedef ptrdiff_t difference_type;
12425 typedef std::bidirectional_iterator_tag iterator_category;
12426 typedef _Tp value_type;
12427 typedef const _Tp* pointer;
12428 typedef const _Tp& reference;
12429 _List_const_iterator()
12430 : _M_node() { }
12431 explicit
12432 _List_const_iterator(const _List_node_base* __x)
12433 : _M_node(__x) { }
12434 _List_const_iterator(const iterator& __x)
12435 : _M_node(__x._M_node) { }
12436 reference
12437 operator*() const
12438 { return static_cast<_Node*>(_M_node)->_M_data; }
12439 pointer
12440 operator->() const
12441 { return &static_cast<_Node*>(_M_node)->_M_data; }
12442 _Self&
12443 operator++()
12444 {
12445 _M_node = _M_node->_M_next;
12446 return *this;
12447 }
12448 _Self
12449 operator++(int)
12450 {
12451 _Self __tmp = *this;
12452 _M_node = _M_node->_M_next;
12453 return __tmp;
12454 }
12455 _Self&
12456 operator--()
12457 {
12458 _M_node = _M_node->_M_prev;
12459 return *this;
12460 }
12461 _Self
12462 operator--(int)
12463 {
12464 _Self __tmp = *this;
12465 _M_node = _M_node->_M_prev;
12466 return __tmp;
12467 }
12468 bool
12469 operator==(const _Self& __x) const
12470 { return _M_node == __x._M_node; }
12471 bool
12472 operator!=(const _Self& __x) const
12473 { return _M_node != __x._M_node; }
12474 const _List_node_base* _M_node;
12475 };
12476 template<typename _Val>
12477 inline bool
12478 operator==(const _List_iterator<_Val>& __x,
12479 const _List_const_iterator<_Val>& __y)
12480 { return __x._M_node == __y._M_node; }
12481 template<typename _Val>
12482 inline bool
12483 operator!=(const _List_iterator<_Val>& __x,
12484 const _List_const_iterator<_Val>& __y)
12485 { return __x._M_node != __y._M_node; }
12486 template<typename _Tp, typename _Alloc>
12487 class _List_base
12488 {
12489 protected:
12490 typedef typename _Alloc::template rebind<_List_node<_Tp> >::other
12491 _Node_alloc_type;
12492 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
12493 struct _List_impl
12494 : public _Node_alloc_type
12495 {
12496 _List_node_base _M_node;
12497 _List_impl()
12498 : _Node_alloc_type(), _M_node()
12499 { }
12500 _List_impl(const _Node_alloc_type& __a)
12501 : _Node_alloc_type(__a), _M_node()
12502 { }
12503 };
12504 _List_impl _M_impl;
12505 _List_node<_Tp>*
12506 _M_get_node()
12507 { return _M_impl._Node_alloc_type::allocate(1); }
12508 void
12509 _M_put_node(_List_node<_Tp>* __p)
12510 { _M_impl._Node_alloc_type::deallocate(__p, 1); }
12511 public:
12512 typedef _Alloc allocator_type;
12513 _Node_alloc_type&
12514 _M_get_Node_allocator()
12515 { return *static_cast<_Node_alloc_type*>(&this->_M_impl); }
12516 const _Node_alloc_type&
12517 _M_get_Node_allocator() const
12518 { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }
12519 _Tp_alloc_type
12520 _M_get_Tp_allocator() const
12521 { return _Tp_alloc_type(_M_get_Node_allocator()); }
12522 allocator_type
12523 get_allocator() const
12524 { return allocator_type(_M_get_Node_allocator()); }
12525 _List_base()
12526 : _M_impl()
12527 { _M_init(); }
12528 _List_base(const allocator_type& __a)
12529 : _M_impl(__a)
12530 { _M_init(); }
12531 ~_List_base()
12532 { _M_clear(); }
12533 void
12534 _M_clear();
12535 void
12536 _M_init()
12537 {
12538 this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
12539 this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
12540 }
12541 };
12542 template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
12543 class list : protected _List_base<_Tp, _Alloc>
12544 {
12545 typedef typename _Alloc::value_type _Alloc_value_type;
12546 typedef _List_base<_Tp, _Alloc> _Base;
12547 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
12548 public:
12549 typedef _Tp value_type;
12550 typedef typename _Tp_alloc_type::pointer pointer;
12551 typedef typename _Tp_alloc_type::const_pointer const_pointer;
12552 typedef typename _Tp_alloc_type::reference reference;
12553 typedef typename _Tp_alloc_type::const_reference const_reference;
12554 typedef _List_iterator<_Tp> iterator;
12555 typedef _List_const_iterator<_Tp> const_iterator;
12556 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
12557 typedef std::reverse_iterator<iterator> reverse_iterator;
12558 typedef size_t size_type;
12559 typedef ptrdiff_t difference_type;
12560 typedef _Alloc allocator_type;
12561 protected:
12562 typedef _List_node<_Tp> _Node;
12563 using _Base::_M_impl;
12564 using _Base::_M_put_node;
12565 using _Base::_M_get_node;
12566 using _Base::_M_get_Tp_allocator;
12567 using _Base::_M_get_Node_allocator;
12568 _Node*
12569 _M_create_node(const value_type& __x)
12570 {
12571 _Node* __p = this->_M_get_node();
12572 try
12573 {
12574 _M_get_Tp_allocator().construct(&__p->_M_data, __x);
12575 }
12576 catch(...)
12577 {
12578 _M_put_node(__p);
12579 throw;
12580 }
12581 return __p;
12582 }
12583 public:
12584 list()
12585 : _Base() { }
12586 explicit
12587 list(const allocator_type& __a)
12588 : _Base(__a) { }
12589 explicit
12590 list(size_type __n, const value_type& __value = value_type(),
12591 const allocator_type& __a = allocator_type())
12592 : _Base(__a)
12593 { _M_fill_initialize(__n, __value); }
12594 list(const list& __x)
12595 : _Base(__x._M_get_Node_allocator())
12596 { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); }
12597 template<typename _InputIterator>
12598 list(_InputIterator __first, _InputIterator __last,
12599 const allocator_type& __a = allocator_type())
12600 : _Base(__a)
12601 {
12602 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
12603 _M_initialize_dispatch(__first, __last, _Integral());
12604 }
12605 list&
12606 operator=(const list& __x);
12607 void
12608 assign(size_type __n, const value_type& __val)
12609 { _M_fill_assign(__n, __val); }
12610 template<typename _InputIterator>
12611 void
12612 assign(_InputIterator __first, _InputIterator __last)
12613 {
12614 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
12615 _M_assign_dispatch(__first, __last, _Integral());
12616 }
12617 allocator_type
12618 get_allocator() const
12619 { return _Base::get_allocator(); }
12620 iterator
12621 begin()
12622 { return iterator(this->_M_impl._M_node._M_next); }
12623 const_iterator
12624 begin() const
12625 { return const_iterator(this->_M_impl._M_node._M_next); }
12626 iterator
12627 end()
12628 { return iterator(&this->_M_impl._M_node); }
12629 const_iterator
12630 end() const
12631 { return const_iterator(&this->_M_impl._M_node); }
12632 reverse_iterator
12633 rbegin()
12634 { return reverse_iterator(end()); }
12635 const_reverse_iterator
12636 rbegin() const
12637 { return const_reverse_iterator(end()); }
12638 reverse_iterator
12639 rend()
12640 { return reverse_iterator(begin()); }
12641 const_reverse_iterator
12642 rend() const
12643 { return const_reverse_iterator(begin()); }
12644 bool
12645 empty() const
12646 { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
12647 size_type
12648 size() const
12649 { return std::distance(begin(), end()); }
12650 size_type
12651 max_size() const
12652 { return _M_get_Tp_allocator().max_size(); }
12653 void
12654 resize(size_type __new_size, value_type __x = value_type());
12655 reference
12656 front()
12657 { return *begin(); }
12658 const_reference
12659 front() const
12660 { return *begin(); }
12661 reference
12662 back()
12663 {
12664 iterator __tmp = end();
12665 --__tmp;
12666 return *__tmp;
12667 }
12668 const_reference
12669 back() const
12670 {
12671 const_iterator __tmp = end();
12672 --__tmp;
12673 return *__tmp;
12674 }
12675 void
12676 push_front(const value_type& __x)
12677 { this->_M_insert(begin(), __x); }
12678 void
12679 pop_front()
12680 { this->_M_erase(begin()); }
12681 void
12682 push_back(const value_type& __x)
12683 { this->_M_insert(end(), __x); }
12684 void
12685 pop_back()
12686 { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
12687 iterator
12688 insert(iterator __position, const value_type& __x);
12689 void
12690 insert(iterator __position, size_type __n, const value_type& __x)
12691 {
12692 list __tmp(__n, __x, _M_get_Node_allocator());
12693 splice(__position, __tmp);
12694 }
12695 template<typename _InputIterator>
12696 void
12697 insert(iterator __position, _InputIterator __first,
12698 _InputIterator __last)
12699 {
12700 list __tmp(__first, __last, _M_get_Node_allocator());
12701 splice(__position, __tmp);
12702 }
12703 iterator
12704 erase(iterator __position);
12705 iterator
12706 erase(iterator __first, iterator __last)
12707 {
12708 while (__first != __last)
12709 __first = erase(__first);
12710 return __last;
12711 }
12712 void
12713 swap(list& __x)
12714 {
12715 _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
12716 std::__alloc_swap<typename _Base::_Node_alloc_type>::
12717 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator());
12718 }
12719 void
12720 clear()
12721 {
12722 _Base::_M_clear();
12723 _Base::_M_init();
12724 }
12725 void
12726 splice(iterator __position, list& __x)
12727 {
12728 if (!__x.empty())
12729 {
12730 _M_check_equal_allocators(__x);
12731 this->_M_transfer(__position, __x.begin(), __x.end());
12732 }
12733 }
12734 void
12735 splice(iterator __position, list& __x, iterator __i)
12736 {
12737 iterator __j = __i;
12738 ++__j;
12739 if (__position == __i || __position == __j)
12740 return;
12741 if (this != &__x)
12742 _M_check_equal_allocators(__x);
12743 this->_M_transfer(__position, __i, __j);
12744 }
12745 void
12746 splice(iterator __position, list& __x, iterator __first,
12747 iterator __last)
12748 {
12749 if (__first != __last)
12750 {
12751 if (this != &__x)
12752 _M_check_equal_allocators(__x);
12753 this->_M_transfer(__position, __first, __last);
12754 }
12755 }
12756 void
12757 remove(const _Tp& __value);
12758 template<typename _Predicate>
12759 void
12760 remove_if(_Predicate);
12761 void
12762 unique();
12763 template<typename _BinaryPredicate>
12764 void
12765 unique(_BinaryPredicate);
12766 void
12767 merge(list& __x);
12768 template<typename _StrictWeakOrdering>
12769 void
12770 merge(list&, _StrictWeakOrdering);
12771 void
12772 reverse()
12773 { this->_M_impl._M_node.reverse(); }
12774 void
12775 sort();
12776 template<typename _StrictWeakOrdering>
12777 void
12778 sort(_StrictWeakOrdering);
12779 protected:
12780 template<typename _Integer>
12781 void
12782 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
12783 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
12784 template<typename _InputIterator>
12785 void
12786 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
12787 __false_type)
12788 {
12789 for (; __first != __last; ++__first)
12790 push_back(*__first);
12791 }
12792 void
12793 _M_fill_initialize(size_type __n, const value_type& __x)
12794 {
12795 for (; __n > 0; --__n)
12796 push_back(__x);
12797 }
12798 template<typename _Integer>
12799 void
12800 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
12801 { _M_fill_assign(__n, __val); }
12802 template<typename _InputIterator>
12803 void
12804 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
12805 __false_type);
12806 void
12807 _M_fill_assign(size_type __n, const value_type& __val);
12808 void
12809 _M_transfer(iterator __position, iterator __first, iterator __last)
12810 { __position._M_node->transfer(__first._M_node, __last._M_node); }
12811 void
12812 _M_insert(iterator __position, const value_type& __x)
12813 {
12814 _Node* __tmp = _M_create_node(__x);
12815 __tmp->hook(__position._M_node);
12816 }
12817 void
12818 _M_erase(iterator __position)
12819 {
12820 __position._M_node->unhook();
12821 _Node* __n = static_cast<_Node*>(__position._M_node);
12822 _M_get_Tp_allocator().destroy(&__n->_M_data);
12823 _M_put_node(__n);
12824 }
12825 void
12826 _M_check_equal_allocators(list& __x)
12827 {
12828 if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
12829 _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
12830 __throw_runtime_error(("list::_M_check_equal_allocators"));
12831 }
12832 };
12833 template<typename _Tp, typename _Alloc>
12834 inline bool
12835 operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12836 {
12837 typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;
12838 const_iterator __end1 = __x.end();
12839 const_iterator __end2 = __y.end();
12840 const_iterator __i1 = __x.begin();
12841 const_iterator __i2 = __y.begin();
12842 while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
12843 {
12844 ++__i1;
12845 ++__i2;
12846 }
12847 return __i1 == __end1 && __i2 == __end2;
12848 }
12849 template<typename _Tp, typename _Alloc>
12850 inline bool
12851 operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12852 { return std::lexicographical_compare(__x.begin(), __x.end(),
12853 __y.begin(), __y.end()); }
12854 template<typename _Tp, typename _Alloc>
12855 inline bool
12856 operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12857 { return !(__x == __y); }
12858 template<typename _Tp, typename _Alloc>
12859 inline bool
12860 operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12861 { return __y < __x; }
12862 template<typename _Tp, typename _Alloc>
12863 inline bool
12864 operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12865 { return !(__y < __x); }
12866 template<typename _Tp, typename _Alloc>
12867 inline bool
12868 operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
12869 { return !(__x < __y); }
12870 template<typename _Tp, typename _Alloc>
12871 inline void
12872 swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
12873 { __x.swap(__y); }
12874 }
12875 namespace std __attribute__ ((__visibility__ ("default"))) {
12876 template<typename _Tp, typename _Alloc>
12877 void
12878 _List_base<_Tp, _Alloc>::
12879 _M_clear()
12880 {
12881 typedef _List_node<_Tp> _Node;
12882 _Node* __cur = static_cast<_Node*>(this->_M_impl._M_node._M_next);
12883 while (__cur != &this->_M_impl._M_node)
12884 {
12885 _Node* __tmp = __cur;
12886 __cur = static_cast<_Node*>(__cur->_M_next);
12887 _M_get_Tp_allocator().destroy(&__tmp->_M_data);
12888 _M_put_node(__tmp);
12889 }
12890 }
12891 template<typename _Tp, typename _Alloc>
12892 typename list<_Tp, _Alloc>::iterator
12893 list<_Tp, _Alloc>::
12894 insert(iterator __position, const value_type& __x)
12895 {
12896 _Node* __tmp = _M_create_node(__x);
12897 __tmp->hook(__position._M_node);
12898 return iterator(__tmp);
12899 }
12900 template<typename _Tp, typename _Alloc>
12901 typename list<_Tp, _Alloc>::iterator
12902 list<_Tp, _Alloc>::
12903 erase(iterator __position)
12904 {
12905 iterator __ret = iterator(__position._M_node->_M_next);
12906 _M_erase(__position);
12907 return __ret;
12908 }
12909 template<typename _Tp, typename _Alloc>
12910 void
12911 list<_Tp, _Alloc>::
12912 resize(size_type __new_size, value_type __x)
12913 {
12914 iterator __i = begin();
12915 size_type __len = 0;
12916 for (; __i != end() && __len < __new_size; ++__i, ++__len)
12917 ;
12918 if (__len == __new_size)
12919 erase(__i, end());
12920 else
12921 insert(end(), __new_size - __len, __x);
12922 }
12923 template<typename _Tp, typename _Alloc>
12924 list<_Tp, _Alloc>&
12925 list<_Tp, _Alloc>::
12926 operator=(const list& __x)
12927 {
12928 if (this != &__x)
12929 {
12930 iterator __first1 = begin();
12931 iterator __last1 = end();
12932 const_iterator __first2 = __x.begin();
12933 const_iterator __last2 = __x.end();
12934 for (; __first1 != __last1 && __first2 != __last2;
12935 ++__first1, ++__first2)
12936 *__first1 = *__first2;
12937 if (__first2 == __last2)
12938 erase(__first1, __last1);
12939 else
12940 insert(__last1, __first2, __last2);
12941 }
12942 return *this;
12943 }
12944 template<typename _Tp, typename _Alloc>
12945 void
12946 list<_Tp, _Alloc>::
12947 _M_fill_assign(size_type __n, const value_type& __val)
12948 {
12949 iterator __i = begin();
12950 for (; __i != end() && __n > 0; ++__i, --__n)
12951 *__i = __val;
12952 if (__n > 0)
12953 insert(end(), __n, __val);
12954 else
12955 erase(__i, end());
12956 }
12957 template<typename _Tp, typename _Alloc>
12958 template <typename _InputIterator>
12959 void
12960 list<_Tp, _Alloc>::
12961 _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
12962 __false_type)
12963 {
12964 iterator __first1 = begin();
12965 iterator __last1 = end();
12966 for (; __first1 != __last1 && __first2 != __last2;
12967 ++__first1, ++__first2)
12968 *__first1 = *__first2;
12969 if (__first2 == __last2)
12970 erase(__first1, __last1);
12971 else
12972 insert(__last1, __first2, __last2);
12973 }
12974 template<typename _Tp, typename _Alloc>
12975 void
12976 list<_Tp, _Alloc>::
12977 remove(const value_type& __value)
12978 {
12979 iterator __first = begin();
12980 iterator __last = end();
12981 iterator __extra = __last;
12982 while (__first != __last)
12983 {
12984 iterator __next = __first;
12985 ++__next;
12986 if (*__first == __value)
12987 {
12988 if (&*__first != &__value)
12989 _M_erase(__first);
12990 else
12991 __extra = __first;
12992 }
12993 __first = __next;
12994 }
12995 if (__extra != __last)
12996 _M_erase(__extra);
12997 }
12998 template<typename _Tp, typename _Alloc>
12999 void
13000 list<_Tp, _Alloc>::
13001 unique()
13002 {
13003 iterator __first = begin();
13004 iterator __last = end();
13005 if (__first == __last)
13006 return;
13007 iterator __next = __first;
13008 while (++__next != __last)
13009 {
13010 if (*__first == *__next)
13011 _M_erase(__next);
13012 else
13013 __first = __next;
13014 __next = __first;
13015 }
13016 }
13017 template<typename _Tp, typename _Alloc>
13018 void
13019 list<_Tp, _Alloc>::
13020 merge(list& __x)
13021 {
13022 if (this != &__x)
13023 {
13024 _M_check_equal_allocators(__x);
13025 iterator __first1 = begin();
13026 iterator __last1 = end();
13027 iterator __first2 = __x.begin();
13028 iterator __last2 = __x.end();
13029 while (__first1 != __last1 && __first2 != __last2)
13030 if (*__first2 < *__first1)
13031 {
13032 iterator __next = __first2;
13033 _M_transfer(__first1, __first2, ++__next);
13034 __first2 = __next;
13035 }
13036 else
13037 ++__first1;
13038 if (__first2 != __last2)
13039 _M_transfer(__last1, __first2, __last2);
13040 }
13041 }
13042 template<typename _Tp, typename _Alloc>
13043 template <typename _StrictWeakOrdering>
13044 void
13045 list<_Tp, _Alloc>::
13046 merge(list& __x, _StrictWeakOrdering __comp)
13047 {
13048 if (this != &__x)
13049 {
13050 _M_check_equal_allocators(__x);
13051 iterator __first1 = begin();
13052 iterator __last1 = end();
13053 iterator __first2 = __x.begin();
13054 iterator __last2 = __x.end();
13055 while (__first1 != __last1 && __first2 != __last2)
13056 if (__comp(*__first2, *__first1))
13057 {
13058 iterator __next = __first2;
13059 _M_transfer(__first1, __first2, ++__next);
13060 __first2 = __next;
13061 }
13062 else
13063 ++__first1;
13064 if (__first2 != __last2)
13065 _M_transfer(__last1, __first2, __last2);
13066 }
13067 }
13068 template<typename _Tp, typename _Alloc>
13069 void
13070 list<_Tp, _Alloc>::
13071 sort()
13072 {
13073 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
13074 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
13075 {
13076 list __carry;
13077 list __tmp[64];
13078 list * __fill = &__tmp[0];
13079 list * __counter;
13080 do
13081 {
13082 __carry.splice(__carry.begin(), *this, begin());
13083 for(__counter = &__tmp[0];
13084 __counter != __fill && !__counter->empty();
13085 ++__counter)
13086 {
13087 __counter->merge(__carry);
13088 __carry.swap(*__counter);
13089 }
13090 __carry.swap(*__counter);
13091 if (__counter == __fill)
13092 ++__fill;
13093 }
13094 while ( !empty() );
13095 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
13096 __counter->merge(*(__counter - 1));
13097 swap( *(__fill - 1) );
13098 }
13099 }
13100 template<typename _Tp, typename _Alloc>
13101 template <typename _Predicate>
13102 void
13103 list<_Tp, _Alloc>::
13104 remove_if(_Predicate __pred)
13105 {
13106 iterator __first = begin();
13107 iterator __last = end();
13108 while (__first != __last)
13109 {
13110 iterator __next = __first;
13111 ++__next;
13112 if (__pred(*__first))
13113 _M_erase(__first);
13114 __first = __next;
13115 }
13116 }
13117 template<typename _Tp, typename _Alloc>
13118 template <typename _BinaryPredicate>
13119 void
13120 list<_Tp, _Alloc>::
13121 unique(_BinaryPredicate __binary_pred)
13122 {
13123 iterator __first = begin();
13124 iterator __last = end();
13125 if (__first == __last)
13126 return;
13127 iterator __next = __first;
13128 while (++__next != __last)
13129 {
13130 if (__binary_pred(*__first, *__next))
13131 _M_erase(__next);
13132 else
13133 __first = __next;
13134 __next = __first;
13135 }
13136 }
13137 template<typename _Tp, typename _Alloc>
13138 template <typename _StrictWeakOrdering>
13139 void
13140 list<_Tp, _Alloc>::
13141 sort(_StrictWeakOrdering __comp)
13142 {
13143 if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
13144 && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
13145 {
13146 list __carry;
13147 list __tmp[64];
13148 list * __fill = &__tmp[0];
13149 list * __counter;
13150 do
13151 {
13152 __carry.splice(__carry.begin(), *this, begin());
13153 for(__counter = &__tmp[0];
13154 __counter != __fill && !__counter->empty();
13155 ++__counter)
13156 {
13157 __counter->merge(__carry, __comp);
13158 __carry.swap(*__counter);
13159 }
13160 __carry.swap(*__counter);
13161 if (__counter == __fill)
13162 ++__fill;
13163 }
13164 while ( !empty() );
13165 for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
13166 __counter->merge(*(__counter - 1), __comp);
13167 swap(*(__fill - 1));
13168 }
13169 }
13170 }
13171 typedef QtValidLicenseForCoreModule QtCoreModule;
13172 template <typename T> class QVector;
13173 template <typename T> class QSet;
13174 struct __attribute__((visibility("default"))) QListData {
13175 struct Data {
13176 QBasicAtomicInt ref;
13177 int alloc, begin, end;
13178 uint sharable : 1;
13179 void *array[1];
13180 };
13181 enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
13182 Data *detach();
13183 Data *detach2();
13184 void realloc(int alloc);
13185 static Data shared_null;
13186 Data *d;
13187 void **erase(void **xi);
13188 void **append();
13189 void **append(const QListData &l);
13190 void **prepend();
13191 void **insert(int i);
13192 void remove(int i);
13193 void remove(int i, int n);
13194 void move(int from, int to);
13195 inline int size() const { return d->end - d->begin; }
13196 inline bool isEmpty() const { return d->end == d->begin; }
13197 inline void **at(int i) const { return d->array + d->begin + i; }
13198 inline void **begin() const { return d->array + d->begin; }
13199 inline void **end() const { return d->array + d->end; }
13200 };
13201 template <typename T>
13202 class QList
13203 {
13204 struct Node { void *v;
13205 inline T &t()
13206 { return *reinterpret_cast<T*>(QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic
13207 ? v : this); }
13208 };
13209 union { QListData p; QListData::Data *d; };
13210 public:
13211 inline QList() : d(&QListData::shared_null) { d->ref.ref(); }
13212 inline QList(const QList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach_helper(); }
13213 ~QList();
13214 QList<T> &operator=(const QList<T> &l);
13215 bool operator==(const QList<T> &l) const;
13216 inline bool operator!=(const QList<T> &l) const { return !(*this == l); }
13217 inline int size() const { return p.size(); }
13218 inline void detach() { if (d->ref != 1) detach_helper(); }
13219 inline bool isDetached() const { return d->ref == 1; }
13220 inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
13221 inline bool isEmpty() const { return p.isEmpty(); }
13222 void clear();
13223 const T &at(int i) const;
13224 const T &operator[](int i) const;
13225 T &operator[](int i);
13226 void append(const T &t);
13227 void append(const QList<T> &t);
13228 void prepend(const T &t);
13229 void insert(int i, const T &t);
13230 void replace(int i, const T &t);
13231 void removeAt(int i);
13232 int removeAll(const T &t);
13233 bool removeOne(const T &t);
13234 T takeAt(int i);
13235 T takeFirst();
13236 T takeLast();
13237 void move(int from, int to);
13238 void swap(int i, int j);
13239 int indexOf(const T &t, int from = 0) const;
13240 int lastIndexOf(const T &t, int from = -1) const;
13241 QBool contains(const T &t) const;
13242 int count(const T &t) const;
13243 class const_iterator;
13244 class iterator {
13245 public:
13246 Node *i;
13247 typedef std::random_access_iterator_tag iterator_category;
13248 typedef ptrdiff_t difference_type;
13249 typedef T value_type;
13250 typedef T *pointer;
13251 typedef T &reference;
13252 inline iterator() : i(0) {}
13253 inline iterator(Node *n) : i(n) {}
13254 inline iterator(const iterator &o): i(o.i){}
13255 inline T &operator*() const { return i->t(); }
13256 inline T *operator->() const { return &i->t(); }
13257 inline T &operator[](int j) const { return i[j].t(); }
13258 inline bool operator==(const iterator &o) const { return i == o.i; }
13259 inline bool operator!=(const iterator &o) const { return i != o.i; }
13260 inline bool operator<(const iterator& other) const { return i < other.i; }
13261 inline bool operator<=(const iterator& other) const { return i <= other.i; }
13262 inline bool operator>(const iterator& other) const { return i > other.i; }
13263 inline bool operator>=(const iterator& other) const { return i >= other.i; }
13264 inline bool operator==(const const_iterator &o) const
13265 { return i == o.i; }
13266 inline bool operator!=(const const_iterator &o) const
13267 { return i != o.i; }
13268 inline bool operator<(const const_iterator& other) const
13269 { return i < other.i; }
13270 inline bool operator<=(const const_iterator& other) const
13271 { return i <= other.i; }
13272 inline bool operator>(const const_iterator& other) const
13273 { return i > other.i; }
13274 inline bool operator>=(const const_iterator& other) const
13275 { return i >= other.i; }
13276 inline iterator &operator++() { ++i; return *this; }
13277 inline iterator operator++(int) { Node *n = i; ++i; return n; }
13278 inline iterator &operator--() { i--; return *this; }
13279 inline iterator operator--(int) { Node *n = i; i--; return n; }
13280 inline iterator &operator+=(int j) { i+=j; return *this; }
13281 inline iterator &operator-=(int j) { i-=j; return *this; }
13282 inline iterator operator+(int j) const { return iterator(i+j); }
13283 inline iterator operator-(int j) const { return iterator(i-j); }
13284 inline int operator-(iterator j) const { return i - j.i; }
13285 };
13286 friend class iterator;
13287 class const_iterator {
13288 public:
13289 Node *i;
13290 typedef std::random_access_iterator_tag iterator_category;
13291 typedef ptrdiff_t difference_type;
13292 typedef T value_type;
13293 typedef const T *pointer;
13294 typedef const T &reference;
13295 inline const_iterator() : i(0) {}
13296 inline const_iterator(Node *n) : i(n) {}
13297 inline const_iterator(const const_iterator &o): i(o.i) {}
13298 inline const_iterator(const iterator &o): i(o.i) {}
13299 inline const T &operator*() const { return i->t(); }
13300 inline const T *operator->() const { return &i->t(); }
13301 inline const T &operator[](int j) const { return i[j].t(); }
13302 inline bool operator==(const const_iterator &o) const { return i == o.i; }
13303 inline bool operator!=(const const_iterator &o) const { return i != o.i; }
13304 inline bool operator<(const const_iterator& other) const { return i < other.i; }
13305 inline bool operator<=(const const_iterator& other) const { return i <= other.i; }
13306 inline bool operator>(const const_iterator& other) const { return i > other.i; }
13307 inline bool operator>=(const const_iterator& other) const { return i >= other.i; }
13308 inline const_iterator &operator++() { ++i; return *this; }
13309 inline const_iterator operator++(int) { Node *n = i; ++i; return n; }
13310 inline const_iterator &operator--() { i--; return *this; }
13311 inline const_iterator operator--(int) { Node *n = i; i--; return n; }
13312 inline const_iterator &operator+=(int j) { i+=j; return *this; }
13313 inline const_iterator &operator-=(int j) { i-=j; return *this; }
13314 inline const_iterator operator+(int j) const { return const_iterator(i+j); }
13315 inline const_iterator operator-(int j) const { return const_iterator(i-j); }
13316 inline int operator-(const_iterator j) const { return i - j.i; }
13317 };
13318 friend class const_iterator;
13319 inline iterator begin() { detach(); return reinterpret_cast<Node *>(p.begin()); }
13320 inline const_iterator begin() const { return reinterpret_cast<Node *>(p.begin()); }
13321 inline const_iterator constBegin() const { return reinterpret_cast<Node *>(p.begin()); }
13322 inline iterator end() { detach(); return reinterpret_cast<Node *>(p.end()); }
13323 inline const_iterator end() const { return reinterpret_cast<Node *>(p.end()); }
13324 inline const_iterator constEnd() const { return reinterpret_cast<Node *>(p.end()); }
13325 iterator insert(iterator before, const T &t);
13326 iterator erase(iterator pos);
13327 iterator erase(iterator first, iterator last);
13328 typedef iterator Iterator;
13329 typedef const_iterator ConstIterator;
13330 inline int count() const { return p.size(); }
13331 inline int length() const { return p.size(); }
13332 inline T& first() { qt_noop(); return *begin(); }
13333 inline const T& first() const { qt_noop(); return *begin(); }
13334 T& last() { qt_noop(); return *(--end()); }
13335 const T& last() const { qt_noop(); return *(--end()); }
13336 inline void removeFirst() { qt_noop(); erase(begin()); }
13337 inline void removeLast() { qt_noop(); erase(--end()); }
13338 inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
13339 inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
13340 QList<T> mid(int pos, int length = -1) const;
13341 T value(int i) const;
13342 T value(int i, const T &defaultValue) const;
13343 inline void push_back(const T &t) { append(t); }
13344 inline void push_front(const T &t) { prepend(t); }
13345 inline T& front() { return first(); }
13346 inline const T& front() const { return first(); }
13347 inline T& back() { return last(); }
13348 inline const T& back() const { return last(); }
13349 inline void pop_front() { removeFirst(); }
13350 inline void pop_back() { removeLast(); }
13351 inline bool empty() const { return isEmpty(); }
13352 typedef int size_type;
13353 typedef T value_type;
13354 typedef value_type *pointer;
13355 typedef const value_type *const_pointer;
13356 typedef value_type &reference;
13357 typedef const value_type &const_reference;
13358 typedef ptrdiff_t difference_type;
13359 QList<T> &operator+=(const QList<T> &l);
13360 inline QList<T> operator+(const QList<T> &l) const
13361 { QList n = *this; n += l; return n; }
13362 inline QList<T> &operator+=(const T &t)
13363 { append(t); return *this; }
13364 inline QList<T> &operator<< (const T &t)
13365 { append(t); return *this; }
13366 inline QList<T> &operator<<(const QList<T> &l)
13367 { *this += l; return *this; }
13368 QVector<T> toVector() const;
13369 QSet<T> toSet() const;
13370 static QList<T> fromVector(const QVector<T> &vector);
13371 static QList<T> fromSet(const QSet<T> &set);
13372 static inline QList<T> fromStdList(const std::list<T> &list)
13373 { QList<T> tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
13374 inline std::list<T> toStdList() const
13375 { std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
13376 private:
13377 void detach_helper();
13378 void free(QListData::Data *d);
13379 void node_construct(Node *n, const T &t);
13380 void node_destruct(Node *n);
13381 void node_copy(Node *from, Node *to, Node *src);
13382 void node_destruct(Node *from, Node *to);
13383 };
13384 template <typename T>
13385 inline void QList<T>::node_construct(Node *n, const T &t)
13386 {
13387 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) n->v = new T(t);
13388 else if (QTypeInfo<T>::isComplex) new (n) T(t);
13389 else *reinterpret_cast<T*>(n) = t;
13390 }
13391 template <typename T>
13392 inline void QList<T>::node_destruct(Node *n)
13393 {
13394 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) delete reinterpret_cast<T*>(n->v);
13395 else if (QTypeInfo<T>::isComplex) reinterpret_cast<T*>(n)->~T();
13396 }
13397 template <typename T>
13398 inline void QList<T>::node_copy(Node *from, Node *to, Node *src)
13399 {
13400 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
13401 while(from != to)
13402 (from++)->v = new T(*reinterpret_cast<T*>((src++)->v));
13403 else if (QTypeInfo<T>::isComplex)
13404 while(from != to)
13405 new (from++) T(*reinterpret_cast<T*>(src++));
13406 }
13407 template <typename T>
13408 inline void QList<T>::node_destruct(Node *from, Node *to)
13409 {
13410 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
13411 while(from != to) --to, delete reinterpret_cast<T*>(to->v);
13412 else if (QTypeInfo<T>::isComplex)
13413 while (from != to) --to, reinterpret_cast<T*>(to)->~T();
13414 }
13415 template <typename T>
13416 inline QList<T> &QList<T>::operator=(const QList<T> &l)
13417 {
13418 if (d != l.d) {
13419 l.d->ref.ref();
13420 if (!d->ref.deref())
13421 free(d);
13422 d = l.d;
13423 if (!d->sharable)
13424 detach_helper();
13425 }
13426 return *this;
13427 }
13428 template <typename T>
13429 inline typename QList<T>::iterator QList<T>::insert(iterator before, const T &t)
13430 { Node *n = reinterpret_cast<Node *>(p.insert(before.i-reinterpret_cast<Node *>(p.begin())));
13431 node_construct(n,t); return n; }
13432 template <typename T>
13433 inline typename QList<T>::iterator QList<T>::erase(iterator it)
13434 { node_destruct(it.i);
13435 return reinterpret_cast<Node *>(p.erase(reinterpret_cast<void**>(it.i))); }
13436 template <typename T>
13437 inline const T &QList<T>::at(int i) const
13438 { qt_noop();
13439 return reinterpret_cast<Node *>(p.at(i))->t(); }
13440 template <typename T>
13441 inline const T &QList<T>::operator[](int i) const
13442 { qt_noop();
13443 return reinterpret_cast<Node *>(p.at(i))->t(); }
13444 template <typename T>
13445 inline T &QList<T>::operator[](int i)
13446 { qt_noop();
13447 detach(); return reinterpret_cast<Node *>(p.at(i))->t(); }
13448 template <typename T>
13449 inline void QList<T>::removeAt(int i)
13450 { if(i >= 0 && i < p.size()) { detach();
13451 node_destruct(reinterpret_cast<Node *>(p.at(i))); p.remove(i); } }
13452 template <typename T>
13453 inline T QList<T>::takeAt(int i)
13454 { qt_noop();
13455 detach(); Node *n = reinterpret_cast<Node *>(p.at(i)); T t = n->t(); node_destruct(n);
13456 p.remove(i); return t; }
13457 template <typename T>
13458 inline T QList<T>::takeFirst()
13459 { T t = first(); removeFirst(); return t; }
13460 template <typename T>
13461 inline T QList<T>::takeLast()
13462 { T t = last(); removeLast(); return t; }
13463 template <typename T>
13464 void QList<T>::append(const T &t)
13465 {
13466 detach();
13467 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
13468 node_construct(reinterpret_cast<Node *>(p.append()), t);
13469 } else {
13470 const T cpy(t);
13471 node_construct(reinterpret_cast<Node *>(p.append()), cpy);
13472 }
13473 }
13474 template <typename T>
13475 inline void QList<T>::prepend(const T &t)
13476 {
13477 detach();
13478 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
13479 node_construct(reinterpret_cast<Node *>(p.prepend()), t);
13480 } else {
13481 const T cpy(t);
13482 node_construct(reinterpret_cast<Node *>(p.prepend()), cpy);
13483 }
13484 }
13485 template <typename T>
13486 inline void QList<T>::insert(int i, const T &t)
13487 {
13488 detach();
13489 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
13490 node_construct(reinterpret_cast<Node *>(p.insert(i)), t);
13491 } else {
13492 const T cpy(t);
13493 node_construct(reinterpret_cast<Node *>(p.insert(i)), cpy);
13494 }
13495 }
13496 template <typename T>
13497 inline void QList<T>::replace(int i, const T &t)
13498 {
13499 qt_noop();
13500 detach();
13501 if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
13502 reinterpret_cast<Node *>(p.at(i))->t() = t;
13503 } else {
13504 const T cpy(t);
13505 reinterpret_cast<Node *>(p.at(i))->t() = cpy;
13506 }
13507 }
13508 template <typename T>
13509 inline void QList<T>::swap(int i, int j)
13510 {
13511 qt_noop();
13512 detach();
13513 void *t = d->array[d->begin + i];
13514 d->array[d->begin + i] = d->array[d->begin + j];
13515 d->array[d->begin + j] = t;
13516 }
13517 template <typename T>
13518 inline void QList<T>::move(int from, int to)
13519 {
13520 qt_noop();
13521 detach();
13522 p.move(from, to);
13523 }
13524 template<typename T>
13525 QList<T> QList<T>::mid(int pos, int alength) const
13526 {
13527 if (alength < 0)
13528 alength = size() - pos;
13529 if (pos == 0 && alength == size())
13530 return *this;
13531 QList<T> cpy;
13532 if (pos + alength > size())
13533 alength = size() - pos;
13534 for (int i = pos; i < pos + alength; ++i)
13535 cpy += at(i);
13536 return cpy;
13537 }
13538 template<typename T>
13539 T QList<T>::value(int i) const
13540 {
13541 if (i < 0 || i >= p.size()) {
13542 return T();
13543 }
13544 return reinterpret_cast<Node *>(p.at(i))->t();
13545 }
13546 template<typename T>
13547 T QList<T>::value(int i, const T& defaultValue) const
13548 {
13549 return ((i < 0 || i >= p.size()) ? defaultValue : reinterpret_cast<Node *>(p.at(i))->t());
13550 }
13551 template <typename T>
13552 void QList<T>::detach_helper()
13553 {
13554 Node *n = reinterpret_cast<Node *>(p.begin());
13555 QListData::Data *x = p.detach2();
13556 node_copy(reinterpret_cast<Node *>(p.begin()), reinterpret_cast<Node *>(p.end()), n);
13557 if (!x->ref.deref())
13558 free(x);
13559 }
13560 template <typename T>
13561 QList<T>::~QList()
13562 {
13563 if (d && !d->ref.deref())
13564 free(d);
13565 }
13566 template <typename T>
13567 bool QList<T>::operator==(const QList<T> &l) const
13568 {
13569 if (p.size() != l.p.size())
13570 return false;
13571 if (d == l.d)
13572 return true;
13573 Node *i = reinterpret_cast<Node *>(p.end());
13574 Node *b = reinterpret_cast<Node *>(p.begin());
13575 Node *li = reinterpret_cast<Node *>(l.p.end());
13576 while (i != b) {
13577 --i; --li;
13578 if (!(i->t() == li->t()))
13579 return false;
13580 }
13581 return true;
13582 }
13583 template <typename T>
13584 void QList<T>::free(QListData::Data *data)
13585 {
13586 node_destruct(reinterpret_cast<Node *>(data->array + data->begin),
13587 reinterpret_cast<Node *>(data->array + data->end));
13588 if (data->ref == 0)
13589 qFree(data);
13590 }
13591 template <typename T>
13592 void QList<T>::clear()
13593 {
13594 *this = QList<T>();
13595 }
13596 template <typename T>
13597 int QList<T>::removeAll(const T &_t)
13598 {
13599 detach();
13600 const T t = _t;
13601 int removedCount=0, i=0;
13602 Node *n;
13603 while (i < p.size())
13604 if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) {
13605 node_destruct(n);
13606 p.remove(i);
13607 ++removedCount;
13608 } else {
13609 ++i;
13610 }
13611 return removedCount;
13612 }
13613 template <typename T>
13614 bool QList<T>::removeOne(const T &_t)
13615 {
13616 detach();
13617 int index = indexOf(_t);
13618 if (index != -1) {
13619 removeAt(index);
13620 return true;
13621 }
13622 return false;
13623 }
13624 template <typename T>
13625 typename QList<T>::iterator QList<T>::erase(typename QList<T>::iterator afirst,
13626 typename QList<T>::iterator alast)
13627 {
13628 for (Node *n = afirst.i; n < alast.i; ++n)
13629 node_destruct(n);
13630 int idx = afirst - begin();
13631 p.remove(idx, alast - afirst);
13632 return begin() + idx;
13633 }
13634 template <typename T>
13635 QList<T> &QList<T>::operator+=(const QList<T> &l)
13636 {
13637 detach();
13638 Node *n = reinterpret_cast<Node *>(p.append(l.p));
13639 node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin()));
13640 return *this;
13641 }
13642 template <typename T>
13643 inline void QList<T>::append(const QList<T> &t)
13644 {
13645 *this += t;
13646 }
13647 template <typename T>
13648 int QList<T>::indexOf(const T &t, int from) const
13649 {
13650 if (from < 0)
13651 from = qMax(from + p.size(), 0);
13652 if (from < p.size()) {
13653 Node *n = reinterpret_cast<Node *>(p.at(from -1));
13654 Node *e = reinterpret_cast<Node *>(p.end());
13655 while (++n != e)
13656 if (n->t() == t)
13657 return n - reinterpret_cast<Node *>(p.begin());
13658 }
13659 return -1;
13660 }
13661 template <typename T>
13662 int QList<T>::lastIndexOf(const T &t, int from) const
13663 {
13664 if (from < 0)
13665 from += p.size();
13666 else if (from >= p.size())
13667 from = p.size()-1;
13668 if (from >= 0) {
13669 Node *b = reinterpret_cast<Node *>(p.begin());
13670 Node *n = reinterpret_cast<Node *>(p.at(from + 1));
13671 while (n-- != b) {
13672 if (n->t() == t)
13673 return n - b;
13674 }
13675 }
13676 return -1;
13677 }
13678 template <typename T>
13679 QBool QList<T>::contains(const T &t) const
13680 {
13681 Node *b = reinterpret_cast<Node *>(p.begin());
13682 Node *i = reinterpret_cast<Node *>(p.end());
13683 while (i-- != b)
13684 if (i->t() == t)
13685 return QBool(true);
13686 return QBool(false);
13687 }
13688 template <typename T>
13689 int QList<T>::count(const T &t) const
13690 {
13691 int c = 0;
13692 Node *b = reinterpret_cast<Node *>(p.begin());
13693 Node *i = reinterpret_cast<Node *>(p.end());
13694 while (i-- != b)
13695 if (i->t() == t)
13696 ++c;
13697 return c;
13698 }
13699 template <class T> class QListIterator { typedef typename QList<T>::const_iterator const_iterator; QList<T> c; const_iterator i; public: inline QListIterator(const QList<T> &container) : c(container), i(c.constBegin()) {} inline QListIterator &operator=(const QList<T> &container) { c = container; i = c.constBegin(); return *this; } inline void toFront() { i = c.constBegin(); } inline void toBack() { i = c.constEnd(); } inline bool hasNext() const { return i != c.constEnd(); } inline const T &next() { return *i++; } inline const T &peekNext() const { return *i; } inline bool hasPrevious() const { return i != c.constBegin(); } inline const T &previous() { return *--i; } inline const T &peekPrevious() const { const_iterator p = i; return *--p; } inline bool findNext(const T &t) { while (i != c.constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (i != c.constBegin()) if (*(--i) == t) return true; return false; } };
13700 template <class T> class QMutableListIterator { typedef typename QList<T>::iterator iterator; typedef typename QList<T>::const_iterator const_iterator; QList<T> *c; iterator i, n; inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } public: inline QMutableListIterator(QList<T> &container) : c(&container) { c->setSharable(false); i = c->begin(); n = c->end(); } inline ~QMutableListIterator() { c->setSharable(true); } inline QMutableListIterator &operator=(QList<T> &container) { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } inline void toFront() { i = c->begin(); n = c->end(); } inline void toBack() { i = c->end(); n = i; } inline bool hasNext() const { return c->constEnd() != const_iterator(i); } inline T &next() { n = i++; return *n; } inline T &peekNext() const { return *i; } inline bool hasPrevious() const { return c->constBegin() != const_iterator(i); } inline T &previous() { n = --i; return *n; } inline T &peekPrevious() const { iterator p = i; return *--p; } inline void remove() { if (c->constEnd() != const_iterator(n)) { i = c->erase(n); n = c->end(); } } inline void setValue(const T &t) const { if (c->constEnd() != const_iterator(n)) *n = t; } inline T &value() { qt_noop(); return *n; } inline const T &value() const { qt_noop(); return *n; } inline void insert(const T &t) { n = i = c->insert(i, t); ++i; } inline bool findNext(const T &t) { while (c->constEnd() != const_iterator(n = i)) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (c->constBegin() != const_iterator(i)) if (*(n = --i) == t) return true; n = c->end(); return false; } };
13701 typedef QtValidLicenseForCoreModule QtCoreModule;
13702 namespace
13703 Qt {
13704 enum GlobalColor {
13705 color0,
13706 color1,
13707 black,
13708 white,
13709 darkGray,
13710 gray,
13711 lightGray,
13712 red,
13713 green,
13714 blue,
13715 cyan,
13716 magenta,
13717 yellow,
13718 darkRed,
13719 darkGreen,
13720 darkBlue,
13721 darkCyan,
13722 darkMagenta,
13723 darkYellow,
13724 transparent
13725 };
13726 enum KeyboardModifier {
13727 NoModifier = 0x00000000,
13728 ShiftModifier = 0x02000000,
13729 ControlModifier = 0x04000000,
13730 AltModifier = 0x08000000,
13731 MetaModifier = 0x10000000,
13732 KeypadModifier = 0x20000000,
13733 GroupSwitchModifier = 0x40000000,
13734 KeyboardModifierMask = 0xfe000000
13735 };
13736 typedef QFlags<KeyboardModifier> KeyboardModifiers;
13737 enum Modifier {
13738 META = Qt::MetaModifier,
13739 SHIFT = Qt::ShiftModifier,
13740 CTRL = Qt::ControlModifier,
13741 ALT = Qt::AltModifier,
13742 MODIFIER_MASK = KeyboardModifierMask,
13743 UNICODE_ACCEL = 0x00000000
13744 };
13745 enum MouseButton {
13746 NoButton = 0x00000000,
13747 LeftButton = 0x00000001,
13748 RightButton = 0x00000002,
13749 MidButton = 0x00000004,
13750 XButton1 = 0x00000008,
13751 XButton2 = 0x00000010,
13752 MouseButtonMask = 0x000000ff
13753 };
13754 typedef QFlags<MouseButton> MouseButtons;
13755 enum Orientation {
13756 Horizontal = 0x1,
13757 Vertical = 0x2
13758 };
13759 typedef QFlags<Orientation> Orientations;
13760 enum FocusPolicy {
13761 NoFocus = 0,
13762 TabFocus = 0x1,
13763 ClickFocus = 0x2,
13764 StrongFocus = TabFocus | ClickFocus | 0x8,
13765 WheelFocus = StrongFocus | 0x4
13766 };
13767 enum SortOrder {
13768 AscendingOrder,
13769 DescendingOrder
13770 };
13771 enum AlignmentFlag {
13772 AlignLeft = 0x0001,
13773 AlignLeading = AlignLeft,
13774 AlignRight = 0x0002,
13775 AlignTrailing = AlignRight,
13776 AlignHCenter = 0x0004,
13777 AlignJustify = 0x0008,
13778 AlignAbsolute = 0x0010,
13779 AlignHorizontal_Mask = AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute,
13780 AlignTop = 0x0020,
13781 AlignBottom = 0x0040,
13782 AlignVCenter = 0x0080,
13783 AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter,
13784 AlignCenter = AlignVCenter | AlignHCenter
13785 };
13786 typedef QFlags<AlignmentFlag> Alignment;
13787 enum TextFlag {
13788 TextSingleLine = 0x0100,
13789 TextDontClip = 0x0200,
13790 TextExpandTabs = 0x0400,
13791 TextShowMnemonic = 0x0800,
13792 TextWordWrap = 0x1000,
13793 TextWrapAnywhere = 0x2000,
13794 TextDontPrint = 0x4000,
13795 TextIncludeTrailingSpaces = 0x08000000,
13796 TextHideMnemonic = 0x8000,
13797 TextJustificationForced = 0x10000,
13798 TextForceLeftToRight = 0x20000,
13799 TextForceRightToLeft = 0x40000
13800 };
13801 enum TextElideMode {
13802 ElideLeft,
13803 ElideRight,
13804 ElideMiddle,
13805 ElideNone
13806 };
13807 enum WindowType {
13808 Widget = 0x00000000,
13809 Window = 0x00000001,
13810 Dialog = 0x00000002 | Window,
13811 Sheet = 0x00000004 | Window,
13812 Drawer = 0x00000006 | Window,
13813 Popup = 0x00000008 | Window,
13814 Tool = 0x0000000a | Window,
13815 ToolTip = 0x0000000c | Window,
13816 SplashScreen = 0x0000000e | Window,
13817 Desktop = 0x00000010 | Window,
13818 SubWindow = 0x00000012,
13819 WindowType_Mask = 0x000000ff,
13820 MSWindowsFixedSizeDialogHint = 0x00000100,
13821 MSWindowsOwnDC = 0x00000200,
13822 X11BypassWindowManagerHint = 0x00000400,
13823 FramelessWindowHint = 0x00000800,
13824 WindowTitleHint = 0x00001000,
13825 WindowSystemMenuHint = 0x00002000,
13826 WindowMinimizeButtonHint = 0x00004000,
13827 WindowMaximizeButtonHint = 0x00008000,
13828 WindowMinMaxButtonsHint = WindowMinimizeButtonHint | WindowMaximizeButtonHint,
13829 WindowContextHelpButtonHint = 0x00010000,
13830 WindowShadeButtonHint = 0x00020000,
13831 WindowStaysOnTopHint = 0x00040000,
13832 CustomizeWindowHint = 0x02000000,
13833 WindowStaysOnBottomHint = 0x04000000,
13834 WindowCloseButtonHint = 0x08000000,
13835 MacWindowToolBarButtonHint = 0x10000000,
13836 BypassGraphicsProxyWidget = 0x20000000,
13837 WindowOkButtonHint = 0x00080000,
13838 WindowCancelButtonHint = 0x00100000
13839 };
13840 typedef QFlags<WindowType> WindowFlags;
13841 enum WindowState {
13842 WindowNoState = 0x00000000,
13843 WindowMinimized = 0x00000001,
13844 WindowMaximized = 0x00000002,
13845 WindowFullScreen = 0x00000004,
13846 WindowActive = 0x00000008
13847 };
13848 typedef QFlags<WindowState> WindowStates;
13849 enum WidgetAttribute {
13850 WA_Disabled = 0,
13851 WA_UnderMouse = 1,
13852 WA_MouseTracking = 2,
13853 WA_ContentsPropagated = 3,
13854 WA_OpaquePaintEvent = 4,
13855 WA_NoBackground = WA_OpaquePaintEvent,
13856 WA_StaticContents = 5,
13857 WA_LaidOut = 7,
13858 WA_PaintOnScreen = 8,
13859 WA_NoSystemBackground = 9,
13860 WA_UpdatesDisabled = 10,
13861 WA_Mapped = 11,
13862 WA_MacNoClickThrough = 12,
13863 WA_PaintOutsidePaintEvent = 13,
13864 WA_InputMethodEnabled = 14,
13865 WA_WState_Visible = 15,
13866 WA_WState_Hidden = 16,
13867 WA_ForceDisabled = 32,
13868 WA_KeyCompression = 33,
13869 WA_PendingMoveEvent = 34,
13870 WA_PendingResizeEvent = 35,
13871 WA_SetPalette = 36,
13872 WA_SetFont = 37,
13873 WA_SetCursor = 38,
13874 WA_NoChildEventsFromChildren = 39,
13875 WA_WindowModified = 41,
13876 WA_Resized = 42,
13877 WA_Moved = 43,
13878 WA_PendingUpdate = 44,
13879 WA_InvalidSize = 45,
13880 WA_MacBrushedMetal = 46,
13881 WA_MacMetalStyle = WA_MacBrushedMetal,
13882 WA_CustomWhatsThis = 47,
13883 WA_LayoutOnEntireRect = 48,
13884 WA_OutsideWSRange = 49,
13885 WA_GrabbedShortcut = 50,
13886 WA_TransparentForMouseEvents = 51,
13887 WA_PaintUnclipped = 52,
13888 WA_SetWindowIcon = 53,
13889 WA_NoMouseReplay = 54,
13890 WA_DeleteOnClose = 55,
13891 WA_RightToLeft = 56,
13892 WA_SetLayoutDirection = 57,
13893 WA_NoChildEventsForParent = 58,
13894 WA_ForceUpdatesDisabled = 59,
13895 WA_WState_Created = 60,
13896 WA_WState_CompressKeys = 61,
13897 WA_WState_InPaintEvent = 62,
13898 WA_WState_Reparented = 63,
13899 WA_WState_ConfigPending = 64,
13900 WA_WState_Polished = 66,
13901 WA_WState_DND = 67,
13902 WA_WState_OwnSizePolicy = 68,
13903 WA_WState_ExplicitShowHide = 69,
13904 WA_ShowModal = 70,
13905 WA_MouseNoMask = 71,
13906 WA_GroupLeader = 72,
13907 WA_NoMousePropagation = 73,
13908 WA_Hover = 74,
13909 WA_InputMethodTransparent = 75,
13910 WA_QuitOnClose = 76,
13911 WA_KeyboardFocusChange = 77,
13912 WA_AcceptDrops = 78,
13913 WA_DropSiteRegistered = 79,
13914 WA_ForceAcceptDrops = WA_DropSiteRegistered,
13915 WA_WindowPropagation = 80,
13916 WA_NoX11EventCompression = 81,
13917 WA_TintedBackground = 82,
13918 WA_X11OpenGLOverlay = 83,
13919 WA_AlwaysShowToolTips = 84,
13920 WA_MacOpaqueSizeGrip = 85,
13921 WA_SetStyle = 86,
13922 WA_SetLocale = 87,
13923 WA_MacShowFocusRect = 88,
13924 WA_MacNormalSize = 89,
13925 WA_MacSmallSize = 90,
13926 WA_MacMiniSize = 91,
13927 WA_LayoutUsesWidgetRect = 92,
13928 WA_StyledBackground = 93,
13929 WA_MSWindowsUseDirect3D = 94,
13930 WA_CanHostQMdiSubWindowTitleBar = 95,
13931 WA_MacAlwaysShowToolWindow = 96,
13932 WA_StyleSheet = 97,
13933 WA_ShowWithoutActivating = 98,
13934 WA_X11BypassTransientForHint = 99,
13935 WA_NativeWindow = 100,
13936 WA_DontCreateNativeAncestors = 101,
13937 WA_MacVariableSize = 102,
13938 WA_DontShowOnScreen = 103,
13939 WA_X11NetWmWindowTypeDesktop = 104,
13940 WA_X11NetWmWindowTypeDock = 105,
13941 WA_X11NetWmWindowTypeToolBar = 106,
13942 WA_X11NetWmWindowTypeMenu = 107,
13943 WA_X11NetWmWindowTypeUtility = 108,
13944 WA_X11NetWmWindowTypeSplash = 109,
13945 WA_X11NetWmWindowTypeDialog = 110,
13946 WA_X11NetWmWindowTypeDropDownMenu = 111,
13947 WA_X11NetWmWindowTypePopupMenu = 112,
13948 WA_X11NetWmWindowTypeToolTip = 113,
13949 WA_X11NetWmWindowTypeNotification = 114,
13950 WA_X11NetWmWindowTypeCombo = 115,
13951 WA_X11NetWmWindowTypeDND = 116,
13952 WA_MacFrameworkScaled = 117,
13953 WA_SetWindowModality = 118,
13954 WA_WState_WindowOpacitySet = 119,
13955 WA_TranslucentBackground = 120,
13956 WA_AttributeCount
13957 };
13958 enum ApplicationAttribute
13959 {
13960 AA_ImmediateWidgetCreation = 0,
13961 AA_MSWindowsUseDirect3DByDefault = 1,
13962 AA_DontShowIconsInMenus = 2,
13963 AA_NativeWindows = 3,
13964 AA_DontCreateNativeWidgetSiblings = 4,
13965 AA_MacPluginApplication = 5,
13966 AA_AttributeCount
13967 };
13968 enum ImageConversionFlag {
13969 ColorMode_Mask = 0x00000003,
13970 AutoColor = 0x00000000,
13971 ColorOnly = 0x00000003,
13972 MonoOnly = 0x00000002,
13973 AlphaDither_Mask = 0x0000000c,
13974 ThresholdAlphaDither = 0x00000000,
13975 OrderedAlphaDither = 0x00000004,
13976 DiffuseAlphaDither = 0x00000008,
13977 NoAlpha = 0x0000000c,
13978 Dither_Mask = 0x00000030,
13979 DiffuseDither = 0x00000000,
13980 OrderedDither = 0x00000010,
13981 ThresholdDither = 0x00000020,
13982 DitherMode_Mask = 0x000000c0,
13983 AutoDither = 0x00000000,
13984 PreferDither = 0x00000040,
13985 AvoidDither = 0x00000080,
13986 NoOpaqueDetection = 0x00000100
13987 };
13988 typedef QFlags<ImageConversionFlag> ImageConversionFlags;
13989 enum BGMode {
13990 TransparentMode,
13991 OpaqueMode
13992 };
13993 enum Key {
13994 Key_Escape = 0x01000000,
13995 Key_Tab = 0x01000001,
13996 Key_Backtab = 0x01000002,
13997 Key_Backspace = 0x01000003,
13998 Key_Return = 0x01000004,
13999 Key_Enter = 0x01000005,
14000 Key_Insert = 0x01000006,
14001 Key_Delete = 0x01000007,
14002 Key_Pause = 0x01000008,
14003 Key_Print = 0x01000009,
14004 Key_SysReq = 0x0100000a,
14005 Key_Clear = 0x0100000b,
14006 Key_Home = 0x01000010,
14007 Key_End = 0x01000011,
14008 Key_Left = 0x01000012,
14009 Key_Up = 0x01000013,
14010 Key_Right = 0x01000014,
14011 Key_Down = 0x01000015,
14012 Key_PageUp = 0x01000016,
14013 Key_PageDown = 0x01000017,
14014 Key_Shift = 0x01000020,
14015 Key_Control = 0x01000021,
14016 Key_Meta = 0x01000022,
14017 Key_Alt = 0x01000023,
14018 Key_CapsLock = 0x01000024,
14019 Key_NumLock = 0x01000025,
14020 Key_ScrollLock = 0x01000026,
14021 Key_F1 = 0x01000030,
14022 Key_F2 = 0x01000031,
14023 Key_F3 = 0x01000032,
14024 Key_F4 = 0x01000033,
14025 Key_F5 = 0x01000034,
14026 Key_F6 = 0x01000035,
14027 Key_F7 = 0x01000036,
14028 Key_F8 = 0x01000037,
14029 Key_F9 = 0x01000038,
14030 Key_F10 = 0x01000039,
14031 Key_F11 = 0x0100003a,
14032 Key_F12 = 0x0100003b,
14033 Key_F13 = 0x0100003c,
14034 Key_F14 = 0x0100003d,
14035 Key_F15 = 0x0100003e,
14036 Key_F16 = 0x0100003f,
14037 Key_F17 = 0x01000040,
14038 Key_F18 = 0x01000041,
14039 Key_F19 = 0x01000042,
14040 Key_F20 = 0x01000043,
14041 Key_F21 = 0x01000044,
14042 Key_F22 = 0x01000045,
14043 Key_F23 = 0x01000046,
14044 Key_F24 = 0x01000047,
14045 Key_F25 = 0x01000048,
14046 Key_F26 = 0x01000049,
14047 Key_F27 = 0x0100004a,
14048 Key_F28 = 0x0100004b,
14049 Key_F29 = 0x0100004c,
14050 Key_F30 = 0x0100004d,
14051 Key_F31 = 0x0100004e,
14052 Key_F32 = 0x0100004f,
14053 Key_F33 = 0x01000050,
14054 Key_F34 = 0x01000051,
14055 Key_F35 = 0x01000052,
14056 Key_Super_L = 0x01000053,
14057 Key_Super_R = 0x01000054,
14058 Key_Menu = 0x01000055,
14059 Key_Hyper_L = 0x01000056,
14060 Key_Hyper_R = 0x01000057,
14061 Key_Help = 0x01000058,
14062 Key_Direction_L = 0x01000059,
14063 Key_Direction_R = 0x01000060,
14064 Key_Space = 0x20,
14065 Key_Any = Key_Space,
14066 Key_Exclam = 0x21,
14067 Key_QuoteDbl = 0x22,
14068 Key_NumberSign = 0x23,
14069 Key_Dollar = 0x24,
14070 Key_Percent = 0x25,
14071 Key_Ampersand = 0x26,
14072 Key_Apostrophe = 0x27,
14073 Key_ParenLeft = 0x28,
14074 Key_ParenRight = 0x29,
14075 Key_Asterisk = 0x2a,
14076 Key_Plus = 0x2b,
14077 Key_Comma = 0x2c,
14078 Key_Minus = 0x2d,
14079 Key_Period = 0x2e,
14080 Key_Slash = 0x2f,
14081 Key_0 = 0x30,
14082 Key_1 = 0x31,
14083 Key_2 = 0x32,
14084 Key_3 = 0x33,
14085 Key_4 = 0x34,
14086 Key_5 = 0x35,
14087 Key_6 = 0x36,
14088 Key_7 = 0x37,
14089 Key_8 = 0x38,
14090 Key_9 = 0x39,
14091 Key_Colon = 0x3a,
14092 Key_Semicolon = 0x3b,
14093 Key_Less = 0x3c,
14094 Key_Equal = 0x3d,
14095 Key_Greater = 0x3e,
14096 Key_Question = 0x3f,
14097 Key_At = 0x40,
14098 Key_A = 0x41,
14099 Key_B = 0x42,
14100 Key_C = 0x43,
14101 Key_D = 0x44,
14102 Key_E = 0x45,
14103 Key_F = 0x46,
14104 Key_G = 0x47,
14105 Key_H = 0x48,
14106 Key_I = 0x49,
14107 Key_J = 0x4a,
14108 Key_K = 0x4b,
14109 Key_L = 0x4c,
14110 Key_M = 0x4d,
14111 Key_N = 0x4e,
14112 Key_O = 0x4f,
14113 Key_P = 0x50,
14114 Key_Q = 0x51,
14115 Key_R = 0x52,
14116 Key_S = 0x53,
14117 Key_T = 0x54,
14118 Key_U = 0x55,
14119 Key_V = 0x56,
14120 Key_W = 0x57,
14121 Key_X = 0x58,
14122 Key_Y = 0x59,
14123 Key_Z = 0x5a,
14124 Key_BracketLeft = 0x5b,
14125 Key_Backslash = 0x5c,
14126 Key_BracketRight = 0x5d,
14127 Key_AsciiCircum = 0x5e,
14128 Key_Underscore = 0x5f,
14129 Key_QuoteLeft = 0x60,
14130 Key_BraceLeft = 0x7b,
14131 Key_Bar = 0x7c,
14132 Key_BraceRight = 0x7d,
14133 Key_AsciiTilde = 0x7e,
14134 Key_nobreakspace = 0x0a0,
14135 Key_exclamdown = 0x0a1,
14136 Key_cent = 0x0a2,
14137 Key_sterling = 0x0a3,
14138 Key_currency = 0x0a4,
14139 Key_yen = 0x0a5,
14140 Key_brokenbar = 0x0a6,
14141 Key_section = 0x0a7,
14142 Key_diaeresis = 0x0a8,
14143 Key_copyright = 0x0a9,
14144 Key_ordfeminine = 0x0aa,
14145 Key_guillemotleft = 0x0ab,
14146 Key_notsign = 0x0ac,
14147 Key_hyphen = 0x0ad,
14148 Key_registered = 0x0ae,
14149 Key_macron = 0x0af,
14150 Key_degree = 0x0b0,
14151 Key_plusminus = 0x0b1,
14152 Key_twosuperior = 0x0b2,
14153 Key_threesuperior = 0x0b3,
14154 Key_acute = 0x0b4,
14155 Key_mu = 0x0b5,
14156 Key_paragraph = 0x0b6,
14157 Key_periodcentered = 0x0b7,
14158 Key_cedilla = 0x0b8,
14159 Key_onesuperior = 0x0b9,
14160 Key_masculine = 0x0ba,
14161 Key_guillemotright = 0x0bb,
14162 Key_onequarter = 0x0bc,
14163 Key_onehalf = 0x0bd,
14164 Key_threequarters = 0x0be,
14165 Key_questiondown = 0x0bf,
14166 Key_Agrave = 0x0c0,
14167 Key_Aacute = 0x0c1,
14168 Key_Acircumflex = 0x0c2,
14169 Key_Atilde = 0x0c3,
14170 Key_Adiaeresis = 0x0c4,
14171 Key_Aring = 0x0c5,
14172 Key_AE = 0x0c6,
14173 Key_Ccedilla = 0x0c7,
14174 Key_Egrave = 0x0c8,
14175 Key_Eacute = 0x0c9,
14176 Key_Ecircumflex = 0x0ca,
14177 Key_Ediaeresis = 0x0cb,
14178 Key_Igrave = 0x0cc,
14179 Key_Iacute = 0x0cd,
14180 Key_Icircumflex = 0x0ce,
14181 Key_Idiaeresis = 0x0cf,
14182 Key_ETH = 0x0d0,
14183 Key_Ntilde = 0x0d1,
14184 Key_Ograve = 0x0d2,
14185 Key_Oacute = 0x0d3,
14186 Key_Ocircumflex = 0x0d4,
14187 Key_Otilde = 0x0d5,
14188 Key_Odiaeresis = 0x0d6,
14189 Key_multiply = 0x0d7,
14190 Key_Ooblique = 0x0d8,
14191 Key_Ugrave = 0x0d9,
14192 Key_Uacute = 0x0da,
14193 Key_Ucircumflex = 0x0db,
14194 Key_Udiaeresis = 0x0dc,
14195 Key_Yacute = 0x0dd,
14196 Key_THORN = 0x0de,
14197 Key_ssharp = 0x0df,
14198 Key_division = 0x0f7,
14199 Key_ydiaeresis = 0x0ff,
14200 Key_AltGr = 0x01001103,
14201 Key_Multi_key = 0x01001120,
14202 Key_Codeinput = 0x01001137,
14203 Key_SingleCandidate = 0x0100113c,
14204 Key_MultipleCandidate = 0x0100113d,
14205 Key_PreviousCandidate = 0x0100113e,
14206 Key_Mode_switch = 0x0100117e,
14207 Key_Kanji = 0x01001121,
14208 Key_Muhenkan = 0x01001122,
14209 Key_Henkan = 0x01001123,
14210 Key_Romaji = 0x01001124,
14211 Key_Hiragana = 0x01001125,
14212 Key_Katakana = 0x01001126,
14213 Key_Hiragana_Katakana = 0x01001127,
14214 Key_Zenkaku = 0x01001128,
14215 Key_Hankaku = 0x01001129,
14216 Key_Zenkaku_Hankaku = 0x0100112a,
14217 Key_Touroku = 0x0100112b,
14218 Key_Massyo = 0x0100112c,
14219 Key_Kana_Lock = 0x0100112d,
14220 Key_Kana_Shift = 0x0100112e,
14221 Key_Eisu_Shift = 0x0100112f,
14222 Key_Eisu_toggle = 0x01001130,
14223 Key_Hangul = 0x01001131,
14224 Key_Hangul_Start = 0x01001132,
14225 Key_Hangul_End = 0x01001133,
14226 Key_Hangul_Hanja = 0x01001134,
14227 Key_Hangul_Jamo = 0x01001135,
14228 Key_Hangul_Romaja = 0x01001136,
14229 Key_Hangul_Jeonja = 0x01001138,
14230 Key_Hangul_Banja = 0x01001139,
14231 Key_Hangul_PreHanja = 0x0100113a,
14232 Key_Hangul_PostHanja = 0x0100113b,
14233 Key_Hangul_Special = 0x0100113f,
14234 Key_Dead_Grave = 0x01001250,
14235 Key_Dead_Acute = 0x01001251,
14236 Key_Dead_Circumflex = 0x01001252,
14237 Key_Dead_Tilde = 0x01001253,
14238 Key_Dead_Macron = 0x01001254,
14239 Key_Dead_Breve = 0x01001255,
14240 Key_Dead_Abovedot = 0x01001256,
14241 Key_Dead_Diaeresis = 0x01001257,
14242 Key_Dead_Abovering = 0x01001258,
14243 Key_Dead_Doubleacute = 0x01001259,
14244 Key_Dead_Caron = 0x0100125a,
14245 Key_Dead_Cedilla = 0x0100125b,
14246 Key_Dead_Ogonek = 0x0100125c,
14247 Key_Dead_Iota = 0x0100125d,
14248 Key_Dead_Voiced_Sound = 0x0100125e,
14249 Key_Dead_Semivoiced_Sound = 0x0100125f,
14250 Key_Dead_Belowdot = 0x01001260,
14251 Key_Dead_Hook = 0x01001261,
14252 Key_Dead_Horn = 0x01001262,
14253 Key_Back = 0x01000061,
14254 Key_Forward = 0x01000062,
14255 Key_Stop = 0x01000063,
14256 Key_Refresh = 0x01000064,
14257 Key_VolumeDown = 0x01000070,
14258 Key_VolumeMute = 0x01000071,
14259 Key_VolumeUp = 0x01000072,
14260 Key_BassBoost = 0x01000073,
14261 Key_BassUp = 0x01000074,
14262 Key_BassDown = 0x01000075,
14263 Key_TrebleUp = 0x01000076,
14264 Key_TrebleDown = 0x01000077,
14265 Key_MediaPlay = 0x01000080,
14266 Key_MediaStop = 0x01000081,
14267 Key_MediaPrevious = 0x01000082,
14268 Key_MediaNext = 0x01000083,
14269 Key_MediaRecord = 0x01000084,
14270 Key_HomePage = 0x01000090,
14271 Key_Favorites = 0x01000091,
14272 Key_Search = 0x01000092,
14273 Key_Standby = 0x01000093,
14274 Key_OpenUrl = 0x01000094,
14275 Key_LaunchMail = 0x010000a0,
14276 Key_LaunchMedia = 0x010000a1,
14277 Key_Launch0 = 0x010000a2,
14278 Key_Launch1 = 0x010000a3,
14279 Key_Launch2 = 0x010000a4,
14280 Key_Launch3 = 0x010000a5,
14281 Key_Launch4 = 0x010000a6,
14282 Key_Launch5 = 0x010000a7,
14283 Key_Launch6 = 0x010000a8,
14284 Key_Launch7 = 0x010000a9,
14285 Key_Launch8 = 0x010000aa,
14286 Key_Launch9 = 0x010000ab,
14287 Key_LaunchA = 0x010000ac,
14288 Key_LaunchB = 0x010000ad,
14289 Key_LaunchC = 0x010000ae,
14290 Key_LaunchD = 0x010000af,
14291 Key_LaunchE = 0x010000b0,
14292 Key_LaunchF = 0x010000b1,
14293 Key_MediaLast = 0x0100ffff,
14294 Key_Select = 0x01010000,
14295 Key_Yes = 0x01010001,
14296 Key_No = 0x01010002,
14297 Key_Cancel = 0x01020001,
14298 Key_Printer = 0x01020002,
14299 Key_Execute = 0x01020003,
14300 Key_Sleep = 0x01020004,
14301 Key_Play = 0x01020005,
14302 Key_Zoom = 0x01020006,
14303 Key_Context1 = 0x01100000,
14304 Key_Context2 = 0x01100001,
14305 Key_Context3 = 0x01100002,
14306 Key_Context4 = 0x01100003,
14307 Key_Call = 0x01100004,
14308 Key_Hangup = 0x01100005,
14309 Key_Flip = 0x01100006,
14310 Key_unknown = 0x01ffffff
14311 };
14312 enum ArrowType {
14313 NoArrow,
14314 UpArrow,
14315 DownArrow,
14316 LeftArrow,
14317 RightArrow
14318 };
14319 enum PenStyle {
14320 NoPen,
14321 SolidLine,
14322 DashLine,
14323 DotLine,
14324 DashDotLine,
14325 DashDotDotLine,
14326 CustomDashLine
14327 , MPenStyle = 0x0f
14328 };
14329 enum PenCapStyle {
14330 FlatCap = 0x00,
14331 SquareCap = 0x10,
14332 RoundCap = 0x20,
14333 MPenCapStyle = 0x30
14334 };
14335 enum PenJoinStyle {
14336 MiterJoin = 0x00,
14337 BevelJoin = 0x40,
14338 RoundJoin = 0x80,
14339 SvgMiterJoin = 0x100,
14340 MPenJoinStyle = 0x1c0
14341 };
14342 enum BrushStyle {
14343 NoBrush,
14344 SolidPattern,
14345 Dense1Pattern,
14346 Dense2Pattern,
14347 Dense3Pattern,
14348 Dense4Pattern,
14349 Dense5Pattern,
14350 Dense6Pattern,
14351 Dense7Pattern,
14352 HorPattern,
14353 VerPattern,
14354 CrossPattern,
14355 BDiagPattern,
14356 FDiagPattern,
14357 DiagCrossPattern,
14358 LinearGradientPattern,
14359 RadialGradientPattern,
14360 ConicalGradientPattern,
14361 TexturePattern = 24
14362 };
14363 enum SizeMode {
14364 AbsoluteSize,
14365 RelativeSize
14366 };
14367 enum UIEffect {
14368 UI_General,
14369 UI_AnimateMenu,
14370 UI_FadeMenu,
14371 UI_AnimateCombo,
14372 UI_AnimateTooltip,
14373 UI_FadeTooltip,
14374 UI_AnimateToolBox
14375 };
14376 enum CursorShape {
14377 ArrowCursor,
14378 UpArrowCursor,
14379 CrossCursor,
14380 WaitCursor,
14381 IBeamCursor,
14382 SizeVerCursor,
14383 SizeHorCursor,
14384 SizeBDiagCursor,
14385 SizeFDiagCursor,
14386 SizeAllCursor,
14387 BlankCursor,
14388 SplitVCursor,
14389 SplitHCursor,
14390 PointingHandCursor,
14391 ForbiddenCursor,
14392 WhatsThisCursor,
14393 BusyCursor,
14394 OpenHandCursor,
14395 ClosedHandCursor,
14396 LastCursor = ClosedHandCursor,
14397 BitmapCursor = 24,
14398 CustomCursor = 25
14399 };
14400 enum TextFormat {
14401 PlainText,
14402 RichText,
14403 AutoText,
14404 LogText
14405 };
14406 enum AspectRatioMode {
14407 IgnoreAspectRatio,
14408 KeepAspectRatio,
14409 KeepAspectRatioByExpanding
14410 };
14411 enum AnchorAttribute {
14412 AnchorName,
14413 AnchorHref
14414 };
14415 enum DockWidgetArea {
14416 LeftDockWidgetArea = 0x1,
14417 RightDockWidgetArea = 0x2,
14418 TopDockWidgetArea = 0x4,
14419 BottomDockWidgetArea = 0x8,
14420 DockWidgetArea_Mask = 0xf,
14421 AllDockWidgetAreas = DockWidgetArea_Mask,
14422 NoDockWidgetArea = 0
14423 };
14424 enum DockWidgetAreaSizes {
14425 NDockWidgetAreas = 4
14426 };
14427 typedef QFlags<DockWidgetArea> DockWidgetAreas;
14428 enum ToolBarArea {
14429 LeftToolBarArea = 0x1,
14430 RightToolBarArea = 0x2,
14431 TopToolBarArea = 0x4,
14432 BottomToolBarArea = 0x8,
14433 ToolBarArea_Mask = 0xf,
14434 AllToolBarAreas = ToolBarArea_Mask,
14435 NoToolBarArea = 0
14436 };
14437 enum ToolBarAreaSizes {
14438 NToolBarAreas = 4
14439 };
14440 typedef QFlags<ToolBarArea> ToolBarAreas;
14441 enum DateFormat {
14442 TextDate,
14443 ISODate,
14444 SystemLocaleDate,
14445 LocalDate = SystemLocaleDate,
14446 LocaleDate,
14447 SystemLocaleShortDate,
14448 SystemLocaleLongDate,
14449 DefaultLocaleShortDate,
14450 DefaultLocaleLongDate
14451 };
14452 enum TimeSpec {
14453 LocalTime,
14454 UTC,
14455 OffsetFromUTC
14456 };
14457 enum DayOfWeek {
14458 Monday = 1,
14459 Tuesday = 2,
14460 Wednesday = 3,
14461 Thursday = 4,
14462 Friday = 5,
14463 Saturday = 6,
14464 Sunday = 7
14465 };
14466 enum ScrollBarPolicy {
14467 ScrollBarAsNeeded,
14468 ScrollBarAlwaysOff,
14469 ScrollBarAlwaysOn
14470 };
14471 enum CaseSensitivity {
14472 CaseInsensitive,
14473 CaseSensitive
14474 };
14475 enum Corner {
14476 TopLeftCorner = 0x00000,
14477 TopRightCorner = 0x00001,
14478 BottomLeftCorner = 0x00002,
14479 BottomRightCorner = 0x00003
14480 };
14481 enum ConnectionType {
14482 AutoConnection,
14483 DirectConnection,
14484 QueuedConnection,
14485 AutoCompatConnection,
14486 BlockingQueuedConnection
14487 };
14488 enum ShortcutContext {
14489 WidgetShortcut,
14490 WindowShortcut,
14491 ApplicationShortcut,
14492 WidgetWithChildrenShortcut
14493 };
14494 enum FillRule {
14495 OddEvenFill,
14496 WindingFill
14497 };
14498 enum MaskMode {
14499 MaskInColor,
14500 MaskOutColor
14501 };
14502 enum ClipOperation {
14503 NoClip,
14504 ReplaceClip,
14505 IntersectClip,
14506 UniteClip
14507 };
14508 enum ItemSelectionMode {
14509 ContainsItemShape = 0x0,
14510 IntersectsItemShape = 0x1,
14511 ContainsItemBoundingRect = 0x2,
14512 IntersectsItemBoundingRect = 0x3
14513 };
14514 enum TransformationMode {
14515 FastTransformation,
14516 SmoothTransformation
14517 };
14518 enum Axis {
14519 XAxis,
14520 YAxis,
14521 ZAxis
14522 };
14523 enum FocusReason {
14524 MouseFocusReason,
14525 TabFocusReason,
14526 BacktabFocusReason,
14527 ActiveWindowFocusReason,
14528 PopupFocusReason,
14529 ShortcutFocusReason,
14530 MenuBarFocusReason,
14531 OtherFocusReason,
14532 NoFocusReason
14533 };
14534 enum ContextMenuPolicy {
14535 NoContextMenu,
14536 DefaultContextMenu,
14537 ActionsContextMenu,
14538 CustomContextMenu,
14539 PreventContextMenu
14540 };
14541 enum InputMethodQuery {
14542 ImMicroFocus,
14543 ImFont,
14544 ImCursorPosition,
14545 ImSurroundingText,
14546 ImCurrentSelection
14547 };
14548 enum ToolButtonStyle {
14549 ToolButtonIconOnly,
14550 ToolButtonTextOnly,
14551 ToolButtonTextBesideIcon,
14552 ToolButtonTextUnderIcon
14553 };
14554 enum LayoutDirection {
14555 LeftToRight,
14556 RightToLeft
14557 };
14558 enum DropAction {
14559 CopyAction = 0x1,
14560 MoveAction = 0x2,
14561 LinkAction = 0x4,
14562 ActionMask = 0xff,
14563 TargetMoveAction = 0x8002,
14564 IgnoreAction = 0x0
14565 };
14566 typedef QFlags<DropAction> DropActions;
14567 enum CheckState {
14568 Unchecked,
14569 PartiallyChecked,
14570 Checked
14571 };
14572 enum ItemDataRole {
14573 DisplayRole = 0,
14574 DecorationRole = 1,
14575 EditRole = 2,
14576 ToolTipRole = 3,
14577 StatusTipRole = 4,
14578 WhatsThisRole = 5,
14579 FontRole = 6,
14580 TextAlignmentRole = 7,
14581 BackgroundColorRole = 8,
14582 BackgroundRole = 8,
14583 TextColorRole = 9,
14584 ForegroundRole = 9,
14585 CheckStateRole = 10,
14586 AccessibleTextRole = 11,
14587 AccessibleDescriptionRole = 12,
14588 SizeHintRole = 13,
14589 DisplayPropertyRole = 27,
14590 DecorationPropertyRole = 28,
14591 ToolTipPropertyRole = 29,
14592 StatusTipPropertyRole = 30,
14593 WhatsThisPropertyRole = 31,
14594 UserRole = 32
14595 };
14596 enum ItemFlag {
14597 NoItemFlags = 0,
14598 ItemIsSelectable = 1,
14599 ItemIsEditable = 2,
14600 ItemIsDragEnabled = 4,
14601 ItemIsDropEnabled = 8,
14602 ItemIsUserCheckable = 16,
14603 ItemIsEnabled = 32,
14604 ItemIsTristate = 64
14605 };
14606 typedef QFlags<ItemFlag> ItemFlags;
14607 enum MatchFlag {
14608 MatchExactly = 0,
14609 MatchContains = 1,
14610 MatchStartsWith = 2,
14611 MatchEndsWith = 3,
14612 MatchRegExp = 4,
14613 MatchWildcard = 5,
14614 MatchFixedString = 8,
14615 MatchCaseSensitive = 16,
14616 MatchWrap = 32,
14617 MatchRecursive = 64
14618 };
14619 typedef QFlags<MatchFlag> MatchFlags;
14620 typedef void * HANDLE;
14621 typedef WindowFlags WFlags;
14622 enum WindowModality {
14623 NonModal,
14624 WindowModal,
14625 ApplicationModal
14626 };
14627 enum TextInteractionFlag {
14628 NoTextInteraction = 0,
14629 TextSelectableByMouse = 1,
14630 TextSelectableByKeyboard = 2,
14631 LinksAccessibleByMouse = 4,
14632 LinksAccessibleByKeyboard = 8,
14633 TextEditable = 16,
14634 TextEditorInteraction = TextSelectableByMouse | TextSelectableByKeyboard | TextEditable,
14635 TextBrowserInteraction = TextSelectableByMouse | LinksAccessibleByMouse | LinksAccessibleByKeyboard
14636 };
14637 typedef QFlags<TextInteractionFlag> TextInteractionFlags;
14638 enum EventPriority {
14639 HighEventPriority = 1,
14640 NormalEventPriority = 0,
14641 LowEventPriority = -1
14642 };
14643 enum SizeHint {
14644 MinimumSize,
14645 PreferredSize,
14646 MaximumSize,
14647 MinimumDescent,
14648 NSizeHints
14649 };
14650 enum WindowFrameSection {
14651 NoSection,
14652 LeftSection,
14653 TopLeftSection,
14654 TopSection,
14655 TopRightSection,
14656 RightSection,
14657 BottomRightSection,
14658 BottomSection,
14659 BottomLeftSection,
14660 TitleBarArea
14661 };
14662 }
14663 inline QFlags<Qt::MouseButtons::enum_type> operator|(Qt::MouseButtons::enum_type f1, Qt::MouseButtons::enum_type f2) { return QFlags<Qt::MouseButtons::enum_type>(f1) | f2; } inline QFlags<Qt::MouseButtons::enum_type> operator|(Qt::MouseButtons::enum_type f1, QFlags<Qt::MouseButtons::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::MouseButtons::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14664 inline QFlags<Qt::Orientations::enum_type> operator|(Qt::Orientations::enum_type f1, Qt::Orientations::enum_type f2) { return QFlags<Qt::Orientations::enum_type>(f1) | f2; } inline QFlags<Qt::Orientations::enum_type> operator|(Qt::Orientations::enum_type f1, QFlags<Qt::Orientations::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::Orientations::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14665 inline QFlags<Qt::KeyboardModifiers::enum_type> operator|(Qt::KeyboardModifiers::enum_type f1, Qt::KeyboardModifiers::enum_type f2) { return QFlags<Qt::KeyboardModifiers::enum_type>(f1) | f2; } inline QFlags<Qt::KeyboardModifiers::enum_type> operator|(Qt::KeyboardModifiers::enum_type f1, QFlags<Qt::KeyboardModifiers::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::KeyboardModifiers::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14666 inline QFlags<Qt::WindowFlags::enum_type> operator|(Qt::WindowFlags::enum_type f1, Qt::WindowFlags::enum_type f2) { return QFlags<Qt::WindowFlags::enum_type>(f1) | f2; } inline QFlags<Qt::WindowFlags::enum_type> operator|(Qt::WindowFlags::enum_type f1, QFlags<Qt::WindowFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::WindowFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14667 inline QFlags<Qt::Alignment::enum_type> operator|(Qt::Alignment::enum_type f1, Qt::Alignment::enum_type f2) { return QFlags<Qt::Alignment::enum_type>(f1) | f2; } inline QFlags<Qt::Alignment::enum_type> operator|(Qt::Alignment::enum_type f1, QFlags<Qt::Alignment::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::Alignment::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14668 inline QFlags<Qt::ImageConversionFlags::enum_type> operator|(Qt::ImageConversionFlags::enum_type f1, Qt::ImageConversionFlags::enum_type f2) { return QFlags<Qt::ImageConversionFlags::enum_type>(f1) | f2; } inline QFlags<Qt::ImageConversionFlags::enum_type> operator|(Qt::ImageConversionFlags::enum_type f1, QFlags<Qt::ImageConversionFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::ImageConversionFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14669 inline QFlags<Qt::DockWidgetAreas::enum_type> operator|(Qt::DockWidgetAreas::enum_type f1, Qt::DockWidgetAreas::enum_type f2) { return QFlags<Qt::DockWidgetAreas::enum_type>(f1) | f2; } inline QFlags<Qt::DockWidgetAreas::enum_type> operator|(Qt::DockWidgetAreas::enum_type f1, QFlags<Qt::DockWidgetAreas::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::DockWidgetAreas::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14670 inline QFlags<Qt::ToolBarAreas::enum_type> operator|(Qt::ToolBarAreas::enum_type f1, Qt::ToolBarAreas::enum_type f2) { return QFlags<Qt::ToolBarAreas::enum_type>(f1) | f2; } inline QFlags<Qt::ToolBarAreas::enum_type> operator|(Qt::ToolBarAreas::enum_type f1, QFlags<Qt::ToolBarAreas::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::ToolBarAreas::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14671 inline QFlags<Qt::WindowStates::enum_type> operator|(Qt::WindowStates::enum_type f1, Qt::WindowStates::enum_type f2) { return QFlags<Qt::WindowStates::enum_type>(f1) | f2; } inline QFlags<Qt::WindowStates::enum_type> operator|(Qt::WindowStates::enum_type f1, QFlags<Qt::WindowStates::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::WindowStates::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14672 inline QFlags<Qt::DropActions::enum_type> operator|(Qt::DropActions::enum_type f1, Qt::DropActions::enum_type f2) { return QFlags<Qt::DropActions::enum_type>(f1) | f2; } inline QFlags<Qt::DropActions::enum_type> operator|(Qt::DropActions::enum_type f1, QFlags<Qt::DropActions::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::DropActions::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14673 inline QFlags<Qt::ItemFlags::enum_type> operator|(Qt::ItemFlags::enum_type f1, Qt::ItemFlags::enum_type f2) { return QFlags<Qt::ItemFlags::enum_type>(f1) | f2; } inline QFlags<Qt::ItemFlags::enum_type> operator|(Qt::ItemFlags::enum_type f1, QFlags<Qt::ItemFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::ItemFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14674 inline QFlags<Qt::MatchFlags::enum_type> operator|(Qt::MatchFlags::enum_type f1, Qt::MatchFlags::enum_type f2) { return QFlags<Qt::MatchFlags::enum_type>(f1) | f2; } inline QFlags<Qt::MatchFlags::enum_type> operator|(Qt::MatchFlags::enum_type f1, QFlags<Qt::MatchFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::MatchFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14675 inline QFlags<Qt::TextInteractionFlags::enum_type> operator|(Qt::TextInteractionFlags::enum_type f1, Qt::TextInteractionFlags::enum_type f2) { return QFlags<Qt::TextInteractionFlags::enum_type>(f1) | f2; } inline QFlags<Qt::TextInteractionFlags::enum_type> operator|(Qt::TextInteractionFlags::enum_type f1, QFlags<Qt::TextInteractionFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(Qt::TextInteractionFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
14676 typedef bool (*qInternalCallback)(void **);
14677 class __attribute__((visibility("default"))) QInternal {
14678 public:
14679 enum PaintDeviceFlags {
14680 UnknownDevice = 0x00,
14681 Widget = 0x01,
14682 Pixmap = 0x02,
14683 Image = 0x03,
14684 Printer = 0x04,
14685 Picture = 0x05,
14686 Pbuffer = 0x06,
14687 FramebufferObject = 0x07,
14688 CustomRaster = 0x08,
14689 MacQuartz = 0x09
14690 };
14691 enum RelayoutType {
14692 RelayoutNormal,
14693 RelayoutDragging,
14694 RelayoutDropped
14695 };
14696 enum Callback {
14697 ConnectCallback,
14698 DisconnectCallback,
14699 AdoptCurrentThread,
14700 EventNotifyCallback,
14701 LastCallback
14702 };
14703 enum InternalFunction {
14704 CreateThreadForAdoption,
14705 RefAdoptedThread,
14706 DerefAdoptedThread,
14707 SetCurrentThreadToMainThread,
14708 SetQObjectSender,
14709 GetQObjectSender,
14710 ResetQObjectSender,
14711 LastInternalFunction
14712 };
14713 enum DockPosition {
14714 LeftDock,
14715 RightDock,
14716 TopDock,
14717 BottomDock,
14718 DockCount
14719 };
14720 static bool registerCallback(Callback, qInternalCallback);
14721 static bool unregisterCallback(Callback, qInternalCallback);
14722 static bool activateCallbacks(Callback, void **);
14723 static bool callFunction(InternalFunction func, void **);
14724 };
14725 typedef QtValidLicenseForCoreModule QtCoreModule;
14726 class QByteArray;
14727 class QString;
14728 template <typename T>
14729 inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; }
14730 template <typename T1, typename T2>
14731 inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
14732 __attribute__((visibility("default"))) const char *qFlagLocation(const char *method);
14733 class QObject;
14734 class QMetaMethod;
14735 class QMetaEnum;
14736 class QMetaProperty;
14737 class QMetaClassInfo;
14738 class __attribute__((visibility("default"))) QGenericArgument
14739 {
14740 public:
14741 inline QGenericArgument(const char *aName = 0, const void *aData = 0)
14742 : _data(aData), _name(aName) {}
14743 inline void *data() const { return const_cast<void *>(_data); }
14744 inline const char *name() const { return _name; }
14745 private:
14746 const void *_data;
14747 const char *_name;
14748 };
14749 class __attribute__((visibility("default"))) QGenericReturnArgument: public QGenericArgument
14750 {
14751 public:
14752 inline QGenericReturnArgument(const char *aName = 0, void *aData = 0)
14753 : QGenericArgument(aName, aData)
14754 {}
14755 };
14756 template <class T>
14757 class QArgument: public QGenericArgument
14758 {
14759 public:
14760 inline QArgument(const char *aName, const T &aData)
14761 : QGenericArgument(aName, static_cast<const void *>(&aData))
14762 {}
14763 };
14764 template <typename T>
14765 class QReturnArgument: public QGenericReturnArgument
14766 {
14767 public:
14768 inline QReturnArgument(const char *aName, T &aData)
14769 : QGenericReturnArgument(aName, static_cast<void *>(&aData))
14770 {}
14771 };
14772 struct __attribute__((visibility("default"))) QMetaObject
14773 {
14774 const char *className() const;
14775 const QMetaObject *superClass() const;
14776 QObject *cast(QObject *obj) const;
14777 QString tr(const char *s, const char *c) const;
14778 QString trUtf8(const char *s, const char *c) const;
14779 QString tr(const char *s, const char *c, int n) const;
14780 QString trUtf8(const char *s, const char *c, int n) const;
14781 int methodOffset() const;
14782 int enumeratorOffset() const;
14783 int propertyOffset() const;
14784 int classInfoOffset() const;
14785 int constructorCount() const;
14786 int methodCount() const;
14787 int enumeratorCount() const;
14788 int propertyCount() const;
14789 int classInfoCount() const;
14790 int indexOfConstructor(const char *constructor) const;
14791 int indexOfMethod(const char *method) const;
14792 int indexOfSignal(const char *signal) const;
14793 int indexOfSlot(const char *slot) const;
14794 int indexOfEnumerator(const char *name) const;
14795 int indexOfProperty(const char *name) const;
14796 int indexOfClassInfo(const char *name) const;
14797 QMetaMethod constructor(int index) const;
14798 QMetaMethod method(int index) const;
14799 QMetaEnum enumerator(int index) const;
14800 QMetaProperty property(int index) const;
14801 QMetaClassInfo classInfo(int index) const;
14802 QMetaProperty userProperty() const;
14803 static bool checkConnectArgs(const char *signal, const char *method);
14804 static QByteArray normalizedSignature(const char *method);
14805 static QByteArray normalizedType(const char *type);
14806 static bool connect(const QObject *sender, int signal_index,
14807 const QObject *receiver, int method_index,
14808 int type = 0, int *types = 0);
14809 static bool disconnect(const QObject *sender, int signal_index,
14810 const QObject *receiver, int method_index);
14811 static void connectSlotsByName(QObject *o);
14812 static void activate(QObject *sender, int signal_index, void **argv);
14813 static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv);
14814 static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv);
14815 static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv);
14816 static void addGuard(QObject **ptr);
14817 static void removeGuard(QObject **ptr);
14818 static void changeGuard(QObject **ptr, QObject *o);
14819 static bool invokeMethod(QObject *obj, const char *member,
14820 Qt::ConnectionType,
14821 QGenericReturnArgument ret,
14822 QGenericArgument val0 = QGenericArgument(0),
14823 QGenericArgument val1 = QGenericArgument(),
14824 QGenericArgument val2 = QGenericArgument(),
14825 QGenericArgument val3 = QGenericArgument(),
14826 QGenericArgument val4 = QGenericArgument(),
14827 QGenericArgument val5 = QGenericArgument(),
14828 QGenericArgument val6 = QGenericArgument(),
14829 QGenericArgument val7 = QGenericArgument(),
14830 QGenericArgument val8 = QGenericArgument(),
14831 QGenericArgument val9 = QGenericArgument());
14832 static inline bool invokeMethod(QObject *obj, const char *member,
14833 QGenericReturnArgument ret,
14834 QGenericArgument val0 = QGenericArgument(0),
14835 QGenericArgument val1 = QGenericArgument(),
14836 QGenericArgument val2 = QGenericArgument(),
14837 QGenericArgument val3 = QGenericArgument(),
14838 QGenericArgument val4 = QGenericArgument(),
14839 QGenericArgument val5 = QGenericArgument(),
14840 QGenericArgument val6 = QGenericArgument(),
14841 QGenericArgument val7 = QGenericArgument(),
14842 QGenericArgument val8 = QGenericArgument(),
14843 QGenericArgument val9 = QGenericArgument())
14844 {
14845 return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3,
14846 val4, val5, val6, val7, val8, val9);
14847 }
14848 static inline bool invokeMethod(QObject *obj, const char *member,
14849 Qt::ConnectionType type,
14850 QGenericArgument val0 = QGenericArgument(0),
14851 QGenericArgument val1 = QGenericArgument(),
14852 QGenericArgument val2 = QGenericArgument(),
14853 QGenericArgument val3 = QGenericArgument(),
14854 QGenericArgument val4 = QGenericArgument(),
14855 QGenericArgument val5 = QGenericArgument(),
14856 QGenericArgument val6 = QGenericArgument(),
14857 QGenericArgument val7 = QGenericArgument(),
14858 QGenericArgument val8 = QGenericArgument(),
14859 QGenericArgument val9 = QGenericArgument())
14860 {
14861 return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2,
14862 val3, val4, val5, val6, val7, val8, val9);
14863 }
14864 static inline bool invokeMethod(QObject *obj, const char *member,
14865 QGenericArgument val0 = QGenericArgument(0),
14866 QGenericArgument val1 = QGenericArgument(),
14867 QGenericArgument val2 = QGenericArgument(),
14868 QGenericArgument val3 = QGenericArgument(),
14869 QGenericArgument val4 = QGenericArgument(),
14870 QGenericArgument val5 = QGenericArgument(),
14871 QGenericArgument val6 = QGenericArgument(),
14872 QGenericArgument val7 = QGenericArgument(),
14873 QGenericArgument val8 = QGenericArgument(),
14874 QGenericArgument val9 = QGenericArgument())
14875 {
14876 return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0,
14877 val1, val2, val3, val4, val5, val6, val7, val8, val9);
14878 }
14879 QObject *newInstance(QGenericArgument val0 = QGenericArgument(0),
14880 QGenericArgument val1 = QGenericArgument(),
14881 QGenericArgument val2 = QGenericArgument(),
14882 QGenericArgument val3 = QGenericArgument(),
14883 QGenericArgument val4 = QGenericArgument(),
14884 QGenericArgument val5 = QGenericArgument(),
14885 QGenericArgument val6 = QGenericArgument(),
14886 QGenericArgument val7 = QGenericArgument(),
14887 QGenericArgument val8 = QGenericArgument(),
14888 QGenericArgument val9 = QGenericArgument()) const;
14889 enum Call {
14890 InvokeMetaMethod,
14891 ReadProperty,
14892 WriteProperty,
14893 ResetProperty,
14894 QueryPropertyDesignable,
14895 QueryPropertyScriptable,
14896 QueryPropertyStored,
14897 QueryPropertyEditable,
14898 QueryPropertyUser,
14899 CreateInstance
14900 };
14901 int static_metacall(Call, int, void **) const;
14902 struct {
14903 const QMetaObject *superdata;
14904 const char *stringdata;
14905 const uint *data;
14906 const void *extradata;
14907 } d;
14908 };
14909 struct QMetaObjectExtraData
14910 {
14911 const QMetaObject **objects;
14912 int (*static_metacall)(QMetaObject::Call, int, void **);
14913 };
14914 inline const char *QMetaObject::className() const
14915 { return d.stringdata; }
14916 inline const QMetaObject *QMetaObject::superClass() const
14917 { return d.superdata; }
14918 extern "C" {
14919 extern void *memcpy (void *__restrict __dest,
14920 __const void *__restrict __src, size_t __n)
14921 throw () __attribute__ ((__nonnull__ (1, 2)));
14922 extern void *memmove (void *__dest, __const void *__src, size_t __n)
14923 throw () __attribute__ ((__nonnull__ (1, 2)));
14924 extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
14925 int __c, size_t __n)
14926 throw () __attribute__ ((__nonnull__ (1, 2)));
14927 extern void *memset (void *__s, int __c, size_t __n) throw () __attribute__ ((__nonnull__ (1)));
14928 extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
14929 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14930 extern void *memchr (__const void *__s, int __c, size_t __n)
14931 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14932 extern void *rawmemchr (__const void *__s, int __c)
14933 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14934 extern void *memrchr (__const void *__s, int __c, size_t __n)
14935 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14936 extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
14937 throw () __attribute__ ((__nonnull__ (1, 2)));
14938 extern char *strncpy (char *__restrict __dest,
14939 __const char *__restrict __src, size_t __n)
14940 throw () __attribute__ ((__nonnull__ (1, 2)));
14941 extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
14942 throw () __attribute__ ((__nonnull__ (1, 2)));
14943 extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
14944 size_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));
14945 extern int strcmp (__const char *__s1, __const char *__s2)
14946 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14947 extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
14948 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14949 extern int strcoll (__const char *__s1, __const char *__s2)
14950 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14951 extern size_t strxfrm (char *__restrict __dest,
14952 __const char *__restrict __src, size_t __n)
14953 throw () __attribute__ ((__nonnull__ (2)));
14954 extern char *strdup (__const char *__s)
14955 throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
14956 extern char *strndup (__const char *__string, size_t __n)
14957 throw () __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
14958 extern char *strchr (__const char *__s, int __c)
14959 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14960 extern char *strrchr (__const char *__s, int __c)
14961 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14962 extern char *strchrnul (__const char *__s, int __c)
14963 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14964 extern size_t strcspn (__const char *__s, __const char *__reject)
14965 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14966 extern size_t strspn (__const char *__s, __const char *__accept)
14967 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14968 extern char *strpbrk (__const char *__s, __const char *__accept)
14969 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14970 extern char *strstr (__const char *__haystack, __const char *__needle)
14971 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14972 extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
14973 throw () __attribute__ ((__nonnull__ (2)));
14974 extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
14975 char **__restrict __save_ptr)
14976 throw () __attribute__ ((__nonnull__ (2, 3)));
14977 extern char *strcasestr (__const char *__haystack, __const char *__needle)
14978 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14979 extern void *memmem (__const void *__haystack, size_t __haystacklen,
14980 __const void *__needle, size_t __needlelen)
14981 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3)));
14982 extern void *mempcpy (void *__restrict __dest,
14983 __const void *__restrict __src, size_t __n)
14984 throw () __attribute__ ((__nonnull__ (1, 2)));
14985 extern size_t strlen (__const char *__s)
14986 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14987 extern size_t strnlen (__const char *__string, size_t __maxlen)
14988 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
14989 extern char *strerror (int __errnum) throw ();
14990 extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen)
14991 throw () __attribute__ ((__nonnull__ (2)));
14992 extern char * strerror_r (int __errnum, char *__buf, size_t __buflen) throw () __asm__ ("_" "__glibc_strerror_r") __attribute__ ((__nonnull__ (2)));
14993 extern void bcopy (__const void *__src, void *__dest, size_t __n)
14994 throw () __attribute__ ((__nonnull__ (1, 2)));
14995 extern void bzero (void *__s, size_t __n) throw () __attribute__ ((__nonnull__ (1)));
14996 extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
14997 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
14998 extern char *index (__const char *__s, int __c)
14999 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
15000 extern char *rindex (__const char *__s, int __c)
15001 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
15002 extern int ffs (int __i) throw () __attribute__ ((__const__));
15003 extern int strcasecmp (__const char *__s1, __const char *__s2)
15004 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
15005 extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
15006 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
15007 extern char *strsep (char **__restrict __stringp,
15008 __const char *__restrict __delim)
15009 throw () __attribute__ ((__nonnull__ (1, 2)));
15010 extern char *strsignal (int __sig) throw ();
15011 extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
15012 throw () __attribute__ ((__nonnull__ (1, 2)));
15013 extern char *stpncpy (char *__restrict __dest,
15014 __const char *__restrict __src, size_t __n)
15015 throw () __attribute__ ((__nonnull__ (1, 2)));
15016 extern char *basename (__const char *__filename) throw () __attribute__ ((__nonnull__ (1)));
15017 extern size_t strlcat(char *__restrict dst, const char *__restrict src,
15018 size_t n) throw () __attribute__ ((__nonnull__ (1, 2)));
15019 extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
15020 size_t n) throw () __attribute__ ((__nonnull__ (1, 2)));
15021 }
15022 typedef __gnuc_va_list va_list;
15023 typedef QtValidLicenseForCoreModule QtCoreModule;
15024 __attribute__((visibility("default"))) char *qstrdup(const char *);
15025 inline uint qstrlen(const char *str)
15026 { return str ? uint(strlen(str)) : 0; }
15027 inline uint qstrnlen(const char *str, uint maxlen)
15028 {
15029 uint length = 0;
15030 if (str) {
15031 while (length < maxlen && *str++)
15032 length++;
15033 }
15034 return length;
15035 }
15036 __attribute__((visibility("default"))) char *qstrcpy(char *dst, const char *src);
15037 __attribute__((visibility("default"))) char *qstrncpy(char *dst, const char *src, uint len);
15038 __attribute__((visibility("default"))) int qstrcmp(const char *str1, const char *str2);
15039 __attribute__((visibility("default"))) int qstrcmp(const QByteArray &str1, const QByteArray &str2);
15040 __attribute__((visibility("default"))) int qstrcmp(const QByteArray &str1, const char *str2);
15041 static inline int qstrcmp(const char *str1, const QByteArray &str2)
15042 { return -qstrcmp(str2, str1); }
15043 inline int qstrncmp(const char *str1, const char *str2, uint len)
15044 {
15045 return (str1 && str2) ? strncmp(str1, str2, len)
15046 : (str1 ? 1 : (str2 ? -1 : 0));
15047 }
15048 __attribute__((visibility("default"))) int qstricmp(const char *, const char *);
15049 __attribute__((visibility("default"))) int qstrnicmp(const char *, const char *, uint len);
15050 __attribute__((visibility("default"))) int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap);
15051 __attribute__((visibility("default"))) int qsnprintf(char *str, size_t n, const char *fmt, ...);
15052 __attribute__((visibility("default"))) quint16 qChecksum(const char *s, uint len);
15053 class QByteRef;
15054 class QString;
15055 class QDataStream;
15056 template <typename T> class QList;
15057 class __attribute__((visibility("default"))) QByteArray
15058 {
15059 public:
15060 inline QByteArray();
15061 QByteArray(const char *);
15062 QByteArray(const char *, int size);
15063 QByteArray(int size, char c);
15064 inline QByteArray(const QByteArray &);
15065 inline ~QByteArray();
15066 QByteArray &operator=(const QByteArray &);
15067 QByteArray &operator=(const char *str);
15068 inline int size() const;
15069 bool isEmpty() const;
15070 void resize(int size);
15071 QByteArray &fill(char c, int size = -1);
15072 int capacity() const;
15073 void reserve(int size);
15074 void squeeze();
15075 operator const char *() const;
15076 operator const void *() const;
15077 char *data();
15078 const char *data() const;
15079 inline const char *constData() const;
15080 inline void detach();
15081 bool isDetached() const;
15082 void clear();
15083 char at(int i) const;
15084 char operator[](int i) const;
15085 char operator[](uint i) const;
15086 QByteRef operator[](int i);
15087 QByteRef operator[](uint i);
15088 int indexOf(char c, int from = 0) const;
15089 int indexOf(const char *c, int from = 0) const;
15090 int indexOf(const QByteArray &a, int from = 0) const;
15091 int lastIndexOf(char c, int from = -1) const;
15092 int lastIndexOf(const char *c, int from = -1) const;
15093 int lastIndexOf(const QByteArray &a, int from = -1) const;
15094 QBool contains(char c) const;
15095 QBool contains(const char *a) const;
15096 QBool contains(const QByteArray &a) const;
15097 int count(char c) const;
15098 int count(const char *a) const;
15099 int count(const QByteArray &a) const;
15100 QByteArray left(int len) const;
15101 QByteArray right(int len) const;
15102 QByteArray mid(int index, int len = -1) const;
15103 bool startsWith(const QByteArray &a) const;
15104 bool startsWith(char c) const;
15105 bool startsWith(const char *c) const;
15106 bool endsWith(const QByteArray &a) const;
15107 bool endsWith(char c) const;
15108 bool endsWith(const char *c) const;
15109 void truncate(int pos);
15110 void chop(int n);
15111 QByteArray toLower() const;
15112 QByteArray toUpper() const;
15113 QByteArray trimmed() const;
15114 QByteArray simplified() const;
15115 QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const;
15116 QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const;
15117 QByteArray &prepend(char c);
15118 QByteArray &prepend(const char *s);
15119 QByteArray &prepend(const QByteArray &a);
15120 QByteArray &append(char c);
15121 QByteArray &append(const char *s);
15122 QByteArray &append(const char *s, int len);
15123 QByteArray &append(const QByteArray &a);
15124 QByteArray &insert(int i, char c);
15125 QByteArray &insert(int i, const char *s);
15126 QByteArray &insert(int i, const QByteArray &a);
15127 QByteArray &remove(int index, int len);
15128 QByteArray &replace(int index, int len, const char *s);
15129 QByteArray &replace(int index, int len, const QByteArray &s);
15130 QByteArray &replace(char before, const char *after);
15131 QByteArray &replace(char before, const QByteArray &after);
15132 QByteArray &replace(const char *before, const char *after);
15133 QByteArray &replace(const char *before, int bsize, const char *after, int asize);
15134 QByteArray &replace(const QByteArray &before, const QByteArray &after);
15135 QByteArray &replace(const QByteArray &before, const char *after);
15136 QByteArray &replace(const char *before, const QByteArray &after);
15137 QByteArray &replace(char before, char after);
15138 QByteArray &operator+=(char c);
15139 QByteArray &operator+=(const char *s);
15140 QByteArray &operator+=(const QByteArray &a);
15141 QList<QByteArray> split(char sep) const;
15142 QByteArray repeated(int times) const;
15143 inline __attribute__ ((__deprecated__)) bool operator==(const QString &s2) const;
15144 inline __attribute__ ((__deprecated__)) bool operator!=(const QString &s2) const;
15145 inline __attribute__ ((__deprecated__)) bool operator<(const QString &s2) const;
15146 inline __attribute__ ((__deprecated__)) bool operator>(const QString &s2) const;
15147 inline __attribute__ ((__deprecated__)) bool operator<=(const QString &s2) const;
15148 inline __attribute__ ((__deprecated__)) bool operator>=(const QString &s2) const;
15149 short toShort(bool *ok = 0, int base = 10) const;
15150 ushort toUShort(bool *ok = 0, int base = 10) const;
15151 int toInt(bool *ok = 0, int base = 10) const;
15152 uint toUInt(bool *ok = 0, int base = 10) const;
15153 long toLong(bool *ok = 0, int base = 10) const;
15154 ulong toULong(bool *ok = 0, int base = 10) const;
15155 qlonglong toLongLong(bool *ok = 0, int base = 10) const;
15156 qulonglong toULongLong(bool *ok = 0, int base = 10) const;
15157 float toFloat(bool *ok = 0) const;
15158 double toDouble(bool *ok = 0) const;
15159 QByteArray toBase64() const;
15160 QByteArray toHex() const;
15161 QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(),
15162 const QByteArray &include = QByteArray(),
15163 char percent = '%') const;
15164 QByteArray &setNum(short, int base = 10);
15165 QByteArray &setNum(ushort, int base = 10);
15166 QByteArray &setNum(int, int base = 10);
15167 QByteArray &setNum(uint, int base = 10);
15168 QByteArray &setNum(qlonglong, int base = 10);
15169 QByteArray &setNum(qulonglong, int base = 10);
15170 QByteArray &setNum(float, char f = 'g', int prec = 6);
15171 QByteArray &setNum(double, char f = 'g', int prec = 6);
15172 static QByteArray number(int, int base = 10);
15173 static QByteArray number(uint, int base = 10);
15174 static QByteArray number(qlonglong, int base = 10);
15175 static QByteArray number(qulonglong, int base = 10);
15176 static QByteArray number(double, char f = 'g', int prec = 6);
15177 static QByteArray fromRawData(const char *, int size);
15178 static QByteArray fromBase64(const QByteArray &base64);
15179 static QByteArray fromHex(const QByteArray &hexEncoded);
15180 static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%');
15181 typedef char *iterator;
15182 typedef const char *const_iterator;
15183 typedef iterator Iterator;
15184 typedef const_iterator ConstIterator;
15185 iterator begin();
15186 const_iterator begin() const;
15187 const_iterator constBegin() const;
15188 iterator end();
15189 const_iterator end() const;
15190 const_iterator constEnd() const;
15191 typedef const char & const_reference;
15192 typedef char & reference;
15193 void push_back(char c);
15194 void push_back(const char *c);
15195 void push_back(const QByteArray &a);
15196 void push_front(char c);
15197 void push_front(const char *c);
15198 void push_front(const QByteArray &a);
15199 inline int count() const { return d->size; }
15200 int length() const { return d->size; }
15201 bool isNull() const;
15202 private:
15203 operator QNoImplicitBoolCast() const;
15204 struct Data {
15205 QBasicAtomicInt ref;
15206 int alloc, size;
15207 char *data;
15208 char array[1];
15209 };
15210 static Data shared_null;
15211 static Data shared_empty;
15212 Data *d;
15213 QByteArray(Data *dd, int , int ) : d(dd) {}
15214 void realloc(int alloc);
15215 void expand(int i);
15216 QByteArray nulTerminated() const;
15217 friend class QByteRef;
15218 friend class QString;
15219 public:
15220 typedef Data * DataPtr;
15221 inline DataPtr &data_ptr() { return d; }
15222 };
15223 inline QByteArray::QByteArray(): d(&shared_null) { d->ref.ref(); }
15224 inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); }
15225 inline int QByteArray::size() const
15226 { return d->size; }
15227 inline char QByteArray::at(int i) const
15228 { qt_noop(); return d->data[i]; }
15229 inline char QByteArray::operator[](int i) const
15230 { qt_noop(); return d->data[i]; }
15231 inline char QByteArray::operator[](uint i) const
15232 { qt_noop(); return d->data[i]; }
15233 inline bool QByteArray::isEmpty() const
15234 { return d->size == 0; }
15235 inline QByteArray::operator const char *() const
15236 { return d->data; }
15237 inline QByteArray::operator const void *() const
15238 { return d->data; }
15239 inline char *QByteArray::data()
15240 { detach(); return d->data; }
15241 inline const char *QByteArray::data() const
15242 { return d->data; }
15243 inline const char *QByteArray::constData() const
15244 { return d->data; }
15245 inline void QByteArray::detach()
15246 { if (d->ref != 1 || d->data != d->array) realloc(d->size); }
15247 inline bool QByteArray::isDetached() const
15248 { return d->ref == 1; }
15249 inline QByteArray::QByteArray(const QByteArray &a) : d(a.d)
15250 { d->ref.ref(); }
15251 inline int QByteArray::capacity() const
15252 { return d->alloc; }
15253 inline void QByteArray::reserve(int asize)
15254 { if (d->ref != 1 || asize > d->alloc) realloc(asize); }
15255 inline void QByteArray::squeeze()
15256 { if (d->size < d->alloc) realloc(d->size); }
15257 class __attribute__((visibility("default"))) QByteRef {
15258 QByteArray &a;
15259 int i;
15260 inline QByteRef(QByteArray &array, int idx)
15261 : a(array),i(idx) {}
15262 friend class QByteArray;
15263 public:
15264 inline operator char() const
15265 { return i < a.d->size ? a.d->data[i] : 0; }
15266 inline QByteRef &operator=(char c)
15267 { if (i >= a.d->size) a.expand(i); else a.detach();
15268 a.d->data[i] = c; return *this; }
15269 inline QByteRef &operator=(const QByteRef &c)
15270 { if (i >= a.d->size) a.expand(i); else a.detach();
15271 a.d->data[i] = c.a.d->data[c.i]; return *this; }
15272 inline bool operator==(char c) const
15273 { return a.d->data[i] == c; }
15274 inline bool operator!=(char c) const
15275 { return a.d->data[i] != c; }
15276 inline bool operator>(char c) const
15277 { return a.d->data[i] > c; }
15278 inline bool operator>=(char c) const
15279 { return a.d->data[i] >= c; }
15280 inline bool operator<(char c) const
15281 { return a.d->data[i] < c; }
15282 inline bool operator<=(char c) const
15283 { return a.d->data[i] <= c; }
15284 };
15285 inline QByteRef QByteArray::operator[](int i)
15286 { qt_noop(); return QByteRef(*this, i); }
15287 inline QByteRef QByteArray::operator[](uint i)
15288 { return QByteRef(*this, i); }
15289 inline QByteArray::iterator QByteArray::begin()
15290 { detach(); return d->data; }
15291 inline QByteArray::const_iterator QByteArray::begin() const
15292 { return d->data; }
15293 inline QByteArray::const_iterator QByteArray::constBegin() const
15294 { return d->data; }
15295 inline QByteArray::iterator QByteArray::end()
15296 { detach(); return d->data + d->size; }
15297 inline QByteArray::const_iterator QByteArray::end() const
15298 { return d->data + d->size; }
15299 inline QByteArray::const_iterator QByteArray::constEnd() const
15300 { return d->data + d->size; }
15301 inline QByteArray &QByteArray::operator+=(char c)
15302 { return append(c); }
15303 inline QByteArray &QByteArray::operator+=(const char *s)
15304 { return append(s); }
15305 inline QByteArray &QByteArray::operator+=(const QByteArray &a)
15306 { return append(a); }
15307 inline void QByteArray::push_back(char c)
15308 { append(c); }
15309 inline void QByteArray::push_back(const char *c)
15310 { append(c); }
15311 inline void QByteArray::push_back(const QByteArray &a)
15312 { append(a); }
15313 inline void QByteArray::push_front(char c)
15314 { prepend(c); }
15315 inline void QByteArray::push_front(const char *c)
15316 { prepend(c); }
15317 inline void QByteArray::push_front(const QByteArray &a)
15318 { prepend(a); }
15319 inline QBool QByteArray::contains(const QByteArray &a) const
15320 { return QBool(indexOf(a) != -1); }
15321 inline QBool QByteArray::contains(char c) const
15322 { return QBool(indexOf(c) != -1); }
15323 inline bool operator==(const QByteArray &a1, const QByteArray &a2)
15324 { return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); }
15325 inline bool operator==(const QByteArray &a1, const char *a2)
15326 { return a2 ? qstrcmp(a1,a2) == 0 : a1.isEmpty(); }
15327 inline bool operator==(const char *a1, const QByteArray &a2)
15328 { return a1 ? qstrcmp(a1,a2) == 0 : a2.isEmpty(); }
15329 inline bool operator!=(const QByteArray &a1, const QByteArray &a2)
15330 { return !(a1==a2); }
15331 inline bool operator!=(const QByteArray &a1, const char *a2)
15332 { return a2 ? qstrcmp(a1,a2) != 0 : !a1.isEmpty(); }
15333 inline bool operator!=(const char *a1, const QByteArray &a2)
15334 { return a1 ? qstrcmp(a1,a2) != 0 : !a2.isEmpty(); }
15335 inline bool operator<(const QByteArray &a1, const QByteArray &a2)
15336 { return qstrcmp(a1, a2) < 0; }
15337 inline bool operator<(const QByteArray &a1, const char *a2)
15338 { return qstrcmp(a1, a2) < 0; }
15339 inline bool operator<(const char *a1, const QByteArray &a2)
15340 { return qstrcmp(a1, a2) < 0; }
15341 inline bool operator<=(const QByteArray &a1, const QByteArray &a2)
15342 { return qstrcmp(a1, a2) <= 0; }
15343 inline bool operator<=(const QByteArray &a1, const char *a2)
15344 { return qstrcmp(a1, a2) <= 0; }
15345 inline bool operator<=(const char *a1, const QByteArray &a2)
15346 { return qstrcmp(a1, a2) <= 0; }
15347 inline bool operator>(const QByteArray &a1, const QByteArray &a2)
15348 { return qstrcmp(a1, a2) > 0; }
15349 inline bool operator>(const QByteArray &a1, const char *a2)
15350 { return qstrcmp(a1, a2) > 0; }
15351 inline bool operator>(const char *a1, const QByteArray &a2)
15352 { return qstrcmp(a1, a2) > 0; }
15353 inline bool operator>=(const QByteArray &a1, const QByteArray &a2)
15354 { return qstrcmp(a1, a2) >= 0; }
15355 inline bool operator>=(const QByteArray &a1, const char *a2)
15356 { return qstrcmp(a1, a2) >= 0; }
15357 inline bool operator>=(const char *a1, const QByteArray &a2)
15358 { return qstrcmp(a1, a2) >= 0; }
15359 inline const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
15360 { return QByteArray(a1) += a2; }
15361 inline const QByteArray operator+(const QByteArray &a1, const char *a2)
15362 { return QByteArray(a1) += a2; }
15363 inline const QByteArray operator+(const QByteArray &a1, char a2)
15364 { return QByteArray(a1) += a2; }
15365 inline const QByteArray operator+(const char *a1, const QByteArray &a2)
15366 { return QByteArray(a1) += a2; }
15367 inline const QByteArray operator+(char a1, const QByteArray &a2)
15368 { return QByteArray(&a1, 1) += a2; }
15369 inline QBool QByteArray::contains(const char *c) const
15370 { return QBool(indexOf(c) != -1); }
15371 inline QByteArray &QByteArray::replace(char before, const char *c)
15372 { return replace(&before, 1, c, qstrlen(c)); }
15373 inline QByteArray &QByteArray::replace(const QByteArray &before, const char *c)
15374 { return replace(before.constData(), before.size(), c, qstrlen(c)); }
15375 inline QByteArray &QByteArray::replace(const char *before, const char *after)
15376 { return replace(before, qstrlen(before), after, qstrlen(after)); }
15377 inline QByteArray &QByteArray::setNum(short n, int base)
15378 { return setNum(qlonglong(n), base); }
15379 inline QByteArray &QByteArray::setNum(ushort n, int base)
15380 { return setNum(qulonglong(n), base); }
15381 inline QByteArray &QByteArray::setNum(int n, int base)
15382 { return setNum(qlonglong(n), base); }
15383 inline QByteArray &QByteArray::setNum(uint n, int base)
15384 { return setNum(qulonglong(n), base); }
15385 inline QByteArray &QByteArray::setNum(float n, char f, int prec)
15386 { return setNum(double(n),f,prec); }
15387 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QByteArray &);
15388 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QByteArray &);
15389 __attribute__((visibility("default"))) QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel = -1);
15390 __attribute__((visibility("default"))) QByteArray qUncompress(const uchar* data, int nbytes);
15391 inline QByteArray qCompress(const QByteArray& data, int compressionLevel = -1)
15392 { return qCompress(reinterpret_cast<const uchar *>(data.constData()), data.size(), compressionLevel); }
15393 inline QByteArray qUncompress(const QByteArray& data)
15394 { return qUncompress(reinterpret_cast<const uchar*>(data.constData()), data.size()); }
15395 template <> class QTypeInfo<QByteArray> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QByteArray)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QByteArray"; } };
15396 template <> inline bool qIsDetached<QByteArray>(QByteArray &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QByteArray>(QByteArray &value1, QByteArray &value2) { const QByteArray::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
15397 typedef std::basic_string<wchar_t> QStdWString;
15398 typedef QtValidLicenseForCoreModule QtCoreModule;
15399 class QCharRef;
15400 class QRegExp;
15401 class QStringList;
15402 class QTextCodec;
15403 class QLatin1String;
15404 class QStringRef;
15405 template <typename T> class QVector;
15406 class __attribute__((visibility("default"))) QString
15407 {
15408 public:
15409 inline QString();
15410 QString(const QChar *unicode, int size);
15411 QString(QChar c);
15412 QString(int size, QChar c);
15413 inline QString(const QLatin1String &latin1);
15414 inline QString(const QString &);
15415 inline ~QString();
15416 QString &operator=(QChar c);
15417 QString &operator=(const QString &);
15418 inline QString &operator=(const QLatin1String &);
15419 inline int size() const { return d->size; }
15420 inline int count() const { return d->size; }
15421 inline int length() const;
15422 inline bool isEmpty() const;
15423 void resize(int size);
15424 QString &fill(QChar c, int size = -1);
15425 void truncate(int pos);
15426 void chop(int n);
15427 int capacity() const;
15428 inline void reserve(int size);
15429 inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;}
15430 inline const QChar *unicode() const;
15431 inline QChar *data();
15432 inline const QChar *data() const;
15433 inline const QChar *constData() const;
15434 inline void detach();
15435 inline bool isDetached() const;
15436 void clear();
15437 inline const QChar at(int i) const;
15438 const QChar operator[](int i) const;
15439 QCharRef operator[](int i);
15440 const QChar operator[](uint i) const;
15441 QCharRef operator[](uint i);
15442 QString arg(qlonglong a, int fieldwidth=0, int base=10,
15443 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15444 QString arg(qulonglong a, int fieldwidth=0, int base=10,
15445 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15446 QString arg(long a, int fieldwidth=0, int base=10,
15447 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15448 QString arg(ulong a, int fieldwidth=0, int base=10,
15449 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15450 QString arg(int a, int fieldWidth = 0, int base = 10,
15451 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15452 QString arg(uint a, int fieldWidth = 0, int base = 10,
15453 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15454 QString arg(short a, int fieldWidth = 0, int base = 10,
15455 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15456 QString arg(ushort a, int fieldWidth = 0, int base = 10,
15457 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15458 QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,
15459 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15460 QString arg(char a, int fieldWidth = 0,
15461 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15462 QString arg(QChar a, int fieldWidth = 0,
15463 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15464 QString arg(const QString &a, int fieldWidth = 0,
15465 const QChar &fillChar = QLatin1Char(' ')) const __attribute__ ((warn_unused_result));
15466 QString arg(const QString &a1, const QString &a2) const __attribute__ ((warn_unused_result));
15467 QString arg(const QString &a1, const QString &a2, const QString &a3) const __attribute__ ((warn_unused_result));
15468 QString arg(const QString &a1, const QString &a2, const QString &a3,
15469 const QString &a4) const __attribute__ ((warn_unused_result));
15470 QString arg(const QString &a1, const QString &a2, const QString &a3,
15471 const QString &a4, const QString &a5) const __attribute__ ((warn_unused_result));
15472 QString arg(const QString &a1, const QString &a2, const QString &a3,
15473 const QString &a4, const QString &a5, const QString &a6) const __attribute__ ((warn_unused_result));
15474 QString arg(const QString &a1, const QString &a2, const QString &a3,
15475 const QString &a4, const QString &a5, const QString &a6,
15476 const QString &a7) const __attribute__ ((warn_unused_result));
15477 QString arg(const QString &a1, const QString &a2, const QString &a3,
15478 const QString &a4, const QString &a5, const QString &a6,
15479 const QString &a7, const QString &a8) const __attribute__ ((warn_unused_result));
15480 QString arg(const QString &a1, const QString &a2, const QString &a3,
15481 const QString &a4, const QString &a5, const QString &a6,
15482 const QString &a7, const QString &a8, const QString &a9) const __attribute__ ((warn_unused_result));
15483 QString &vsprintf(const char *format, va_list ap)
15484 __attribute__ ((format (printf, 2, 0)))
15485 ;
15486 QString &sprintf(const char *format, ...)
15487 __attribute__ ((format (printf, 2, 3)))
15488 ;
15489 int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15490 int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15491 int indexOf(const QLatin1String &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15492 int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15493 int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15494 int lastIndexOf(const QLatin1String &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15495 inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15496 inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15497 int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15498 int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15499 int indexOf(const QRegExp &, int from = 0) const;
15500 int lastIndexOf(const QRegExp &, int from = -1) const;
15501 inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
15502 int count(const QRegExp &) const;
15503 int indexOf(QRegExp &, int from = 0) const;
15504 int lastIndexOf(QRegExp &, int from = -1) const;
15505 inline QBool contains(QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
15506 enum SectionFlag {
15507 SectionDefault = 0x00,
15508 SectionSkipEmpty = 0x01,
15509 SectionIncludeLeadingSep = 0x02,
15510 SectionIncludeTrailingSep = 0x04,
15511 SectionCaseInsensitiveSeps = 0x08
15512 };
15513 typedef QFlags<SectionFlag> SectionFlags;
15514 QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
15515 QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
15516 QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;
15517 QString left(int n) const __attribute__ ((warn_unused_result));
15518 QString right(int n) const __attribute__ ((warn_unused_result));
15519 QString mid(int position, int n = -1) const __attribute__ ((warn_unused_result));
15520 QStringRef leftRef(int n) const __attribute__ ((warn_unused_result));
15521 QStringRef rightRef(int n) const __attribute__ ((warn_unused_result));
15522 QStringRef midRef(int position, int n = -1) const __attribute__ ((warn_unused_result));
15523 bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15524 bool startsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15525 bool startsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15526 bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15527 bool endsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15528 bool endsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15529 QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const __attribute__ ((warn_unused_result));
15530 QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const __attribute__ ((warn_unused_result));
15531 QString toLower() const __attribute__ ((warn_unused_result));
15532 QString toUpper() const __attribute__ ((warn_unused_result));
15533 QString toCaseFolded() const __attribute__ ((warn_unused_result));
15534 QString trimmed() const __attribute__ ((warn_unused_result));
15535 QString simplified() const __attribute__ ((warn_unused_result));
15536 QString &insert(int i, QChar c);
15537 QString &insert(int i, const QChar *uc, int len);
15538 inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); }
15539 QString &insert(int i, const QLatin1String &s);
15540 QString &append(QChar c);
15541 QString &append(const QString &s);
15542 QString &append(const QStringRef &s);
15543 QString &append(const QLatin1String &s);
15544 inline QString &prepend(QChar c) { return insert(0, c); }
15545 inline QString &prepend(const QString &s) { return insert(0, s); }
15546 inline QString &prepend(const QLatin1String &s) { return insert(0, s); }
15547 inline QString &operator+=(QChar c) {
15548 if (d->ref != 1 || d->size + 1 > d->alloc)
15549 realloc(grow(d->size + 1));
15550 d->data[d->size++] = c.unicode();
15551 d->data[d->size] = '\0';
15552 return *this;
15553 }
15554 inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); }
15555 inline QString &operator+=(const QString &s) { return append(s); }
15556 inline QString &operator+=(const QStringRef &s) { return append(s); }
15557 inline QString &operator+=(const QLatin1String &s) { return append(s); }
15558 QString &remove(int i, int len);
15559 QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15560 QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15561 QString &replace(int i, int len, QChar after);
15562 QString &replace(int i, int len, const QChar *s, int slen);
15563 QString &replace(int i, int len, const QString &after);
15564 QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15565 QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15566 QString &replace(const QLatin1String &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15567 QString &replace(const QLatin1String &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15568 QString &replace(const QString &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15569 QString &replace(const QString &before, const QString &after,
15570 Qt::CaseSensitivity cs = Qt::CaseSensitive);
15571 QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15572 QString &replace(QChar c, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
15573 QString &replace(const QRegExp &rx, const QString &after);
15574 inline QString &remove(const QRegExp &rx)
15575 { return replace(rx, QString()); }
15576 enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };
15577 QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
15578 Qt::CaseSensitivity cs = Qt::CaseSensitive) const __attribute__ ((warn_unused_result));
15579 QStringList split(const QChar &sep, SplitBehavior behavior = KeepEmptyParts,
15580 Qt::CaseSensitivity cs = Qt::CaseSensitive) const __attribute__ ((warn_unused_result));
15581 QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const __attribute__ ((warn_unused_result));
15582 enum NormalizationForm {
15583 NormalizationForm_D,
15584 NormalizationForm_C,
15585 NormalizationForm_KD,
15586 NormalizationForm_KC
15587 };
15588 QString normalized(NormalizationForm mode) const __attribute__ ((warn_unused_result));
15589 QString normalized(NormalizationForm mode, QChar::UnicodeVersion version) const __attribute__ ((warn_unused_result));
15590 QString repeated(int times) const;
15591 const ushort *utf16() const;
15592 QByteArray toAscii() const __attribute__ ((warn_unused_result));
15593 QByteArray toLatin1() const __attribute__ ((warn_unused_result));
15594 QByteArray toUtf8() const __attribute__ ((warn_unused_result));
15595 QByteArray toLocal8Bit() const __attribute__ ((warn_unused_result));
15596 QVector<uint> toUcs4() const __attribute__ ((warn_unused_result));
15597 static QString fromAscii(const char *, int size = -1);
15598 static QString fromLatin1(const char *, int size = -1);
15599 static QString fromUtf8(const char *, int size = -1);
15600 static QString fromLocal8Bit(const char *, int size = -1);
15601 static QString fromUtf16(const ushort *, int size = -1);
15602 static QString fromUcs4(const uint *, int size = -1);
15603 static QString fromRawData(const QChar *, int size);
15604 int toWCharArray(wchar_t *array) const;
15605 static QString fromWCharArray(const wchar_t *, int size = -1);
15606 QString &setUnicode(const QChar *unicode, int size);
15607 inline QString &setUtf16(const ushort *utf16, int size);
15608 int compare(const QString &s) const;
15609 int compare(const QString &s, Qt::CaseSensitivity cs) const;
15610 int compare(const QLatin1String &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15611 static inline int compare(const QString &s1, const QString &s2)
15612 { return s1.compare(s2); }
15613 static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
15614 { return s1.compare(s2, cs); }
15615 static inline int compare(const QString& s1, const QLatin1String &s2,
15616 Qt::CaseSensitivity cs = Qt::CaseSensitive)
15617 { return s1.compare(s2, cs); }
15618 static inline int compare(const QLatin1String& s1, const QString &s2,
15619 Qt::CaseSensitivity cs = Qt::CaseSensitive)
15620 { return -s2.compare(s1, cs); }
15621 int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
15622 static int compare(const QString &s1, const QStringRef &s2,
15623 Qt::CaseSensitivity = Qt::CaseSensitive);
15624 int localeAwareCompare(const QString& s) const;
15625 static int localeAwareCompare(const QString& s1, const QString& s2)
15626 { return s1.localeAwareCompare(s2); }
15627 int localeAwareCompare(const QStringRef &s) const;
15628 static int localeAwareCompare(const QString& s1, const QStringRef& s2);
15629 short toShort(bool *ok=0, int base=10) const;
15630 ushort toUShort(bool *ok=0, int base=10) const;
15631 int toInt(bool *ok=0, int base=10) const;
15632 uint toUInt(bool *ok=0, int base=10) const;
15633 long toLong(bool *ok=0, int base=10) const;
15634 ulong toULong(bool *ok=0, int base=10) const;
15635 qlonglong toLongLong(bool *ok=0, int base=10) const;
15636 qulonglong toULongLong(bool *ok=0, int base=10) const;
15637 float toFloat(bool *ok=0) const;
15638 double toDouble(bool *ok=0) const;
15639 QString &setNum(short, int base=10);
15640 QString &setNum(ushort, int base=10);
15641 QString &setNum(int, int base=10);
15642 QString &setNum(uint, int base=10);
15643 QString &setNum(long, int base=10);
15644 QString &setNum(ulong, int base=10);
15645 QString &setNum(qlonglong, int base=10);
15646 QString &setNum(qulonglong, int base=10);
15647 QString &setNum(float, char f='g', int prec=6);
15648 QString &setNum(double, char f='g', int prec=6);
15649 static QString number(int, int base=10);
15650 static QString number(uint, int base=10);
15651 static QString number(long, int base=10);
15652 static QString number(ulong, int base=10);
15653 static QString number(qlonglong, int base=10);
15654 static QString number(qulonglong, int base=10);
15655 static QString number(double, char f='g', int prec=6);
15656 bool operator==(const QString &s) const;
15657 bool operator<(const QString &s) const;
15658 inline bool operator>(const QString &s) const { return s < *this; }
15659 inline bool operator!=(const QString &s) const { return !operator==(s); }
15660 inline bool operator<=(const QString &s) const { return !operator>(s); }
15661 inline bool operator>=(const QString &s) const { return !operator<(s); }
15662 bool operator==(const QLatin1String &s) const;
15663 bool operator<(const QLatin1String &s) const;
15664 bool operator>(const QLatin1String &s) const;
15665 inline bool operator!=(const QLatin1String &s) const { return !operator==(s); }
15666 inline bool operator<=(const QLatin1String &s) const { return !operator>(s); }
15667 inline bool operator>=(const QLatin1String &s) const { return !operator<(s); }
15668 inline __attribute__ ((__deprecated__)) QString(const char *ch) : d(fromAscii_helper(ch))
15669 {}
15670 inline __attribute__ ((__deprecated__)) QString(const QByteArray &a)
15671 : d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size())))
15672 {}
15673 inline __attribute__ ((__deprecated__)) QString &operator=(const char *ch)
15674 { return (*this = fromAscii(ch)); }
15675 inline __attribute__ ((__deprecated__)) QString &operator=(const QByteArray &a)
15676 { return (*this = fromAscii(a.constData(), qstrnlen(a.constData(), a.size()))); }
15677 inline __attribute__ ((__deprecated__)) QString &operator=(char c)
15678 { return (*this = QChar::fromAscii(c)); }
15679 inline __attribute__ ((__deprecated__)) QString &prepend(const char *s)
15680 { return prepend(QString::fromAscii(s)); }
15681 inline __attribute__ ((__deprecated__)) QString &prepend(const QByteArray &s)
15682 { return prepend(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
15683 inline __attribute__ ((__deprecated__)) QString &append(const char *s)
15684 { return append(QString::fromAscii(s)); }
15685 inline __attribute__ ((__deprecated__)) QString &append(const QByteArray &s)
15686 { return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
15687 inline __attribute__ ((__deprecated__)) QString &operator+=(const char *s)
15688 { return append(QString::fromAscii(s)); }
15689 inline __attribute__ ((__deprecated__)) QString &operator+=(const QByteArray &s)
15690 { return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
15691 inline __attribute__ ((__deprecated__)) QString &operator+=(char c)
15692 { return append(QChar::fromAscii(c)); }
15693 inline __attribute__ ((__deprecated__)) bool operator==(const char *s) const;
15694 inline __attribute__ ((__deprecated__)) bool operator!=(const char *s) const;
15695 inline __attribute__ ((__deprecated__)) bool operator<(const char *s) const;
15696 inline __attribute__ ((__deprecated__)) bool operator<=(const char *s2) const;
15697 inline __attribute__ ((__deprecated__)) bool operator>(const char *s2) const;
15698 inline __attribute__ ((__deprecated__)) bool operator>=(const char *s2) const;
15699 inline __attribute__ ((__deprecated__)) bool operator==(const QByteArray &s) const;
15700 inline __attribute__ ((__deprecated__)) bool operator!=(const QByteArray &s) const;
15701 inline __attribute__ ((__deprecated__)) bool operator<(const QByteArray &s) const
15702 { return *this < QString::fromAscii(s.constData(), s.size()); }
15703 inline __attribute__ ((__deprecated__)) bool operator>(const QByteArray &s) const
15704 { return *this > QString::fromAscii(s.constData(), s.size()); }
15705 inline __attribute__ ((__deprecated__)) bool operator<=(const QByteArray &s) const
15706 { return *this <= QString::fromAscii(s.constData(), s.size()); }
15707 inline __attribute__ ((__deprecated__)) bool operator>=(const QByteArray &s) const
15708 { return *this >= QString::fromAscii(s.constData(), s.size()); }
15709 typedef QChar *iterator;
15710 typedef const QChar *const_iterator;
15711 typedef iterator Iterator;
15712 typedef const_iterator ConstIterator;
15713 iterator begin();
15714 const_iterator begin() const;
15715 const_iterator constBegin() const;
15716 iterator end();
15717 const_iterator end() const;
15718 const_iterator constEnd() const;
15719 inline void push_back(QChar c) { append(c); }
15720 inline void push_back(const QString &s) { append(s); }
15721 inline void push_front(QChar c) { prepend(c); }
15722 inline void push_front(const QString &s) { prepend(s); }
15723 static inline QString fromStdString(const std::string &s);
15724 inline std::string toStdString() const;
15725 static inline QString fromStdWString(const QStdWString &s);
15726 inline QStdWString toStdWString() const;
15727 struct Null { };
15728 static const Null null;
15729 inline QString(const Null &): d(&shared_null) { d->ref.ref(); }
15730 inline QString &operator=(const Null &) { *this = QString(); return *this; }
15731 inline bool isNull() const { return d == &shared_null; }
15732 bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; }
15733 bool isRightToLeft() const { if (!d->clean) updateProperties(); return d->righttoleft; }
15734 private:
15735 struct Data {
15736 QBasicAtomicInt ref;
15737 int alloc, size;
15738 ushort *data;
15739 ushort clean : 1;
15740 ushort simpletext : 1;
15741 ushort righttoleft : 1;
15742 ushort asciiCache : 1;
15743 ushort capacity : 1;
15744 ushort reserved : 11;
15745 ushort array[1];
15746 };
15747 static Data shared_null;
15748 static Data shared_empty;
15749 Data *d;
15750 QString(Data *dd, int ) : d(dd) {}
15751 static QTextCodec *codecForCStrings;
15752 static int grow(int);
15753 static void free(Data *);
15754 void realloc();
15755 void realloc(int alloc);
15756 void expand(int i);
15757 void updateProperties() const;
15758 QString multiArg(int numArgs, const QString **args) const;
15759 static int compare_helper(const QChar *data1, int length1,
15760 const QChar *data2, int length2,
15761 Qt::CaseSensitivity cs = Qt::CaseSensitive);
15762 static int compare_helper(const QChar *data1, int length1,
15763 QLatin1String s2,
15764 Qt::CaseSensitivity cs = Qt::CaseSensitive);
15765 static int localeAwareCompare_helper(const QChar *data1, int length1,
15766 const QChar *data2, int length2);
15767 static Data *fromLatin1_helper(const char *str, int size = -1);
15768 static Data *fromAscii_helper(const char *str, int size = -1);
15769 void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
15770 friend class QCharRef;
15771 friend class QTextCodec;
15772 friend class QStringRef;
15773 friend inline bool qStringComparisonHelper(const QString &s1, const char *s2);
15774 friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2);
15775 public:
15776 typedef Data * DataPtr;
15777 inline DataPtr &data_ptr() { return d; }
15778 };
15779 class __attribute__((visibility("default"))) QLatin1String
15780 {
15781 public:
15782 inline explicit QLatin1String(const char *s) : chars(s) {}
15783 inline QLatin1String &operator=(const QLatin1String &other)
15784 { chars = other.chars; return *this; }
15785 inline const char *latin1() const { return chars; }
15786 inline bool operator==(const QString &s) const
15787 { return s == *this; }
15788 inline bool operator!=(const QString &s) const
15789 { return s != *this; }
15790 inline bool operator>(const QString &s) const
15791 { return s < *this; }
15792 inline bool operator<(const QString &s) const
15793 { return s > *this; }
15794 inline bool operator>=(const QString &s) const
15795 { return s <= *this; }
15796 inline bool operator<=(const QString &s) const
15797 { return s >= *this; }
15798 inline __attribute__ ((__deprecated__)) bool operator==(const char *s) const
15799 { return QString::fromAscii(s) == *this; }
15800 inline __attribute__ ((__deprecated__)) bool operator!=(const char *s) const
15801 { return QString::fromAscii(s) != *this; }
15802 inline __attribute__ ((__deprecated__)) bool operator<(const char *s) const
15803 { return QString::fromAscii(s) > *this; }
15804 inline __attribute__ ((__deprecated__)) bool operator>(const char *s) const
15805 { return QString::fromAscii(s) < *this; }
15806 inline __attribute__ ((__deprecated__)) bool operator<=(const char *s) const
15807 { return QString::fromAscii(s) >= *this; }
15808 inline __attribute__ ((__deprecated__)) bool operator>=(const char *s) const
15809 { return QString::fromAscii(s) <= *this; }
15810 private:
15811 const char *chars;
15812 };
15813 inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
15814 { }
15815 inline int QString::length() const
15816 { return d->size; }
15817 inline const QChar QString::at(int i) const
15818 { qt_noop(); return d->data[i]; }
15819 inline const QChar QString::operator[](int i) const
15820 { qt_noop(); return d->data[i]; }
15821 inline const QChar QString::operator[](uint i) const
15822 { qt_noop(); return d->data[i]; }
15823 inline bool QString::isEmpty() const
15824 { return d->size == 0; }
15825 inline const QChar *QString::unicode() const
15826 { return reinterpret_cast<const QChar*>(d->data); }
15827 inline const QChar *QString::data() const
15828 { return reinterpret_cast<const QChar*>(d->data); }
15829 inline QChar *QString::data()
15830 { detach(); return reinterpret_cast<QChar*>(d->data); }
15831 inline const QChar *QString::constData() const
15832 { return reinterpret_cast<const QChar*>(d->data); }
15833 inline void QString::detach()
15834 { if (d->ref != 1 || d->data != d->array) realloc(); }
15835 inline bool QString::isDetached() const
15836 { return d->ref == 1; }
15837 inline QString &QString::operator=(const QLatin1String &s)
15838 {
15839 *this = fromLatin1(s.latin1());
15840 return *this;
15841 }
15842 inline void QString::clear()
15843 { if (!isNull()) *this = QString(); }
15844 inline QString::QString(const QString &other) : d(other.d)
15845 { qt_noop(); d->ref.ref(); }
15846 inline int QString::capacity() const
15847 { return d->alloc; }
15848 inline QString &QString::setNum(short n, int base)
15849 { return setNum(qlonglong(n), base); }
15850 inline QString &QString::setNum(ushort n, int base)
15851 { return setNum(qulonglong(n), base); }
15852 inline QString &QString::setNum(int n, int base)
15853 { return setNum(qlonglong(n), base); }
15854 inline QString &QString::setNum(uint n, int base)
15855 { return setNum(qulonglong(n), base); }
15856 inline QString &QString::setNum(long n, int base)
15857 { return setNum(qlonglong(n), base); }
15858 inline QString &QString::setNum(ulong n, int base)
15859 { return setNum(qulonglong(n), base); }
15860 inline QString &QString::setNum(float n, char f, int prec)
15861 { return setNum(double(n),f,prec); }
15862 inline QString QString::arg(int a, int fieldWidth, int base, const QChar &fillChar) const
15863 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
15864 inline QString QString::arg(uint a, int fieldWidth, int base, const QChar &fillChar) const
15865 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
15866 inline QString QString::arg(long a, int fieldWidth, int base, const QChar &fillChar) const
15867 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
15868 inline QString QString::arg(ulong a, int fieldWidth, int base, const QChar &fillChar) const
15869 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
15870 inline QString QString::arg(short a, int fieldWidth, int base, const QChar &fillChar) const
15871 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
15872 inline QString QString::arg(ushort a, int fieldWidth, int base, const QChar &fillChar) const
15873 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
15874 inline QString QString::arg(const QString &a1, const QString &a2) const
15875 { const QString *args[2] = { &a1, &a2 }; return multiArg(2, args); }
15876 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3) const
15877 { const QString *args[3] = { &a1, &a2, &a3 }; return multiArg(3, args); }
15878 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15879 const QString &a4) const
15880 { const QString *args[4] = { &a1, &a2, &a3, &a4 }; return multiArg(4, args); }
15881 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15882 const QString &a4, const QString &a5) const
15883 { const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 }; return multiArg(5, args); }
15884 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15885 const QString &a4, const QString &a5, const QString &a6) const
15886 { const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 }; return multiArg(6, args); }
15887 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15888 const QString &a4, const QString &a5, const QString &a6,
15889 const QString &a7) const
15890 { const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 }; return multiArg(7, args); }
15891 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15892 const QString &a4, const QString &a5, const QString &a6,
15893 const QString &a7, const QString &a8) const
15894 { const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 }; return multiArg(8, args); }
15895 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
15896 const QString &a4, const QString &a5, const QString &a6,
15897 const QString &a7, const QString &a8, const QString &a9) const
15898 { const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 }; return multiArg(9, args); }
15899 inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
15900 { return section(QString(asep), astart, aend, aflags); }
15901 class __attribute__((visibility("default"))) QCharRef {
15902 QString &s;
15903 int i;
15904 inline QCharRef(QString &str, int idx)
15905 : s(str),i(idx) {}
15906 friend class QString;
15907 public:
15908 inline operator QChar() const
15909 { return i < s.d->size ? s.d->data[i] : 0; }
15910 inline QCharRef &operator=(const QChar &c)
15911 { if (i >= s.d->size) s.expand(i); else s.detach();
15912 s.d->data[i] = c.unicode(); return *this; }
15913 inline __attribute__ ((__deprecated__)) QCharRef &operator=(char c)
15914 { return operator=(QChar::fromAscii(c)); }
15915 inline __attribute__ ((__deprecated__)) QCharRef &operator=(uchar c)
15916 { return operator=(QChar::fromAscii(c)); }
15917 inline QCharRef &operator=(const QCharRef &c) { return operator=(QChar(c)); }
15918 inline QCharRef &operator=(ushort rc) { return operator=(QChar(rc)); }
15919 inline QCharRef &operator=(short rc) { return operator=(QChar(rc)); }
15920 inline QCharRef &operator=(uint rc) { return operator=(QChar(rc)); }
15921 inline QCharRef &operator=(int rc) { return operator=(QChar(rc)); }
15922 inline bool isNull() const { return QChar(*this).isNull(); }
15923 inline bool isPrint() const { return QChar(*this).isPrint(); }
15924 inline bool isPunct() const { return QChar(*this).isPunct(); }
15925 inline bool isSpace() const { return QChar(*this).isSpace(); }
15926 inline bool isMark() const { return QChar(*this).isMark(); }
15927 inline bool isLetter() const { return QChar(*this).isLetter(); }
15928 inline bool isNumber() const { return QChar(*this).isNumber(); }
15929 inline bool isLetterOrNumber() { return QChar(*this).isLetterOrNumber(); }
15930 inline bool isDigit() const { return QChar(*this).isDigit(); }
15931 inline bool isLower() const { return QChar(*this).isLower(); }
15932 inline bool isUpper() const { return QChar(*this).isUpper(); }
15933 inline bool isTitleCase() const { return QChar(*this).isTitleCase(); }
15934 inline int digitValue() const { return QChar(*this).digitValue(); }
15935 QChar toLower() const { return QChar(*this).toLower(); }
15936 QChar toUpper() const { return QChar(*this).toUpper(); }
15937 QChar toTitleCase () const { return QChar(*this).toTitleCase(); }
15938 QChar::Category category() const { return QChar(*this).category(); }
15939 QChar::Direction direction() const { return QChar(*this).direction(); }
15940 QChar::Joining joining() const { return QChar(*this).joining(); }
15941 bool hasMirrored() const { return QChar(*this).hasMirrored(); }
15942 QChar mirroredChar() const { return QChar(*this).mirroredChar(); }
15943 QString decomposition() const { return QChar(*this).decomposition(); }
15944 QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); }
15945 uchar combiningClass() const { return QChar(*this).combiningClass(); }
15946 QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); }
15947 inline uchar cell() const { return QChar(*this).cell(); }
15948 inline uchar row() const { return QChar(*this).row(); }
15949 inline void setCell(uchar cell);
15950 inline void setRow(uchar row);
15951 char toAscii() const { return QChar(*this).toAscii(); }
15952 char toLatin1() const { return QChar(*this).toLatin1(); }
15953 ushort unicode() const { return QChar(*this).unicode(); }
15954 ushort& unicode() { return s.data()[i].unicode(); }
15955 };
15956 inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); }
15957 inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); }
15958 inline QString::QString() : d(&shared_null) { d->ref.ref(); }
15959 inline QString::~QString() { if (!d->ref.deref()) free(d); }
15960 inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacity = 1;}
15961 inline QString &QString::setUtf16(const ushort *autf16, int asize)
15962 { return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
15963 inline QCharRef QString::operator[](int i)
15964 { qt_noop(); return QCharRef(*this, i); }
15965 inline QCharRef QString::operator[](uint i)
15966 { return QCharRef(*this, i); }
15967 inline QString::iterator QString::begin()
15968 { detach(); return reinterpret_cast<QChar*>(d->data); }
15969 inline QString::const_iterator QString::begin() const
15970 { return reinterpret_cast<const QChar*>(d->data); }
15971 inline QString::const_iterator QString::constBegin() const
15972 { return reinterpret_cast<const QChar*>(d->data); }
15973 inline QString::iterator QString::end()
15974 { detach(); return reinterpret_cast<QChar*>(d->data + d->size); }
15975 inline QString::const_iterator QString::end() const
15976 { return reinterpret_cast<const QChar*>(d->data + d->size); }
15977 inline QString::const_iterator QString::constEnd() const
15978 { return reinterpret_cast<const QChar*>(d->data + d->size); }
15979 inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
15980 { return QBool(indexOf(s, 0, cs) != -1); }
15981 inline QBool QString::contains(QChar c, Qt::CaseSensitivity cs) const
15982 { return QBool(indexOf(c, 0, cs) != -1); }
15983 inline bool operator==(QString::Null, QString::Null) { return true; }
15984 inline bool operator==(QString::Null, const QString &s) { return s.isNull(); }
15985 inline bool operator==(const QString &s, QString::Null) { return s.isNull(); }
15986 inline bool operator!=(QString::Null, QString::Null) { return false; }
15987 inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
15988 inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
15989 inline bool qStringComparisonHelper(const QString &s1, const char *s2)
15990 {
15991 if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
15992 return (s1 == QLatin1String(s2));
15993 }
15994 inline bool QString::operator==(const char *s) const
15995 { return qStringComparisonHelper(*this, s); }
15996 inline bool QString::operator!=(const char *s) const
15997 { return !qStringComparisonHelper(*this, s); }
15998 inline bool QString::operator<(const char *s) const
15999 { return *this < QString::fromAscii(s); }
16000 inline bool QString::operator>(const char *s) const
16001 { return *this > QString::fromAscii(s); }
16002 inline bool QString::operator<=(const char *s) const
16003 { return *this <= QString::fromAscii(s); }
16004 inline bool QString::operator>=(const char *s) const
16005 { return *this >= QString::fromAscii(s); }
16006 inline __attribute__ ((__deprecated__)) bool operator==(const char *s1, const QString &s2)
16007 { return qStringComparisonHelper(s2, s1); }
16008 inline __attribute__ ((__deprecated__)) bool operator!=(const char *s1, const QString &s2)
16009 { return !qStringComparisonHelper(s2, s1); }
16010 inline __attribute__ ((__deprecated__)) bool operator<(const char *s1, const QString &s2)
16011 { return (QString::fromAscii(s1) < s2); }
16012 inline __attribute__ ((__deprecated__)) bool operator>(const char *s1, const QString &s2)
16013 { return (QString::fromAscii(s1) > s2); }
16014 inline __attribute__ ((__deprecated__)) bool operator<=(const char *s1, const QString &s2)
16015 { return (QString::fromAscii(s1) <= s2); }
16016 inline __attribute__ ((__deprecated__)) bool operator>=(const char *s1, const QString &s2)
16017 { return (QString::fromAscii(s1) >= s2); }
16018 inline __attribute__ ((__deprecated__)) bool operator==(const char *s1, const QLatin1String &s2)
16019 { return QString::fromAscii(s1) == s2; }
16020 inline __attribute__ ((__deprecated__)) bool operator!=(const char *s1, const QLatin1String &s2)
16021 { return QString::fromAscii(s1) != s2; }
16022 inline __attribute__ ((__deprecated__)) bool operator<(const char *s1, const QLatin1String &s2)
16023 { return (QString::fromAscii(s1) < s2); }
16024 inline __attribute__ ((__deprecated__)) bool operator>(const char *s1, const QLatin1String &s2)
16025 { return (QString::fromAscii(s1) > s2); }
16026 inline __attribute__ ((__deprecated__)) bool operator<=(const char *s1, const QLatin1String &s2)
16027 { return (QString::fromAscii(s1) <= s2); }
16028 inline __attribute__ ((__deprecated__)) bool operator>=(const char *s1, const QLatin1String &s2)
16029 { return (QString::fromAscii(s1) >= s2); }
16030 inline bool operator==(const QLatin1String &s1, const QLatin1String &s2)
16031 { return (qstrcmp(s1.latin1(), s2.latin1()) == 0); }
16032 inline bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
16033 { return (qstrcmp(s1.latin1(), s2.latin1()) != 0); }
16034 inline bool operator<(const QLatin1String &s1, const QLatin1String &s2)
16035 { return (qstrcmp(s1.latin1(), s2.latin1()) < 0); }
16036 inline bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
16037 { return (qstrcmp(s1.latin1(), s2.latin1()) <= 0); }
16038 inline bool operator>(const QLatin1String &s1, const QLatin1String &s2)
16039 { return (qstrcmp(s1.latin1(), s2.latin1()) > 0); }
16040 inline bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
16041 { return (qstrcmp(s1.latin1(), s2.latin1()) >= 0); }
16042 inline bool QString::operator==(const QByteArray &s) const
16043 { return qStringComparisonHelper(*this, s.constData()); }
16044 inline bool QString::operator!=(const QByteArray &s) const
16045 { return !qStringComparisonHelper(*this, s.constData()); }
16046 inline bool QByteArray::operator==(const QString &s) const
16047 { return qStringComparisonHelper(s, constData()); }
16048 inline bool QByteArray::operator!=(const QString &s) const
16049 { return !qStringComparisonHelper(s, constData()); }
16050 inline bool QByteArray::operator<(const QString &s) const
16051 { return QString::fromAscii(constData(), size()) < s; }
16052 inline bool QByteArray::operator>(const QString &s) const
16053 { return QString::fromAscii(constData(), size()) > s; }
16054 inline bool QByteArray::operator<=(const QString &s) const
16055 { return QString::fromAscii(constData(), size()) <= s; }
16056 inline bool QByteArray::operator>=(const QString &s) const
16057 { return QString::fromAscii(constData(), size()) >= s; }
16058 inline const QString operator+(const QString &s1, const QString &s2)
16059 { QString t(s1); t += s2; return t; }
16060 inline const QString operator+(const QString &s1, QChar s2)
16061 { QString t(s1); t += s2; return t; }
16062 inline const QString operator+(QChar s1, const QString &s2)
16063 { QString t(s1); t += s2; return t; }
16064 inline __attribute__ ((__deprecated__)) const QString operator+(const QString &s1, const char *s2)
16065 { QString t(s1); t += QString::fromAscii(s2); return t; }
16066 inline __attribute__ ((__deprecated__)) const QString operator+(const char *s1, const QString &s2)
16067 { QString t = QString::fromAscii(s1); t += s2; return t; }
16068 inline __attribute__ ((__deprecated__)) const QString operator+(char c, const QString &s)
16069 { QString t = s; t.prepend(QChar::fromAscii(c)); return t; }
16070 inline __attribute__ ((__deprecated__)) const QString operator+(const QString &s, char c)
16071 { QString t = s; t += QChar::fromAscii(c); return t; }
16072 inline __attribute__ ((__deprecated__)) const QString operator+(const QByteArray &ba, const QString &s)
16073 { QString t = QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); t += s; return t; }
16074 inline __attribute__ ((__deprecated__)) const QString operator+(const QString &s, const QByteArray &ba)
16075 { QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; }
16076 inline std::string QString::toStdString() const
16077 { const QByteArray asc = toAscii(); return std::string(asc.constData(), asc.length()); }
16078 inline QString QString::fromStdString(const std::string &s)
16079 { return fromAscii(s.data(), int(s.size())); }
16080 inline QStdWString QString::toStdWString() const
16081 {
16082 QStdWString str;
16083 str.resize(length());
16084 str.resize(toWCharArray(&(*str.begin())));
16085 return str;
16086 }
16087 inline QString QString::fromStdWString(const QStdWString &s)
16088 { return fromWCharArray(s.data(), int(s.size())); }
16089 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QString &);
16090 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QString &);
16091 template <> class QTypeInfo<QString> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QString)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QString"; } };
16092 template <> inline bool qIsDetached<QString>(QString &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QString>(QString &value1, QString &value2) { const QString::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
16093 inline QFlags<QString::SectionFlags::enum_type> operator|(QString::SectionFlags::enum_type f1, QString::SectionFlags::enum_type f2) { return QFlags<QString::SectionFlags::enum_type>(f1) | f2; } inline QFlags<QString::SectionFlags::enum_type> operator|(QString::SectionFlags::enum_type f1, QFlags<QString::SectionFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QString::SectionFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
16094 class __attribute__((visibility("default"))) QStringRef {
16095 const QString *m_string;
16096 int m_position;
16097 int m_size;
16098 public:
16099 inline QStringRef():m_string(0), m_position(0), m_size(0){}
16100 inline QStringRef(const QString *string, int position, int size);
16101 inline QStringRef(const QString *string);
16102 inline QStringRef(const QStringRef &other)
16103 :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
16104 {}
16105 inline ~QStringRef(){}
16106 inline const QString *string() const { return m_string; }
16107 inline int position() const { return m_position; }
16108 inline int size() const { return m_size; }
16109 inline int count() const { return m_size; }
16110 inline int length() const { return m_size; }
16111 inline QStringRef &operator=(const QStringRef &other) {
16112 m_string = other.m_string; m_position = other.m_position;
16113 m_size = other.m_size; return *this;
16114 }
16115 inline QStringRef &operator=(const QString *string);
16116 inline const QChar *unicode() const {
16117 if (!m_string)
16118 return reinterpret_cast<const QChar *>(QString::shared_null.data);
16119 return m_string->unicode() + m_position;
16120 }
16121 inline const QChar *data() const { return unicode(); }
16122 inline const QChar *constData() const { return unicode(); }
16123 inline void clear() { m_string = 0; m_position = m_size = 0; }
16124 QString toString() const;
16125 inline bool isEmpty() const { return m_size == 0; }
16126 inline bool isNull() const { return m_string == 0 || m_string->isNull(); }
16127 QStringRef appendTo(QString *string) const;
16128 inline const QChar at(int i) const
16129 { qt_noop(); return m_string->at(i + m_position); }
16130 int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
16131 int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
16132 int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
16133 static int compare(const QStringRef &s1, const QString &s2,
16134 Qt::CaseSensitivity = Qt::CaseSensitive);
16135 static int compare(const QStringRef &s1, const QStringRef &s2,
16136 Qt::CaseSensitivity = Qt::CaseSensitive);
16137 static int compare(const QStringRef &s1, QLatin1String s2,
16138 Qt::CaseSensitivity cs = Qt::CaseSensitive);
16139 int localeAwareCompare(const QString &s) const;
16140 int localeAwareCompare(const QStringRef &s) const;
16141 static int localeAwareCompare(const QStringRef &s1, const QString &s2);
16142 static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
16143 };
16144 inline QStringRef &QStringRef::operator=(const QString *aString)
16145 { m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; }
16146 inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize)
16147 :m_string(aString), m_position(aPosition), m_size(aSize){}
16148 inline QStringRef::QStringRef(const QString *aString)
16149 :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}
16150 __attribute__((visibility("default"))) bool operator==(const QStringRef &s1,const QStringRef &s2);
16151 inline bool operator!=(const QStringRef &s1,const QStringRef &s2)
16152 { return !(s1 == s2); }
16153 __attribute__((visibility("default"))) bool operator==(const QString &s1,const QStringRef &s2);
16154 inline bool operator!=(const QString &s1,const QStringRef &s2)
16155 { return !(s1 == s2); }
16156 inline bool operator==(const QStringRef &s1,const QString &s2)
16157 { return s2 == s1; }
16158 inline bool operator!=(const QStringRef &s1,const QString &s2)
16159 { return s2 != s1; }
16160 __attribute__((visibility("default"))) bool operator==(const QLatin1String &s1, const QStringRef &s2);
16161 inline bool operator!=(const QLatin1String &s1,const QStringRef &s2)
16162 { return !(s1 == s2); }
16163 inline bool operator==(const QStringRef &s1,const QLatin1String &s2)
16164 { return s2 == s1; }
16165 inline bool operator!=(const QStringRef &s1,const QLatin1String &s2)
16166 { return s2 != s1; }
16167 __attribute__((visibility("default"))) bool operator<(const QStringRef &s1,const QStringRef &s2);
16168 inline bool operator>(const QStringRef &s1, const QStringRef &s2)
16169 { return s2 < s1; }
16170 inline bool operator<=(const QStringRef &s1, const QStringRef &s2)
16171 { return !(s1 > s2); }
16172 inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
16173 { return !(s1 < s2); }
16174 inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2)
16175 {
16176 if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
16177 return (s1 == QLatin1String(s2));
16178 }
16179 inline __attribute__ ((__deprecated__)) bool operator==(const char *s1, const QStringRef &s2)
16180 { return qStringComparisonHelper(s2, s1); }
16181 inline __attribute__ ((__deprecated__)) bool operator==(const QStringRef &s1, const char *s2)
16182 { return qStringComparisonHelper(s1, s2); }
16183 inline __attribute__ ((__deprecated__)) bool operator!=(const char *s1, const QStringRef &s2)
16184 { return !qStringComparisonHelper(s2, s1); }
16185 inline __attribute__ ((__deprecated__)) bool operator!=(const QStringRef &s1, const char *s2)
16186 { return !qStringComparisonHelper(s1, s2); }
16187 inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const
16188 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
16189 inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
16190 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
16191 inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const
16192 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
16193 inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const
16194 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
16195 inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const
16196 { return QString::compare_helper(constData(), length(), s, cs); }
16197 inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs)
16198 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
16199 inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
16200 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
16201 inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs)
16202 { return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
16203 inline int QString::localeAwareCompare(const QStringRef &s) const
16204 { return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
16205 inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2)
16206 { return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
16207 inline int QStringRef::localeAwareCompare(const QString &s) const
16208 { return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
16209 inline int QStringRef::localeAwareCompare(const QStringRef &s) const
16210 { return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
16211 inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s2)
16212 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
16213 inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2)
16214 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
16215 typedef QtValidLicenseForCoreModule QtCoreModule;
16216 class QEvent;
16217 class QTimerEvent;
16218 class QChildEvent;
16219 struct QMetaObject;
16220 class QVariant;
16221 class QObjectPrivate;
16222 class QObject;
16223 class QThread;
16224 class QWidget;
16225 class QRegExp;
16226 class QObjectUserData;
16227 typedef QList<QObject*> QObjectList;
16228 template<typename T> inline T qFindChild(const QObject *, const QString & = QString());
16229 template<typename T> inline QList<T> qFindChildren(const QObject *, const QString & = QString());
16230 template<typename T> inline QList<T> qFindChildren(const QObject *, const QRegExp &);
16231 class QObjectData {
16232 public:
16233 virtual ~QObjectData() = 0;
16234 QObject *q_ptr;
16235 QObject *parent;
16236 QObjectList children;
16237 uint isWidget : 1;
16238 uint pendTimer : 1;
16239 uint blockSig : 1;
16240 uint wasDeleted : 1;
16241 uint ownObjectName : 1;
16242 uint sendChildEvents : 1;
16243 uint receiveChildEvents : 1;
16244 uint inEventHandler : 1;
16245 uint inThreadChangeEvent : 1;
16246 uint unused : 23;
16247 int postedEvents;
16248 };
16249 class __attribute__((visibility("default"))) QObject
16250 {
16251 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
16252 inline QObjectPrivate* d_func() { return reinterpret_cast<QObjectPrivate *>(d_ptr); } inline const QObjectPrivate* d_func() const { return reinterpret_cast<const QObjectPrivate *>(d_ptr); } friend class QObjectPrivate;
16253 public:
16254 explicit QObject(QObject *parent=0);
16255 virtual ~QObject();
16256 virtual bool event(QEvent *);
16257 virtual bool eventFilter(QObject *, QEvent *);
16258 QString objectName() const;
16259 void setObjectName(const QString &name);
16260 inline bool isWidgetType() const { return d_ptr->isWidget; }
16261 inline bool signalsBlocked() const { return d_ptr->blockSig; }
16262 bool blockSignals(bool b);
16263 QThread *thread() const;
16264 void moveToThread(QThread *thread);
16265 int startTimer(int interval);
16266 void killTimer(int id);
16267 template<typename T>
16268 inline T findChild(const QString &aName = QString()) const
16269 { return qFindChild<T>(this, aName); }
16270 template<typename T>
16271 inline QList<T> findChildren(const QString &aName = QString()) const
16272 { return qFindChildren<T>(this, aName); }
16273 template<typename T>
16274 inline QList<T> findChildren(const QRegExp &re) const
16275 { return qFindChildren<T>(this, re); }
16276 inline const QObjectList &children() const { return d_ptr->children; }
16277 void setParent(QObject *);
16278 void installEventFilter(QObject *);
16279 void removeEventFilter(QObject *);
16280 static bool connect(const QObject *sender, const char *signal,
16281 const QObject *receiver, const char *member, Qt::ConnectionType =
16282 Qt::AutoConnection
16283 );
16284 inline bool connect(const QObject *sender, const char *signal,
16285 const char *member, Qt::ConnectionType type =
16286 Qt::AutoConnection
16287 ) const;
16288 static bool disconnect(const QObject *sender, const char *signal,
16289 const QObject *receiver, const char *member);
16290 inline bool disconnect(const char *signal = 0,
16291 const QObject *receiver = 0, const char *member = 0)
16292 { return disconnect(this, signal, receiver, member); }
16293 inline bool disconnect(const QObject *receiver, const char *member = 0)
16294 { return disconnect(this, 0, receiver, member); }
16295 void dumpObjectTree();
16296 void dumpObjectInfo();
16297 bool setProperty(const char *name, const QVariant &value);
16298 QVariant property(const char *name) const;
16299 QList<QByteArray> dynamicPropertyNames() const;
16300 static uint registerUserData();
16301 void setUserData(uint id, QObjectUserData* data);
16302 QObjectUserData* userData(uint id) const;
16303 protected:
16304 void destroyed(QObject * = 0);
16305 public:
16306 inline QObject *parent() const { return d_ptr->parent; }
16307 inline bool inherits(const char *classname) const
16308 { return const_cast<QObject *>(this)->qt_metacast(classname) != 0; }
16309 public :
16310 void deleteLater();
16311 protected:
16312 QObject *sender() const;
16313 int receivers(const char* signal) const;
16314 virtual void timerEvent(QTimerEvent *);
16315 virtual void childEvent(QChildEvent *);
16316 virtual void customEvent(QEvent *);
16317 virtual void connectNotify(const char *signal);
16318 virtual void disconnectNotify(const char *signal);
16319 protected:
16320 QObject(QObjectPrivate &dd, QObject *parent = 0);
16321 protected:
16322 QObjectData *d_ptr;
16323 static const QMetaObject staticQtMetaObject;
16324 friend struct QMetaObject;
16325 friend class QApplication;
16326 friend class QApplicationPrivate;
16327 friend class QCoreApplication;
16328 friend class QCoreApplicationPrivate;
16329 friend class QWidget;
16330 friend class QThreadData;
16331 private:
16332 QObject(const QObject &); QObject &operator=(const QObject &);
16333 };
16334 inline bool QObject::connect(const QObject *asender, const char *asignal,
16335 const char *amember, Qt::ConnectionType atype) const
16336 { return connect(asender, asignal, this, amember, atype); }
16337 class __attribute__((visibility("default"))) QObjectUserData {
16338 public:
16339 virtual ~QObjectUserData();
16340 };
16341 __attribute__((visibility("default"))) void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
16342 const QMetaObject &mo, QList<void *> *list);
16343 __attribute__((visibility("default"))) QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo);
16344 template<typename T>
16345 inline T qFindChild(const QObject *o, const QString &name)
16346 { return static_cast<T>(qt_qFindChild_helper(o, name, reinterpret_cast<T>(0)->staticMetaObject)); }
16347 template<typename T>
16348 inline QList<T> qFindChildren(const QObject *o, const QString &name)
16349 {
16350 QList<T> list;
16351 union {
16352 QList<T> *typedList;
16353 QList<void *> *voidList;
16354 } u;
16355 u.typedList = &list;
16356 qt_qFindChildren_helper(o, name, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList);
16357 return list;
16358 }
16359 template<typename T>
16360 inline QList<T> qFindChildren(const QObject *o, const QRegExp &re)
16361 {
16362 QList<T> list;
16363 union {
16364 QList<T> *typedList;
16365 QList<void *> *voidList;
16366 } u;
16367 u.typedList = &list;
16368 qt_qFindChildren_helper(o, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList);
16369 return list;
16370 }
16371 template <class T>
16372 inline T qobject_cast(QObject *object)
16373 {
16374 reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(object));
16375 return static_cast<T>(reinterpret_cast<T>(0)->staticMetaObject.cast(object));
16376 }
16377 template <class T>
16378 inline T qobject_cast(const QObject *object)
16379 {
16380 register T ptr = static_cast<T>(object);
16381 (void)ptr;;
16382 reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(const_cast<QObject *>(object)));
16383 return static_cast<T>(const_cast<QObject *>(reinterpret_cast<T>(0)->staticMetaObject.cast(const_cast<QObject *>(object))));
16384 }
16385 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QObject *);
16386 typedef QtValidLicenseForCoreModule QtCoreModule;
16387 class QByteArray;
16388 class QIODevicePrivate;
16389 class __attribute__((visibility("default"))) QIODevice
16390 : public QObject
16391 {
16392 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
16393 public:
16394 enum OpenModeFlag {
16395 NotOpen = 0x0000,
16396 ReadOnly = 0x0001,
16397 WriteOnly = 0x0002,
16398 ReadWrite = ReadOnly | WriteOnly,
16399 Append = 0x0004,
16400 Truncate = 0x0008,
16401 Text = 0x0010,
16402 Unbuffered = 0x0020
16403 };
16404 typedef QFlags<OpenModeFlag> OpenMode;
16405 QIODevice();
16406 explicit QIODevice(QObject *parent);
16407 virtual ~QIODevice();
16408 OpenMode openMode() const;
16409 void setTextModeEnabled(bool enabled);
16410 bool isTextModeEnabled() const;
16411 bool isOpen() const;
16412 bool isReadable() const;
16413 bool isWritable() const;
16414 virtual bool isSequential() const;
16415 virtual bool open(OpenMode mode);
16416 virtual void close();
16417 virtual qint64 pos() const;
16418 virtual qint64 size() const;
16419 virtual bool seek(qint64 pos);
16420 virtual bool atEnd() const;
16421 virtual bool reset();
16422 virtual qint64 bytesAvailable() const;
16423 virtual qint64 bytesToWrite() const;
16424 qint64 read(char *data, qint64 maxlen);
16425 QByteArray read(qint64 maxlen);
16426 QByteArray readAll();
16427 qint64 readLine(char *data, qint64 maxlen);
16428 QByteArray readLine(qint64 maxlen = 0);
16429 virtual bool canReadLine() const;
16430 qint64 write(const char *data, qint64 len);
16431 qint64 write(const char *data);
16432 inline qint64 write(const QByteArray &data)
16433 { return write(data.constData(), data.size()); }
16434 qint64 peek(char *data, qint64 maxlen);
16435 QByteArray peek(qint64 maxlen);
16436 virtual bool waitForReadyRead(int msecs);
16437 virtual bool waitForBytesWritten(int msecs);
16438 void ungetChar(char c);
16439 bool putChar(char c);
16440 bool getChar(char *c);
16441 QString errorString() const;
16442 protected:
16443 void readyRead();
16444 void bytesWritten(qint64 bytes);
16445 void aboutToClose();
16446 void readChannelFinished();
16447 protected:
16448 QIODevice(QIODevicePrivate &dd, QObject *parent = 0);
16449 virtual qint64 readData(char *data, qint64 maxlen) = 0;
16450 virtual qint64 readLineData(char *data, qint64 maxlen);
16451 virtual qint64 writeData(const char *data, qint64 len) = 0;
16452 void setOpenMode(OpenMode openMode);
16453 void setErrorString(const QString &errorString);
16454 private:
16455 inline QIODevicePrivate* d_func() { return reinterpret_cast<QIODevicePrivate *>(d_ptr); } inline const QIODevicePrivate* d_func() const { return reinterpret_cast<const QIODevicePrivate *>(d_ptr); } friend class QIODevicePrivate;
16456 QIODevice(const QIODevice &); QIODevice &operator=(const QIODevice &);
16457 };
16458 inline QFlags<QIODevice::OpenMode::enum_type> operator|(QIODevice::OpenMode::enum_type f1, QIODevice::OpenMode::enum_type f2) { return QFlags<QIODevice::OpenMode::enum_type>(f1) | f2; } inline QFlags<QIODevice::OpenMode::enum_type> operator|(QIODevice::OpenMode::enum_type f1, QFlags<QIODevice::OpenMode::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QIODevice::OpenMode::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
16459 class QDebug;
16460 __attribute__((visibility("default"))) QDebug operator<<(QDebug debug, QIODevice::OpenMode modes);
16461 typedef QtValidLicenseForCoreModule QtCoreModule;
16462 class QByteArray;
16463 class QIODevice;
16464 template <typename T> class QList;
16465 template <typename T> class QLinkedList;
16466 template <typename T> class QVector;
16467 template <typename T> class QSet;
16468 template <class Key, class T> class QHash;
16469 template <class Key, class T> class QMap;
16470 class QDataStreamPrivate;
16471 class __attribute__((visibility("default"))) QDataStream
16472 {
16473 public:
16474 enum Version {
16475 Qt_1_0 = 1,
16476 Qt_2_0 = 2,
16477 Qt_2_1 = 3,
16478 Qt_3_0 = 4,
16479 Qt_3_1 = 5,
16480 Qt_3_3 = 6,
16481 Qt_4_0 = 7,
16482 Qt_4_1 = Qt_4_0,
16483 Qt_4_2 = 8,
16484 Qt_4_3 = 9,
16485 Qt_4_4 = 10,
16486 Qt_4_5 = 11
16487 };
16488 enum ByteOrder {
16489 BigEndian = QSysInfo::BigEndian,
16490 LittleEndian = QSysInfo::LittleEndian
16491 };
16492 enum Status {
16493 Ok,
16494 ReadPastEnd,
16495 ReadCorruptData
16496 };
16497 QDataStream();
16498 explicit QDataStream(QIODevice *);
16499 QDataStream(QByteArray *, QIODevice::OpenMode flags);
16500 QDataStream(const QByteArray &);
16501 virtual ~QDataStream();
16502 QIODevice *device() const;
16503 void setDevice(QIODevice *);
16504 void unsetDevice();
16505 bool atEnd() const;
16506 Status status() const;
16507 void setStatus(Status status);
16508 void resetStatus();
16509 ByteOrder byteOrder() const;
16510 void setByteOrder(ByteOrder);
16511 int version() const;
16512 void setVersion(int);
16513 QDataStream &operator>>(qint8 &i);
16514 QDataStream &operator>>(quint8 &i);
16515 QDataStream &operator>>(qint16 &i);
16516 QDataStream &operator>>(quint16 &i);
16517 QDataStream &operator>>(qint32 &i);
16518 QDataStream &operator>>(quint32 &i);
16519 QDataStream &operator>>(qint64 &i);
16520 QDataStream &operator>>(quint64 &i);
16521 QDataStream &operator>>(bool &i);
16522 QDataStream &operator>>(float &f);
16523 QDataStream &operator>>(double &f);
16524 QDataStream &operator>>(char *&str);
16525 QDataStream &operator<<(qint8 i);
16526 QDataStream &operator<<(quint8 i);
16527 QDataStream &operator<<(qint16 i);
16528 QDataStream &operator<<(quint16 i);
16529 QDataStream &operator<<(qint32 i);
16530 QDataStream &operator<<(quint32 i);
16531 QDataStream &operator<<(qint64 i);
16532 QDataStream &operator<<(quint64 i);
16533 QDataStream &operator<<(bool i);
16534 QDataStream &operator<<(float f);
16535 QDataStream &operator<<(double f);
16536 QDataStream &operator<<(const char *str);
16537 QDataStream &readBytes(char *&, uint &len);
16538 int readRawData(char *, int len);
16539 QDataStream &writeBytes(const char *, uint len);
16540 int writeRawData(const char *, int len);
16541 int skipRawData(int len);
16542 private:
16543 QDataStream(const QDataStream &); QDataStream &operator=(const QDataStream &);
16544 QDataStreamPrivate *d;
16545 QIODevice *dev;
16546 bool owndev;
16547 bool noswap;
16548 ByteOrder byteorder;
16549 int ver;
16550 Status q_status;
16551 };
16552 inline QIODevice *QDataStream::device() const
16553 { return dev; }
16554 inline QDataStream::ByteOrder QDataStream::byteOrder() const
16555 { return byteorder; }
16556 inline int QDataStream::version() const
16557 { return ver; }
16558 inline void QDataStream::setVersion(int v)
16559 { ver = v; }
16560 inline QDataStream &QDataStream::operator>>(quint8 &i)
16561 { return *this >> reinterpret_cast<qint8&>(i); }
16562 inline QDataStream &QDataStream::operator>>(quint16 &i)
16563 { return *this >> reinterpret_cast<qint16&>(i); }
16564 inline QDataStream &QDataStream::operator>>(quint32 &i)
16565 { return *this >> reinterpret_cast<qint32&>(i); }
16566 inline QDataStream &QDataStream::operator>>(quint64 &i)
16567 { return *this >> reinterpret_cast<qint64&>(i); }
16568 inline QDataStream &QDataStream::operator<<(quint8 i)
16569 { return *this << qint8(i); }
16570 inline QDataStream &QDataStream::operator<<(quint16 i)
16571 { return *this << qint16(i); }
16572 inline QDataStream &QDataStream::operator<<(quint32 i)
16573 { return *this << qint32(i); }
16574 inline QDataStream &QDataStream::operator<<(quint64 i)
16575 { return *this << qint64(i); }
16576 template <typename T>
16577 QDataStream& operator>>(QDataStream& s, QList<T>& l)
16578 {
16579 l.clear();
16580 quint32 c;
16581 s >> c;
16582 for(quint32 i = 0; i < c; ++i)
16583 {
16584 T t;
16585 s >> t;
16586 l.append(t);
16587 if (s.atEnd())
16588 break;
16589 }
16590 return s;
16591 }
16592 template <typename T>
16593 QDataStream& operator<<(QDataStream& s, const QList<T>& l)
16594 {
16595 s << quint32(l.size());
16596 for (int i = 0; i < l.size(); ++i)
16597 s << l.at(i);
16598 return s;
16599 }
16600 template <typename T>
16601 QDataStream& operator>>(QDataStream& s, QLinkedList<T>& l)
16602 {
16603 l.clear();
16604 quint32 c;
16605 s >> c;
16606 for(quint32 i = 0; i < c; ++i)
16607 {
16608 T t;
16609 s >> t;
16610 l.append(t);
16611 if (s.atEnd())
16612 break;
16613 }
16614 return s;
16615 }
16616 template <typename T>
16617 QDataStream& operator<<(QDataStream& s, const QLinkedList<T>& l)
16618 {
16619 s << quint32(l.size());
16620 typename QLinkedList<T>::ConstIterator it = l.constBegin();
16621 for(; it != l.constEnd(); ++it)
16622 s << *it;
16623 return s;
16624 }
16625 template<typename T>
16626 QDataStream& operator>>(QDataStream& s, QVector<T>& v)
16627 {
16628 v.clear();
16629 quint32 c;
16630 s >> c;
16631 v.resize(c);
16632 for(quint32 i = 0; i < c; ++i) {
16633 T t;
16634 s >> t;
16635 v[i] = t;
16636 }
16637 return s;
16638 }
16639 template<typename T>
16640 QDataStream& operator<<(QDataStream& s, const QVector<T>& v)
16641 {
16642 s << quint32(v.size());
16643 for (typename QVector<T>::const_iterator it = v.begin(); it != v.end(); ++it)
16644 s << *it;
16645 return s;
16646 }
16647 template <typename T>
16648 QDataStream &operator>>(QDataStream &in, QSet<T> &set)
16649 {
16650 set.clear();
16651 quint32 c;
16652 in >> c;
16653 for (quint32 i = 0; i < c; ++i) {
16654 T t;
16655 in >> t;
16656 set << t;
16657 if (in.atEnd())
16658 break;
16659 }
16660 return in;
16661 }
16662 template <typename T>
16663 QDataStream& operator<<(QDataStream &out, const QSet<T> &set)
16664 {
16665 out << quint32(set.size());
16666 typename QSet<T>::const_iterator i = set.constBegin();
16667 while (i != set.constEnd()) {
16668 out << *i;
16669 ++i;
16670 }
16671 return out;
16672 }
16673 template <class Key, class T>
16674 QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash)
16675 {
16676 QDataStream::Status oldStatus = in.status();
16677 in.resetStatus();
16678 hash.clear();
16679 quint32 n;
16680 in >> n;
16681 for (quint32 i = 0; i < n; ++i) {
16682 if (in.status() != QDataStream::Ok)
16683 break;
16684 Key k;
16685 T t;
16686 in >> k >> t;
16687 hash.insertMulti(k, t);
16688 }
16689 if (in.status() != QDataStream::Ok)
16690 hash.clear();
16691 if (oldStatus != QDataStream::Ok)
16692 in.setStatus(oldStatus);
16693 return in;
16694 }
16695 template <class Key, class T>
16696 QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)
16697 {
16698 out << quint32(hash.size());
16699 typename QHash<Key, T>::ConstIterator it = hash.end();
16700 typename QHash<Key, T>::ConstIterator begin = hash.begin();
16701 while (it != begin) {
16702 --it;
16703 out << it.key() << it.value();
16704 }
16705 return out;
16706 }
16707 template <class aKey, class aT>
16708 QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &map)
16709 {
16710 QDataStream::Status oldStatus = in.status();
16711 in.resetStatus();
16712 map.clear();
16713 quint32 n;
16714 in >> n;
16715 map.detach();
16716 map.setInsertInOrder(true);
16717 for (quint32 i = 0; i < n; ++i) {
16718 if (in.status() != QDataStream::Ok)
16719 break;
16720 aKey key;
16721 aT value;
16722 in >> key >> value;
16723 map.insertMulti(key, value);
16724 }
16725 map.setInsertInOrder(false);
16726 if (in.status() != QDataStream::Ok)
16727 map.clear();
16728 if (oldStatus != QDataStream::Ok)
16729 in.setStatus(oldStatus);
16730 return in;
16731 }
16732 template <class Key, class T>
16733 QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map)
16734 {
16735 out << quint32(map.size());
16736 typename QMap<Key, T>::ConstIterator it = map.end();
16737 typename QMap<Key, T>::ConstIterator begin = map.begin();
16738 while (it != begin) {
16739 --it;
16740 out << it.key() << it.value();
16741 }
16742 return out;
16743 }
16744 typedef QtValidLicenseForCoreModule QtCoreModule;
16745 template <class T1, class T2>
16746 struct QPair
16747 {
16748 typedef T1 first_type;
16749 typedef T2 second_type;
16750 QPair() : first(T1()), second(T2()) {}
16751 QPair(const T1 &t1, const T2 &t2) : first(t1), second(t2) {}
16752 QPair<T1, T2> &operator=(const QPair<T1, T2> &other)
16753 { first = other.first; second = other.second; return *this; }
16754 T1 first;
16755 T2 second;
16756 };
16757 template <class T1, class T2>
16758 inline bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16759 { return p1.first == p2.first && p1.second == p2.second; }
16760 template <class T1, class T2>
16761 inline bool operator!=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16762 { return !(p1 == p2); }
16763 template <class T1, class T2>
16764 inline bool operator<(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16765 {
16766 return p1.first < p2.first || (!(p2.first < p1.first) && p1.second < p2.second);
16767 }
16768 template <class T1, class T2>
16769 inline bool operator>(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16770 {
16771 return p2 < p1;
16772 }
16773 template <class T1, class T2>
16774 inline bool operator<=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16775 {
16776 return !(p2 < p1);
16777 }
16778 template <class T1, class T2>
16779 inline bool operator>=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
16780 {
16781 return !(p1 < p2);
16782 }
16783 template <class T1, class T2>
16784 QPair<T1, T2> qMakePair(const T1 &x, const T2 &y)
16785 {
16786 return QPair<T1, T2>(x, y);
16787 }
16788 template <class T1, class T2>
16789 inline QDataStream& operator>>(QDataStream& s, QPair<T1, T2>& p)
16790 {
16791 s >> p.first >> p.second;
16792 return s;
16793 }
16794 template <class T1, class T2>
16795 inline QDataStream& operator<<(QDataStream& s, const QPair<T1, T2>& p)
16796 {
16797 s << p.first << p.second;
16798 return s;
16799 }
16800 typedef QtValidLicenseForCoreModule QtCoreModule;
16801 class QBitArray;
16802 class QByteArray;
16803 class QString;
16804 class QStringRef;
16805 inline uint qHash(char key) { return uint(key); }
16806 inline uint qHash(uchar key) { return uint(key); }
16807 inline uint qHash(signed char key) { return uint(key); }
16808 inline uint qHash(ushort key) { return uint(key); }
16809 inline uint qHash(short key) { return uint(key); }
16810 inline uint qHash(uint key) { return key; }
16811 inline uint qHash(int key) { return uint(key); }
16812 inline uint qHash(ulong key)
16813 {
16814 if (sizeof(ulong) > sizeof(uint)) {
16815 return uint((key >> (8 * sizeof(uint) - 1)) ^ key);
16816 } else {
16817 return uint(key);
16818 }
16819 }
16820 inline uint qHash(long key) { return qHash(ulong(key)); }
16821 inline uint qHash(quint64 key)
16822 {
16823 if (sizeof(quint64) > sizeof(uint)) {
16824 return uint((key >> (8 * sizeof(uint) - 1)) ^ key);
16825 } else {
16826 return uint(key);
16827 }
16828 }
16829 inline uint qHash(qint64 key) { return qHash(quint64(key)); }
16830 inline uint qHash(QChar key) { return qHash(key.unicode()); }
16831 __attribute__((visibility("default"))) uint qHash(const QByteArray &key);
16832 __attribute__((visibility("default"))) uint qHash(const QString &key);
16833 __attribute__((visibility("default"))) uint qHash(const QStringRef &key);
16834 __attribute__((visibility("default"))) uint qHash(const QBitArray &key);
16835 template <class T> inline uint qHash(const T *key)
16836 {
16837 if (sizeof(const T *) > sizeof(uint))
16838 return qHash(reinterpret_cast<quint64>(key));
16839 else
16840 return uint(reinterpret_cast<ulong>(key));
16841 }
16842 template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key)
16843 {
16844 uint h1 = qHash(key.first);
16845 uint h2 = qHash(key.second);
16846 return ((h1 << 16) | (h1 >> 16)) ^ h2;
16847 }
16848 struct __attribute__((visibility("default"))) QHashData
16849 {
16850 struct Node {
16851 Node *next;
16852 uint h;
16853 };
16854 Node *fakeNext;
16855 Node **buckets;
16856 QBasicAtomicInt ref;
16857 int size;
16858 int nodeSize;
16859 short userNumBits;
16860 short numBits;
16861 int numBuckets;
16862 uint sharable : 1;
16863 void *allocateNode();
16864 void freeNode(void *node);
16865 QHashData *detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize);
16866 void mightGrow();
16867 bool willGrow();
16868 void hasShrunk();
16869 void rehash(int hint);
16870 void destroyAndFree();
16871 Node *firstNode();
16872 static Node *nextNode(Node *node);
16873 static Node *previousNode(Node *node);
16874 static QHashData shared_null;
16875 };
16876 inline void QHashData::mightGrow()
16877 {
16878 if (size >= numBuckets)
16879 rehash(numBits + 1);
16880 }
16881 inline bool QHashData::willGrow()
16882 {
16883 if (size >= numBuckets) {
16884 rehash(numBits + 1);
16885 return true;
16886 } else {
16887 return false;
16888 }
16889 }
16890 inline void QHashData::hasShrunk()
16891 {
16892 if (size <= (numBuckets >> 3) && numBits > userNumBits)
16893 rehash(qMax(int(numBits) - 2, int(userNumBits)));
16894 }
16895 inline QHashData::Node *QHashData::firstNode()
16896 {
16897 Node *e = reinterpret_cast<Node *>(this);
16898 Node **bucket = buckets;
16899 int n = numBuckets;
16900 while (n--) {
16901 if (*bucket != e)
16902 return *bucket;
16903 ++bucket;
16904 }
16905 return e;
16906 }
16907 struct QHashDummyValue
16908 {
16909 };
16910 inline bool operator==(const QHashDummyValue & , const QHashDummyValue & )
16911 {
16912 return true;
16913 }
16914 template <> class QTypeInfo<QHashDummyValue> { public: enum { isComplex = (((Q_MOVABLE_TYPE | Q_DUMMY_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE | Q_DUMMY_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QHashDummyValue)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE | Q_DUMMY_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QHashDummyValue"; } };
16915 template <class Key, class T>
16916 struct QHashDummyNode
16917 {
16918 QHashDummyNode *next;
16919 uint h;
16920 Key key;
16921 inline QHashDummyNode(const Key &key0) : key(key0) {}
16922 };
16923 template <class Key, class T>
16924 struct QHashNode
16925 {
16926 QHashNode *next;
16927 uint h;
16928 Key key;
16929 T value;
16930 inline QHashNode(const Key &key0) : key(key0) {}
16931 inline QHashNode(const Key &key0, const T &value0) : key(key0), value(value0) {}
16932 inline bool same_key(uint h0, const Key &key0) { return h0 == h && key0 == key; }
16933 };
16934 template <class T> struct QHashDummyNode<short, T> { QHashDummyNode *next; union { uint h; short key; }; inline QHashDummyNode(short ) {} }; template <class T> struct QHashNode<short, T> { QHashNode *next; union { uint h; short key; }; T value; inline QHashNode(short ) {} inline QHashNode(short , const T &value0) : value(value0) {} inline bool same_key(uint h0, short) { return h0 == h; } };
16935 template <class T> struct QHashDummyNode<ushort, T> { QHashDummyNode *next; union { uint h; ushort key; }; inline QHashDummyNode(ushort ) {} }; template <class T> struct QHashNode<ushort, T> { QHashNode *next; union { uint h; ushort key; }; T value; inline QHashNode(ushort ) {} inline QHashNode(ushort , const T &value0) : value(value0) {} inline bool same_key(uint h0, ushort) { return h0 == h; } };
16936 template <class T> struct QHashDummyNode<int, T> { QHashDummyNode *next; union { uint h; int key; }; inline QHashDummyNode(int ) {} }; template <class T> struct QHashNode<int, T> { QHashNode *next; union { uint h; int key; }; T value; inline QHashNode(int ) {} inline QHashNode(int , const T &value0) : value(value0) {} inline bool same_key(uint h0, int) { return h0 == h; } };
16937 template <class T> struct QHashDummyNode<uint, T> { QHashDummyNode *next; union { uint h; uint key; }; inline QHashDummyNode(uint ) {} }; template <class T> struct QHashNode<uint, T> { QHashNode *next; union { uint h; uint key; }; T value; inline QHashNode(uint ) {} inline QHashNode(uint , const T &value0) : value(value0) {} inline bool same_key(uint h0, uint) { return h0 == h; } };
16938 template <class Key, class T>
16939 class QHash
16940 {
16941 typedef QHashDummyNode<Key, T> DummyNode;
16942 typedef QHashNode<Key, T> Node;
16943 union {
16944 QHashData *d;
16945 QHashNode<Key, T> *e;
16946 };
16947 static inline Node *concrete(QHashData::Node *node) {
16948 return reinterpret_cast<Node *>(node);
16949 }
16950 public:
16951 inline QHash() : d(&QHashData::shared_null) { d->ref.ref(); }
16952 inline QHash(const QHash<Key, T> &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); }
16953 inline ~QHash() { if (!d->ref.deref()) freeData(d); }
16954 QHash<Key, T> &operator=(const QHash<Key, T> &other);
16955 bool operator==(const QHash<Key, T> &other) const;
16956 inline bool operator!=(const QHash<Key, T> &other) const { return !(*this == other); }
16957 inline int size() const { return d->size; }
16958 inline bool isEmpty() const { return d->size == 0; }
16959 inline int capacity() const { return d->numBuckets; }
16960 void reserve(int size);
16961 inline void squeeze() { reserve(1); }
16962 inline void detach() { if (d->ref != 1) detach_helper(); }
16963 inline bool isDetached() const { return d->ref == 1; }
16964 inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
16965 void clear();
16966 int remove(const Key &key);
16967 T take(const Key &key);
16968 bool contains(const Key &key) const;
16969 const Key key(const T &value) const;
16970 const Key key(const T &value, const Key &defaultKey) const;
16971 const T value(const Key &key) const;
16972 const T value(const Key &key, const T &defaultValue) const;
16973 T &operator[](const Key &key);
16974 const T operator[](const Key &key) const;
16975 QList<Key> uniqueKeys() const;
16976 QList<Key> keys() const;
16977 QList<Key> keys(const T &value) const;
16978 QList<T> values() const;
16979 QList<T> values(const Key &key) const;
16980 int count(const Key &key) const;
16981 class const_iterator;
16982 class iterator
16983 {
16984 friend class const_iterator;
16985 QHashData::Node *i;
16986 public:
16987 typedef std::bidirectional_iterator_tag iterator_category;
16988 typedef ptrdiff_t difference_type;
16989 typedef T value_type;
16990 typedef T *pointer;
16991 typedef T &reference;
16992 inline operator Node *() const { return concrete(i); }
16993 inline iterator() : i(0) { }
16994 explicit inline iterator(void *node) : i(reinterpret_cast<QHashData::Node *>(node)) { }
16995 inline const Key &key() const { return concrete(i)->key; }
16996 inline T &value() const { return concrete(i)->value; }
16997 inline T &operator*() const { return concrete(i)->value; }
16998 inline T *operator->() const { return &concrete(i)->value; }
16999 inline bool operator==(const iterator &o) const { return i == o.i; }
17000 inline bool operator!=(const iterator &o) const { return i != o.i; }
17001 inline iterator &operator++() {
17002 i = QHashData::nextNode(i);
17003 return *this;
17004 }
17005 inline iterator operator++(int) {
17006 iterator r = *this;
17007 i = QHashData::nextNode(i);
17008 return r;
17009 }
17010 inline iterator &operator--() {
17011 i = QHashData::previousNode(i);
17012 return *this;
17013 }
17014 inline iterator operator--(int) {
17015 iterator r = *this;
17016 i = QHashData::previousNode(i);
17017 return r;
17018 }
17019 inline iterator operator+(int j) const
17020 { iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
17021 inline iterator operator-(int j) const { return operator+(-j); }
17022 inline iterator &operator+=(int j) { return *this = *this + j; }
17023 inline iterator &operator-=(int j) { return *this = *this - j; }
17024 public:
17025 inline bool operator==(const const_iterator &o) const
17026 { return i == o.i; }
17027 inline bool operator!=(const const_iterator &o) const
17028 { return i != o.i; }
17029 private:
17030 inline operator bool() const { return false; }
17031 };
17032 friend class iterator;
17033 class const_iterator
17034 {
17035 friend class iterator;
17036 QHashData::Node *i;
17037 public:
17038 typedef std::bidirectional_iterator_tag iterator_category;
17039 typedef ptrdiff_t difference_type;
17040 typedef T value_type;
17041 typedef const T *pointer;
17042 typedef const T &reference;
17043 inline operator Node *() const { return concrete(i); }
17044 inline const_iterator() : i(0) { }
17045 explicit inline const_iterator(void *node)
17046 : i(reinterpret_cast<QHashData::Node *>(node)) { }
17047 inline const_iterator(const iterator &o)
17048 { i = o.i; }
17049 inline const Key &key() const { return concrete(i)->key; }
17050 inline const T &value() const { return concrete(i)->value; }
17051 inline const T &operator*() const { return concrete(i)->value; }
17052 inline const T *operator->() const { return &concrete(i)->value; }
17053 inline bool operator==(const const_iterator &o) const { return i == o.i; }
17054 inline bool operator!=(const const_iterator &o) const { return i != o.i; }
17055 inline const_iterator &operator++() {
17056 i = QHashData::nextNode(i);
17057 return *this;
17058 }
17059 inline const_iterator operator++(int) {
17060 const_iterator r = *this;
17061 i = QHashData::nextNode(i);
17062 return r;
17063 }
17064 inline const_iterator &operator--() {
17065 i = QHashData::previousNode(i);
17066 return *this;
17067 }
17068 inline const_iterator operator--(int) {
17069 const_iterator r = *this;
17070 i = QHashData::previousNode(i);
17071 return r;
17072 }
17073 inline const_iterator operator+(int j) const
17074 { const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
17075 inline const_iterator operator-(int j) const { return operator+(-j); }
17076 inline const_iterator &operator+=(int j) { return *this = *this + j; }
17077 inline const_iterator &operator-=(int j) { return *this = *this - j; }
17078 private:
17079 inline operator bool() const { return false; }
17080 };
17081 friend class const_iterator;
17082 inline iterator begin() { detach(); return iterator(d->firstNode()); }
17083 inline const_iterator begin() const { return const_iterator(d->firstNode()); }
17084 inline const_iterator constBegin() const { return const_iterator(d->firstNode()); }
17085 inline iterator end() { detach(); return iterator(e); }
17086 inline const_iterator end() const { return const_iterator(e); }
17087 inline const_iterator constEnd() const { return const_iterator(e); }
17088 iterator erase(iterator it);
17089 typedef iterator Iterator;
17090 typedef const_iterator ConstIterator;
17091 inline int count() const { return d->size; }
17092 iterator find(const Key &key);
17093 const_iterator find(const Key &key) const;
17094 const_iterator constFind(const Key &key) const;
17095 iterator insert(const Key &key, const T &value);
17096 iterator insertMulti(const Key &key, const T &value);
17097 QHash<Key, T> &unite(const QHash<Key, T> &other);
17098 typedef T mapped_type;
17099 typedef Key key_type;
17100 typedef ptrdiff_t difference_type;
17101 typedef int size_type;
17102 inline bool empty() const { return isEmpty(); }
17103 private:
17104 void detach_helper();
17105 void freeData(QHashData *d);
17106 Node **findNode(const Key &key, uint *hp = 0) const;
17107 Node *createNode(uint h, const Key &key, const T &value, Node **nextNode);
17108 void deleteNode(Node *node);
17109 static void duplicateNode(QHashData::Node *originalNode, void *newNode);
17110 };
17111 template <class Key, class T>
17112 inline void QHash<Key, T>::deleteNode(Node *node)
17113 {
17114 node->~Node();
17115 d->freeNode(node);
17116 }
17117 template <class Key, class T>
17118 inline void QHash<Key, T>::duplicateNode(QHashData::Node *node, void *newNode)
17119 {
17120 Node *concreteNode = concrete(node);
17121 if (QTypeInfo<T>::isDummy) {
17122 (void) new (newNode) DummyNode(concreteNode->key);
17123 } else {
17124 (void) new (newNode) Node(concreteNode->key, concreteNode->value);
17125 }
17126 }
17127 template <class Key, class T>
17128 inline typename QHash<Key, T>::Node *
17129 QHash<Key, T>::createNode(uint ah, const Key &akey, const T &avalue, Node **anextNode)
17130 {
17131 Node *node;
17132 if (QTypeInfo<T>::isDummy) {
17133 node = reinterpret_cast<Node *>(new (d->allocateNode()) DummyNode(akey));
17134 } else {
17135 node = new (d->allocateNode()) Node(akey, avalue);
17136 }
17137 node->h = ah;
17138 node->next = *anextNode;
17139 *anextNode = node;
17140 ++d->size;
17141 return node;
17142 }
17143 template <class Key, class T>
17144 inline QHash<Key, T> &QHash<Key, T>::unite(const QHash<Key, T> &other)
17145 {
17146 QHash<Key, T> copy(other);
17147 const_iterator it = copy.constEnd();
17148 while (it != copy.constBegin()) {
17149 --it;
17150 insertMulti(it.key(), it.value());
17151 }
17152 return *this;
17153 }
17154 template <class Key, class T>
17155 void QHash<Key, T>::freeData(QHashData *x)
17156 {
17157 Node *e_for_x = reinterpret_cast<Node *>(x);
17158 Node **bucket = reinterpret_cast<Node **>(x->buckets);
17159 int n = x->numBuckets;
17160 while (n--) {
17161 Node *cur = *bucket++;
17162 while (cur != e_for_x) {
17163 Node *next = cur->next;
17164 deleteNode(cur);
17165 cur = next;
17166 }
17167 }
17168 x->destroyAndFree();
17169 }
17170 template <class Key, class T>
17171 inline void QHash<Key, T>::clear()
17172 {
17173 *this = QHash<Key,T>();
17174 }
17175 template <class Key, class T>
17176 void QHash<Key, T>::detach_helper()
17177 {
17178 QHashData *x = d->detach_helper(duplicateNode,
17179 QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node));
17180 if (!d->ref.deref())
17181 freeData(d);
17182 d = x;
17183 }
17184 template <class Key, class T>
17185 inline QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other)
17186 {
17187 if (d != other.d) {
17188 other.d->ref.ref();
17189 if (!d->ref.deref())
17190 freeData(d);
17191 d = other.d;
17192 if (!d->sharable)
17193 detach_helper();
17194 }
17195 return *this;
17196 }
17197 template <class Key, class T>
17198 inline const T QHash<Key, T>::value(const Key &akey) const
17199 {
17200 Node *node;
17201 if (d->size == 0 || (node = *findNode(akey)) == e) {
17202 return T();
17203 } else {
17204 return node->value;
17205 }
17206 }
17207 template <class Key, class T>
17208 inline const T QHash<Key, T>::value(const Key &akey, const T &adefaultValue) const
17209 {
17210 Node *node;
17211 if (d->size == 0 || (node = *findNode(akey)) == e) {
17212 return adefaultValue;
17213 } else {
17214 return node->value;
17215 }
17216 }
17217 template <class Key, class T>
17218 QList<Key> QHash<Key, T>::uniqueKeys() const
17219 {
17220 QList<Key> res;
17221 const_iterator i = begin();
17222 if (i != end()) {
17223 for (;;) {
17224 const Key &aKey = i.key();
17225 res.append(aKey);
17226 do {
17227 if (++i == end())
17228 goto break_out_of_outer_loop;
17229 } while (aKey == i.key());
17230 }
17231 }
17232 break_out_of_outer_loop:
17233 return res;
17234 }
17235 template <class Key, class T>
17236 QList<Key> QHash<Key, T>::keys() const
17237 {
17238 QList<Key> res;
17239 const_iterator i = begin();
17240 while (i != end()) {
17241 res.append(i.key());
17242 ++i;
17243 }
17244 return res;
17245 }
17246 template <class Key, class T>
17247 QList<Key> QHash<Key, T>::keys(const T &avalue) const
17248 {
17249 QList<Key> res;
17250 const_iterator i = begin();
17251 while (i != end()) {
17252 if (i.value() == avalue)
17253 res.append(i.key());
17254 ++i;
17255 }
17256 return res;
17257 }
17258 template <class Key, class T>
17259 const Key QHash<Key, T>::key(const T &avalue) const
17260 {
17261 return key(avalue, Key());
17262 }
17263 template <class Key, class T>
17264 const Key QHash<Key, T>::key(const T &avalue, const Key &defaultValue) const
17265 {
17266 const_iterator i = begin();
17267 while (i != end()) {
17268 if (i.value() == avalue)
17269 return i.key();
17270 ++i;
17271 }
17272 return defaultValue;
17273 }
17274 template <class Key, class T>
17275 QList<T> QHash<Key, T>::values() const
17276 {
17277 QList<T> res;
17278 const_iterator i = begin();
17279 while (i != end()) {
17280 res.append(i.value());
17281 ++i;
17282 }
17283 return res;
17284 }
17285 template <class Key, class T>
17286 QList<T> QHash<Key, T>::values(const Key &akey) const
17287 {
17288 QList<T> res;
17289 Node *node = *findNode(akey);
17290 if (node != e) {
17291 do {
17292 res.append(node->value);
17293 } while ((node = node->next) != e && node->key == akey);
17294 }
17295 return res;
17296 }
17297 template <class Key, class T>
17298 int QHash<Key, T>::count(const Key &akey) const
17299 {
17300 int cnt = 0;
17301 Node *node = *findNode(akey);
17302 if (node != e) {
17303 do {
17304 ++cnt;
17305 } while ((node = node->next) != e && node->key == akey);
17306 }
17307 return cnt;
17308 }
17309 template <class Key, class T>
17310 inline const T QHash<Key, T>::operator[](const Key &akey) const
17311 {
17312 return value(akey);
17313 }
17314 template <class Key, class T>
17315 inline T &QHash<Key, T>::operator[](const Key &akey)
17316 {
17317 detach();
17318 uint h;
17319 Node **node = findNode(akey, &h);
17320 if (*node == e) {
17321 if (d->willGrow())
17322 node = findNode(akey, &h);
17323 return createNode(h, akey, T(), node)->value;
17324 }
17325 return (*node)->value;
17326 }
17327 template <class Key, class T>
17328 inline typename QHash<Key, T>::iterator QHash<Key, T>::insert(const Key &akey,
17329 const T &avalue)
17330 {
17331 detach();
17332 uint h;
17333 Node **node = findNode(akey, &h);
17334 if (*node == e) {
17335 if (d->willGrow())
17336 node = findNode(akey, &h);
17337 return iterator(createNode(h, akey, avalue, node));
17338 }
17339 if (!QTypeInfo<T>::isDummy)
17340 (*node)->value = avalue;
17341 return iterator(*node);
17342 }
17343 template <class Key, class T>
17344 inline typename QHash<Key, T>::iterator QHash<Key, T>::insertMulti(const Key &akey,
17345 const T &avalue)
17346 {
17347 detach();
17348 d->willGrow();
17349 uint h;
17350 Node **nextNode = findNode(akey, &h);
17351 return iterator(createNode(h, akey, avalue, nextNode));
17352 }
17353 template <class Key, class T>
17354 int QHash<Key, T>::remove(const Key &akey)
17355 {
17356 detach();
17357 int oldSize = d->size;
17358 Node **node = findNode(akey);
17359 if (*node != e) {
17360 bool deleteNext = true;
17361 do {
17362 Node *next = (*node)->next;
17363 deleteNext = (next != e && next->key == (*node)->key);
17364 deleteNode(*node);
17365 *node = next;
17366 --d->size;
17367 } while (deleteNext);
17368 d->hasShrunk();
17369 }
17370 return oldSize - d->size;
17371 }
17372 template <class Key, class T>
17373 T QHash<Key, T>::take(const Key &akey)
17374 {
17375 detach();
17376 Node **node = findNode(akey);
17377 if (*node != e) {
17378 T t = (*node)->value;
17379 Node *next = (*node)->next;
17380 deleteNode(*node);
17381 *node = next;
17382 --d->size;
17383 d->hasShrunk();
17384 return t;
17385 }
17386 return T();
17387 }
17388 template <class Key, class T>
17389 typename QHash<Key, T>::iterator QHash<Key, T>::erase(iterator it)
17390 {
17391 if (it == iterator(e))
17392 return it;
17393 iterator ret = it;
17394 ++ret;
17395 Node *node = it;
17396 Node **node_ptr = reinterpret_cast<Node **>(&d->buckets[node->h % d->numBuckets]);
17397 while (*node_ptr != node)
17398 node_ptr = &(*node_ptr)->next;
17399 *node_ptr = node->next;
17400 deleteNode(node);
17401 --d->size;
17402 return ret;
17403 }
17404 template <class Key, class T>
17405 inline void QHash<Key, T>::reserve(int asize)
17406 {
17407 detach();
17408 d->rehash(-qMax(asize, 1));
17409 }
17410 template <class Key, class T>
17411 inline typename QHash<Key, T>::const_iterator QHash<Key, T>::find(const Key &akey) const
17412 {
17413 return const_iterator(*findNode(akey));
17414 }
17415 template <class Key, class T>
17416 inline typename QHash<Key, T>::const_iterator QHash<Key, T>::constFind(const Key &akey) const
17417 {
17418 return const_iterator(*findNode(akey));
17419 }
17420 template <class Key, class T>
17421 inline typename QHash<Key, T>::iterator QHash<Key, T>::find(const Key &akey)
17422 {
17423 detach();
17424 return iterator(*findNode(akey));
17425 }
17426 template <class Key, class T>
17427 inline bool QHash<Key, T>::contains(const Key &akey) const
17428 {
17429 return *findNode(akey) != e;
17430 }
17431 template <class Key, class T>
17432 typename QHash<Key, T>::Node **QHash<Key, T>::findNode(const Key &akey,
17433 uint *ahp) const
17434 {
17435 Node **node;
17436 uint h = qHash(akey);
17437 if (d->numBuckets) {
17438 node = reinterpret_cast<Node **>(&d->buckets[h % d->numBuckets]);
17439 qt_noop();
17440 while (*node != e && !(*node)->same_key(h, akey))
17441 node = &(*node)->next;
17442 } else {
17443 node = const_cast<Node **>(reinterpret_cast<const Node * const *>(&e));
17444 }
17445 if (ahp)
17446 *ahp = h;
17447 return node;
17448 }
17449 template <class Key, class T>
17450 bool QHash<Key, T>::operator==(const QHash<Key, T> &other) const
17451 {
17452 if (size() != other.size())
17453 return false;
17454 if (d == other.d)
17455 return true;
17456 const_iterator it = begin();
17457 while (it != end()) {
17458 const Key &akey = it.key();
17459 const_iterator it2 = other.find(akey);
17460 do {
17461 if (it2 == other.end() || !(it2.key() == akey))
17462 return false;
17463 if (!QTypeInfo<T>::isDummy && !(it.value() == it2.value()))
17464 return false;
17465 ++it;
17466 ++it2;
17467 } while (it != end() && it.key() == akey);
17468 }
17469 return true;
17470 }
17471 template <class Key, class T>
17472 class QMultiHash : public QHash<Key, T>
17473 {
17474 public:
17475 QMultiHash() {}
17476 QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {}
17477 inline typename QHash<Key, T>::iterator replace(const Key &key, const T &value)
17478 { return QHash<Key, T>::insert(key, value); }
17479 inline typename QHash<Key, T>::iterator insert(const Key &key, const T &value)
17480 { return QHash<Key, T>::insertMulti(key, value); }
17481 inline QMultiHash &operator+=(const QMultiHash &other)
17482 { unite(other); return *this; }
17483 inline QMultiHash operator+(const QMultiHash &other) const
17484 { QMultiHash result = *this; result += other; return result; }
17485 using QHash<Key, T>::contains;
17486 using QHash<Key, T>::remove;
17487 using QHash<Key, T>::count;
17488 using QHash<Key, T>::find;
17489 using QHash<Key, T>::constFind;
17490 bool contains(const Key &key, const T &value) const;
17491 int remove(const Key &key, const T &value);
17492 int count(const Key &key, const T &value) const;
17493 typename QHash<Key, T>::iterator find(const Key &key, const T &value) {
17494 typename QHash<Key, T>::iterator i(find(key));
17495 typename QHash<Key, T>::iterator end(this->end());
17496 while (i != end && i.key() == key) {
17497 if (i.value() == value)
17498 return i;
17499 ++i;
17500 }
17501 return end;
17502 }
17503 typename QHash<Key, T>::const_iterator find(const Key &key, const T &value) const {
17504 typename QHash<Key, T>::const_iterator i(constFind(key));
17505 typename QHash<Key, T>::const_iterator end(QHash<Key, T>::constEnd());
17506 while (i != end && i.key() == key) {
17507 if (i.value() == value)
17508 return i;
17509 ++i;
17510 }
17511 return end;
17512 }
17513 typename QHash<Key, T>::const_iterator constFind(const Key &key, const T &value) const
17514 { return find(key, value); }
17515 private:
17516 T &operator[](const Key &key);
17517 const T operator[](const Key &key) const;
17518 };
17519 template <class Key, class T>
17520 inline bool QMultiHash<Key, T>::contains(const Key &key, const T &value) const
17521 {
17522 return constFind(key, value) != QHash<Key, T>::constEnd();
17523 }
17524 template <class Key, class T>
17525 inline int QMultiHash<Key, T>::remove(const Key &key, const T &value)
17526 {
17527 int n = 0;
17528 typename QHash<Key, T>::iterator i(find(key));
17529 typename QHash<Key, T>::iterator end(QHash<Key, T>::end());
17530 while (i != end && i.key() == key) {
17531 if (i.value() == value) {
17532 i = erase(i);
17533 ++n;
17534 } else {
17535 ++i;
17536 }
17537 }
17538 return n;
17539 }
17540 template <class Key, class T>
17541 inline int QMultiHash<Key, T>::count(const Key &key, const T &value) const
17542 {
17543 int n = 0;
17544 typename QHash<Key, T>::const_iterator i(constFind(key));
17545 typename QHash<Key, T>::const_iterator end(QHash<Key, T>::constEnd());
17546 while (i != end && i.key() == key) {
17547 if (i.value() == value)
17548 ++n;
17549 ++i;
17550 }
17551 return n;
17552 }
17553 template <class Key, class T> class QHashIterator { typedef typename QHash<Key,T>::const_iterator const_iterator; typedef const_iterator Item; QHash<Key,T> c; const_iterator i, n; inline bool item_exists() const { return n != c.constEnd(); } public: inline QHashIterator(const QHash<Key,T> &container) : c(container), i(c.constBegin()), n(c.constEnd()) {} inline QHashIterator &operator=(const QHash<Key,T> &container) { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } inline void toFront() { i = c.constBegin(); n = c.constEnd(); } inline void toBack() { i = c.constEnd(); n = c.constEnd(); } inline bool hasNext() const { return i != c.constEnd(); } inline Item next() { n = i++; return n; } inline Item peekNext() const { return i; } inline bool hasPrevious() const { return i != c.constBegin(); } inline Item previous() { n = --i; return n; } inline Item peekPrevious() const { const_iterator p = i; return --p; } inline const T &value() const { qt_noop(); return *n; } inline const Key &key() const { qt_noop(); return n.key(); } inline bool findNext(const T &t) { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (i != c.constBegin()) if (*(n = --i) == t) return true; n = c.constEnd(); return false; } };
17554 template <class Key, class T> class QMutableHashIterator { typedef typename QHash<Key,T>::iterator iterator; typedef typename QHash<Key,T>::const_iterator const_iterator; typedef iterator Item; QHash<Key,T> *c; iterator i, n; inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } public: inline QMutableHashIterator(QHash<Key,T> &container) : c(&container) { c->setSharable(false); i = c->begin(); n = c->end(); } inline ~QMutableHashIterator() { c->setSharable(true); } inline QMutableHashIterator &operator=(QHash<Key,T> &container) { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } inline void toFront() { i = c->begin(); n = c->end(); } inline void toBack() { i = c->end(); n = c->end(); } inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } inline Item next() { n = i++; return n; } inline Item peekNext() const { return i; } inline bool hasPrevious() const { return const_iterator(i) != c->constBegin(); } inline Item previous() { n = --i; return n; } inline Item peekPrevious() const { iterator p = i; return --p; } inline void remove() { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } inline T &value() { qt_noop(); return *n; } inline const T &value() const { qt_noop(); return *n; } inline const Key &key() const { qt_noop(); return n.key(); } inline bool findNext(const T &t) { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (const_iterator(i) != c->constBegin()) if (*(n = --i) == t) return true; n = c->end(); return false; } };
17555 namespace std __attribute__ ((__visibility__ ("default"))) {
17556 enum _Rb_tree_color { _S_red = false, _S_black = true };
17557 struct _Rb_tree_node_base
17558 {
17559 typedef _Rb_tree_node_base* _Base_ptr;
17560 typedef const _Rb_tree_node_base* _Const_Base_ptr;
17561 _Rb_tree_color _M_color;
17562 _Base_ptr _M_parent;
17563 _Base_ptr _M_left;
17564 _Base_ptr _M_right;
17565 static _Base_ptr
17566 _S_minimum(_Base_ptr __x)
17567 {
17568 while (__x->_M_left != 0) __x = __x->_M_left;
17569 return __x;
17570 }
17571 static _Const_Base_ptr
17572 _S_minimum(_Const_Base_ptr __x)
17573 {
17574 while (__x->_M_left != 0) __x = __x->_M_left;
17575 return __x;
17576 }
17577 static _Base_ptr
17578 _S_maximum(_Base_ptr __x)
17579 {
17580 while (__x->_M_right != 0) __x = __x->_M_right;
17581 return __x;
17582 }
17583 static _Const_Base_ptr
17584 _S_maximum(_Const_Base_ptr __x)
17585 {
17586 while (__x->_M_right != 0) __x = __x->_M_right;
17587 return __x;
17588 }
17589 };
17590 template<typename _Val>
17591 struct _Rb_tree_node : public _Rb_tree_node_base
17592 {
17593 typedef _Rb_tree_node<_Val>* _Link_type;
17594 _Val _M_value_field;
17595 };
17596 _Rb_tree_node_base*
17597 _Rb_tree_increment(_Rb_tree_node_base* __x);
17598 const _Rb_tree_node_base*
17599 _Rb_tree_increment(const _Rb_tree_node_base* __x);
17600 _Rb_tree_node_base*
17601 _Rb_tree_decrement(_Rb_tree_node_base* __x);
17602 const _Rb_tree_node_base*
17603 _Rb_tree_decrement(const _Rb_tree_node_base* __x);
17604 template<typename _Tp>
17605 struct _Rb_tree_iterator
17606 {
17607 typedef _Tp value_type;
17608 typedef _Tp& reference;
17609 typedef _Tp* pointer;
17610 typedef bidirectional_iterator_tag iterator_category;
17611 typedef ptrdiff_t difference_type;
17612 typedef _Rb_tree_iterator<_Tp> _Self;
17613 typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
17614 typedef _Rb_tree_node<_Tp>* _Link_type;
17615 _Rb_tree_iterator()
17616 : _M_node() { }
17617 explicit
17618 _Rb_tree_iterator(_Link_type __x)
17619 : _M_node(__x) { }
17620 reference
17621 operator*() const
17622 { return static_cast<_Link_type>(_M_node)->_M_value_field; }
17623 pointer
17624 operator->() const
17625 { return &static_cast<_Link_type>(_M_node)->_M_value_field; }
17626 _Self&
17627 operator++()
17628 {
17629 _M_node = _Rb_tree_increment(_M_node);
17630 return *this;
17631 }
17632 _Self
17633 operator++(int)
17634 {
17635 _Self __tmp = *this;
17636 _M_node = _Rb_tree_increment(_M_node);
17637 return __tmp;
17638 }
17639 _Self&
17640 operator--()
17641 {
17642 _M_node = _Rb_tree_decrement(_M_node);
17643 return *this;
17644 }
17645 _Self
17646 operator--(int)
17647 {
17648 _Self __tmp = *this;
17649 _M_node = _Rb_tree_decrement(_M_node);
17650 return __tmp;
17651 }
17652 bool
17653 operator==(const _Self& __x) const
17654 { return _M_node == __x._M_node; }
17655 bool
17656 operator!=(const _Self& __x) const
17657 { return _M_node != __x._M_node; }
17658 _Base_ptr _M_node;
17659 };
17660 template<typename _Tp>
17661 struct _Rb_tree_const_iterator
17662 {
17663 typedef _Tp value_type;
17664 typedef const _Tp& reference;
17665 typedef const _Tp* pointer;
17666 typedef _Rb_tree_iterator<_Tp> iterator;
17667 typedef bidirectional_iterator_tag iterator_category;
17668 typedef ptrdiff_t difference_type;
17669 typedef _Rb_tree_const_iterator<_Tp> _Self;
17670 typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
17671 typedef const _Rb_tree_node<_Tp>* _Link_type;
17672 _Rb_tree_const_iterator()
17673 : _M_node() { }
17674 explicit
17675 _Rb_tree_const_iterator(_Link_type __x)
17676 : _M_node(__x) { }
17677 _Rb_tree_const_iterator(const iterator& __it)
17678 : _M_node(__it._M_node) { }
17679 reference
17680 operator*() const
17681 { return static_cast<_Link_type>(_M_node)->_M_value_field; }
17682 pointer
17683 operator->() const
17684 { return &static_cast<_Link_type>(_M_node)->_M_value_field; }
17685 _Self&
17686 operator++()
17687 {
17688 _M_node = _Rb_tree_increment(_M_node);
17689 return *this;
17690 }
17691 _Self
17692 operator++(int)
17693 {
17694 _Self __tmp = *this;
17695 _M_node = _Rb_tree_increment(_M_node);
17696 return __tmp;
17697 }
17698 _Self&
17699 operator--()
17700 {
17701 _M_node = _Rb_tree_decrement(_M_node);
17702 return *this;
17703 }
17704 _Self
17705 operator--(int)
17706 {
17707 _Self __tmp = *this;
17708 _M_node = _Rb_tree_decrement(_M_node);
17709 return __tmp;
17710 }
17711 bool
17712 operator==(const _Self& __x) const
17713 { return _M_node == __x._M_node; }
17714 bool
17715 operator!=(const _Self& __x) const
17716 { return _M_node != __x._M_node; }
17717 _Base_ptr _M_node;
17718 };
17719 template<typename _Val>
17720 inline bool
17721 operator==(const _Rb_tree_iterator<_Val>& __x,
17722 const _Rb_tree_const_iterator<_Val>& __y)
17723 { return __x._M_node == __y._M_node; }
17724 template<typename _Val>
17725 inline bool
17726 operator!=(const _Rb_tree_iterator<_Val>& __x,
17727 const _Rb_tree_const_iterator<_Val>& __y)
17728 { return __x._M_node != __y._M_node; }
17729 void
17730 _Rb_tree_insert_and_rebalance(const bool __insert_left,
17731 _Rb_tree_node_base* __x,
17732 _Rb_tree_node_base* __p,
17733 _Rb_tree_node_base& __header);
17734 _Rb_tree_node_base*
17735 _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
17736 _Rb_tree_node_base& __header);
17737 template<typename _Key, typename _Val, typename _KeyOfValue,
17738 typename _Compare, typename _Alloc = allocator<_Val> >
17739 class _Rb_tree
17740 {
17741 typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other
17742 _Node_allocator;
17743 protected:
17744 typedef _Rb_tree_node_base* _Base_ptr;
17745 typedef const _Rb_tree_node_base* _Const_Base_ptr;
17746 public:
17747 typedef _Key key_type;
17748 typedef _Val value_type;
17749 typedef value_type* pointer;
17750 typedef const value_type* const_pointer;
17751 typedef value_type& reference;
17752 typedef const value_type& const_reference;
17753 typedef _Rb_tree_node<_Val>* _Link_type;
17754 typedef const _Rb_tree_node<_Val>* _Const_Link_type;
17755 typedef size_t size_type;
17756 typedef ptrdiff_t difference_type;
17757 typedef _Alloc allocator_type;
17758 _Node_allocator&
17759 _M_get_Node_allocator()
17760 { return *static_cast<_Node_allocator*>(&this->_M_impl); }
17761 const _Node_allocator&
17762 _M_get_Node_allocator() const
17763 { return *static_cast<const _Node_allocator*>(&this->_M_impl); }
17764 allocator_type
17765 get_allocator() const
17766 { return allocator_type(_M_get_Node_allocator()); }
17767 protected:
17768 _Link_type
17769 _M_get_node()
17770 { return _M_impl._Node_allocator::allocate(1); }
17771 void
17772 _M_put_node(_Link_type __p)
17773 { _M_impl._Node_allocator::deallocate(__p, 1); }
17774 _Link_type
17775 _M_create_node(const value_type& __x)
17776 {
17777 _Link_type __tmp = _M_get_node();
17778 try
17779 { get_allocator().construct(&__tmp->_M_value_field, __x); }
17780 catch(...)
17781 {
17782 _M_put_node(__tmp);
17783 throw;
17784 }
17785 return __tmp;
17786 }
17787 _Link_type
17788 _M_clone_node(_Const_Link_type __x)
17789 {
17790 _Link_type __tmp = _M_create_node(__x->_M_value_field);
17791 __tmp->_M_color = __x->_M_color;
17792 __tmp->_M_left = 0;
17793 __tmp->_M_right = 0;
17794 return __tmp;
17795 }
17796 void
17797 _M_destroy_node(_Link_type __p)
17798 {
17799 get_allocator().destroy(&__p->_M_value_field);
17800 _M_put_node(__p);
17801 }
17802 protected:
17803 template<typename _Key_compare,
17804 bool _Is_pod_comparator = __is_pod(_Key_compare)>
17805 struct _Rb_tree_impl : public _Node_allocator
17806 {
17807 _Key_compare _M_key_compare;
17808 _Rb_tree_node_base _M_header;
17809 size_type _M_node_count;
17810 _Rb_tree_impl()
17811 : _Node_allocator(), _M_key_compare(), _M_header(),
17812 _M_node_count(0)
17813 { _M_initialize(); }
17814 _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
17815 : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
17816 _M_node_count(0)
17817 { _M_initialize(); }
17818 private:
17819 void
17820 _M_initialize()
17821 {
17822 this->_M_header._M_color = _S_red;
17823 this->_M_header._M_parent = 0;
17824 this->_M_header._M_left = &this->_M_header;
17825 this->_M_header._M_right = &this->_M_header;
17826 }
17827 };
17828 _Rb_tree_impl<_Compare> _M_impl;
17829 protected:
17830 _Base_ptr&
17831 _M_root()
17832 { return this->_M_impl._M_header._M_parent; }
17833 _Const_Base_ptr
17834 _M_root() const
17835 { return this->_M_impl._M_header._M_parent; }
17836 _Base_ptr&
17837 _M_leftmost()
17838 { return this->_M_impl._M_header._M_left; }
17839 _Const_Base_ptr
17840 _M_leftmost() const
17841 { return this->_M_impl._M_header._M_left; }
17842 _Base_ptr&
17843 _M_rightmost()
17844 { return this->_M_impl._M_header._M_right; }
17845 _Const_Base_ptr
17846 _M_rightmost() const
17847 { return this->_M_impl._M_header._M_right; }
17848 _Link_type
17849 _M_begin()
17850 { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }
17851 _Const_Link_type
17852 _M_begin() const
17853 {
17854 return static_cast<_Const_Link_type>
17855 (this->_M_impl._M_header._M_parent);
17856 }
17857 _Link_type
17858 _M_end()
17859 { return static_cast<_Link_type>(&this->_M_impl._M_header); }
17860 _Const_Link_type
17861 _M_end() const
17862 { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
17863 static const_reference
17864 _S_value(_Const_Link_type __x)
17865 { return __x->_M_value_field; }
17866 static const _Key&
17867 _S_key(_Const_Link_type __x)
17868 { return _KeyOfValue()(_S_value(__x)); }
17869 static _Link_type
17870 _S_left(_Base_ptr __x)
17871 { return static_cast<_Link_type>(__x->_M_left); }
17872 static _Const_Link_type
17873 _S_left(_Const_Base_ptr __x)
17874 { return static_cast<_Const_Link_type>(__x->_M_left); }
17875 static _Link_type
17876 _S_right(_Base_ptr __x)
17877 { return static_cast<_Link_type>(__x->_M_right); }
17878 static _Const_Link_type
17879 _S_right(_Const_Base_ptr __x)
17880 { return static_cast<_Const_Link_type>(__x->_M_right); }
17881 static const_reference
17882 _S_value(_Const_Base_ptr __x)
17883 { return static_cast<_Const_Link_type>(__x)->_M_value_field; }
17884 static const _Key&
17885 _S_key(_Const_Base_ptr __x)
17886 { return _KeyOfValue()(_S_value(__x)); }
17887 static _Base_ptr
17888 _S_minimum(_Base_ptr __x)
17889 { return _Rb_tree_node_base::_S_minimum(__x); }
17890 static _Const_Base_ptr
17891 _S_minimum(_Const_Base_ptr __x)
17892 { return _Rb_tree_node_base::_S_minimum(__x); }
17893 static _Base_ptr
17894 _S_maximum(_Base_ptr __x)
17895 { return _Rb_tree_node_base::_S_maximum(__x); }
17896 static _Const_Base_ptr
17897 _S_maximum(_Const_Base_ptr __x)
17898 { return _Rb_tree_node_base::_S_maximum(__x); }
17899 public:
17900 typedef _Rb_tree_iterator<value_type> iterator;
17901 typedef _Rb_tree_const_iterator<value_type> const_iterator;
17902 typedef std::reverse_iterator<iterator> reverse_iterator;
17903 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
17904 private:
17905 iterator
17906 _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __y,
17907 const value_type& __v);
17908 iterator
17909 _M_insert_lower(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
17910 iterator
17911 _M_insert_equal_lower(const value_type& __x);
17912 _Link_type
17913 _M_copy(_Const_Link_type __x, _Link_type __p);
17914 void
17915 _M_erase(_Link_type __x);
17916 iterator
17917 _M_lower_bound(_Link_type __x, _Link_type __y,
17918 const _Key& __k);
17919 const_iterator
17920 _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
17921 const _Key& __k) const;
17922 iterator
17923 _M_upper_bound(_Link_type __x, _Link_type __y,
17924 const _Key& __k);
17925 const_iterator
17926 _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
17927 const _Key& __k) const;
17928 public:
17929 _Rb_tree() { }
17930 _Rb_tree(const _Compare& __comp,
17931 const allocator_type& __a = allocator_type())
17932 : _M_impl(__comp, __a) { }
17933 _Rb_tree(const _Rb_tree& __x)
17934 : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
17935 {
17936 if (__x._M_root() != 0)
17937 {
17938 _M_root() = _M_copy(__x._M_begin(), _M_end());
17939 _M_leftmost() = _S_minimum(_M_root());
17940 _M_rightmost() = _S_maximum(_M_root());
17941 _M_impl._M_node_count = __x._M_impl._M_node_count;
17942 }
17943 }
17944 ~_Rb_tree()
17945 { _M_erase(_M_begin()); }
17946 _Rb_tree&
17947 operator=(const _Rb_tree& __x);
17948 _Compare
17949 key_comp() const
17950 { return _M_impl._M_key_compare; }
17951 iterator
17952 begin()
17953 {
17954 return iterator(static_cast<_Link_type>
17955 (this->_M_impl._M_header._M_left));
17956 }
17957 const_iterator
17958 begin() const
17959 {
17960 return const_iterator(static_cast<_Const_Link_type>
17961 (this->_M_impl._M_header._M_left));
17962 }
17963 iterator
17964 end()
17965 { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
17966 const_iterator
17967 end() const
17968 {
17969 return const_iterator(static_cast<_Const_Link_type>
17970 (&this->_M_impl._M_header));
17971 }
17972 reverse_iterator
17973 rbegin()
17974 { return reverse_iterator(end()); }
17975 const_reverse_iterator
17976 rbegin() const
17977 { return const_reverse_iterator(end()); }
17978 reverse_iterator
17979 rend()
17980 { return reverse_iterator(begin()); }
17981 const_reverse_iterator
17982 rend() const
17983 { return const_reverse_iterator(begin()); }
17984 bool
17985 empty() const
17986 { return _M_impl._M_node_count == 0; }
17987 size_type
17988 size() const
17989 { return _M_impl._M_node_count; }
17990 size_type
17991 max_size() const
17992 { return get_allocator().max_size(); }
17993 void
17994 swap(_Rb_tree& __t);
17995 pair<iterator, bool>
17996 _M_insert_unique(const value_type& __x);
17997 iterator
17998 _M_insert_equal(const value_type& __x);
17999 iterator
18000 _M_insert_unique_(const_iterator __position, const value_type& __x);
18001 iterator
18002 _M_insert_equal_(const_iterator __position, const value_type& __x);
18003 template<typename _InputIterator>
18004 void
18005 _M_insert_unique(_InputIterator __first, _InputIterator __last);
18006 template<typename _InputIterator>
18007 void
18008 _M_insert_equal(_InputIterator __first, _InputIterator __last);
18009 void
18010 erase(iterator __position);
18011 void
18012 erase(const_iterator __position);
18013 size_type
18014 erase(const key_type& __x);
18015 void
18016 erase(iterator __first, iterator __last);
18017 void
18018 erase(const_iterator __first, const_iterator __last);
18019 void
18020 erase(const key_type* __first, const key_type* __last);
18021 void
18022 clear()
18023 {
18024 _M_erase(_M_begin());
18025 _M_leftmost() = _M_end();
18026 _M_root() = 0;
18027 _M_rightmost() = _M_end();
18028 _M_impl._M_node_count = 0;
18029 }
18030 iterator
18031 find(const key_type& __k);
18032 const_iterator
18033 find(const key_type& __k) const;
18034 size_type
18035 count(const key_type& __k) const;
18036 iterator
18037 lower_bound(const key_type& __k)
18038 { return _M_lower_bound(_M_begin(), _M_end(), __k); }
18039 const_iterator
18040 lower_bound(const key_type& __k) const
18041 { return _M_lower_bound(_M_begin(), _M_end(), __k); }
18042 iterator
18043 upper_bound(const key_type& __k)
18044 { return _M_upper_bound(_M_begin(), _M_end(), __k); }
18045 const_iterator
18046 upper_bound(const key_type& __k) const
18047 { return _M_upper_bound(_M_begin(), _M_end(), __k); }
18048 pair<iterator, iterator>
18049 equal_range(const key_type& __k);
18050 pair<const_iterator, const_iterator>
18051 equal_range(const key_type& __k) const;
18052 bool
18053 __rb_verify() const;
18054 };
18055 template<typename _Key, typename _Val, typename _KeyOfValue,
18056 typename _Compare, typename _Alloc>
18057 inline bool
18058 operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18059 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18060 {
18061 return __x.size() == __y.size()
18062 && std::equal(__x.begin(), __x.end(), __y.begin());
18063 }
18064 template<typename _Key, typename _Val, typename _KeyOfValue,
18065 typename _Compare, typename _Alloc>
18066 inline bool
18067 operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18068 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18069 {
18070 return std::lexicographical_compare(__x.begin(), __x.end(),
18071 __y.begin(), __y.end());
18072 }
18073 template<typename _Key, typename _Val, typename _KeyOfValue,
18074 typename _Compare, typename _Alloc>
18075 inline bool
18076 operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18077 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18078 { return !(__x == __y); }
18079 template<typename _Key, typename _Val, typename _KeyOfValue,
18080 typename _Compare, typename _Alloc>
18081 inline bool
18082 operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18083 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18084 { return __y < __x; }
18085 template<typename _Key, typename _Val, typename _KeyOfValue,
18086 typename _Compare, typename _Alloc>
18087 inline bool
18088 operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18089 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18090 { return !(__y < __x); }
18091 template<typename _Key, typename _Val, typename _KeyOfValue,
18092 typename _Compare, typename _Alloc>
18093 inline bool
18094 operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18095 const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18096 { return !(__x < __y); }
18097 template<typename _Key, typename _Val, typename _KeyOfValue,
18098 typename _Compare, typename _Alloc>
18099 inline void
18100 swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
18101 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
18102 { __x.swap(__y); }
18103 template<typename _Key, typename _Val, typename _KeyOfValue,
18104 typename _Compare, typename _Alloc>
18105 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
18106 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18107 operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
18108 {
18109 if (this != &__x)
18110 {
18111 clear();
18112 _M_impl._M_key_compare = __x._M_impl._M_key_compare;
18113 if (__x._M_root() != 0)
18114 {
18115 _M_root() = _M_copy(__x._M_begin(), _M_end());
18116 _M_leftmost() = _S_minimum(_M_root());
18117 _M_rightmost() = _S_maximum(_M_root());
18118 _M_impl._M_node_count = __x._M_impl._M_node_count;
18119 }
18120 }
18121 return *this;
18122 }
18123 template<typename _Key, typename _Val, typename _KeyOfValue,
18124 typename _Compare, typename _Alloc>
18125 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18126 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18127 _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
18128 {
18129 bool __insert_left = (__x != 0 || __p == _M_end()
18130 || _M_impl._M_key_compare(_KeyOfValue()(__v),
18131 _S_key(__p)));
18132 _Link_type __z = _M_create_node(__v);
18133 _Rb_tree_insert_and_rebalance(__insert_left, __z,
18134 const_cast<_Base_ptr>(__p),
18135 this->_M_impl._M_header);
18136 ++_M_impl._M_node_count;
18137 return iterator(__z);
18138 }
18139 template<typename _Key, typename _Val, typename _KeyOfValue,
18140 typename _Compare, typename _Alloc>
18141 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18142 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18143 _M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
18144 {
18145 bool __insert_left = (__x != 0 || __p == _M_end()
18146 || !_M_impl._M_key_compare(_S_key(__p),
18147 _KeyOfValue()(__v)));
18148 _Link_type __z = _M_create_node(__v);
18149 _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
18150 this->_M_impl._M_header);
18151 ++_M_impl._M_node_count;
18152 return iterator(__z);
18153 }
18154 template<typename _Key, typename _Val, typename _KeyOfValue,
18155 typename _Compare, typename _Alloc>
18156 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18157 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18158 _M_insert_equal_lower(const _Val& __v)
18159 {
18160 _Link_type __x = _M_begin();
18161 _Link_type __y = _M_end();
18162 while (__x != 0)
18163 {
18164 __y = __x;
18165 __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ?
18166 _S_left(__x) : _S_right(__x);
18167 }
18168 return _M_insert_lower(__x, __y, __v);
18169 }
18170 template<typename _Key, typename _Val, typename _KoV,
18171 typename _Compare, typename _Alloc>
18172 typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
18173 _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
18174 _M_copy(_Const_Link_type __x, _Link_type __p)
18175 {
18176 _Link_type __top = _M_clone_node(__x);
18177 __top->_M_parent = __p;
18178 try
18179 {
18180 if (__x->_M_right)
18181 __top->_M_right = _M_copy(_S_right(__x), __top);
18182 __p = __top;
18183 __x = _S_left(__x);
18184 while (__x != 0)
18185 {
18186 _Link_type __y = _M_clone_node(__x);
18187 __p->_M_left = __y;
18188 __y->_M_parent = __p;
18189 if (__x->_M_right)
18190 __y->_M_right = _M_copy(_S_right(__x), __y);
18191 __p = __y;
18192 __x = _S_left(__x);
18193 }
18194 }
18195 catch(...)
18196 {
18197 _M_erase(__top);
18198 throw;
18199 }
18200 return __top;
18201 }
18202 template<typename _Key, typename _Val, typename _KeyOfValue,
18203 typename _Compare, typename _Alloc>
18204 void
18205 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18206 _M_erase(_Link_type __x)
18207 {
18208 while (__x != 0)
18209 {
18210 _M_erase(_S_right(__x));
18211 _Link_type __y = _S_left(__x);
18212 _M_destroy_node(__x);
18213 __x = __y;
18214 }
18215 }
18216 template<typename _Key, typename _Val, typename _KeyOfValue,
18217 typename _Compare, typename _Alloc>
18218 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18219 _Compare, _Alloc>::iterator
18220 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18221 _M_lower_bound(_Link_type __x, _Link_type __y,
18222 const _Key& __k)
18223 {
18224 while (__x != 0)
18225 if (!_M_impl._M_key_compare(_S_key(__x), __k))
18226 __y = __x, __x = _S_left(__x);
18227 else
18228 __x = _S_right(__x);
18229 return iterator(__y);
18230 }
18231 template<typename _Key, typename _Val, typename _KeyOfValue,
18232 typename _Compare, typename _Alloc>
18233 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18234 _Compare, _Alloc>::const_iterator
18235 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18236 _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
18237 const _Key& __k) const
18238 {
18239 while (__x != 0)
18240 if (!_M_impl._M_key_compare(_S_key(__x), __k))
18241 __y = __x, __x = _S_left(__x);
18242 else
18243 __x = _S_right(__x);
18244 return const_iterator(__y);
18245 }
18246 template<typename _Key, typename _Val, typename _KeyOfValue,
18247 typename _Compare, typename _Alloc>
18248 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18249 _Compare, _Alloc>::iterator
18250 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18251 _M_upper_bound(_Link_type __x, _Link_type __y,
18252 const _Key& __k)
18253 {
18254 while (__x != 0)
18255 if (_M_impl._M_key_compare(__k, _S_key(__x)))
18256 __y = __x, __x = _S_left(__x);
18257 else
18258 __x = _S_right(__x);
18259 return iterator(__y);
18260 }
18261 template<typename _Key, typename _Val, typename _KeyOfValue,
18262 typename _Compare, typename _Alloc>
18263 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18264 _Compare, _Alloc>::const_iterator
18265 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18266 _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
18267 const _Key& __k) const
18268 {
18269 while (__x != 0)
18270 if (_M_impl._M_key_compare(__k, _S_key(__x)))
18271 __y = __x, __x = _S_left(__x);
18272 else
18273 __x = _S_right(__x);
18274 return const_iterator(__y);
18275 }
18276 template<typename _Key, typename _Val, typename _KeyOfValue,
18277 typename _Compare, typename _Alloc>
18278 pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
18279 _Compare, _Alloc>::iterator,
18280 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18281 _Compare, _Alloc>::iterator>
18282 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18283 equal_range(const _Key& __k)
18284 {
18285 _Link_type __x = _M_begin();
18286 _Link_type __y = _M_end();
18287 while (__x != 0)
18288 {
18289 if (_M_impl._M_key_compare(_S_key(__x), __k))
18290 __x = _S_right(__x);
18291 else if (_M_impl._M_key_compare(__k, _S_key(__x)))
18292 __y = __x, __x = _S_left(__x);
18293 else
18294 {
18295 _Link_type __xu(__x), __yu(__y);
18296 __y = __x, __x = _S_left(__x);
18297 __xu = _S_right(__xu);
18298 return pair<iterator,
18299 iterator>(_M_lower_bound(__x, __y, __k),
18300 _M_upper_bound(__xu, __yu, __k));
18301 }
18302 }
18303 return pair<iterator, iterator>(iterator(__y),
18304 iterator(__y));
18305 }
18306 template<typename _Key, typename _Val, typename _KeyOfValue,
18307 typename _Compare, typename _Alloc>
18308 pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
18309 _Compare, _Alloc>::const_iterator,
18310 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18311 _Compare, _Alloc>::const_iterator>
18312 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18313 equal_range(const _Key& __k) const
18314 {
18315 _Const_Link_type __x = _M_begin();
18316 _Const_Link_type __y = _M_end();
18317 while (__x != 0)
18318 {
18319 if (_M_impl._M_key_compare(_S_key(__x), __k))
18320 __x = _S_right(__x);
18321 else if (_M_impl._M_key_compare(__k, _S_key(__x)))
18322 __y = __x, __x = _S_left(__x);
18323 else
18324 {
18325 _Const_Link_type __xu(__x), __yu(__y);
18326 __y = __x, __x = _S_left(__x);
18327 __xu = _S_right(__xu);
18328 return pair<const_iterator,
18329 const_iterator>(_M_lower_bound(__x, __y, __k),
18330 _M_upper_bound(__xu, __yu, __k));
18331 }
18332 }
18333 return pair<const_iterator, const_iterator>(const_iterator(__y),
18334 const_iterator(__y));
18335 }
18336 template<typename _Key, typename _Val, typename _KeyOfValue,
18337 typename _Compare, typename _Alloc>
18338 void
18339 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18340 swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
18341 {
18342 if (_M_root() == 0)
18343 {
18344 if (__t._M_root() != 0)
18345 {
18346 _M_root() = __t._M_root();
18347 _M_leftmost() = __t._M_leftmost();
18348 _M_rightmost() = __t._M_rightmost();
18349 _M_root()->_M_parent = _M_end();
18350 __t._M_root() = 0;
18351 __t._M_leftmost() = __t._M_end();
18352 __t._M_rightmost() = __t._M_end();
18353 }
18354 }
18355 else if (__t._M_root() == 0)
18356 {
18357 __t._M_root() = _M_root();
18358 __t._M_leftmost() = _M_leftmost();
18359 __t._M_rightmost() = _M_rightmost();
18360 __t._M_root()->_M_parent = __t._M_end();
18361 _M_root() = 0;
18362 _M_leftmost() = _M_end();
18363 _M_rightmost() = _M_end();
18364 }
18365 else
18366 {
18367 std::swap(_M_root(),__t._M_root());
18368 std::swap(_M_leftmost(),__t._M_leftmost());
18369 std::swap(_M_rightmost(),__t._M_rightmost());
18370 _M_root()->_M_parent = _M_end();
18371 __t._M_root()->_M_parent = __t._M_end();
18372 }
18373 std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count);
18374 std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare);
18375 std::__alloc_swap<_Node_allocator>::
18376 _S_do_it(_M_get_Node_allocator(), __t._M_get_Node_allocator());
18377 }
18378 template<typename _Key, typename _Val, typename _KeyOfValue,
18379 typename _Compare, typename _Alloc>
18380 pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
18381 _Compare, _Alloc>::iterator, bool>
18382 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18383 _M_insert_unique(const _Val& __v)
18384 {
18385 _Link_type __x = _M_begin();
18386 _Link_type __y = _M_end();
18387 bool __comp = true;
18388 while (__x != 0)
18389 {
18390 __y = __x;
18391 __comp = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x));
18392 __x = __comp ? _S_left(__x) : _S_right(__x);
18393 }
18394 iterator __j = iterator(__y);
18395 if (__comp)
18396 {
18397 if (__j == begin())
18398 return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
18399 else
18400 --__j;
18401 }
18402 if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
18403 return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
18404 return pair<iterator, bool>(__j, false);
18405 }
18406 template<typename _Key, typename _Val, typename _KeyOfValue,
18407 typename _Compare, typename _Alloc>
18408 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18409 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18410 _M_insert_equal(const _Val& __v)
18411 {
18412 _Link_type __x = _M_begin();
18413 _Link_type __y = _M_end();
18414 while (__x != 0)
18415 {
18416 __y = __x;
18417 __x = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ?
18418 _S_left(__x) : _S_right(__x);
18419 }
18420 return _M_insert_(__x, __y, __v);
18421 }
18422 template<typename _Key, typename _Val, typename _KeyOfValue,
18423 typename _Compare, typename _Alloc>
18424 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18425 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18426 _M_insert_unique_(const_iterator __position, const _Val& __v)
18427 {
18428 if (__position._M_node == _M_end())
18429 {
18430 if (size() > 0
18431 && _M_impl._M_key_compare(_S_key(_M_rightmost()),
18432 _KeyOfValue()(__v)))
18433 return _M_insert_(0, _M_rightmost(), __v);
18434 else
18435 return _M_insert_unique(__v).first;
18436 }
18437 else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
18438 _S_key(__position._M_node)))
18439 {
18440 const_iterator __before = __position;
18441 if (__position._M_node == _M_leftmost())
18442 return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
18443 else if (_M_impl._M_key_compare(_S_key((--__before)._M_node),
18444 _KeyOfValue()(__v)))
18445 {
18446 if (_S_right(__before._M_node) == 0)
18447 return _M_insert_(0, __before._M_node, __v);
18448 else
18449 return _M_insert_(__position._M_node,
18450 __position._M_node, __v);
18451 }
18452 else
18453 return _M_insert_unique(__v).first;
18454 }
18455 else if (_M_impl._M_key_compare(_S_key(__position._M_node),
18456 _KeyOfValue()(__v)))
18457 {
18458 const_iterator __after = __position;
18459 if (__position._M_node == _M_rightmost())
18460 return _M_insert_(0, _M_rightmost(), __v);
18461 else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
18462 _S_key((++__after)._M_node)))
18463 {
18464 if (_S_right(__position._M_node) == 0)
18465 return _M_insert_(0, __position._M_node, __v);
18466 else
18467 return _M_insert_(__after._M_node, __after._M_node, __v);
18468 }
18469 else
18470 return _M_insert_unique(__v).first;
18471 }
18472 else
18473 return iterator(static_cast<_Link_type>
18474 (const_cast<_Base_ptr>(__position._M_node)));
18475 }
18476 template<typename _Key, typename _Val, typename _KeyOfValue,
18477 typename _Compare, typename _Alloc>
18478 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
18479 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18480 _M_insert_equal_(const_iterator __position, const _Val& __v)
18481 {
18482 if (__position._M_node == _M_end())
18483 {
18484 if (size() > 0
18485 && !_M_impl._M_key_compare(_KeyOfValue()(__v),
18486 _S_key(_M_rightmost())))
18487 return _M_insert_(0, _M_rightmost(), __v);
18488 else
18489 return _M_insert_equal(__v);
18490 }
18491 else if (!_M_impl._M_key_compare(_S_key(__position._M_node),
18492 _KeyOfValue()(__v)))
18493 {
18494 const_iterator __before = __position;
18495 if (__position._M_node == _M_leftmost())
18496 return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
18497 else if (!_M_impl._M_key_compare(_KeyOfValue()(__v),
18498 _S_key((--__before)._M_node)))
18499 {
18500 if (_S_right(__before._M_node) == 0)
18501 return _M_insert_(0, __before._M_node, __v);
18502 else
18503 return _M_insert_(__position._M_node,
18504 __position._M_node, __v);
18505 }
18506 else
18507 return _M_insert_equal(__v);
18508 }
18509 else
18510 {
18511 const_iterator __after = __position;
18512 if (__position._M_node == _M_rightmost())
18513 return _M_insert_(0, _M_rightmost(), __v);
18514 else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node),
18515 _KeyOfValue()(__v)))
18516 {
18517 if (_S_right(__position._M_node) == 0)
18518 return _M_insert_(0, __position._M_node, __v);
18519 else
18520 return _M_insert_(__after._M_node, __after._M_node, __v);
18521 }
18522 else
18523 return _M_insert_equal_lower(__v);
18524 }
18525 }
18526 template<typename _Key, typename _Val, typename _KoV,
18527 typename _Cmp, typename _Alloc>
18528 template<class _II>
18529 void
18530 _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
18531 _M_insert_unique(_II __first, _II __last)
18532 {
18533 for (; __first != __last; ++__first)
18534 _M_insert_unique_(end(), *__first);
18535 }
18536 template<typename _Key, typename _Val, typename _KoV,
18537 typename _Cmp, typename _Alloc>
18538 template<class _II>
18539 void
18540 _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
18541 _M_insert_equal(_II __first, _II __last)
18542 {
18543 for (; __first != __last; ++__first)
18544 _M_insert_equal_(end(), *__first);
18545 }
18546 template<typename _Key, typename _Val, typename _KeyOfValue,
18547 typename _Compare, typename _Alloc>
18548 inline void
18549 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18550 erase(iterator __position)
18551 {
18552 _Link_type __y =
18553 static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
18554 (__position._M_node,
18555 this->_M_impl._M_header));
18556 _M_destroy_node(__y);
18557 --_M_impl._M_node_count;
18558 }
18559 template<typename _Key, typename _Val, typename _KeyOfValue,
18560 typename _Compare, typename _Alloc>
18561 inline void
18562 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18563 erase(const_iterator __position)
18564 {
18565 _Link_type __y =
18566 static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
18567 (const_cast<_Base_ptr>(__position._M_node),
18568 this->_M_impl._M_header));
18569 _M_destroy_node(__y);
18570 --_M_impl._M_node_count;
18571 }
18572 template<typename _Key, typename _Val, typename _KeyOfValue,
18573 typename _Compare, typename _Alloc>
18574 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
18575 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18576 erase(const _Key& __x)
18577 {
18578 pair<iterator, iterator> __p = equal_range(__x);
18579 const size_type __old_size = size();
18580 erase(__p.first, __p.second);
18581 return __old_size - size();
18582 }
18583 template<typename _Key, typename _Val, typename _KeyOfValue,
18584 typename _Compare, typename _Alloc>
18585 void
18586 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18587 erase(iterator __first, iterator __last)
18588 {
18589 if (__first == begin() && __last == end())
18590 clear();
18591 else
18592 while (__first != __last)
18593 erase(__first++);
18594 }
18595 template<typename _Key, typename _Val, typename _KeyOfValue,
18596 typename _Compare, typename _Alloc>
18597 void
18598 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18599 erase(const_iterator __first, const_iterator __last)
18600 {
18601 if (__first == begin() && __last == end())
18602 clear();
18603 else
18604 while (__first != __last)
18605 erase(__first++);
18606 }
18607 template<typename _Key, typename _Val, typename _KeyOfValue,
18608 typename _Compare, typename _Alloc>
18609 void
18610 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18611 erase(const _Key* __first, const _Key* __last)
18612 {
18613 while (__first != __last)
18614 erase(*__first++);
18615 }
18616 template<typename _Key, typename _Val, typename _KeyOfValue,
18617 typename _Compare, typename _Alloc>
18618 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18619 _Compare, _Alloc>::iterator
18620 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18621 find(const _Key& __k)
18622 {
18623 iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
18624 return (__j == end()
18625 || _M_impl._M_key_compare(__k,
18626 _S_key(__j._M_node))) ? end() : __j;
18627 }
18628 template<typename _Key, typename _Val, typename _KeyOfValue,
18629 typename _Compare, typename _Alloc>
18630 typename _Rb_tree<_Key, _Val, _KeyOfValue,
18631 _Compare, _Alloc>::const_iterator
18632 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18633 find(const _Key& __k) const
18634 {
18635 const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
18636 return (__j == end()
18637 || _M_impl._M_key_compare(__k,
18638 _S_key(__j._M_node))) ? end() : __j;
18639 }
18640 template<typename _Key, typename _Val, typename _KeyOfValue,
18641 typename _Compare, typename _Alloc>
18642 typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
18643 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
18644 count(const _Key& __k) const
18645 {
18646 pair<const_iterator, const_iterator> __p = equal_range(__k);
18647 const size_type __n = std::distance(__p.first, __p.second);
18648 return __n;
18649 }
18650 unsigned int
18651 _Rb_tree_black_count(const _Rb_tree_node_base* __node,
18652 const _Rb_tree_node_base* __root);
18653 template<typename _Key, typename _Val, typename _KeyOfValue,
18654 typename _Compare, typename _Alloc>
18655 bool
18656 _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const
18657 {
18658 if (_M_impl._M_node_count == 0 || begin() == end())
18659 return _M_impl._M_node_count == 0 && begin() == end()
18660 && this->_M_impl._M_header._M_left == _M_end()
18661 && this->_M_impl._M_header._M_right == _M_end();
18662 unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root());
18663 for (const_iterator __it = begin(); __it != end(); ++__it)
18664 {
18665 _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node);
18666 _Const_Link_type __L = _S_left(__x);
18667 _Const_Link_type __R = _S_right(__x);
18668 if (__x->_M_color == _S_red)
18669 if ((__L && __L->_M_color == _S_red)
18670 || (__R && __R->_M_color == _S_red))
18671 return false;
18672 if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L)))
18673 return false;
18674 if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x)))
18675 return false;
18676 if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len)
18677 return false;
18678 }
18679 if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
18680 return false;
18681 if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
18682 return false;
18683 return true;
18684 }
18685 }
18686 namespace std __attribute__ ((__visibility__ ("default"))) {
18687 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
18688 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
18689 class map
18690 {
18691 public:
18692 typedef _Key key_type;
18693 typedef _Tp mapped_type;
18694 typedef std::pair<const _Key, _Tp> value_type;
18695 typedef _Compare key_compare;
18696 typedef _Alloc allocator_type;
18697 private:
18698 typedef typename _Alloc::value_type _Alloc_value_type;
18699 public:
18700 class value_compare
18701 : public std::binary_function<value_type, value_type, bool>
18702 {
18703 friend class map<_Key, _Tp, _Compare, _Alloc>;
18704 protected:
18705 _Compare comp;
18706 value_compare(_Compare __c)
18707 : comp(__c) { }
18708 public:
18709 bool operator()(const value_type& __x, const value_type& __y) const
18710 { return comp(__x.first, __y.first); }
18711 };
18712 private:
18713 typedef typename _Alloc::template rebind<value_type>::other
18714 _Pair_alloc_type;
18715 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
18716 key_compare, _Pair_alloc_type> _Rep_type;
18717 _Rep_type _M_t;
18718 public:
18719 typedef typename _Pair_alloc_type::pointer pointer;
18720 typedef typename _Pair_alloc_type::const_pointer const_pointer;
18721 typedef typename _Pair_alloc_type::reference reference;
18722 typedef typename _Pair_alloc_type::const_reference const_reference;
18723 typedef typename _Rep_type::iterator iterator;
18724 typedef typename _Rep_type::const_iterator const_iterator;
18725 typedef typename _Rep_type::size_type size_type;
18726 typedef typename _Rep_type::difference_type difference_type;
18727 typedef typename _Rep_type::reverse_iterator reverse_iterator;
18728 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
18729 map()
18730 : _M_t() { }
18731 explicit
18732 map(const _Compare& __comp,
18733 const allocator_type& __a = allocator_type())
18734 : _M_t(__comp, __a) { }
18735 map(const map& __x)
18736 : _M_t(__x._M_t) { }
18737 template<typename _InputIterator>
18738 map(_InputIterator __first, _InputIterator __last)
18739 : _M_t()
18740 { _M_t._M_insert_unique(__first, __last); }
18741 template<typename _InputIterator>
18742 map(_InputIterator __first, _InputIterator __last,
18743 const _Compare& __comp,
18744 const allocator_type& __a = allocator_type())
18745 : _M_t(__comp, __a)
18746 { _M_t._M_insert_unique(__first, __last); }
18747 map&
18748 operator=(const map& __x)
18749 {
18750 _M_t = __x._M_t;
18751 return *this;
18752 }
18753 allocator_type
18754 get_allocator() const
18755 { return _M_t.get_allocator(); }
18756 iterator
18757 begin()
18758 { return _M_t.begin(); }
18759 const_iterator
18760 begin() const
18761 { return _M_t.begin(); }
18762 iterator
18763 end()
18764 { return _M_t.end(); }
18765 const_iterator
18766 end() const
18767 { return _M_t.end(); }
18768 reverse_iterator
18769 rbegin()
18770 { return _M_t.rbegin(); }
18771 const_reverse_iterator
18772 rbegin() const
18773 { return _M_t.rbegin(); }
18774 reverse_iterator
18775 rend()
18776 { return _M_t.rend(); }
18777 const_reverse_iterator
18778 rend() const
18779 { return _M_t.rend(); }
18780 bool
18781 empty() const
18782 { return _M_t.empty(); }
18783 size_type
18784 size() const
18785 { return _M_t.size(); }
18786 size_type
18787 max_size() const
18788 { return _M_t.max_size(); }
18789 mapped_type&
18790 operator[](const key_type& __k)
18791 {
18792 iterator __i = lower_bound(__k);
18793 if (__i == end() || key_comp()(__k, (*__i).first))
18794 __i = insert(__i, value_type(__k, mapped_type()));
18795 return (*__i).second;
18796 }
18797 mapped_type&
18798 at(const key_type& __k)
18799 {
18800 iterator __i = lower_bound(__k);
18801 if (__i == end() || key_comp()(__k, (*__i).first))
18802 __throw_out_of_range(("map::at"));
18803 return (*__i).second;
18804 }
18805 const mapped_type&
18806 at(const key_type& __k) const
18807 {
18808 const_iterator __i = lower_bound(__k);
18809 if (__i == end() || key_comp()(__k, (*__i).first))
18810 __throw_out_of_range(("map::at"));
18811 return (*__i).second;
18812 }
18813 std::pair<iterator, bool>
18814 insert(const value_type& __x)
18815 { return _M_t._M_insert_unique(__x); }
18816 iterator
18817 insert(iterator __position, const value_type& __x)
18818 { return _M_t._M_insert_unique_(__position, __x); }
18819 template<typename _InputIterator>
18820 void
18821 insert(_InputIterator __first, _InputIterator __last)
18822 { _M_t._M_insert_unique(__first, __last); }
18823 void
18824 erase(iterator __position)
18825 { _M_t.erase(__position); }
18826 size_type
18827 erase(const key_type& __x)
18828 { return _M_t.erase(__x); }
18829 void
18830 erase(iterator __first, iterator __last)
18831 { _M_t.erase(__first, __last); }
18832 void
18833 swap(map& __x)
18834 { _M_t.swap(__x._M_t); }
18835 void
18836 clear()
18837 { _M_t.clear(); }
18838 key_compare
18839 key_comp() const
18840 { return _M_t.key_comp(); }
18841 value_compare
18842 value_comp() const
18843 { return value_compare(_M_t.key_comp()); }
18844 iterator
18845 find(const key_type& __x)
18846 { return _M_t.find(__x); }
18847 const_iterator
18848 find(const key_type& __x) const
18849 { return _M_t.find(__x); }
18850 size_type
18851 count(const key_type& __x) const
18852 { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
18853 iterator
18854 lower_bound(const key_type& __x)
18855 { return _M_t.lower_bound(__x); }
18856 const_iterator
18857 lower_bound(const key_type& __x) const
18858 { return _M_t.lower_bound(__x); }
18859 iterator
18860 upper_bound(const key_type& __x)
18861 { return _M_t.upper_bound(__x); }
18862 const_iterator
18863 upper_bound(const key_type& __x) const
18864 { return _M_t.upper_bound(__x); }
18865 std::pair<iterator, iterator>
18866 equal_range(const key_type& __x)
18867 { return _M_t.equal_range(__x); }
18868 std::pair<const_iterator, const_iterator>
18869 equal_range(const key_type& __x) const
18870 { return _M_t.equal_range(__x); }
18871 template<typename _K1, typename _T1, typename _C1, typename _A1>
18872 friend bool
18873 operator==(const map<_K1, _T1, _C1, _A1>&,
18874 const map<_K1, _T1, _C1, _A1>&);
18875 template<typename _K1, typename _T1, typename _C1, typename _A1>
18876 friend bool
18877 operator<(const map<_K1, _T1, _C1, _A1>&,
18878 const map<_K1, _T1, _C1, _A1>&);
18879 };
18880 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18881 inline bool
18882 operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18883 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18884 { return __x._M_t == __y._M_t; }
18885 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18886 inline bool
18887 operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18888 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18889 { return __x._M_t < __y._M_t; }
18890 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18891 inline bool
18892 operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18893 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18894 { return !(__x == __y); }
18895 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18896 inline bool
18897 operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18898 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18899 { return __y < __x; }
18900 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18901 inline bool
18902 operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18903 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18904 { return !(__y < __x); }
18905 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18906 inline bool
18907 operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
18908 const map<_Key, _Tp, _Compare, _Alloc>& __y)
18909 { return !(__x < __y); }
18910 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
18911 inline void
18912 swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
18913 map<_Key, _Tp, _Compare, _Alloc>& __y)
18914 { __x.swap(__y); }
18915 }
18916 namespace std __attribute__ ((__visibility__ ("default"))) {
18917 template <typename _Key, typename _Tp,
18918 typename _Compare = std::less<_Key>,
18919 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
18920 class multimap
18921 {
18922 public:
18923 typedef _Key key_type;
18924 typedef _Tp mapped_type;
18925 typedef std::pair<const _Key, _Tp> value_type;
18926 typedef _Compare key_compare;
18927 typedef _Alloc allocator_type;
18928 private:
18929 typedef typename _Alloc::value_type _Alloc_value_type;
18930 public:
18931 class value_compare
18932 : public std::binary_function<value_type, value_type, bool>
18933 {
18934 friend class multimap<_Key, _Tp, _Compare, _Alloc>;
18935 protected:
18936 _Compare comp;
18937 value_compare(_Compare __c)
18938 : comp(__c) { }
18939 public:
18940 bool operator()(const value_type& __x, const value_type& __y) const
18941 { return comp(__x.first, __y.first); }
18942 };
18943 private:
18944 typedef typename _Alloc::template rebind<value_type>::other
18945 _Pair_alloc_type;
18946 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
18947 key_compare, _Pair_alloc_type> _Rep_type;
18948 _Rep_type _M_t;
18949 public:
18950 typedef typename _Pair_alloc_type::pointer pointer;
18951 typedef typename _Pair_alloc_type::const_pointer const_pointer;
18952 typedef typename _Pair_alloc_type::reference reference;
18953 typedef typename _Pair_alloc_type::const_reference const_reference;
18954 typedef typename _Rep_type::iterator iterator;
18955 typedef typename _Rep_type::const_iterator const_iterator;
18956 typedef typename _Rep_type::size_type size_type;
18957 typedef typename _Rep_type::difference_type difference_type;
18958 typedef typename _Rep_type::reverse_iterator reverse_iterator;
18959 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
18960 multimap()
18961 : _M_t() { }
18962 explicit
18963 multimap(const _Compare& __comp,
18964 const allocator_type& __a = allocator_type())
18965 : _M_t(__comp, __a) { }
18966 multimap(const multimap& __x)
18967 : _M_t(__x._M_t) { }
18968 template<typename _InputIterator>
18969 multimap(_InputIterator __first, _InputIterator __last)
18970 : _M_t()
18971 { _M_t._M_insert_equal(__first, __last); }
18972 template<typename _InputIterator>
18973 multimap(_InputIterator __first, _InputIterator __last,
18974 const _Compare& __comp,
18975 const allocator_type& __a = allocator_type())
18976 : _M_t(__comp, __a)
18977 { _M_t._M_insert_equal(__first, __last); }
18978 multimap&
18979 operator=(const multimap& __x)
18980 {
18981 _M_t = __x._M_t;
18982 return *this;
18983 }
18984 allocator_type
18985 get_allocator() const
18986 { return _M_t.get_allocator(); }
18987 iterator
18988 begin()
18989 { return _M_t.begin(); }
18990 const_iterator
18991 begin() const
18992 { return _M_t.begin(); }
18993 iterator
18994 end()
18995 { return _M_t.end(); }
18996 const_iterator
18997 end() const
18998 { return _M_t.end(); }
18999 reverse_iterator
19000 rbegin()
19001 { return _M_t.rbegin(); }
19002 const_reverse_iterator
19003 rbegin() const
19004 { return _M_t.rbegin(); }
19005 reverse_iterator
19006 rend()
19007 { return _M_t.rend(); }
19008 const_reverse_iterator
19009 rend() const
19010 { return _M_t.rend(); }
19011 bool
19012 empty() const
19013 { return _M_t.empty(); }
19014 size_type
19015 size() const
19016 { return _M_t.size(); }
19017 size_type
19018 max_size() const
19019 { return _M_t.max_size(); }
19020 iterator
19021 insert(const value_type& __x)
19022 { return _M_t._M_insert_equal(__x); }
19023 iterator
19024 insert(iterator __position, const value_type& __x)
19025 { return _M_t._M_insert_equal_(__position, __x); }
19026 template<typename _InputIterator>
19027 void
19028 insert(_InputIterator __first, _InputIterator __last)
19029 { _M_t._M_insert_equal(__first, __last); }
19030 void
19031 erase(iterator __position)
19032 { _M_t.erase(__position); }
19033 size_type
19034 erase(const key_type& __x)
19035 { return _M_t.erase(__x); }
19036 void
19037 erase(iterator __first, iterator __last)
19038 { _M_t.erase(__first, __last); }
19039 void
19040 swap(multimap& __x)
19041 { _M_t.swap(__x._M_t); }
19042 void
19043 clear()
19044 { _M_t.clear(); }
19045 key_compare
19046 key_comp() const
19047 { return _M_t.key_comp(); }
19048 value_compare
19049 value_comp() const
19050 { return value_compare(_M_t.key_comp()); }
19051 iterator
19052 find(const key_type& __x)
19053 { return _M_t.find(__x); }
19054 const_iterator
19055 find(const key_type& __x) const
19056 { return _M_t.find(__x); }
19057 size_type
19058 count(const key_type& __x) const
19059 { return _M_t.count(__x); }
19060 iterator
19061 lower_bound(const key_type& __x)
19062 { return _M_t.lower_bound(__x); }
19063 const_iterator
19064 lower_bound(const key_type& __x) const
19065 { return _M_t.lower_bound(__x); }
19066 iterator
19067 upper_bound(const key_type& __x)
19068 { return _M_t.upper_bound(__x); }
19069 const_iterator
19070 upper_bound(const key_type& __x) const
19071 { return _M_t.upper_bound(__x); }
19072 std::pair<iterator, iterator>
19073 equal_range(const key_type& __x)
19074 { return _M_t.equal_range(__x); }
19075 std::pair<const_iterator, const_iterator>
19076 equal_range(const key_type& __x) const
19077 { return _M_t.equal_range(__x); }
19078 template<typename _K1, typename _T1, typename _C1, typename _A1>
19079 friend bool
19080 operator==(const multimap<_K1, _T1, _C1, _A1>&,
19081 const multimap<_K1, _T1, _C1, _A1>&);
19082 template<typename _K1, typename _T1, typename _C1, typename _A1>
19083 friend bool
19084 operator<(const multimap<_K1, _T1, _C1, _A1>&,
19085 const multimap<_K1, _T1, _C1, _A1>&);
19086 };
19087 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19088 inline bool
19089 operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19090 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19091 { return __x._M_t == __y._M_t; }
19092 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19093 inline bool
19094 operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19095 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19096 { return __x._M_t < __y._M_t; }
19097 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19098 inline bool
19099 operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19100 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19101 { return !(__x == __y); }
19102 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19103 inline bool
19104 operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19105 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19106 { return __y < __x; }
19107 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19108 inline bool
19109 operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19110 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19111 { return !(__y < __x); }
19112 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19113 inline bool
19114 operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19115 const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19116 { return !(__x < __y); }
19117 template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
19118 inline void
19119 swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
19120 multimap<_Key, _Tp, _Compare, _Alloc>& __y)
19121 { __x.swap(__y); }
19122 }
19123 typedef QtValidLicenseForCoreModule QtCoreModule;
19124 struct __attribute__((visibility("default"))) QMapData
19125 {
19126 struct Node {
19127 Node *backward;
19128 Node *forward[1];
19129 };
19130 enum { LastLevel = 11, Sparseness = 3 };
19131 QMapData *backward;
19132 QMapData *forward[QMapData::LastLevel + 1];
19133 QBasicAtomicInt ref;
19134 int topLevel;
19135 int size;
19136 uint randomBits;
19137 uint insertInOrder : 1;
19138 uint sharable : 1;
19139 static QMapData *createData();
19140 void continueFreeData(int offset);
19141 Node *node_create(Node *update[], int offset);
19142 void node_delete(Node *update[], int offset, Node *node);
19143 static QMapData shared_null;
19144 };
19145 template <class Key> inline bool qMapLessThanKey(const Key &key1, const Key &key2)
19146 {
19147 return key1 < key2;
19148 }
19149 template <class Ptr> inline bool qMapLessThanKey(Ptr *key1, Ptr *key2)
19150 {
19151 qt_noop();
19152 return quintptr(key1) < quintptr(key2);
19153 }
19154 template <class Ptr> inline bool qMapLessThanKey(const Ptr *key1, const Ptr *key2)
19155 {
19156 qt_noop();
19157 return quintptr(key1) < quintptr(key2);
19158 }
19159 template <class Key, class T>
19160 struct QMapNode {
19161 Key key;
19162 T value;
19163 QMapData::Node *backward;
19164 QMapData::Node *forward[1];
19165 };
19166 template <class Key, class T>
19167 struct QMapPayloadNode
19168 {
19169 Key key;
19170 T value;
19171 QMapData::Node *backward;
19172 };
19173 template <class Key, class T>
19174 class QMap
19175 {
19176 typedef QMapNode<Key, T> Node;
19177 typedef QMapPayloadNode<Key, T> PayloadNode;
19178 union {
19179 QMapData *d;
19180 QMapData::Node *e;
19181 };
19182 static inline int payload() { return sizeof(PayloadNode) - sizeof(QMapData::Node *); }
19183 static inline Node *concrete(QMapData::Node *node) {
19184 return reinterpret_cast<Node *>(reinterpret_cast<char *>(node) - payload());
19185 }
19186 public:
19187 inline QMap() : d(&QMapData::shared_null) { d->ref.ref(); }
19188 inline QMap(const QMap<Key, T> &other) : d(other.d)
19189 { d->ref.ref(); if (!d->sharable) detach(); }
19190 inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); }
19191 QMap<Key, T> &operator=(const QMap<Key, T> &other);
19192 explicit QMap(const typename std::map<Key, T> &other);
19193 std::map<Key, T> toStdMap() const;
19194 bool operator==(const QMap<Key, T> &other) const;
19195 inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); }
19196 inline int size() const { return d->size; }
19197 inline bool isEmpty() const { return d->size == 0; }
19198 inline void detach() { if (d->ref != 1) detach_helper(); }
19199 inline bool isDetached() const { return d->ref == 1; }
19200 inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
19201 inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; }
19202 void clear();
19203 int remove(const Key &key);
19204 T take(const Key &key);
19205 bool contains(const Key &key) const;
19206 const Key key(const T &value) const;
19207 const Key key(const T &value, const Key &defaultKey) const;
19208 const T value(const Key &key) const;
19209 const T value(const Key &key, const T &defaultValue) const;
19210 T &operator[](const Key &key);
19211 const T operator[](const Key &key) const;
19212 QList<Key> uniqueKeys() const;
19213 QList<Key> keys() const;
19214 QList<Key> keys(const T &value) const;
19215 QList<T> values() const;
19216 QList<T> values(const Key &key) const;
19217 int count(const Key &key) const;
19218 class const_iterator;
19219 class iterator
19220 {
19221 friend class const_iterator;
19222 QMapData::Node *i;
19223 public:
19224 typedef std::bidirectional_iterator_tag iterator_category;
19225 typedef ptrdiff_t difference_type;
19226 typedef T value_type;
19227 typedef T *pointer;
19228 typedef T &reference;
19229 inline operator QMapData::Node *() const { return i; }
19230 inline iterator() : i(0) { }
19231 inline iterator(QMapData::Node *node) : i(node) { }
19232 inline const Key &key() const { return concrete(i)->key; }
19233 inline T &value() const { return concrete(i)->value; }
19234 inline T &operator*() const { return concrete(i)->value; }
19235 inline T *operator->() const { return &concrete(i)->value; }
19236 inline bool operator==(const iterator &o) const { return i == o.i; }
19237 inline bool operator!=(const iterator &o) const { return i != o.i; }
19238 inline iterator &operator++() {
19239 i = i->forward[0];
19240 return *this;
19241 }
19242 inline iterator operator++(int) {
19243 iterator r = *this;
19244 i = i->forward[0];
19245 return r;
19246 }
19247 inline iterator &operator--() {
19248 i = i->backward;
19249 return *this;
19250 }
19251 inline iterator operator--(int) {
19252 iterator r = *this;
19253 i = i->backward;
19254 return r;
19255 }
19256 inline iterator operator+(int j) const
19257 { iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
19258 inline iterator operator-(int j) const { return operator+(-j); }
19259 inline iterator &operator+=(int j) { return *this = *this + j; }
19260 inline iterator &operator-=(int j) { return *this = *this - j; }
19261 public:
19262 inline bool operator==(const const_iterator &o) const
19263 { return i == o.i; }
19264 inline bool operator!=(const const_iterator &o) const
19265 { return i != o.i; }
19266 private:
19267 inline operator bool() const { return false; }
19268 };
19269 friend class iterator;
19270 class const_iterator
19271 {
19272 friend class iterator;
19273 QMapData::Node *i;
19274 public:
19275 typedef std::bidirectional_iterator_tag iterator_category;
19276 typedef ptrdiff_t difference_type;
19277 typedef T value_type;
19278 typedef const T *pointer;
19279 typedef const T &reference;
19280 inline operator QMapData::Node *() const { return i; }
19281 inline const_iterator() : i(0) { }
19282 inline const_iterator(QMapData::Node *node) : i(node) { }
19283 inline const_iterator(const iterator &o)
19284 { i = o.i; }
19285 inline const Key &key() const { return concrete(i)->key; }
19286 inline const T &value() const { return concrete(i)->value; }
19287 inline const T &operator*() const { return concrete(i)->value; }
19288 inline const T *operator->() const { return &concrete(i)->value; }
19289 inline bool operator==(const const_iterator &o) const { return i == o.i; }
19290 inline bool operator!=(const const_iterator &o) const { return i != o.i; }
19291 inline const_iterator &operator++() {
19292 i = i->forward[0];
19293 return *this;
19294 }
19295 inline const_iterator operator++(int) {
19296 const_iterator r = *this;
19297 i = i->forward[0];
19298 return r;
19299 }
19300 inline const_iterator &operator--() {
19301 i = i->backward;
19302 return *this;
19303 }
19304 inline const_iterator operator--(int) {
19305 const_iterator r = *this;
19306 i = i->backward;
19307 return r;
19308 }
19309 inline const_iterator operator+(int j) const
19310 { const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
19311 inline const_iterator operator-(int j) const { return operator+(-j); }
19312 inline const_iterator &operator+=(int j) { return *this = *this + j; }
19313 inline const_iterator &operator-=(int j) { return *this = *this - j; }
19314 private:
19315 inline operator bool() const { return false; }
19316 };
19317 friend class const_iterator;
19318 inline iterator begin() { detach(); return iterator(e->forward[0]); }
19319 inline const_iterator begin() const { return const_iterator(e->forward[0]); }
19320 inline const_iterator constBegin() const { return const_iterator(e->forward[0]); }
19321 inline iterator end() {
19322 detach();
19323 return iterator(e);
19324 }
19325 inline const_iterator end() const { return const_iterator(e); }
19326 inline const_iterator constEnd() const { return const_iterator(e); }
19327 iterator erase(iterator it);
19328 typedef iterator Iterator;
19329 typedef const_iterator ConstIterator;
19330 inline int count() const { return d->size; }
19331 iterator find(const Key &key);
19332 const_iterator find(const Key &key) const;
19333 const_iterator constFind(const Key &key) const;
19334 iterator lowerBound(const Key &key);
19335 const_iterator lowerBound(const Key &key) const;
19336 iterator upperBound(const Key &key);
19337 const_iterator upperBound(const Key &key) const;
19338 iterator insert(const Key &key, const T &value);
19339 iterator insertMulti(const Key &key, const T &value);
19340 QMap<Key, T> &unite(const QMap<Key, T> &other);
19341 typedef Key key_type;
19342 typedef T mapped_type;
19343 typedef ptrdiff_t difference_type;
19344 typedef int size_type;
19345 inline bool empty() const { return isEmpty(); }
19346 private:
19347 void detach_helper();
19348 void freeData(QMapData *d);
19349 QMapData::Node *findNode(const Key &key) const;
19350 QMapData::Node *mutableFindNode(QMapData::Node *update[], const Key &key) const;
19351 QMapData::Node *node_create(QMapData *d, QMapData::Node *update[], const Key &key,
19352 const T &value);
19353 };
19354 template <class Key, class T>
19355 inline QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other)
19356 {
19357 if (d != other.d) {
19358 other.d->ref.ref();
19359 if (!d->ref.deref())
19360 freeData(d);
19361 d = other.d;
19362 if (!d->sharable)
19363 detach_helper();
19364 }
19365 return *this;
19366 }
19367 template <class Key, class T>
19368 inline void QMap<Key, T>::clear()
19369 {
19370 *this = QMap<Key, T>();
19371 }
19372 template <class Key, class T>
19373 inline typename QMapData::Node *
19374 QMap<Key, T>::node_create(QMapData *adt, QMapData::Node *aupdate[], const Key &akey, const T &avalue)
19375 {
19376 QMapData::Node *abstractNode = adt->node_create(aupdate, payload());
19377 Node *concreteNode = concrete(abstractNode);
19378 new (&concreteNode->key) Key(akey);
19379 new (&concreteNode->value) T(avalue);
19380 return abstractNode;
19381 }
19382 template <class Key, class T>
19383 inline QMapData::Node *QMap<Key, T>::findNode(const Key &akey) const
19384 {
19385 QMapData::Node *cur = e;
19386 QMapData::Node *next = e;
19387 for (int i = d->topLevel; i >= 0; i--) {
19388 while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey))
19389 cur = next;
19390 }
19391 if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) {
19392 return next;
19393 } else {
19394 return e;
19395 }
19396 }
19397 template <class Key, class T>
19398 inline const T QMap<Key, T>::value(const Key &akey) const
19399 {
19400 QMapData::Node *node;
19401 if (d->size == 0 || (node = findNode(akey)) == e) {
19402 return T();
19403 } else {
19404 return concrete(node)->value;
19405 }
19406 }
19407 template <class Key, class T>
19408 inline const T QMap<Key, T>::value(const Key &akey, const T &adefaultValue) const
19409 {
19410 QMapData::Node *node;
19411 if (d->size == 0 || (node = findNode(akey)) == e) {
19412 return adefaultValue;
19413 } else {
19414 return concrete(node)->value;
19415 }
19416 }
19417 template <class Key, class T>
19418 inline const T QMap<Key, T>::operator[](const Key &akey) const
19419 {
19420 return value(akey);
19421 }
19422 template <class Key, class T>
19423 inline T &QMap<Key, T>::operator[](const Key &akey)
19424 {
19425 detach();
19426 QMapData::Node *update[QMapData::LastLevel + 1];
19427 QMapData::Node *node = mutableFindNode(update, akey);
19428 if (node == e)
19429 node = node_create(d, update, akey, T());
19430 return concrete(node)->value;
19431 }
19432 template <class Key, class T>
19433 inline int QMap<Key, T>::count(const Key &akey) const
19434 {
19435 int cnt = 0;
19436 QMapData::Node *node = findNode(akey);
19437 if (node != e) {
19438 do {
19439 ++cnt;
19440 node = node->forward[0];
19441 } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key));
19442 }
19443 return cnt;
19444 }
19445 template <class Key, class T>
19446 inline bool QMap<Key, T>::contains(const Key &akey) const
19447 {
19448 return findNode(akey) != e;
19449 }
19450 template <class Key, class T>
19451 inline typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey,
19452 const T &avalue)
19453 {
19454 detach();
19455 QMapData::Node *update[QMapData::LastLevel + 1];
19456 QMapData::Node *node = mutableFindNode(update, akey);
19457 if (node == e) {
19458 node = node_create(d, update, akey, avalue);
19459 } else {
19460 concrete(node)->value = avalue;
19461 }
19462 return iterator(node);
19463 }
19464 template <class Key, class T>
19465 inline typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey,
19466 const T &avalue)
19467 {
19468 detach();
19469 QMapData::Node *update[QMapData::LastLevel + 1];
19470 mutableFindNode(update, akey);
19471 return iterator(node_create(d, update, akey, avalue));
19472 }
19473 template <class Key, class T>
19474 inline typename QMap<Key, T>::const_iterator QMap<Key, T>::find(const Key &akey) const
19475 {
19476 return const_iterator(findNode(akey));
19477 }
19478 template <class Key, class T>
19479 inline typename QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &akey) const
19480 {
19481 return const_iterator(findNode(akey));
19482 }
19483 template <class Key, class T>
19484 inline typename QMap<Key, T>::iterator QMap<Key, T>::find(const Key &akey)
19485 {
19486 detach();
19487 return iterator(findNode(akey));
19488 }
19489 template <class Key, class T>
19490 inline QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other)
19491 {
19492 QMap<Key, T> copy(other);
19493 const_iterator it = copy.constEnd();
19494 const const_iterator b = copy.constBegin();
19495 while (it != b) {
19496 --it;
19497 insertMulti(it.key(), it.value());
19498 }
19499 return *this;
19500 }
19501 template <class Key, class T>
19502 void QMap<Key, T>::freeData(QMapData *x)
19503 {
19504 if (QTypeInfo<Key>::isComplex || QTypeInfo<T>::isComplex) {
19505 QMapData::Node *y = reinterpret_cast<QMapData::Node *>(x);
19506 QMapData::Node *cur = y;
19507 QMapData::Node *next = cur->forward[0];
19508 while (next != y) {
19509 cur = next;
19510 next = cur->forward[0];
19511 Node *concreteNode = concrete(cur);
19512 concreteNode->key.~Key();
19513 concreteNode->value.~T();
19514 }
19515 }
19516 x->continueFreeData(payload());
19517 }
19518 template <class Key, class T>
19519 int QMap<Key, T>::remove(const Key &akey)
19520 {
19521 detach();
19522 QMapData::Node *update[QMapData::LastLevel + 1];
19523 QMapData::Node *cur = e;
19524 QMapData::Node *next = e;
19525 int oldSize = d->size;
19526 for (int i = d->topLevel; i >= 0; i--) {
19527 while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey))
19528 cur = next;
19529 update[i] = cur;
19530 }
19531 if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) {
19532 bool deleteNext = true;
19533 do {
19534 cur = next;
19535 next = cur->forward[0];
19536 deleteNext = (next != e && !qMapLessThanKey<Key>(concrete(cur)->key, concrete(next)->key));
19537 concrete(cur)->key.~Key();
19538 concrete(cur)->value.~T();
19539 d->node_delete(update, payload(), cur);
19540 } while (deleteNext);
19541 }
19542 return oldSize - d->size;
19543 }
19544 template <class Key, class T>
19545 T QMap<Key, T>::take(const Key &akey)
19546 {
19547 detach();
19548 QMapData::Node *update[QMapData::LastLevel + 1];
19549 QMapData::Node *cur = e;
19550 QMapData::Node *next = e;
19551 for (int i = d->topLevel; i >= 0; i--) {
19552 while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey))
19553 cur = next;
19554 update[i] = cur;
19555 }
19556 if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) {
19557 T t = concrete(next)->value;
19558 concrete(next)->key.~Key();
19559 concrete(next)->value.~T();
19560 d->node_delete(update, payload(), next);
19561 return t;
19562 }
19563 return T();
19564 }
19565 template <class Key, class T>
19566 typename QMap<Key, T>::iterator QMap<Key, T>::erase(iterator it)
19567 {
19568 QMapData::Node *update[QMapData::LastLevel + 1];
19569 QMapData::Node *cur = e;
19570 QMapData::Node *next = e;
19571 if (it == iterator(e))
19572 return it;
19573 for (int i = d->topLevel; i >= 0; i--) {
19574 while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, it.key()))
19575 cur = next;
19576 update[i] = cur;
19577 }
19578 while (next != e) {
19579 cur = next;
19580 next = cur->forward[0];
19581 if (cur == it) {
19582 concrete(cur)->key.~Key();
19583 concrete(cur)->value.~T();
19584 d->node_delete(update, payload(), cur);
19585 return iterator(next);
19586 }
19587 for (int i = 0; i <= d->topLevel; ++i) {
19588 if (update[i]->forward[i] != cur)
19589 break;
19590 update[i] = cur;
19591 }
19592 }
19593 return end();
19594 }
19595 template <class Key, class T>
19596 void QMap<Key, T>::detach_helper()
19597 {
19598 union { QMapData *d; QMapData::Node *e; } x;
19599 x.d = QMapData::createData();
19600 if (d->size) {
19601 x.d->insertInOrder = true;
19602 QMapData::Node *update[QMapData::LastLevel + 1];
19603 QMapData::Node *cur = e->forward[0];
19604 update[0] = x.e;
19605 while (cur != e) {
19606 Node *concreteNode = concrete(cur);
19607 node_create(x.d, update, concreteNode->key, concreteNode->value);
19608 cur = cur->forward[0];
19609 }
19610 x.d->insertInOrder = false;
19611 }
19612 if (!d->ref.deref())
19613 freeData(d);
19614 d = x.d;
19615 }
19616 template <class Key, class T>
19617 QMapData::Node *QMap<Key, T>::mutableFindNode(QMapData::Node *aupdate[],
19618 const Key &akey) const
19619 {
19620 QMapData::Node *cur = e;
19621 QMapData::Node *next = e;
19622 for (int i = d->topLevel; i >= 0; i--) {
19623 while ((next = cur->forward[i]) != e && qMapLessThanKey<Key>(concrete(next)->key, akey))
19624 cur = next;
19625 aupdate[i] = cur;
19626 }
19627 if (next != e && !qMapLessThanKey<Key>(akey, concrete(next)->key)) {
19628 return next;
19629 } else {
19630 return e;
19631 }
19632 }
19633 template <class Key, class T>
19634 QList<Key> QMap<Key, T>::uniqueKeys() const
19635 {
19636 QList<Key> res;
19637 const_iterator i = begin();
19638 if (i != end()) {
19639 for (;;) {
19640 const Key &aKey = i.key();
19641 res.append(aKey);
19642 do {
19643 if (++i == end())
19644 goto break_out_of_outer_loop;
19645 } while (!(aKey < i.key()));
19646 }
19647 }
19648 break_out_of_outer_loop:
19649 return res;
19650 }
19651 template <class Key, class T>
19652 QList<Key> QMap<Key, T>::keys() const
19653 {
19654 QList<Key> res;
19655 const_iterator i = begin();
19656 while (i != end()) {
19657 res.append(i.key());
19658 ++i;
19659 }
19660 return res;
19661 }
19662 template <class Key, class T>
19663 QList<Key> QMap<Key, T>::keys(const T &avalue) const
19664 {
19665 QList<Key> res;
19666 const_iterator i = begin();
19667 while (i != end()) {
19668 if (i.value() == avalue)
19669 res.append(i.key());
19670 ++i;
19671 }
19672 return res;
19673 }
19674 template <class Key, class T>
19675 const Key QMap<Key, T>::key(const T &avalue) const
19676 {
19677 return key(avalue, Key());
19678 }
19679 template <class Key, class T>
19680 const Key QMap<Key, T>::key(const T &avalue, const Key &defaultKey) const
19681 {
19682 const_iterator i = begin();
19683 while (i != end()) {
19684 if (i.value() == avalue)
19685 return i.key();
19686 ++i;
19687 }
19688 return defaultKey;
19689 }
19690 template <class Key, class T>
19691 QList<T> QMap<Key, T>::values() const
19692 {
19693 QList<T> res;
19694 const_iterator i = begin();
19695 while (i != end()) {
19696 res.append(i.value());
19697 ++i;
19698 }
19699 return res;
19700 }
19701 template <class Key, class T>
19702 QList<T> QMap<Key, T>::values(const Key &akey) const
19703 {
19704 QList<T> res;
19705 QMapData::Node *node = findNode(akey);
19706 if (node != e) {
19707 do {
19708 res.append(concrete(node)->value);
19709 node = node->forward[0];
19710 } while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key));
19711 }
19712 return res;
19713 }
19714 template <class Key, class T>
19715 inline typename QMap<Key, T>::const_iterator
19716 QMap<Key, T>::lowerBound(const Key &akey) const
19717 {
19718 QMapData::Node *update[QMapData::LastLevel + 1];
19719 mutableFindNode(update, akey);
19720 return const_iterator(update[0]->forward[0]);
19721 }
19722 template <class Key, class T>
19723 inline typename QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &akey)
19724 {
19725 detach();
19726 return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->lowerBound(akey));
19727 }
19728 template <class Key, class T>
19729 inline typename QMap<Key, T>::const_iterator
19730 QMap<Key, T>::upperBound(const Key &akey) const
19731 {
19732 QMapData::Node *update[QMapData::LastLevel + 1];
19733 mutableFindNode(update, akey);
19734 QMapData::Node *node = update[0]->forward[0];
19735 while (node != e && !qMapLessThanKey<Key>(akey, concrete(node)->key))
19736 node = node->forward[0];
19737 return const_iterator(node);
19738 }
19739 template <class Key, class T>
19740 inline typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &akey)
19741 {
19742 detach();
19743 return static_cast<QMapData::Node *>(const_cast<const QMap *>(this)->upperBound(akey));
19744 }
19745 template <class Key, class T>
19746 bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const
19747 {
19748 if (size() != other.size())
19749 return false;
19750 if (d == other.d)
19751 return true;
19752 const_iterator it1 = begin();
19753 const_iterator it2 = other.begin();
19754 while (it1 != end()) {
19755 if (!(it1.value() == it2.value()) || qMapLessThanKey(it1.key(), it2.key()) || qMapLessThanKey(it2.key(), it1.key()))
19756 return false;
19757 ++it2;
19758 ++it1;
19759 }
19760 return true;
19761 }
19762 template <class Key, class T>
19763 QMap<Key, T>::QMap(const std::map<Key, T> &other)
19764 {
19765 d = QMapData::createData();
19766 d->insertInOrder = true;
19767 typename std::map<Key,T>::const_iterator it = other.end();
19768 while (it != other.begin()) {
19769 --it;
19770 insert((*it).first, (*it).second);
19771 }
19772 d->insertInOrder = false;
19773 }
19774 template <class Key, class T>
19775 std::map<Key, T> QMap<Key, T>::toStdMap() const
19776 {
19777 std::map<Key, T> map;
19778 const_iterator it = end();
19779 while (it != begin()) {
19780 --it;
19781 map.insert(std::pair<Key, T>(it.key(), it.value()));
19782 }
19783 return map;
19784 }
19785 template <class Key, class T>
19786 class QMultiMap : public QMap<Key, T>
19787 {
19788 public:
19789 QMultiMap() {}
19790 QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {}
19791 inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value)
19792 { return QMap<Key, T>::insert(key, value); }
19793 inline typename QMap<Key, T>::iterator insert(const Key &key, const T &value)
19794 { return QMap<Key, T>::insertMulti(key, value); }
19795 inline QMultiMap &operator+=(const QMultiMap &other)
19796 { unite(other); return *this; }
19797 inline QMultiMap operator+(const QMultiMap &other) const
19798 { QMultiMap result = *this; result += other; return result; }
19799 using QMap<Key, T>::contains;
19800 using QMap<Key, T>::remove;
19801 using QMap<Key, T>::count;
19802 using QMap<Key, T>::find;
19803 using QMap<Key, T>::constFind;
19804 bool contains(const Key &key, const T &value) const;
19805 int remove(const Key &key, const T &value);
19806 int count(const Key &key, const T &value) const;
19807 typename QMap<Key, T>::iterator find(const Key &key, const T &value) {
19808 typename QMap<Key, T>::iterator i(find(key));
19809 typename QMap<Key, T>::iterator end(this->end());
19810 while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
19811 if (i.value() == value)
19812 return i;
19813 ++i;
19814 }
19815 return end;
19816 }
19817 typename QMap<Key, T>::const_iterator find(const Key &key, const T &value) const {
19818 typename QMap<Key, T>::const_iterator i(constFind(key));
19819 typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd());
19820 while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
19821 if (i.value() == value)
19822 return i;
19823 ++i;
19824 }
19825 return end;
19826 }
19827 typename QMap<Key, T>::const_iterator constFind(const Key &key, const T &value) const
19828 { return find(key, value); }
19829 private:
19830 T &operator[](const Key &key);
19831 const T operator[](const Key &key) const;
19832 };
19833 template <class Key, class T>
19834 inline bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const
19835 {
19836 return constFind(key, value) != QMap<Key, T>::constEnd();
19837 }
19838 template <class Key, class T>
19839 inline int QMultiMap<Key, T>::remove(const Key &key, const T &value)
19840 {
19841 int n = 0;
19842 typename QMap<Key, T>::iterator i(find(key));
19843 typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd());
19844 while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
19845 if (i.value() == value) {
19846 i = erase(i);
19847 ++n;
19848 } else {
19849 ++i;
19850 }
19851 }
19852 return n;
19853 }
19854 template <class Key, class T>
19855 inline int QMultiMap<Key, T>::count(const Key &key, const T &value) const
19856 {
19857 int n = 0;
19858 typename QMap<Key, T>::const_iterator i(constFind(key));
19859 typename QMap<Key, T>::const_iterator end(QMap<Key, T>::constEnd());
19860 while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
19861 if (i.value() == value)
19862 ++n;
19863 ++i;
19864 }
19865 return n;
19866 }
19867 template <class Key, class T> class QMapIterator { typedef typename QMap<Key,T>::const_iterator const_iterator; typedef const_iterator Item; QMap<Key,T> c; const_iterator i, n; inline bool item_exists() const { return n != c.constEnd(); } public: inline QMapIterator(const QMap<Key,T> &container) : c(container), i(c.constBegin()), n(c.constEnd()) {} inline QMapIterator &operator=(const QMap<Key,T> &container) { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } inline void toFront() { i = c.constBegin(); n = c.constEnd(); } inline void toBack() { i = c.constEnd(); n = c.constEnd(); } inline bool hasNext() const { return i != c.constEnd(); } inline Item next() { n = i++; return n; } inline Item peekNext() const { return i; } inline bool hasPrevious() const { return i != c.constBegin(); } inline Item previous() { n = --i; return n; } inline Item peekPrevious() const { const_iterator p = i; return --p; } inline const T &value() const { qt_noop(); return *n; } inline const Key &key() const { qt_noop(); return n.key(); } inline bool findNext(const T &t) { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (i != c.constBegin()) if (*(n = --i) == t) return true; n = c.constEnd(); return false; } };
19868 template <class Key, class T> class QMutableMapIterator { typedef typename QMap<Key,T>::iterator iterator; typedef typename QMap<Key,T>::const_iterator const_iterator; typedef iterator Item; QMap<Key,T> *c; iterator i, n; inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } public: inline QMutableMapIterator(QMap<Key,T> &container) : c(&container) { c->setSharable(false); i = c->begin(); n = c->end(); } inline ~QMutableMapIterator() { c->setSharable(true); } inline QMutableMapIterator &operator=(QMap<Key,T> &container) { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } inline void toFront() { i = c->begin(); n = c->end(); } inline void toBack() { i = c->end(); n = c->end(); } inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } inline Item next() { n = i++; return n; } inline Item peekNext() const { return i; } inline bool hasPrevious() const { return const_iterator(i) != c->constBegin(); } inline Item previous() { n = --i; return n; } inline Item peekPrevious() const { iterator p = i; return --p; } inline void remove() { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } inline T &value() { qt_noop(); return *n; } inline const T &value() const { qt_noop(); return *n; } inline const Key &key() const { qt_noop(); return n.key(); } inline bool findNext(const T &t) { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (const_iterator(i) != c->constBegin()) if (*(n = --i) == t) return true; n = c->end(); return false; } };
19869 typedef QtValidLicenseForCoreModule QtCoreModule;
19870 class QDataStream;
19871 class QDate;
19872 class QDateTime;
19873 class QTime;
19874 class QVariant;
19875 class QTextStream;
19876 class QTextStreamPrivate;
19877 class QLocale;
19878 class __attribute__((visibility("default"))) QSystemLocale
19879 {
19880 public:
19881 QSystemLocale();
19882 virtual ~QSystemLocale();
19883 enum QueryType {
19884 LanguageId,
19885 CountryId,
19886 DecimalPoint,
19887 GroupSeparator,
19888 ZeroDigit,
19889 NegativeSign,
19890 DateFormatLong,
19891 DateFormatShort,
19892 TimeFormatLong,
19893 TimeFormatShort,
19894 DayNameLong,
19895 DayNameShort,
19896 MonthNameLong,
19897 MonthNameShort,
19898 DateToStringLong,
19899 DateToStringShort,
19900 TimeToStringLong,
19901 TimeToStringShort,
19902 DateTimeFormatLong,
19903 DateTimeFormatShort,
19904 DateTimeToStringLong,
19905 DateTimeToStringShort,
19906 MeasurementSystem,
19907 PositiveSign,
19908 AMText,
19909 PMText
19910 };
19911 virtual QVariant query(QueryType type, QVariant in) const;
19912 virtual QLocale fallbackLocale() const;
19913 };
19914 struct QLocalePrivate;
19915 class __attribute__((visibility("default"))) QLocale
19916 {
19917 public: static const QMetaObject staticMetaObject; private:
19918 friend class QString;
19919 friend class QByteArray;
19920 friend class QIntValidator;
19921 friend class QDoubleValidator;
19922 friend class QTextStream;
19923 friend class QTextStreamPrivate;
19924 public:
19925 enum Language {
19926 C = 1,
19927 Abkhazian = 2,
19928 Afan = 3,
19929 Afar = 4,
19930 Afrikaans = 5,
19931 Albanian = 6,
19932 Amharic = 7,
19933 Arabic = 8,
19934 Armenian = 9,
19935 Assamese = 10,
19936 Aymara = 11,
19937 Azerbaijani = 12,
19938 Bashkir = 13,
19939 Basque = 14,
19940 Bengali = 15,
19941 Bhutani = 16,
19942 Bihari = 17,
19943 Bislama = 18,
19944 Breton = 19,
19945 Bulgarian = 20,
19946 Burmese = 21,
19947 Byelorussian = 22,
19948 Cambodian = 23,
19949 Catalan = 24,
19950 Chinese = 25,
19951 Corsican = 26,
19952 Croatian = 27,
19953 Czech = 28,
19954 Danish = 29,
19955 Dutch = 30,
19956 English = 31,
19957 Esperanto = 32,
19958 Estonian = 33,
19959 Faroese = 34,
19960 FijiLanguage = 35,
19961 Finnish = 36,
19962 French = 37,
19963 Frisian = 38,
19964 Gaelic = 39,
19965 Galician = 40,
19966 Georgian = 41,
19967 German = 42,
19968 Greek = 43,
19969 Greenlandic = 44,
19970 Guarani = 45,
19971 Gujarati = 46,
19972 Hausa = 47,
19973 Hebrew = 48,
19974 Hindi = 49,
19975 Hungarian = 50,
19976 Icelandic = 51,
19977 Indonesian = 52,
19978 Interlingua = 53,
19979 Interlingue = 54,
19980 Inuktitut = 55,
19981 Inupiak = 56,
19982 Irish = 57,
19983 Italian = 58,
19984 Japanese = 59,
19985 Javanese = 60,
19986 Kannada = 61,
19987 Kashmiri = 62,
19988 Kazakh = 63,
19989 Kinyarwanda = 64,
19990 Kirghiz = 65,
19991 Korean = 66,
19992 Kurdish = 67,
19993 Kurundi = 68,
19994 Laothian = 69,
19995 Latin = 70,
19996 Latvian = 71,
19997 Lingala = 72,
19998 Lithuanian = 73,
19999 Macedonian = 74,
20000 Malagasy = 75,
20001 Malay = 76,
20002 Malayalam = 77,
20003 Maltese = 78,
20004 Maori = 79,
20005 Marathi = 80,
20006 Moldavian = 81,
20007 Mongolian = 82,
20008 NauruLanguage = 83,
20009 Nepali = 84,
20010 Norwegian = 85,
20011 NorwegianBokmal = Norwegian,
20012 Occitan = 86,
20013 Oriya = 87,
20014 Pashto = 88,
20015 Persian = 89,
20016 Polish = 90,
20017 Portuguese = 91,
20018 Punjabi = 92,
20019 Quechua = 93,
20020 RhaetoRomance = 94,
20021 Romanian = 95,
20022 Russian = 96,
20023 Samoan = 97,
20024 Sangho = 98,
20025 Sanskrit = 99,
20026 Serbian = 100,
20027 SerboCroatian = 101,
20028 Sesotho = 102,
20029 Setswana = 103,
20030 Shona = 104,
20031 Sindhi = 105,
20032 Singhalese = 106,
20033 Siswati = 107,
20034 Slovak = 108,
20035 Slovenian = 109,
20036 Somali = 110,
20037 Spanish = 111,
20038 Sundanese = 112,
20039 Swahili = 113,
20040 Swedish = 114,
20041 Tagalog = 115,
20042 Tajik = 116,
20043 Tamil = 117,
20044 Tatar = 118,
20045 Telugu = 119,
20046 Thai = 120,
20047 Tibetan = 121,
20048 Tigrinya = 122,
20049 TongaLanguage = 123,
20050 Tsonga = 124,
20051 Turkish = 125,
20052 Turkmen = 126,
20053 Twi = 127,
20054 Uigur = 128,
20055 Ukrainian = 129,
20056 Urdu = 130,
20057 Uzbek = 131,
20058 Vietnamese = 132,
20059 Volapuk = 133,
20060 Welsh = 134,
20061 Wolof = 135,
20062 Xhosa = 136,
20063 Yiddish = 137,
20064 Yoruba = 138,
20065 Zhuang = 139,
20066 Zulu = 140,
20067 NorwegianNynorsk = 141,
20068 Nynorsk = NorwegianNynorsk,
20069 Bosnian = 142,
20070 Divehi = 143,
20071 Manx = 144,
20072 Cornish = 145,
20073 Akan = 146,
20074 Konkani = 147,
20075 Ga = 148,
20076 Igbo = 149,
20077 Kamba = 150,
20078 Syriac = 151,
20079 Blin = 152,
20080 Geez = 153,
20081 Koro = 154,
20082 Sidamo = 155,
20083 Atsam = 156,
20084 Tigre = 157,
20085 Jju = 158,
20086 Friulian = 159,
20087 Venda = 160,
20088 Ewe = 161,
20089 Walamo = 162,
20090 Hawaiian = 163,
20091 Tyap = 164,
20092 Chewa = 165,
20093 LastLanguage = Chewa
20094 };
20095 enum Country {
20096 AnyCountry = 0,
20097 Afghanistan = 1,
20098 Albania = 2,
20099 Algeria = 3,
20100 AmericanSamoa = 4,
20101 Andorra = 5,
20102 Angola = 6,
20103 Anguilla = 7,
20104 Antarctica = 8,
20105 AntiguaAndBarbuda = 9,
20106 Argentina = 10,
20107 Armenia = 11,
20108 Aruba = 12,
20109 Australia = 13,
20110 Austria = 14,
20111 Azerbaijan = 15,
20112 Bahamas = 16,
20113 Bahrain = 17,
20114 Bangladesh = 18,
20115 Barbados = 19,
20116 Belarus = 20,
20117 Belgium = 21,
20118 Belize = 22,
20119 Benin = 23,
20120 Bermuda = 24,
20121 Bhutan = 25,
20122 Bolivia = 26,
20123 BosniaAndHerzegowina = 27,
20124 Botswana = 28,
20125 BouvetIsland = 29,
20126 Brazil = 30,
20127 BritishIndianOceanTerritory = 31,
20128 BruneiDarussalam = 32,
20129 Bulgaria = 33,
20130 BurkinaFaso = 34,
20131 Burundi = 35,
20132 Cambodia = 36,
20133 Cameroon = 37,
20134 Canada = 38,
20135 CapeVerde = 39,
20136 CaymanIslands = 40,
20137 CentralAfricanRepublic = 41,
20138 Chad = 42,
20139 Chile = 43,
20140 China = 44,
20141 ChristmasIsland = 45,
20142 CocosIslands = 46,
20143 Colombia = 47,
20144 Comoros = 48,
20145 DemocraticRepublicOfCongo = 49,
20146 PeoplesRepublicOfCongo = 50,
20147 CookIslands = 51,
20148 CostaRica = 52,
20149 IvoryCoast = 53,
20150 Croatia = 54,
20151 Cuba = 55,
20152 Cyprus = 56,
20153 CzechRepublic = 57,
20154 Denmark = 58,
20155 Djibouti = 59,
20156 Dominica = 60,
20157 DominicanRepublic = 61,
20158 EastTimor = 62,
20159 Ecuador = 63,
20160 Egypt = 64,
20161 ElSalvador = 65,
20162 EquatorialGuinea = 66,
20163 Eritrea = 67,
20164 Estonia = 68,
20165 Ethiopia = 69,
20166 FalklandIslands = 70,
20167 FaroeIslands = 71,
20168 FijiCountry = 72,
20169 Finland = 73,
20170 France = 74,
20171 MetropolitanFrance = 75,
20172 FrenchGuiana = 76,
20173 FrenchPolynesia = 77,
20174 FrenchSouthernTerritories = 78,
20175 Gabon = 79,
20176 Gambia = 80,
20177 Georgia = 81,
20178 Germany = 82,
20179 Ghana = 83,
20180 Gibraltar = 84,
20181 Greece = 85,
20182 Greenland = 86,
20183 Grenada = 87,
20184 Guadeloupe = 88,
20185 Guam = 89,
20186 Guatemala = 90,
20187 Guinea = 91,
20188 GuineaBissau = 92,
20189 Guyana = 93,
20190 Haiti = 94,
20191 HeardAndMcDonaldIslands = 95,
20192 Honduras = 96,
20193 HongKong = 97,
20194 Hungary = 98,
20195 Iceland = 99,
20196 India = 100,
20197 Indonesia = 101,
20198 Iran = 102,
20199 Iraq = 103,
20200 Ireland = 104,
20201 Israel = 105,
20202 Italy = 106,
20203 Jamaica = 107,
20204 Japan = 108,
20205 Jordan = 109,
20206 Kazakhstan = 110,
20207 Kenya = 111,
20208 Kiribati = 112,
20209 DemocraticRepublicOfKorea = 113,
20210 RepublicOfKorea = 114,
20211 Kuwait = 115,
20212 Kyrgyzstan = 116,
20213 Lao = 117,
20214 Latvia = 118,
20215 Lebanon = 119,
20216 Lesotho = 120,
20217 Liberia = 121,
20218 LibyanArabJamahiriya = 122,
20219 Liechtenstein = 123,
20220 Lithuania = 124,
20221 Luxembourg = 125,
20222 Macau = 126,
20223 Macedonia = 127,
20224 Madagascar = 128,
20225 Malawi = 129,
20226 Malaysia = 130,
20227 Maldives = 131,
20228 Mali = 132,
20229 Malta = 133,
20230 MarshallIslands = 134,
20231 Martinique = 135,
20232 Mauritania = 136,
20233 Mauritius = 137,
20234 Mayotte = 138,
20235 Mexico = 139,
20236 Micronesia = 140,
20237 Moldova = 141,
20238 Monaco = 142,
20239 Mongolia = 143,
20240 Montserrat = 144,
20241 Morocco = 145,
20242 Mozambique = 146,
20243 Myanmar = 147,
20244 Namibia = 148,
20245 NauruCountry = 149,
20246 Nepal = 150,
20247 Netherlands = 151,
20248 NetherlandsAntilles = 152,
20249 NewCaledonia = 153,
20250 NewZealand = 154,
20251 Nicaragua = 155,
20252 Niger = 156,
20253 Nigeria = 157,
20254 Niue = 158,
20255 NorfolkIsland = 159,
20256 NorthernMarianaIslands = 160,
20257 Norway = 161,
20258 Oman = 162,
20259 Pakistan = 163,
20260 Palau = 164,
20261 PalestinianTerritory = 165,
20262 Panama = 166,
20263 PapuaNewGuinea = 167,
20264 Paraguay = 168,
20265 Peru = 169,
20266 Philippines = 170,
20267 Pitcairn = 171,
20268 Poland = 172,
20269 Portugal = 173,
20270 PuertoRico = 174,
20271 Qatar = 175,
20272 Reunion = 176,
20273 Romania = 177,
20274 RussianFederation = 178,
20275 Rwanda = 179,
20276 SaintKittsAndNevis = 180,
20277 StLucia = 181,
20278 StVincentAndTheGrenadines = 182,
20279 Samoa = 183,
20280 SanMarino = 184,
20281 SaoTomeAndPrincipe = 185,
20282 SaudiArabia = 186,
20283 Senegal = 187,
20284 Seychelles = 188,
20285 SierraLeone = 189,
20286 Singapore = 190,
20287 Slovakia = 191,
20288 Slovenia = 192,
20289 SolomonIslands = 193,
20290 Somalia = 194,
20291 SouthAfrica = 195,
20292 SouthGeorgiaAndTheSouthSandwichIslands = 196,
20293 Spain = 197,
20294 SriLanka = 198,
20295 StHelena = 199,
20296 StPierreAndMiquelon = 200,
20297 Sudan = 201,
20298 Suriname = 202,
20299 SvalbardAndJanMayenIslands = 203,
20300 Swaziland = 204,
20301 Sweden = 205,
20302 Switzerland = 206,
20303 SyrianArabRepublic = 207,
20304 Taiwan = 208,
20305 Tajikistan = 209,
20306 Tanzania = 210,
20307 Thailand = 211,
20308 Togo = 212,
20309 Tokelau = 213,
20310 TongaCountry = 214,
20311 TrinidadAndTobago = 215,
20312 Tunisia = 216,
20313 Turkey = 217,
20314 Turkmenistan = 218,
20315 TurksAndCaicosIslands = 219,
20316 Tuvalu = 220,
20317 Uganda = 221,
20318 Ukraine = 222,
20319 UnitedArabEmirates = 223,
20320 UnitedKingdom = 224,
20321 UnitedStates = 225,
20322 UnitedStatesMinorOutlyingIslands = 226,
20323 Uruguay = 227,
20324 Uzbekistan = 228,
20325 Vanuatu = 229,
20326 VaticanCityState = 230,
20327 Venezuela = 231,
20328 VietNam = 232,
20329 BritishVirginIslands = 233,
20330 USVirginIslands = 234,
20331 WallisAndFutunaIslands = 235,
20332 WesternSahara = 236,
20333 Yemen = 237,
20334 Yugoslavia = 238,
20335 Zambia = 239,
20336 Zimbabwe = 240,
20337 SerbiaAndMontenegro = 241,
20338 LastCountry = SerbiaAndMontenegro
20339 };
20340 enum MeasurementSystem { MetricSystem, ImperialSystem };
20341 enum FormatType { LongFormat, ShortFormat, NarrowFormat };
20342 enum NumberOption {
20343 OmitGroupSeparator = 0x01,
20344 RejectGroupSeparator = 0x02
20345 };
20346 typedef QFlags<NumberOption> NumberOptions;
20347 QLocale();
20348 QLocale(const QString &name);
20349 QLocale(Language language, Country country = AnyCountry);
20350 QLocale(const QLocale &other);
20351 QLocale &operator=(const QLocale &other);
20352 Language language() const;
20353 Country country() const;
20354 QString name() const;
20355 short toShort(const QString &s, bool *ok = 0, int base = 0) const;
20356 ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const;
20357 int toInt(const QString &s, bool *ok = 0, int base = 0) const;
20358 uint toUInt(const QString &s, bool *ok = 0, int base = 0) const;
20359 qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const;
20360 qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const;
20361 float toFloat(const QString &s, bool *ok = 0) const;
20362 double toDouble(const QString &s, bool *ok = 0) const;
20363 QString toString(qlonglong i) const;
20364 QString toString(qulonglong i) const;
20365 inline QString toString(short i) const;
20366 inline QString toString(ushort i) const;
20367 inline QString toString(int i) const;
20368 inline QString toString(uint i) const;
20369 QString toString(double i, char f = 'g', int prec = 6) const;
20370 inline QString toString(float i, char f = 'g', int prec = 6) const;
20371 QString toString(const QDate &date, const QString &formatStr) const;
20372 QString toString(const QDate &date, FormatType format = LongFormat) const;
20373 QString toString(const QTime &time, const QString &formatStr) const;
20374 QString toString(const QTime &time, FormatType format = LongFormat) const;
20375 QString toString(const QDateTime &dateTime, FormatType format = LongFormat) const;
20376 QString toString(const QDateTime &dateTime, const QString &format) const;
20377 QString dateFormat(FormatType format = LongFormat) const;
20378 QString timeFormat(FormatType format = LongFormat) const;
20379 QString dateTimeFormat(FormatType format = LongFormat) const;
20380 QDate toDate(const QString &string, FormatType = LongFormat) const;
20381 QTime toTime(const QString &string, FormatType = LongFormat) const;
20382 QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const;
20383 QDate toDate(const QString &string, const QString &format) const;
20384 QTime toTime(const QString &string, const QString &format) const;
20385 QDateTime toDateTime(const QString &string, const QString &format) const;
20386 QChar decimalPoint() const;
20387 QChar groupSeparator() const;
20388 QChar percent() const;
20389 QChar zeroDigit() const;
20390 QChar negativeSign() const;
20391 QChar positiveSign() const;
20392 QChar exponential() const;
20393 QString monthName(int, FormatType format = LongFormat) const;
20394 QString standaloneMonthName(int, FormatType format = LongFormat) const;
20395 QString dayName(int, FormatType format = LongFormat) const;
20396 QString standaloneDayName(int, FormatType format = LongFormat) const;
20397 QString amText() const;
20398 QString pmText() const;
20399 MeasurementSystem measurementSystem() const;
20400 inline bool operator==(const QLocale &other) const;
20401 inline bool operator!=(const QLocale &other) const;
20402 static QString languageToString(Language language);
20403 static QString countryToString(Country country);
20404 static void setDefault(const QLocale &locale);
20405 static QLocale c() { return QLocale(C); }
20406 static QLocale system();
20407 static QList<Country> countriesForLanguage(Language lang);
20408 void setNumberOptions(NumberOptions options);
20409 NumberOptions numberOptions() const;
20410 struct Data {
20411 quint16 index;
20412 quint16 numberOptions;
20413 }
20414 ;
20415 private:
20416 friend struct QLocalePrivate;
20417 union {
20418 void *v;
20419 Data p;
20420 };
20421 const QLocalePrivate *d() const;
20422 };
20423 template <> class QTypeInfo<QLocale> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QLocale)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QLocale"; } };
20424 inline QFlags<QLocale::NumberOptions::enum_type> operator|(QLocale::NumberOptions::enum_type f1, QLocale::NumberOptions::enum_type f2) { return QFlags<QLocale::NumberOptions::enum_type>(f1) | f2; } inline QFlags<QLocale::NumberOptions::enum_type> operator|(QLocale::NumberOptions::enum_type f1, QFlags<QLocale::NumberOptions::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QLocale::NumberOptions::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
20425 inline QString QLocale::toString(short i) const
20426 { return toString(qlonglong(i)); }
20427 inline QString QLocale::toString(ushort i) const
20428 { return toString(qulonglong(i)); }
20429 inline QString QLocale::toString(int i) const
20430 { return toString(qlonglong(i)); }
20431 inline QString QLocale::toString(uint i) const
20432 { return toString(qulonglong(i)); }
20433 inline QString QLocale::toString(float i, char f, int prec) const
20434 { return toString(double(i), f, prec); }
20435 inline bool QLocale::operator==(const QLocale &other) const
20436 { return d() == other.d() && numberOptions() == other.numberOptions(); }
20437 inline bool QLocale::operator!=(const QLocale &other) const
20438 { return d() != other.d() || numberOptions() != other.numberOptions(); }
20439 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QLocale &);
20440 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QLocale &);
20441 typedef QtValidLicenseForCoreModule QtCoreModule;
20442 class QTextCodec;
20443 class QTextDecoder;
20444 class QTextStreamPrivate;
20445 class __attribute__((visibility("default"))) QTextStream
20446 {
20447 inline QTextStreamPrivate* d_func() { return reinterpret_cast<QTextStreamPrivate *>(d_ptr); } inline const QTextStreamPrivate* d_func() const { return reinterpret_cast<const QTextStreamPrivate *>(d_ptr); } friend class QTextStreamPrivate;
20448 public:
20449 enum RealNumberNotation {
20450 SmartNotation,
20451 FixedNotation,
20452 ScientificNotation
20453 };
20454 enum FieldAlignment {
20455 AlignLeft,
20456 AlignRight,
20457 AlignCenter,
20458 AlignAccountingStyle
20459 };
20460 enum Status {
20461 Ok,
20462 ReadPastEnd,
20463 ReadCorruptData
20464 };
20465 enum NumberFlag {
20466 ShowBase = 0x1,
20467 ForcePoint = 0x2,
20468 ForceSign = 0x4,
20469 UppercaseBase = 0x8,
20470 UppercaseDigits = 0x10
20471 };
20472 typedef QFlags<NumberFlag> NumberFlags;
20473 QTextStream();
20474 explicit QTextStream(QIODevice *device);
20475 explicit QTextStream(FILE *fileHandle, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
20476 explicit QTextStream(QString *string, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
20477 explicit QTextStream(QByteArray *array, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
20478 explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
20479 virtual ~QTextStream();
20480 void setCodec(QTextCodec *codec);
20481 void setCodec(const char *codecName);
20482 QTextCodec *codec() const;
20483 void setAutoDetectUnicode(bool enabled);
20484 bool autoDetectUnicode() const;
20485 void setGenerateByteOrderMark(bool generate);
20486 bool generateByteOrderMark() const;
20487 void setLocale(const QLocale &locale);
20488 QLocale locale() const;
20489 void setDevice(QIODevice *device);
20490 QIODevice *device() const;
20491 void setString(QString *string, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
20492 QString *string() const;
20493 Status status() const;
20494 void setStatus(Status status);
20495 void resetStatus();
20496 bool atEnd() const;
20497 void reset();
20498 void flush();
20499 bool seek(qint64 pos);
20500 qint64 pos() const;
20501 void skipWhiteSpace();
20502 QString readLine(qint64 maxlen = 0);
20503 QString readAll();
20504 QString read(qint64 maxlen);
20505 void setFieldAlignment(FieldAlignment alignment);
20506 FieldAlignment fieldAlignment() const;
20507 void setPadChar(QChar ch);
20508 QChar padChar() const;
20509 void setFieldWidth(int width);
20510 int fieldWidth() const;
20511 void setNumberFlags(NumberFlags flags);
20512 NumberFlags numberFlags() const;
20513 void setIntegerBase(int base);
20514 int integerBase() const;
20515 void setRealNumberNotation(RealNumberNotation notation);
20516 RealNumberNotation realNumberNotation() const;
20517 void setRealNumberPrecision(int precision);
20518 int realNumberPrecision() const;
20519 QTextStream &operator>>(QChar &ch);
20520 QTextStream &operator>>(char &ch);
20521 QTextStream &operator>>(signed short &i);
20522 QTextStream &operator>>(unsigned short &i);
20523 QTextStream &operator>>(signed int &i);
20524 QTextStream &operator>>(unsigned int &i);
20525 QTextStream &operator>>(signed long &i);
20526 QTextStream &operator>>(unsigned long &i);
20527 QTextStream &operator>>(qlonglong &i);
20528 QTextStream &operator>>(qulonglong &i);
20529 QTextStream &operator>>(float &f);
20530 QTextStream &operator>>(double &f);
20531 QTextStream &operator>>(QString &s);
20532 QTextStream &operator>>(QByteArray &array);
20533 QTextStream &operator>>(char *c);
20534 QTextStream &operator<<(QBool b);
20535 QTextStream &operator<<(QChar ch);
20536 QTextStream &operator<<(char ch);
20537 QTextStream &operator<<(signed short i);
20538 QTextStream &operator<<(unsigned short i);
20539 QTextStream &operator<<(signed int i);
20540 QTextStream &operator<<(unsigned int i);
20541 QTextStream &operator<<(signed long i);
20542 QTextStream &operator<<(unsigned long i);
20543 QTextStream &operator<<(qlonglong i);
20544 QTextStream &operator<<(qulonglong i);
20545 QTextStream &operator<<(float f);
20546 QTextStream &operator<<(double f);
20547 QTextStream &operator<<(const QString &s);
20548 QTextStream &operator<<(const QByteArray &array);
20549 QTextStream &operator<<(const char *c);
20550 QTextStream &operator<<(const void *ptr);
20551 private:
20552 QTextStream(const QTextStream &); QTextStream &operator=(const QTextStream &);
20553 QTextStreamPrivate *d_ptr;
20554 };
20555 inline QFlags<QTextStream::NumberFlags::enum_type> operator|(QTextStream::NumberFlags::enum_type f1, QTextStream::NumberFlags::enum_type f2) { return QFlags<QTextStream::NumberFlags::enum_type>(f1) | f2; } inline QFlags<QTextStream::NumberFlags::enum_type> operator|(QTextStream::NumberFlags::enum_type f1, QFlags<QTextStream::NumberFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextStream::NumberFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
20556 typedef QTextStream & (*QTextStreamFunction)(QTextStream &);
20557 typedef void (QTextStream::*QTSMFI)(int);
20558 typedef void (QTextStream::*QTSMFC)(QChar);
20559 class __attribute__((visibility("default"))) QTextStreamManipulator
20560 {
20561 public:
20562 QTextStreamManipulator(QTSMFI m, int a) { mf = m; mc = 0; arg = a; }
20563 QTextStreamManipulator(QTSMFC m, QChar c) { mf = 0; mc = m; ch = c; }
20564 void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
20565 private:
20566 QTSMFI mf;
20567 QTSMFC mc;
20568 int arg;
20569 QChar ch;
20570 };
20571 inline QTextStream &operator>>(QTextStream &s, QTextStreamFunction f)
20572 { return (*f)(s); }
20573 inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f)
20574 { return (*f)(s); }
20575 inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m)
20576 { m.exec(s); return s; }
20577 __attribute__((visibility("default"))) QTextStream &bin(QTextStream &s);
20578 __attribute__((visibility("default"))) QTextStream &oct(QTextStream &s);
20579 __attribute__((visibility("default"))) QTextStream &dec(QTextStream &s);
20580 __attribute__((visibility("default"))) QTextStream &hex(QTextStream &s);
20581 __attribute__((visibility("default"))) QTextStream &showbase(QTextStream &s);
20582 __attribute__((visibility("default"))) QTextStream &forcesign(QTextStream &s);
20583 __attribute__((visibility("default"))) QTextStream &forcepoint(QTextStream &s);
20584 __attribute__((visibility("default"))) QTextStream &noshowbase(QTextStream &s);
20585 __attribute__((visibility("default"))) QTextStream &noforcesign(QTextStream &s);
20586 __attribute__((visibility("default"))) QTextStream &noforcepoint(QTextStream &s);
20587 __attribute__((visibility("default"))) QTextStream &uppercasebase(QTextStream &s);
20588 __attribute__((visibility("default"))) QTextStream &uppercasedigits(QTextStream &s);
20589 __attribute__((visibility("default"))) QTextStream &lowercasebase(QTextStream &s);
20590 __attribute__((visibility("default"))) QTextStream &lowercasedigits(QTextStream &s);
20591 __attribute__((visibility("default"))) QTextStream &fixed(QTextStream &s);
20592 __attribute__((visibility("default"))) QTextStream &scientific(QTextStream &s);
20593 __attribute__((visibility("default"))) QTextStream &left(QTextStream &s);
20594 __attribute__((visibility("default"))) QTextStream &right(QTextStream &s);
20595 __attribute__((visibility("default"))) QTextStream &center(QTextStream &s);
20596 __attribute__((visibility("default"))) QTextStream &endl(QTextStream &s);
20597 __attribute__((visibility("default"))) QTextStream &flush(QTextStream &s);
20598 __attribute__((visibility("default"))) QTextStream &reset(QTextStream &s);
20599 __attribute__((visibility("default"))) QTextStream &bom(QTextStream &s);
20600 __attribute__((visibility("default"))) QTextStream &ws(QTextStream &s);
20601 inline QTextStreamManipulator qSetFieldWidth(int width)
20602 {
20603 QTSMFI func = &QTextStream::setFieldWidth;
20604 return QTextStreamManipulator(func,width);
20605 }
20606 inline QTextStreamManipulator qSetPadChar(QChar ch)
20607 {
20608 QTSMFC func = &QTextStream::setPadChar;
20609 return QTextStreamManipulator(func, ch);
20610 }
20611 inline QTextStreamManipulator qSetRealNumberPrecision(int precision)
20612 {
20613 QTSMFI func = &QTextStream::setRealNumberPrecision;
20614 return QTextStreamManipulator(func, precision);
20615 }
20616 namespace std __attribute__ ((__visibility__ ("default"))) {
20617 template<typename _T1, typename _T2>
20618 inline void
20619 _Construct(_T1* __p, const _T2& __value)
20620 {
20621 ::new(static_cast<void*>(__p)) _T1(__value);
20622 }
20623 template<typename _Tp>
20624 inline void
20625 _Destroy(_Tp* __pointer)
20626 { __pointer->~_Tp(); }
20627 template<typename _ForwardIterator>
20628 inline void
20629 _Destroy(_ForwardIterator __first, _ForwardIterator __last)
20630 {
20631 typedef typename iterator_traits<_ForwardIterator>::value_type
20632 _Value_type;
20633 if (!__has_trivial_destructor(_Value_type))
20634 for (; __first != __last; ++__first)
20635 std::_Destroy(&*__first);
20636 }
20637 template <typename _Tp> class allocator;
20638 template<typename _ForwardIterator, typename _Allocator>
20639 void
20640 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
20641 _Allocator& __alloc)
20642 {
20643 for (; __first != __last; ++__first)
20644 __alloc.destroy(&*__first);
20645 }
20646 template<typename _ForwardIterator, typename _Tp>
20647 inline void
20648 _Destroy(_ForwardIterator __first, _ForwardIterator __last,
20649 allocator<_Tp>&)
20650 {
20651 _Destroy(__first, __last);
20652 }
20653 }
20654 namespace std __attribute__ ((__visibility__ ("default"))) {
20655 template<bool>
20656 struct __uninitialized_copy
20657 {
20658 template<typename _InputIterator, typename _ForwardIterator>
20659 static _ForwardIterator
20660 uninitialized_copy(_InputIterator __first, _InputIterator __last,
20661 _ForwardIterator __result)
20662 {
20663 _ForwardIterator __cur = __result;
20664 try
20665 {
20666 for (; __first != __last; ++__first, ++__cur)
20667 ::new(static_cast<void*>(&*__cur)) typename
20668 iterator_traits<_ForwardIterator>::value_type(*__first);
20669 return __cur;
20670 }
20671 catch(...)
20672 {
20673 std::_Destroy(__result, __cur);
20674 throw;
20675 }
20676 }
20677 };
20678 template<>
20679 struct __uninitialized_copy<true>
20680 {
20681 template<typename _InputIterator, typename _ForwardIterator>
20682 static _ForwardIterator
20683 uninitialized_copy(_InputIterator __first, _InputIterator __last,
20684 _ForwardIterator __result)
20685 { return std::copy(__first, __last, __result); }
20686 };
20687 template<typename _InputIterator, typename _ForwardIterator>
20688 inline _ForwardIterator
20689 uninitialized_copy(_InputIterator __first, _InputIterator __last,
20690 _ForwardIterator __result)
20691 {
20692 typedef typename iterator_traits<_InputIterator>::value_type
20693 _ValueType1;
20694 typedef typename iterator_traits<_ForwardIterator>::value_type
20695 _ValueType2;
20696 return std::__uninitialized_copy<(__is_pod(_ValueType1)
20697 && __is_pod(_ValueType2))>::
20698 uninitialized_copy(__first, __last, __result);
20699 }
20700 template<bool>
20701 struct __uninitialized_fill
20702 {
20703 template<typename _ForwardIterator, typename _Tp>
20704 static void
20705 uninitialized_fill(_ForwardIterator __first,
20706 _ForwardIterator __last, const _Tp& __x)
20707 {
20708 _ForwardIterator __cur = __first;
20709 try
20710 {
20711 for (; __cur != __last; ++__cur)
20712 std::_Construct(&*__cur, __x);
20713 }
20714 catch(...)
20715 {
20716 std::_Destroy(__first, __cur);
20717 throw;
20718 }
20719 }
20720 };
20721 template<>
20722 struct __uninitialized_fill<true>
20723 {
20724 template<typename _ForwardIterator, typename _Tp>
20725 static void
20726 uninitialized_fill(_ForwardIterator __first,
20727 _ForwardIterator __last, const _Tp& __x)
20728 { std::fill(__first, __last, __x); }
20729 };
20730 template<typename _ForwardIterator, typename _Tp>
20731 inline void
20732 uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,
20733 const _Tp& __x)
20734 {
20735 typedef typename iterator_traits<_ForwardIterator>::value_type
20736 _ValueType;
20737 std::__uninitialized_fill<__is_pod(_ValueType)>::
20738 uninitialized_fill(__first, __last, __x);
20739 }
20740 template<bool>
20741 struct __uninitialized_fill_n
20742 {
20743 template<typename _ForwardIterator, typename _Size, typename _Tp>
20744 static void
20745 uninitialized_fill_n(_ForwardIterator __first, _Size __n,
20746 const _Tp& __x)
20747 {
20748 _ForwardIterator __cur = __first;
20749 try
20750 {
20751 for (; __n > 0; --__n, ++__cur)
20752 std::_Construct(&*__cur, __x);
20753 }
20754 catch(...)
20755 {
20756 std::_Destroy(__first, __cur);
20757 throw;
20758 }
20759 }
20760 };
20761 template<>
20762 struct __uninitialized_fill_n<true>
20763 {
20764 template<typename _ForwardIterator, typename _Size, typename _Tp>
20765 static void
20766 uninitialized_fill_n(_ForwardIterator __first, _Size __n,
20767 const _Tp& __x)
20768 { std::fill_n(__first, __n, __x); }
20769 };
20770 template<typename _ForwardIterator, typename _Size, typename _Tp>
20771 inline void
20772 uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
20773 {
20774 typedef typename iterator_traits<_ForwardIterator>::value_type
20775 _ValueType;
20776 std::__uninitialized_fill_n<__is_pod(_ValueType)>::
20777 uninitialized_fill_n(__first, __n, __x);
20778 }
20779 template<typename _InputIterator, typename _ForwardIterator,
20780 typename _Allocator>
20781 _ForwardIterator
20782 __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
20783 _ForwardIterator __result, _Allocator& __alloc)
20784 {
20785 _ForwardIterator __cur = __result;
20786 try
20787 {
20788 for (; __first != __last; ++__first, ++__cur)
20789 __alloc.construct(&*__cur, *__first);
20790 return __cur;
20791 }
20792 catch(...)
20793 {
20794 std::_Destroy(__result, __cur, __alloc);
20795 throw;
20796 }
20797 }
20798 template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
20799 inline _ForwardIterator
20800 __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
20801 _ForwardIterator __result, allocator<_Tp>&)
20802 { return std::uninitialized_copy(__first, __last, __result); }
20803 template<typename _InputIterator, typename _ForwardIterator,
20804 typename _Allocator>
20805 inline _ForwardIterator
20806 __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
20807 _ForwardIterator __result, _Allocator& __alloc)
20808 {
20809 return std::__uninitialized_copy_a((__first),
20810 (__last),
20811 __result, __alloc);
20812 }
20813 template<typename _ForwardIterator, typename _Tp, typename _Allocator>
20814 void
20815 __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
20816 const _Tp& __x, _Allocator& __alloc)
20817 {
20818 _ForwardIterator __cur = __first;
20819 try
20820 {
20821 for (; __cur != __last; ++__cur)
20822 __alloc.construct(&*__cur, __x);
20823 }
20824 catch(...)
20825 {
20826 std::_Destroy(__first, __cur, __alloc);
20827 throw;
20828 }
20829 }
20830 template<typename _ForwardIterator, typename _Tp, typename _Tp2>
20831 inline void
20832 __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
20833 const _Tp& __x, allocator<_Tp2>&)
20834 { std::uninitialized_fill(__first, __last, __x); }
20835 template<typename _ForwardIterator, typename _Size, typename _Tp,
20836 typename _Allocator>
20837 void
20838 __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
20839 const _Tp& __x, _Allocator& __alloc)
20840 {
20841 _ForwardIterator __cur = __first;
20842 try
20843 {
20844 for (; __n > 0; --__n, ++__cur)
20845 __alloc.construct(&*__cur, __x);
20846 }
20847 catch(...)
20848 {
20849 std::_Destroy(__first, __cur, __alloc);
20850 throw;
20851 }
20852 }
20853 template<typename _ForwardIterator, typename _Size, typename _Tp,
20854 typename _Tp2>
20855 inline void
20856 __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
20857 const _Tp& __x, allocator<_Tp2>&)
20858 { std::uninitialized_fill_n(__first, __n, __x); }
20859 template<typename _InputIterator1, typename _InputIterator2,
20860 typename _ForwardIterator, typename _Allocator>
20861 inline _ForwardIterator
20862 __uninitialized_copy_move(_InputIterator1 __first1,
20863 _InputIterator1 __last1,
20864 _InputIterator2 __first2,
20865 _InputIterator2 __last2,
20866 _ForwardIterator __result,
20867 _Allocator& __alloc)
20868 {
20869 _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
20870 __result,
20871 __alloc);
20872 try
20873 {
20874 return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
20875 }
20876 catch(...)
20877 {
20878 std::_Destroy(__result, __mid, __alloc);
20879 throw;
20880 }
20881 }
20882 template<typename _InputIterator1, typename _InputIterator2,
20883 typename _ForwardIterator, typename _Allocator>
20884 inline _ForwardIterator
20885 __uninitialized_move_copy(_InputIterator1 __first1,
20886 _InputIterator1 __last1,
20887 _InputIterator2 __first2,
20888 _InputIterator2 __last2,
20889 _ForwardIterator __result,
20890 _Allocator& __alloc)
20891 {
20892 _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
20893 __result,
20894 __alloc);
20895 try
20896 {
20897 return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
20898 }
20899 catch(...)
20900 {
20901 std::_Destroy(__result, __mid, __alloc);
20902 throw;
20903 }
20904 }
20905 template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
20906 typename _Allocator>
20907 inline _ForwardIterator
20908 __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
20909 const _Tp& __x, _InputIterator __first,
20910 _InputIterator __last, _Allocator& __alloc)
20911 {
20912 std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
20913 try
20914 {
20915 return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
20916 }
20917 catch(...)
20918 {
20919 std::_Destroy(__result, __mid, __alloc);
20920 throw;
20921 }
20922 }
20923 template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
20924 typename _Allocator>
20925 inline void
20926 __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
20927 _ForwardIterator __first2,
20928 _ForwardIterator __last2, const _Tp& __x,
20929 _Allocator& __alloc)
20930 {
20931 _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
20932 __first2,
20933 __alloc);
20934 try
20935 {
20936 std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
20937 }
20938 catch(...)
20939 {
20940 std::_Destroy(__first2, __mid2, __alloc);
20941 throw;
20942 }
20943 }
20944 }
20945 namespace std __attribute__ ((__visibility__ ("default"))) {
20946 template<typename _Tp, typename _Alloc>
20947 struct _Vector_base
20948 {
20949 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
20950 struct _Vector_impl
20951 : public _Tp_alloc_type
20952 {
20953 _Tp* _M_start;
20954 _Tp* _M_finish;
20955 _Tp* _M_end_of_storage;
20956 _Vector_impl()
20957 : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
20958 { }
20959 _Vector_impl(_Tp_alloc_type const& __a)
20960 : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
20961 { }
20962 };
20963 public:
20964 typedef _Alloc allocator_type;
20965 _Tp_alloc_type&
20966 _M_get_Tp_allocator()
20967 { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); }
20968 const _Tp_alloc_type&
20969 _M_get_Tp_allocator() const
20970 { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); }
20971 allocator_type
20972 get_allocator() const
20973 { return allocator_type(_M_get_Tp_allocator()); }
20974 _Vector_base()
20975 : _M_impl() { }
20976 _Vector_base(const allocator_type& __a)
20977 : _M_impl(__a) { }
20978 _Vector_base(size_t __n, const allocator_type& __a)
20979 : _M_impl(__a)
20980 {
20981 this->_M_impl._M_start = this->_M_allocate(__n);
20982 this->_M_impl._M_finish = this->_M_impl._M_start;
20983 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
20984 }
20985 ~_Vector_base()
20986 { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
20987 - this->_M_impl._M_start); }
20988 public:
20989 _Vector_impl _M_impl;
20990 _Tp*
20991 _M_allocate(size_t __n)
20992 { return __n != 0 ? _M_impl.allocate(__n) : 0; }
20993 void
20994 _M_deallocate(_Tp* __p, size_t __n)
20995 {
20996 if (__p)
20997 _M_impl.deallocate(__p, __n);
20998 }
20999 };
21000 template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
21001 class vector : protected _Vector_base<_Tp, _Alloc>
21002 {
21003 typedef typename _Alloc::value_type _Alloc_value_type;
21004 typedef _Vector_base<_Tp, _Alloc> _Base;
21005 typedef vector<_Tp, _Alloc> vector_type;
21006 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
21007 public:
21008 typedef _Tp value_type;
21009 typedef typename _Tp_alloc_type::pointer pointer;
21010 typedef typename _Tp_alloc_type::const_pointer const_pointer;
21011 typedef typename _Tp_alloc_type::reference reference;
21012 typedef typename _Tp_alloc_type::const_reference const_reference;
21013 typedef __gnu_cxx::__normal_iterator<pointer, vector_type> iterator;
21014 typedef __gnu_cxx::__normal_iterator<const_pointer, vector_type>
21015 const_iterator;
21016 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
21017 typedef std::reverse_iterator<iterator> reverse_iterator;
21018 typedef size_t size_type;
21019 typedef ptrdiff_t difference_type;
21020 typedef _Alloc allocator_type;
21021 protected:
21022 using _Base::_M_allocate;
21023 using _Base::_M_deallocate;
21024 using _Base::_M_impl;
21025 using _Base::_M_get_Tp_allocator;
21026 public:
21027 vector()
21028 : _Base() { }
21029 explicit
21030 vector(const allocator_type& __a)
21031 : _Base(__a) { }
21032 explicit
21033 vector(size_type __n, const value_type& __value = value_type(),
21034 const allocator_type& __a = allocator_type())
21035 : _Base(__n, __a)
21036 { _M_fill_initialize(__n, __value); }
21037 vector(const vector& __x)
21038 : _Base(__x.size(), __x._M_get_Tp_allocator())
21039 { this->_M_impl._M_finish =
21040 std::__uninitialized_copy_a(__x.begin(), __x.end(),
21041 this->_M_impl._M_start,
21042 _M_get_Tp_allocator());
21043 }
21044 template<typename _InputIterator>
21045 vector(_InputIterator __first, _InputIterator __last,
21046 const allocator_type& __a = allocator_type())
21047 : _Base(__a)
21048 {
21049 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21050 _M_initialize_dispatch(__first, __last, _Integral());
21051 }
21052 ~vector()
21053 { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
21054 _M_get_Tp_allocator()); }
21055 vector&
21056 operator=(const vector& __x);
21057 void
21058 assign(size_type __n, const value_type& __val)
21059 { _M_fill_assign(__n, __val); }
21060 template<typename _InputIterator>
21061 void
21062 assign(_InputIterator __first, _InputIterator __last)
21063 {
21064 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21065 _M_assign_dispatch(__first, __last, _Integral());
21066 }
21067 using _Base::get_allocator;
21068 iterator
21069 begin()
21070 { return iterator(this->_M_impl._M_start); }
21071 const_iterator
21072 begin() const
21073 { return const_iterator(this->_M_impl._M_start); }
21074 iterator
21075 end()
21076 { return iterator(this->_M_impl._M_finish); }
21077 const_iterator
21078 end() const
21079 { return const_iterator(this->_M_impl._M_finish); }
21080 reverse_iterator
21081 rbegin()
21082 { return reverse_iterator(end()); }
21083 const_reverse_iterator
21084 rbegin() const
21085 { return const_reverse_iterator(end()); }
21086 reverse_iterator
21087 rend()
21088 { return reverse_iterator(begin()); }
21089 const_reverse_iterator
21090 rend() const
21091 { return const_reverse_iterator(begin()); }
21092 size_type
21093 size() const
21094 { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
21095 size_type
21096 max_size() const
21097 { return _M_get_Tp_allocator().max_size(); }
21098 void
21099 resize(size_type __new_size, value_type __x = value_type())
21100 {
21101 if (__new_size < size())
21102 _M_erase_at_end(this->_M_impl._M_start + __new_size);
21103 else
21104 insert(end(), __new_size - size(), __x);
21105 }
21106 size_type
21107 capacity() const
21108 { return size_type(this->_M_impl._M_end_of_storage
21109 - this->_M_impl._M_start); }
21110 bool
21111 empty() const
21112 { return begin() == end(); }
21113 void
21114 reserve(size_type __n);
21115 reference
21116 operator[](size_type __n)
21117 { return *(this->_M_impl._M_start + __n); }
21118 const_reference
21119 operator[](size_type __n) const
21120 { return *(this->_M_impl._M_start + __n); }
21121 protected:
21122 void
21123 _M_range_check(size_type __n) const
21124 {
21125 if (__n >= this->size())
21126 __throw_out_of_range(("vector::_M_range_check"));
21127 }
21128 public:
21129 reference
21130 at(size_type __n)
21131 {
21132 _M_range_check(__n);
21133 return (*this)[__n];
21134 }
21135 const_reference
21136 at(size_type __n) const
21137 {
21138 _M_range_check(__n);
21139 return (*this)[__n];
21140 }
21141 reference
21142 front()
21143 { return *begin(); }
21144 const_reference
21145 front() const
21146 { return *begin(); }
21147 reference
21148 back()
21149 { return *(end() - 1); }
21150 const_reference
21151 back() const
21152 { return *(end() - 1); }
21153 pointer
21154 data()
21155 { return pointer(this->_M_impl._M_start); }
21156 const_pointer
21157 data() const
21158 { return const_pointer(this->_M_impl._M_start); }
21159 void
21160 push_back(const value_type& __x)
21161 {
21162 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
21163 {
21164 this->_M_impl.construct(this->_M_impl._M_finish, __x);
21165 ++this->_M_impl._M_finish;
21166 }
21167 else
21168 _M_insert_aux(end(), __x);
21169 }
21170 void
21171 pop_back()
21172 {
21173 --this->_M_impl._M_finish;
21174 this->_M_impl.destroy(this->_M_impl._M_finish);
21175 }
21176 iterator
21177 insert(iterator __position, const value_type& __x);
21178 void
21179 insert(iterator __position, size_type __n, const value_type& __x)
21180 { _M_fill_insert(__position, __n, __x); }
21181 template<typename _InputIterator>
21182 void
21183 insert(iterator __position, _InputIterator __first,
21184 _InputIterator __last)
21185 {
21186 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21187 _M_insert_dispatch(__position, __first, __last, _Integral());
21188 }
21189 iterator
21190 erase(iterator __position);
21191 iterator
21192 erase(iterator __first, iterator __last);
21193 void
21194 swap(vector& __x)
21195 {
21196 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
21197 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
21198 std::swap(this->_M_impl._M_end_of_storage,
21199 __x._M_impl._M_end_of_storage);
21200 std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(),
21201 __x._M_get_Tp_allocator());
21202 }
21203 void
21204 clear()
21205 { _M_erase_at_end(this->_M_impl._M_start); }
21206 protected:
21207 template<typename _ForwardIterator>
21208 pointer
21209 _M_allocate_and_copy(size_type __n,
21210 _ForwardIterator __first, _ForwardIterator __last)
21211 {
21212 pointer __result = this->_M_allocate(__n);
21213 try
21214 {
21215 std::__uninitialized_copy_a(__first, __last, __result,
21216 _M_get_Tp_allocator());
21217 return __result;
21218 }
21219 catch(...)
21220 {
21221 _M_deallocate(__result, __n);
21222 throw;
21223 }
21224 }
21225 template<typename _Integer>
21226 void
21227 _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
21228 {
21229 this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
21230 this->_M_impl._M_end_of_storage =
21231 this->_M_impl._M_start + static_cast<size_type>(__n);
21232 _M_fill_initialize(static_cast<size_type>(__n), __value);
21233 }
21234 template<typename _InputIterator>
21235 void
21236 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
21237 __false_type)
21238 {
21239 typedef typename std::iterator_traits<_InputIterator>::
21240 iterator_category _IterCategory;
21241 _M_range_initialize(__first, __last, _IterCategory());
21242 }
21243 template<typename _InputIterator>
21244 void
21245 _M_range_initialize(_InputIterator __first,
21246 _InputIterator __last, std::input_iterator_tag)
21247 {
21248 for (; __first != __last; ++__first)
21249 push_back(*__first);
21250 }
21251 template<typename _ForwardIterator>
21252 void
21253 _M_range_initialize(_ForwardIterator __first,
21254 _ForwardIterator __last, std::forward_iterator_tag)
21255 {
21256 const size_type __n = std::distance(__first, __last);
21257 this->_M_impl._M_start = this->_M_allocate(__n);
21258 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
21259 this->_M_impl._M_finish =
21260 std::__uninitialized_copy_a(__first, __last,
21261 this->_M_impl._M_start,
21262 _M_get_Tp_allocator());
21263 }
21264 void
21265 _M_fill_initialize(size_type __n, const value_type& __value)
21266 {
21267 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
21268 _M_get_Tp_allocator());
21269 this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
21270 }
21271 template<typename _Integer>
21272 void
21273 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
21274 { _M_fill_assign(__n, __val); }
21275 template<typename _InputIterator>
21276 void
21277 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
21278 __false_type)
21279 {
21280 typedef typename std::iterator_traits<_InputIterator>::
21281 iterator_category _IterCategory;
21282 _M_assign_aux(__first, __last, _IterCategory());
21283 }
21284 template<typename _InputIterator>
21285 void
21286 _M_assign_aux(_InputIterator __first, _InputIterator __last,
21287 std::input_iterator_tag);
21288 template<typename _ForwardIterator>
21289 void
21290 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
21291 std::forward_iterator_tag);
21292 void
21293 _M_fill_assign(size_type __n, const value_type& __val);
21294 template<typename _Integer>
21295 void
21296 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
21297 __true_type)
21298 { _M_fill_insert(__pos, __n, __val); }
21299 template<typename _InputIterator>
21300 void
21301 _M_insert_dispatch(iterator __pos, _InputIterator __first,
21302 _InputIterator __last, __false_type)
21303 {
21304 typedef typename std::iterator_traits<_InputIterator>::
21305 iterator_category _IterCategory;
21306 _M_range_insert(__pos, __first, __last, _IterCategory());
21307 }
21308 template<typename _InputIterator>
21309 void
21310 _M_range_insert(iterator __pos, _InputIterator __first,
21311 _InputIterator __last, std::input_iterator_tag);
21312 template<typename _ForwardIterator>
21313 void
21314 _M_range_insert(iterator __pos, _ForwardIterator __first,
21315 _ForwardIterator __last, std::forward_iterator_tag);
21316 void
21317 _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
21318 void
21319 _M_insert_aux(iterator __position, const value_type& __x);
21320 size_type
21321 _M_check_len(size_type __n, const char* __s) const
21322 {
21323 if (max_size() - size() < __n)
21324 __throw_length_error((__s));
21325 const size_type __len = size() + std::max(size(), __n);
21326 return (__len < size() || __len > max_size()) ? max_size() : __len;
21327 }
21328 void
21329 _M_erase_at_end(pointer __pos)
21330 {
21331 std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
21332 this->_M_impl._M_finish = __pos;
21333 }
21334 };
21335 template<typename _Tp, typename _Alloc>
21336 inline bool
21337 operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21338 { return (__x.size() == __y.size()
21339 && std::equal(__x.begin(), __x.end(), __y.begin())); }
21340 template<typename _Tp, typename _Alloc>
21341 inline bool
21342 operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21343 { return std::lexicographical_compare(__x.begin(), __x.end(),
21344 __y.begin(), __y.end()); }
21345 template<typename _Tp, typename _Alloc>
21346 inline bool
21347 operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21348 { return !(__x == __y); }
21349 template<typename _Tp, typename _Alloc>
21350 inline bool
21351 operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21352 { return __y < __x; }
21353 template<typename _Tp, typename _Alloc>
21354 inline bool
21355 operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21356 { return !(__y < __x); }
21357 template<typename _Tp, typename _Alloc>
21358 inline bool
21359 operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
21360 { return !(__x < __y); }
21361 template<typename _Tp, typename _Alloc>
21362 inline void
21363 swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
21364 { __x.swap(__y); }
21365 }
21366 namespace std __attribute__ ((__visibility__ ("default"))) {
21367 typedef unsigned long _Bit_type;
21368 enum { _S_word_bit = int(8 * sizeof(_Bit_type)) };
21369 struct _Bit_reference
21370 {
21371 _Bit_type * _M_p;
21372 _Bit_type _M_mask;
21373 _Bit_reference(_Bit_type * __x, _Bit_type __y)
21374 : _M_p(__x), _M_mask(__y) { }
21375 _Bit_reference() : _M_p(0), _M_mask(0) { }
21376 operator bool() const
21377 { return !!(*_M_p & _M_mask); }
21378 _Bit_reference&
21379 operator=(bool __x)
21380 {
21381 if (__x)
21382 *_M_p |= _M_mask;
21383 else
21384 *_M_p &= ~_M_mask;
21385 return *this;
21386 }
21387 _Bit_reference&
21388 operator=(const _Bit_reference& __x)
21389 { return *this = bool(__x); }
21390 bool
21391 operator==(const _Bit_reference& __x) const
21392 { return bool(*this) == bool(__x); }
21393 bool
21394 operator<(const _Bit_reference& __x) const
21395 { return !bool(*this) && bool(__x); }
21396 void
21397 flip()
21398 { *_M_p ^= _M_mask; }
21399 };
21400 struct _Bit_iterator_base
21401 : public std::iterator<std::random_access_iterator_tag, bool>
21402 {
21403 _Bit_type * _M_p;
21404 unsigned int _M_offset;
21405 _Bit_iterator_base(_Bit_type * __x, unsigned int __y)
21406 : _M_p(__x), _M_offset(__y) { }
21407 void
21408 _M_bump_up()
21409 {
21410 if (_M_offset++ == int(_S_word_bit) - 1)
21411 {
21412 _M_offset = 0;
21413 ++_M_p;
21414 }
21415 }
21416 void
21417 _M_bump_down()
21418 {
21419 if (_M_offset-- == 0)
21420 {
21421 _M_offset = int(_S_word_bit) - 1;
21422 --_M_p;
21423 }
21424 }
21425 void
21426 _M_incr(ptrdiff_t __i)
21427 {
21428 difference_type __n = __i + _M_offset;
21429 _M_p += __n / int(_S_word_bit);
21430 __n = __n % int(_S_word_bit);
21431 if (__n < 0)
21432 {
21433 __n += int(_S_word_bit);
21434 --_M_p;
21435 }
21436 _M_offset = static_cast<unsigned int>(__n);
21437 }
21438 bool
21439 operator==(const _Bit_iterator_base& __i) const
21440 { return _M_p == __i._M_p && _M_offset == __i._M_offset; }
21441 bool
21442 operator<(const _Bit_iterator_base& __i) const
21443 {
21444 return _M_p < __i._M_p
21445 || (_M_p == __i._M_p && _M_offset < __i._M_offset);
21446 }
21447 bool
21448 operator!=(const _Bit_iterator_base& __i) const
21449 { return !(*this == __i); }
21450 bool
21451 operator>(const _Bit_iterator_base& __i) const
21452 { return __i < *this; }
21453 bool
21454 operator<=(const _Bit_iterator_base& __i) const
21455 { return !(__i < *this); }
21456 bool
21457 operator>=(const _Bit_iterator_base& __i) const
21458 { return !(*this < __i); }
21459 };
21460 inline ptrdiff_t
21461 operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)
21462 {
21463 return (int(_S_word_bit) * (__x._M_p - __y._M_p)
21464 + __x._M_offset - __y._M_offset);
21465 }
21466 struct _Bit_iterator : public _Bit_iterator_base
21467 {
21468 typedef _Bit_reference reference;
21469 typedef _Bit_reference* pointer;
21470 typedef _Bit_iterator iterator;
21471 _Bit_iterator() : _Bit_iterator_base(0, 0) { }
21472 _Bit_iterator(_Bit_type * __x, unsigned int __y)
21473 : _Bit_iterator_base(__x, __y) { }
21474 reference
21475 operator*() const
21476 { return reference(_M_p, 1UL << _M_offset); }
21477 iterator&
21478 operator++()
21479 {
21480 _M_bump_up();
21481 return *this;
21482 }
21483 iterator
21484 operator++(int)
21485 {
21486 iterator __tmp = *this;
21487 _M_bump_up();
21488 return __tmp;
21489 }
21490 iterator&
21491 operator--()
21492 {
21493 _M_bump_down();
21494 return *this;
21495 }
21496 iterator
21497 operator--(int)
21498 {
21499 iterator __tmp = *this;
21500 _M_bump_down();
21501 return __tmp;
21502 }
21503 iterator&
21504 operator+=(difference_type __i)
21505 {
21506 _M_incr(__i);
21507 return *this;
21508 }
21509 iterator&
21510 operator-=(difference_type __i)
21511 {
21512 *this += -__i;
21513 return *this;
21514 }
21515 iterator
21516 operator+(difference_type __i) const
21517 {
21518 iterator __tmp = *this;
21519 return __tmp += __i;
21520 }
21521 iterator
21522 operator-(difference_type __i) const
21523 {
21524 iterator __tmp = *this;
21525 return __tmp -= __i;
21526 }
21527 reference
21528 operator[](difference_type __i) const
21529 { return *(*this + __i); }
21530 };
21531 inline _Bit_iterator
21532 operator+(ptrdiff_t __n, const _Bit_iterator& __x)
21533 { return __x + __n; }
21534 struct _Bit_const_iterator : public _Bit_iterator_base
21535 {
21536 typedef bool reference;
21537 typedef bool const_reference;
21538 typedef const bool* pointer;
21539 typedef _Bit_const_iterator const_iterator;
21540 _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
21541 _Bit_const_iterator(_Bit_type * __x, unsigned int __y)
21542 : _Bit_iterator_base(__x, __y) { }
21543 _Bit_const_iterator(const _Bit_iterator& __x)
21544 : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
21545 const_reference
21546 operator*() const
21547 { return _Bit_reference(_M_p, 1UL << _M_offset); }
21548 const_iterator&
21549 operator++()
21550 {
21551 _M_bump_up();
21552 return *this;
21553 }
21554 const_iterator
21555 operator++(int)
21556 {
21557 const_iterator __tmp = *this;
21558 _M_bump_up();
21559 return __tmp;
21560 }
21561 const_iterator&
21562 operator--()
21563 {
21564 _M_bump_down();
21565 return *this;
21566 }
21567 const_iterator
21568 operator--(int)
21569 {
21570 const_iterator __tmp = *this;
21571 _M_bump_down();
21572 return __tmp;
21573 }
21574 const_iterator&
21575 operator+=(difference_type __i)
21576 {
21577 _M_incr(__i);
21578 return *this;
21579 }
21580 const_iterator&
21581 operator-=(difference_type __i)
21582 {
21583 *this += -__i;
21584 return *this;
21585 }
21586 const_iterator
21587 operator+(difference_type __i) const
21588 {
21589 const_iterator __tmp = *this;
21590 return __tmp += __i;
21591 }
21592 const_iterator
21593 operator-(difference_type __i) const
21594 {
21595 const_iterator __tmp = *this;
21596 return __tmp -= __i;
21597 }
21598 const_reference
21599 operator[](difference_type __i) const
21600 { return *(*this + __i); }
21601 };
21602 inline _Bit_const_iterator
21603 operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)
21604 { return __x + __n; }
21605 inline void
21606 __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x)
21607 {
21608 for (; __first != __last; ++__first)
21609 *__first = __x;
21610 }
21611 inline void
21612 fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x)
21613 {
21614 if (__first._M_p != __last._M_p)
21615 {
21616 std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);
21617 __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x);
21618 __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x);
21619 }
21620 else
21621 __fill_bvector(__first, __last, __x);
21622 }
21623 template<typename _Alloc>
21624 struct _Bvector_base
21625 {
21626 typedef typename _Alloc::template rebind<_Bit_type>::other
21627 _Bit_alloc_type;
21628 struct _Bvector_impl
21629 : public _Bit_alloc_type
21630 {
21631 _Bit_iterator _M_start;
21632 _Bit_iterator _M_finish;
21633 _Bit_type* _M_end_of_storage;
21634 _Bvector_impl()
21635 : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0)
21636 { }
21637 _Bvector_impl(const _Bit_alloc_type& __a)
21638 : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
21639 { }
21640 };
21641 public:
21642 typedef _Alloc allocator_type;
21643 _Bit_alloc_type&
21644 _M_get_Bit_allocator()
21645 { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); }
21646 const _Bit_alloc_type&
21647 _M_get_Bit_allocator() const
21648 { return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); }
21649 allocator_type
21650 get_allocator() const
21651 { return allocator_type(_M_get_Bit_allocator()); }
21652 _Bvector_base()
21653 : _M_impl() { }
21654 _Bvector_base(const allocator_type& __a)
21655 : _M_impl(__a) { }
21656 ~_Bvector_base()
21657 { this->_M_deallocate(); }
21658 protected:
21659 _Bvector_impl _M_impl;
21660 _Bit_type*
21661 _M_allocate(size_t __n)
21662 { return _M_impl.allocate((__n + int(_S_word_bit) - 1)
21663 / int(_S_word_bit)); }
21664 void
21665 _M_deallocate()
21666 {
21667 if (_M_impl._M_start._M_p)
21668 _M_impl.deallocate(_M_impl._M_start._M_p,
21669 _M_impl._M_end_of_storage - _M_impl._M_start._M_p);
21670 }
21671 };
21672 }
21673 namespace std __attribute__ ((__visibility__ ("default"))) {
21674 template<typename _Alloc>
21675 class vector<bool, _Alloc> : protected _Bvector_base<_Alloc>
21676 {
21677 typedef _Bvector_base<_Alloc> _Base;
21678 public:
21679 typedef bool value_type;
21680 typedef size_t size_type;
21681 typedef ptrdiff_t difference_type;
21682 typedef _Bit_reference reference;
21683 typedef bool const_reference;
21684 typedef _Bit_reference* pointer;
21685 typedef const bool* const_pointer;
21686 typedef _Bit_iterator iterator;
21687 typedef _Bit_const_iterator const_iterator;
21688 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
21689 typedef std::reverse_iterator<iterator> reverse_iterator;
21690 typedef _Alloc allocator_type;
21691 allocator_type get_allocator() const
21692 { return _Base::get_allocator(); }
21693 protected:
21694 using _Base::_M_allocate;
21695 using _Base::_M_deallocate;
21696 using _Base::_M_get_Bit_allocator;
21697 public:
21698 vector()
21699 : _Base() { }
21700 explicit
21701 vector(const allocator_type& __a)
21702 : _Base(__a) { }
21703 explicit
21704 vector(size_type __n, const bool& __value = bool(),
21705 const allocator_type& __a = allocator_type())
21706 : _Base(__a)
21707 {
21708 _M_initialize(__n);
21709 std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage,
21710 __value ? ~0 : 0);
21711 }
21712 vector(const vector& __x)
21713 : _Base(__x._M_get_Bit_allocator())
21714 {
21715 _M_initialize(__x.size());
21716 _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start);
21717 }
21718 template<typename _InputIterator>
21719 vector(_InputIterator __first, _InputIterator __last,
21720 const allocator_type& __a = allocator_type())
21721 : _Base(__a)
21722 {
21723 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21724 _M_initialize_dispatch(__first, __last, _Integral());
21725 }
21726 ~vector() { }
21727 vector&
21728 operator=(const vector& __x)
21729 {
21730 if (&__x == this)
21731 return *this;
21732 if (__x.size() > capacity())
21733 {
21734 this->_M_deallocate();
21735 _M_initialize(__x.size());
21736 }
21737 this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(),
21738 begin());
21739 return *this;
21740 }
21741 void
21742 assign(size_type __n, const bool& __x)
21743 { _M_fill_assign(__n, __x); }
21744 template<typename _InputIterator>
21745 void
21746 assign(_InputIterator __first, _InputIterator __last)
21747 {
21748 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21749 _M_assign_dispatch(__first, __last, _Integral());
21750 }
21751 iterator
21752 begin()
21753 { return this->_M_impl._M_start; }
21754 const_iterator
21755 begin() const
21756 { return this->_M_impl._M_start; }
21757 iterator
21758 end()
21759 { return this->_M_impl._M_finish; }
21760 const_iterator
21761 end() const
21762 { return this->_M_impl._M_finish; }
21763 reverse_iterator
21764 rbegin()
21765 { return reverse_iterator(end()); }
21766 const_reverse_iterator
21767 rbegin() const
21768 { return const_reverse_iterator(end()); }
21769 reverse_iterator
21770 rend()
21771 { return reverse_iterator(begin()); }
21772 const_reverse_iterator
21773 rend() const
21774 { return const_reverse_iterator(begin()); }
21775 size_type
21776 size() const
21777 { return size_type(end() - begin()); }
21778 size_type
21779 max_size() const
21780 {
21781 const size_type __isize =
21782 __gnu_cxx::__numeric_traits<difference_type>::__max
21783 - int(_S_word_bit) + 1;
21784 const size_type __asize = _M_get_Bit_allocator().max_size();
21785 return (__asize <= __isize / int(_S_word_bit)
21786 ? __asize * int(_S_word_bit) : __isize);
21787 }
21788 size_type
21789 capacity() const
21790 { return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0)
21791 - begin()); }
21792 bool
21793 empty() const
21794 { return begin() == end(); }
21795 reference
21796 operator[](size_type __n)
21797 {
21798 return *iterator(this->_M_impl._M_start._M_p
21799 + __n / int(_S_word_bit), __n % int(_S_word_bit));
21800 }
21801 const_reference
21802 operator[](size_type __n) const
21803 {
21804 return *const_iterator(this->_M_impl._M_start._M_p
21805 + __n / int(_S_word_bit), __n % int(_S_word_bit));
21806 }
21807 protected:
21808 void
21809 _M_range_check(size_type __n) const
21810 {
21811 if (__n >= this->size())
21812 __throw_out_of_range(("vector<bool>::_M_range_check"));
21813 }
21814 public:
21815 reference
21816 at(size_type __n)
21817 { _M_range_check(__n); return (*this)[__n]; }
21818 const_reference
21819 at(size_type __n) const
21820 { _M_range_check(__n); return (*this)[__n]; }
21821 void
21822 reserve(size_type __n);
21823 reference
21824 front()
21825 { return *begin(); }
21826 const_reference
21827 front() const
21828 { return *begin(); }
21829 reference
21830 back()
21831 { return *(end() - 1); }
21832 const_reference
21833 back() const
21834 { return *(end() - 1); }
21835 void
21836 data() { }
21837 void
21838 push_back(bool __x)
21839 {
21840 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
21841 *this->_M_impl._M_finish++ = __x;
21842 else
21843 _M_insert_aux(end(), __x);
21844 }
21845 void
21846 swap(vector& __x)
21847 {
21848 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
21849 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
21850 std::swap(this->_M_impl._M_end_of_storage,
21851 __x._M_impl._M_end_of_storage);
21852 std::__alloc_swap<typename _Base::_Bit_alloc_type>::
21853 _S_do_it(_M_get_Bit_allocator(), __x._M_get_Bit_allocator());
21854 }
21855 static void
21856 swap(reference __x, reference __y)
21857 {
21858 bool __tmp = __x;
21859 __x = __y;
21860 __y = __tmp;
21861 }
21862 iterator
21863 insert(iterator __position, const bool& __x = bool())
21864 {
21865 const difference_type __n = __position - begin();
21866 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage
21867 && __position == end())
21868 *this->_M_impl._M_finish++ = __x;
21869 else
21870 _M_insert_aux(__position, __x);
21871 return begin() + __n;
21872 }
21873 template<typename _InputIterator>
21874 void
21875 insert(iterator __position,
21876 _InputIterator __first, _InputIterator __last)
21877 {
21878 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
21879 _M_insert_dispatch(__position, __first, __last, _Integral());
21880 }
21881 void
21882 insert(iterator __position, size_type __n, const bool& __x)
21883 { _M_fill_insert(__position, __n, __x); }
21884 void
21885 pop_back()
21886 { --this->_M_impl._M_finish; }
21887 iterator
21888 erase(iterator __position)
21889 {
21890 if (__position + 1 != end())
21891 std::copy(__position + 1, end(), __position);
21892 --this->_M_impl._M_finish;
21893 return __position;
21894 }
21895 iterator
21896 erase(iterator __first, iterator __last)
21897 {
21898 _M_erase_at_end(std::copy(__last, end(), __first));
21899 return __first;
21900 }
21901 void
21902 resize(size_type __new_size, bool __x = bool())
21903 {
21904 if (__new_size < size())
21905 _M_erase_at_end(begin() + difference_type(__new_size));
21906 else
21907 insert(end(), __new_size - size(), __x);
21908 }
21909 void
21910 flip()
21911 {
21912 for (_Bit_type * __p = this->_M_impl._M_start._M_p;
21913 __p != this->_M_impl._M_end_of_storage; ++__p)
21914 *__p = ~*__p;
21915 }
21916 void
21917 clear()
21918 { _M_erase_at_end(begin()); }
21919 protected:
21920 iterator
21921 _M_copy_aligned(const_iterator __first, const_iterator __last,
21922 iterator __result)
21923 {
21924 _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
21925 return std::copy(const_iterator(__last._M_p, 0), __last,
21926 iterator(__q, 0));
21927 }
21928 void
21929 _M_initialize(size_type __n)
21930 {
21931 _Bit_type* __q = this->_M_allocate(__n);
21932 this->_M_impl._M_end_of_storage = (__q
21933 + ((__n + int(_S_word_bit) - 1)
21934 / int(_S_word_bit)));
21935 this->_M_impl._M_start = iterator(__q, 0);
21936 this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
21937 }
21938 template<typename _Integer>
21939 void
21940 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
21941 {
21942 _M_initialize(static_cast<size_type>(__n));
21943 std::fill(this->_M_impl._M_start._M_p,
21944 this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
21945 }
21946 template<typename _InputIterator>
21947 void
21948 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
21949 __false_type)
21950 { _M_initialize_range(__first, __last,
21951 std::__iterator_category(__first)); }
21952 template<typename _InputIterator>
21953 void
21954 _M_initialize_range(_InputIterator __first, _InputIterator __last,
21955 std::input_iterator_tag)
21956 {
21957 for (; __first != __last; ++__first)
21958 push_back(*__first);
21959 }
21960 template<typename _ForwardIterator>
21961 void
21962 _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
21963 std::forward_iterator_tag)
21964 {
21965 const size_type __n = std::distance(__first, __last);
21966 _M_initialize(__n);
21967 std::copy(__first, __last, this->_M_impl._M_start);
21968 }
21969 template<typename _Integer>
21970 void
21971 _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
21972 { _M_fill_assign(__n, __val); }
21973 template<class _InputIterator>
21974 void
21975 _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
21976 __false_type)
21977 { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
21978 void
21979 _M_fill_assign(size_t __n, bool __x)
21980 {
21981 if (__n > size())
21982 {
21983 std::fill(this->_M_impl._M_start._M_p,
21984 this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
21985 insert(end(), __n - size(), __x);
21986 }
21987 else
21988 {
21989 _M_erase_at_end(begin() + __n);
21990 std::fill(this->_M_impl._M_start._M_p,
21991 this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
21992 }
21993 }
21994 template<typename _InputIterator>
21995 void
21996 _M_assign_aux(_InputIterator __first, _InputIterator __last,
21997 std::input_iterator_tag)
21998 {
21999 iterator __cur = begin();
22000 for (; __first != __last && __cur != end(); ++__cur, ++__first)
22001 *__cur = *__first;
22002 if (__first == __last)
22003 _M_erase_at_end(__cur);
22004 else
22005 insert(end(), __first, __last);
22006 }
22007 template<typename _ForwardIterator>
22008 void
22009 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
22010 std::forward_iterator_tag)
22011 {
22012 const size_type __len = std::distance(__first, __last);
22013 if (__len < size())
22014 _M_erase_at_end(std::copy(__first, __last, begin()));
22015 else
22016 {
22017 _ForwardIterator __mid = __first;
22018 std::advance(__mid, size());
22019 std::copy(__first, __mid, begin());
22020 insert(end(), __mid, __last);
22021 }
22022 }
22023 template<typename _Integer>
22024 void
22025 _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
22026 __true_type)
22027 { _M_fill_insert(__pos, __n, __x); }
22028 template<typename _InputIterator>
22029 void
22030 _M_insert_dispatch(iterator __pos,
22031 _InputIterator __first, _InputIterator __last,
22032 __false_type)
22033 { _M_insert_range(__pos, __first, __last,
22034 std::__iterator_category(__first)); }
22035 void
22036 _M_fill_insert(iterator __position, size_type __n, bool __x);
22037 template<typename _InputIterator>
22038 void
22039 _M_insert_range(iterator __pos, _InputIterator __first,
22040 _InputIterator __last, std::input_iterator_tag)
22041 {
22042 for (; __first != __last; ++__first)
22043 {
22044 __pos = insert(__pos, *__first);
22045 ++__pos;
22046 }
22047 }
22048 template<typename _ForwardIterator>
22049 void
22050 _M_insert_range(iterator __position, _ForwardIterator __first,
22051 _ForwardIterator __last, std::forward_iterator_tag);
22052 void
22053 _M_insert_aux(iterator __position, bool __x);
22054 size_type
22055 _M_check_len(size_type __n, const char* __s) const
22056 {
22057 if (max_size() - size() < __n)
22058 __throw_length_error((__s));
22059 const size_type __len = size() + std::max(size(), __n);
22060 return (__len < size() || __len > max_size()) ? max_size() : __len;
22061 }
22062 void
22063 _M_erase_at_end(iterator __pos)
22064 { this->_M_impl._M_finish = __pos; }
22065 };
22066 }
22067 namespace std __attribute__ ((__visibility__ ("default"))) {
22068 template<typename _Tp, typename _Alloc>
22069 void
22070 vector<_Tp, _Alloc>::
22071 reserve(size_type __n)
22072 {
22073 if (__n > this->max_size())
22074 __throw_length_error(("vector::reserve"));
22075 if (this->capacity() < __n)
22076 {
22077 const size_type __old_size = size();
22078 pointer __tmp = _M_allocate_and_copy(__n,
22079 (this->_M_impl._M_start),
22080 (this->_M_impl._M_finish));
22081 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22082 _M_get_Tp_allocator());
22083 _M_deallocate(this->_M_impl._M_start,
22084 this->_M_impl._M_end_of_storage
22085 - this->_M_impl._M_start);
22086 this->_M_impl._M_start = __tmp;
22087 this->_M_impl._M_finish = __tmp + __old_size;
22088 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
22089 }
22090 }
22091 template<typename _Tp, typename _Alloc>
22092 typename vector<_Tp, _Alloc>::iterator
22093 vector<_Tp, _Alloc>::
22094 insert(iterator __position, const value_type& __x)
22095 {
22096 const size_type __n = __position - begin();
22097 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage
22098 && __position == end())
22099 {
22100 this->_M_impl.construct(this->_M_impl._M_finish, __x);
22101 ++this->_M_impl._M_finish;
22102 }
22103 else
22104 {
22105 _M_insert_aux(__position, __x);
22106 }
22107 return iterator(this->_M_impl._M_start + __n);
22108 }
22109 template<typename _Tp, typename _Alloc>
22110 typename vector<_Tp, _Alloc>::iterator
22111 vector<_Tp, _Alloc>::
22112 erase(iterator __position)
22113 {
22114 if (__position + 1 != end())
22115 std::copy(__position + 1, end(), __position);
22116 --this->_M_impl._M_finish;
22117 this->_M_impl.destroy(this->_M_impl._M_finish);
22118 return __position;
22119 }
22120 template<typename _Tp, typename _Alloc>
22121 typename vector<_Tp, _Alloc>::iterator
22122 vector<_Tp, _Alloc>::
22123 erase(iterator __first, iterator __last)
22124 {
22125 if (__last != end())
22126 std::copy(__last, end(), __first);
22127 _M_erase_at_end(__first.base() + (end() - __last));
22128 return __first;
22129 }
22130 template<typename _Tp, typename _Alloc>
22131 vector<_Tp, _Alloc>&
22132 vector<_Tp, _Alloc>::
22133 operator=(const vector<_Tp, _Alloc>& __x)
22134 {
22135 if (&__x != this)
22136 {
22137 const size_type __xlen = __x.size();
22138 if (__xlen > capacity())
22139 {
22140 pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(),
22141 __x.end());
22142 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22143 _M_get_Tp_allocator());
22144 _M_deallocate(this->_M_impl._M_start,
22145 this->_M_impl._M_end_of_storage
22146 - this->_M_impl._M_start);
22147 this->_M_impl._M_start = __tmp;
22148 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen;
22149 }
22150 else if (size() >= __xlen)
22151 {
22152 std::_Destroy(std::copy(__x.begin(), __x.end(), begin()),
22153 end(), _M_get_Tp_allocator());
22154 }
22155 else
22156 {
22157 std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(),
22158 this->_M_impl._M_start);
22159 std::__uninitialized_copy_a(__x._M_impl._M_start + size(),
22160 __x._M_impl._M_finish,
22161 this->_M_impl._M_finish,
22162 _M_get_Tp_allocator());
22163 }
22164 this->_M_impl._M_finish = this->_M_impl._M_start + __xlen;
22165 }
22166 return *this;
22167 }
22168 template<typename _Tp, typename _Alloc>
22169 void
22170 vector<_Tp, _Alloc>::
22171 _M_fill_assign(size_t __n, const value_type& __val)
22172 {
22173 if (__n > capacity())
22174 {
22175 vector __tmp(__n, __val, _M_get_Tp_allocator());
22176 __tmp.swap(*this);
22177 }
22178 else if (__n > size())
22179 {
22180 std::fill(begin(), end(), __val);
22181 std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
22182 __n - size(), __val,
22183 _M_get_Tp_allocator());
22184 this->_M_impl._M_finish += __n - size();
22185 }
22186 else
22187 _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val));
22188 }
22189 template<typename _Tp, typename _Alloc>
22190 template<typename _InputIterator>
22191 void
22192 vector<_Tp, _Alloc>::
22193 _M_assign_aux(_InputIterator __first, _InputIterator __last,
22194 std::input_iterator_tag)
22195 {
22196 pointer __cur(this->_M_impl._M_start);
22197 for (; __first != __last && __cur != this->_M_impl._M_finish;
22198 ++__cur, ++__first)
22199 *__cur = *__first;
22200 if (__first == __last)
22201 _M_erase_at_end(__cur);
22202 else
22203 insert(end(), __first, __last);
22204 }
22205 template<typename _Tp, typename _Alloc>
22206 template<typename _ForwardIterator>
22207 void
22208 vector<_Tp, _Alloc>::
22209 _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
22210 std::forward_iterator_tag)
22211 {
22212 const size_type __len = std::distance(__first, __last);
22213 if (__len > capacity())
22214 {
22215 pointer __tmp(_M_allocate_and_copy(__len, __first, __last));
22216 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22217 _M_get_Tp_allocator());
22218 _M_deallocate(this->_M_impl._M_start,
22219 this->_M_impl._M_end_of_storage
22220 - this->_M_impl._M_start);
22221 this->_M_impl._M_start = __tmp;
22222 this->_M_impl._M_finish = this->_M_impl._M_start + __len;
22223 this->_M_impl._M_end_of_storage = this->_M_impl._M_finish;
22224 }
22225 else if (size() >= __len)
22226 _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start));
22227 else
22228 {
22229 _ForwardIterator __mid = __first;
22230 std::advance(__mid, size());
22231 std::copy(__first, __mid, this->_M_impl._M_start);
22232 this->_M_impl._M_finish =
22233 std::__uninitialized_copy_a(__mid, __last,
22234 this->_M_impl._M_finish,
22235 _M_get_Tp_allocator());
22236 }
22237 }
22238 template<typename _Tp, typename _Alloc>
22239 void
22240 vector<_Tp, _Alloc>::
22241 _M_insert_aux(iterator __position, const _Tp& __x)
22242 {
22243 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
22244 {
22245 this->_M_impl.construct(this->_M_impl._M_finish,
22246 (*(this->_M_impl._M_finish - 1)));
22247 ++this->_M_impl._M_finish;
22248 _Tp __x_copy = __x;
22249 std::copy_backward(__position.base(), this->_M_impl._M_finish - 2, this->_M_impl._M_finish - 1);
22250 *__position = __x_copy;
22251 }
22252 else
22253 {
22254 const size_type __len =
22255 _M_check_len(size_type(1), "vector::_M_insert_aux");
22256 pointer __new_start(this->_M_allocate(__len));
22257 pointer __new_finish(__new_start);
22258 try
22259 {
22260 __new_finish =
22261 std::__uninitialized_move_a(this->_M_impl._M_start,
22262 __position.base(), __new_start,
22263 _M_get_Tp_allocator());
22264 this->_M_impl.construct(__new_finish, __x);
22265 ++__new_finish;
22266 __new_finish =
22267 std::__uninitialized_move_a(__position.base(),
22268 this->_M_impl._M_finish,
22269 __new_finish,
22270 _M_get_Tp_allocator());
22271 }
22272 catch(...)
22273 {
22274 std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator());
22275 _M_deallocate(__new_start, __len);
22276 throw;
22277 }
22278 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22279 _M_get_Tp_allocator());
22280 _M_deallocate(this->_M_impl._M_start,
22281 this->_M_impl._M_end_of_storage
22282 - this->_M_impl._M_start);
22283 this->_M_impl._M_start = __new_start;
22284 this->_M_impl._M_finish = __new_finish;
22285 this->_M_impl._M_end_of_storage = __new_start + __len;
22286 }
22287 }
22288 template<typename _Tp, typename _Alloc>
22289 void
22290 vector<_Tp, _Alloc>::
22291 _M_fill_insert(iterator __position, size_type __n, const value_type& __x)
22292 {
22293 if (__n != 0)
22294 {
22295 if (size_type(this->_M_impl._M_end_of_storage
22296 - this->_M_impl._M_finish) >= __n)
22297 {
22298 value_type __x_copy = __x;
22299 const size_type __elems_after = end() - __position;
22300 pointer __old_finish(this->_M_impl._M_finish);
22301 if (__elems_after > __n)
22302 {
22303 std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
22304 this->_M_impl._M_finish,
22305 this->_M_impl._M_finish,
22306 _M_get_Tp_allocator());
22307 this->_M_impl._M_finish += __n;
22308 std::copy_backward(__position.base(), __old_finish - __n, __old_finish);
22309 std::fill(__position.base(), __position.base() + __n,
22310 __x_copy);
22311 }
22312 else
22313 {
22314 std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
22315 __n - __elems_after,
22316 __x_copy,
22317 _M_get_Tp_allocator());
22318 this->_M_impl._M_finish += __n - __elems_after;
22319 std::__uninitialized_move_a(__position.base(), __old_finish,
22320 this->_M_impl._M_finish,
22321 _M_get_Tp_allocator());
22322 this->_M_impl._M_finish += __elems_after;
22323 std::fill(__position.base(), __old_finish, __x_copy);
22324 }
22325 }
22326 else
22327 {
22328 const size_type __len =
22329 _M_check_len(__n, "vector::_M_fill_insert");
22330 pointer __new_start(this->_M_allocate(__len));
22331 pointer __new_finish(__new_start);
22332 try
22333 {
22334 __new_finish =
22335 std::__uninitialized_move_a(this->_M_impl._M_start,
22336 __position.base(),
22337 __new_start,
22338 _M_get_Tp_allocator());
22339 std::__uninitialized_fill_n_a(__new_finish, __n, __x,
22340 _M_get_Tp_allocator());
22341 __new_finish += __n;
22342 __new_finish =
22343 std::__uninitialized_move_a(__position.base(),
22344 this->_M_impl._M_finish,
22345 __new_finish,
22346 _M_get_Tp_allocator());
22347 }
22348 catch(...)
22349 {
22350 std::_Destroy(__new_start, __new_finish,
22351 _M_get_Tp_allocator());
22352 _M_deallocate(__new_start, __len);
22353 throw;
22354 }
22355 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22356 _M_get_Tp_allocator());
22357 _M_deallocate(this->_M_impl._M_start,
22358 this->_M_impl._M_end_of_storage
22359 - this->_M_impl._M_start);
22360 this->_M_impl._M_start = __new_start;
22361 this->_M_impl._M_finish = __new_finish;
22362 this->_M_impl._M_end_of_storage = __new_start + __len;
22363 }
22364 }
22365 }
22366 template<typename _Tp, typename _Alloc>
22367 template<typename _InputIterator>
22368 void
22369 vector<_Tp, _Alloc>::
22370 _M_range_insert(iterator __pos, _InputIterator __first,
22371 _InputIterator __last, std::input_iterator_tag)
22372 {
22373 for (; __first != __last; ++__first)
22374 {
22375 __pos = insert(__pos, *__first);
22376 ++__pos;
22377 }
22378 }
22379 template<typename _Tp, typename _Alloc>
22380 template<typename _ForwardIterator>
22381 void
22382 vector<_Tp, _Alloc>::
22383 _M_range_insert(iterator __position, _ForwardIterator __first,
22384 _ForwardIterator __last, std::forward_iterator_tag)
22385 {
22386 if (__first != __last)
22387 {
22388 const size_type __n = std::distance(__first, __last);
22389 if (size_type(this->_M_impl._M_end_of_storage
22390 - this->_M_impl._M_finish) >= __n)
22391 {
22392 const size_type __elems_after = end() - __position;
22393 pointer __old_finish(this->_M_impl._M_finish);
22394 if (__elems_after > __n)
22395 {
22396 std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
22397 this->_M_impl._M_finish,
22398 this->_M_impl._M_finish,
22399 _M_get_Tp_allocator());
22400 this->_M_impl._M_finish += __n;
22401 std::copy_backward(__position.base(), __old_finish - __n, __old_finish);
22402 std::copy(__first, __last, __position);
22403 }
22404 else
22405 {
22406 _ForwardIterator __mid = __first;
22407 std::advance(__mid, __elems_after);
22408 std::__uninitialized_copy_a(__mid, __last,
22409 this->_M_impl._M_finish,
22410 _M_get_Tp_allocator());
22411 this->_M_impl._M_finish += __n - __elems_after;
22412 std::__uninitialized_move_a(__position.base(),
22413 __old_finish,
22414 this->_M_impl._M_finish,
22415 _M_get_Tp_allocator());
22416 this->_M_impl._M_finish += __elems_after;
22417 std::copy(__first, __mid, __position);
22418 }
22419 }
22420 else
22421 {
22422 const size_type __len =
22423 _M_check_len(__n, "vector::_M_range_insert");
22424 pointer __new_start(this->_M_allocate(__len));
22425 pointer __new_finish(__new_start);
22426 try
22427 {
22428 __new_finish =
22429 std::__uninitialized_move_a(this->_M_impl._M_start,
22430 __position.base(),
22431 __new_start,
22432 _M_get_Tp_allocator());
22433 __new_finish =
22434 std::__uninitialized_copy_a(__first, __last,
22435 __new_finish,
22436 _M_get_Tp_allocator());
22437 __new_finish =
22438 std::__uninitialized_move_a(__position.base(),
22439 this->_M_impl._M_finish,
22440 __new_finish,
22441 _M_get_Tp_allocator());
22442 }
22443 catch(...)
22444 {
22445 std::_Destroy(__new_start, __new_finish,
22446 _M_get_Tp_allocator());
22447 _M_deallocate(__new_start, __len);
22448 throw;
22449 }
22450 std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
22451 _M_get_Tp_allocator());
22452 _M_deallocate(this->_M_impl._M_start,
22453 this->_M_impl._M_end_of_storage
22454 - this->_M_impl._M_start);
22455 this->_M_impl._M_start = __new_start;
22456 this->_M_impl._M_finish = __new_finish;
22457 this->_M_impl._M_end_of_storage = __new_start + __len;
22458 }
22459 }
22460 }
22461 template<typename _Alloc>
22462 void
22463 vector<bool, _Alloc>::
22464 reserve(size_type __n)
22465 {
22466 if (__n > this->max_size())
22467 __throw_length_error(("vector::reserve"));
22468 if (this->capacity() < __n)
22469 {
22470 _Bit_type* __q = this->_M_allocate(__n);
22471 this->_M_impl._M_finish = _M_copy_aligned(begin(), end(),
22472 iterator(__q, 0));
22473 this->_M_deallocate();
22474 this->_M_impl._M_start = iterator(__q, 0);
22475 this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)
22476 / int(_S_word_bit));
22477 }
22478 }
22479 template<typename _Alloc>
22480 void
22481 vector<bool, _Alloc>::
22482 _M_fill_insert(iterator __position, size_type __n, bool __x)
22483 {
22484 if (__n == 0)
22485 return;
22486 if (capacity() - size() >= __n)
22487 {
22488 std::copy_backward(__position, end(),
22489 this->_M_impl._M_finish + difference_type(__n));
22490 std::fill(__position, __position + difference_type(__n), __x);
22491 this->_M_impl._M_finish += difference_type(__n);
22492 }
22493 else
22494 {
22495 const size_type __len =
22496 _M_check_len(__n, "vector<bool>::_M_fill_insert");
22497 _Bit_type * __q = this->_M_allocate(__len);
22498 iterator __i = _M_copy_aligned(begin(), __position,
22499 iterator(__q, 0));
22500 std::fill(__i, __i + difference_type(__n), __x);
22501 this->_M_impl._M_finish = std::copy(__position, end(),
22502 __i + difference_type(__n));
22503 this->_M_deallocate();
22504 this->_M_impl._M_end_of_storage = (__q + ((__len
22505 + int(_S_word_bit) - 1)
22506 / int(_S_word_bit)));
22507 this->_M_impl._M_start = iterator(__q, 0);
22508 }
22509 }
22510 template<typename _Alloc>
22511 template<typename _ForwardIterator>
22512 void
22513 vector<bool, _Alloc>::
22514 _M_insert_range(iterator __position, _ForwardIterator __first,
22515 _ForwardIterator __last, std::forward_iterator_tag)
22516 {
22517 if (__first != __last)
22518 {
22519 size_type __n = std::distance(__first, __last);
22520 if (capacity() - size() >= __n)
22521 {
22522 std::copy_backward(__position, end(),
22523 this->_M_impl._M_finish
22524 + difference_type(__n));
22525 std::copy(__first, __last, __position);
22526 this->_M_impl._M_finish += difference_type(__n);
22527 }
22528 else
22529 {
22530 const size_type __len =
22531 _M_check_len(__n, "vector<bool>::_M_insert_range");
22532 _Bit_type * __q = this->_M_allocate(__len);
22533 iterator __i = _M_copy_aligned(begin(), __position,
22534 iterator(__q, 0));
22535 __i = std::copy(__first, __last, __i);
22536 this->_M_impl._M_finish = std::copy(__position, end(), __i);
22537 this->_M_deallocate();
22538 this->_M_impl._M_end_of_storage = (__q
22539 + ((__len
22540 + int(_S_word_bit) - 1)
22541 / int(_S_word_bit)));
22542 this->_M_impl._M_start = iterator(__q, 0);
22543 }
22544 }
22545 }
22546 template<typename _Alloc>
22547 void
22548 vector<bool, _Alloc>::
22549 _M_insert_aux(iterator __position, bool __x)
22550 {
22551 if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
22552 {
22553 std::copy_backward(__position, this->_M_impl._M_finish,
22554 this->_M_impl._M_finish + 1);
22555 *__position = __x;
22556 ++this->_M_impl._M_finish;
22557 }
22558 else
22559 {
22560 const size_type __len =
22561 _M_check_len(size_type(1), "vector<bool>::_M_insert_aux");
22562 _Bit_type * __q = this->_M_allocate(__len);
22563 iterator __i = _M_copy_aligned(begin(), __position,
22564 iterator(__q, 0));
22565 *__i++ = __x;
22566 this->_M_impl._M_finish = std::copy(__position, end(), __i);
22567 this->_M_deallocate();
22568 this->_M_impl._M_end_of_storage = (__q + ((__len
22569 + int(_S_word_bit) - 1)
22570 / int(_S_word_bit)));
22571 this->_M_impl._M_start = iterator(__q, 0);
22572 }
22573 }
22574 }
22575 extern "C" {
22576 union wait
22577 {
22578 int w_status;
22579 struct
22580 {
22581 unsigned int __w_termsig:7;
22582 unsigned int __w_coredump:1;
22583 unsigned int __w_retcode:8;
22584 unsigned int:16;
22585 } __wait_terminated;
22586 struct
22587 {
22588 unsigned int __w_stopval:8;
22589 unsigned int __w_stopsig:8;
22590 unsigned int:16;
22591 } __wait_stopped;
22592 };
22593 typedef struct
22594 {
22595 int quot;
22596 int rem;
22597 } div_t;
22598 typedef struct
22599 {
22600 long int quot;
22601 long int rem;
22602 } ldiv_t;
22603 __extension__ typedef struct
22604 {
22605 long long int quot;
22606 long long int rem;
22607 } lldiv_t;
22608 extern double atof (__const char *__nptr)
22609 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
22610 extern int atoi (__const char *__nptr)
22611 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
22612 extern long int atol (__const char *__nptr)
22613 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
22614 __extension__ extern long long int atoll (__const char *__nptr)
22615 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
22616 extern double strtod (__const char *__restrict __nptr,
22617 char **__restrict __endptr)
22618 throw () __attribute__ ((__nonnull__ (1))) ;
22619 extern float strtof (__const char *__restrict __nptr,
22620 char **__restrict __endptr) throw () __attribute__ ((__nonnull__ (1))) ;
22621 extern long double strtold (__const char *__restrict __nptr,
22622 char **__restrict __endptr)
22623 throw () __attribute__ ((__nonnull__ (1))) ;
22624 extern long int strtol (__const char *__restrict __nptr,
22625 char **__restrict __endptr, int __base)
22626 throw () __attribute__ ((__nonnull__ (1))) ;
22627 extern unsigned long int strtoul (__const char *__restrict __nptr,
22628 char **__restrict __endptr, int __base)
22629 throw () __attribute__ ((__nonnull__ (1))) ;
22630 __extension__
22631 extern long long int strtoq (__const char *__restrict __nptr,
22632 char **__restrict __endptr, int __base)
22633 throw () __attribute__ ((__nonnull__ (1))) ;
22634 __extension__
22635 extern unsigned long long int strtouq (__const char *__restrict __nptr,
22636 char **__restrict __endptr, int __base)
22637 throw () __attribute__ ((__nonnull__ (1))) ;
22638 __extension__
22639 extern long long int strtoll (__const char *__restrict __nptr,
22640 char **__restrict __endptr, int __base)
22641 throw () __attribute__ ((__nonnull__ (1))) ;
22642 __extension__
22643 extern unsigned long long int strtoull (__const char *__restrict __nptr,
22644 char **__restrict __endptr, int __base)
22645 throw () __attribute__ ((__nonnull__ (1))) ;
22646 extern char *l64a (long int __n) throw () ;
22647 extern long int a64l (__const char *__s)
22648 throw () __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
22649 extern "C" {
22650 typedef __u_char u_char;
22651 typedef __u_short u_short;
22652 typedef __u_int u_int;
22653 typedef __u_long u_long;
22654 typedef __quad_t quad_t;
22655 typedef __u_quad_t u_quad_t;
22656 typedef __fsid_t fsid_t;
22657 typedef __loff_t loff_t;
22658 typedef __ino_t ino_t;
22659 typedef __ino64_t ino64_t;
22660 typedef __dev_t dev_t;
22661 typedef __mode_t mode_t;
22662 typedef __nlink_t nlink_t;
22663 typedef __id_t id_t;
22664 typedef __daddr_t daddr_t;
22665 typedef __caddr_t caddr_t;
22666 typedef __key_t key_t;
22667 typedef __suseconds_t suseconds_t;
22668 typedef unsigned long int ulong;
22669 typedef unsigned short int ushort;
22670 typedef unsigned int uint;
22671 typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
22672 typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
22673 typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
22674 typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
22675 typedef int register_t __attribute__ ((__mode__ (__word__)));
22676 struct timeval
22677 {
22678 __time_t tv_sec;
22679 __suseconds_t tv_usec;
22680 };
22681 typedef long int __fd_mask;
22682 typedef struct
22683 {
22684 __fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))];
22685 } fd_set;
22686 typedef __fd_mask fd_mask;
22687 extern "C" {
22688 extern int select (int __nfds, fd_set *__restrict __readfds,
22689 fd_set *__restrict __writefds,
22690 fd_set *__restrict __exceptfds,
22691 struct timeval *__restrict __timeout);
22692 extern int pselect (int __nfds, fd_set *__restrict __readfds,
22693 fd_set *__restrict __writefds,
22694 fd_set *__restrict __exceptfds,
22695 const struct timespec *__restrict __timeout,
22696 const __sigset_t *__restrict __sigmask);
22697 }
22698 __extension__
22699 static __inline unsigned int gnu_dev_major (unsigned long long int __dev)
22700 throw ();
22701 __extension__
22702 static __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
22703 throw ();
22704 __extension__
22705 static __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
22706 unsigned int __minor)
22707 throw ();
22708 __extension__ static __inline unsigned int
22709 gnu_dev_major (unsigned long long int __dev) throw ()
22710 {
22711 return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
22712 }
22713 __extension__ static __inline unsigned int
22714 gnu_dev_minor (unsigned long long int __dev) throw ()
22715 {
22716 return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
22717 }
22718 __extension__ static __inline unsigned long long int
22719 gnu_dev_makedev (unsigned int __major, unsigned int __minor) throw ()
22720 {
22721 return ((__minor & 0xff) | ((__major & 0xfff) << 8)
22722 | (((unsigned long long int) (__minor & ~0xff)) << 12)
22723 | (((unsigned long long int) (__major & ~0xfff)) << 32));
22724 }
22725 typedef __blksize_t blksize_t;
22726 typedef __blkcnt_t blkcnt_t;
22727 typedef __fsblkcnt_t fsblkcnt_t;
22728 typedef __fsfilcnt_t fsfilcnt_t;
22729 typedef __blkcnt64_t blkcnt64_t;
22730 typedef __fsblkcnt64_t fsblkcnt64_t;
22731 typedef __fsfilcnt64_t fsfilcnt64_t;
22732 }
22733 extern long int random (void) throw ();
22734 extern void srandom (unsigned int __seed) throw ();
22735 extern char *initstate (unsigned int __seed, char *__statebuf,
22736 size_t __statelen) throw () __attribute__ ((__nonnull__ (2)));
22737 extern char *setstate (char *__statebuf) throw () __attribute__ ((__nonnull__ (1)));
22738 struct random_data
22739 {
22740 int32_t *fptr;
22741 int32_t *rptr;
22742 int32_t *state;
22743 int rand_type;
22744 int rand_deg;
22745 int rand_sep;
22746 int32_t *end_ptr;
22747 };
22748 extern int random_r (struct random_data *__restrict __buf,
22749 int32_t *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2)));
22750 extern int srandom_r (unsigned int __seed, struct random_data *__buf)
22751 throw () __attribute__ ((__nonnull__ (2)));
22752 extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
22753 size_t __statelen,
22754 struct random_data *__restrict __buf)
22755 throw () __attribute__ ((__nonnull__ (2, 4)));
22756 extern int setstate_r (char *__restrict __statebuf,
22757 struct random_data *__restrict __buf)
22758 throw () __attribute__ ((__nonnull__ (1, 2)));
22759 extern int rand (void) throw ();
22760 extern void srand (unsigned int __seed) throw ();
22761 extern int rand_r (unsigned int *__seed) throw ();
22762 extern double drand48 (void) throw ();
22763 extern double erand48 (unsigned short int __xsubi[3]) throw () __attribute__ ((__nonnull__ (1)));
22764 extern long int lrand48 (void) throw ();
22765 extern long int nrand48 (unsigned short int __xsubi[3])
22766 throw () __attribute__ ((__nonnull__ (1)));
22767 extern long int mrand48 (void) throw ();
22768 extern long int jrand48 (unsigned short int __xsubi[3])
22769 throw () __attribute__ ((__nonnull__ (1)));
22770 extern void srand48 (long int __seedval) throw ();
22771 extern unsigned short int *seed48 (unsigned short int __seed16v[3])
22772 throw () __attribute__ ((__nonnull__ (1)));
22773 extern void lcong48 (unsigned short int __param[7]) throw () __attribute__ ((__nonnull__ (1)));
22774 struct drand48_data
22775 {
22776 unsigned short int __x[3];
22777 unsigned short int __old_x[3];
22778 unsigned short int __c;
22779 unsigned short int __init;
22780 unsigned long long int __a;
22781 };
22782 extern int drand48_r (struct drand48_data *__restrict __buffer,
22783 double *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2)));
22784 extern int erand48_r (unsigned short int __xsubi[3],
22785 struct drand48_data *__restrict __buffer,
22786 double *__restrict __result) throw () __attribute__ ((__nonnull__ (1, 2)));
22787 extern int lrand48_r (struct drand48_data *__restrict __buffer,
22788 long int *__restrict __result)
22789 throw () __attribute__ ((__nonnull__ (1, 2)));
22790 extern int nrand48_r (unsigned short int __xsubi[3],
22791 struct drand48_data *__restrict __buffer,
22792 long int *__restrict __result)
22793 throw () __attribute__ ((__nonnull__ (1, 2)));
22794 extern int mrand48_r (struct drand48_data *__restrict __buffer,
22795 long int *__restrict __result)
22796 throw () __attribute__ ((__nonnull__ (1, 2)));
22797 extern int jrand48_r (unsigned short int __xsubi[3],
22798 struct drand48_data *__restrict __buffer,
22799 long int *__restrict __result)
22800 throw () __attribute__ ((__nonnull__ (1, 2)));
22801 extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
22802 throw () __attribute__ ((__nonnull__ (2)));
22803 extern int seed48_r (unsigned short int __seed16v[3],
22804 struct drand48_data *__buffer) throw () __attribute__ ((__nonnull__ (1, 2)));
22805 extern int lcong48_r (unsigned short int __param[7],
22806 struct drand48_data *__buffer)
22807 throw () __attribute__ ((__nonnull__ (1, 2)));
22808 extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__)) ;
22809 extern void *calloc (size_t __nmemb, size_t __size)
22810 throw () __attribute__ ((__malloc__)) ;
22811 extern void *realloc (void *__ptr, size_t __size)
22812 throw () __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
22813 extern void free (void *__ptr) throw ();
22814 extern void cfree (void *__ptr) throw ();
22815 extern "C" {
22816 extern void *alloca (size_t __size) throw ();
22817 }
22818 extern void *valloc (size_t __size) throw () __attribute__ ((__malloc__)) ;
22819 extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
22820 throw () __attribute__ ((__nonnull__ (1))) ;
22821 extern void abort (void) throw () __attribute__ ((__noreturn__));
22822 extern int atexit (void (*__func) (void)) throw () __attribute__ ((__nonnull__ (1)));
22823 extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
22824 throw () __attribute__ ((__nonnull__ (1)));
22825 extern void exit (int __status) throw () __attribute__ ((__noreturn__));
22826 extern void _Exit (int __status) throw () __attribute__ ((__noreturn__));
22827 extern char *getenv (__const char *__name) throw () __attribute__ ((__nonnull__ (1))) ;
22828 extern char *__secure_getenv (__const char *__name)
22829 throw () __attribute__ ((__nonnull__ (1))) ;
22830 extern int putenv (char *__string) throw () __attribute__ ((__nonnull__ (1)));
22831 extern int setenv (__const char *__name, __const char *__value, int __replace)
22832 throw () __attribute__ ((__nonnull__ (2)));
22833 extern int unsetenv (__const char *__name) throw ();
22834 extern int clearenv (void) throw ();
22835 extern char *mktemp (char *__template) throw () __attribute__ ((__nonnull__ (1))) ;
22836 extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
22837 extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) ;
22838 extern char *mkdtemp (char *__template) throw () __attribute__ ((__nonnull__ (1))) ;
22839 extern int system (__const char *__command) ;
22840 extern char *realpath (__const char *__restrict __name,
22841 char *__restrict __resolved) throw () __attribute__ ((__nonnull__ (2)));
22842 typedef int (*__compar_fn_t) (__const void *, __const void *);
22843 typedef __compar_fn_t comparison_fn_t;
22844 extern void *bsearch (__const void *__key, __const void *__base,
22845 size_t __nmemb, size_t __size, __compar_fn_t __compar)
22846 __attribute__ ((__nonnull__ (1, 2, 5))) ;
22847 extern void qsort (void *__base, size_t __nmemb, size_t __size,
22848 __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
22849 extern int abs (int __x) throw () __attribute__ ((__const__)) ;
22850 extern long int labs (long int __x) throw () __attribute__ ((__const__)) ;
22851 __extension__ extern long long int llabs (long long int __x)
22852 throw () __attribute__ ((__const__)) ;
22853 extern div_t div (int __numer, int __denom)
22854 throw () __attribute__ ((__const__)) ;
22855 extern ldiv_t ldiv (long int __numer, long int __denom)
22856 throw () __attribute__ ((__const__)) ;
22857 __extension__ extern lldiv_t lldiv (long long int __numer,
22858 long long int __denom)
22859 throw () __attribute__ ((__const__)) ;
22860 extern char *gcvt (double __value, int __ndigit, char *__buf)
22861 throw () __attribute__ ((__nonnull__ (3))) ;
22862 extern int rpmatch (__const char *__response) throw () __attribute__ ((__nonnull__ (1))) ;
22863 extern int getsubopt (char **__restrict __optionp,
22864 char *__const *__restrict __tokens,
22865 char **__restrict __valuep)
22866 throw () __attribute__ ((__nonnull__ (1, 2, 3))) ;
22867 extern void setkey (__const char *__key) throw () __attribute__ ((__nonnull__ (1)));
22868 extern int posix_openpt (int __oflag) ;
22869 extern int grantpt (int __fd) throw ();
22870 extern int unlockpt (int __fd) throw ();
22871 extern char *ptsname (int __fd) throw () ;
22872 extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
22873 throw () __attribute__ ((__nonnull__ (2)));
22874 }
22875 typedef QtValidLicenseForCoreModule QtCoreModule;
22876 struct __attribute__((visibility("default"))) QVectorData
22877 {
22878 QBasicAtomicInt ref;
22879 int alloc;
22880 int size;
22881 uint sharable : 1;
22882 uint capacity : 1;
22883 static QVectorData shared_null;
22884 static QVectorData *malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init);
22885 static int grow(int sizeofTypedData, int size, int sizeofT, bool excessive);
22886 };
22887 template <typename T>
22888 struct QVectorTypedData
22889 {
22890 QBasicAtomicInt ref;
22891 int alloc;
22892 int size;
22893 uint sharable : 1;
22894 uint capacity : 1;
22895 T array[1];
22896 };
22897 class QRegion;
22898 template <typename T>
22899 class QVector
22900 {
22901 typedef QVectorTypedData<T> Data;
22902 union { QVectorData *p; QVectorTypedData<T> *d; };
22903 public:
22904 inline QVector() : p(&QVectorData::shared_null) { d->ref.ref(); }
22905 explicit QVector(int size);
22906 QVector(int size, const T &t);
22907 inline QVector(const QVector<T> &v) : d(v.d) { d->ref.ref(); if (!d->sharable) detach_helper(); }
22908 inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(d); }
22909 QVector<T> &operator=(const QVector<T> &v);
22910 bool operator==(const QVector<T> &v) const;
22911 inline bool operator!=(const QVector<T> &v) const { return !(*this == v); }
22912 inline int size() const { return d->size; }
22913 inline bool isEmpty() const { return d->size == 0; }
22914 void resize(int size);
22915 inline int capacity() const { return d->alloc; }
22916 void reserve(int size);
22917 inline void squeeze() { realloc(d->size, d->size); d->capacity = 0; }
22918 inline void detach() { if (d->ref != 1) detach_helper(); }
22919 inline bool isDetached() const { return d->ref == 1; }
22920 inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
22921 inline T *data() { detach(); return d->array; }
22922 inline const T *data() const { return d->array; }
22923 inline const T *constData() const { return d->array; }
22924 void clear();
22925 const T &at(int i) const;
22926 T &operator[](int i);
22927 const T &operator[](int i) const;
22928 void append(const T &t);
22929 void prepend(const T &t);
22930 void insert(int i, const T &t);
22931 void insert(int i, int n, const T &t);
22932 void replace(int i, const T &t);
22933 void remove(int i);
22934 void remove(int i, int n);
22935 QVector<T> &fill(const T &t, int size = -1);
22936 int indexOf(const T &t, int from = 0) const;
22937 int lastIndexOf(const T &t, int from = -1) const;
22938 bool contains(const T &t) const;
22939 int count(const T &t) const;
22940 typedef T* iterator;
22941 typedef const T* const_iterator;
22942 inline iterator begin() { detach(); return d->array; }
22943 inline const_iterator begin() const { return d->array; }
22944 inline const_iterator constBegin() const { return d->array; }
22945 inline iterator end() { detach(); return d->array + d->size; }
22946 inline const_iterator end() const { return d->array + d->size; }
22947 inline const_iterator constEnd() const { return d->array + d->size; }
22948 iterator insert(iterator before, int n, const T &x);
22949 inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); }
22950 iterator erase(iterator begin, iterator end);
22951 inline iterator erase(iterator pos) { return erase(pos, pos+1); }
22952 inline int count() const { return d->size; }
22953 inline T& first() { qt_noop(); return *begin(); }
22954 inline const T &first() const { qt_noop(); return *begin(); }
22955 inline T& last() { qt_noop(); return *(end()-1); }
22956 inline const T &last() const { qt_noop(); return *(end()-1); }
22957 inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
22958 inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
22959 QVector<T> mid(int pos, int length = -1) const;
22960 T value(int i) const;
22961 T value(int i, const T &defaultValue) const;
22962 typedef T value_type;
22963 typedef value_type* pointer;
22964 typedef const value_type* const_pointer;
22965 typedef value_type& reference;
22966 typedef const value_type& const_reference;
22967 typedef ptrdiff_t difference_type;
22968 typedef iterator Iterator;
22969 typedef const_iterator ConstIterator;
22970 typedef int size_type;
22971 inline void push_back(const T &t) { append(t); }
22972 inline void push_front(const T &t) { prepend(t); }
22973 void pop_back() { qt_noop(); erase(end()-1); }
22974 void pop_front() { qt_noop(); erase(begin()); }
22975 inline bool empty() const
22976 { return d->size == 0; }
22977 inline T& front() { return first(); }
22978 inline const_reference front() const { return first(); }
22979 inline reference back() { return last(); }
22980 inline const_reference back() const { return last(); }
22981 QVector<T> &operator+=(const QVector<T> &l);
22982 inline QVector<T> operator+(const QVector<T> &l) const
22983 { QVector n = *this; n += l; return n; }
22984 inline QVector<T> &operator+=(const T &t)
22985 { append(t); return *this; }
22986 inline QVector<T> &operator<< (const T &t)
22987 { append(t); return *this; }
22988 inline QVector<T> &operator<<(const QVector<T> &l)
22989 { *this += l; return *this; }
22990 QList<T> toList() const;
22991 static QVector<T> fromList(const QList<T> &list);
22992 static inline QVector<T> fromStdVector(const std::vector<T> &vector)
22993 { QVector<T> tmp; qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
22994 inline std::vector<T> toStdVector() const
22995 { std::vector<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
22996 private:
22997 friend class QRegion;
22998 void detach_helper();
22999 QVectorData *malloc(int alloc);
23000 void realloc(int size, int alloc);
23001 void free(Data *d);
23002 int sizeOfTypedData() {
23003 return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this);
23004 }
23005 };
23006 template <typename T>
23007 void QVector<T>::detach_helper()
23008 { realloc(d->size, d->alloc); }
23009 template <typename T>
23010 void QVector<T>::reserve(int asize)
23011 { if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; }
23012 template <typename T>
23013 void QVector<T>::resize(int asize)
23014 { realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ?
23015 QVectorData::grow(sizeOfTypedData(), asize, sizeof(T), QTypeInfo<T>::isStatic)
23016 : d->alloc); }
23017 template <typename T>
23018 inline void QVector<T>::clear()
23019 { *this = QVector<T>(); }
23020 template <typename T>
23021 inline const T &QVector<T>::at(int i) const
23022 { qt_noop();
23023 return d->array[i]; }
23024 template <typename T>
23025 inline const T &QVector<T>::operator[](int i) const
23026 { qt_noop();
23027 return d->array[i]; }
23028 template <typename T>
23029 inline T &QVector<T>::operator[](int i)
23030 { qt_noop();
23031 return data()[i]; }
23032 template <typename T>
23033 inline void QVector<T>::insert(int i, const T &t)
23034 { qt_noop();
23035 insert(begin() + i, 1, t); }
23036 template <typename T>
23037 inline void QVector<T>::insert(int i, int n, const T &t)
23038 { qt_noop();
23039 insert(begin() + i, n, t); }
23040 template <typename T>
23041 inline void QVector<T>::remove(int i, int n)
23042 { qt_noop();
23043 erase(begin() + i, begin() + i + n); }
23044 template <typename T>
23045 inline void QVector<T>::remove(int i)
23046 { qt_noop();
23047 erase(begin() + i, begin() + i + 1); }
23048 template <typename T>
23049 inline void QVector<T>::prepend(const T &t)
23050 { insert(begin(), 1, t); }
23051 template <typename T>
23052 inline void QVector<T>::replace(int i, const T &t)
23053 {
23054 qt_noop();
23055 const T copy(t);
23056 data()[i] = copy;
23057 }
23058 template <typename T>
23059 QVector<T> &QVector<T>::operator=(const QVector<T> &v)
23060 {
23061 v.d->ref.ref();
23062 if (!d->ref.deref())
23063 free(d);
23064 d = v.d;
23065 if (!d->sharable)
23066 detach_helper();
23067 return *this;
23068 }
23069 template <typename T>
23070 inline QVectorData *QVector<T>::malloc(int aalloc)
23071 {
23072 return static_cast<QVectorData *>(qMalloc(sizeOfTypedData() + (aalloc - 1) * sizeof(T)));
23073 }
23074 template <typename T>
23075 QVector<T>::QVector(int asize)
23076 {
23077 p = malloc(asize);
23078 d->ref = 1;
23079 d->alloc = d->size = asize;
23080 d->sharable = true;
23081 d->capacity = false;
23082 if (QTypeInfo<T>::isComplex) {
23083 T* b = d->array;
23084 T* i = d->array + d->size;
23085 while (i != b)
23086 new (--i) T;
23087 } else {
23088 qMemSet(d->array, 0, asize * sizeof(T));
23089 }
23090 }
23091 template <typename T>
23092 QVector<T>::QVector(int asize, const T &t)
23093 {
23094 p = malloc(asize);
23095 d->ref = 1;
23096 d->alloc = d->size = asize;
23097 d->sharable = true;
23098 d->capacity = false;
23099 T* i = d->array + d->size;
23100 while (i != d->array)
23101 new (--i) T(t);
23102 }
23103 template <typename T>
23104 void QVector<T>::free(Data *x)
23105 {
23106 if (QTypeInfo<T>::isComplex) {
23107 T* b = x->array;
23108 T* i = b + x->size;
23109 while (i-- != b)
23110 i->~T();
23111 }
23112 qFree(x);
23113 }
23114 template <typename T>
23115 void QVector<T>::realloc(int asize, int aalloc)
23116 {
23117 T *j, *i, *b;
23118 union { QVectorData *p; Data *d; } x;
23119 x.d = d;
23120 if (QTypeInfo<T>::isComplex && aalloc == d->alloc && d->ref == 1) {
23121 i = d->array + d->size;
23122 j = d->array + asize;
23123 if (i > j) {
23124 while (i-- != j)
23125 i->~T();
23126 } else {
23127 while (j-- != i)
23128 new (j) T;
23129 }
23130 d->size = asize;
23131 return;
23132 }
23133 if (aalloc != d->alloc || d->ref != 1) {
23134 if (QTypeInfo<T>::isStatic) {
23135 x.p = malloc(aalloc);
23136 } else if (d->ref != 1) {
23137 x.p = QVectorData::malloc(sizeOfTypedData(), aalloc, sizeof(T), p);
23138 } else {
23139 if (QTypeInfo<T>::isComplex) {
23140 if (asize < d->size) {
23141 j = d->array + asize;
23142 i = d->array + d->size;
23143 while (i-- != j)
23144 i->~T();
23145 i = d->array + asize;
23146 }
23147 }
23148 x.p = p = static_cast<QVectorData *>(qRealloc(p, sizeOfTypedData() + (aalloc - 1) * sizeof(T)));
23149 }
23150 x.d->ref = 1;
23151 x.d->sharable = true;
23152 x.d->capacity = d->capacity;
23153 }
23154 if (QTypeInfo<T>::isComplex) {
23155 if (asize < d->size) {
23156 j = d->array + asize;
23157 i = x.d->array + asize;
23158 } else {
23159 i = x.d->array + asize;
23160 j = x.d->array + d->size;
23161 while (i != j)
23162 new (--i) T;
23163 j = d->array + d->size;
23164 }
23165 if (i != j) {
23166 b = x.d->array;
23167 while (i != b)
23168 new (--i) T(*--j);
23169 }
23170 } else if (asize > d->size) {
23171 qMemSet(x.d->array + d->size, 0, (asize - d->size) * sizeof(T));
23172 }
23173 x.d->size = asize;
23174 x.d->alloc = aalloc;
23175 if (d != x.d) {
23176 if (!d->ref.deref())
23177 free(d);
23178 d = x.d;
23179 }
23180 }
23181 template<typename T>
23182 T QVector<T>::value(int i) const
23183 {
23184 if (i < 0 || i >= p->size) {
23185 return T();
23186 }
23187 return d->array[i];
23188 }
23189 template<typename T>
23190 T QVector<T>::value(int i, const T &defaultValue) const
23191 {
23192 return ((i < 0 || i >= p->size) ? defaultValue : d->array[i]);
23193 }
23194 template <typename T>
23195 void QVector<T>::append(const T &t)
23196 {
23197 if (d->ref != 1 || d->size + 1 > d->alloc) {
23198 const T copy(t);
23199 realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T),
23200 QTypeInfo<T>::isStatic));
23201 if (QTypeInfo<T>::isComplex)
23202 new (d->array + d->size) T(copy);
23203 else
23204 d->array[d->size] = copy;
23205 } else {
23206 if (QTypeInfo<T>::isComplex)
23207 new (d->array + d->size) T(t);
23208 else
23209 d->array[d->size] = t;
23210 }
23211 ++d->size;
23212 }
23213 template <typename T>
23214 typename QVector<T>::iterator QVector<T>::insert(iterator before, size_type n, const T &t)
23215 {
23216 int offset = before - d->array;
23217 if (n != 0) {
23218 const T copy(t);
23219 if (d->ref != 1 || d->size + n > d->alloc)
23220 realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + n, sizeof(T),
23221 QTypeInfo<T>::isStatic));
23222 if (QTypeInfo<T>::isStatic) {
23223 T *b = d->array + d->size;
23224 T *i = d->array + d->size + n;
23225 while (i != b)
23226 new (--i) T;
23227 i = d->array + d->size;
23228 T *j = i + n;
23229 b = d->array + offset;
23230 while (i != b)
23231 *--j = *--i;
23232 i = b+n;
23233 while (i != b)
23234 *--i = copy;
23235 } else {
23236 T *b = d->array + offset;
23237 T *i = b + n;
23238 memmove(i, b, (d->size - offset) * sizeof(T));
23239 while (i != b)
23240 new (--i) T(copy);
23241 }
23242 d->size += n;
23243 }
23244 return d->array + offset;
23245 }
23246 template <typename T>
23247 typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
23248 {
23249 int f = abegin - d->array;
23250 int l = aend - d->array;
23251 int n = l - f;
23252 detach();
23253 if (QTypeInfo<T>::isComplex) {
23254 qCopy(d->array+l, d->array+d->size, d->array+f);
23255 T *i = d->array+d->size;
23256 T* b = d->array+d->size-n;
23257 while (i != b) {
23258 --i;
23259 i->~T();
23260 }
23261 } else {
23262 memmove(d->array + f, d->array + l, (d->size-l)*sizeof(T));
23263 }
23264 d->size -= n;
23265 return d->array + f;
23266 }
23267 template <typename T>
23268 bool QVector<T>::operator==(const QVector<T> &v) const
23269 {
23270 if (d->size != v.d->size)
23271 return false;
23272 if (d == v.d)
23273 return true;
23274 T* b = d->array;
23275 T* i = b + d->size;
23276 T* j = v.d->array + d->size;
23277 while (i != b)
23278 if (!(*--i == *--j))
23279 return false;
23280 return true;
23281 }
23282 template <typename T>
23283 QVector<T> &QVector<T>::fill(const T &from, int asize)
23284 {
23285 const T copy(from);
23286 resize(asize < 0 ? d->size : asize);
23287 if (d->size) {
23288 T *i = d->array + d->size;
23289 T *b = d->array;
23290 while (i != b)
23291 *--i = copy;
23292 }
23293 return *this;
23294 }
23295 template <typename T>
23296 QVector<T> &QVector<T>::operator+=(const QVector &l)
23297 {
23298 int newSize = d->size + l.d->size;
23299 realloc(d->size, newSize);
23300 T *w = d->array + newSize;
23301 T *i = l.d->array + l.d->size;
23302 T *b = l.d->array;
23303 while (i != b) {
23304 if (QTypeInfo<T>::isComplex)
23305 new (--w) T(*--i);
23306 else
23307 *--w = *--i;
23308 }
23309 d->size = newSize;
23310 return *this;
23311 }
23312 template <typename T>
23313 int QVector<T>::indexOf(const T &t, int from) const
23314 {
23315 if (from < 0)
23316 from = qMax(from + d->size, 0);
23317 if (from < d->size) {
23318 T* n = d->array + from - 1;
23319 T* e = d->array + d->size;
23320 while (++n != e)
23321 if (*n == t)
23322 return n - d->array;
23323 }
23324 return -1;
23325 }
23326 template <typename T>
23327 int QVector<T>::lastIndexOf(const T &t, int from) const
23328 {
23329 if (from < 0)
23330 from += d->size;
23331 else if (from >= d->size)
23332 from = d->size-1;
23333 if (from >= 0) {
23334 T* b = d->array;
23335 T* n = d->array + from + 1;
23336 while (n != b) {
23337 if (*--n == t)
23338 return n - b;
23339 }
23340 }
23341 return -1;
23342 }
23343 template <typename T>
23344 bool QVector<T>::contains(const T &t) const
23345 {
23346 T* b = d->array;
23347 T* i = d->array + d->size;
23348 while (i != b)
23349 if (*--i == t)
23350 return true;
23351 return false;
23352 }
23353 template <typename T>
23354 int QVector<T>::count(const T &t) const
23355 {
23356 int c = 0;
23357 T* b = d->array;
23358 T* i = d->array + d->size;
23359 while (i != b)
23360 if (*--i == t)
23361 ++c;
23362 return c;
23363 }
23364 template <typename T>
23365 QVector<T> QVector<T>::mid(int pos, int length) const
23366 {
23367 if (length < 0)
23368 length = size() - pos;
23369 if (pos == 0 && length == size())
23370 return *this;
23371 QVector<T> copy;
23372 if (pos + length > size())
23373 length = size() - pos;
23374 for (int i = pos; i < pos + length; ++i)
23375 copy += at(i);
23376 return copy;
23377 }
23378 template <typename T>
23379 QList<T> QVector<T>::toList() const
23380 {
23381 QList<T> result;
23382 for (int i = 0; i < size(); ++i)
23383 result.append(at(i));
23384 return result;
23385 }
23386 template <typename T>
23387 QVector<T> QList<T>::toVector() const
23388 {
23389 QVector<T> result(size());
23390 for (int i = 0; i < size(); ++i)
23391 result[i] = at(i);
23392 return result;
23393 }
23394 template <typename T>
23395 QVector<T> QVector<T>::fromList(const QList<T> &list)
23396 {
23397 return list.toVector();
23398 }
23399 template <typename T>
23400 QList<T> QList<T>::fromVector(const QVector<T> &vector)
23401 {
23402 return vector.toList();
23403 }
23404 template <class T> class QVectorIterator { typedef typename QVector<T>::const_iterator const_iterator; QVector<T> c; const_iterator i; public: inline QVectorIterator(const QVector<T> &container) : c(container), i(c.constBegin()) {} inline QVectorIterator &operator=(const QVector<T> &container) { c = container; i = c.constBegin(); return *this; } inline void toFront() { i = c.constBegin(); } inline void toBack() { i = c.constEnd(); } inline bool hasNext() const { return i != c.constEnd(); } inline const T &next() { return *i++; } inline const T &peekNext() const { return *i; } inline bool hasPrevious() const { return i != c.constBegin(); } inline const T &previous() { return *--i; } inline const T &peekPrevious() const { const_iterator p = i; return *--p; } inline bool findNext(const T &t) { while (i != c.constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (i != c.constBegin()) if (*(--i) == t) return true; return false; } };
23405 template <class T> class QMutableVectorIterator { typedef typename QVector<T>::iterator iterator; typedef typename QVector<T>::const_iterator const_iterator; QVector<T> *c; iterator i, n; inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } public: inline QMutableVectorIterator(QVector<T> &container) : c(&container) { c->setSharable(false); i = c->begin(); n = c->end(); } inline ~QMutableVectorIterator() { c->setSharable(true); } inline QMutableVectorIterator &operator=(QVector<T> &container) { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } inline void toFront() { i = c->begin(); n = c->end(); } inline void toBack() { i = c->end(); n = i; } inline bool hasNext() const { return c->constEnd() != const_iterator(i); } inline T &next() { n = i++; return *n; } inline T &peekNext() const { return *i; } inline bool hasPrevious() const { return c->constBegin() != const_iterator(i); } inline T &previous() { n = --i; return *n; } inline T &peekPrevious() const { iterator p = i; return *--p; } inline void remove() { if (c->constEnd() != const_iterator(n)) { i = c->erase(n); n = c->end(); } } inline void setValue(const T &t) const { if (c->constEnd() != const_iterator(n)) *n = t; } inline T &value() { qt_noop(); return *n; } inline const T &value() const { qt_noop(); return *n; } inline void insert(const T &t) { n = i = c->insert(i, t); ++i; } inline bool findNext(const T &t) { while (c->constEnd() != const_iterator(n = i)) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (c->constBegin() != const_iterator(i)) if (*(n = --i) == t) return true; n = c->end(); return false; } };
23406 typedef QtValidLicenseForCoreModule QtCoreModule;
23407 template <class T>
23408 class QSet
23409 {
23410 typedef QHash<T, QHashDummyValue> Hash;
23411 public:
23412 inline QSet() {}
23413 inline QSet(const QSet<T> &other) : q_hash(other.q_hash) {}
23414 inline QSet<T> &operator=(const QSet<T> &other)
23415 { q_hash = other.q_hash; return *this; }
23416 inline bool operator==(const QSet<T> &other) const
23417 { return q_hash == other.q_hash; }
23418 inline bool operator!=(const QSet<T> &other) const
23419 { return q_hash != other.q_hash; }
23420 inline int size() const { return q_hash.size(); }
23421 inline bool isEmpty() const { return q_hash.isEmpty(); }
23422 inline int capacity() const { return q_hash.capacity(); }
23423 inline void reserve(int size);
23424 inline void squeeze() { q_hash.squeeze(); }
23425 inline void detach() { q_hash.detach(); }
23426 inline bool isDetached() const { return q_hash.isDetached(); }
23427 inline void setSharable(bool sharable) { q_hash.setSharable(sharable); }
23428 inline void clear() { q_hash.clear(); }
23429 inline bool remove(const T &value) { return q_hash.remove(value) != 0; }
23430 inline bool contains(const T &value) const { return q_hash.contains(value); }
23431 class const_iterator;
23432 class iterator
23433 {
23434 typedef QHash<T, QHashDummyValue> Hash;
23435 typename Hash::iterator i;
23436 friend class const_iterator;
23437 public:
23438 typedef std::bidirectional_iterator_tag iterator_category;
23439 typedef ptrdiff_t difference_type;
23440 typedef T value_type;
23441 typedef const T *pointer;
23442 typedef const T &reference;
23443 inline iterator() {}
23444 inline iterator(typename Hash::iterator o) : i(o) {}
23445 inline iterator(const iterator &o) : i(o.i) {}
23446 inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
23447 inline const T &operator*() const { return i.key(); }
23448 inline const T *operator->() const { return &i.key(); }
23449 inline bool operator==(const iterator &o) const { return i == o.i; }
23450 inline bool operator!=(const iterator &o) const { return i != o.i; }
23451 inline bool operator==(const const_iterator &o) const
23452 { return i == o.i; }
23453 inline bool operator!=(const const_iterator &o) const
23454 { return i != o.i; }
23455 inline iterator &operator++() { ++i; return *this; }
23456 inline iterator operator++(int) { iterator r = *this; ++i; return r; }
23457 inline iterator &operator--() { --i; return *this; }
23458 inline iterator operator--(int) { iterator r = *this; --i; return r; }
23459 inline iterator operator+(int j) const { return i + j; }
23460 inline iterator operator-(int j) const { return i - j; }
23461 inline iterator &operator+=(int j) { i += j; return *this; }
23462 inline iterator &operator-=(int j) { i -= j; return *this; }
23463 };
23464 class const_iterator
23465 {
23466 typedef QHash<T, QHashDummyValue> Hash;
23467 typename Hash::const_iterator i;
23468 friend class iterator;
23469 public:
23470 typedef std::bidirectional_iterator_tag iterator_category;
23471 typedef ptrdiff_t difference_type;
23472 typedef T value_type;
23473 typedef const T *pointer;
23474 typedef const T &reference;
23475 inline const_iterator() {}
23476 inline const_iterator(typename Hash::const_iterator o) : i(o) {}
23477 inline const_iterator(const const_iterator &o) : i(o.i) {}
23478 inline const_iterator(const iterator &o)
23479 : i(o.i) {}
23480 inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
23481 inline const T &operator*() const { return i.key(); }
23482 inline const T *operator->() const { return &i.key(); }
23483 inline bool operator==(const const_iterator &o) const { return i == o.i; }
23484 inline bool operator!=(const const_iterator &o) const { return i != o.i; }
23485 inline const_iterator &operator++() { ++i; return *this; }
23486 inline const_iterator operator++(int) { const_iterator r = *this; ++i; return r; }
23487 inline const_iterator &operator--() { --i; return *this; }
23488 inline const_iterator operator--(int) { const_iterator r = *this; --i; return r; }
23489 inline const_iterator operator+(int j) const { return i + j; }
23490 inline const_iterator operator-(int j) const { return i - j; }
23491 inline const_iterator &operator+=(int j) { i += j; return *this; }
23492 inline const_iterator &operator-=(int j) { i -= j; return *this; }
23493 };
23494 inline iterator begin() { return q_hash.begin(); }
23495 inline const_iterator begin() const { return q_hash.begin(); }
23496 inline const_iterator constBegin() const { return q_hash.constBegin(); }
23497 inline iterator end() { return q_hash.end(); }
23498 inline const_iterator end() const { return q_hash.end(); }
23499 inline const_iterator constEnd() const { return q_hash.constEnd(); }
23500 iterator erase(iterator i)
23501 { return q_hash.erase(reinterpret_cast<typename Hash::iterator &>(i)); }
23502 typedef iterator Iterator;
23503 typedef const_iterator ConstIterator;
23504 inline int count() const { return q_hash.count(); }
23505 inline const_iterator insert(const T &value)
23506 { return static_cast<typename Hash::const_iterator>(q_hash.insert(value,
23507 QHashDummyValue())); }
23508 iterator find(const T &value) { return q_hash.find(value); }
23509 const_iterator find(const T &value) const { return q_hash.find(value); }
23510 inline const_iterator constFind(const T &value) const { return find(value); }
23511 QSet<T> &unite(const QSet<T> &other);
23512 QSet<T> &intersect(const QSet<T> &other);
23513 QSet<T> &subtract(const QSet<T> &other);
23514 typedef T key_type;
23515 typedef T value_type;
23516 typedef value_type *pointer;
23517 typedef const value_type *const_pointer;
23518 typedef value_type &reference;
23519 typedef const value_type &const_reference;
23520 typedef ptrdiff_t difference_type;
23521 typedef int size_type;
23522 inline bool empty() const { return isEmpty(); }
23523 inline QSet<T> &operator<<(const T &value) { insert(value); return *this; }
23524 inline QSet<T> &operator|=(const QSet<T> &other) { unite(other); return *this; }
23525 inline QSet<T> &operator|=(const T &value) { insert(value); return *this; }
23526 inline QSet<T> &operator&=(const QSet<T> &other) { intersect(other); return *this; }
23527 inline QSet<T> &operator&=(const T &value)
23528 { QSet<T> result; if (contains(value)) result.insert(value); return (*this = result); }
23529 inline QSet<T> &operator+=(const QSet<T> &other) { unite(other); return *this; }
23530 inline QSet<T> &operator+=(const T &value) { insert(value); return *this; }
23531 inline QSet<T> &operator-=(const QSet<T> &other) { subtract(other); return *this; }
23532 inline QSet<T> &operator-=(const T &value) { remove(value); return *this; }
23533 inline QSet<T> operator|(const QSet<T> &other) const
23534 { QSet<T> result = *this; result |= other; return result; }
23535 inline QSet<T> operator&(const QSet<T> &other) const
23536 { QSet<T> result = *this; result &= other; return result; }
23537 inline QSet<T> operator+(const QSet<T> &other) const
23538 { QSet<T> result = *this; result += other; return result; }
23539 inline QSet<T> operator-(const QSet<T> &other) const
23540 { QSet<T> result = *this; result -= other; return result; }
23541 inline QSet<T> operator|(const QSet<T> &other)
23542 { QSet<T> result = *this; result |= other; return result; }
23543 inline QSet<T> operator&(const QSet<T> &other)
23544 { QSet<T> result = *this; result &= other; return result; }
23545 inline QSet<T> operator+(const QSet<T> &other)
23546 { QSet<T> result = *this; result += other; return result; }
23547 inline QSet<T> operator-(const QSet<T> &other)
23548 { QSet<T> result = *this; result -= other; return result; }
23549 QList<T> toList() const;
23550 inline QList<T> values() const { return toList(); }
23551 static QSet<T> fromList(const QList<T> &list);
23552 private:
23553 Hash q_hash;
23554 };
23555 template <class T>
23556 inline void QSet<T>::reserve(int asize) { q_hash.reserve(asize); }
23557 template <class T>
23558 inline QSet<T> &QSet<T>::unite(const QSet<T> &other)
23559 {
23560 QSet<T> copy(other);
23561 typename QSet<T>::const_iterator i = copy.constEnd();
23562 while (i != copy.constBegin()) {
23563 --i;
23564 insert(*i);
23565 }
23566 return *this;
23567 }
23568 template <class T>
23569 inline QSet<T> &QSet<T>::intersect(const QSet<T> &other)
23570 {
23571 QSet<T> copy1(*this);
23572 QSet<T> copy2(other);
23573 typename QSet<T>::const_iterator i = copy1.constEnd();
23574 while (i != copy1.constBegin()) {
23575 --i;
23576 if (!copy2.contains(*i))
23577 remove(*i);
23578 }
23579 return *this;
23580 }
23581 template <class T>
23582 inline QSet<T> &QSet<T>::subtract(const QSet<T> &other)
23583 {
23584 QSet<T> copy1(*this);
23585 QSet<T> copy2(other);
23586 typename QSet<T>::const_iterator i = copy1.constEnd();
23587 while (i != copy1.constBegin()) {
23588 --i;
23589 if (copy2.contains(*i))
23590 remove(*i);
23591 }
23592 return *this;
23593 }
23594 template <typename T>
23595 QList<T> QSet<T>::toList() const
23596 {
23597 QList<T> result;
23598 typename QSet<T>::const_iterator i = constBegin();
23599 while (i != constEnd()) {
23600 result.append(*i);
23601 ++i;
23602 }
23603 return result;
23604 }
23605 template <typename T>
23606 QSet<T> QList<T>::toSet() const
23607 {
23608 QSet<T> result;
23609 result.reserve(size());
23610 for (int i = 0; i < size(); ++i)
23611 result.insert(at(i));
23612 return result;
23613 }
23614 template <typename T>
23615 QSet<T> QSet<T>::fromList(const QList<T> &list)
23616 {
23617 return list.toSet();
23618 }
23619 template <typename T>
23620 QList<T> QList<T>::fromSet(const QSet<T> &set)
23621 {
23622 return set.toList();
23623 }
23624 template <class T> class QSetIterator { typedef typename QSet<T>::const_iterator const_iterator; QSet<T> c; const_iterator i; public: inline QSetIterator(const QSet<T> &container) : c(container), i(c.constBegin()) {} inline QSetIterator &operator=(const QSet<T> &container) { c = container; i = c.constBegin(); return *this; } inline void toFront() { i = c.constBegin(); } inline void toBack() { i = c.constEnd(); } inline bool hasNext() const { return i != c.constEnd(); } inline const T &next() { return *i++; } inline const T &peekNext() const { return *i; } inline bool hasPrevious() const { return i != c.constBegin(); } inline const T &previous() { return *--i; } inline const T &peekPrevious() const { const_iterator p = i; return *--p; } inline bool findNext(const T &t) { while (i != c.constEnd()) if (*i++ == t) return true; return false; } inline bool findPrevious(const T &t) { while (i != c.constBegin()) if (*(--i) == t) return true; return false; } };
23625 template <typename T>
23626 class QMutableSetIterator
23627 {
23628 typedef typename QSet<T>::iterator iterator;
23629 QSet<T> *c;
23630 iterator i, n;
23631 inline bool item_exists() const { return n != c->constEnd(); }
23632 public:
23633 inline QMutableSetIterator(QSet<T> &container)
23634 : c(&container)
23635 { c->setSharable(false); i = c->begin(); n = c->end(); }
23636 inline ~QMutableSetIterator()
23637 { c->setSharable(true); }
23638 inline QMutableSetIterator &operator=(QSet<T> &container)
23639 { c->setSharable(true); c = &container; c->setSharable(false);
23640 i = c->begin(); n = c->end(); return *this; }
23641 inline void toFront() { i = c->begin(); n = c->end(); }
23642 inline void toBack() { i = c->end(); n = i; }
23643 inline bool hasNext() const { return c->constEnd() != i; }
23644 inline const T &next() { n = i++; return *n; }
23645 inline const T &peekNext() const { return *i; }
23646 inline bool hasPrevious() const { return c->constBegin() != i; }
23647 inline const T &previous() { n = --i; return *n; }
23648 inline const T &peekPrevious() const { iterator p = i; return *--p; }
23649 inline void remove()
23650 { if (c->constEnd() != n) { i = c->erase(n); n = c->end(); } }
23651 inline const T &value() const { qt_noop(); return *n; }
23652 inline bool findNext(const T &t)
23653 { while (c->constEnd() != (n = i)) if (*i++ == t) return true; return false; }
23654 inline bool findPrevious(const T &t)
23655 { while (c->constBegin() != i) if (*(n = --i) == t) return true;
23656 n = c->end(); return false; }
23657 };
23658 typedef QtValidLicenseForCoreModule QtCoreModule;
23659 class __attribute__((visibility("default"))) QDebug
23660 {
23661 struct Stream {
23662 Stream(QIODevice *device) : ts(device), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
23663 Stream(QString *string) : ts(string, QIODevice::WriteOnly), ref(1), type(QtDebugMsg), space(true), message_output(false) {}
23664 Stream(QtMsgType t) : ts(&buffer, QIODevice::WriteOnly), ref(1), type(t), space(true), message_output(true) {}
23665 QTextStream ts;
23666 QString buffer;
23667 int ref;
23668 QtMsgType type;
23669 bool space;
23670 bool message_output;
23671 } *stream;
23672 public:
23673 inline QDebug(QIODevice *device) : stream(new Stream(device)) {}
23674 inline QDebug(QString *string) : stream(new Stream(string)) {}
23675 inline QDebug(QtMsgType t) : stream(new Stream(t)) {}
23676 inline QDebug(const QDebug &o):stream(o.stream) { ++stream->ref; }
23677 inline QDebug &operator=(const QDebug &other);
23678 inline ~QDebug() {
23679 if (!--stream->ref) {
23680 if(stream->message_output)
23681 qt_message_output(stream->type, stream->buffer.toLocal8Bit().data());
23682 delete stream;
23683 }
23684 }
23685 inline QDebug &space() { stream->space = true; stream->ts << " "; return *this; }
23686 inline QDebug &nospace() { stream->space = false; return *this; }
23687 inline QDebug &maybeSpace() { if (stream->space) stream->ts << " "; return *this; }
23688 inline QDebug &operator<<(QChar t) { stream->ts << "\'" << t << "\'"; return maybeSpace(); }
23689 inline QDebug &operator<<(QBool t) { stream->ts << (bool(t) ? "true" : "false"); return maybeSpace(); }
23690 inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
23691 inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
23692 inline QDebug &operator<<(signed short t) { stream->ts << t; return maybeSpace(); }
23693 inline QDebug &operator<<(unsigned short t) { stream->ts << t; return maybeSpace(); }
23694 inline QDebug &operator<<(signed int t) { stream->ts << t; return maybeSpace(); }
23695 inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); }
23696 inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); }
23697 inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); }
23698 inline QDebug &operator<<(qint64 t)
23699 { stream->ts << QString::number(t); return maybeSpace(); }
23700 inline QDebug &operator<<(quint64 t)
23701 { stream->ts << QString::number(t); return maybeSpace(); }
23702 inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); }
23703 inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
23704 inline QDebug &operator<<(const char* t) { stream->ts << QString::fromAscii(t); return maybeSpace(); }
23705 inline QDebug &operator<<(const QString & t) { stream->ts << "\"" << t << "\""; return maybeSpace(); }
23706 inline QDebug &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
23707 inline QDebug &operator<<(const QLatin1String &t) { stream->ts << "\"" << t.latin1() << "\""; return maybeSpace(); }
23708 inline QDebug &operator<<(const QByteArray & t) { stream->ts << "\"" << t << "\""; return maybeSpace(); }
23709 inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); }
23710 inline QDebug &operator<<(QTextStreamFunction f) {
23711 stream->ts << f;
23712 return *this;
23713 }
23714 inline QDebug &operator<<(QTextStreamManipulator m)
23715 { stream->ts << m; return *this; }
23716 };
23717 class QNoDebug
23718 {
23719 public:
23720 inline QNoDebug(){}
23721 inline QNoDebug(const QDebug &){}
23722 inline ~QNoDebug(){}
23723 inline QNoDebug &operator<<(QTextStreamFunction) { return *this; }
23724 inline QNoDebug &operator<<(QTextStreamManipulator) { return *this; }
23725 inline QNoDebug &space() { return *this; }
23726 inline QNoDebug &nospace() { return *this; }
23727 inline QNoDebug &maybeSpace() { return *this; }
23728 template<typename T>
23729 inline QNoDebug &operator<<(const T &) { return *this; }
23730 };
23731 __attribute__((visibility("default"))) inline QDebug qCritical() { return QDebug(QtCriticalMsg); }
23732 inline QDebug &QDebug::operator=(const QDebug &other)
23733 {
23734 if (this != &other) {
23735 QDebug copy(other);
23736 qSwap(stream, copy.stream);
23737 }
23738 return *this;
23739 }
23740 template <class T>
23741 inline QDebug operator<<(QDebug debug, const QList<T> &list)
23742 {
23743 debug.nospace() << "(";
23744 for (typename QList<T>::size_type i = 0; i < list.count(); ++i) {
23745 if (i)
23746 debug << ", ";
23747 debug << list.at(i);
23748 }
23749 debug << ")";
23750 return debug.space();
23751 }
23752 template <typename T>
23753 inline QDebug operator<<(QDebug debug, const QVector<T> &vec)
23754 {
23755 debug.nospace() << "QVector";
23756 return operator<<(debug, vec.toList());
23757 }
23758 template <class aKey, class aT>
23759 inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
23760 {
23761 debug.nospace() << "QMap(";
23762 for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
23763 it != map.constEnd(); ++it) {
23764 debug << "(" << it.key() << ", " << it.value() << ")";
23765 }
23766 debug << ")";
23767 return debug.space();
23768 }
23769 template <class aKey, class aT>
23770 inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash)
23771 {
23772 debug.nospace() << "QHash(";
23773 for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
23774 it != hash.constEnd(); ++it)
23775 debug << "(" << it.key() << ", " << it.value() << ")";
23776 debug << ")";
23777 return debug.space();
23778 }
23779 template <class T1, class T2>
23780 inline QDebug operator<<(QDebug debug, const QPair<T1, T2> &pair)
23781 {
23782 debug.nospace() << "QPair(" << pair.first << "," << pair.second << ")";
23783 return debug.space();
23784 }
23785 template <typename T>
23786 inline QDebug operator<<(QDebug debug, const QSet<T> &set)
23787 {
23788 debug.nospace() << "QSet";
23789 return operator<<(debug, set.toList());
23790 }
23791 __attribute__((visibility("default"))) inline QDebug qDebug() { return QDebug(QtDebugMsg); }
23792 __attribute__((visibility("default"))) inline QDebug qWarning() { return QDebug(QtWarningMsg); }
23793 typedef QtValidLicenseForCoreModule QtCoreModule;
23794 template <class Key, class T> class QCache;
23795 template <class Key, class T> class QHash;
23796 template <class T> class QLinkedList;
23797 template <class T> class QList;
23798 template <class Key, class T> class QMap;
23799 template <class Key, class T> class QMultiHash;
23800 template <class Key, class T> class QMultiMap;
23801 template <class T1, class T2> struct QPair;
23802 template <class T> class QQueue;
23803 template <class T> class QSet;
23804 template <class T> class QStack;
23805 template<class T, int Prealloc = 256> class QVarLengthArray;
23806 template <class T> class QVector;
23807 typedef QtValidLicenseForCoreModule QtCoreModule;
23808 template<class T, int Prealloc>
23809 class QVarLengthArray
23810 {
23811 public:
23812 inline explicit QVarLengthArray(int size = 0);
23813 inline QVarLengthArray(const QVarLengthArray<T, Prealloc> &other)
23814 : a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array))
23815 {
23816 append(other.constData(), other.size());
23817 }
23818 inline ~QVarLengthArray() {
23819 if (QTypeInfo<T>::isComplex) {
23820 T *i = ptr + s;
23821 while (i-- != ptr)
23822 i->~T();
23823 }
23824 if (ptr != reinterpret_cast<T *>(array))
23825 qFree(ptr);
23826 }
23827 inline QVarLengthArray<T, Prealloc> &operator=(const QVarLengthArray<T, Prealloc> &other)
23828 {
23829 if (this != &other) {
23830 clear();
23831 append(other.constData(), other.size());
23832 }
23833 return *this;
23834 }
23835 inline void removeLast() {
23836 qt_noop();
23837 realloc(s - 1, a);
23838 }
23839 inline int size() const { return s; }
23840 inline int count() const { return s; }
23841 inline bool isEmpty() const { return (s == 0); }
23842 inline void resize(int size);
23843 inline void clear() { resize(0); }
23844 inline int capacity() const { return a; }
23845 inline void reserve(int size);
23846 inline T &operator[](int idx) {
23847 qt_noop();
23848 return ptr[idx];
23849 }
23850 inline const T &operator[](int idx) const {
23851 qt_noop();
23852 return ptr[idx];
23853 }
23854 inline void append(const T &t) {
23855 if (s == a)
23856 realloc(s, s<<1);
23857 const int idx = s++;
23858 if (QTypeInfo<T>::isComplex) {
23859 new (ptr + idx) T(t);
23860 } else {
23861 ptr[idx] = t;
23862 }
23863 }
23864 void append(const T *buf, int size);
23865 inline T *data() { return ptr; }
23866 inline const T *data() const { return ptr; }
23867 inline const T * constData() const { return ptr; }
23868 private:
23869 void realloc(int size, int alloc);
23870 int a;
23871 int s;
23872 T *ptr;
23873 union {
23874 char array[sizeof(qint64) * (((Prealloc * sizeof(T)) / sizeof(qint64)) + 1)];
23875 qint64 q_for_alignment_1;
23876 double q_for_alignment_2;
23877 };
23878 };
23879 template <class T, int Prealloc>
23880 inline QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize)
23881 : s(asize) {
23882 if (s > Prealloc) {
23883 ptr = reinterpret_cast<T *>(qMalloc(s * sizeof(T)));
23884 a = s;
23885 } else {
23886 ptr = reinterpret_cast<T *>(array);
23887 a = Prealloc;
23888 }
23889 if (QTypeInfo<T>::isComplex) {
23890 T *i = ptr + s;
23891 while (i != ptr)
23892 new (--i) T;
23893 }
23894 }
23895 template <class T, int Prealloc>
23896 inline void QVarLengthArray<T, Prealloc>::resize(int asize)
23897 { realloc(asize, qMax(asize, a)); }
23898 template <class T, int Prealloc>
23899 inline void QVarLengthArray<T, Prealloc>::reserve(int asize)
23900 { if (asize > a) realloc(s, asize); }
23901 template <class T, int Prealloc>
23902 void QVarLengthArray<T, Prealloc>::append(const T *abuf, int asize)
23903 {
23904 qt_noop();
23905 if (asize <= 0)
23906 return;
23907 const int idx = s;
23908 const int news = s + asize;
23909 if (news >= a)
23910 realloc(s, qMax(s<<1, news));
23911 s = news;
23912 if (QTypeInfo<T>::isComplex) {
23913 T *i = ptr + idx;
23914 T *j = i + asize;
23915 while (i < j)
23916 new (i++) T(*abuf++);
23917 } else {
23918 qMemCopy(&ptr[idx], abuf, asize * sizeof(T));
23919 }
23920 }
23921 template <class T, int Prealloc>
23922 void QVarLengthArray<T, Prealloc>::realloc(int asize, int aalloc)
23923 {
23924 qt_noop();
23925 T *oldPtr = ptr;
23926 int osize = s;
23927 s = asize;
23928 if (aalloc != a) {
23929 ptr = reinterpret_cast<T *>(qMalloc(aalloc * sizeof(T)));
23930 if (ptr) {
23931 a = aalloc;
23932 if (QTypeInfo<T>::isStatic) {
23933 T *i = ptr + osize;
23934 T *j = oldPtr + osize;
23935 while (i != ptr) {
23936 new (--i) T(*--j);
23937 j->~T();
23938 }
23939 } else {
23940 qMemCopy(ptr, oldPtr, osize * sizeof(T));
23941 }
23942 } else {
23943 ptr = oldPtr;
23944 s = 0;
23945 asize = 0;
23946 }
23947 }
23948 if (QTypeInfo<T>::isComplex) {
23949 if (asize < osize) {
23950 T *i = oldPtr + osize;
23951 T *j = oldPtr + asize;
23952 while (i-- != j)
23953 i->~T();
23954 } else {
23955 T *i = ptr + asize;
23956 T *j = ptr + osize;
23957 while (i != j)
23958 new (--i) T;
23959 }
23960 }
23961 if (oldPtr != reinterpret_cast<T *>(array) && oldPtr != ptr)
23962 qFree(oldPtr);
23963 }
23964 typedef QtValidLicenseForCoreModule QtCoreModule;
23965 class __attribute__((visibility("default"))) QSize
23966 {
23967 public:
23968 QSize();
23969 QSize(int w, int h);
23970 bool isNull() const;
23971 bool isEmpty() const;
23972 bool isValid() const;
23973 int width() const;
23974 int height() const;
23975 void setWidth(int w);
23976 void setHeight(int h);
23977 void transpose();
23978 void scale(int w, int h, Qt::AspectRatioMode mode);
23979 void scale(const QSize &s, Qt::AspectRatioMode mode);
23980 QSize expandedTo(const QSize &) const;
23981 QSize boundedTo(const QSize &) const;
23982 int &rwidth();
23983 int &rheight();
23984 QSize &operator+=(const QSize &);
23985 QSize &operator-=(const QSize &);
23986 QSize &operator*=(qreal c);
23987 QSize &operator/=(qreal c);
23988 friend inline bool operator==(const QSize &, const QSize &);
23989 friend inline bool operator!=(const QSize &, const QSize &);
23990 friend inline const QSize operator+(const QSize &, const QSize &);
23991 friend inline const QSize operator-(const QSize &, const QSize &);
23992 friend inline const QSize operator*(const QSize &, qreal);
23993 friend inline const QSize operator*(qreal, const QSize &);
23994 friend inline const QSize operator/(const QSize &, qreal);
23995 private:
23996 int wd;
23997 int ht;
23998 };
23999 template <> class QTypeInfo<QSize> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QSize"; } };
24000 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QSize &);
24001 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QSize &);
24002 inline QSize::QSize()
24003 { wd = ht = -1; }
24004 inline QSize::QSize(int w, int h)
24005 { wd = w; ht = h; }
24006 inline bool QSize::isNull() const
24007 { return wd==0 && ht==0; }
24008 inline bool QSize::isEmpty() const
24009 { return wd<1 || ht<1; }
24010 inline bool QSize::isValid() const
24011 { return wd>=0 && ht>=0; }
24012 inline int QSize::width() const
24013 { return wd; }
24014 inline int QSize::height() const
24015 { return ht; }
24016 inline void QSize::setWidth(int w)
24017 { wd = w; }
24018 inline void QSize::setHeight(int h)
24019 { ht = h; }
24020 inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode)
24021 { scale(QSize(w, h), mode); }
24022 inline int &QSize::rwidth()
24023 { return wd; }
24024 inline int &QSize::rheight()
24025 { return ht; }
24026 inline QSize &QSize::operator+=(const QSize &s)
24027 { wd+=s.wd; ht+=s.ht; return *this; }
24028 inline QSize &QSize::operator-=(const QSize &s)
24029 { wd-=s.wd; ht-=s.ht; return *this; }
24030 inline QSize &QSize::operator*=(qreal c)
24031 { wd = qRound(wd*c); ht = qRound(ht*c); return *this; }
24032 inline bool operator==(const QSize &s1, const QSize &s2)
24033 { return s1.wd == s2.wd && s1.ht == s2.ht; }
24034 inline bool operator!=(const QSize &s1, const QSize &s2)
24035 { return s1.wd != s2.wd || s1.ht != s2.ht; }
24036 inline const QSize operator+(const QSize & s1, const QSize & s2)
24037 { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
24038 inline const QSize operator-(const QSize &s1, const QSize &s2)
24039 { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
24040 inline const QSize operator*(const QSize &s, qreal c)
24041 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
24042 inline const QSize operator*(qreal c, const QSize &s)
24043 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
24044 inline QSize &QSize::operator/=(qreal c)
24045 {
24046 qt_noop();
24047 wd = qRound(wd/c); ht = qRound(ht/c);
24048 return *this;
24049 }
24050 inline const QSize operator/(const QSize &s, qreal c)
24051 {
24052 qt_noop();
24053 return QSize(qRound(s.wd/c), qRound(s.ht/c));
24054 }
24055 inline QSize QSize::expandedTo(const QSize & otherSize) const
24056 {
24057 return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
24058 }
24059 inline QSize QSize::boundedTo(const QSize & otherSize) const
24060 {
24061 return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht));
24062 }
24063 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QSize &);
24064 class __attribute__((visibility("default"))) QSizeF
24065 {
24066 public:
24067 QSizeF();
24068 QSizeF(const QSize &sz);
24069 QSizeF(qreal w, qreal h);
24070 bool isNull() const;
24071 bool isEmpty() const;
24072 bool isValid() const;
24073 qreal width() const;
24074 qreal height() const;
24075 void setWidth(qreal w);
24076 void setHeight(qreal h);
24077 void transpose();
24078 void scale(qreal w, qreal h, Qt::AspectRatioMode mode);
24079 void scale(const QSizeF &s, Qt::AspectRatioMode mode);
24080 QSizeF expandedTo(const QSizeF &) const;
24081 QSizeF boundedTo(const QSizeF &) const;
24082 qreal &rwidth();
24083 qreal &rheight();
24084 QSizeF &operator+=(const QSizeF &);
24085 QSizeF &operator-=(const QSizeF &);
24086 QSizeF &operator*=(qreal c);
24087 QSizeF &operator/=(qreal c);
24088 friend inline bool operator==(const QSizeF &, const QSizeF &);
24089 friend inline bool operator!=(const QSizeF &, const QSizeF &);
24090 friend inline const QSizeF operator+(const QSizeF &, const QSizeF &);
24091 friend inline const QSizeF operator-(const QSizeF &, const QSizeF &);
24092 friend inline const QSizeF operator*(const QSizeF &, qreal);
24093 friend inline const QSizeF operator*(qreal, const QSizeF &);
24094 friend inline const QSizeF operator/(const QSizeF &, qreal);
24095 inline QSize toSize() const;
24096 private:
24097 qreal wd;
24098 qreal ht;
24099 };
24100 template <> class QTypeInfo<QSizeF> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QSizeF)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QSizeF"; } };
24101 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QSizeF &);
24102 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QSizeF &);
24103 inline QSizeF::QSizeF()
24104 { wd = ht = -1.; }
24105 inline QSizeF::QSizeF(const QSize &sz)
24106 : wd(sz.width()), ht(sz.height())
24107 {
24108 }
24109 inline QSizeF::QSizeF(qreal w, qreal h)
24110 { wd = w; ht = h; }
24111 inline bool QSizeF::isNull() const
24112 { return qIsNull(wd) && qIsNull(ht); }
24113 inline bool QSizeF::isEmpty() const
24114 { return wd <= 0. || ht <= 0.; }
24115 inline bool QSizeF::isValid() const
24116 { return wd >= 0. && ht >= 0.; }
24117 inline qreal QSizeF::width() const
24118 { return wd; }
24119 inline qreal QSizeF::height() const
24120 { return ht; }
24121 inline void QSizeF::setWidth(qreal w)
24122 { wd = w; }
24123 inline void QSizeF::setHeight(qreal h)
24124 { ht = h; }
24125 inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode)
24126 { scale(QSizeF(w, h), mode); }
24127 inline qreal &QSizeF::rwidth()
24128 { return wd; }
24129 inline qreal &QSizeF::rheight()
24130 { return ht; }
24131 inline QSizeF &QSizeF::operator+=(const QSizeF &s)
24132 { wd += s.wd; ht += s.ht; return *this; }
24133 inline QSizeF &QSizeF::operator-=(const QSizeF &s)
24134 { wd -= s.wd; ht -= s.ht; return *this; }
24135 inline QSizeF &QSizeF::operator*=(qreal c)
24136 { wd *= c; ht *= c; return *this; }
24137 inline bool operator==(const QSizeF &s1, const QSizeF &s2)
24138 { return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); }
24139 inline bool operator!=(const QSizeF &s1, const QSizeF &s2)
24140 { return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht); }
24141 inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2)
24142 { return QSizeF(s1.wd+s2.wd, s1.ht+s2.ht); }
24143 inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2)
24144 { return QSizeF(s1.wd-s2.wd, s1.ht-s2.ht); }
24145 inline const QSizeF operator*(const QSizeF &s, qreal c)
24146 { return QSizeF(s.wd*c, s.ht*c); }
24147 inline const QSizeF operator*(qreal c, const QSizeF &s)
24148 { return QSizeF(s.wd*c, s.ht*c); }
24149 inline QSizeF &QSizeF::operator/=(qreal c)
24150 {
24151 qt_noop();
24152 wd = wd/c; ht = ht/c;
24153 return *this;
24154 }
24155 inline const QSizeF operator/(const QSizeF &s, qreal c)
24156 {
24157 qt_noop();
24158 return QSizeF(s.wd/c, s.ht/c);
24159 }
24160 inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const
24161 {
24162 return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
24163 }
24164 inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const
24165 {
24166 return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht));
24167 }
24168 inline QSize QSizeF::toSize() const
24169 {
24170 return QSize(qRound(wd), qRound(ht));
24171 }
24172 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QSizeF &);
24173 typedef QtValidLicenseForCoreModule QtCoreModule;
24174 class __attribute__((visibility("default"))) QPoint
24175 {
24176 public:
24177 QPoint();
24178 QPoint(int xpos, int ypos);
24179 bool isNull() const;
24180 int x() const;
24181 int y() const;
24182 void setX(int x);
24183 void setY(int y);
24184 int manhattanLength() const;
24185 int &rx();
24186 int &ry();
24187 QPoint &operator+=(const QPoint &p);
24188 QPoint &operator-=(const QPoint &p);
24189 QPoint &operator*=(qreal c);
24190 QPoint &operator/=(qreal c);
24191 friend inline bool operator==(const QPoint &, const QPoint &);
24192 friend inline bool operator!=(const QPoint &, const QPoint &);
24193 friend inline const QPoint operator+(const QPoint &, const QPoint &);
24194 friend inline const QPoint operator-(const QPoint &, const QPoint &);
24195 friend inline const QPoint operator*(const QPoint &, qreal);
24196 friend inline const QPoint operator*(qreal, const QPoint &);
24197 friend inline const QPoint operator-(const QPoint &);
24198 friend inline const QPoint operator/(const QPoint &, qreal);
24199 private:
24200 friend class QTransform;
24201 int xp;
24202 int yp;
24203 };
24204 template <> class QTypeInfo<QPoint> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QPoint)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QPoint"; } };
24205 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPoint &);
24206 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPoint &);
24207 inline QPoint::QPoint()
24208 { xp=0; yp=0; }
24209 inline QPoint::QPoint(int xpos, int ypos)
24210 { xp = xpos; yp = ypos; }
24211 inline bool QPoint::isNull() const
24212 { return xp == 0 && yp == 0; }
24213 inline int QPoint::x() const
24214 { return xp; }
24215 inline int QPoint::y() const
24216 { return yp; }
24217 inline void QPoint::setX(int xpos)
24218 { xp = xpos; }
24219 inline void QPoint::setY(int ypos)
24220 { yp = ypos; }
24221 inline int &QPoint::rx()
24222 { return xp; }
24223 inline int &QPoint::ry()
24224 { return yp; }
24225 inline QPoint &QPoint::operator+=(const QPoint &p)
24226 { xp+=p.xp; yp+=p.yp; return *this; }
24227 inline QPoint &QPoint::operator-=(const QPoint &p)
24228 { xp-=p.xp; yp-=p.yp; return *this; }
24229 inline QPoint &QPoint::operator*=(qreal c)
24230 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; }
24231 inline bool operator==(const QPoint &p1, const QPoint &p2)
24232 { return p1.xp == p2.xp && p1.yp == p2.yp; }
24233 inline bool operator!=(const QPoint &p1, const QPoint &p2)
24234 { return p1.xp != p2.xp || p1.yp != p2.yp; }
24235 inline const QPoint operator+(const QPoint &p1, const QPoint &p2)
24236 { return QPoint(p1.xp+p2.xp, p1.yp+p2.yp); }
24237 inline const QPoint operator-(const QPoint &p1, const QPoint &p2)
24238 { return QPoint(p1.xp-p2.xp, p1.yp-p2.yp); }
24239 inline const QPoint operator*(const QPoint &p, qreal c)
24240 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
24241 inline const QPoint operator*(qreal c, const QPoint &p)
24242 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
24243 inline const QPoint operator-(const QPoint &p)
24244 { return QPoint(-p.xp, -p.yp); }
24245 inline QPoint &QPoint::operator/=(qreal c)
24246 {
24247 xp = qRound(xp/c);
24248 yp = qRound(yp/c);
24249 return *this;
24250 }
24251 inline const QPoint operator/(const QPoint &p, qreal c)
24252 {
24253 return QPoint(qRound(p.xp/c), qRound(p.yp/c));
24254 }
24255 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QPoint &);
24256 class __attribute__((visibility("default"))) QPointF
24257 {
24258 public:
24259 QPointF();
24260 QPointF(const QPoint &p);
24261 QPointF(qreal xpos, qreal ypos);
24262 bool isNull() const;
24263 qreal x() const;
24264 qreal y() const;
24265 void setX(qreal x);
24266 void setY(qreal y);
24267 qreal &rx();
24268 qreal &ry();
24269 QPointF &operator+=(const QPointF &p);
24270 QPointF &operator-=(const QPointF &p);
24271 QPointF &operator*=(qreal c);
24272 QPointF &operator/=(qreal c);
24273 friend inline bool operator==(const QPointF &, const QPointF &);
24274 friend inline bool operator!=(const QPointF &, const QPointF &);
24275 friend inline const QPointF operator+(const QPointF &, const QPointF &);
24276 friend inline const QPointF operator-(const QPointF &, const QPointF &);
24277 friend inline const QPointF operator*(qreal, const QPointF &);
24278 friend inline const QPointF operator*(const QPointF &, qreal);
24279 friend inline const QPointF operator-(const QPointF &);
24280 friend inline const QPointF operator/(const QPointF &, qreal);
24281 QPoint toPoint() const;
24282 private:
24283 friend class QMatrix;
24284 friend class QTransform;
24285 qreal xp;
24286 qreal yp;
24287 };
24288 template <> class QTypeInfo<QPointF> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QPointF)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QPointF"; } };
24289 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPointF &);
24290 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPointF &);
24291 inline QPointF::QPointF() : xp(0), yp(0) { }
24292 inline QPointF::QPointF(qreal xpos, qreal ypos) : xp(xpos), yp(ypos) { }
24293 inline QPointF::QPointF(const QPoint &p) : xp(p.x()), yp(p.y()) { }
24294 inline bool QPointF::isNull() const
24295 {
24296 return qIsNull(xp) && qIsNull(yp);
24297 }
24298 inline qreal QPointF::x() const
24299 {
24300 return xp;
24301 }
24302 inline qreal QPointF::y() const
24303 {
24304 return yp;
24305 }
24306 inline void QPointF::setX(qreal xpos)
24307 {
24308 xp = xpos;
24309 }
24310 inline void QPointF::setY(qreal ypos)
24311 {
24312 yp = ypos;
24313 }
24314 inline qreal &QPointF::rx()
24315 {
24316 return xp;
24317 }
24318 inline qreal &QPointF::ry()
24319 {
24320 return yp;
24321 }
24322 inline QPointF &QPointF::operator+=(const QPointF &p)
24323 {
24324 xp+=p.xp;
24325 yp+=p.yp;
24326 return *this;
24327 }
24328 inline QPointF &QPointF::operator-=(const QPointF &p)
24329 {
24330 xp-=p.xp; yp-=p.yp; return *this;
24331 }
24332 inline QPointF &QPointF::operator*=(qreal c)
24333 {
24334 xp*=c; yp*=c; return *this;
24335 }
24336 inline bool operator==(const QPointF &p1, const QPointF &p2)
24337 {
24338 return qFuzzyCompare(p1.xp, p2.xp) && qFuzzyCompare(p1.yp, p2.yp);
24339 }
24340 inline bool operator!=(const QPointF &p1, const QPointF &p2)
24341 {
24342 return !qFuzzyCompare(p1.xp, p2.xp) || !qFuzzyCompare(p1.yp, p2.yp);
24343 }
24344 inline const QPointF operator+(const QPointF &p1, const QPointF &p2)
24345 {
24346 return QPointF(p1.xp+p2.xp, p1.yp+p2.yp);
24347 }
24348 inline const QPointF operator-(const QPointF &p1, const QPointF &p2)
24349 {
24350 return QPointF(p1.xp-p2.xp, p1.yp-p2.yp);
24351 }
24352 inline const QPointF operator*(const QPointF &p, qreal c)
24353 {
24354 return QPointF(p.xp*c, p.yp*c);
24355 }
24356 inline const QPointF operator*(qreal c, const QPointF &p)
24357 {
24358 return QPointF(p.xp*c, p.yp*c);
24359 }
24360 inline const QPointF operator-(const QPointF &p)
24361 {
24362 return QPointF(-p.xp, -p.yp);
24363 }
24364 inline QPointF &QPointF::operator/=(qreal c)
24365 {
24366 xp/=c;
24367 yp/=c;
24368 return *this;
24369 }
24370 inline const QPointF operator/(const QPointF &p, qreal c)
24371 {
24372 return QPointF(p.xp/c, p.yp/c);
24373 }
24374 inline QPoint QPointF::toPoint() const
24375 {
24376 return QPoint(qRound(xp), qRound(yp));
24377 }
24378 __attribute__((visibility("default"))) QDebug operator<<(QDebug d, const QPointF &p);
24379 typedef QtValidLicenseForCoreModule QtCoreModule;
24380 class __attribute__((visibility("default"))) QRect
24381 {
24382 public:
24383 QRect() { x1 = y1 = 0; x2 = y2 = -1; }
24384 QRect(const QPoint &topleft, const QPoint &bottomright);
24385 QRect(const QPoint &topleft, const QSize &size);
24386 QRect(int left, int top, int width, int height);
24387 bool isNull() const;
24388 bool isEmpty() const;
24389 bool isValid() const;
24390 int left() const;
24391 int top() const;
24392 int right() const;
24393 int bottom() const;
24394 QRect normalized() const;
24395 int x() const;
24396 int y() const;
24397 void setLeft(int pos);
24398 void setTop(int pos);
24399 void setRight(int pos);
24400 void setBottom(int pos);
24401 void setX(int x);
24402 void setY(int y);
24403 void setTopLeft(const QPoint &p);
24404 void setBottomRight(const QPoint &p);
24405 void setTopRight(const QPoint &p);
24406 void setBottomLeft(const QPoint &p);
24407 QPoint topLeft() const;
24408 QPoint bottomRight() const;
24409 QPoint topRight() const;
24410 QPoint bottomLeft() const;
24411 QPoint center() const;
24412 void moveLeft(int pos);
24413 void moveTop(int pos);
24414 void moveRight(int pos);
24415 void moveBottom(int pos);
24416 void moveTopLeft(const QPoint &p);
24417 void moveBottomRight(const QPoint &p);
24418 void moveTopRight(const QPoint &p);
24419 void moveBottomLeft(const QPoint &p);
24420 void moveCenter(const QPoint &p);
24421 inline void translate(int dx, int dy);
24422 inline void translate(const QPoint &p);
24423 inline QRect translated(int dx, int dy) const;
24424 inline QRect translated(const QPoint &p) const;
24425 void moveTo(int x, int t);
24426 void moveTo(const QPoint &p);
24427 void setRect(int x, int y, int w, int h);
24428 inline void getRect(int *x, int *y, int *w, int *h) const;
24429 void setCoords(int x1, int y1, int x2, int y2);
24430 inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
24431 inline void adjust(int x1, int y1, int x2, int y2);
24432 inline QRect adjusted(int x1, int y1, int x2, int y2) const;
24433 QSize size() const;
24434 int width() const;
24435 int height() const;
24436 void setWidth(int w);
24437 void setHeight(int h);
24438 void setSize(const QSize &s);
24439 QRect operator|(const QRect &r) const;
24440 QRect operator&(const QRect &r) const;
24441 QRect& operator|=(const QRect &r);
24442 QRect& operator&=(const QRect &r);
24443 bool contains(const QPoint &p, bool proper=false) const;
24444 bool contains(int x, int y) const;
24445 bool contains(int x, int y, bool proper) const;
24446 bool contains(const QRect &r, bool proper = false) const;
24447 QRect unite(const QRect &r) const;
24448 QRect united(const QRect &other) const;
24449 QRect intersect(const QRect &r) const;
24450 QRect intersected(const QRect &other) const;
24451 bool intersects(const QRect &r) const;
24452 friend __attribute__((visibility("default"))) inline bool operator==(const QRect &, const QRect &);
24453 friend __attribute__((visibility("default"))) inline bool operator!=(const QRect &, const QRect &);
24454 private:
24455 int x1;
24456 int y1;
24457 int x2;
24458 int y2;
24459 };
24460 template <> class QTypeInfo<QRect> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QRect)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QRect"; } };
24461 __attribute__((visibility("default"))) inline bool operator==(const QRect &, const QRect &);
24462 __attribute__((visibility("default"))) inline bool operator!=(const QRect &, const QRect &);
24463 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QRect &);
24464 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QRect &);
24465 inline QRect::QRect(int aleft, int atop, int awidth, int aheight)
24466 {
24467 x1 = aleft;
24468 y1 = atop;
24469 x2 = (aleft + awidth - 1);
24470 y2 = (atop + aheight - 1);
24471 }
24472 inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight)
24473 {
24474 x1 = atopLeft.x();
24475 y1 = atopLeft.y();
24476 x2 = abottomRight.x();
24477 y2 = abottomRight.y();
24478 }
24479 inline QRect::QRect(const QPoint &atopLeft, const QSize &asize)
24480 {
24481 x1 = atopLeft.x();
24482 y1 = atopLeft.y();
24483 x2 = (x1+asize.width() - 1);
24484 y2 = (y1+asize.height() - 1);
24485 }
24486 inline bool QRect::isNull() const
24487 { return x2 == x1 - 1 && y2 == y1 - 1; }
24488 inline bool QRect::isEmpty() const
24489 { return x1 > x2 || y1 > y2; }
24490 inline bool QRect::isValid() const
24491 { return x1 <= x2 && y1 <= y2; }
24492 inline int QRect::left() const
24493 { return x1; }
24494 inline int QRect::top() const
24495 { return y1; }
24496 inline int QRect::right() const
24497 { return x2; }
24498 inline int QRect::bottom() const
24499 { return y2; }
24500 inline int QRect::x() const
24501 { return x1; }
24502 inline int QRect::y() const
24503 { return y1; }
24504 inline void QRect::setLeft(int pos)
24505 { x1 = pos; }
24506 inline void QRect::setTop(int pos)
24507 { y1 = pos; }
24508 inline void QRect::setRight(int pos)
24509 { x2 = pos; }
24510 inline void QRect::setBottom(int pos)
24511 { y2 = pos; }
24512 inline void QRect::setTopLeft(const QPoint &p)
24513 { x1 = p.x(); y1 = p.y(); }
24514 inline void QRect::setBottomRight(const QPoint &p)
24515 { x2 = p.x(); y2 = p.y(); }
24516 inline void QRect::setTopRight(const QPoint &p)
24517 { x2 = p.x(); y1 = p.y(); }
24518 inline void QRect::setBottomLeft(const QPoint &p)
24519 { x1 = p.x(); y2 = p.y(); }
24520 inline void QRect::setX(int ax)
24521 { x1 = ax; }
24522 inline void QRect::setY(int ay)
24523 { y1 = ay; }
24524 inline QPoint QRect::topLeft() const
24525 { return QPoint(x1, y1); }
24526 inline QPoint QRect::bottomRight() const
24527 { return QPoint(x2, y2); }
24528 inline QPoint QRect::topRight() const
24529 { return QPoint(x2, y1); }
24530 inline QPoint QRect::bottomLeft() const
24531 { return QPoint(x1, y2); }
24532 inline QPoint QRect::center() const
24533 { return QPoint((x1+x2)/2, (y1+y2)/2); }
24534 inline int QRect::width() const
24535 { return x2 - x1 + 1; }
24536 inline int QRect::height() const
24537 { return y2 - y1 + 1; }
24538 inline QSize QRect::size() const
24539 { return QSize(width(), height()); }
24540 inline void QRect::translate(int dx, int dy)
24541 {
24542 x1 += dx;
24543 y1 += dy;
24544 x2 += dx;
24545 y2 += dy;
24546 }
24547 inline void QRect::translate(const QPoint &p)
24548 {
24549 x1 += p.x();
24550 y1 += p.y();
24551 x2 += p.x();
24552 y2 += p.y();
24553 }
24554 inline QRect QRect::translated(int dx, int dy) const
24555 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
24556 inline QRect QRect::translated(const QPoint &p) const
24557 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
24558 inline void QRect::moveTo(int ax, int ay)
24559 {
24560 x2 += ax - x1;
24561 y2 += ay - y1;
24562 x1 = ax;
24563 y1 = ay;
24564 }
24565 inline void QRect::moveTo(const QPoint &p)
24566 {
24567 x2 += p.x() - x1;
24568 y2 += p.y() - y1;
24569 x1 = p.x();
24570 y1 = p.y();
24571 }
24572 inline void QRect::moveLeft(int pos)
24573 { x2 += (pos - x1); x1 = pos; }
24574 inline void QRect::moveTop(int pos)
24575 { y2 += (pos - y1); y1 = pos; }
24576 inline void QRect::moveRight(int pos)
24577 {
24578 x1 += (pos - x2);
24579 x2 = pos;
24580 }
24581 inline void QRect::moveBottom(int pos)
24582 {
24583 y1 += (pos - y2);
24584 y2 = pos;
24585 }
24586 inline void QRect::moveTopLeft(const QPoint &p)
24587 {
24588 moveLeft(p.x());
24589 moveTop(p.y());
24590 }
24591 inline void QRect::moveBottomRight(const QPoint &p)
24592 {
24593 moveRight(p.x());
24594 moveBottom(p.y());
24595 }
24596 inline void QRect::moveTopRight(const QPoint &p)
24597 {
24598 moveRight(p.x());
24599 moveTop(p.y());
24600 }
24601 inline void QRect::moveBottomLeft(const QPoint &p)
24602 {
24603 moveLeft(p.x());
24604 moveBottom(p.y());
24605 }
24606 inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const
24607 {
24608 *ax = x1;
24609 *ay = y1;
24610 *aw = x2 - x1 + 1;
24611 *ah = y2 - y1 + 1;
24612 }
24613 inline void QRect::setRect(int ax, int ay, int aw, int ah)
24614 {
24615 x1 = ax;
24616 y1 = ay;
24617 x2 = (ax + aw - 1);
24618 y2 = (ay + ah - 1);
24619 }
24620 inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const
24621 {
24622 *xp1 = x1;
24623 *yp1 = y1;
24624 *xp2 = x2;
24625 *yp2 = y2;
24626 }
24627 inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2)
24628 {
24629 x1 = xp1;
24630 y1 = yp1;
24631 x2 = xp2;
24632 y2 = yp2;
24633 }
24634 inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const
24635 { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
24636 inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2)
24637 {
24638 x1 += dx1;
24639 y1 += dy1;
24640 x2 += dx2;
24641 y2 += dy2;
24642 }
24643 inline void QRect::setWidth(int w)
24644 { x2 = (x1 + w - 1); }
24645 inline void QRect::setHeight(int h)
24646 { y2 = (y1 + h - 1); }
24647 inline void QRect::setSize(const QSize &s)
24648 {
24649 x2 = (s.width() + x1 - 1);
24650 y2 = (s.height() + y1 - 1);
24651 }
24652 inline bool QRect::contains(int ax, int ay, bool aproper) const
24653 {
24654 return contains(QPoint(ax, ay), aproper);
24655 }
24656 inline bool QRect::contains(int ax, int ay) const
24657 {
24658 return contains(QPoint(ax, ay), false);
24659 }
24660 inline QRect& QRect::operator|=(const QRect &r)
24661 {
24662 *this = *this | r;
24663 return *this;
24664 }
24665 inline QRect& QRect::operator&=(const QRect &r)
24666 {
24667 *this = *this & r;
24668 return *this;
24669 }
24670 inline QRect QRect::intersect(const QRect &r) const
24671 {
24672 return *this & r;
24673 }
24674 inline QRect QRect::intersected(const QRect &other) const
24675 {
24676 return intersect(other);
24677 }
24678 inline QRect QRect::unite(const QRect &r) const
24679 {
24680 return *this | r;
24681 }
24682 inline QRect QRect::united(const QRect &r) const
24683 {
24684 return unite(r);
24685 }
24686 inline bool operator==(const QRect &r1, const QRect &r2)
24687 {
24688 return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
24689 }
24690 inline bool operator!=(const QRect &r1, const QRect &r2)
24691 {
24692 return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
24693 }
24694 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QRect &);
24695 class __attribute__((visibility("default"))) QRectF
24696 {
24697 public:
24698 QRectF() { xp = yp = 0.; w = h = 0.; }
24699 QRectF(const QPointF &topleft, const QSizeF &size);
24700 QRectF(const QPointF &topleft, const QPointF &bottomRight);
24701 QRectF(qreal left, qreal top, qreal width, qreal height);
24702 QRectF(const QRect &rect);
24703 bool isNull() const;
24704 bool isEmpty() const;
24705 bool isValid() const;
24706 QRectF normalized() const;
24707 inline qreal left() const { return xp; }
24708 inline qreal top() const { return yp; }
24709 inline qreal right() const { return xp + w; }
24710 inline qreal bottom() const { return yp + h; }
24711 inline qreal x() const;
24712 inline qreal y() const;
24713 inline void setLeft(qreal pos);
24714 inline void setTop(qreal pos);
24715 inline void setRight(qreal pos);
24716 inline void setBottom(qreal pos);
24717 inline void setX(qreal pos) { setLeft(pos); }
24718 inline void setY(qreal pos) { setTop(pos); }
24719 inline QPointF topLeft() const { return QPointF(xp, yp); }
24720 inline QPointF bottomRight() const { return QPointF(xp+w, yp+h); }
24721 inline QPointF topRight() const { return QPointF(xp+w, yp); }
24722 inline QPointF bottomLeft() const { return QPointF(xp, yp+h); }
24723 inline QPointF center() const;
24724 void setTopLeft(const QPointF &p);
24725 void setBottomRight(const QPointF &p);
24726 void setTopRight(const QPointF &p);
24727 void setBottomLeft(const QPointF &p);
24728 void moveLeft(qreal pos);
24729 void moveTop(qreal pos);
24730 void moveRight(qreal pos);
24731 void moveBottom(qreal pos);
24732 void moveTopLeft(const QPointF &p);
24733 void moveBottomRight(const QPointF &p);
24734 void moveTopRight(const QPointF &p);
24735 void moveBottomLeft(const QPointF &p);
24736 void moveCenter(const QPointF &p);
24737 void translate(qreal dx, qreal dy);
24738 void translate(const QPointF &p);
24739 QRectF translated(qreal dx, qreal dy) const;
24740 QRectF translated(const QPointF &p) const;
24741 void moveTo(qreal x, qreal t);
24742 void moveTo(const QPointF &p);
24743 void setRect(qreal x, qreal y, qreal w, qreal h);
24744 void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const;
24745 void setCoords(qreal x1, qreal y1, qreal x2, qreal y2);
24746 void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
24747 inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2);
24748 inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const;
24749 QSizeF size() const;
24750 qreal width() const;
24751 qreal height() const;
24752 void setWidth(qreal w);
24753 void setHeight(qreal h);
24754 void setSize(const QSizeF &s);
24755 QRectF operator|(const QRectF &r) const;
24756 QRectF operator&(const QRectF &r) const;
24757 QRectF& operator|=(const QRectF &r);
24758 QRectF& operator&=(const QRectF &r);
24759 bool contains(const QPointF &p) const;
24760 bool contains(qreal x, qreal y) const;
24761 bool contains(const QRectF &r) const;
24762 QRectF unite(const QRectF &r) const;
24763 QRectF united(const QRectF &other) const;
24764 QRectF intersect(const QRectF &r) const;
24765 QRectF intersected(const QRectF &other) const;
24766 bool intersects(const QRectF &r) const;
24767 friend __attribute__((visibility("default"))) inline bool operator==(const QRectF &, const QRectF &);
24768 friend __attribute__((visibility("default"))) inline bool operator!=(const QRectF &, const QRectF &);
24769 QRect toRect() const;
24770 QRect toAlignedRect() const;
24771 private:
24772 qreal xp;
24773 qreal yp;
24774 qreal w;
24775 qreal h;
24776 };
24777 template <> class QTypeInfo<QRectF> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QRectF)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QRectF"; } };
24778 __attribute__((visibility("default"))) inline bool operator==(const QRectF &, const QRectF &);
24779 __attribute__((visibility("default"))) inline bool operator!=(const QRectF &, const QRectF &);
24780 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QRectF &);
24781 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QRectF &);
24782 inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight)
24783 : xp(aleft), yp(atop), w(awidth), h(aheight)
24784 {
24785 }
24786 inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize)
24787 {
24788 xp = atopLeft.x();
24789 yp = atopLeft.y();
24790 w = asize.width();
24791 h = asize.height();
24792 }
24793 inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight)
24794 {
24795 xp = atopLeft.x();
24796 yp = atopLeft.y();
24797 w = abottomRight.x() - xp;
24798 h = abottomRight.y() - yp;
24799 }
24800 inline QRectF::QRectF(const QRect &r)
24801 : xp(r.x()), yp(r.y()), w(r.width()), h(r.height())
24802 {
24803 }
24804 inline bool QRectF::isNull() const
24805 { return qIsNull(w) && qIsNull(h); }
24806 inline bool QRectF::isEmpty() const
24807 { return w <= 0. || h <= 0.; }
24808 inline bool QRectF::isValid() const
24809 { return w > 0. && h > 0.; }
24810 inline qreal QRectF::x() const
24811 { return xp; }
24812 inline qreal QRectF::y() const
24813 { return yp; }
24814 inline void QRectF::setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; }
24815 inline void QRectF::setRight(qreal pos) { w = pos - xp; }
24816 inline void QRectF::setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; }
24817 inline void QRectF::setBottom(qreal pos) { h = pos - yp; }
24818 inline void QRectF::setTopLeft(const QPointF &p) { setLeft(p.x()); setTop(p.y()); }
24819 inline void QRectF::setTopRight(const QPointF &p) { setRight(p.x()); setTop(p.y()); }
24820 inline void QRectF::setBottomLeft(const QPointF &p) { setLeft(p.x()); setBottom(p.y()); }
24821 inline void QRectF::setBottomRight(const QPointF &p) { setRight(p.x()); setBottom(p.y()); }
24822 inline QPointF QRectF::center() const
24823 { return QPointF(xp + w/2, yp + h/2); }
24824 inline void QRectF::moveLeft(qreal pos) { xp = pos; }
24825 inline void QRectF::moveTop(qreal pos) { yp = pos; }
24826 inline void QRectF::moveRight(qreal pos) { xp = pos - w; }
24827 inline void QRectF::moveBottom(qreal pos) { yp = pos - h; }
24828 inline void QRectF::moveTopLeft(const QPointF &p) { moveLeft(p.x()); moveTop(p.y()); }
24829 inline void QRectF::moveTopRight(const QPointF &p) { moveRight(p.x()); moveTop(p.y()); }
24830 inline void QRectF::moveBottomLeft(const QPointF &p) { moveLeft(p.x()); moveBottom(p.y()); }
24831 inline void QRectF::moveBottomRight(const QPointF &p) { moveRight(p.x()); moveBottom(p.y()); }
24832 inline void QRectF::moveCenter(const QPointF &p) { xp = p.x() - w/2; yp = p.y() - h/2; }
24833 inline qreal QRectF::width() const
24834 { return w; }
24835 inline qreal QRectF::height() const
24836 { return h; }
24837 inline QSizeF QRectF::size() const
24838 { return QSizeF(w, h); }
24839 inline void QRectF::translate(qreal dx, qreal dy)
24840 {
24841 xp += dx;
24842 yp += dy;
24843 }
24844 inline void QRectF::translate(const QPointF &p)
24845 {
24846 xp += p.x();
24847 yp += p.y();
24848 }
24849 inline void QRectF::moveTo(qreal ax, qreal ay)
24850 {
24851 xp = ax;
24852 yp = ay;
24853 }
24854 inline void QRectF::moveTo(const QPointF &p)
24855 {
24856 xp = p.x();
24857 yp = p.y();
24858 }
24859 inline QRectF QRectF::translated(qreal dx, qreal dy) const
24860 { return QRectF(xp + dx, yp + dy, w, h); }
24861 inline QRectF QRectF::translated(const QPointF &p) const
24862 { return QRectF(xp + p.x(), yp + p.y(), w, h); }
24863 inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const
24864 {
24865 *ax = this->xp;
24866 *ay = this->yp;
24867 *aaw = this->w;
24868 *aah = this->h;
24869 }
24870 inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah)
24871 {
24872 this->xp = ax;
24873 this->yp = ay;
24874 this->w = aaw;
24875 this->h = aah;
24876 }
24877 inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const
24878 {
24879 *xp1 = xp;
24880 *yp1 = yp;
24881 *xp2 = xp + w;
24882 *yp2 = yp + h;
24883 }
24884 inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
24885 {
24886 xp = xp1;
24887 yp = yp1;
24888 w = xp2 - xp1;
24889 h = yp2 - yp1;
24890 }
24891 inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
24892 { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; }
24893 inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const
24894 { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); }
24895 inline void QRectF::setWidth(qreal aw)
24896 { this->w = aw; }
24897 inline void QRectF::setHeight(qreal ah)
24898 { this->h = ah; }
24899 inline void QRectF::setSize(const QSizeF &s)
24900 {
24901 w = s.width();
24902 h = s.height();
24903 }
24904 inline bool QRectF::contains(qreal ax, qreal ay) const
24905 {
24906 return contains(QPointF(ax, ay));
24907 }
24908 inline QRectF& QRectF::operator|=(const QRectF &r)
24909 {
24910 *this = *this | r;
24911 return *this;
24912 }
24913 inline QRectF& QRectF::operator&=(const QRectF &r)
24914 {
24915 *this = *this & r;
24916 return *this;
24917 }
24918 inline QRectF QRectF::intersect(const QRectF &r) const
24919 {
24920 return *this & r;
24921 }
24922 inline QRectF QRectF::intersected(const QRectF &r) const
24923 {
24924 return intersect(r);
24925 }
24926 inline QRectF QRectF::unite(const QRectF &r) const
24927 {
24928 return *this | r;
24929 }
24930 inline QRectF QRectF::united(const QRectF &r) const
24931 {
24932 return unite(r);
24933 }
24934 inline bool operator==(const QRectF &r1, const QRectF &r2)
24935 {
24936 return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp)
24937 && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h);
24938 }
24939 inline bool operator!=(const QRectF &r1, const QRectF &r2)
24940 {
24941 return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp)
24942 || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h);
24943 }
24944 inline QRect QRectF::toRect() const
24945 {
24946 return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h));
24947 }
24948 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QRectF &);
24949 typedef QtValidLicenseForGuiModule QtGuiModule;
24950 typedef unsigned int QRgb;
24951 const QRgb RGB_MASK = 0x00ffffff;
24952 __attribute__((visibility("default"))) inline int qRed(QRgb rgb)
24953 { return ((rgb >> 16) & 0xff); }
24954 __attribute__((visibility("default"))) inline int qGreen(QRgb rgb)
24955 { return ((rgb >> 8) & 0xff); }
24956 __attribute__((visibility("default"))) inline int qBlue(QRgb rgb)
24957 { return (rgb & 0xff); }
24958 __attribute__((visibility("default"))) inline int qAlpha(QRgb rgb)
24959 { return ((rgb >> 24) & 0xff); }
24960 __attribute__((visibility("default"))) inline QRgb qRgb(int r, int g, int b)
24961 { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
24962 __attribute__((visibility("default"))) inline QRgb qRgba(int r, int g, int b, int a)
24963 { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
24964 __attribute__((visibility("default"))) inline int qGray(int r, int g, int b)
24965 { return (r*11+g*16+b*5)/32; }
24966 __attribute__((visibility("default"))) inline int qGray(QRgb rgb)
24967 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
24968 __attribute__((visibility("default"))) inline bool qIsGray(QRgb rgb)
24969 { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); }
24970 typedef QtValidLicenseForCoreModule QtCoreModule;
24971 struct QRegExpPrivate;
24972 class QStringList;
24973 class __attribute__((visibility("default"))) QRegExp
24974 {
24975 public:
24976 enum PatternSyntax { RegExp, Wildcard, FixedString, RegExp2 };
24977 enum CaretMode { CaretAtZero, CaretAtOffset, CaretWontMatch };
24978 QRegExp();
24979 explicit QRegExp(const QString &pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive,
24980 PatternSyntax syntax = RegExp);
24981 QRegExp(const QRegExp &rx);
24982 ~QRegExp();
24983 QRegExp &operator=(const QRegExp &rx);
24984 bool operator==(const QRegExp &rx) const;
24985 inline bool operator!=(const QRegExp &rx) const { return !operator==(rx); }
24986 bool isEmpty() const;
24987 bool isValid() const;
24988 QString pattern() const;
24989 void setPattern(const QString &pattern);
24990 Qt::CaseSensitivity caseSensitivity() const;
24991 void setCaseSensitivity(Qt::CaseSensitivity cs);
24992 PatternSyntax patternSyntax() const;
24993 void setPatternSyntax(PatternSyntax syntax);
24994 bool isMinimal() const;
24995 void setMinimal(bool minimal);
24996 bool exactMatch(const QString &str) const;
24997 int indexIn(const QString &str, int offset = 0, CaretMode caretMode = CaretAtZero) const;
24998 int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const;
24999 int matchedLength() const;
25000 int numCaptures() const;
25001 QStringList capturedTexts() const;
25002 QStringList capturedTexts();
25003 QString cap(int nth = 0) const;
25004 QString cap(int nth = 0);
25005 int pos(int nth = 0) const;
25006 int pos(int nth = 0);
25007 QString errorString() const;
25008 QString errorString();
25009 static QString escape(const QString &str);
25010 private:
25011 QRegExpPrivate *priv;
25012 };
25013 template <> class QTypeInfo<QRegExp> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QRegExp)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QRegExp"; } };
25014 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &out, const QRegExp &regExp);
25015 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &in, QRegExp &regExp);
25016 typedef QtValidLicenseForCoreModule QtCoreModule;
25017 class QStringMatcherPrivate;
25018 class __attribute__((visibility("default"))) QStringMatcher
25019 {
25020 public:
25021 QStringMatcher();
25022 QStringMatcher(const QString &pattern,
25023 Qt::CaseSensitivity cs = Qt::CaseSensitive);
25024 QStringMatcher(const QChar *uc, int len,
25025 Qt::CaseSensitivity cs = Qt::CaseSensitive);
25026 QStringMatcher(const QStringMatcher &other);
25027 ~QStringMatcher();
25028 QStringMatcher &operator=(const QStringMatcher &other);
25029 void setPattern(const QString &pattern);
25030 void setCaseSensitivity(Qt::CaseSensitivity cs);
25031 int indexIn(const QString &str, int from = 0) const;
25032 int indexIn(const QChar *str, int length, int from = 0) const;
25033 QString pattern() const;
25034 inline Qt::CaseSensitivity caseSensitivity() const { return q_cs; }
25035 private:
25036 QStringMatcherPrivate *d_ptr;
25037 QString q_pattern;
25038 Qt::CaseSensitivity q_cs;
25039 union {
25040 uint q_data[256];
25041 struct {
25042 uchar q_skiptable[256];
25043 const QChar *uc;
25044 int len;
25045 } p;
25046 };
25047 };
25048 typedef QtValidLicenseForCoreModule QtCoreModule;
25049 class QRegExp;
25050 typedef QListIterator<QString> QStringListIterator;
25051 typedef QMutableListIterator<QString> QMutableStringListIterator;
25052 class QStringList : public QList<QString>
25053 {
25054 public:
25055 inline QStringList() { }
25056 inline explicit QStringList(const QString &i) { append(i); }
25057 inline QStringList(const QStringList &l) : QList<QString>(l) { }
25058 inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
25059 inline void sort();
25060 inline int removeDuplicates();
25061 inline QString join(const QString &sep) const;
25062 inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
25063 inline QBool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
25064 inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
25065 inline QStringList operator+(const QStringList &other) const
25066 { QStringList n = *this; n += other; return n; }
25067 inline QStringList &operator<<(const QString &str)
25068 { append(str); return *this; }
25069 inline QStringList &operator<<(const QStringList &l)
25070 { *this += l; return *this; }
25071 inline QStringList filter(const QRegExp &rx) const;
25072 inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after);
25073 inline int indexOf(const QRegExp &rx, int from = 0) const;
25074 inline int lastIndexOf(const QRegExp &rx, int from = -1) const;
25075 inline int indexOf(QRegExp &rx, int from = 0) const;
25076 inline int lastIndexOf(QRegExp &rx, int from = -1) const;
25077 using QList<QString>::indexOf;
25078 using QList<QString>::lastIndexOf;
25079 };
25080 namespace QtPrivate {
25081 void __attribute__((visibility("default"))) QStringList_sort(QStringList *that);
25082 int __attribute__((visibility("default"))) QStringList_removeDuplicates(QStringList *that);
25083 QString __attribute__((visibility("default"))) QStringList_join(const QStringList *that, const QString &sep);
25084 QStringList __attribute__((visibility("default"))) QStringList_filter(const QStringList *that, const QString &str,
25085 Qt::CaseSensitivity cs);
25086 QBool __attribute__((visibility("default"))) QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs);
25087 void __attribute__((visibility("default"))) QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after,
25088 Qt::CaseSensitivity cs);
25089 void __attribute__((visibility("default"))) QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after);
25090 QStringList __attribute__((visibility("default"))) QStringList_filter(const QStringList *that, const QRegExp &re);
25091 int __attribute__((visibility("default"))) QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from);
25092 int __attribute__((visibility("default"))) QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from);
25093 int __attribute__((visibility("default"))) QStringList_indexOf(const QStringList *that, QRegExp &rx, int from);
25094 int __attribute__((visibility("default"))) QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from);
25095 }
25096 inline void QStringList::sort()
25097 {
25098 QtPrivate::QStringList_sort(this);
25099 }
25100 inline int QStringList::removeDuplicates()
25101 {
25102 return QtPrivate::QStringList_removeDuplicates(this);
25103 }
25104 inline QString QStringList::join(const QString &sep) const
25105 {
25106 return QtPrivate::QStringList_join(this, sep);
25107 }
25108 inline QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const
25109 {
25110 return QtPrivate::QStringList_filter(this, str, cs);
25111 }
25112 inline QBool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
25113 {
25114 return QtPrivate::QStringList_contains(this, str, cs);
25115 }
25116 inline QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
25117 {
25118 QtPrivate::QStringList_replaceInStrings(this, before, after, cs);
25119 return *this;
25120 }
25121 inline QStringList &QStringList::replaceInStrings(const QRegExp &rx, const QString &after)
25122 {
25123 QtPrivate::QStringList_replaceInStrings(this, rx, after);
25124 return *this;
25125 }
25126 inline QStringList QStringList::filter(const QRegExp &rx) const
25127 {
25128 return QtPrivate::QStringList_filter(this, rx);
25129 }
25130 inline int QStringList::indexOf(const QRegExp &rx, int from) const
25131 {
25132 return QtPrivate::QStringList_indexOf(this, rx, from);
25133 }
25134 inline int QStringList::lastIndexOf(const QRegExp &rx, int from) const
25135 {
25136 return QtPrivate::QStringList_lastIndexOf(this, rx, from);
25137 }
25138 inline int QStringList::indexOf(QRegExp &rx, int from) const
25139 {
25140 return QtPrivate::QStringList_indexOf(this, rx, from);
25141 }
25142 inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
25143 {
25144 return QtPrivate::QStringList_lastIndexOf(this, rx, from);
25145 }
25146 inline QDataStream &operator>>(QDataStream &in, QStringList &list)
25147 {
25148 return operator>>(in, static_cast<QList<QString> &>(list));
25149 }
25150 inline QDataStream &operator<<(QDataStream &out, const QStringList &list)
25151 {
25152 return operator<<(out, static_cast<const QList<QString> &>(list));
25153 }
25154 typedef QtValidLicenseForGuiModule QtGuiModule;
25155 class QColor;
25156 class QColormap;
25157 class QVariant;
25158 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QColor &);
25159 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QColor &);
25160 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QColor &);
25161 class __attribute__((visibility("default"))) QColor
25162 {
25163 public:
25164 enum Spec { Invalid, Rgb, Hsv, Cmyk };
25165 QColor();
25166 QColor(Qt::GlobalColor color);
25167 QColor(int r, int g, int b, int a = 255);
25168 QColor(QRgb rgb);
25169 QColor(const QString& name);
25170 QColor(const char *name);
25171 QColor(const QColor &color);
25172 QColor(Spec spec);
25173 bool isValid() const;
25174 QString name() const;
25175 void setNamedColor(const QString& name);
25176 static QStringList colorNames();
25177 inline Spec spec() const
25178 { return cspec; }
25179 int alpha() const;
25180 void setAlpha(int alpha);
25181 qreal alphaF() const;
25182 void setAlphaF(qreal alpha);
25183 int red() const;
25184 int green() const;
25185 int blue() const;
25186 void setRed(int red);
25187 void setGreen(int green);
25188 void setBlue(int blue);
25189 qreal redF() const;
25190 qreal greenF() const;
25191 qreal blueF() const;
25192 void setRedF(qreal red);
25193 void setGreenF(qreal green);
25194 void setBlueF(qreal blue);
25195 void getRgb(int *r, int *g, int *b, int *a = 0) const;
25196 void setRgb(int r, int g, int b, int a = 255);
25197 void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = 0) const;
25198 void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
25199 QRgb rgba() const;
25200 void setRgba(QRgb rgba);
25201 QRgb rgb() const;
25202 void setRgb(QRgb rgb);
25203 int hue() const;
25204 int saturation() const;
25205 int value() const;
25206 qreal hueF() const;
25207 qreal saturationF() const;
25208 qreal valueF() const;
25209 void getHsv(int *h, int *s, int *v, int *a = 0) const;
25210 void setHsv(int h, int s, int v, int a = 255);
25211 void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = 0) const;
25212 void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
25213 int cyan() const;
25214 int magenta() const;
25215 int yellow() const;
25216 int black() const;
25217 qreal cyanF() const;
25218 qreal magentaF() const;
25219 qreal yellowF() const;
25220 qreal blackF() const;
25221 void getCmyk(int *c, int *m, int *y, int *k, int *a = 0);
25222 void setCmyk(int c, int m, int y, int k, int a = 255);
25223 void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = 0);
25224 void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0);
25225 QColor toRgb() const;
25226 QColor toHsv() const;
25227 QColor toCmyk() const;
25228 QColor convertTo(Spec colorSpec) const;
25229 static QColor fromRgb(QRgb rgb);
25230 static QColor fromRgba(QRgb rgba);
25231 static QColor fromRgb(int r, int g, int b, int a = 255);
25232 static QColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
25233 static QColor fromHsv(int h, int s, int v, int a = 255);
25234 static QColor fromHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
25235 static QColor fromCmyk(int c, int m, int y, int k, int a = 255);
25236 static QColor fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0);
25237 QColor light(int f = 150) const;
25238 QColor lighter(int f = 150) const;
25239 QColor dark(int f = 200) const;
25240 QColor darker(int f = 200) const;
25241 QColor &operator=(const QColor &);
25242 QColor &operator=(Qt::GlobalColor color);
25243 bool operator==(const QColor &c) const;
25244 bool operator!=(const QColor &c) const;
25245 operator QVariant() const;
25246 private:
25247 QColor(int, int, int, Spec);
25248 void invalidate();
25249 Spec cspec;
25250 union {
25251 struct {
25252 ushort alpha;
25253 ushort red;
25254 ushort green;
25255 ushort blue;
25256 ushort pad;
25257 } argb;
25258 struct {
25259 ushort alpha;
25260 ushort hue;
25261 ushort saturation;
25262 ushort value;
25263 ushort pad;
25264 } ahsv;
25265 struct {
25266 ushort alpha;
25267 ushort cyan;
25268 ushort magenta;
25269 ushort yellow;
25270 ushort black;
25271 } acmyk;
25272 } ct;
25273 friend class QColormap;
25274 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QColor &);
25275 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QColor &);
25276 };
25277 inline QColor::QColor()
25278 { invalidate(); }
25279 inline QColor::QColor(int r, int g, int b, int a)
25280 { setRgb(r, g, b, a); }
25281 inline QColor::QColor(const char *aname)
25282 { setNamedColor(QLatin1String(aname)); }
25283 inline QColor::QColor(const QString& aname)
25284 { setNamedColor(aname); }
25285 inline QColor::QColor(const QColor &acolor)
25286 : cspec(acolor.cspec)
25287 { ct.argb = acolor.ct.argb; }
25288 inline bool QColor::isValid() const
25289 { return cspec != Invalid; }
25290 inline QColor QColor::lighter(int f) const
25291 { return light(f); }
25292 inline QColor QColor::darker(int f) const
25293 { return dark(f); }
25294 typedef QtValidLicenseForGuiModule QtGuiModule;
25295 class QPaintDevice;
25296 class QWidget;
25297 class QDialog;
25298 class QColor;
25299 class QPalette;
25300 class QCursor;
25301 class QPoint;
25302 class QSize;
25303 class QRect;
25304 class QPolygon;
25305 class QPainter;
25306 class QRegion;
25307 class QFont;
25308 class QFontMetrics;
25309 class QFontInfo;
25310 class QPen;
25311 class QBrush;
25312 class QMatrix;
25313 class QPixmap;
25314 class QBitmap;
25315 class QMovie;
25316 class QImage;
25317 class QPicture;
25318 class QPrinter;
25319 class QTimer;
25320 class QTime;
25321 class QClipboard;
25322 class QString;
25323 class QByteArray;
25324 class QApplication;
25325 template<typename T> class QList;
25326 typedef QList<QWidget *> QWidgetList;
25327 typedef unsigned long WId;
25328 struct QWSEvent;
25329 template<class K, class V> class QHash;
25330 typedef QHash<WId, QWidget *> QWidgetMapper;
25331 template<class V> class QSet;
25332 typedef QSet<QWidget *> QWidgetSet;
25333 typedef QtValidLicenseForGuiModule QtGuiModule;
25334 template <class T> class QVector;
25335 class QVariant;
25336 struct QRegionPrivate;
25337 class QBitmap;
25338 class __attribute__((visibility("default"))) QRegion
25339 {
25340 public:
25341 enum RegionType { Rectangle, Ellipse };
25342 QRegion();
25343 QRegion(int x, int y, int w, int h, RegionType t = Rectangle);
25344 QRegion(const QRect &r, RegionType t = Rectangle);
25345 QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
25346 QRegion(const QRegion &region);
25347 QRegion(const QBitmap &bitmap);
25348 ~QRegion();
25349 QRegion &operator=(const QRegion &);
25350 bool isEmpty() const;
25351 bool contains(const QPoint &p) const;
25352 bool contains(const QRect &r) const;
25353 void translate(int dx, int dy);
25354 inline void translate(const QPoint &p) { translate(p.x(), p.y()); }
25355 QRegion translated(int dx, int dy) const;
25356 inline QRegion translated(const QPoint &p) const { return translated(p.x(), p.y()); }
25357 QRegion unite(const QRegion &r) const;
25358 QRegion unite(const QRect &r) const;
25359 QRegion intersect(const QRegion &r) const;
25360 QRegion intersect(const QRect &r) const;
25361 QRegion subtract(const QRegion &r) const;
25362 QRegion eor(const QRegion &r) const;
25363 inline QRegion united(const QRegion &r) const { return unite(r); }
25364 inline QRegion united(const QRect &r) const { return unite(r); }
25365 inline QRegion intersected(const QRegion &r) const { return intersect(r); }
25366 inline QRegion intersected(const QRect &r) const { return intersect(r); }
25367 inline QRegion subtracted(const QRegion &r) const { return subtract(r); }
25368 inline QRegion xored(const QRegion &r) const { return eor(r); }
25369 bool intersects(const QRegion &r) const;
25370 bool intersects(const QRect &r) const;
25371 QRect boundingRect() const;
25372 QVector<QRect> rects() const;
25373 void setRects(const QRect *rect, int num);
25374 int numRects() const;
25375 const QRegion operator|(const QRegion &r) const;
25376 const QRegion operator+(const QRegion &r) const;
25377 const QRegion operator+(const QRect &r) const;
25378 const QRegion operator&(const QRegion &r) const;
25379 const QRegion operator&(const QRect &r) const;
25380 const QRegion operator-(const QRegion &r) const;
25381 const QRegion operator^(const QRegion &r) const;
25382 QRegion& operator|=(const QRegion &r);
25383 QRegion& operator+=(const QRegion &r);
25384 QRegion& operator+=(const QRect &r);
25385 QRegion& operator&=(const QRegion &r);
25386 QRegion& operator&=(const QRect &r);
25387 QRegion& operator-=(const QRegion &r);
25388 QRegion& operator^=(const QRegion &r);
25389 bool operator==(const QRegion &r) const;
25390 inline bool operator!=(const QRegion &r) const { return !(operator==(r)); }
25391 operator QVariant() const;
25392 inline void *handle() const { return d->qt_rgn; }
25393 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QRegion &);
25394 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QRegion &);
25395 private:
25396 QRegion copy() const;
25397 void detach();
25398 friend bool qt_region_strictContains(const QRegion &region,
25399 const QRect &rect);
25400 friend struct QRegionPrivate;
25401 void exec(const QByteArray &ba, int ver = 0, QDataStream::ByteOrder byteOrder = QDataStream::BigEndian);
25402 struct QRegionData {
25403 QBasicAtomicInt ref;
25404 QRegionPrivate *qt_rgn;
25405 };
25406 struct QRegionData *d;
25407 static struct QRegionData shared_empty;
25408 static void cleanUp(QRegionData *x);
25409 };
25410 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QRegion &);
25411 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QRegion &);
25412 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QRegion &);
25413 typedef QtValidLicenseForGuiModule QtGuiModule;
25414 class QKeySequence;
25415 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
25416 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
25417 class QVariant;
25418 class QKeySequencePrivate;
25419 class __attribute__((visibility("default"))) QKeySequence
25420 {
25421 public:
25422 enum StandardKey {
25423 UnknownKey,
25424 HelpContents,
25425 WhatsThis,
25426 Open,
25427 Close,
25428 Save,
25429 New,
25430 Delete,
25431 Cut,
25432 Copy,
25433 Paste,
25434 Undo,
25435 Redo,
25436 Back,
25437 Forward,
25438 Refresh,
25439 ZoomIn,
25440 ZoomOut,
25441 Print,
25442 AddTab,
25443 NextChild,
25444 PreviousChild,
25445 Find,
25446 FindNext,
25447 FindPrevious,
25448 Replace,
25449 SelectAll,
25450 Bold,
25451 Italic,
25452 Underline,
25453 MoveToNextChar,
25454 MoveToPreviousChar,
25455 MoveToNextWord,
25456 MoveToPreviousWord,
25457 MoveToNextLine,
25458 MoveToPreviousLine,
25459 MoveToNextPage,
25460 MoveToPreviousPage,
25461 MoveToStartOfLine,
25462 MoveToEndOfLine,
25463 MoveToStartOfBlock,
25464 MoveToEndOfBlock,
25465 MoveToStartOfDocument,
25466 MoveToEndOfDocument,
25467 SelectNextChar,
25468 SelectPreviousChar,
25469 SelectNextWord,
25470 SelectPreviousWord,
25471 SelectNextLine,
25472 SelectPreviousLine,
25473 SelectNextPage,
25474 SelectPreviousPage,
25475 SelectStartOfLine,
25476 SelectEndOfLine,
25477 SelectStartOfBlock,
25478 SelectEndOfBlock,
25479 SelectStartOfDocument,
25480 SelectEndOfDocument,
25481 DeleteStartOfWord,
25482 DeleteEndOfWord,
25483 DeleteEndOfLine,
25484 InsertParagraphSeparator,
25485 InsertLineSeparator,
25486 SaveAs
25487 };
25488 QKeySequence();
25489 QKeySequence(const QString &key);
25490 QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
25491 QKeySequence(const QKeySequence &ks);
25492 QKeySequence(StandardKey key);
25493 ~QKeySequence();
25494 uint count() const;
25495 bool isEmpty() const;
25496 enum SequenceMatch {
25497 NoMatch,
25498 PartialMatch,
25499 ExactMatch
25500 };
25501 enum SequenceFormat {
25502 NativeText,
25503 PortableText
25504 };
25505 QString toString(SequenceFormat format = PortableText) const;
25506 static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
25507 SequenceMatch matches(const QKeySequence &seq) const;
25508 static QKeySequence mnemonic(const QString &text);
25509 static QList<QKeySequence> keyBindings(StandardKey key);
25510 operator QString() const;
25511 operator QVariant() const;
25512 operator int() const;
25513 int operator[](uint i) const;
25514 QKeySequence &operator=(const QKeySequence &other);
25515 bool operator==(const QKeySequence &other) const;
25516 inline bool operator!= (const QKeySequence &other) const
25517 { return !(*this == other); }
25518 bool operator< (const QKeySequence &ks) const;
25519 inline bool operator> (const QKeySequence &other) const
25520 { return other < *this; }
25521 inline bool operator<= (const QKeySequence &other) const
25522 { return !(other < *this); }
25523 inline bool operator>= (const QKeySequence &other) const
25524 { return !(*this < other); }
25525 bool isDetached() const;
25526 private:
25527 static int decodeString(const QString &ks);
25528 static QString encodeString(int key);
25529 int assign(const QString &str);
25530 void setKey(int key, int index);
25531 QKeySequencePrivate *d;
25532 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
25533 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
25534 friend class Q3AccelManager;
25535 friend class QShortcutMap;
25536 friend class QShortcut;
25537 public:
25538 typedef QKeySequencePrivate * DataPtr;
25539 inline DataPtr &data_ptr() { return d; }
25540 };
25541 template <> class QTypeInfo<QKeySequence> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QKeySequence)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QKeySequence"; } };
25542 template <> inline bool qIsDetached<QKeySequence>(QKeySequence &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QKeySequence>(QKeySequence &value1, QKeySequence &value2) { const QKeySequence::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
25543 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QKeySequence &);
25544 typedef QtValidLicenseForCoreModule QtCoreModule;
25545 class QEventPrivate;
25546 class __attribute__((visibility("default"))) QEvent
25547 {
25548 public:
25549 enum Type {
25550 None = 0,
25551 Timer = 1,
25552 MouseButtonPress = 2,
25553 MouseButtonRelease = 3,
25554 MouseButtonDblClick = 4,
25555 MouseMove = 5,
25556 KeyPress = 6,
25557 KeyRelease = 7,
25558 FocusIn = 8,
25559 FocusOut = 9,
25560 Enter = 10,
25561 Leave = 11,
25562 Paint = 12,
25563 Move = 13,
25564 Resize = 14,
25565 Create = 15,
25566 Destroy = 16,
25567 Show = 17,
25568 Hide = 18,
25569 Close = 19,
25570 Quit = 20,
25571 ParentChange = 21,
25572 ParentAboutToChange = 131,
25573 ThreadChange = 22,
25574 WindowActivate = 24,
25575 WindowDeactivate = 25,
25576 ShowToParent = 26,
25577 HideToParent = 27,
25578 Wheel = 31,
25579 WindowTitleChange = 33,
25580 WindowIconChange = 34,
25581 ApplicationWindowIconChange = 35,
25582 ApplicationFontChange = 36,
25583 ApplicationLayoutDirectionChange = 37,
25584 ApplicationPaletteChange = 38,
25585 PaletteChange = 39,
25586 Clipboard = 40,
25587 Speech = 42,
25588 MetaCall = 43,
25589 SockAct = 50,
25590 WinEventAct = 132,
25591 DeferredDelete = 52,
25592 DragEnter = 60,
25593 DragMove = 61,
25594 DragLeave = 62,
25595 Drop = 63,
25596 DragResponse = 64,
25597 ChildAdded = 68,
25598 ChildPolished = 69,
25599 ChildRemoved = 71,
25600 ShowWindowRequest = 73,
25601 PolishRequest = 74,
25602 Polish = 75,
25603 LayoutRequest = 76,
25604 UpdateRequest = 77,
25605 UpdateLater = 78,
25606 EmbeddingControl = 79,
25607 ActivateControl = 80,
25608 DeactivateControl = 81,
25609 ContextMenu = 82,
25610 InputMethod = 83,
25611 AccessibilityPrepare = 86,
25612 TabletMove = 87,
25613 LocaleChange = 88,
25614 LanguageChange = 89,
25615 LayoutDirectionChange = 90,
25616 Style = 91,
25617 TabletPress = 92,
25618 TabletRelease = 93,
25619 OkRequest = 94,
25620 HelpRequest = 95,
25621 IconDrag = 96,
25622 FontChange = 97,
25623 EnabledChange = 98,
25624 ActivationChange = 99,
25625 StyleChange = 100,
25626 IconTextChange = 101,
25627 ModifiedChange = 102,
25628 MouseTrackingChange = 109,
25629 WindowBlocked = 103,
25630 WindowUnblocked = 104,
25631 WindowStateChange = 105,
25632 ToolTip = 110,
25633 WhatsThis = 111,
25634 StatusTip = 112,
25635 ActionChanged = 113,
25636 ActionAdded = 114,
25637 ActionRemoved = 115,
25638 FileOpen = 116,
25639 Shortcut = 117,
25640 ShortcutOverride = 51,
25641 WhatsThisClicked = 118,
25642 ToolBarChange = 120,
25643 ApplicationActivate = 121,
25644 ApplicationActivated = ApplicationActivate,
25645 ApplicationDeactivate = 122,
25646 ApplicationDeactivated = ApplicationDeactivate,
25647 QueryWhatsThis = 123,
25648 EnterWhatsThisMode = 124,
25649 LeaveWhatsThisMode = 125,
25650 ZOrderChange = 126,
25651 HoverEnter = 127,
25652 HoverLeave = 128,
25653 HoverMove = 129,
25654 AccessibilityHelp = 119,
25655 AccessibilityDescription = 130,
25656 AcceptDropsChange = 152,
25657 MenubarUpdated = 153,
25658 ZeroTimerEvent = 154,
25659 GraphicsSceneMouseMove = 155,
25660 GraphicsSceneMousePress = 156,
25661 GraphicsSceneMouseRelease = 157,
25662 GraphicsSceneMouseDoubleClick = 158,
25663 GraphicsSceneContextMenu = 159,
25664 GraphicsSceneHoverEnter = 160,
25665 GraphicsSceneHoverMove = 161,
25666 GraphicsSceneHoverLeave = 162,
25667 GraphicsSceneHelp = 163,
25668 GraphicsSceneDragEnter = 164,
25669 GraphicsSceneDragMove = 165,
25670 GraphicsSceneDragLeave = 166,
25671 GraphicsSceneDrop = 167,
25672 GraphicsSceneWheel = 168,
25673 KeyboardLayoutChange = 169,
25674 DynamicPropertyChange = 170,
25675 TabletEnterProximity = 171,
25676 TabletLeaveProximity = 172,
25677 NonClientAreaMouseMove = 173,
25678 NonClientAreaMouseButtonPress = 174,
25679 NonClientAreaMouseButtonRelease = 175,
25680 NonClientAreaMouseButtonDblClick = 176,
25681 MacSizeChange = 177,
25682 ContentsRectChange = 178,
25683 MacGLWindowChange = 179,
25684 FutureCallOut = 180,
25685 GraphicsSceneResize = 181,
25686 GraphicsSceneMove = 182,
25687 CursorChange = 183,
25688 ToolTipChange = 184,
25689 NetworkReplyUpdated = 185,
25690 GrabMouse = 186,
25691 UngrabMouse = 187,
25692 GrabKeyboard = 188,
25693 UngrabKeyboard = 189,
25694 CocoaRequestModal = 190,
25695 MacGLClearDrawable = 191,
25696 User = 1000,
25697 MaxUser = 65535
25698 };
25699 QEvent(Type type);
25700 virtual ~QEvent();
25701 inline Type type() const { return static_cast<Type>(t); }
25702 inline bool spontaneous() const { return spont; }
25703 inline void setAccepted(bool accepted) { m_accept = accepted; }
25704 inline bool isAccepted() const { return m_accept; }
25705 inline void accept() { m_accept = true; }
25706 inline void ignore() { m_accept = false; }
25707 static int registerEventType(int hint = -1);
25708 protected:
25709 QEventPrivate *d;
25710 ushort t;
25711 private:
25712 ushort posted : 1;
25713 ushort spont : 1;
25714 ushort m_accept : 1;
25715 ushort reserved : 13;
25716 friend class QCoreApplication;
25717 friend class QCoreApplicationPrivate;
25718 friend class QThreadData;
25719 friend class QApplication;
25720 friend class QApplicationPrivate;
25721 friend class Q3AccelManager;
25722 friend class QShortcutMap;
25723 friend class QETWidget;
25724 };
25725 class __attribute__((visibility("default"))) QTimerEvent : public QEvent
25726 {
25727 public:
25728 QTimerEvent( int timerId );
25729 ~QTimerEvent();
25730 int timerId() const { return id; }
25731 protected:
25732 int id;
25733 };
25734 class QObject;
25735 class __attribute__((visibility("default"))) QChildEvent : public QEvent
25736 {
25737 public:
25738 QChildEvent( Type type, QObject *child );
25739 ~QChildEvent();
25740 QObject *child() const { return c; }
25741 bool added() const { return type() == ChildAdded; }
25742 bool polished() const { return type() == ChildPolished; }
25743 bool removed() const { return type() == ChildRemoved; }
25744 protected:
25745 QObject *c;
25746 };
25747 class __attribute__((visibility("default"))) QDynamicPropertyChangeEvent : public QEvent
25748 {
25749 public:
25750 QDynamicPropertyChangeEvent(const QByteArray &name);
25751 ~QDynamicPropertyChangeEvent();
25752 inline QByteArray propertyName() const { return n; }
25753 private:
25754 QByteArray n;
25755 };
25756 typedef QtValidLicenseForCoreModule QtCoreModule;
25757 class __attribute__((visibility("default"))) QMetaType {
25758 public:
25759 enum Type {
25760 Void = 0, Bool = 1, Int = 2, UInt = 3, LongLong = 4, ULongLong = 5,
25761 Double = 6, QChar = 7, QVariantMap = 8, QVariantList = 9,
25762 QString = 10, QStringList = 11, QByteArray = 12,
25763 QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17,
25764 QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22,
25765 QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27,
25766 QVariantHash = 28, LastCoreType = 28 ,
25767 FirstGuiType = 63 ,
25768 QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
25769 QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
25770 QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77,
25771 QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81,
25772 LastGuiType = 81 ,
25773 FirstCoreExtType = 128 ,
25774 VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132,
25775 UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137,
25776 LastCoreExtType = 137 ,
25777 User = 256
25778 };
25779 typedef void (*Destructor)(void *);
25780 typedef void *(*Constructor)(const void *);
25781 typedef void (*SaveOperator)(QDataStream &, const void *);
25782 typedef void (*LoadOperator)(QDataStream &, void *);
25783 static void registerStreamOperators(const char *typeName, SaveOperator saveOp,
25784 LoadOperator loadOp);
25785 static int registerType(const char *typeName, Destructor destructor,
25786 Constructor constructor);
25787 static int type(const char *typeName);
25788 static const char *typeName(int type);
25789 static bool isRegistered(int type);
25790 static void *construct(int type, const void *copy = 0);
25791 static void destroy(int type, void *data);
25792 static void unregisterType(const char *typeName);
25793 static bool save(QDataStream &stream, int type, const void *data);
25794 static bool load(QDataStream &stream, int type, void *data);
25795 };
25796 template <typename T>
25797 void qMetaTypeDeleteHelper(T *t)
25798 {
25799 delete t;
25800 }
25801 template <typename T>
25802 void *qMetaTypeConstructHelper(const T *t)
25803 {
25804 if (!t)
25805 return new T;
25806 return new T(*static_cast<const T*>(t));
25807 }
25808 template <typename T>
25809 void qMetaTypeSaveHelper(QDataStream &stream, const T *t)
25810 {
25811 stream << *t;
25812 }
25813 template <typename T>
25814 void qMetaTypeLoadHelper(QDataStream &stream, T *t)
25815 {
25816 stream >> *t;
25817 }
25818 template <typename T>
25819 int qRegisterMetaType(const char *typeName
25820 , T * = 0
25821 )
25822 {
25823 typedef void*(*ConstructPtr)(const T*);
25824 ConstructPtr cptr = qMetaTypeConstructHelper<T>;
25825 typedef void(*DeletePtr)(T*);
25826 DeletePtr dptr = qMetaTypeDeleteHelper<T>;
25827 return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Destructor>(dptr),
25828 reinterpret_cast<QMetaType::Constructor>(cptr));
25829 }
25830 template <typename T>
25831 void qRegisterMetaTypeStreamOperators(const char *typeName
25832 , T * = 0
25833 )
25834 {
25835 typedef void(*SavePtr)(QDataStream &, const T *);
25836 typedef void(*LoadPtr)(QDataStream &, T *);
25837 SavePtr sptr = qMetaTypeSaveHelper<T>;
25838 LoadPtr lptr = qMetaTypeLoadHelper<T>;
25839 qRegisterMetaType<T>(typeName);
25840 QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(sptr),
25841 reinterpret_cast<QMetaType::LoadOperator>(lptr));
25842 }
25843 template <typename T>
25844 struct QMetaTypeId
25845 {
25846 enum { Defined = 0 };
25847 };
25848 template <typename T>
25849 struct QMetaTypeId2
25850 {
25851 enum { Defined = QMetaTypeId<T>::Defined };
25852 static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
25853 };
25854 template <typename T>
25855 inline int qMetaTypeId(
25856 T * = 0
25857 )
25858 {
25859 return QMetaTypeId2<T>::qt_metatype_id();
25860 }
25861 template <typename T>
25862 inline int qRegisterMetaType(
25863 T * dummy = 0
25864 )
25865 {
25866 return qMetaTypeId(dummy);
25867 }
25868 class QString;
25869 class QByteArray;
25870 class QChar;
25871 class QStringList;
25872 class QBitArray;
25873 class QDate;
25874 class QTime;
25875 class QDateTime;
25876 class QUrl;
25877 class QLocale;
25878 class QRect;
25879 class QRectF;
25880 class QSize;
25881 class QSizeF;
25882 class QLine;
25883 class QLineF;
25884 class QPoint;
25885 class QPointF;
25886 class QRegExp;
25887 class QWidget;
25888 class QObject;
25889 class QFont;
25890 class QPixmap;
25891 class QBrush;
25892 class QColor;
25893 class QPalette;
25894 class QIcon;
25895 class QImage;
25896 class QPolygon;
25897 class QRegion;
25898 class QBitmap;
25899 class QCursor;
25900 class QSizePolicy;
25901 class QKeySequence;
25902 class QPen;
25903 class QTextLength;
25904 class QTextFormat;
25905 class QMatrix;
25906 class QTransform;
25907 template<> struct QMetaTypeId2<QString> { enum { Defined = 1, MetaType = QMetaType::QString }; static inline int qt_metatype_id() { return QMetaType::QString; } };
25908 template<> struct QMetaTypeId2<int> { enum { Defined = 1, MetaType = QMetaType::Int }; static inline int qt_metatype_id() { return QMetaType::Int; } };
25909 template<> struct QMetaTypeId2<uint> { enum { Defined = 1, MetaType = QMetaType::UInt }; static inline int qt_metatype_id() { return QMetaType::UInt; } };
25910 template<> struct QMetaTypeId2<bool> { enum { Defined = 1, MetaType = QMetaType::Bool }; static inline int qt_metatype_id() { return QMetaType::Bool; } };
25911 template<> struct QMetaTypeId2<double> { enum { Defined = 1, MetaType = QMetaType::Double }; static inline int qt_metatype_id() { return QMetaType::Double; } };
25912 template<> struct QMetaTypeId2<QByteArray> { enum { Defined = 1, MetaType = QMetaType::QByteArray }; static inline int qt_metatype_id() { return QMetaType::QByteArray; } };
25913 template<> struct QMetaTypeId2<QChar> { enum { Defined = 1, MetaType = QMetaType::QChar }; static inline int qt_metatype_id() { return QMetaType::QChar; } };
25914 template<> struct QMetaTypeId2<long> { enum { Defined = 1, MetaType = QMetaType::Long }; static inline int qt_metatype_id() { return QMetaType::Long; } };
25915 template<> struct QMetaTypeId2<short> { enum { Defined = 1, MetaType = QMetaType::Short }; static inline int qt_metatype_id() { return QMetaType::Short; } };
25916 template<> struct QMetaTypeId2<char> { enum { Defined = 1, MetaType = QMetaType::Char }; static inline int qt_metatype_id() { return QMetaType::Char; } };
25917 template<> struct QMetaTypeId2<ulong> { enum { Defined = 1, MetaType = QMetaType::ULong }; static inline int qt_metatype_id() { return QMetaType::ULong; } };
25918 template<> struct QMetaTypeId2<ushort> { enum { Defined = 1, MetaType = QMetaType::UShort }; static inline int qt_metatype_id() { return QMetaType::UShort; } };
25919 template<> struct QMetaTypeId2<uchar> { enum { Defined = 1, MetaType = QMetaType::UChar }; static inline int qt_metatype_id() { return QMetaType::UChar; } };
25920 template<> struct QMetaTypeId2<float> { enum { Defined = 1, MetaType = QMetaType::Float }; static inline int qt_metatype_id() { return QMetaType::Float; } };
25921 template<> struct QMetaTypeId2<QObject *> { enum { Defined = 1, MetaType = QMetaType::QObjectStar }; static inline int qt_metatype_id() { return QMetaType::QObjectStar; } };
25922 template<> struct QMetaTypeId2<QWidget *> { enum { Defined = 1, MetaType = QMetaType::QWidgetStar }; static inline int qt_metatype_id() { return QMetaType::QWidgetStar; } };
25923 template<> struct QMetaTypeId2<void *> { enum { Defined = 1, MetaType = QMetaType::VoidStar }; static inline int qt_metatype_id() { return QMetaType::VoidStar; } };
25924 template<> struct QMetaTypeId2<qlonglong> { enum { Defined = 1, MetaType = QMetaType::LongLong }; static inline int qt_metatype_id() { return QMetaType::LongLong; } };
25925 template<> struct QMetaTypeId2<qulonglong> { enum { Defined = 1, MetaType = QMetaType::ULongLong }; static inline int qt_metatype_id() { return QMetaType::ULongLong; } };
25926 template<> struct QMetaTypeId2<QStringList> { enum { Defined = 1, MetaType = QMetaType::QStringList }; static inline int qt_metatype_id() { return QMetaType::QStringList; } };
25927 template<> struct QMetaTypeId2<QBitArray> { enum { Defined = 1, MetaType = QMetaType::QBitArray }; static inline int qt_metatype_id() { return QMetaType::QBitArray; } };
25928 template<> struct QMetaTypeId2<QDate> { enum { Defined = 1, MetaType = QMetaType::QDate }; static inline int qt_metatype_id() { return QMetaType::QDate; } };
25929 template<> struct QMetaTypeId2<QTime> { enum { Defined = 1, MetaType = QMetaType::QTime }; static inline int qt_metatype_id() { return QMetaType::QTime; } };
25930 template<> struct QMetaTypeId2<QDateTime> { enum { Defined = 1, MetaType = QMetaType::QDateTime }; static inline int qt_metatype_id() { return QMetaType::QDateTime; } };
25931 template<> struct QMetaTypeId2<QUrl> { enum { Defined = 1, MetaType = QMetaType::QUrl }; static inline int qt_metatype_id() { return QMetaType::QUrl; } };
25932 template<> struct QMetaTypeId2<QLocale> { enum { Defined = 1, MetaType = QMetaType::QLocale }; static inline int qt_metatype_id() { return QMetaType::QLocale; } };
25933 template<> struct QMetaTypeId2<QRect> { enum { Defined = 1, MetaType = QMetaType::QRect }; static inline int qt_metatype_id() { return QMetaType::QRect; } };
25934 template<> struct QMetaTypeId2<QRectF> { enum { Defined = 1, MetaType = QMetaType::QRectF }; static inline int qt_metatype_id() { return QMetaType::QRectF; } };
25935 template<> struct QMetaTypeId2<QSize> { enum { Defined = 1, MetaType = QMetaType::QSize }; static inline int qt_metatype_id() { return QMetaType::QSize; } };
25936 template<> struct QMetaTypeId2<QSizeF> { enum { Defined = 1, MetaType = QMetaType::QSizeF }; static inline int qt_metatype_id() { return QMetaType::QSizeF; } };
25937 template<> struct QMetaTypeId2<QLine> { enum { Defined = 1, MetaType = QMetaType::QLine }; static inline int qt_metatype_id() { return QMetaType::QLine; } };
25938 template<> struct QMetaTypeId2<QLineF> { enum { Defined = 1, MetaType = QMetaType::QLineF }; static inline int qt_metatype_id() { return QMetaType::QLineF; } };
25939 template<> struct QMetaTypeId2<QPoint> { enum { Defined = 1, MetaType = QMetaType::QPoint }; static inline int qt_metatype_id() { return QMetaType::QPoint; } };
25940 template<> struct QMetaTypeId2<QPointF> { enum { Defined = 1, MetaType = QMetaType::QPointF }; static inline int qt_metatype_id() { return QMetaType::QPointF; } };
25941 template<> struct QMetaTypeId2<QRegExp> { enum { Defined = 1, MetaType = QMetaType::QRegExp }; static inline int qt_metatype_id() { return QMetaType::QRegExp; } };
25942 template<> struct QMetaTypeId2<QFont> { enum { Defined = 1, MetaType = QMetaType::QFont }; static inline int qt_metatype_id() { return QMetaType::QFont; } };
25943 template<> struct QMetaTypeId2<QPixmap> { enum { Defined = 1, MetaType = QMetaType::QPixmap }; static inline int qt_metatype_id() { return QMetaType::QPixmap; } };
25944 template<> struct QMetaTypeId2<QBrush> { enum { Defined = 1, MetaType = QMetaType::QBrush }; static inline int qt_metatype_id() { return QMetaType::QBrush; } };
25945 template<> struct QMetaTypeId2<QColor> { enum { Defined = 1, MetaType = QMetaType::QColor }; static inline int qt_metatype_id() { return QMetaType::QColor; } };
25946 template<> struct QMetaTypeId2<QPalette> { enum { Defined = 1, MetaType = QMetaType::QPalette }; static inline int qt_metatype_id() { return QMetaType::QPalette; } };
25947 template<> struct QMetaTypeId2<QIcon> { enum { Defined = 1, MetaType = QMetaType::QIcon }; static inline int qt_metatype_id() { return QMetaType::QIcon; } };
25948 template<> struct QMetaTypeId2<QImage> { enum { Defined = 1, MetaType = QMetaType::QImage }; static inline int qt_metatype_id() { return QMetaType::QImage; } };
25949 template<> struct QMetaTypeId2<QPolygon> { enum { Defined = 1, MetaType = QMetaType::QPolygon }; static inline int qt_metatype_id() { return QMetaType::QPolygon; } };
25950 template<> struct QMetaTypeId2<QRegion> { enum { Defined = 1, MetaType = QMetaType::QRegion }; static inline int qt_metatype_id() { return QMetaType::QRegion; } };
25951 template<> struct QMetaTypeId2<QBitmap> { enum { Defined = 1, MetaType = QMetaType::QBitmap }; static inline int qt_metatype_id() { return QMetaType::QBitmap; } };
25952 template<> struct QMetaTypeId2<QCursor> { enum { Defined = 1, MetaType = QMetaType::QCursor }; static inline int qt_metatype_id() { return QMetaType::QCursor; } };
25953 template<> struct QMetaTypeId2<QSizePolicy> { enum { Defined = 1, MetaType = QMetaType::QSizePolicy }; static inline int qt_metatype_id() { return QMetaType::QSizePolicy; } };
25954 template<> struct QMetaTypeId2<QKeySequence> { enum { Defined = 1, MetaType = QMetaType::QKeySequence }; static inline int qt_metatype_id() { return QMetaType::QKeySequence; } };
25955 template<> struct QMetaTypeId2<QPen> { enum { Defined = 1, MetaType = QMetaType::QPen }; static inline int qt_metatype_id() { return QMetaType::QPen; } };
25956 template<> struct QMetaTypeId2<QTextLength> { enum { Defined = 1, MetaType = QMetaType::QTextLength }; static inline int qt_metatype_id() { return QMetaType::QTextLength; } };
25957 template<> struct QMetaTypeId2<QTextFormat> { enum { Defined = 1, MetaType = QMetaType::QTextFormat }; static inline int qt_metatype_id() { return QMetaType::QTextFormat; } };
25958 template<> struct QMetaTypeId2<QMatrix> { enum { Defined = 1, MetaType = QMetaType::QMatrix }; static inline int qt_metatype_id() { return QMetaType::QMatrix; } };
25959 template<> struct QMetaTypeId2<QTransform> { enum { Defined = 1, MetaType = QMetaType::QTransform }; static inline int qt_metatype_id() { return QMetaType::QTransform; } };
25960 typedef QtValidLicenseForCoreModule QtCoreModule;
25961 class QBitArray;
25962 class QDataStream;
25963 class QDate;
25964 class QDateTime;
25965 class QLine;
25966 class QLineF;
25967 class QLocale;
25968 class QMatrix;
25969 class QTransform;
25970 class QStringList;
25971 class QTime;
25972 class QPoint;
25973 class QPointF;
25974 class QSize;
25975 class QSizeF;
25976 class QRect;
25977 class QRectF;
25978 class QRegExp;
25979 class QTextFormat;
25980 class QTextLength;
25981 class QUrl;
25982 class QVariant;
25983 class QVariantComparisonHelper;
25984 template <typename T>
25985 inline QVariant qVariantFromValue(const T &);
25986 template <typename T>
25987 inline void qVariantSetValue(QVariant &, const T &);
25988 template<typename T>
25989 inline T qVariantValue(const QVariant &);
25990 template<typename T>
25991 inline bool qVariantCanConvert(const QVariant &);
25992 class __attribute__((visibility("default"))) QVariant
25993 {
25994 public:
25995 enum Type {
25996 Invalid = 0,
25997 Bool = 1,
25998 Int = 2,
25999 UInt = 3,
26000 LongLong = 4,
26001 ULongLong = 5,
26002 Double = 6,
26003 Char = 7,
26004 Map = 8,
26005 List = 9,
26006 String = 10,
26007 StringList = 11,
26008 ByteArray = 12,
26009 BitArray = 13,
26010 Date = 14,
26011 Time = 15,
26012 DateTime = 16,
26013 Url = 17,
26014 Locale = 18,
26015 Rect = 19,
26016 RectF = 20,
26017 Size = 21,
26018 SizeF = 22,
26019 Line = 23,
26020 LineF = 24,
26021 Point = 25,
26022 PointF = 26,
26023 RegExp = 27,
26024 Hash = 28,
26025 LastCoreType = Hash,
26026 Font = 64,
26027 Pixmap = 65,
26028 Brush = 66,
26029 Color = 67,
26030 Palette = 68,
26031 Icon = 69,
26032 Image = 70,
26033 Polygon = 71,
26034 Region = 72,
26035 Bitmap = 73,
26036 Cursor = 74,
26037 SizePolicy = 75,
26038 KeySequence = 76,
26039 Pen = 77,
26040 TextLength = 78,
26041 TextFormat = 79,
26042 Matrix = 80,
26043 Transform = 81,
26044 LastGuiType = Transform,
26045 UserType = 127,
26046 LastType = 0xffffffff
26047 };
26048 inline QVariant();
26049 ~QVariant();
26050 QVariant(Type type);
26051 QVariant(int typeOrUserType, const void *copy);
26052 QVariant(const QVariant &other);
26053 QVariant(QDataStream &s);
26054 QVariant(int i);
26055 QVariant(uint ui);
26056 QVariant(qlonglong ll);
26057 QVariant(qulonglong ull);
26058 QVariant(bool b);
26059 QVariant(double d);
26060 __attribute__ ((__deprecated__)) QVariant(const char *str);
26061 QVariant(const QByteArray &bytearray);
26062 QVariant(const QBitArray &bitarray);
26063 QVariant(const QString &string);
26064 QVariant(const QLatin1String &string);
26065 QVariant(const QStringList &stringlist);
26066 QVariant(const QChar &qchar);
26067 QVariant(const QDate &date);
26068 QVariant(const QTime &time);
26069 QVariant(const QDateTime &datetime);
26070 QVariant(const QList<QVariant> &list);
26071 QVariant(const QMap<QString,QVariant> &map);
26072 QVariant(const QHash<QString,QVariant> &hash);
26073 QVariant(const QSize &size);
26074 QVariant(const QSizeF &size);
26075 QVariant(const QPoint &pt);
26076 QVariant(const QPointF &pt);
26077 QVariant(const QLine &line);
26078 QVariant(const QLineF &line);
26079 QVariant(const QRect &rect);
26080 QVariant(const QRectF &rect);
26081 QVariant(const QUrl &url);
26082 QVariant(const QLocale &locale);
26083 QVariant(const QRegExp &regExp);
26084 QVariant(Qt::GlobalColor color);
26085 QVariant& operator=(const QVariant &other);
26086 Type type() const;
26087 int userType() const;
26088 const char *typeName() const;
26089 bool canConvert(Type t) const;
26090 bool convert(Type t);
26091 inline bool isValid() const;
26092 bool isNull() const;
26093 void clear();
26094 void detach();
26095 inline bool isDetached() const;
26096 int toInt(bool *ok = 0) const;
26097 uint toUInt(bool *ok = 0) const;
26098 qlonglong toLongLong(bool *ok = 0) const;
26099 qulonglong toULongLong(bool *ok = 0) const;
26100 bool toBool() const;
26101 double toDouble(bool *ok = 0) const;
26102 QByteArray toByteArray() const;
26103 QBitArray toBitArray() const;
26104 QString toString() const;
26105 QStringList toStringList() const;
26106 QChar toChar() const;
26107 QDate toDate() const;
26108 QTime toTime() const;
26109 QDateTime toDateTime() const;
26110 QList<QVariant> toList() const;
26111 QMap<QString, QVariant> toMap() const;
26112 QHash<QString, QVariant> toHash() const;
26113 QPoint toPoint() const;
26114 QPointF toPointF() const;
26115 QRect toRect() const;
26116 QSize toSize() const;
26117 QSizeF toSizeF() const;
26118 QLine toLine() const;
26119 QLineF toLineF() const;
26120 QRectF toRectF() const;
26121 QUrl toUrl() const;
26122 QLocale toLocale() const;
26123 QRegExp toRegExp() const;
26124 void load(QDataStream &ds);
26125 void save(QDataStream &ds) const;
26126 static const char *typeToName(Type type);
26127 static Type nameToType(const char *name);
26128 void *data();
26129 const void *constData() const;
26130 inline const void *data() const { return constData(); }
26131 template<typename T>
26132 inline void setValue(const T &value);
26133 template<typename T>
26134 inline T value() const
26135 { return qVariantValue<T>(*this); }
26136 template<typename T>
26137 static inline QVariant fromValue(const T &value)
26138 { return qVariantFromValue(value); }
26139 template<typename T>
26140 bool canConvert() const
26141 { return qVariantCanConvert<T>(*this); }
26142 public:
26143 struct PrivateShared
26144 {
26145 inline PrivateShared(void *v) : ptr(v), ref(1) { }
26146 void *ptr;
26147 QAtomicInt ref;
26148 };
26149 struct Private
26150 {
26151 inline Private(): type(Invalid), is_shared(false), is_null(true) { data.ptr = 0; }
26152 inline Private(const Private &other)
26153 : data(other.data), type(other.type),
26154 is_shared(other.is_shared), is_null(other.is_null)
26155 {}
26156 union Data
26157 {
26158 char c;
26159 int i;
26160 uint u;
26161 bool b;
26162 double d;
26163 qlonglong ll;
26164 qulonglong ull;
26165 void *ptr;
26166 PrivateShared *shared;
26167 } data;
26168 uint type : 30;
26169 uint is_shared : 1;
26170 uint is_null : 1;
26171 };
26172 public:
26173 typedef void (*f_construct)(Private *, const void *);
26174 typedef void (*f_clear)(Private *);
26175 typedef bool (*f_null)(const Private *);
26176 typedef void (*f_load)(Private *, QDataStream &);
26177 typedef void (*f_save)(const Private *, QDataStream &);
26178 typedef bool (*f_compare)(const Private *, const Private *);
26179 typedef bool (*f_convert)(const QVariant::Private *d, Type t, void *, bool *);
26180 typedef bool (*f_canConvert)(const QVariant::Private *d, Type t);
26181 typedef void (*f_debugStream)(QDebug, const QVariant &);
26182 struct Handler {
26183 f_construct construct;
26184 f_clear clear;
26185 f_null isNull;
26186 f_load load;
26187 f_save save;
26188 f_compare compare;
26189 f_convert convert;
26190 f_canConvert canConvert;
26191 f_debugStream debugStream;
26192 };
26193 inline bool operator==(const QVariant &v) const
26194 { return cmp(v); }
26195 inline bool operator!=(const QVariant &v) const
26196 { return !cmp(v); }
26197 protected:
26198 friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
26199 friend int qRegisterGuiVariant();
26200 friend int qUnregisterGuiVariant();
26201 friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
26202 friend __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QVariant &);
26203 Private d;
26204 static const Handler *handler;
26205 void create(int type, const void *copy);
26206 bool cmp(const QVariant &other) const;
26207 private:
26208 inline QVariant(void *) { qt_noop(); }
26209 inline QVariant(bool, int) { qt_noop(); }
26210 public:
26211 typedef Private DataPtr;
26212 inline DataPtr &data_ptr() { return d; }
26213 };
26214 typedef QList<QVariant> QVariantList;
26215 typedef QMap<QString, QVariant> QVariantMap;
26216 typedef QHash<QString, QVariant> QVariantHash;
26217 inline bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr)
26218 { return QVariant::handler->convert(&v.d, tp, ptr, 0); }
26219 template <typename T>
26220 inline QVariant qVariantFromValue(const T &t)
26221 {
26222 return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t);
26223 }
26224 template <>
26225 inline QVariant qVariantFromValue(const QVariant &t) { return t; }
26226 template <typename T>
26227 inline void qVariantSetValue(QVariant &v, const T &t)
26228 {
26229 v = QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t);
26230 }
26231 inline QVariant::QVariant() {}
26232 inline bool QVariant::isValid() const { return d.type != Invalid; }
26233 template<typename T>
26234 inline void QVariant::setValue(const T &avalue)
26235 { qVariantSetValue(*this, avalue); }
26236 __attribute__((visibility("default"))) QDataStream& operator>> (QDataStream& s, QVariant& p);
26237 __attribute__((visibility("default"))) QDataStream& operator<< (QDataStream& s, const QVariant& p);
26238 __attribute__((visibility("default"))) QDataStream& operator>> (QDataStream& s, QVariant::Type& p);
26239 __attribute__((visibility("default"))) QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
26240 inline bool QVariant::isDetached() const
26241 { return !d.is_shared || d.data.shared->ref == 1; }
26242 class QVariantComparisonHelper
26243 {
26244 public:
26245 inline QVariantComparisonHelper(const QVariant &var)
26246 : v(&var) {}
26247 private:
26248 friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
26249 const QVariant *v;
26250 };
26251 inline bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2)
26252 {
26253 return v1.cmp(*v2.v);
26254 }
26255 inline bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2)
26256 {
26257 return !operator==(v1, v2);
26258 }
26259 template<typename T> T qvariant_cast(const QVariant &v)
26260 {
26261 const int vid = qMetaTypeId<T>(static_cast<T *>(0));
26262 if (vid == v.userType())
26263 return *reinterpret_cast<const T *>(v.constData());
26264 if (vid < int(QMetaType::User)) {
26265 T t;
26266 if (qvariant_cast_helper(v, QVariant::Type(vid), &t))
26267 return t;
26268 }
26269 return T();
26270 }
26271 template<typename T>
26272 inline T qVariantValue(const QVariant &variant)
26273 { return qvariant_cast<T>(variant); }
26274 template<typename T>
26275 inline bool qVariantCanConvert(const QVariant &variant)
26276 {
26277 return variant.canConvert(static_cast<QVariant::Type>(
26278 qMetaTypeId<T>(static_cast<T *>(0))));
26279 }
26280 template <> inline bool qIsDetached<QVariant>(QVariant &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QVariant>(QVariant &value1, QVariant &value2) { const QVariant::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
26281 template <> class QTypeInfo<QVariant> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QVariant)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QVariant"; } };
26282 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QVariant &);
26283 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QVariant::Type);
26284 template<> struct QMetaTypeId2<QVariantList> { enum { Defined = 1, MetaType = QMetaType::QVariantList }; static inline int qt_metatype_id() { return QMetaType::QVariantList; } };
26285 template<> struct QMetaTypeId2<QVariantMap> { enum { Defined = 1, MetaType = QMetaType::QVariantMap }; static inline int qt_metatype_id() { return QMetaType::QVariantMap; } };
26286 template<> struct QMetaTypeId2<QVariantHash> { enum { Defined = 1, MetaType = QMetaType::QVariantHash }; static inline int qt_metatype_id() { return QMetaType::QVariantHash; } };
26287 typedef QtValidLicenseForCoreModule QtCoreModule;
26288 class QUrl;
26289 class QMimeDataPrivate;
26290 class __attribute__((visibility("default"))) QMimeData : public QObject
26291 {
26292 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
26293 public:
26294 QMimeData();
26295 ~QMimeData();
26296 QList<QUrl> urls() const;
26297 void setUrls(const QList<QUrl> &urls);
26298 bool hasUrls() const;
26299 QString text() const;
26300 void setText(const QString &text);
26301 bool hasText() const;
26302 QString html() const;
26303 void setHtml(const QString &html);
26304 bool hasHtml() const;
26305 QVariant imageData() const;
26306 void setImageData(const QVariant &image);
26307 bool hasImage() const;
26308 QVariant colorData() const;
26309 void setColorData(const QVariant &color);
26310 bool hasColor() const;
26311 QByteArray data(const QString &mimetype) const;
26312 void setData(const QString &mimetype, const QByteArray &data);
26313 void removeFormat(const QString &mimetype);
26314 virtual bool hasFormat(const QString &mimetype) const;
26315 virtual QStringList formats() const;
26316 void clear();
26317 protected:
26318 virtual QVariant retrieveData(const QString &mimetype,
26319 QVariant::Type preferredType) const;
26320 private:
26321 QMimeData(const QMimeData &); QMimeData &operator=(const QMimeData &);
26322 inline QMimeDataPrivate* d_func() { return reinterpret_cast<QMimeDataPrivate *>(d_ptr); } inline const QMimeDataPrivate* d_func() const { return reinterpret_cast<const QMimeDataPrivate *>(d_ptr); } friend class QMimeDataPrivate;
26323 };
26324 typedef QtValidLicenseForGuiModule QtGuiModule;
26325 class __attribute__((visibility("default"))) QMimeSource
26326 {
26327 public:
26328 virtual ~QMimeSource();
26329 virtual const char* format(int n = 0) const = 0;
26330 virtual bool provides(const char*) const;
26331 virtual QByteArray encodedData(const char*) const = 0;
26332 };
26333 typedef QtValidLicenseForGuiModule QtGuiModule;
26334 class QMimeData;
26335 class QDragPrivate;
26336 class QWidget;
26337 class QPixmap;
26338 class QPoint;
26339 class QDragManager;
26340 class __attribute__((visibility("default"))) QDrag : public QObject
26341 {
26342 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
26343 inline QDragPrivate* d_func() { return reinterpret_cast<QDragPrivate *>(d_ptr); } inline const QDragPrivate* d_func() const { return reinterpret_cast<const QDragPrivate *>(d_ptr); } friend class QDragPrivate;
26344 public:
26345 explicit QDrag(QWidget *dragSource);
26346 ~QDrag();
26347 void setMimeData(QMimeData *data);
26348 QMimeData *mimeData() const;
26349 void setPixmap(const QPixmap &);
26350 QPixmap pixmap() const;
26351 void setHotSpot(const QPoint &hotspot);
26352 QPoint hotSpot() const;
26353 QWidget *source() const;
26354 QWidget *target() const;
26355 Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction);
26356 Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
26357 Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
26358 void setDragCursor(const QPixmap &cursor, Qt::DropAction action);
26359 protected:
26360 void actionChanged(Qt::DropAction action);
26361 void targetChanged(QWidget *newTarget);
26362 private:
26363 friend class QDragManager;
26364 QDrag(const QDrag &); QDrag &operator=(const QDrag &);
26365 };
26366 typedef QtValidLicenseForGuiModule QtGuiModule;
26367 class QAction;
26368 class __attribute__((visibility("default"))) QInputEvent : public QEvent
26369 {
26370 public:
26371 QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
26372 ~QInputEvent();
26373 inline Qt::KeyboardModifiers modifiers() const { return modState; }
26374 protected:
26375 Qt::KeyboardModifiers modState;
26376 };
26377 class __attribute__((visibility("default"))) QMouseEvent : public QInputEvent
26378 {
26379 public:
26380 QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
26381 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
26382 QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
26383 Qt::MouseButton button, Qt::MouseButtons buttons,
26384 Qt::KeyboardModifiers modifiers);
26385 ~QMouseEvent();
26386 inline const QPoint &pos() const { return p; }
26387 inline const QPoint &globalPos() const { return g; }
26388 inline int x() const { return p.x(); }
26389 inline int y() const { return p.y(); }
26390 inline int globalX() const { return g.x(); }
26391 inline int globalY() const { return g.y(); }
26392 inline Qt::MouseButton button() const { return b; }
26393 inline Qt::MouseButtons buttons() const { return mouseState; }
26394 static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos,
26395 const QPoint &globalPos, Qt::MouseButton button,
26396 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
26397 inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; }
26398 QPointF posF() const;
26399 protected:
26400 QPoint p, g;
26401 Qt::MouseButton b;
26402 Qt::MouseButtons mouseState;
26403 };
26404 class __attribute__((visibility("default"))) QHoverEvent : public QEvent
26405 {
26406 public:
26407 QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
26408 ~QHoverEvent();
26409 inline const QPoint &pos() const { return p; }
26410 inline const QPoint &oldPos() const { return op; }
26411 protected:
26412 QPoint p, op;
26413 };
26414 class __attribute__((visibility("default"))) QWheelEvent : public QInputEvent
26415 {
26416 public:
26417 QWheelEvent(const QPoint &pos, int delta,
26418 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
26419 Qt::Orientation orient = Qt::Vertical);
26420 QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
26421 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
26422 Qt::Orientation orient = Qt::Vertical);
26423 ~QWheelEvent();
26424 inline int delta() const { return d; }
26425 inline const QPoint &pos() const { return p; }
26426 inline const QPoint &globalPos() const { return g; }
26427 inline int x() const { return p.x(); }
26428 inline int y() const { return p.y(); }
26429 inline int globalX() const { return g.x(); }
26430 inline int globalY() const { return g.y(); }
26431 inline Qt::MouseButtons buttons() const { return mouseState; }
26432 Qt::Orientation orientation() const { return o; }
26433 protected:
26434 QPoint p;
26435 QPoint g;
26436 int d;
26437 Qt::MouseButtons mouseState;
26438 Qt::Orientation o;
26439 };
26440 class __attribute__((visibility("default"))) QTabletEvent : public QInputEvent
26441 {
26442 public:
26443 enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
26444 XFreeEraser , RotationStylus };
26445 enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
26446 QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
26447 int device, int pointerType, qreal pressure, int xTilt, int yTilt,
26448 qreal tangentialPressure, qreal rotation, int z,
26449 Qt::KeyboardModifiers keyState, qint64 uniqueID);
26450 ~QTabletEvent();
26451 inline const QPoint &pos() const { return mPos; }
26452 inline const QPoint &globalPos() const { return mGPos; }
26453 inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
26454 inline int x() const { return mPos.x(); }
26455 inline int y() const { return mPos.y(); }
26456 inline int globalX() const { return mGPos.x(); }
26457 inline int globalY() const { return mGPos.y(); }
26458 inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
26459 inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
26460 inline TabletDevice device() const { return TabletDevice(mDev); }
26461 inline PointerType pointerType() const { return PointerType(mPointerType); }
26462 inline qint64 uniqueId() const { return mUnique; }
26463 inline qreal pressure() const { return mPress; }
26464 inline int z() const { return mZ; }
26465 inline qreal tangentialPressure() const { return mTangential; }
26466 inline qreal rotation() const { return mRot; }
26467 inline int xTilt() const { return mXT; }
26468 inline int yTilt() const { return mYT; }
26469 protected:
26470 QPoint mPos, mGPos;
26471 QPointF mHiResGlobalPos;
26472 int mDev, mPointerType, mXT, mYT, mZ;
26473 qreal mPress, mTangential, mRot;
26474 qint64 mUnique;
26475 void *mExtra;
26476 };
26477 class __attribute__((visibility("default"))) QKeyEvent : public QInputEvent
26478 {
26479 public:
26480 QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
26481 bool autorep = false, ushort count = 1);
26482 ~QKeyEvent();
26483 int key() const { return k; }
26484 bool matches(QKeySequence::StandardKey key) const;
26485 Qt::KeyboardModifiers modifiers() const;
26486 inline QString text() const { return txt; }
26487 inline bool isAutoRepeat() const { return autor; }
26488 inline int count() const { return int(c); }
26489 static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
26490 quint32 nativeScanCode, quint32 nativeVirtualKey,
26491 quint32 nativeModifiers,
26492 const QString& text = QString(), bool autorep = false,
26493 ushort count = 1);
26494 inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
26495 quint32 nativeScanCode() const;
26496 quint32 nativeVirtualKey() const;
26497 quint32 nativeModifiers() const;
26498 protected:
26499 QString txt;
26500 int k;
26501 ushort c;
26502 uint autor:1;
26503 };
26504 class __attribute__((visibility("default"))) QFocusEvent : public QEvent
26505 {
26506 public:
26507 QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
26508 ~QFocusEvent();
26509 inline bool gotFocus() const { return type() == FocusIn; }
26510 inline bool lostFocus() const { return type() == FocusOut; }
26511 Qt::FocusReason reason();
26512 Qt::FocusReason reason() const;
26513 private:
26514 Qt::FocusReason m_reason;
26515 };
26516 class __attribute__((visibility("default"))) QPaintEvent : public QEvent
26517 {
26518 public:
26519 QPaintEvent(const QRegion& paintRegion);
26520 QPaintEvent(const QRect &paintRect);
26521 ~QPaintEvent();
26522 inline const QRect &rect() const { return m_rect; }
26523 inline const QRegion &region() const { return m_region; }
26524 protected:
26525 friend class QApplication;
26526 friend class QCoreApplication;
26527 QRect m_rect;
26528 QRegion m_region;
26529 bool m_erased;
26530 };
26531 class QUpdateLaterEvent : public QEvent
26532 {
26533 public:
26534 QUpdateLaterEvent(const QRegion& paintRegion);
26535 ~QUpdateLaterEvent();
26536 inline const QRegion &region() const { return m_region; }
26537 protected:
26538 QRegion m_region;
26539 };
26540 class __attribute__((visibility("default"))) QMoveEvent : public QEvent
26541 {
26542 public:
26543 QMoveEvent(const QPoint &pos, const QPoint &oldPos);
26544 ~QMoveEvent();
26545 inline const QPoint &pos() const { return p; }
26546 inline const QPoint &oldPos() const { return oldp;}
26547 protected:
26548 QPoint p, oldp;
26549 friend class QApplication;
26550 friend class QCoreApplication;
26551 };
26552 class __attribute__((visibility("default"))) QResizeEvent : public QEvent
26553 {
26554 public:
26555 QResizeEvent(const QSize &size, const QSize &oldSize);
26556 ~QResizeEvent();
26557 inline const QSize &size() const { return s; }
26558 inline const QSize &oldSize()const { return olds;}
26559 protected:
26560 QSize s, olds;
26561 friend class QApplication;
26562 friend class QCoreApplication;
26563 };
26564 class __attribute__((visibility("default"))) QCloseEvent : public QEvent
26565 {
26566 public:
26567 QCloseEvent();
26568 ~QCloseEvent();
26569 };
26570 class __attribute__((visibility("default"))) QIconDragEvent : public QEvent
26571 {
26572 public:
26573 QIconDragEvent();
26574 ~QIconDragEvent();
26575 };
26576 class __attribute__((visibility("default"))) QShowEvent : public QEvent
26577 {
26578 public:
26579 QShowEvent();
26580 ~QShowEvent();
26581 };
26582 class __attribute__((visibility("default"))) QHideEvent : public QEvent
26583 {
26584 public:
26585 QHideEvent();
26586 ~QHideEvent();
26587 };
26588 class __attribute__((visibility("default"))) QContextMenuEvent : public QInputEvent
26589 {
26590 public:
26591 enum Reason { Mouse, Keyboard, Other };
26592 QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
26593 Qt::KeyboardModifiers modifiers);
26594 QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
26595 QContextMenuEvent(Reason reason, const QPoint &pos);
26596 ~QContextMenuEvent();
26597 inline int x() const { return p.x(); }
26598 inline int y() const { return p.y(); }
26599 inline int globalX() const { return gp.x(); }
26600 inline int globalY() const { return gp.y(); }
26601 inline const QPoint& pos() const { return p; }
26602 inline const QPoint& globalPos() const { return gp; }
26603 inline Reason reason() const { return Reason(reas); }
26604 protected:
26605 QPoint p;
26606 QPoint gp;
26607 uint reas : 8;
26608 };
26609 class __attribute__((visibility("default"))) QInputMethodEvent : public QEvent
26610 {
26611 public:
26612 enum AttributeType {
26613 TextFormat,
26614 Cursor,
26615 Language,
26616 Ruby
26617 };
26618 class Attribute {
26619 public:
26620 Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
26621 AttributeType type;
26622 int start;
26623 int length;
26624 QVariant value;
26625 };
26626 QInputMethodEvent();
26627 QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
26628 void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
26629 inline const QList<Attribute> &attributes() const { return attrs; }
26630 inline const QString &preeditString() const { return preedit; }
26631 inline const QString &commitString() const { return commit; }
26632 inline int replacementStart() const { return replace_from; }
26633 inline int replacementLength() const { return replace_length; }
26634 QInputMethodEvent(const QInputMethodEvent &other);
26635 private:
26636 QString preedit;
26637 QList<Attribute> attrs;
26638 QString commit;
26639 int replace_from;
26640 int replace_length;
26641 };
26642 class QMimeData;
26643 class __attribute__((visibility("default"))) QDropEvent : public QEvent
26644 , public QMimeSource
26645 {
26646 public:
26647 QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
26648 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
26649 ~QDropEvent();
26650 inline const QPoint &pos() const { return p; }
26651 inline Qt::MouseButtons mouseButtons() const { return mouseState; }
26652 inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
26653 inline Qt::DropActions possibleActions() const { return act; }
26654 inline Qt::DropAction proposedAction() const { return default_action; }
26655 inline void acceptProposedAction() { drop_action = default_action; accept(); }
26656 inline Qt::DropAction dropAction() const { return drop_action; }
26657 void setDropAction(Qt::DropAction action);
26658 QWidget* source() const;
26659 inline const QMimeData *mimeData() const { return mdata; }
26660 const char* format(int n = 0) const;
26661 QByteArray encodedData(const char*) const;
26662 bool provides(const char*) const;
26663 protected:
26664 friend class QApplication;
26665 QPoint p;
26666 Qt::MouseButtons mouseState;
26667 Qt::KeyboardModifiers modState;
26668 Qt::DropActions act;
26669 Qt::DropAction drop_action;
26670 Qt::DropAction default_action;
26671 const QMimeData *mdata;
26672 mutable QList<QByteArray> fmts;
26673 };
26674 class __attribute__((visibility("default"))) QDragMoveEvent : public QDropEvent
26675 {
26676 public:
26677 QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
26678 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
26679 ~QDragMoveEvent();
26680 inline QRect answerRect() const { return rect; }
26681 inline void accept() { QDropEvent::accept(); }
26682 inline void ignore() { QDropEvent::ignore(); }
26683 inline void accept(const QRect & r) { accept(); rect = r; }
26684 inline void ignore(const QRect & r) { ignore(); rect = r; }
26685 protected:
26686 friend class QApplication;
26687 QRect rect;
26688 };
26689 class __attribute__((visibility("default"))) QDragEnterEvent : public QDragMoveEvent
26690 {
26691 public:
26692 QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
26693 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
26694 ~QDragEnterEvent();
26695 };
26696 class __attribute__((visibility("default"))) QDragResponseEvent : public QEvent
26697 {
26698 public:
26699 QDragResponseEvent(bool accepted);
26700 ~QDragResponseEvent();
26701 inline bool dragAccepted() const { return a; }
26702 protected:
26703 bool a;
26704 };
26705 class __attribute__((visibility("default"))) QDragLeaveEvent : public QEvent
26706 {
26707 public:
26708 QDragLeaveEvent();
26709 ~QDragLeaveEvent();
26710 };
26711 class __attribute__((visibility("default"))) QHelpEvent : public QEvent
26712 {
26713 public:
26714 QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
26715 ~QHelpEvent();
26716 inline int x() const { return p.x(); }
26717 inline int y() const { return p.y(); }
26718 inline int globalX() const { return gp.x(); }
26719 inline int globalY() const { return gp.y(); }
26720 inline const QPoint& pos() const { return p; }
26721 inline const QPoint& globalPos() const { return gp; }
26722 private:
26723 QPoint p;
26724 QPoint gp;
26725 };
26726 class __attribute__((visibility("default"))) QStatusTipEvent : public QEvent
26727 {
26728 public:
26729 QStatusTipEvent(const QString &tip);
26730 ~QStatusTipEvent();
26731 inline QString tip() const { return s; }
26732 private:
26733 QString s;
26734 };
26735 class __attribute__((visibility("default"))) QWhatsThisClickedEvent : public QEvent
26736 {
26737 public:
26738 QWhatsThisClickedEvent(const QString &href);
26739 ~QWhatsThisClickedEvent();
26740 inline QString href() const { return s; }
26741 private:
26742 QString s;
26743 };
26744 class __attribute__((visibility("default"))) QActionEvent : public QEvent
26745 {
26746 QAction *act, *bef;
26747 public:
26748 QActionEvent(int type, QAction *action, QAction *before = 0);
26749 ~QActionEvent();
26750 inline QAction *action() const { return act; }
26751 inline QAction *before() const { return bef; }
26752 };
26753 class __attribute__((visibility("default"))) QFileOpenEvent : public QEvent
26754 {
26755 public:
26756 QFileOpenEvent(const QString &file);
26757 ~QFileOpenEvent();
26758 inline QString file() const { return f; }
26759 private:
26760 QString f;
26761 };
26762 class __attribute__((visibility("default"))) QToolBarChangeEvent : public QEvent
26763 {
26764 public:
26765 QToolBarChangeEvent(bool t);
26766 ~QToolBarChangeEvent();
26767 inline bool toggle() const { return tog; }
26768 private:
26769 uint tog : 1;
26770 };
26771 class __attribute__((visibility("default"))) QShortcutEvent : public QEvent
26772 {
26773 public:
26774 QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
26775 ~QShortcutEvent();
26776 inline const QKeySequence &key() { return sequence; }
26777 inline const QKeySequence &key() const { return sequence; }
26778 inline int shortcutId() { return sid; }
26779 inline int shortcutId() const { return sid; }
26780 inline bool isAmbiguous() { return ambig; }
26781 inline bool isAmbiguous() const { return ambig; }
26782 protected:
26783 QKeySequence sequence;
26784 bool ambig;
26785 int sid;
26786 };
26787 class __attribute__((visibility("default"))) QClipboardEvent : public QEvent
26788 {
26789 public:
26790 QClipboardEvent(QEventPrivate *data);
26791 ~QClipboardEvent();
26792 QEventPrivate *data() { return d; };
26793 };
26794 class __attribute__((visibility("default"))) QWindowStateChangeEvent: public QEvent
26795 {
26796 public:
26797 QWindowStateChangeEvent(Qt::WindowStates aOldState);
26798 QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
26799 ~QWindowStateChangeEvent();
26800 inline Qt::WindowStates oldState() const { return ostate; }
26801 bool isOverride() const;
26802 private:
26803 Qt::WindowStates ostate;
26804 };
26805 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QEvent *);
26806 inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
26807 inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
26808 typedef struct FT_FaceRec_* FT_Face;
26809 typedef QtValidLicenseForGuiModule QtGuiModule;
26810 class QFontPrivate;
26811 class QStringList;
26812 class QVariant;
26813 class Q3TextFormatCollection;
26814 class __attribute__((visibility("default"))) QFont
26815 {
26816 public: static const QMetaObject staticMetaObject; private:
26817 public:
26818 enum StyleHint {
26819 Helvetica, SansSerif = Helvetica,
26820 Times, Serif = Times,
26821 Courier, TypeWriter = Courier,
26822 OldEnglish, Decorative = OldEnglish,
26823 System,
26824 AnyStyle
26825 };
26826 enum StyleStrategy {
26827 PreferDefault = 0x0001,
26828 PreferBitmap = 0x0002,
26829 PreferDevice = 0x0004,
26830 PreferOutline = 0x0008,
26831 ForceOutline = 0x0010,
26832 PreferMatch = 0x0020,
26833 PreferQuality = 0x0040,
26834 PreferAntialias = 0x0080,
26835 NoAntialias = 0x0100,
26836 OpenGLCompatible = 0x0200,
26837 NoFontMerging = 0x8000
26838 };
26839 enum Weight {
26840 Light = 25,
26841 Normal = 50,
26842 DemiBold = 63,
26843 Bold = 75,
26844 Black = 87
26845 };
26846 enum Style {
26847 StyleNormal,
26848 StyleItalic,
26849 StyleOblique
26850 };
26851 enum Stretch {
26852 UltraCondensed = 50,
26853 ExtraCondensed = 62,
26854 Condensed = 75,
26855 SemiCondensed = 87,
26856 Unstretched = 100,
26857 SemiExpanded = 112,
26858 Expanded = 125,
26859 ExtraExpanded = 150,
26860 UltraExpanded = 200
26861 };
26862 enum Capitalization {
26863 MixedCase,
26864 AllUppercase,
26865 AllLowercase,
26866 SmallCaps,
26867 Capitalize
26868 };
26869 enum SpacingType {
26870 PercentageSpacing,
26871 AbsoluteSpacing
26872 };
26873 enum ResolveProperties {
26874 FamilyResolved = 0x0001,
26875 SizeResolved = 0x0002,
26876 StyleHintResolved = 0x0004,
26877 StyleStrategyResolved = 0x0008,
26878 WeightResolved = 0x0010,
26879 StyleResolved = 0x0020,
26880 UnderlineResolved = 0x0040,
26881 OverlineResolved = 0x0080,
26882 StrikeOutResolved = 0x0100,
26883 FixedPitchResolved = 0x0200,
26884 StretchResolved = 0x0400,
26885 KerningResolved = 0x0800,
26886 CapitalizationResolved = 0x1000,
26887 LetterSpacingResolved = 0x2000,
26888 WordSpacingResolved = 0x4000,
26889 AllPropertiesResolved = 0x7fff
26890 };
26891 QFont();
26892 QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false);
26893 QFont(const QFont &, QPaintDevice *pd);
26894 QFont(const QFont &);
26895 ~QFont();
26896 QString family() const;
26897 void setFamily(const QString &);
26898 int pointSize() const;
26899 void setPointSize(int);
26900 qreal pointSizeF() const;
26901 void setPointSizeF(qreal);
26902 int pixelSize() const;
26903 void setPixelSize(int);
26904 int weight() const;
26905 void setWeight(int);
26906 inline bool bold() const;
26907 inline void setBold(bool);
26908 void setStyle(Style style);
26909 Style style() const;
26910 inline bool italic() const;
26911 inline void setItalic(bool b);
26912 bool underline() const;
26913 void setUnderline(bool);
26914 bool overline() const;
26915 void setOverline(bool);
26916 bool strikeOut() const;
26917 void setStrikeOut(bool);
26918 bool fixedPitch() const;
26919 void setFixedPitch(bool);
26920 bool kerning() const;
26921 void setKerning(bool);
26922 StyleHint styleHint() const;
26923 StyleStrategy styleStrategy() const;
26924 void setStyleHint(StyleHint, StyleStrategy = PreferDefault);
26925 void setStyleStrategy(StyleStrategy s);
26926 int stretch() const;
26927 void setStretch(int);
26928 qreal letterSpacing() const;
26929 SpacingType letterSpacingType() const;
26930 void setLetterSpacing(SpacingType type, qreal spacing);
26931 qreal wordSpacing() const;
26932 void setWordSpacing(qreal spacing);
26933 void setCapitalization(Capitalization);
26934 Capitalization capitalization() const;
26935 bool rawMode() const;
26936 void setRawMode(bool);
26937 bool exactMatch() const;
26938 QFont &operator=(const QFont &);
26939 bool operator==(const QFont &) const;
26940 bool operator!=(const QFont &) const;
26941 bool operator<(const QFont &) const;
26942 operator QVariant() const;
26943 bool isCopyOf(const QFont &) const;
26944 Qt::HANDLE handle() const;
26945 FT_Face freetypeFace() const;
26946 void setRawName(const QString &);
26947 QString rawName() const;
26948 QString key() const;
26949 QString toString() const;
26950 bool fromString(const QString &);
26951 static QString substitute(const QString &);
26952 static QStringList substitutes(const QString &);
26953 static QStringList substitutions();
26954 static void insertSubstitution(const QString&, const QString &);
26955 static void insertSubstitutions(const QString&, const QStringList &);
26956 static void removeSubstitution(const QString &);
26957 static void initialize();
26958 static void cleanup();
26959 QString defaultFamily() const;
26960 QString lastResortFamily() const;
26961 QString lastResortFont() const;
26962 QFont resolve(const QFont &) const;
26963 inline uint resolve() const { return resolve_mask; }
26964 inline void resolve(uint mask) { resolve_mask = mask; }
26965 private:
26966 QFont(QFontPrivate *);
26967 void detach();
26968 friend class QFontPrivate;
26969 friend class QFontDialogPrivate;
26970 friend class QFontMetrics;
26971 friend class QFontMetricsF;
26972 friend class QFontInfo;
26973 friend class QPainter;
26974 friend class QPSPrintEngineFont;
26975 friend class QApplication;
26976 friend class QWidget;
26977 friend class QWidgetPrivate;
26978 friend class Q3TextFormatCollection;
26979 friend class QTextLayout;
26980 friend class QTextEngine;
26981 friend class QStackTextEngine;
26982 friend class QTextLine;
26983 friend struct QScriptLine;
26984 friend class QGLContext;
26985 friend class QWin32PaintEngine;
26986 friend class QAlphaPaintEngine;
26987 friend class QPainterPath;
26988 friend class QTextItemInt;
26989 friend class QPicturePaintEngine;
26990 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QFont &);
26991 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QFont &);
26992 QFontPrivate *d;
26993 uint resolve_mask;
26994 };
26995 inline bool QFont::bold() const
26996 { return weight() > Normal; }
26997 inline void QFont::setBold(bool enable)
26998 { setWeight(enable ? Bold : Normal); }
26999 inline bool QFont::italic() const
27000 {
27001 return (style() != StyleNormal);
27002 }
27003 inline void QFont::setItalic(bool b) {
27004 setStyle(b ? StyleItalic : StyleNormal);
27005 }
27006 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QFont &);
27007 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QFont &);
27008 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QFont &);
27009 typedef QtValidLicenseForCoreModule QtCoreModule;
27010 template <class T> class QSharedDataPointer;
27011 class __attribute__((visibility("default"))) QSharedData
27012 {
27013 public:
27014 mutable QAtomicInt ref;
27015 inline QSharedData() : ref(0) { }
27016 inline QSharedData(const QSharedData &) : ref(0) { }
27017 private:
27018 QSharedData &operator=(const QSharedData &);
27019 };
27020 template <class T> class QSharedDataPointer
27021 {
27022 public:
27023 inline void detach() { if (d && d->ref != 1) detach_helper(); }
27024 inline T &operator*() { detach(); return *d; }
27025 inline const T &operator*() const { return *d; }
27026 inline T *operator->() { detach(); return d; }
27027 inline const T *operator->() const { return d; }
27028 inline operator T *() { detach(); return d; }
27029 inline operator const T *() const { return d; }
27030 inline T *data() { detach(); return d; }
27031 inline const T *data() const { return d; }
27032 inline const T *constData() const { return d; }
27033 inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; }
27034 inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; }
27035 inline QSharedDataPointer() { d = 0; }
27036 inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; }
27037 explicit QSharedDataPointer(T *data);
27038 inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); }
27039 inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) {
27040 if (o.d != d) {
27041 if (o.d)
27042 o.d->ref.ref();
27043 if (d && !d->ref.deref())
27044 delete d;
27045 d = o.d;
27046 }
27047 return *this;
27048 }
27049 inline QSharedDataPointer &operator=(T *o) {
27050 if (o != d) {
27051 if (o)
27052 o->ref.ref();
27053 if (d && !d->ref.deref())
27054 delete d;
27055 d = o;
27056 }
27057 return *this;
27058 }
27059 inline bool operator!() const { return !d; }
27060 protected:
27061 T *clone();
27062 private:
27063 void detach_helper();
27064 T *d;
27065 };
27066 template <class T> class QExplicitlySharedDataPointer
27067 {
27068 public:
27069 typedef T Type;
27070 inline T &operator*() const { return *d; }
27071 inline T *operator->() { return d; }
27072 inline T *operator->() const { return d; }
27073 inline T *data() const { return d; }
27074 inline const T *constData() const { return d; }
27075 inline void detach() { if (d && d->ref != 1) detach_helper(); }
27076 inline void reset()
27077 {
27078 if(d && !d->ref.deref())
27079 delete d;
27080 d = 0;
27081 }
27082 inline operator bool () const { return d != 0; }
27083 inline bool operator==(const QExplicitlySharedDataPointer<T> &other) const { return d == other.d; }
27084 inline bool operator!=(const QExplicitlySharedDataPointer<T> &other) const { return d != other.d; }
27085 inline bool operator==(const T *ptr) const { return d == ptr; }
27086 inline bool operator!=(const T *ptr) const { return d != ptr; }
27087 inline QExplicitlySharedDataPointer() { d = 0; }
27088 inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; }
27089 explicit QExplicitlySharedDataPointer(T *data);
27090 inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); }
27091 template<class X>
27092 inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<X> &o) : d(static_cast<T *>(o.data()))
27093 {
27094 if(d)
27095 d->ref.ref();
27096 }
27097 inline QExplicitlySharedDataPointer<T> & operator=(const QExplicitlySharedDataPointer<T> &o) {
27098 if (o.d != d) {
27099 if (o.d)
27100 o.d->ref.ref();
27101 if (d && !d->ref.deref())
27102 delete d;
27103 d = o.d;
27104 }
27105 return *this;
27106 }
27107 inline QExplicitlySharedDataPointer &operator=(T *o) {
27108 if (o != d) {
27109 if (o)
27110 o->ref.ref();
27111 if (d && !d->ref.deref())
27112 delete d;
27113 d = o;
27114 }
27115 return *this;
27116 }
27117 inline bool operator!() const { return !d; }
27118 protected:
27119 T *clone();
27120 private:
27121 void detach_helper();
27122 T *d;
27123 };
27124 template <class T>
27125 inline QSharedDataPointer<T>::QSharedDataPointer(T *adata) : d(adata)
27126 { if (d) d->ref.ref(); }
27127 template <class T>
27128 inline T *QSharedDataPointer<T>::clone()
27129 {
27130 return new T(*d);
27131 }
27132 template <class T>
27133 void QSharedDataPointer<T>::detach_helper()
27134 {
27135 T *x = clone();
27136 x->ref.ref();
27137 if (!d->ref.deref())
27138 delete d;
27139 d = x;
27140 }
27141 template <class T>
27142 inline T *QExplicitlySharedDataPointer<T>::clone()
27143 {
27144 return new T(*d);
27145 }
27146 template <class T>
27147 void QExplicitlySharedDataPointer<T>::detach_helper()
27148 {
27149 T *x = clone();
27150 x->ref.ref();
27151 if (!d->ref.deref())
27152 delete d;
27153 d = x;
27154 }
27155 template <class T>
27156 inline QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(T *adata) : d(adata)
27157 { if (d) d->ref.ref(); }
27158 typedef QtValidLicenseForGuiModule QtGuiModule;
27159 class QMatrix;
27160 class QTransform;
27161 class QRect;
27162 class QVariant;
27163 class __attribute__((visibility("default"))) QPolygon : public QVector<QPoint>
27164 {
27165 public:
27166 inline QPolygon() {}
27167 inline ~QPolygon() {}
27168 inline QPolygon(int size);
27169 inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {}
27170 inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
27171 QPolygon(const QRect &r, bool closed=false);
27172 QPolygon(int nPoints, const int *points);
27173 operator QVariant() const;
27174 void translate(int dx, int dy);
27175 void translate(const QPoint &offset);
27176 QRect boundingRect() const;
27177 void point(int i, int *x, int *y) const;
27178 QPoint point(int i) const;
27179 void setPoint(int index, int x, int y);
27180 void setPoint(int index, const QPoint &p);
27181 void setPoints(int nPoints, const int *points);
27182 void setPoints(int nPoints, int firstx, int firsty, ...);
27183 void putPoints(int index, int nPoints, const int *points);
27184 void putPoints(int index, int nPoints, int firstx, int firsty, ...);
27185 void putPoints(int index, int nPoints, const QPolygon & from, int fromIndex=0);
27186 bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const;
27187 QPolygon united(const QPolygon &r) const;
27188 QPolygon intersected(const QPolygon &r) const;
27189 QPolygon subtracted(const QPolygon &r) const;
27190 };
27191 inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {}
27192 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QPolygon &);
27193 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon);
27194 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &stream, QPolygon &polygon);
27195 inline void QPolygon::setPoint(int index, const QPoint &pt)
27196 { (*this)[index] = pt; }
27197 inline void QPolygon::setPoint(int index, int x, int y)
27198 { (*this)[index] = QPoint(x, y); }
27199 inline QPoint QPolygon::point(int index) const
27200 { return at(index); }
27201 inline void QPolygon::translate(const QPoint &offset)
27202 { translate(offset.x(), offset.y()); }
27203 class QRectF;
27204 class __attribute__((visibility("default"))) QPolygonF : public QVector<QPointF>
27205 {
27206 public:
27207 inline QPolygonF() {}
27208 inline ~QPolygonF() {}
27209 inline QPolygonF(int size);
27210 inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
27211 inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
27212 QPolygonF(const QRectF &r);
27213 QPolygonF(const QPolygon &a);
27214 inline void translate(qreal dx, qreal dy);
27215 void translate(const QPointF &offset);
27216 QPolygon toPolygon() const;
27217 bool isClosed() const { return !isEmpty() && first() == last(); }
27218 QRectF boundingRect() const;
27219 bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
27220 QPolygonF united(const QPolygonF &r) const;
27221 QPolygonF intersected(const QPolygonF &r) const;
27222 QPolygonF subtracted(const QPolygonF &r) const;
27223 };
27224 inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
27225 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QPolygonF &);
27226 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &stream, const QPolygonF &array);
27227 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &stream, QPolygonF &array);
27228 inline void QPolygonF::translate(qreal dx, qreal dy)
27229 { translate(QPointF(dx, dy)); }
27230 typedef QtValidLicenseForCoreModule QtCoreModule;
27231 class __attribute__((visibility("default"))) QLine
27232 {
27233 public:
27234 inline QLine();
27235 inline QLine(const QPoint &pt1, const QPoint &pt2);
27236 inline QLine(int x1, int y1, int x2, int y2);
27237 inline bool isNull() const;
27238 inline QPoint p1() const;
27239 inline QPoint p2() const;
27240 inline int x1() const;
27241 inline int y1() const;
27242 inline int x2() const;
27243 inline int y2() const;
27244 inline int dx() const;
27245 inline int dy() const;
27246 inline void translate(const QPoint &p);
27247 inline void translate(int dx, int dy);
27248 inline QLine translated(const QPoint &p) const;
27249 inline QLine translated(int dx, int dy) const;
27250 inline void setP1(const QPoint &p1);
27251 inline void setP2(const QPoint &p2);
27252 inline void setPoints(const QPoint &p1, const QPoint &p2);
27253 inline void setLine(int x1, int y1, int x2, int y2);
27254 inline bool operator==(const QLine &d) const;
27255 inline bool operator!=(const QLine &d) const { return !(*this == d); }
27256 private:
27257 QPoint pt1, pt2;
27258 };
27259 template <> class QTypeInfo<QLine> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QLine)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QLine"; } };
27260 inline QLine::QLine() { }
27261 inline QLine::QLine(const QPoint &pt1_, const QPoint &pt2_) : pt1(pt1_), pt2(pt2_) { }
27262 inline QLine::QLine(int x1pos, int y1pos, int x2pos, int y2pos) : pt1(QPoint(x1pos, y1pos)), pt2(QPoint(x2pos, y2pos)) { }
27263 inline bool QLine::isNull() const
27264 {
27265 return pt1 == pt2;
27266 }
27267 inline int QLine::x1() const
27268 {
27269 return pt1.x();
27270 }
27271 inline int QLine::y1() const
27272 {
27273 return pt1.y();
27274 }
27275 inline int QLine::x2() const
27276 {
27277 return pt2.x();
27278 }
27279 inline int QLine::y2() const
27280 {
27281 return pt2.y();
27282 }
27283 inline QPoint QLine::p1() const
27284 {
27285 return pt1;
27286 }
27287 inline QPoint QLine::p2() const
27288 {
27289 return pt2;
27290 }
27291 inline int QLine::dx() const
27292 {
27293 return pt2.x() - pt1.x();
27294 }
27295 inline int QLine::dy() const
27296 {
27297 return pt2.y() - pt1.y();
27298 }
27299 inline void QLine::translate(const QPoint &point)
27300 {
27301 pt1 += point;
27302 pt2 += point;
27303 }
27304 inline void QLine::translate(int adx, int ady)
27305 {
27306 this->translate(QPoint(adx, ady));
27307 }
27308 inline QLine QLine::translated(const QPoint &p) const
27309 {
27310 return QLine(pt1 + p, pt2 + p);
27311 }
27312 inline QLine QLine::translated(int adx, int ady) const
27313 {
27314 return translated(QPoint(adx, ady));
27315 }
27316 inline void QLine::setP1(const QPoint &aP1)
27317 {
27318 pt1 = aP1;
27319 }
27320 inline void QLine::setP2(const QPoint &aP2)
27321 {
27322 pt2 = aP2;
27323 }
27324 inline void QLine::setPoints(const QPoint &aP1, const QPoint &aP2)
27325 {
27326 pt1 = aP1;
27327 pt2 = aP2;
27328 }
27329 inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2)
27330 {
27331 pt1 = QPoint(aX1, aY1);
27332 pt2 = QPoint(aX2, aY2);
27333 }
27334 inline bool QLine::operator==(const QLine &d) const
27335 {
27336 return pt1 == d.pt1 && pt2 == d.pt2;
27337 }
27338 __attribute__((visibility("default"))) QDebug operator<<(QDebug d, const QLine &p);
27339 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QLine &);
27340 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QLine &);
27341 class __attribute__((visibility("default"))) QLineF {
27342 public:
27343 enum IntersectType { NoIntersection, BoundedIntersection, UnboundedIntersection };
27344 inline QLineF();
27345 inline QLineF(const QPointF &pt1, const QPointF &pt2);
27346 inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2);
27347 inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { }
27348 static QLineF fromPolar(qreal length, qreal angle);
27349 bool isNull() const;
27350 inline QPointF p1() const;
27351 inline QPointF p2() const;
27352 inline qreal x1() const;
27353 inline qreal y1() const;
27354 inline qreal x2() const;
27355 inline qreal y2() const;
27356 inline qreal dx() const;
27357 inline qreal dy() const;
27358 qreal length() const;
27359 void setLength(qreal len);
27360 qreal angle() const;
27361 void setAngle(qreal angle);
27362 qreal angleTo(const QLineF &l) const;
27363 QLineF unitVector() const;
27364 QLineF normalVector() const;
27365 IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const;
27366 qreal angle(const QLineF &l) const;
27367 QPointF pointAt(qreal t) const;
27368 inline void translate(const QPointF &p);
27369 inline void translate(qreal dx, qreal dy);
27370 inline QLineF translated(const QPointF &p) const;
27371 inline QLineF translated(qreal dx, qreal dy) const;
27372 inline void setP1(const QPointF &p1);
27373 inline void setP2(const QPointF &p2);
27374 inline void setPoints(const QPointF &p1, const QPointF &p2);
27375 inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
27376 inline bool operator==(const QLineF &d) const;
27377 inline bool operator!=(const QLineF &d) const { return !(*this == d); }
27378 QLine toLine() const;
27379 private:
27380 QPointF pt1, pt2;
27381 };
27382 template <> class QTypeInfo<QLineF> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QLineF)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QLineF"; } };
27383 inline QLineF::QLineF()
27384 {
27385 }
27386 inline QLineF::QLineF(const QPointF &apt1, const QPointF &apt2)
27387 : pt1(apt1), pt2(apt2)
27388 {
27389 }
27390 inline QLineF::QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos)
27391 : pt1(x1pos, y1pos), pt2(x2pos, y2pos)
27392 {
27393 }
27394 inline qreal QLineF::x1() const
27395 {
27396 return pt1.x();
27397 }
27398 inline qreal QLineF::y1() const
27399 {
27400 return pt1.y();
27401 }
27402 inline qreal QLineF::x2() const
27403 {
27404 return pt2.x();
27405 }
27406 inline qreal QLineF::y2() const
27407 {
27408 return pt2.y();
27409 }
27410 inline QPointF QLineF::p1() const
27411 {
27412 return pt1;
27413 }
27414 inline QPointF QLineF::p2() const
27415 {
27416 return pt2;
27417 }
27418 inline qreal QLineF::dx() const
27419 {
27420 return pt2.x() - pt1.x();
27421 }
27422 inline qreal QLineF::dy() const
27423 {
27424 return pt2.y() - pt1.y();
27425 }
27426 inline QLineF QLineF::normalVector() const
27427 {
27428 return QLineF(p1(), p1() + QPointF(dy(), -dx()));
27429 }
27430 inline void QLineF::translate(const QPointF &point)
27431 {
27432 pt1 += point;
27433 pt2 += point;
27434 }
27435 inline void QLineF::translate(qreal adx, qreal ady)
27436 {
27437 this->translate(QPointF(adx, ady));
27438 }
27439 inline QLineF QLineF::translated(const QPointF &p) const
27440 {
27441 return QLineF(pt1 + p, pt2 + p);
27442 }
27443 inline QLineF QLineF::translated(qreal adx, qreal ady) const
27444 {
27445 return translated(QPointF(adx, ady));
27446 }
27447 inline void QLineF::setLength(qreal len)
27448 {
27449 if (isNull())
27450 return;
27451 QLineF v = unitVector();
27452 pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len);
27453 }
27454 inline QPointF QLineF::pointAt(qreal t) const
27455 {
27456 qreal vx = pt2.x() - pt1.x();
27457 qreal vy = pt2.y() - pt1.y();
27458 return QPointF(pt1.x() + vx * t, pt1.y() + vy * t);
27459 }
27460 inline QLine QLineF::toLine() const
27461 {
27462 return QLine(pt1.toPoint(), pt2.toPoint());
27463 }
27464 inline void QLineF::setP1(const QPointF &aP1)
27465 {
27466 pt1 = aP1;
27467 }
27468 inline void QLineF::setP2(const QPointF &aP2)
27469 {
27470 pt2 = aP2;
27471 }
27472 inline void QLineF::setPoints(const QPointF &aP1, const QPointF &aP2)
27473 {
27474 pt1 = aP1;
27475 pt2 = aP2;
27476 }
27477 inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2)
27478 {
27479 pt1 = QPointF(aX1, aY1);
27480 pt2 = QPointF(aX2, aY2);
27481 }
27482 inline bool QLineF::operator==(const QLineF &d) const
27483 {
27484 return pt1 == d.pt1 && pt2 == d.pt2;
27485 }
27486 __attribute__((visibility("default"))) QDebug operator<<(QDebug d, const QLineF &p);
27487 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QLineF &);
27488 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QLineF &);
27489 typedef QtValidLicenseForGuiModule QtGuiModule;
27490 class QPainterPath;
27491 class QVariant;
27492 class __attribute__((visibility("default"))) QMatrix
27493 {
27494 public:
27495 QMatrix();
27496 QMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
27497 qreal dx, qreal dy);
27498 QMatrix(const QMatrix &matrix);
27499 void setMatrix(qreal m11, qreal m12, qreal m21, qreal m22,
27500 qreal dx, qreal dy);
27501 qreal m11() const { return _m11; }
27502 qreal m12() const { return _m12; }
27503 qreal m21() const { return _m21; }
27504 qreal m22() const { return _m22; }
27505 qreal dx() const { return _dx; }
27506 qreal dy() const { return _dy; }
27507 void map(int x, int y, int *tx, int *ty) const;
27508 void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
27509 QRect mapRect(const QRect &) const;
27510 QRectF mapRect(const QRectF &) const;
27511 QPoint map(const QPoint &p) const;
27512 QPointF map(const QPointF&p) const;
27513 QLine map(const QLine &l) const;
27514 QLineF map(const QLineF &l) const;
27515 QPolygonF map(const QPolygonF &a) const;
27516 QPolygon map(const QPolygon &a) const;
27517 QRegion map(const QRegion &r) const;
27518 QPainterPath map(const QPainterPath &p) const;
27519 QPolygon mapToPolygon(const QRect &r) const;
27520 void reset();
27521 inline bool isIdentity() const;
27522 QMatrix &translate(qreal dx, qreal dy);
27523 QMatrix &scale(qreal sx, qreal sy);
27524 QMatrix &shear(qreal sh, qreal sv);
27525 QMatrix &rotate(qreal a);
27526 bool isInvertible() const { return !qFuzzyCompare(_m11*_m22 - _m12*_m21 + 1, 1); }
27527 qreal det() const { return _m11*_m22 - _m12*_m21; }
27528 QMatrix inverted(bool *invertible = 0) const;
27529 bool operator==(const QMatrix &) const;
27530 bool operator!=(const QMatrix &) const;
27531 QMatrix &operator*=(const QMatrix &);
27532 QMatrix operator*(const QMatrix &o) const;
27533 QMatrix &operator=(const QMatrix &);
27534 operator QVariant() const;
27535 private:
27536 friend class QTransform;
27537 qreal _m11, _m12;
27538 qreal _m21, _m22;
27539 qreal _dx, _dy;
27540 };
27541 template <> class QTypeInfo<QMatrix> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QMatrix)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QMatrix"; } };
27542 __attribute__((visibility("default"))) inline QPoint operator*(const QPoint &p, const QMatrix &m)
27543 { return m.map(p); }
27544 __attribute__((visibility("default"))) inline QPointF operator*(const QPointF &p, const QMatrix &m)
27545 { return m.map(p); }
27546 __attribute__((visibility("default"))) inline QLineF operator*(const QLineF &l, const QMatrix &m)
27547 { return m.map(l); }
27548 __attribute__((visibility("default"))) inline QLine operator*(const QLine &l, const QMatrix &m)
27549 { return m.map(l); }
27550 __attribute__((visibility("default"))) inline QPolygon operator *(const QPolygon &a, const QMatrix &m)
27551 { return m.map(a); }
27552 __attribute__((visibility("default"))) inline QPolygonF operator *(const QPolygonF &a, const QMatrix &m)
27553 { return m.map(a); }
27554 __attribute__((visibility("default"))) inline QRegion operator *(const QRegion &r, const QMatrix &m)
27555 { return m.map(r); }
27556 __attribute__((visibility("default"))) QPainterPath operator *(const QPainterPath &p, const QMatrix &m);
27557 inline bool QMatrix::isIdentity() const
27558 {
27559 return qFuzzyCompare(_m11, 1) && qFuzzyCompare(_m22, 1) && qFuzzyCompare(_m12 + 1, 1)
27560 && qFuzzyCompare(_m21 + 1, 1) && qFuzzyCompare(_dx + 1, 1) && qFuzzyCompare(_dy + 1, 1);
27561 }
27562 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QMatrix &);
27563 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QMatrix &);
27564 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QMatrix &);
27565 typedef QtValidLicenseForGuiModule QtGuiModule;
27566 class QFont;
27567 class QPainterPathPrivate;
27568 class QPainterPathData;
27569 class QPainterPathStrokerPrivate;
27570 class QPolygonF;
27571 class QRegion;
27572 class QVectorPath;
27573 class __attribute__((visibility("default"))) QPainterPath
27574 {
27575 public:
27576 enum ElementType {
27577 MoveToElement,
27578 LineToElement,
27579 CurveToElement,
27580 CurveToDataElement
27581 };
27582 class Element {
27583 public:
27584 qreal x;
27585 qreal y;
27586 ElementType type;
27587 bool isMoveTo() const { return type == MoveToElement; }
27588 bool isLineTo() const { return type == LineToElement; }
27589 bool isCurveTo() const { return type == CurveToElement; }
27590 operator QPointF () const { return QPointF(x, y); }
27591 bool operator==(const Element &e) const { return qFuzzyCompare(x, e.x)
27592 && qFuzzyCompare(y, e.y) && type == e.type; }
27593 inline bool operator!=(const Element &e) const { return !operator==(e); }
27594 };
27595 QPainterPath();
27596 explicit QPainterPath(const QPointF &startPoint);
27597 QPainterPath(const QPainterPath &other);
27598 QPainterPath &operator=(const QPainterPath &other);
27599 ~QPainterPath();
27600 void closeSubpath();
27601 void moveTo(const QPointF &p);
27602 inline void moveTo(qreal x, qreal y);
27603 void lineTo(const QPointF &p);
27604 inline void lineTo(qreal x, qreal y);
27605 void arcMoveTo(const QRectF &rect, qreal angle);
27606 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
27607 void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength);
27608 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
27609 void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt);
27610 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
27611 qreal endPtx, qreal endPty);
27612 void quadTo(const QPointF &ctrlPt, const QPointF &endPt);
27613 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
27614 QPointF currentPosition() const;
27615 void addRect(const QRectF &rect);
27616 inline void addRect(qreal x, qreal y, qreal w, qreal h);
27617 void addEllipse(const QRectF &rect);
27618 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
27619 inline void addEllipse(const QPointF &center, qreal rx, qreal ry);
27620 void addPolygon(const QPolygonF &polygon);
27621 void addText(const QPointF &point, const QFont &f, const QString &text);
27622 inline void addText(qreal x, qreal y, const QFont &f, const QString &text);
27623 void addPath(const QPainterPath &path);
27624 void addRegion(const QRegion &region);
27625 void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
27626 Qt::SizeMode mode = Qt::AbsoluteSize);
27627 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
27628 qreal xRadius, qreal yRadius,
27629 Qt::SizeMode mode = Qt::AbsoluteSize);
27630 void addRoundRect(const QRectF &rect, int xRnd, int yRnd);
27631 inline void addRoundRect(qreal x, qreal y, qreal w, qreal h,
27632 int xRnd, int yRnd);
27633 inline void addRoundRect(const QRectF &rect, int roundness);
27634 inline void addRoundRect(qreal x, qreal y, qreal w, qreal h,
27635 int roundness);
27636 void connectPath(const QPainterPath &path);
27637 bool contains(const QPointF &pt) const;
27638 bool contains(const QRectF &rect) const;
27639 bool intersects(const QRectF &rect) const;
27640 QRectF boundingRect() const;
27641 QRectF controlPointRect() const;
27642 Qt::FillRule fillRule() const;
27643 void setFillRule(Qt::FillRule fillRule);
27644 inline bool isEmpty() const;
27645 QPainterPath toReversed() const;
27646 QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
27647 QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
27648 QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
27649 QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const;
27650 QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
27651 QPolygonF toFillPolygon(const QTransform &matrix) const;
27652 inline int elementCount() const;
27653 inline const QPainterPath::Element &elementAt(int i) const;
27654 inline void setElementPositionAt(int i, qreal x, qreal y);
27655 qreal length() const;
27656 qreal percentAtLength(qreal t) const;
27657 QPointF pointAtPercent(qreal t) const;
27658 qreal angleAtPercent(qreal t) const;
27659 qreal slopeAtPercent(qreal t) const;
27660 bool intersects(const QPainterPath &p) const;
27661 bool contains(const QPainterPath &p) const;
27662 QPainterPath united(const QPainterPath &r) const;
27663 QPainterPath intersected(const QPainterPath &r) const;
27664 QPainterPath subtracted(const QPainterPath &r) const;
27665 QPainterPath subtractedInverted(const QPainterPath &r) const;
27666 QPainterPath simplified() const;
27667 bool operator==(const QPainterPath &other) const;
27668 bool operator!=(const QPainterPath &other) const;
27669 QPainterPath operator&(const QPainterPath &other) const;
27670 QPainterPath operator|(const QPainterPath &other) const;
27671 QPainterPath operator+(const QPainterPath &other) const;
27672 QPainterPath operator-(const QPainterPath &other) const;
27673 QPainterPath &operator&=(const QPainterPath &other);
27674 QPainterPath &operator|=(const QPainterPath &other);
27675 QPainterPath &operator+=(const QPainterPath &other);
27676 QPainterPath &operator-=(const QPainterPath &other);
27677 private:
27678 QPainterPathPrivate *d_ptr;
27679 inline void ensureData() { if (!d_ptr) ensureData_helper(); }
27680 void ensureData_helper();
27681 inline void detach();
27682 void detach_helper();
27683 void setDirty(bool);
27684 void computeBoundingRect() const;
27685 void computeControlPointRect() const;
27686 QPainterPathData *d_func() const { return reinterpret_cast<QPainterPathData *>(d_ptr); }
27687 friend class QPainterPathData;
27688 friend class QPainterPathStroker;
27689 friend class QPainterPathStrokerPrivate;
27690 friend class QMatrix;
27691 friend class QTransform;
27692 friend __attribute__((visibility("default"))) const QVectorPath &qtVectorPathForPath(const QPainterPath &);
27693 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPainterPath &);
27694 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPainterPath &);
27695 };
27696 class QPainterPathPrivate
27697 {
27698 public:
27699 friend class QPainterPath;
27700 friend class QPainterPathData;
27701 friend class QPainterPathStroker;
27702 friend class QPainterPathStrokerPrivate;
27703 friend class QMatrix;
27704 friend class QTransform;
27705 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPainterPath &);
27706 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPainterPath &);
27707 private:
27708 QAtomicInt ref;
27709 QVector<QPainterPath::Element> elements;
27710 };
27711 template <> class QTypeInfo<QPainterPath::Element> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QPainterPath::Element)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QPainterPath::Element"; } };
27712 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPainterPath &);
27713 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPainterPath &);
27714 class __attribute__((visibility("default"))) QPainterPathStroker
27715 {
27716 inline QPainterPathStrokerPrivate* d_func() { return reinterpret_cast<QPainterPathStrokerPrivate *>(d_ptr); } inline const QPainterPathStrokerPrivate* d_func() const { return reinterpret_cast<const QPainterPathStrokerPrivate *>(d_ptr); } friend class QPainterPathStrokerPrivate;
27717 public:
27718 QPainterPathStroker();
27719 ~QPainterPathStroker();
27720 void setWidth(qreal width);
27721 qreal width() const;
27722 void setCapStyle(Qt::PenCapStyle style);
27723 Qt::PenCapStyle capStyle() const;
27724 void setJoinStyle(Qt::PenJoinStyle style);
27725 Qt::PenJoinStyle joinStyle() const;
27726 void setMiterLimit(qreal length);
27727 qreal miterLimit() const;
27728 void setCurveThreshold(qreal threshold);
27729 qreal curveThreshold() const;
27730 void setDashPattern(Qt::PenStyle);
27731 void setDashPattern(const QVector<qreal> &dashPattern);
27732 QVector<qreal> dashPattern() const;
27733 void setDashOffset(qreal offset);
27734 qreal dashOffset() const;
27735 QPainterPath createStroke(const QPainterPath &path) const;
27736 private:
27737 friend class QX11PaintEngine;
27738 QPainterPathStrokerPrivate *d_ptr;
27739 };
27740 inline void QPainterPath::moveTo(qreal x, qreal y)
27741 {
27742 moveTo(QPointF(x, y));
27743 }
27744 inline void QPainterPath::lineTo(qreal x, qreal y)
27745 {
27746 lineTo(QPointF(x, y));
27747 }
27748 inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght)
27749 {
27750 arcTo(QRectF(x, y, w, h), startAngle, arcLenght);
27751 }
27752 inline void QPainterPath::arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle)
27753 {
27754 arcMoveTo(QRectF(x, y, w, h), angle);
27755 }
27756 inline void QPainterPath::cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
27757 qreal endPtx, qreal endPty)
27758 {
27759 cubicTo(QPointF(ctrlPt1x, ctrlPt1y), QPointF(ctrlPt2x, ctrlPt2y),
27760 QPointF(endPtx, endPty));
27761 }
27762 inline void QPainterPath::quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty)
27763 {
27764 quadTo(QPointF(ctrlPtx, ctrlPty), QPointF(endPtx, endPty));
27765 }
27766 inline void QPainterPath::addEllipse(qreal x, qreal y, qreal w, qreal h)
27767 {
27768 addEllipse(QRectF(x, y, w, h));
27769 }
27770 inline void QPainterPath::addEllipse(const QPointF &center, qreal rx, qreal ry)
27771 {
27772 addEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
27773 }
27774 inline void QPainterPath::addRect(qreal x, qreal y, qreal w, qreal h)
27775 {
27776 addRect(QRectF(x, y, w, h));
27777 }
27778 inline void QPainterPath::addRoundedRect(qreal x, qreal y, qreal w, qreal h,
27779 qreal xRadius, qreal yRadius,
27780 Qt::SizeMode mode)
27781 {
27782 addRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
27783 }
27784 inline void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
27785 int xRnd, int yRnd)
27786 {
27787 addRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
27788 }
27789 inline void QPainterPath::addRoundRect(const QRectF &rect,
27790 int roundness)
27791 {
27792 int xRnd = roundness;
27793 int yRnd = roundness;
27794 if (rect.width() > rect.height())
27795 xRnd = int(roundness * rect.height()/rect.width());
27796 else
27797 yRnd = int(roundness * rect.width()/rect.height());
27798 addRoundRect(rect, xRnd, yRnd);
27799 }
27800 inline void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
27801 int roundness)
27802 {
27803 addRoundRect(QRectF(x, y, w, h), roundness);
27804 }
27805 inline void QPainterPath::addText(qreal x, qreal y, const QFont &f, const QString &text)
27806 {
27807 addText(QPointF(x, y), f, text);
27808 }
27809 inline bool QPainterPath::isEmpty() const
27810 {
27811 return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
27812 }
27813 inline int QPainterPath::elementCount() const
27814 {
27815 return d_ptr ? d_ptr->elements.size() : 0;
27816 }
27817 inline const QPainterPath::Element &QPainterPath::elementAt(int i) const
27818 {
27819 qt_noop();
27820 qt_noop();
27821 return d_ptr->elements.at(i);
27822 }
27823 inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
27824 {
27825 qt_noop();
27826 qt_noop();
27827 detach();
27828 QPainterPath::Element &e = d_ptr->elements[i];
27829 e.x = x;
27830 e.y = y;
27831 }
27832 inline void QPainterPath::detach()
27833 {
27834 if (d_ptr->ref != 1)
27835 detach_helper();
27836 setDirty(true);
27837 }
27838 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QPainterPath &);
27839 typedef QtValidLicenseForGuiModule QtGuiModule;
27840 class QVariant;
27841 class __attribute__((visibility("default"))) QTransform
27842 {
27843 public:
27844 enum TransformationType {
27845 TxNone = 0x00,
27846 TxTranslate = 0x01,
27847 TxScale = 0x02,
27848 TxRotate = 0x04,
27849 TxShear = 0x08,
27850 TxProject = 0x10
27851 };
27852 QTransform();
27853 QTransform(qreal h11, qreal h12, qreal h13,
27854 qreal h21, qreal h22, qreal h23,
27855 qreal h31, qreal h32, qreal h33 = 1.0);
27856 QTransform(qreal h11, qreal h12, qreal h21,
27857 qreal h22, qreal dx, qreal dy);
27858 explicit QTransform(const QMatrix &mtx);
27859 bool isAffine() const;
27860 bool isIdentity() const;
27861 bool isInvertible() const;
27862 bool isScaling() const;
27863 bool isRotating() const;
27864 bool isTranslating() const;
27865 TransformationType type() const;
27866 inline qreal determinant() const;
27867 qreal det() const;
27868 qreal m11() const;
27869 qreal m12() const;
27870 qreal m13() const;
27871 qreal m21() const;
27872 qreal m22() const;
27873 qreal m23() const;
27874 qreal m31() const;
27875 qreal m32() const;
27876 qreal m33() const;
27877 qreal dx() const;
27878 qreal dy() const;
27879 void setMatrix(qreal m11, qreal m12, qreal m13,
27880 qreal m21, qreal m22, qreal m23,
27881 qreal m31, qreal m32, qreal m33);
27882 QTransform inverted(bool *invertible = 0) const;
27883 QTransform adjoint() const;
27884 QTransform transposed() const;
27885 QTransform &translate(qreal dx, qreal dy);
27886 QTransform &scale(qreal sx, qreal sy);
27887 QTransform &shear(qreal sh, qreal sv);
27888 QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis);
27889 QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis);
27890 static bool squareToQuad(const QPolygonF &square, QTransform &result);
27891 static bool quadToSquare(const QPolygonF &quad, QTransform &result);
27892 static bool quadToQuad(const QPolygonF &one,
27893 const QPolygonF &two,
27894 QTransform &result);
27895 bool operator==(const QTransform &) const;
27896 bool operator!=(const QTransform &) const;
27897 QTransform &operator*=(const QTransform &);
27898 QTransform operator*(const QTransform &o) const;
27899 QTransform &operator=(const QTransform &);
27900 operator QVariant() const;
27901 void reset();
27902 QPoint map(const QPoint &p) const;
27903 QPointF map(const QPointF &p) const;
27904 QLine map(const QLine &l) const;
27905 QLineF map(const QLineF &l) const;
27906 QPolygonF map(const QPolygonF &a) const;
27907 QPolygon map(const QPolygon &a) const;
27908 QRegion map(const QRegion &r) const;
27909 QPainterPath map(const QPainterPath &p) const;
27910 QPolygon mapToPolygon(const QRect &r) const;
27911 QRect mapRect(const QRect &) const;
27912 QRectF mapRect(const QRectF &) const;
27913 void map(int x, int y, int *tx, int *ty) const;
27914 void map(qreal x, qreal y, qreal *tx, qreal *ty) const;
27915 const QMatrix &toAffine() const;
27916 QTransform &operator*=(qreal div);
27917 QTransform &operator/=(qreal div);
27918 QTransform &operator+=(qreal div);
27919 QTransform &operator-=(qreal div);
27920 static QTransform fromTranslate(qreal dx, qreal dy);
27921 static QTransform fromScale(qreal dx, qreal dy);
27922 private:
27923 QMatrix affine;
27924 qreal m_13;
27925 qreal m_23;
27926 qreal m_33;
27927 mutable uint m_type : 5;
27928 mutable uint m_dirty : 5;
27929 class Private;
27930 Private *d;
27931 };
27932 template <> class QTypeInfo<QTransform> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTransform)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTransform"; } };
27933 inline bool QTransform::isAffine() const
27934 {
27935 return type() < TxProject;
27936 }
27937 inline bool QTransform::isIdentity() const
27938 {
27939 return type() == TxNone;
27940 }
27941 inline bool QTransform::isInvertible() const
27942 {
27943 return !qFuzzyCompare(determinant() + 1, 1);
27944 }
27945 inline bool QTransform::isScaling() const
27946 {
27947 return type() >= TxScale;
27948 }
27949 inline bool QTransform::isRotating() const
27950 {
27951 return type() >= TxRotate;
27952 }
27953 inline bool QTransform::isTranslating() const
27954 {
27955 return type() >= TxTranslate;
27956 }
27957 inline qreal QTransform::determinant() const
27958 {
27959 return affine._m11*(m_33*affine._m22-affine._dy*m_23) -
27960 affine._m21*(m_33*affine._m12-affine._dy*m_13)+affine._dx*(m_23*affine._m12-affine._m22*m_13);
27961 }
27962 inline qreal QTransform::det() const
27963 {
27964 return determinant();
27965 }
27966 inline qreal QTransform::m11() const
27967 {
27968 return affine._m11;
27969 }
27970 inline qreal QTransform::m12() const
27971 {
27972 return affine._m12;
27973 }
27974 inline qreal QTransform::m13() const
27975 {
27976 return m_13;
27977 }
27978 inline qreal QTransform::m21() const
27979 {
27980 return affine._m21;
27981 }
27982 inline qreal QTransform::m22() const
27983 {
27984 return affine._m22;
27985 }
27986 inline qreal QTransform::m23() const
27987 {
27988 return m_23;
27989 }
27990 inline qreal QTransform::m31() const
27991 {
27992 return affine._dx;
27993 }
27994 inline qreal QTransform::m32() const
27995 {
27996 return affine._dy;
27997 }
27998 inline qreal QTransform::m33() const
27999 {
28000 return m_33;
28001 }
28002 inline qreal QTransform::dx() const
28003 {
28004 return affine._dx;
28005 }
28006 inline qreal QTransform::dy() const
28007 {
28008 return affine._dy;
28009 }
28010 inline QTransform &QTransform::operator*=(qreal num)
28011 {
28012 if (num == 1.)
28013 return *this;
28014 affine._m11 *= num;
28015 affine._m12 *= num;
28016 m_13 *= num;
28017 affine._m21 *= num;
28018 affine._m22 *= num;
28019 m_23 *= num;
28020 affine._dx *= num;
28021 affine._dy *= num;
28022 m_33 *= num;
28023 m_dirty |= TxScale;
28024 return *this;
28025 }
28026 inline QTransform &QTransform::operator/=(qreal div)
28027 {
28028 if (div == 0)
28029 return *this;
28030 div = 1/div;
28031 return operator*=(div);
28032 }
28033 inline QTransform &QTransform::operator+=(qreal num)
28034 {
28035 if (num == 0)
28036 return *this;
28037 affine._m11 += num;
28038 affine._m12 += num;
28039 m_13 += num;
28040 affine._m21 += num;
28041 affine._m22 += num;
28042 m_23 += num;
28043 affine._dx += num;
28044 affine._dy += num;
28045 m_33 += num;
28046 m_dirty |= TxProject;
28047 return *this;
28048 }
28049 inline QTransform &QTransform::operator-=(qreal num)
28050 {
28051 if (num == 0)
28052 return *this;
28053 affine._m11 -= num;
28054 affine._m12 -= num;
28055 m_13 -= num;
28056 affine._m21 -= num;
28057 affine._m22 -= num;
28058 m_23 -= num;
28059 affine._dx -= num;
28060 affine._dy -= num;
28061 m_33 -= num;
28062 m_dirty |= TxProject;
28063 return *this;
28064 }
28065 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QTransform &);
28066 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QTransform &);
28067 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QTransform &);
28068 __attribute__((visibility("default"))) inline QPoint operator*(const QPoint &p, const QTransform &m)
28069 { return m.map(p); }
28070 __attribute__((visibility("default"))) inline QPointF operator*(const QPointF &p, const QTransform &m)
28071 { return m.map(p); }
28072 __attribute__((visibility("default"))) inline QLineF operator*(const QLineF &l, const QTransform &m)
28073 { return m.map(l); }
28074 __attribute__((visibility("default"))) inline QLine operator*(const QLine &l, const QTransform &m)
28075 { return m.map(l); }
28076 __attribute__((visibility("default"))) inline QPolygon operator *(const QPolygon &a, const QTransform &m)
28077 { return m.map(a); }
28078 __attribute__((visibility("default"))) inline QPolygonF operator *(const QPolygonF &a, const QTransform &m)
28079 { return m.map(a); }
28080 __attribute__((visibility("default"))) inline QRegion operator *(const QRegion &r, const QTransform &m)
28081 { return m.map(r); }
28082 __attribute__((visibility("default"))) inline QPainterPath operator *(const QPainterPath &p, const QTransform &m)
28083 { return m.map(p); }
28084 __attribute__((visibility("default"))) inline QTransform operator *(const QTransform &a, qreal n)
28085 { QTransform t(a); t *= n; return t; }
28086 __attribute__((visibility("default"))) inline QTransform operator /(const QTransform &a, qreal n)
28087 { QTransform t(a); t /= n; return t; }
28088 __attribute__((visibility("default"))) inline QTransform operator +(const QTransform &a, qreal n)
28089 { QTransform t(a); t += n; return t; }
28090 __attribute__((visibility("default"))) inline QTransform operator -(const QTransform &a, qreal n)
28091 { QTransform t(a); t -= n; return t; }
28092 typedef QtValidLicenseForGuiModule QtGuiModule;
28093 class QWSDisplay;
28094 class QPaintEngine;
28095 class __attribute__((visibility("default"))) QPaintDevice
28096 {
28097 public:
28098 enum PaintDeviceMetric {
28099 PdmWidth = 1,
28100 PdmHeight,
28101 PdmWidthMM,
28102 PdmHeightMM,
28103 PdmNumColors,
28104 PdmDepth,
28105 PdmDpiX,
28106 PdmDpiY,
28107 PdmPhysicalDpiX,
28108 PdmPhysicalDpiY
28109 };
28110 virtual ~QPaintDevice();
28111 virtual int devType() const;
28112 bool paintingActive() const;
28113 virtual QPaintEngine *paintEngine() const = 0;
28114 static QWSDisplay *qwsDisplay();
28115 int width() const { return metric(PdmWidth); }
28116 int height() const { return metric(PdmHeight); }
28117 int widthMM() const { return metric(PdmWidthMM); }
28118 int heightMM() const { return metric(PdmHeightMM); }
28119 int logicalDpiX() const { return metric(PdmDpiX); }
28120 int logicalDpiY() const { return metric(PdmDpiY); }
28121 int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
28122 int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
28123 int numColors() const { return metric(PdmNumColors); }
28124 int depth() const { return metric(PdmDepth); }
28125 protected:
28126 QPaintDevice();
28127 virtual int metric(PaintDeviceMetric metric) const;
28128 ushort painters;
28129 private:
28130 QPaintDevice(const QPaintDevice &); QPaintDevice &operator=(const QPaintDevice &);
28131 friend class QPainter;
28132 friend class QFontEngineMac;
28133 friend class QX11PaintEngine;
28134 };
28135 inline int QPaintDevice::devType() const
28136 { return QInternal::UnknownDevice; }
28137 inline bool QPaintDevice::paintingActive() const
28138 { return painters != 0; }
28139 typedef QtValidLicenseForGuiModule QtGuiModule;
28140 class QIODevice;
28141 class QStringList;
28142 class QMatrix;
28143 class QTransform;
28144 class QVariant;
28145 template <class T> class QList;
28146 template <class T> class QVector;
28147 struct QImageData;
28148 class QImageDataMisc;
28149 class __attribute__((visibility("default"))) QImageTextKeyLang {
28150 public:
28151 QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
28152 QImageTextKeyLang() { }
28153 QByteArray key;
28154 QByteArray lang;
28155 bool operator< (const QImageTextKeyLang& other) const
28156 { return key < other.key || (key==other.key && lang < other.lang); }
28157 bool operator== (const QImageTextKeyLang& other) const
28158 { return key==other.key && lang==other.lang; }
28159 inline bool operator!= (const QImageTextKeyLang &other) const
28160 { return !operator==(other); }
28161 };
28162 class __attribute__((visibility("default"))) QImage : public QPaintDevice
28163 {
28164 public:
28165 enum InvertMode { InvertRgb, InvertRgba };
28166 enum Format {
28167 Format_Invalid,
28168 Format_Mono,
28169 Format_MonoLSB,
28170 Format_Indexed8,
28171 Format_RGB32,
28172 Format_ARGB32,
28173 Format_ARGB32_Premultiplied,
28174 Format_RGB16,
28175 Format_ARGB8565_Premultiplied,
28176 Format_RGB666,
28177 Format_ARGB6666_Premultiplied,
28178 Format_RGB555,
28179 Format_ARGB8555_Premultiplied,
28180 Format_RGB888,
28181 Format_RGB444,
28182 Format_ARGB4444_Premultiplied,
28183 NImageFormats
28184 };
28185 QImage();
28186 QImage(const QSize &size, Format format);
28187 QImage(int width, int height, Format format);
28188 QImage(uchar *data, int width, int height, Format format);
28189 QImage(const uchar *data, int width, int height, Format format);
28190 QImage(uchar *data, int width, int height, int bytesPerLine, Format format);
28191 QImage(const uchar *data, int width, int height, int bytesPerLine, Format format);
28192 explicit QImage(const char * const xpm[]);
28193 explicit QImage(const QString &fileName, const char *format = 0);
28194 explicit QImage(const char *fileName, const char *format = 0);
28195 QImage(const QImage &);
28196 ~QImage();
28197 QImage &operator=(const QImage &);
28198 bool isNull() const;
28199 int devType() const;
28200 bool operator==(const QImage &) const;
28201 bool operator!=(const QImage &) const;
28202 operator QVariant() const;
28203 void detach();
28204 bool isDetached() const;
28205 QImage copy(const QRect &rect = QRect()) const;
28206 inline QImage copy(int x, int y, int w, int h) const
28207 { return copy(QRect(x, y, w, h)); }
28208 Format format() const;
28209 QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const __attribute__ ((warn_unused_result));
28210 QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const __attribute__ ((warn_unused_result));
28211 int width() const;
28212 int height() const;
28213 QSize size() const;
28214 QRect rect() const;
28215 int depth() const;
28216 int numColors() const;
28217 QRgb color(int i) const;
28218 void setColor(int i, QRgb c);
28219 void setNumColors(int);
28220 bool allGray() const;
28221 bool isGrayscale() const;
28222 uchar *bits();
28223 const uchar *bits() const;
28224 int numBytes() const;
28225 uchar *scanLine(int);
28226 const uchar *scanLine(int) const;
28227 int bytesPerLine() const;
28228 bool valid(int x, int y) const;
28229 bool valid(const QPoint &pt) const;
28230 int pixelIndex(int x, int y) const;
28231 int pixelIndex(const QPoint &pt) const;
28232 QRgb pixel(int x, int y) const;
28233 QRgb pixel(const QPoint &pt) const;
28234 void setPixel(int x, int y, uint index_or_rgb);
28235 void setPixel(const QPoint &pt, uint index_or_rgb);
28236 QVector<QRgb> colorTable() const;
28237 void setColorTable(const QVector<QRgb> colors);
28238 void fill(uint pixel);
28239 bool hasAlphaChannel() const;
28240 void setAlphaChannel(const QImage &alphaChannel);
28241 QImage alphaChannel() const;
28242 QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
28243 QImage createHeuristicMask(bool clipTight = true) const;
28244 QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const;
28245 inline QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
28246 Qt::TransformationMode mode = Qt::FastTransformation) const
28247 { return scaled(QSize(w, h), aspectMode, mode); }
28248 QImage scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
28249 Qt::TransformationMode mode = Qt::FastTransformation) const;
28250 QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
28251 QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
28252 QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
28253 static QMatrix trueMatrix(const QMatrix &, int w, int h);
28254 QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
28255 static QTransform trueMatrix(const QTransform &, int w, int h);
28256 QImage mirrored(bool horizontally = false, bool vertically = true) const;
28257 QImage rgbSwapped() const;
28258 void invertPixels(InvertMode = InvertRgb);
28259 bool load(QIODevice *device, const char* format);
28260 bool load(const QString &fileName, const char* format=0);
28261 bool loadFromData(const uchar *buf, int len, const char *format = 0);
28262 inline bool loadFromData(const QByteArray &data, const char* aformat=0)
28263 { return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); }
28264 bool save(const QString &fileName, const char* format=0, int quality=-1) const;
28265 bool save(QIODevice *device, const char* format=0, int quality=-1) const;
28266 static QImage fromData(const uchar *data, int size, const char *format = 0);
28267 inline static QImage fromData(const QByteArray &data, const char *format = 0)
28268 { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
28269 int serialNumber() const;
28270 qint64 cacheKey() const;
28271 QPaintEngine *paintEngine() const;
28272 int dotsPerMeterX() const;
28273 int dotsPerMeterY() const;
28274 void setDotsPerMeterX(int);
28275 void setDotsPerMeterY(int);
28276 QPoint offset() const;
28277 void setOffset(const QPoint&);
28278 QStringList textKeys() const;
28279 QString text(const QString &key = QString()) const;
28280 void setText(const QString &key, const QString &value);
28281 QString text(const char* key, const char* lang=0) const;
28282 QList<QImageTextKeyLang> textList() const;
28283 QStringList textLanguages() const;
28284 QString text(const QImageTextKeyLang&) const;
28285 void setText(const char* key, const char* lang, const QString&);
28286 protected:
28287 virtual int metric(PaintDeviceMetric metric) const;
28288 private:
28289 friend class QWSOnScreenSurface;
28290 QImageData *d;
28291 friend class QRasterPixmapData;
28292 friend class QDetachedPixmap;
28293 friend __attribute__((visibility("default"))) qint64 qt_image_id(const QImage &image);
28294 friend const QVector<QRgb> *qt_image_colortable(const QImage &image);
28295 public:
28296 typedef QImageData * DataPtr;
28297 inline DataPtr &data_ptr() { return d; }
28298 };
28299 template <> inline bool qIsDetached<QImage>(QImage &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QImage>(QImage &value1, QImage &value2) { const QImage::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
28300 template <> class QTypeInfo<QImage> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QImage)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QImage"; } };
28301 __attribute__((visibility("default"))) inline bool QImage::valid(const QPoint &pt) const { return valid(pt.x(), pt.y()); }
28302 __attribute__((visibility("default"))) inline int QImage::pixelIndex(const QPoint &pt) const { return pixelIndex(pt.x(), pt.y());}
28303 __attribute__((visibility("default"))) inline QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); }
28304 __attribute__((visibility("default"))) inline void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); }
28305 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QImage &);
28306 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QImage &);
28307 typedef QtValidLicenseForGuiModule QtGuiModule;
28308 class QImageWriter;
28309 class QColor;
28310 class QVariant;
28311 class QX11Info;
28312 class QPixmapData;
28313 class __attribute__((visibility("default"))) QPixmap : public QPaintDevice
28314 {
28315 public:
28316 QPixmap();
28317 explicit QPixmap(QPixmapData *data);
28318 QPixmap(int w, int h);
28319 QPixmap(const QSize &);
28320 QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
28321 QPixmap(const char * const xpm[]);
28322 QPixmap(const QPixmap &);
28323 ~QPixmap();
28324 QPixmap &operator=(const QPixmap &);
28325 operator QVariant() const;
28326 bool isNull() const;
28327 int devType() const;
28328 int width() const;
28329 int height() const;
28330 QSize size() const;
28331 QRect rect() const;
28332 int depth() const;
28333 static int defaultDepth();
28334 void fill(const QColor &fillColor = Qt::white);
28335 void fill(const QWidget *widget, const QPoint &ofs);
28336 inline void fill(const QWidget *widget, int xofs, int yofs) { fill(widget, QPoint(xofs, yofs)); }
28337 QBitmap mask() const;
28338 void setMask(const QBitmap &);
28339 QPixmap alphaChannel() const;
28340 void setAlphaChannel(const QPixmap &);
28341 bool hasAlpha() const;
28342 bool hasAlphaChannel() const;
28343 QBitmap createHeuristicMask(bool clipTight = true) const;
28344 QBitmap createMaskFromColor(const QColor &maskColor) const;
28345 QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const;
28346 static QPixmap grabWindow(WId, int x=0, int y=0, int w=-1, int h=-1);
28347 static QPixmap grabWidget(QWidget *widget, const QRect &rect);
28348 static inline QPixmap grabWidget(QWidget *widget, int x=0, int y=0, int w=-1, int h=-1)
28349 { return grabWidget(widget, QRect(x, y, w, h)); }
28350 inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
28351 Qt::TransformationMode mode = Qt::FastTransformation) const
28352 { return scaled(QSize(w, h), aspectMode, mode); }
28353 QPixmap scaled(const QSize &s, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio,
28354 Qt::TransformationMode mode = Qt::FastTransformation) const;
28355 QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const;
28356 QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const;
28357 QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const;
28358 static QMatrix trueMatrix(const QMatrix &m, int w, int h);
28359 QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const;
28360 static QTransform trueMatrix(const QTransform &m, int w, int h);
28361 QImage toImage() const;
28362 static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
28363 bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
28364 bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
28365 inline bool loadFromData(const QByteArray &data, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
28366 bool save(const QString& fileName, const char* format = 0, int quality = -1) const;
28367 bool save(QIODevice* device, const char* format = 0, int quality = -1) const;
28368 inline QPixmap copy(int x, int y, int width, int height) const;
28369 QPixmap copy(const QRect &rect = QRect()) const;
28370 int serialNumber() const;
28371 qint64 cacheKey() const;
28372 bool isDetached() const;
28373 void detach();
28374 bool isQBitmap() const;
28375 const uchar *qwsBits() const;
28376 int qwsBytesPerLine() const;
28377 QRgb *clut() const;
28378 int numCols() const;
28379 Qt::HANDLE handle() const;
28380 QPaintEngine *paintEngine() const;
28381 inline bool operator!() const { return isNull(); }
28382 protected:
28383 int metric(PaintDeviceMetric) const;
28384 private:
28385 QPixmapData *data;
28386 bool doImageIO(QImageWriter *io, int quality) const;
28387 enum Type { PixmapType, BitmapType };
28388 QPixmap(const QSize &s, Type);
28389 void init(int, int, Type = PixmapType);
28390 QPixmap(const QSize &s, int type);
28391 void init(int, int, int);
28392 void deref();
28393 friend class QPixmapData;
28394 friend class QX11PixmapData;
28395 friend class QMacPixmapData;
28396 friend class QBitmap;
28397 friend class QPaintDevice;
28398 friend class QPainter;
28399 friend class QGLWidget;
28400 friend class QX11PaintEngine;
28401 friend class QCoreGraphicsPaintEngine;
28402 friend class QWidgetPrivate;
28403 friend class QRasterPaintEngine;
28404 friend class QRasterBuffer;
28405 friend class QDirect3DPaintEngine;
28406 friend class QDirect3DPaintEnginePrivate;
28407 friend class QDetachedPixmap;
28408 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPixmap &);
28409 friend __attribute__((visibility("default"))) qint64 qt_pixmap_id(const QPixmap &pixmap);
28410 public:
28411 QPixmapData* pixmapData() const;
28412 public:
28413 typedef QPixmapData * DataPtr;
28414 inline DataPtr &data_ptr() { return data; }
28415 };
28416 template <> inline bool qIsDetached<QPixmap>(QPixmap &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QPixmap>(QPixmap &value1, QPixmap &value2) { const QPixmap::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
28417 inline QPixmap QPixmap::copy(int ax, int ay, int awidth, int aheight) const
28418 {
28419 return copy(QRect(ax, ay, awidth, aheight));
28420 }
28421 inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format,
28422 Qt::ImageConversionFlags flags)
28423 {
28424 return loadFromData(reinterpret_cast<const uchar *>(buf.constData()), buf.size(), format, flags);
28425 }
28426 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPixmap &);
28427 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPixmap &);
28428 typedef QtValidLicenseForGuiModule QtGuiModule;
28429 struct QBrushData;
28430 class QPixmap;
28431 class QGradient;
28432 class QVariant;
28433 class __attribute__((visibility("default"))) QBrush
28434 {
28435 public:
28436 QBrush();
28437 QBrush(Qt::BrushStyle bs);
28438 QBrush(const QColor &color, Qt::BrushStyle bs=Qt::SolidPattern);
28439 QBrush(Qt::GlobalColor color, Qt::BrushStyle bs=Qt::SolidPattern);
28440 QBrush(const QColor &color, const QPixmap &pixmap);
28441 QBrush(Qt::GlobalColor color, const QPixmap &pixmap);
28442 QBrush(const QPixmap &pixmap);
28443 QBrush(const QImage &image);
28444 QBrush(const QBrush &brush);
28445 QBrush(const QGradient &gradient);
28446 ~QBrush();
28447 QBrush &operator=(const QBrush &brush);
28448 operator QVariant() const;
28449 inline Qt::BrushStyle style() const;
28450 void setStyle(Qt::BrushStyle);
28451 inline const QMatrix &matrix() const;
28452 void setMatrix(const QMatrix &mat);
28453 inline QTransform transform() const;
28454 void setTransform(const QTransform &);
28455 QPixmap texture() const;
28456 void setTexture(const QPixmap &pixmap);
28457 QImage textureImage() const;
28458 void setTextureImage(const QImage &image);
28459 inline const QColor &color() const;
28460 void setColor(const QColor &color);
28461 inline void setColor(Qt::GlobalColor color);
28462 const QGradient *gradient() const;
28463 bool isOpaque() const;
28464 bool operator==(const QBrush &b) const;
28465 inline bool operator!=(const QBrush &b) const { return !(operator==(b)); }
28466 private:
28467 friend class QRasterPaintEngine;
28468 friend class QRasterPaintEnginePrivate;
28469 friend struct QSpanData;
28470 friend class QPainter;
28471 friend bool qHasPixmapTexture(const QBrush& brush);
28472 void detach(Qt::BrushStyle newStyle);
28473 void init(const QColor &color, Qt::BrushStyle bs);
28474 QBrushData *d;
28475 void cleanUp(QBrushData *x);
28476 public:
28477 inline bool isDetached() const;
28478 typedef QBrushData * DataPtr;
28479 inline DataPtr &data_ptr() { return d; }
28480 };
28481 inline void QBrush::setColor(Qt::GlobalColor acolor)
28482 { setColor(QColor(acolor)); }
28483 template <> class QTypeInfo<QBrush> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QBrush)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QBrush"; } };
28484 template <> inline bool qIsDetached<QBrush>(QBrush &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QBrush>(QBrush &value1, QBrush &value2) { const QBrush::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
28485 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QBrush &);
28486 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QBrush &);
28487 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QBrush &);
28488 struct QBrushData
28489 {
28490 QAtomicInt ref;
28491 Qt::BrushStyle style;
28492 QColor color;
28493 QTransform transform;
28494 };
28495 inline Qt::BrushStyle QBrush::style() const { return d->style; }
28496 inline const QColor &QBrush::color() const { return d->color; }
28497 inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
28498 inline QTransform QBrush::transform() const { return d->transform; }
28499 inline bool QBrush::isDetached() const { return d->ref == 1; }
28500 class QGradientPrivate;
28501 typedef QPair<qreal, QColor> QGradientStop;
28502 typedef QVector<QGradientStop> QGradientStops;
28503 class __attribute__((visibility("default"))) QGradient
28504 {
28505 public: static const QMetaObject staticMetaObject; private:
28506 public:
28507 enum Type {
28508 LinearGradient,
28509 RadialGradient,
28510 ConicalGradient,
28511 NoGradient
28512 };
28513 enum Spread {
28514 PadSpread,
28515 ReflectSpread,
28516 RepeatSpread
28517 };
28518 enum CoordinateMode {
28519 LogicalMode,
28520 StretchToDeviceMode,
28521 ObjectBoundingMode
28522 };
28523 enum InterpolationMode {
28524 ColorInterpolation,
28525 ComponentInterpolation
28526 };
28527 QGradient();
28528 Type type() const { return m_type; }
28529 inline void setSpread(Spread spread);
28530 Spread spread() const { return m_spread; }
28531 void setColorAt(qreal pos, const QColor &color);
28532 void setStops(const QGradientStops &stops);
28533 QGradientStops stops() const;
28534 CoordinateMode coordinateMode() const;
28535 void setCoordinateMode(CoordinateMode mode);
28536 InterpolationMode interpolationMode() const;
28537 void setInterpolationMode(InterpolationMode mode);
28538 bool operator==(const QGradient &gradient) const;
28539 inline bool operator!=(const QGradient &other) const
28540 { return !operator==(other); }
28541 bool operator==(const QGradient &gradient);
28542 private:
28543 friend class QLinearGradient;
28544 friend class QRadialGradient;
28545 friend class QConicalGradient;
28546 Type m_type;
28547 Spread m_spread;
28548 QGradientStops m_stops;
28549 union {
28550 struct {
28551 qreal x1, y1, x2, y2;
28552 } linear;
28553 struct {
28554 qreal cx, cy, fx, fy, radius;
28555 } radial;
28556 struct {
28557 qreal cx, cy, angle;
28558 } conical;
28559 } m_data;
28560 void *dummy;
28561 };
28562 inline void QGradient::setSpread(Spread aspread)
28563 { m_spread = aspread; }
28564 class __attribute__((visibility("default"))) QLinearGradient : public QGradient
28565 {
28566 public:
28567 QLinearGradient();
28568 QLinearGradient(const QPointF &start, const QPointF &finalStop);
28569 QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop);
28570 QPointF start() const;
28571 void setStart(const QPointF &start);
28572 inline void setStart(qreal x, qreal y) { setStart(QPointF(x, y)); }
28573 QPointF finalStop() const;
28574 void setFinalStop(const QPointF &stop);
28575 inline void setFinalStop(qreal x, qreal y) { setFinalStop(QPointF(x, y)); }
28576 };
28577 class __attribute__((visibility("default"))) QRadialGradient : public QGradient
28578 {
28579 public:
28580 QRadialGradient();
28581 QRadialGradient(const QPointF &center, qreal radius, const QPointF &focalPoint);
28582 QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy);
28583 QRadialGradient(const QPointF &center, qreal radius);
28584 QRadialGradient(qreal cx, qreal cy, qreal radius);
28585 QPointF center() const;
28586 void setCenter(const QPointF &center);
28587 inline void setCenter(qreal x, qreal y) { setCenter(QPointF(x, y)); }
28588 QPointF focalPoint() const;
28589 void setFocalPoint(const QPointF &focalPoint);
28590 inline void setFocalPoint(qreal x, qreal y) { setFocalPoint(QPointF(x, y)); }
28591 qreal radius() const;
28592 void setRadius(qreal radius);
28593 };
28594 class __attribute__((visibility("default"))) QConicalGradient : public QGradient
28595 {
28596 public:
28597 QConicalGradient();
28598 QConicalGradient(const QPointF &center, qreal startAngle);
28599 QConicalGradient(qreal cx, qreal cy, qreal startAngle);
28600 QPointF center() const;
28601 void setCenter(const QPointF &center);
28602 inline void setCenter(qreal x, qreal y) { setCenter(QPointF(x, y)); }
28603 qreal angle() const;
28604 void setAngle(qreal angle);
28605 };
28606 typedef QtValidLicenseForGuiModule QtGuiModule;
28607 class QVariant;
28608 class QPenPrivate;
28609 class QBrush;
28610 class QPen;
28611 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPen &);
28612 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPen &);
28613 class __attribute__((visibility("default"))) QPen
28614 {
28615 public:
28616 QPen();
28617 QPen(Qt::PenStyle);
28618 QPen(const QColor &color);
28619 QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine,
28620 Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin);
28621 QPen(const QPen &pen);
28622 ~QPen();
28623 QPen &operator=(const QPen &pen);
28624 Qt::PenStyle style() const;
28625 void setStyle(Qt::PenStyle);
28626 QVector<qreal> dashPattern() const;
28627 void setDashPattern(const QVector<qreal> &pattern);
28628 qreal dashOffset() const;
28629 void setDashOffset(qreal doffset);
28630 qreal miterLimit() const;
28631 void setMiterLimit(qreal limit);
28632 qreal widthF() const;
28633 void setWidthF(qreal width);
28634 int width() const;
28635 void setWidth(int width);
28636 QColor color() const;
28637 void setColor(const QColor &color);
28638 QBrush brush() const;
28639 void setBrush(const QBrush &brush);
28640 bool isSolid() const;
28641 Qt::PenCapStyle capStyle() const;
28642 void setCapStyle(Qt::PenCapStyle pcs);
28643 Qt::PenJoinStyle joinStyle() const;
28644 void setJoinStyle(Qt::PenJoinStyle pcs);
28645 bool isCosmetic() const;
28646 void setCosmetic(bool cosmetic);
28647 bool operator==(const QPen &p) const;
28648 inline bool operator!=(const QPen &p) const { return !(operator==(p)); }
28649 operator QVariant() const;
28650 bool isDetached();
28651 private:
28652 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QPen &);
28653 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QPen &);
28654 void detach();
28655 class QPenPrivate *d;
28656 public:
28657 typedef QPenPrivate * DataPtr;
28658 inline DataPtr &data_ptr() { return d; }
28659 };
28660 template <> class QTypeInfo<QPen> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QPen)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QPen"; } };
28661 template <> inline bool qIsDetached<QPen>(QPen &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QPen>(QPen &value1, QPen &value2) { const QPen::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
28662 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QPen &);
28663 typedef QtValidLicenseForGuiModule QtGuiModule;
28664 template <typename T> class QList;
28665 struct QTextOptionPrivate;
28666 class __attribute__((visibility("default"))) QTextOption
28667 {
28668 public:
28669 enum TabType {
28670 LeftTab,
28671 RightTab,
28672 CenterTab,
28673 DelimiterTab
28674 };
28675 struct __attribute__((visibility("default"))) Tab {
28676 inline Tab() : position(80), type(QTextOption::LeftTab) { }
28677 inline bool operator==(const Tab &other) const {
28678 return type == other.type
28679 && qFuzzyCompare(position, other.position)
28680 && delimiter == other.delimiter;
28681 }
28682 inline bool operator!=(const Tab &other) const {
28683 return !operator==(other);
28684 }
28685 qreal position;
28686 TabType type;
28687 QChar delimiter;
28688 };
28689 QTextOption();
28690 QTextOption(Qt::Alignment alignment);
28691 ~QTextOption();
28692 QTextOption(const QTextOption &o);
28693 QTextOption &operator=(const QTextOption &o);
28694 inline void setAlignment(Qt::Alignment alignment);
28695 inline Qt::Alignment alignment() const { return Qt::Alignment(align); }
28696 inline void setTextDirection(Qt::LayoutDirection aDirection) { this->direction = aDirection; }
28697 inline Qt::LayoutDirection textDirection() const { return Qt::LayoutDirection(direction); }
28698 enum WrapMode {
28699 NoWrap,
28700 WordWrap,
28701 ManualWrap,
28702 WrapAnywhere,
28703 WrapAtWordBoundaryOrAnywhere
28704 };
28705 inline void setWrapMode(WrapMode wrap) { wordWrap = wrap; }
28706 inline WrapMode wrapMode() const { return static_cast<WrapMode>(wordWrap); }
28707 enum Flag {
28708 ShowTabsAndSpaces = 0x1,
28709 ShowLineAndParagraphSeparators = 0x2,
28710 AddSpaceForLineAndParagraphSeparators = 0x4,
28711 SuppressColors = 0x8,
28712 IncludeTrailingSpaces = 0x80000000
28713 };
28714 typedef QFlags<Flag> Flags;
28715 inline void setFlags(Flags flags);
28716 inline Flags flags() const { return Flags(f); }
28717 inline void setTabStop(qreal tabStop);
28718 inline qreal tabStop() const { return tab; }
28719 void setTabArray(QList<qreal> tabStops);
28720 QList<qreal> tabArray() const;
28721 void setTabs(QList<Tab> tabStops);
28722 QList<Tab> tabs() const;
28723 void setUseDesignMetrics(bool b) { design = b; }
28724 bool useDesignMetrics() const { return design; }
28725 private:
28726 uint align : 8;
28727 uint wordWrap : 4;
28728 uint design : 1;
28729 uint direction : 1;
28730 uint unused : 19;
28731 uint f;
28732 qreal tab;
28733 QTextOptionPrivate *d;
28734 };
28735 inline QFlags<QTextOption::Flags::enum_type> operator|(QTextOption::Flags::enum_type f1, QTextOption::Flags::enum_type f2) { return QFlags<QTextOption::Flags::enum_type>(f1) | f2; } inline QFlags<QTextOption::Flags::enum_type> operator|(QTextOption::Flags::enum_type f1, QFlags<QTextOption::Flags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextOption::Flags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
28736 inline void QTextOption::setAlignment(Qt::Alignment aalignment)
28737 { align = aalignment; }
28738 inline void QTextOption::setFlags(Flags aflags)
28739 { f = aflags; }
28740 inline void QTextOption::setTabStop(qreal atabStop)
28741 { tab = atabStop; }
28742 template <> struct QMetaTypeId< QTextOption::Tab > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { (0) }; if (!metatype_id) metatype_id = qRegisterMetaType< QTextOption::Tab >("QTextOption::Tab"); return metatype_id; } };
28743 typedef QtValidLicenseForGuiModule QtGuiModule;
28744 class QString;
28745 class QVariant;
28746 class QFont;
28747 class QTextFormatCollection;
28748 class QTextFormatPrivate;
28749 class QTextBlockFormat;
28750 class QTextCharFormat;
28751 class QTextListFormat;
28752 class QTextTableFormat;
28753 class QTextFrameFormat;
28754 class QTextImageFormat;
28755 class QTextTableCellFormat;
28756 class QTextFormat;
28757 class QTextObject;
28758 class QTextCursor;
28759 class QTextDocument;
28760 class QTextLength;
28761 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QTextLength &);
28762 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QTextLength &);
28763 class __attribute__((visibility("default"))) QTextLength
28764 {
28765 public:
28766 enum Type { VariableLength = 0, FixedLength, PercentageLength };
28767 inline QTextLength() : lengthType(VariableLength), fixedValueOrPercentage(0) {}
28768 inline explicit QTextLength(Type type, qreal value);
28769 inline Type type() const { return lengthType; }
28770 inline qreal value(qreal maximumLength) const
28771 {
28772 switch (lengthType) {
28773 case FixedLength: return fixedValueOrPercentage;
28774 case VariableLength: return maximumLength;
28775 case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100);
28776 }
28777 return -1;
28778 }
28779 inline qreal rawValue() const { return fixedValueOrPercentage; }
28780 inline bool operator==(const QTextLength &other) const
28781 { return lengthType == other.lengthType
28782 && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
28783 inline bool operator!=(const QTextLength &other) const
28784 { return lengthType != other.lengthType
28785 || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
28786 operator QVariant() const;
28787 private:
28788 Type lengthType;
28789 qreal fixedValueOrPercentage;
28790 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QTextLength &);
28791 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QTextLength &);
28792 };
28793 inline QTextLength::QTextLength(Type atype, qreal avalue)
28794 : lengthType(atype), fixedValueOrPercentage(avalue) {}
28795 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QTextFormat &);
28796 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QTextFormat &);
28797 class __attribute__((visibility("default"))) QTextFormat
28798 {
28799 public: static const QMetaObject staticMetaObject; private:
28800 public:
28801 enum FormatType {
28802 InvalidFormat = -1,
28803 BlockFormat = 1,
28804 CharFormat = 2,
28805 ListFormat = 3,
28806 TableFormat = 4,
28807 FrameFormat = 5,
28808 UserFormat = 100
28809 };
28810 enum Property {
28811 ObjectIndex = 0x0,
28812 CssFloat = 0x0800,
28813 LayoutDirection = 0x0801,
28814 OutlinePen = 0x810,
28815 BackgroundBrush = 0x820,
28816 ForegroundBrush = 0x821,
28817 BackgroundImageUrl = 0x823,
28818 BlockAlignment = 0x1010,
28819 BlockTopMargin = 0x1030,
28820 BlockBottomMargin = 0x1031,
28821 BlockLeftMargin = 0x1032,
28822 BlockRightMargin = 0x1033,
28823 TextIndent = 0x1034,
28824 TabPositions = 0x1035,
28825 BlockIndent = 0x1040,
28826 BlockNonBreakableLines = 0x1050,
28827 BlockTrailingHorizontalRulerWidth = 0x1060,
28828 FirstFontProperty = 0x1FE0,
28829 FontCapitalization = FirstFontProperty,
28830 FontLetterSpacing = 0x1FE1,
28831 FontWordSpacing = 0x1FE2,
28832 FontStyleHint = 0x1FE3,
28833 FontStyleStrategy = 0x1FE4,
28834 FontKerning = 0x1FE5,
28835 FontFamily = 0x2000,
28836 FontPointSize = 0x2001,
28837 FontSizeAdjustment = 0x2002,
28838 FontSizeIncrement = FontSizeAdjustment,
28839 FontWeight = 0x2003,
28840 FontItalic = 0x2004,
28841 FontUnderline = 0x2005,
28842 FontOverline = 0x2006,
28843 FontStrikeOut = 0x2007,
28844 FontFixedPitch = 0x2008,
28845 FontPixelSize = 0x2009,
28846 LastFontProperty = FontPixelSize,
28847 TextUnderlineColor = 0x2010,
28848 TextVerticalAlignment = 0x2021,
28849 TextOutline = 0x2022,
28850 TextUnderlineStyle = 0x2023,
28851 TextToolTip = 0x2024,
28852 IsAnchor = 0x2030,
28853 AnchorHref = 0x2031,
28854 AnchorName = 0x2032,
28855 ObjectType = 0x2f00,
28856 ListStyle = 0x3000,
28857 ListIndent = 0x3001,
28858 FrameBorder = 0x4000,
28859 FrameMargin = 0x4001,
28860 FramePadding = 0x4002,
28861 FrameWidth = 0x4003,
28862 FrameHeight = 0x4004,
28863 FrameTopMargin = 0x4005,
28864 FrameBottomMargin = 0x4006,
28865 FrameLeftMargin = 0x4007,
28866 FrameRightMargin = 0x4008,
28867 FrameBorderBrush = 0x4009,
28868 FrameBorderStyle = 0x4010,
28869 TableColumns = 0x4100,
28870 TableColumnWidthConstraints = 0x4101,
28871 TableCellSpacing = 0x4102,
28872 TableCellPadding = 0x4103,
28873 TableHeaderRowCount = 0x4104,
28874 TableCellRowSpan = 0x4810,
28875 TableCellColumnSpan = 0x4811,
28876 TableCellTopPadding = 0x4812,
28877 TableCellBottomPadding = 0x4813,
28878 TableCellLeftPadding = 0x4814,
28879 TableCellRightPadding = 0x4815,
28880 ImageName = 0x5000,
28881 ImageWidth = 0x5010,
28882 ImageHeight = 0x5011,
28883 FullWidthSelection = 0x06000,
28884 PageBreakPolicy = 0x7000,
28885 UserProperty = 0x100000
28886 };
28887 enum ObjectTypes {
28888 NoObject,
28889 ImageObject,
28890 TableObject,
28891 TableCellObject,
28892 UserObject = 0x1000
28893 };
28894 enum PageBreakFlag {
28895 PageBreak_Auto = 0,
28896 PageBreak_AlwaysBefore = 0x001,
28897 PageBreak_AlwaysAfter = 0x010
28898 };
28899 typedef QFlags<PageBreakFlag> PageBreakFlags;
28900 QTextFormat();
28901 explicit QTextFormat(int type);
28902 QTextFormat(const QTextFormat &rhs);
28903 QTextFormat &operator=(const QTextFormat &rhs);
28904 ~QTextFormat();
28905 void merge(const QTextFormat &other);
28906 inline bool isValid() const { return type() != InvalidFormat; }
28907 int type() const;
28908 int objectIndex() const;
28909 void setObjectIndex(int object);
28910 QVariant property(int propertyId) const;
28911 void setProperty(int propertyId, const QVariant &value);
28912 void clearProperty(int propertyId);
28913 bool hasProperty(int propertyId) const;
28914 bool boolProperty(int propertyId) const;
28915 int intProperty(int propertyId) const;
28916 qreal doubleProperty(int propertyId) const;
28917 QString stringProperty(int propertyId) const;
28918 QColor colorProperty(int propertyId) const;
28919 QPen penProperty(int propertyId) const;
28920 QBrush brushProperty(int propertyId) const;
28921 QTextLength lengthProperty(int propertyId) const;
28922 QVector<QTextLength> lengthVectorProperty(int propertyId) const;
28923 void setProperty(int propertyId, const QVector<QTextLength> &lengths);
28924 QMap<int, QVariant> properties() const;
28925 int propertyCount() const;
28926 inline void setObjectType(int type);
28927 inline int objectType() const
28928 { return intProperty(ObjectType); }
28929 inline bool isCharFormat() const { return type() == CharFormat; }
28930 inline bool isBlockFormat() const { return type() == BlockFormat; }
28931 inline bool isListFormat() const { return type() == ListFormat; }
28932 inline bool isFrameFormat() const { return type() == FrameFormat; }
28933 inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; }
28934 inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; }
28935 inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; }
28936 QTextBlockFormat toBlockFormat() const;
28937 QTextCharFormat toCharFormat() const;
28938 QTextListFormat toListFormat() const;
28939 QTextTableFormat toTableFormat() const;
28940 QTextFrameFormat toFrameFormat() const;
28941 QTextImageFormat toImageFormat() const;
28942 QTextTableCellFormat toTableCellFormat() const;
28943 bool operator==(const QTextFormat &rhs) const;
28944 inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); }
28945 operator QVariant() const;
28946 inline void setLayoutDirection(Qt::LayoutDirection direction)
28947 { setProperty(QTextFormat::LayoutDirection, direction); }
28948 inline Qt::LayoutDirection layoutDirection() const
28949 { return Qt::LayoutDirection(intProperty(QTextFormat::LayoutDirection)); }
28950 inline void setBackground(const QBrush &brush)
28951 { setProperty(BackgroundBrush, brush); }
28952 inline QBrush background() const
28953 { return brushProperty(BackgroundBrush); }
28954 inline void clearBackground()
28955 { clearProperty(BackgroundBrush); }
28956 inline void setForeground(const QBrush &brush)
28957 { setProperty(ForegroundBrush, brush); }
28958 inline QBrush foreground() const
28959 { return brushProperty(ForegroundBrush); }
28960 inline void clearForeground()
28961 { clearProperty(ForegroundBrush); }
28962 private:
28963 QSharedDataPointer<QTextFormatPrivate> d;
28964 qint32 format_type;
28965 friend class QTextFormatCollection;
28966 friend class QTextCharFormat;
28967 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QTextFormat &);
28968 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QTextFormat &);
28969 };
28970 inline void QTextFormat::setObjectType(int atype)
28971 { setProperty(ObjectType, atype); }
28972 inline QFlags<QTextFormat::PageBreakFlags::enum_type> operator|(QTextFormat::PageBreakFlags::enum_type f1, QTextFormat::PageBreakFlags::enum_type f2) { return QFlags<QTextFormat::PageBreakFlags::enum_type>(f1) | f2; } inline QFlags<QTextFormat::PageBreakFlags::enum_type> operator|(QTextFormat::PageBreakFlags::enum_type f1, QFlags<QTextFormat::PageBreakFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextFormat::PageBreakFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
28973 class __attribute__((visibility("default"))) QTextCharFormat : public QTextFormat
28974 {
28975 public:
28976 enum VerticalAlignment {
28977 AlignNormal = 0,
28978 AlignSuperScript,
28979 AlignSubScript,
28980 AlignMiddle,
28981 AlignTop,
28982 AlignBottom
28983 };
28984 enum UnderlineStyle {
28985 NoUnderline,
28986 SingleUnderline,
28987 DashUnderline,
28988 DotLine,
28989 DashDotLine,
28990 DashDotDotLine,
28991 WaveUnderline,
28992 SpellCheckUnderline
28993 };
28994 QTextCharFormat();
28995 bool isValid() const { return isCharFormat(); }
28996 void setFont(const QFont &font);
28997 QFont font() const;
28998 inline void setFontFamily(const QString &family)
28999 { setProperty(FontFamily, family); }
29000 inline QString fontFamily() const
29001 { return stringProperty(FontFamily); }
29002 inline void setFontPointSize(qreal size)
29003 { setProperty(FontPointSize, size); }
29004 inline qreal fontPointSize() const
29005 { return doubleProperty(FontPointSize); }
29006 inline void setFontWeight(int weight)
29007 { if (weight == QFont::Normal) weight = 0; setProperty(FontWeight, weight); }
29008 inline int fontWeight() const
29009 { int weight = intProperty(FontWeight); if (weight == 0) weight = QFont::Normal; return weight; }
29010 inline void setFontItalic(bool italic)
29011 { setProperty(FontItalic, italic); }
29012 inline bool fontItalic() const
29013 { return boolProperty(FontItalic); }
29014 inline void setFontCapitalization(QFont::Capitalization capitalization)
29015 { setProperty(FontCapitalization, capitalization); }
29016 inline QFont::Capitalization fontCapitalization() const
29017 { return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); }
29018 inline void setFontLetterSpacing(qreal spacing)
29019 { setProperty(FontLetterSpacing, spacing); }
29020 inline qreal fontLetterSpacing() const
29021 { return doubleProperty(FontLetterSpacing); }
29022 inline void setFontWordSpacing(qreal spacing)
29023 { setProperty(FontWordSpacing, spacing); }
29024 inline qreal fontWordSpacing() const
29025 { return doubleProperty(FontWordSpacing); }
29026 inline void setFontUnderline(bool underline)
29027 { setProperty(TextUnderlineStyle, underline ? SingleUnderline : NoUnderline); }
29028 bool fontUnderline() const;
29029 inline void setFontOverline(bool overline)
29030 { setProperty(FontOverline, overline); }
29031 inline bool fontOverline() const
29032 { return boolProperty(FontOverline); }
29033 inline void setFontStrikeOut(bool strikeOut)
29034 { setProperty(FontStrikeOut, strikeOut); }
29035 inline bool fontStrikeOut() const
29036 { return boolProperty(FontStrikeOut); }
29037 inline void setUnderlineColor(const QColor &color)
29038 { setProperty(TextUnderlineColor, color); }
29039 inline QColor underlineColor() const
29040 { return colorProperty(TextUnderlineColor); }
29041 inline void setFontFixedPitch(bool fixedPitch)
29042 { setProperty(FontFixedPitch, fixedPitch); }
29043 inline bool fontFixedPitch() const
29044 { return boolProperty(FontFixedPitch); }
29045 inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault)
29046 { setProperty(FontStyleHint, hint); setProperty(FontStyleStrategy, strategy); }
29047 inline void setFontStyleStrategy(QFont::StyleStrategy strategy)
29048 { setProperty(FontStyleStrategy, strategy); }
29049 QFont::StyleHint fontStyleHint() const
29050 { return static_cast<QFont::StyleHint>(intProperty(FontStyleHint)); }
29051 QFont::StyleStrategy fontStyleStrategy() const
29052 { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); }
29053 inline void setFontKerning(bool enable)
29054 { setProperty(FontKerning, enable); }
29055 inline bool fontKerning() const
29056 { return boolProperty(FontKerning); }
29057 void setUnderlineStyle(UnderlineStyle style);
29058 inline UnderlineStyle underlineStyle() const
29059 { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); }
29060 inline void setVerticalAlignment(VerticalAlignment alignment)
29061 { setProperty(TextVerticalAlignment, alignment); }
29062 inline VerticalAlignment verticalAlignment() const
29063 { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); }
29064 inline void setTextOutline(const QPen &pen)
29065 { setProperty(TextOutline, pen); }
29066 inline QPen textOutline() const
29067 { return penProperty(TextOutline); }
29068 inline void setToolTip(const QString &tip)
29069 { setProperty(TextToolTip, tip); }
29070 inline QString toolTip() const
29071 { return stringProperty(TextToolTip); }
29072 inline void setAnchor(bool anchor)
29073 { setProperty(IsAnchor, anchor); }
29074 inline bool isAnchor() const
29075 { return boolProperty(IsAnchor); }
29076 inline void setAnchorHref(const QString &value)
29077 { setProperty(AnchorHref, value); }
29078 inline QString anchorHref() const
29079 { return stringProperty(AnchorHref); }
29080 inline void setAnchorName(const QString &name)
29081 { setAnchorNames(QStringList(name)); }
29082 QString anchorName() const;
29083 inline void setAnchorNames(const QStringList &names)
29084 { setProperty(AnchorName, names); }
29085 QStringList anchorNames() const;
29086 inline void setTableCellRowSpan(int tableCellRowSpan);
29087 inline int tableCellRowSpan() const
29088 { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; }
29089 inline void setTableCellColumnSpan(int tableCellColumnSpan);
29090 inline int tableCellColumnSpan() const
29091 { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; }
29092 protected:
29093 explicit QTextCharFormat(const QTextFormat &fmt);
29094 friend class QTextFormat;
29095 };
29096 inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan)
29097 {
29098 if (_tableCellRowSpan <= 1)
29099 clearProperty(TableCellRowSpan);
29100 else
29101 setProperty(TableCellRowSpan, _tableCellRowSpan);
29102 }
29103 inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan)
29104 {
29105 if (_tableCellColumnSpan <= 1)
29106 clearProperty(TableCellColumnSpan);
29107 else
29108 setProperty(TableCellColumnSpan, _tableCellColumnSpan);
29109 }
29110 class __attribute__((visibility("default"))) QTextBlockFormat : public QTextFormat
29111 {
29112 public:
29113 QTextBlockFormat();
29114 bool isValid() const { return isBlockFormat(); }
29115 inline void setAlignment(Qt::Alignment alignment);
29116 inline Qt::Alignment alignment() const
29117 { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); }
29118 inline void setTopMargin(qreal margin)
29119 { setProperty(BlockTopMargin, margin); }
29120 inline qreal topMargin() const
29121 { return doubleProperty(BlockTopMargin); }
29122 inline void setBottomMargin(qreal margin)
29123 { setProperty(BlockBottomMargin, margin); }
29124 inline qreal bottomMargin() const
29125 { return doubleProperty(BlockBottomMargin); }
29126 inline void setLeftMargin(qreal margin)
29127 { setProperty(BlockLeftMargin, margin); }
29128 inline qreal leftMargin() const
29129 { return doubleProperty(BlockLeftMargin); }
29130 inline void setRightMargin(qreal margin)
29131 { setProperty(BlockRightMargin, margin); }
29132 inline qreal rightMargin() const
29133 { return doubleProperty(BlockRightMargin); }
29134 inline void setTextIndent(qreal aindent)
29135 { setProperty(TextIndent, aindent); }
29136 inline qreal textIndent() const
29137 { return doubleProperty(TextIndent); }
29138 inline void setIndent(int indent);
29139 inline int indent() const
29140 { return intProperty(BlockIndent); }
29141 inline void setNonBreakableLines(bool b)
29142 { setProperty(BlockNonBreakableLines, b); }
29143 inline bool nonBreakableLines() const
29144 { return boolProperty(BlockNonBreakableLines); }
29145 inline void setPageBreakPolicy(PageBreakFlags flags)
29146 { setProperty(PageBreakPolicy, int(flags)); }
29147 inline PageBreakFlags pageBreakPolicy() const
29148 { return PageBreakFlags(intProperty(PageBreakPolicy)); }
29149 void setTabPositions(const QList<QTextOption::Tab> &tabs);
29150 QList<QTextOption::Tab> tabPositions() const;
29151 protected:
29152 explicit QTextBlockFormat(const QTextFormat &fmt);
29153 friend class QTextFormat;
29154 };
29155 inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment)
29156 { setProperty(BlockAlignment, int(aalignment)); }
29157 inline void QTextBlockFormat::setIndent(int aindent)
29158 { setProperty(BlockIndent, aindent); }
29159 class __attribute__((visibility("default"))) QTextListFormat : public QTextFormat
29160 {
29161 public:
29162 QTextListFormat();
29163 bool isValid() const { return isListFormat(); }
29164 enum Style {
29165 ListDisc = -1,
29166 ListCircle = -2,
29167 ListSquare = -3,
29168 ListDecimal = -4,
29169 ListLowerAlpha = -5,
29170 ListUpperAlpha = -6,
29171 ListStyleUndefined = 0
29172 };
29173 inline void setStyle(Style style);
29174 inline Style style() const
29175 { return static_cast<Style>(intProperty(ListStyle)); }
29176 inline void setIndent(int indent);
29177 inline int indent() const
29178 { return intProperty(ListIndent); }
29179 protected:
29180 explicit QTextListFormat(const QTextFormat &fmt);
29181 friend class QTextFormat;
29182 };
29183 inline void QTextListFormat::setStyle(Style astyle)
29184 { setProperty(ListStyle, astyle); }
29185 inline void QTextListFormat::setIndent(int aindent)
29186 { setProperty(ListIndent, aindent); }
29187 class __attribute__((visibility("default"))) QTextImageFormat : public QTextCharFormat
29188 {
29189 public:
29190 QTextImageFormat();
29191 bool isValid() const { return isImageFormat(); }
29192 inline void setName(const QString &name);
29193 inline QString name() const
29194 { return stringProperty(ImageName); }
29195 inline void setWidth(qreal width);
29196 inline qreal width() const
29197 { return doubleProperty(ImageWidth); }
29198 inline void setHeight(qreal height);
29199 inline qreal height() const
29200 { return doubleProperty(ImageHeight); }
29201 protected:
29202 explicit QTextImageFormat(const QTextFormat &format);
29203 friend class QTextFormat;
29204 };
29205 inline void QTextImageFormat::setName(const QString &aname)
29206 { setProperty(ImageName, aname); }
29207 inline void QTextImageFormat::setWidth(qreal awidth)
29208 { setProperty(ImageWidth, awidth); }
29209 inline void QTextImageFormat::setHeight(qreal aheight)
29210 { setProperty(ImageHeight, aheight); }
29211 class __attribute__((visibility("default"))) QTextFrameFormat : public QTextFormat
29212 {
29213 public:
29214 QTextFrameFormat();
29215 bool isValid() const { return isFrameFormat(); }
29216 enum Position {
29217 InFlow,
29218 FloatLeft,
29219 FloatRight
29220 };
29221 enum BorderStyle {
29222 BorderStyle_None,
29223 BorderStyle_Dotted,
29224 BorderStyle_Dashed,
29225 BorderStyle_Solid,
29226 BorderStyle_Double,
29227 BorderStyle_DotDash,
29228 BorderStyle_DotDotDash,
29229 BorderStyle_Groove,
29230 BorderStyle_Ridge,
29231 BorderStyle_Inset,
29232 BorderStyle_Outset
29233 };
29234 inline void setPosition(Position f)
29235 { setProperty(CssFloat, f); }
29236 inline Position position() const
29237 { return static_cast<Position>(intProperty(CssFloat)); }
29238 inline void setBorder(qreal border);
29239 inline qreal border() const
29240 { return doubleProperty(FrameBorder); }
29241 inline void setBorderBrush(const QBrush &brush)
29242 { setProperty(FrameBorderBrush, brush); }
29243 inline QBrush borderBrush() const
29244 { return brushProperty(FrameBorderBrush); }
29245 inline void setBorderStyle(BorderStyle style)
29246 { setProperty(FrameBorderStyle, style); }
29247 inline BorderStyle borderStyle() const
29248 { return static_cast<BorderStyle>(intProperty(FrameBorderStyle)); }
29249 void setMargin(qreal margin);
29250 inline qreal margin() const
29251 { return doubleProperty(FrameMargin); }
29252 inline void setTopMargin(qreal margin);
29253 qreal topMargin() const;
29254 inline void setBottomMargin(qreal margin);
29255 qreal bottomMargin() const;
29256 inline void setLeftMargin(qreal margin);
29257 qreal leftMargin() const;
29258 inline void setRightMargin(qreal margin);
29259 qreal rightMargin() const;
29260 inline void setPadding(qreal padding);
29261 inline qreal padding() const
29262 { return doubleProperty(FramePadding); }
29263 inline void setWidth(qreal width);
29264 inline void setWidth(const QTextLength &length)
29265 { setProperty(FrameWidth, length); }
29266 inline QTextLength width() const
29267 { return lengthProperty(FrameWidth); }
29268 inline void setHeight(qreal height);
29269 inline void setHeight(const QTextLength &height);
29270 inline QTextLength height() const
29271 { return lengthProperty(FrameHeight); }
29272 inline void setPageBreakPolicy(PageBreakFlags flags)
29273 { setProperty(PageBreakPolicy, int(flags)); }
29274 inline PageBreakFlags pageBreakPolicy() const
29275 { return PageBreakFlags(intProperty(PageBreakPolicy)); }
29276 protected:
29277 explicit QTextFrameFormat(const QTextFormat &fmt);
29278 friend class QTextFormat;
29279 };
29280 inline void QTextFrameFormat::setBorder(qreal aborder)
29281 { setProperty(FrameBorder, aborder); }
29282 inline void QTextFrameFormat::setPadding(qreal apadding)
29283 { setProperty(FramePadding, apadding); }
29284 inline void QTextFrameFormat::setWidth(qreal awidth)
29285 { setProperty(FrameWidth, QTextLength(QTextLength::FixedLength, awidth)); }
29286 inline void QTextFrameFormat::setHeight(qreal aheight)
29287 { setProperty(FrameHeight, QTextLength(QTextLength::FixedLength, aheight)); }
29288 inline void QTextFrameFormat::setHeight(const QTextLength &aheight)
29289 { setProperty(FrameHeight, aheight); }
29290 inline void QTextFrameFormat::setTopMargin(qreal amargin)
29291 { setProperty(FrameTopMargin, amargin); }
29292 inline void QTextFrameFormat::setBottomMargin(qreal amargin)
29293 { setProperty(FrameBottomMargin, amargin); }
29294 inline void QTextFrameFormat::setLeftMargin(qreal amargin)
29295 { setProperty(FrameLeftMargin, amargin); }
29296 inline void QTextFrameFormat::setRightMargin(qreal amargin)
29297 { setProperty(FrameRightMargin, amargin); }
29298 class __attribute__((visibility("default"))) QTextTableFormat : public QTextFrameFormat
29299 {
29300 public:
29301 QTextTableFormat();
29302 inline bool isValid() const { return isTableFormat(); }
29303 inline int columns() const
29304 { int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; }
29305 inline void setColumns(int columns);
29306 inline void setColumnWidthConstraints(const QVector<QTextLength> &constraints)
29307 { setProperty(TableColumnWidthConstraints, constraints); }
29308 inline QVector<QTextLength> columnWidthConstraints() const
29309 { return lengthVectorProperty(TableColumnWidthConstraints); }
29310 inline void clearColumnWidthConstraints()
29311 { clearProperty(TableColumnWidthConstraints); }
29312 inline qreal cellSpacing() const
29313 { return doubleProperty(TableCellSpacing); }
29314 inline void setCellSpacing(qreal spacing)
29315 { setProperty(TableCellSpacing, spacing); }
29316 inline qreal cellPadding() const
29317 { return doubleProperty(TableCellPadding); }
29318 inline void setCellPadding(qreal padding);
29319 inline void setAlignment(Qt::Alignment alignment);
29320 inline Qt::Alignment alignment() const
29321 { return QFlag(intProperty(BlockAlignment)); }
29322 inline void setHeaderRowCount(int count)
29323 { setProperty(TableHeaderRowCount, count); }
29324 inline int headerRowCount() const
29325 { return intProperty(TableHeaderRowCount); }
29326 protected:
29327 explicit QTextTableFormat(const QTextFormat &fmt);
29328 friend class QTextFormat;
29329 };
29330 inline void QTextTableFormat::setColumns(int acolumns)
29331 {
29332 if (acolumns == 1)
29333 acolumns = 0;
29334 setProperty(TableColumns, acolumns);
29335 }
29336 inline void QTextTableFormat::setCellPadding(qreal apadding)
29337 { setProperty(TableCellPadding, apadding); }
29338 inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment)
29339 { setProperty(BlockAlignment, int(aalignment)); }
29340 class __attribute__((visibility("default"))) QTextTableCellFormat : public QTextCharFormat
29341 {
29342 public:
29343 QTextTableCellFormat();
29344 inline bool isValid() const { return isTableCellFormat(); }
29345 inline void setTopPadding(qreal padding);
29346 inline qreal topPadding() const;
29347 inline void setBottomPadding(qreal padding);
29348 inline qreal bottomPadding() const;
29349 inline void setLeftPadding(qreal padding);
29350 inline qreal leftPadding() const;
29351 inline void setRightPadding(qreal padding);
29352 inline qreal rightPadding() const;
29353 inline void setPadding(qreal padding);
29354 protected:
29355 explicit QTextTableCellFormat(const QTextFormat &fmt);
29356 friend class QTextFormat;
29357 };
29358 inline void QTextTableCellFormat::setTopPadding(qreal padding)
29359 {
29360 setProperty(TableCellTopPadding, padding);
29361 }
29362 inline qreal QTextTableCellFormat::topPadding() const
29363 {
29364 return doubleProperty(TableCellTopPadding);
29365 }
29366 inline void QTextTableCellFormat::setBottomPadding(qreal padding)
29367 {
29368 setProperty(TableCellBottomPadding, padding);
29369 }
29370 inline qreal QTextTableCellFormat::bottomPadding() const
29371 {
29372 return doubleProperty(TableCellBottomPadding);
29373 }
29374 inline void QTextTableCellFormat::setLeftPadding(qreal padding)
29375 {
29376 setProperty(TableCellLeftPadding, padding);
29377 }
29378 inline qreal QTextTableCellFormat::leftPadding() const
29379 {
29380 return doubleProperty(TableCellLeftPadding);
29381 }
29382 inline void QTextTableCellFormat::setRightPadding(qreal padding)
29383 {
29384 setProperty(TableCellRightPadding, padding);
29385 }
29386 inline qreal QTextTableCellFormat::rightPadding() const
29387 {
29388 return doubleProperty(TableCellRightPadding);
29389 }
29390 inline void QTextTableCellFormat::setPadding(qreal padding)
29391 {
29392 setTopPadding(padding);
29393 setBottomPadding(padding);
29394 setLeftPadding(padding);
29395 setRightPadding(padding);
29396 }
29397 typedef QtValidLicenseForGuiModule QtGuiModule;
29398 class QTextEngine;
29399 class QFont;
29400 class QRect;
29401 class QRegion;
29402 class QTextFormat;
29403 class QPalette;
29404 class QPainter;
29405 class __attribute__((visibility("default"))) QTextInlineObject
29406 {
29407 public:
29408 QTextInlineObject(int i, QTextEngine *e) : itm(i), eng(e) {}
29409 inline QTextInlineObject() : itm(0), eng(0) {}
29410 inline bool isValid() const { return eng; }
29411 QRectF rect() const;
29412 qreal width() const;
29413 qreal ascent() const;
29414 qreal descent() const;
29415 qreal height() const;
29416 Qt::LayoutDirection textDirection() const;
29417 void setWidth(qreal w);
29418 void setAscent(qreal a);
29419 void setDescent(qreal d);
29420 int textPosition() const;
29421 int formatIndex() const;
29422 QTextFormat format() const;
29423 private:
29424 friend class QTextLayout;
29425 int itm;
29426 QTextEngine *eng;
29427 };
29428 class QPaintDevice;
29429 class QTextFormat;
29430 class QTextLine;
29431 class QTextBlock;
29432 class QTextOption;
29433 class __attribute__((visibility("default"))) QTextLayout
29434 {
29435 public:
29436 QTextLayout();
29437 QTextLayout(const QString& text);
29438 QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = 0);
29439 QTextLayout(const QTextBlock &b);
29440 ~QTextLayout();
29441 void setFont(const QFont &f);
29442 QFont font() const;
29443 void setText(const QString& string);
29444 QString text() const;
29445 void setTextOption(const QTextOption &option);
29446 QTextOption textOption() const;
29447 void setPreeditArea(int position, const QString &text);
29448 int preeditAreaPosition() const;
29449 QString preeditAreaText() const;
29450 struct FormatRange {
29451 int start;
29452 int length;
29453 QTextCharFormat format;
29454 };
29455 void setAdditionalFormats(const QList<FormatRange> &overrides);
29456 QList<FormatRange> additionalFormats() const;
29457 void clearAdditionalFormats();
29458 void setCacheEnabled(bool enable);
29459 bool cacheEnabled() const;
29460 void beginLayout();
29461 void endLayout();
29462 void clearLayout();
29463 QTextLine createLine();
29464 int lineCount() const;
29465 QTextLine lineAt(int i) const;
29466 QTextLine lineForTextPosition(int pos) const;
29467 enum CursorMode {
29468 SkipCharacters,
29469 SkipWords
29470 };
29471 bool isValidCursorPosition(int pos) const;
29472 int nextCursorPosition(int oldPos, CursorMode mode = SkipCharacters) const;
29473 int previousCursorPosition(int oldPos, CursorMode mode = SkipCharacters) const;
29474 void draw(QPainter *p, const QPointF &pos, const QVector<FormatRange> &selections = QVector<FormatRange>(),
29475 const QRectF &clip = QRectF()) const;
29476 void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const;
29477 void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width) const;
29478 QPointF position() const;
29479 void setPosition(const QPointF &p);
29480 QRectF boundingRect() const;
29481 qreal minimumWidth() const;
29482 qreal maximumWidth() const;
29483 QTextEngine *engine() const { return d; }
29484 void setFlags(int flags);
29485 private:
29486 QTextLayout(QTextEngine *e) : d(e) {}
29487 QTextLayout(const QTextLayout &); QTextLayout &operator=(const QTextLayout &);
29488 friend class QPainter;
29489 friend class QPSPrinter;
29490 friend class QGraphicsSimpleTextItemPrivate;
29491 friend class QGraphicsSimpleTextItem;
29492 friend void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *, const QString& str,
29493 QRectF *brect, int tabstops, int* tabarray, int tabarraylen,
29494 QPainter *painter);
29495 QTextEngine *d;
29496 };
29497 class __attribute__((visibility("default"))) QTextLine
29498 {
29499 public:
29500 inline QTextLine() : i(0), eng(0) {}
29501 inline bool isValid() const { return eng; }
29502 QRectF rect() const;
29503 qreal x() const;
29504 qreal y() const;
29505 qreal width() const;
29506 qreal ascent() const;
29507 qreal descent() const;
29508 qreal height() const;
29509 qreal naturalTextWidth() const;
29510 QRectF naturalTextRect() const;
29511 enum Edge {
29512 Leading,
29513 Trailing
29514 };
29515 enum CursorPosition {
29516 CursorBetweenCharacters,
29517 CursorOnCharacter
29518 };
29519 qreal cursorToX(int *cursorPos, Edge edge = Leading) const;
29520 inline qreal cursorToX(int cursorPos, Edge edge = Leading) const { return cursorToX(&cursorPos, edge); }
29521 int xToCursor(qreal x, CursorPosition = CursorBetweenCharacters) const;
29522 void setLineWidth(qreal width);
29523 void setNumColumns(int columns);
29524 void setNumColumns(int columns, qreal alignmentWidth);
29525 void setPosition(const QPointF &pos);
29526 QPointF position() const;
29527 int textStart() const;
29528 int textLength() const;
29529 int lineNumber() const { return i; }
29530 void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = 0) const;
29531 private:
29532 QTextLine(int line, QTextEngine *e) : i(line), eng(e) {}
29533 void layout_helper(int numGlyphs);
29534 friend class QTextLayout;
29535 int i;
29536 QTextEngine *eng;
29537 };
29538 class __attribute__((visibility("default"))) QTextFormatCollection
29539 {
29540 public:
29541 QTextFormatCollection() {}
29542 ~QTextFormatCollection();
29543 QTextFormatCollection(const QTextFormatCollection &rhs);
29544 QTextFormatCollection &operator=(const QTextFormatCollection &rhs);
29545 QTextFormat objectFormat(int objectIndex) const;
29546 void setObjectFormat(int objectIndex, const QTextFormat &format);
29547 int objectFormatIndex(int objectIndex) const;
29548 void setObjectFormatIndex(int objectIndex, int formatIndex);
29549 int createObjectIndex(const QTextFormat &f);
29550 int indexForFormat(const QTextFormat &f);
29551 bool hasFormatCached(const QTextFormat &format) const;
29552 QTextFormat format(int idx) const;
29553 inline QTextBlockFormat blockFormat(int index) const
29554 { return format(index).toBlockFormat(); }
29555 inline QTextCharFormat charFormat(int index) const
29556 { return format(index).toCharFormat(); }
29557 inline QTextListFormat listFormat(int index) const
29558 { return format(index).toListFormat(); }
29559 inline QTextTableFormat tableFormat(int index) const
29560 { return format(index).toTableFormat(); }
29561 inline QTextImageFormat imageFormat(int index) const
29562 { return format(index).toImageFormat(); }
29563 inline int numFormats() const { return formats.count(); }
29564 typedef QVector<QTextFormat> FormatVector;
29565 FormatVector formats;
29566 QVector<qint32> objFormats;
29567 QSet<uint> hashes;
29568 inline QFont defaultFont() const { return defaultFnt; }
29569 void setDefaultFont(const QFont &f);
29570 private:
29571 QFont defaultFnt;
29572 };
29573 namespace QUnicodeTables {
29574 struct Properties {
29575 ushort category : 8;
29576 ushort line_break_class : 8;
29577 ushort direction : 8;
29578 ushort combiningClass :8;
29579 ushort joining : 2;
29580 signed short digitValue : 6;
29581 ushort unicodeVersion : 4;
29582 ushort lowerCaseSpecial : 1;
29583 ushort upperCaseSpecial : 1;
29584 ushort titleCaseSpecial : 1;
29585 ushort caseFoldSpecial : 1;
29586 signed short mirrorDiff : 16;
29587 signed short lowerCaseDiff : 16;
29588 signed short upperCaseDiff : 16;
29589 signed short titleCaseDiff : 16;
29590 signed short caseFoldDiff : 16;
29591 ushort graphemeBreak : 8;
29592 ushort wordBreak : 8;
29593 ushort sentenceBreak : 8;
29594 };
29595 __attribute__((visibility("default"))) const Properties* properties(uint ucs4);
29596 __attribute__((visibility("default"))) const Properties* properties(ushort ucs2);
29597 enum Script {
29598 Common,
29599 Greek,
29600 Cyrillic,
29601 Armenian,
29602 Hebrew,
29603 Arabic,
29604 Syriac,
29605 Thaana,
29606 Devanagari,
29607 Bengali,
29608 Gurmukhi,
29609 Gujarati,
29610 Oriya,
29611 Tamil,
29612 Telugu,
29613 Kannada,
29614 Malayalam,
29615 Sinhala,
29616 Thai,
29617 Lao,
29618 Tibetan,
29619 Myanmar,
29620 Georgian,
29621 Hangul,
29622 Ogham,
29623 Runic,
29624 Khmer,
29625 Inherited,
29626 ScriptCount = Inherited,
29627 Latin = Common,
29628 Ethiopic = Common,
29629 Cherokee = Common,
29630 CanadianAboriginal = Common,
29631 Mongolian = Common,
29632 Hiragana = Common,
29633 Katakana = Common,
29634 Bopomofo = Common,
29635 Han = Common,
29636 Yi = Common,
29637 OldItalic = Common,
29638 Gothic = Common,
29639 Deseret = Common,
29640 Tagalog = Common,
29641 Hanunoo = Common,
29642 Buhid = Common,
29643 Tagbanwa = Common,
29644 Limbu = Common,
29645 TaiLe = Common,
29646 LinearB = Common,
29647 Ugaritic = Common,
29648 Shavian = Common,
29649 Osmanya = Common,
29650 Cypriot = Common,
29651 Braille = Common,
29652 Buginese = Common,
29653 Coptic = Common,
29654 NewTaiLue = Common,
29655 Glagolitic = Common,
29656 Tifinagh = Common,
29657 SylotiNagri = Common,
29658 OldPersian = Common,
29659 Kharoshthi = Common,
29660 Balinese = Common,
29661 Cuneiform = Common,
29662 Phoenician = Common,
29663 PhagsPa = Common,
29664 Nko = Common
29665 };
29666 enum { ScriptSentinel = 32 };
29667 enum LineBreakClass {
29668 LineBreak_OP, LineBreak_CL, LineBreak_QU, LineBreak_GL, LineBreak_NS,
29669 LineBreak_EX, LineBreak_SY, LineBreak_IS, LineBreak_PR, LineBreak_PO,
29670 LineBreak_NU, LineBreak_AL, LineBreak_ID, LineBreak_IN, LineBreak_HY,
29671 LineBreak_BA, LineBreak_BB, LineBreak_B2, LineBreak_ZW, LineBreak_CM,
29672 LineBreak_WJ, LineBreak_H2, LineBreak_H3, LineBreak_JL, LineBreak_JV,
29673 LineBreak_JT, LineBreak_SA, LineBreak_SG,
29674 LineBreak_SP, LineBreak_CR, LineBreak_LF, LineBreak_BK
29675 };
29676 __attribute__((visibility("default"))) QUnicodeTables::LineBreakClass lineBreakClass(uint ucs4);
29677 inline int lineBreakClass(const QChar &ch) {
29678 return QUnicodeTables::lineBreakClass(ch.unicode());
29679 }
29680 __attribute__((visibility("default"))) int script(uint ucs4);
29681 __attribute__((visibility("default"))) inline int script(const QChar &ch) {
29682 return script(ch.unicode());
29683 }
29684 enum GraphemeBreak {
29685 GraphemeBreakOther,
29686 GraphemeBreakCR,
29687 GraphemeBreakLF,
29688 GraphemeBreakControl,
29689 GraphemeBreakExtend,
29690 GraphemeBreakL,
29691 GraphemeBreakV,
29692 GraphemeBreakT,
29693 GraphemeBreakLV,
29694 GraphemeBreakLVT
29695 };
29696 enum WordBreak {
29697 WordBreakOther,
29698 WordBreakFormat,
29699 WordBreakKatakana,
29700 WordBreakALetter,
29701 WordBreakMidLetter,
29702 WordBreakMidNum,
29703 WordBreakNumeric,
29704 WordBreakExtendNumLet
29705 };
29706 enum SentenceBreak {
29707 SentenceBreakOther,
29708 SentenceBreakSep,
29709 SentenceBreakFormat,
29710 SentenceBreakSp,
29711 SentenceBreakLower,
29712 SentenceBreakUpper,
29713 SentenceBreakOLetter,
29714 SentenceBreakNumeric,
29715 SentenceBreakATerm,
29716 SentenceBreakSTerm,
29717 SentenceBreakClose
29718 };
29719 }
29720 typedef QtValidLicenseForGuiModule QtGuiModule;
29721 class QStringList;
29722 template <class T> class QList;
29723 struct QFontDef;
29724 class QFontEngine;
29725 class QFontDatabasePrivate;
29726 class __attribute__((visibility("default"))) QFontDatabase
29727 {
29728 public: static const QMetaObject staticMetaObject; private:
29729 public:
29730 enum WritingSystem {
29731 Any,
29732 Latin,
29733 Greek,
29734 Cyrillic,
29735 Armenian,
29736 Hebrew,
29737 Arabic,
29738 Syriac,
29739 Thaana,
29740 Devanagari,
29741 Bengali,
29742 Gurmukhi,
29743 Gujarati,
29744 Oriya,
29745 Tamil,
29746 Telugu,
29747 Kannada,
29748 Malayalam,
29749 Sinhala,
29750 Thai,
29751 Lao,
29752 Tibetan,
29753 Myanmar,
29754 Georgian,
29755 Khmer,
29756 SimplifiedChinese,
29757 TraditionalChinese,
29758 Japanese,
29759 Korean,
29760 Vietnamese,
29761 Symbol,
29762 Other = Symbol,
29763 Ogham,
29764 Runic,
29765 WritingSystemsCount
29766 };
29767 static QList<int> standardSizes();
29768 QFontDatabase();
29769 QList<WritingSystem> writingSystems() const;
29770 QList<WritingSystem> writingSystems(const QString &family) const;
29771 QStringList families(WritingSystem writingSystem = Any) const;
29772 QStringList styles(const QString &family) const;
29773 QList<int> pointSizes(const QString &family, const QString &style = QString());
29774 QList<int> smoothSizes(const QString &family, const QString &style);
29775 QString styleString(const QFont &font);
29776 QString styleString(const QFontInfo &fontInfo);
29777 QFont font(const QString &family, const QString &style, int pointSize) const;
29778 bool isBitmapScalable(const QString &family, const QString &style = QString()) const;
29779 bool isSmoothlyScalable(const QString &family, const QString &style = QString()) const;
29780 bool isScalable(const QString &family, const QString &style = QString()) const;
29781 bool isFixedPitch(const QString &family, const QString &style = QString()) const;
29782 bool italic(const QString &family, const QString &style) const;
29783 bool bold(const QString &family, const QString &style) const;
29784 int weight(const QString &family, const QString &style) const;
29785 static QString writingSystemName(WritingSystem writingSystem);
29786 static QString writingSystemSample(WritingSystem writingSystem);
29787 static int addApplicationFont(const QString &fileName);
29788 static int addApplicationFontFromData(const QByteArray &fontData);
29789 static QStringList applicationFontFamilies(int id);
29790 static bool removeApplicationFont(int id);
29791 static bool removeAllApplicationFonts();
29792 static bool supportsThreadedFontRendering();
29793 private:
29794 static void createDatabase();
29795 static void parseFontName(const QString &name, QString &foundry, QString &family);
29796 static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request);
29797 static void load(const QFontPrivate *d, int script);
29798 friend struct QFontDef;
29799 friend class QFontPrivate;
29800 friend class QFontDialog;
29801 friend class QFontDialogPrivate;
29802 friend class QFontEngineMultiXLFD;
29803 friend class QFontEngineMultiQWS;
29804 QFontDatabasePrivate *d;
29805 };
29806 struct QFixed {
29807 public:
29808 QFixed() : val(0) {}
29809 QFixed(int i) : val(i<<6) {}
29810 QFixed(long i) : val(i<<6) {}
29811 QFixed &operator=(int i) { val = (i<<6); return *this; }
29812 QFixed &operator=(long i) { val = (i<<6); return *this; }
29813 static QFixed fromReal(qreal r) { QFixed f; f.val = (int)(r*qreal(64)); return f; }
29814 static QFixed fromFixed(int fixed) { QFixed f; f.val = fixed; return f; }
29815 inline int value() const { return val; }
29816 inline void setValue(int value) { val = value; }
29817 inline int toInt() const { return (((val)+32) & -64)>>6; }
29818 inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
29819 inline int truncate() const { return val>>6; }
29820 inline QFixed round() const { QFixed f; f.val = ((val)+32) & -64; return f; }
29821 inline QFixed floor() const { QFixed f; f.val = (val) & -64; return f; }
29822 inline QFixed ceil() const { QFixed f; f.val = (val+63) & -64; return f; }
29823 inline QFixed operator+(int i) const { QFixed f; f.val = (val + (i<<6)); return f; }
29824 inline QFixed operator+(uint i) const { QFixed f; f.val = (val + (i<<6)); return f; }
29825 inline QFixed operator+(const QFixed &other) const { QFixed f; f.val = (val + other.val); return f; }
29826 inline QFixed &operator+=(int i) { val += (i<<6); return *this; }
29827 inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
29828 inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
29829 inline QFixed operator-(int i) const { QFixed f; f.val = (val - (i<<6)); return f; }
29830 inline QFixed operator-(uint i) const { QFixed f; f.val = (val - (i<<6)); return f; }
29831 inline QFixed operator-(const QFixed &other) const { QFixed f; f.val = (val - other.val); return f; }
29832 inline QFixed &operator-=(int i) { val -= (i<<6); return *this; }
29833 inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
29834 inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
29835 inline QFixed operator-() const { QFixed f; f.val = -val; return f; }
29836 inline bool operator==(const QFixed &other) const { return val == other.val; }
29837 inline bool operator!=(const QFixed &other) const { return val != other.val; }
29838 inline bool operator<(const QFixed &other) const { return val < other.val; }
29839 inline bool operator>(const QFixed &other) const { return val > other.val; }
29840 inline bool operator<=(const QFixed &other) const { return val <= other.val; }
29841 inline bool operator>=(const QFixed &other) const { return val >= other.val; }
29842 inline bool operator!() const { return !val; }
29843 inline QFixed &operator/=(int x) { val /= x; return *this; }
29844 inline QFixed &operator/=(const QFixed &o) {
29845 if (o.val == 0) {
29846 val = 0x7FFFFFFFL;
29847 } else {
29848 bool neg = false;
29849 qint64 a = val;
29850 qint64 b = o.val;
29851 if (a < 0) { a = -a; neg = true; }
29852 if (b < 0) { b = -b; neg = !neg; }
29853 int res = (int)(((a << 6) + (b >> 1)) / b);
29854 val = (neg ? -res : res);
29855 }
29856 return *this;
29857 }
29858 inline QFixed operator/(int d) const { QFixed f; f.val = val/d; return f; }
29859 inline QFixed operator/(QFixed b) const { QFixed f = *this; return (f /= b); }
29860 inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; }
29861 inline QFixed &operator*=(int i) { val *= i; return *this; }
29862 inline QFixed &operator*=(uint i) { val *= i; return *this; }
29863 inline QFixed &operator*=(const QFixed &o) {
29864 bool neg = false;
29865 qint64 a = val;
29866 qint64 b = o.val;
29867 if (a < 0) { a = -a; neg = true; }
29868 if (b < 0) { b = -b; neg = !neg; }
29869 int res = (int)((a * b + 0x20L) >> 6);
29870 val = neg ? -res : res;
29871 return *this;
29872 }
29873 inline QFixed operator*(int i) const { QFixed f = *this; return (f *= i); }
29874 inline QFixed operator*(uint i) const { QFixed f = *this; return (f *= i); }
29875 inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); }
29876 private:
29877 QFixed(qreal i) : val((int)(i*qreal(64))) {}
29878 QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; }
29879 inline QFixed operator+(qreal i) const { QFixed f; f.val = (val + (int)(i*qreal(64))); return f; }
29880 inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; }
29881 inline QFixed operator-(qreal i) const { QFixed f; f.val = (val - (int)(i*qreal(64))); return f; }
29882 inline QFixed &operator-=(qreal i) { val -= (int)(i*64); return *this; }
29883 inline QFixed &operator/=(qreal r) { val = (int)(val/r); return *this; }
29884 inline QFixed operator/(qreal d) const { QFixed f; f.val = (int)(val/d); return f; }
29885 inline QFixed &operator*=(qreal d) { val = (int) (val*d); return *this; }
29886 inline QFixed operator*(qreal d) const { QFixed f = *this; return (f *= d); }
29887 int val;
29888 };
29889 template <> class QTypeInfo<QFixed> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QFixed)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QFixed"; } };
29890 inline int qRound(const QFixed &f) { return f.toInt(); }
29891 inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
29892 inline QFixed operator*(int i, const QFixed &d) { return d*i; }
29893 inline QFixed operator+(int i, const QFixed &d) { return d+i; }
29894 inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
29895 inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
29896 inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
29897 inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
29898 inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); }
29899 inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); }
29900 inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); }
29901 inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); }
29902 inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); }
29903 inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); }
29904 inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); }
29905 inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); }
29906 inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); }
29907 inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); }
29908 inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); }
29909 inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); }
29910 inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
29911 { return dbg << f.toReal(); }
29912 struct QFixedPoint {
29913 QFixed x;
29914 QFixed y;
29915 inline QFixedPoint() {}
29916 inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
29917 QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
29918 static QFixedPoint fromPointF(const QPointF &p) {
29919 return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y()));
29920 }
29921 };
29922 template <> class QTypeInfo<QFixedPoint> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QFixedPoint)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QFixedPoint"; } };
29923 inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
29924 { return QFixedPoint(p1.x - p2.x, p1.y - p2.y); }
29925 inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
29926 { return QFixedPoint(p1.x + p2.x, p1.y + p2.y); }
29927 struct QFixedSize {
29928 QFixed width;
29929 QFixed height;
29930 QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
29931 static QFixedSize fromSizeF(const QSizeF &s) {
29932 QFixedSize size;
29933 size.width = QFixed::fromReal(s.width());
29934 size.height = QFixed::fromReal(s.height());
29935 return size;
29936 }
29937 };
29938 template <> class QTypeInfo<QFixedSize> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QFixedSize)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QFixedSize"; } };
29939 class QFontCache;
29940 class QFontEngine;
29941 struct QFontDef
29942 {
29943 inline QFontDef()
29944 : pointSize(-1.0), pixelSize(-1),
29945 styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
29946 weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
29947 ignorePitch(true)
29948 {
29949 }
29950 QString family;
29951 qreal pointSize;
29952 int pixelSize;
29953 uint styleStrategy : 16;
29954 uint styleHint : 8;
29955 uint weight : 7;
29956 uint fixedPitch : 1;
29957 uint style : 2;
29958 uint stretch : 12;
29959 uint ignorePitch : 1;
29960 uint fixedPitchComputed : 1;
29961 int reserved : 16;
29962 bool exactMatch(const QFontDef &other) const;
29963 bool operator==(const QFontDef &other) const
29964 {
29965 return pixelSize == other.pixelSize
29966 && weight == other.weight
29967 && style == other.style
29968 && stretch == other.stretch
29969 && styleHint == other.styleHint
29970 && styleStrategy == other.styleStrategy
29971 && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
29972 && family == other.family
29973 ;
29974 }
29975 inline bool operator<(const QFontDef &other) const
29976 {
29977 if (pixelSize != other.pixelSize) return pixelSize < other.pixelSize;
29978 if (weight != other.weight) return weight < other.weight;
29979 if (style != other.style) return style < other.style;
29980 if (stretch != other.stretch) return stretch < other.stretch;
29981 if (styleHint != other.styleHint) return styleHint < other.styleHint;
29982 if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
29983 if (family != other.family) return family < other.family;
29984 if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch;
29985 if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch;
29986 return false;
29987 }
29988 };
29989 class QFontEngineData
29990 {
29991 public:
29992 QFontEngineData();
29993 ~QFontEngineData();
29994 QAtomicInt ref;
29995 QFontCache *fontCache;
29996 QFontEngine *engines[QUnicodeTables::ScriptCount];
29997 };
29998 class __attribute__((visibility("default"))) QFontPrivate
29999 {
30000 public:
30001 QFontPrivate();
30002 QFontPrivate(const QFontPrivate &other);
30003 ~QFontPrivate();
30004 QFontEngine *engineForScript(int script) const;
30005 void alterCharForCapitalization(QChar &c) const;
30006 QAtomicInt ref;
30007 QFontDef request;
30008 mutable QFontEngineData *engineData;
30009 int dpi;
30010 int screen;
30011 uint rawMode : 1;
30012 uint underline : 1;
30013 uint overline : 1;
30014 uint strikeOut : 1;
30015 uint kerning : 1;
30016 uint capital : 3;
30017 bool letterSpacingIsAbsolute : 1;
30018 QFixed letterSpacing;
30019 QFixed wordSpacing;
30020 mutable QFontPrivate *scFont;
30021 QFont smallCapsFont() const { return QFont(smallCapsFontPrivate()); }
30022 QFontPrivate *smallCapsFontPrivate() const;
30023 void resolve(uint mask, const QFontPrivate *other);
30024 private:
30025 QFontPrivate &operator=(const QFontPrivate &) { return *this; }
30026 };
30027 class QFontCache : public QObject
30028 {
30029 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
30030 public:
30031 static QFontCache *instance();
30032 static void cleanup();
30033 QFontCache();
30034 ~QFontCache();
30035 void clear();
30036 void removeEngineForFont(const QByteArray &fontName);
30037 struct Key {
30038 Key() : script(0), screen(0) { }
30039 Key(const QFontDef &d, int c, int s = 0)
30040 : def(d), script(c), screen(s) { }
30041 QFontDef def;
30042 int script;
30043 int screen;
30044 inline bool operator<(const Key &other) const
30045 {
30046 if (script != other.script) return script < other.script;
30047 if (screen != other.screen) return screen < other.screen;
30048 return def < other.def;
30049 }
30050 inline bool operator==(const Key &other) const
30051 { return def == other.def && script == other.script && screen == other.screen; }
30052 };
30053 typedef QMap<Key,QFontEngineData*> EngineDataCache;
30054 EngineDataCache engineDataCache;
30055 QFontEngineData *findEngineData(const Key &key) const;
30056 void insertEngineData(const Key &key, QFontEngineData *engineData);
30057 struct Engine {
30058 Engine() : data(0), timestamp(0), hits(0) { }
30059 Engine(QFontEngine *d) : data(d), timestamp(0), hits(0) { }
30060 QFontEngine *data;
30061 uint timestamp;
30062 uint hits;
30063 };
30064 typedef QMap<Key,Engine> EngineCache;
30065 EngineCache engineCache;
30066 QFontEngine *findEngine(const Key &key);
30067 void insertEngine(const Key &key, QFontEngine *engine);
30068 void cleanupPrinterFonts();
30069 private:
30070 void increaseCost(uint cost);
30071 void decreaseCost(uint cost);
30072 void timerEvent(QTimerEvent *event);
30073 static const uint min_cost;
30074 uint total_cost, max_cost;
30075 uint current_timestamp;
30076 bool fast;
30077 int timer_id;
30078 };
30079 typedef QtValidLicenseForGuiModule QtGuiModule;
30080 class QPainter;
30081 class QColorGroup;
30082 class QPalette;
30083 class QPoint;
30084 class QColor;
30085 class QBrush;
30086 class QRect;
30087 class QPixmap;
30088 __attribute__((visibility("default"))) void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
30089 const QPalette &pal, bool sunken = true,
30090 int lineWidth = 1, int midLineWidth = 0);
30091 __attribute__((visibility("default"))) void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2,
30092 const QPalette &pal, bool sunken = true,
30093 int lineWidth = 1, int midLineWidth = 0);
30094 __attribute__((visibility("default"))) void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
30095 const QPalette &pal, bool sunken = false,
30096 int lineWidth = 1, int midLineWidth = 0,
30097 const QBrush *fill = 0);
30098 __attribute__((visibility("default"))) void qDrawShadeRect(QPainter *p, const QRect &r,
30099 const QPalette &pal, bool sunken = false,
30100 int lineWidth = 1, int midLineWidth = 0,
30101 const QBrush *fill = 0);
30102 __attribute__((visibility("default"))) void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
30103 const QPalette &pal, bool sunken = false,
30104 int lineWidth = 1, const QBrush *fill = 0);
30105 __attribute__((visibility("default"))) void qDrawShadePanel(QPainter *p, const QRect &r,
30106 const QPalette &pal, bool sunken = false,
30107 int lineWidth = 1, const QBrush *fill = 0);
30108 __attribute__((visibility("default"))) void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
30109 const QPalette &pal, bool sunken = false,
30110 const QBrush *fill = 0);
30111 __attribute__((visibility("default"))) void qDrawWinButton(QPainter *p, const QRect &r,
30112 const QPalette &pal, bool sunken = false,
30113 const QBrush *fill = 0);
30114 __attribute__((visibility("default"))) void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
30115 const QPalette &pal, bool sunken = false,
30116 const QBrush *fill = 0);
30117 __attribute__((visibility("default"))) void qDrawWinPanel(QPainter *p, const QRect &r,
30118 const QPalette &pal, bool sunken = false,
30119 const QBrush *fill = 0);
30120 __attribute__((visibility("default"))) void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
30121 int lineWidth = 1, const QBrush *fill = 0);
30122 __attribute__((visibility("default"))) void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
30123 int lineWidth = 1, const QBrush *fill = 0);
30124 typedef QtValidLicenseForGuiModule QtGuiModule;
30125 class __attribute__((visibility("default"))) QFontInfo
30126 {
30127 public:
30128 QFontInfo(const QFont &);
30129 QFontInfo(const QFontInfo &);
30130 ~QFontInfo();
30131 QFontInfo &operator=(const QFontInfo &);
30132 QString family() const;
30133 int pixelSize() const;
30134 int pointSize() const;
30135 qreal pointSizeF() const;
30136 bool italic() const;
30137 QFont::Style style() const;
30138 int weight() const;
30139 inline bool bold() const { return weight() > QFont::Normal; }
30140 bool underline() const;
30141 bool overline() const;
30142 bool strikeOut() const;
30143 bool fixedPitch() const;
30144 QFont::StyleHint styleHint() const;
30145 bool rawMode() const;
30146 bool exactMatch() const;
30147 private:
30148 QFontPrivate *d;
30149 };
30150 typedef QtValidLicenseForGuiModule QtGuiModule;
30151 class QFontEngine;
30152 class QTextCodec;
30153 class QRect;
30154 class __attribute__((visibility("default"))) QFontMetrics
30155 {
30156 public:
30157 QFontMetrics(const QFont &);
30158 QFontMetrics(const QFont &, QPaintDevice *pd);
30159 QFontMetrics(const QFontMetrics &);
30160 ~QFontMetrics();
30161 QFontMetrics &operator=(const QFontMetrics &);
30162 int ascent() const;
30163 int descent() const;
30164 int height() const;
30165 int leading() const;
30166 int lineSpacing() const;
30167 int minLeftBearing() const;
30168 int minRightBearing() const;
30169 int maxWidth() const;
30170 int xHeight() const;
30171 int averageCharWidth() const;
30172 bool inFont(QChar) const;
30173 int leftBearing(QChar) const;
30174 int rightBearing(QChar) const;
30175 int width(const QString &, int len = -1) const;
30176 int width(QChar) const;
30177 int charWidth(const QString &str, int pos) const;
30178 QRect boundingRect(QChar) const;
30179 QRect boundingRect(const QString &text) const;
30180 QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops=0, int *tabarray=0) const;
30181 inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text,
30182 int tabstops=0, int *tabarray=0) const
30183 { return boundingRect(QRect(x, y, w, h), flags, text, tabstops, tabarray); }
30184 QSize size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const;
30185 QRect tightBoundingRect(const QString &text) const;
30186 QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags = 0) const;
30187 int underlinePos() const;
30188 int overlinePos() const;
30189 int strikeOutPos() const;
30190 int lineWidth() const;
30191 bool operator==(const QFontMetrics &other);
30192 bool operator==(const QFontMetrics &other) const;
30193 inline bool operator !=(const QFontMetrics &other) { return !operator==(other); }
30194 inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); }
30195 private:
30196 friend class QFontMetricsF;
30197 friend class QStackTextEngine;
30198 QFontPrivate *d;
30199 };
30200 class __attribute__((visibility("default"))) QFontMetricsF
30201 {
30202 public:
30203 QFontMetricsF(const QFont &);
30204 QFontMetricsF(const QFont &, QPaintDevice *pd);
30205 QFontMetricsF(const QFontMetrics &);
30206 QFontMetricsF(const QFontMetricsF &);
30207 ~QFontMetricsF();
30208 QFontMetricsF &operator=(const QFontMetricsF &);
30209 QFontMetricsF &operator=(const QFontMetrics &);
30210 qreal ascent() const;
30211 qreal descent() const;
30212 qreal height() const;
30213 qreal leading() const;
30214 qreal lineSpacing() const;
30215 qreal minLeftBearing() const;
30216 qreal minRightBearing() const;
30217 qreal maxWidth() const;
30218 qreal xHeight() const;
30219 qreal averageCharWidth() const;
30220 bool inFont(QChar) const;
30221 qreal leftBearing(QChar) const;
30222 qreal rightBearing(QChar) const;
30223 qreal width(const QString &string) const;
30224 qreal width(QChar) const;
30225 QRectF boundingRect(const QString &string) const;
30226 QRectF boundingRect(QChar) const;
30227 QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops=0, int *tabarray=0) const;
30228 QSizeF size(int flags, const QString& str, int tabstops=0, int *tabarray=0) const;
30229 QRectF tightBoundingRect(const QString &text) const;
30230 QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const;
30231 qreal underlinePos() const;
30232 qreal overlinePos() const;
30233 qreal strikeOutPos() const;
30234 qreal lineWidth() const;
30235 bool operator==(const QFontMetricsF &other);
30236 bool operator==(const QFontMetricsF &other) const;
30237 inline bool operator !=(const QFontMetricsF &other) { return !operator==(other); }
30238 inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); }
30239 private:
30240 QFontPrivate *d;
30241 };
30242 typedef QtValidLicenseForGuiModule QtGuiModule;
30243 class QBrush;
30244 class QFontInfo;
30245 class QFontMetrics;
30246 class QPaintDevice;
30247 class QPainterPath;
30248 class QPainterPrivate;
30249 class QPen;
30250 class QPolygon;
30251 class QTextItem;
30252 class QMatrix;
30253 class QTransform;
30254 class __attribute__((visibility("default"))) QPainter
30255 {
30256 inline QPainterPrivate* d_func() { return reinterpret_cast<QPainterPrivate *>(d_ptr); } inline const QPainterPrivate* d_func() const { return reinterpret_cast<const QPainterPrivate *>(d_ptr); } friend class QPainterPrivate;
30257 public: static const QMetaObject staticMetaObject; private:
30258 public:
30259 enum RenderHint {
30260 Antialiasing = 0x01,
30261 TextAntialiasing = 0x02,
30262 SmoothPixmapTransform = 0x04,
30263 HighQualityAntialiasing = 0x08,
30264 NonCosmeticDefaultPen = 0x10
30265 };
30266 typedef QFlags<RenderHint> RenderHints;
30267 QPainter();
30268 explicit QPainter(QPaintDevice *);
30269 ~QPainter();
30270 QPaintDevice *device() const;
30271 bool begin(QPaintDevice *);
30272 bool end();
30273 bool isActive() const;
30274 void initFrom(const QWidget *widget);
30275 enum CompositionMode {
30276 CompositionMode_SourceOver,
30277 CompositionMode_DestinationOver,
30278 CompositionMode_Clear,
30279 CompositionMode_Source,
30280 CompositionMode_Destination,
30281 CompositionMode_SourceIn,
30282 CompositionMode_DestinationIn,
30283 CompositionMode_SourceOut,
30284 CompositionMode_DestinationOut,
30285 CompositionMode_SourceAtop,
30286 CompositionMode_DestinationAtop,
30287 CompositionMode_Xor,
30288 CompositionMode_Plus,
30289 CompositionMode_Multiply,
30290 CompositionMode_Screen,
30291 CompositionMode_Overlay,
30292 CompositionMode_Darken,
30293 CompositionMode_Lighten,
30294 CompositionMode_ColorDodge,
30295 CompositionMode_ColorBurn,
30296 CompositionMode_HardLight,
30297 CompositionMode_SoftLight,
30298 CompositionMode_Difference,
30299 CompositionMode_Exclusion,
30300 RasterOp_SourceOrDestination,
30301 RasterOp_SourceAndDestination,
30302 RasterOp_SourceXorDestination,
30303 RasterOp_NotSourceAndNotDestination,
30304 RasterOp_NotSourceOrNotDestination,
30305 RasterOp_NotSourceXorDestination,
30306 RasterOp_NotSource,
30307 RasterOp_NotSourceAndDestination,
30308 RasterOp_SourceAndNotDestination
30309 };
30310 void setCompositionMode(CompositionMode mode);
30311 CompositionMode compositionMode() const;
30312 const QFont &font() const;
30313 void setFont(const QFont &f);
30314 QFontMetrics fontMetrics() const;
30315 QFontInfo fontInfo() const;
30316 void setPen(const QColor &color);
30317 void setPen(const QPen &pen);
30318 void setPen(Qt::PenStyle style);
30319 const QPen &pen() const;
30320 void setBrush(const QBrush &brush);
30321 void setBrush(Qt::BrushStyle style);
30322 const QBrush &brush() const;
30323 void setBackgroundMode(Qt::BGMode mode);
30324 Qt::BGMode backgroundMode() const;
30325 QPoint brushOrigin() const;
30326 inline void setBrushOrigin(int x, int y);
30327 inline void setBrushOrigin(const QPoint &);
30328 void setBrushOrigin(const QPointF &);
30329 void setBackground(const QBrush &bg);
30330 const QBrush &background() const;
30331 qreal opacity() const;
30332 void setOpacity(qreal opacity);
30333 QRegion clipRegion() const;
30334 QPainterPath clipPath() const;
30335 void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
30336 void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
30337 inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
30338 void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
30339 void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
30340 void setClipping(bool enable);
30341 bool hasClipping() const;
30342 void save();
30343 void restore();
30344 void setMatrix(const QMatrix &matrix, bool combine = false);
30345 const QMatrix &matrix() const;
30346 const QMatrix &deviceMatrix() const;
30347 void resetMatrix();
30348 void setTransform(const QTransform &transform, bool combine = false);
30349 const QTransform &transform() const;
30350 const QTransform &deviceTransform() const;
30351 void resetTransform();
30352 void setWorldMatrix(const QMatrix &matrix, bool combine = false);
30353 const QMatrix &worldMatrix() const;
30354 void setWorldTransform(const QTransform &matrix, bool combine = false);
30355 const QTransform &worldTransform() const;
30356 QMatrix combinedMatrix() const;
30357 QTransform combinedTransform() const;
30358 void setMatrixEnabled(bool enabled);
30359 bool matrixEnabled() const;
30360 void setWorldMatrixEnabled(bool enabled);
30361 bool worldMatrixEnabled() const;
30362 void scale(qreal sx, qreal sy);
30363 void shear(qreal sh, qreal sv);
30364 void rotate(qreal a);
30365 void translate(const QPointF &offset);
30366 inline void translate(const QPoint &offset);
30367 inline void translate(qreal dx, qreal dy);
30368 QRect window() const;
30369 void setWindow(const QRect &window);
30370 inline void setWindow(int x, int y, int w, int h);
30371 QRect viewport() const;
30372 void setViewport(const QRect &viewport);
30373 inline void setViewport(int x, int y, int w, int h);
30374 void setViewTransformEnabled(bool enable);
30375 bool viewTransformEnabled() const;
30376 void strokePath(const QPainterPath &path, const QPen &pen);
30377 void fillPath(const QPainterPath &path, const QBrush &brush);
30378 void drawPath(const QPainterPath &path);
30379 inline void drawPoint(const QPointF &pt);
30380 inline void drawPoint(const QPoint &p);
30381 inline void drawPoint(int x, int y);
30382 void drawPoints(const QPointF *points, int pointCount);
30383 inline void drawPoints(const QPolygonF &points);
30384 void drawPoints(const QPoint *points, int pointCount);
30385 inline void drawPoints(const QPolygon &points);
30386 inline void drawLine(const QLineF &line);
30387 inline void drawLine(const QLine &line);
30388 inline void drawLine(int x1, int y1, int x2, int y2);
30389 inline void drawLine(const QPoint &p1, const QPoint &p2);
30390 inline void drawLine(const QPointF &p1, const QPointF &p2);
30391 void drawLines(const QLineF *lines, int lineCount);
30392 inline void drawLines(const QVector<QLineF> &lines);
30393 void drawLines(const QPointF *pointPairs, int lineCount);
30394 inline void drawLines(const QVector<QPointF> &pointPairs);
30395 void drawLines(const QLine *lines, int lineCount);
30396 inline void drawLines(const QVector<QLine> &lines);
30397 void drawLines(const QPoint *pointPairs, int lineCount);
30398 inline void drawLines(const QVector<QPoint> &pointPairs);
30399 inline void drawRect(const QRectF &rect);
30400 inline void drawRect(int x1, int y1, int w, int h);
30401 inline void drawRect(const QRect &rect);
30402 void drawRects(const QRectF *rects, int rectCount);
30403 inline void drawRects(const QVector<QRectF> &rectangles);
30404 void drawRects(const QRect *rects, int rectCount);
30405 inline void drawRects(const QVector<QRect> &rectangles);
30406 void drawEllipse(const QRectF &r);
30407 void drawEllipse(const QRect &r);
30408 inline void drawEllipse(int x, int y, int w, int h);
30409 inline void drawEllipse(const QPointF &center, qreal rx, qreal ry);
30410 inline void drawEllipse(const QPoint &center, int rx, int ry);
30411 void drawPolyline(const QPointF *points, int pointCount);
30412 inline void drawPolyline(const QPolygonF &polyline);
30413 void drawPolyline(const QPoint *points, int pointCount);
30414 inline void drawPolyline(const QPolygon &polygon);
30415 void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
30416 inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
30417 void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
30418 inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
30419 void drawConvexPolygon(const QPointF *points, int pointCount);
30420 inline void drawConvexPolygon(const QPolygonF &polygon);
30421 void drawConvexPolygon(const QPoint *points, int pointCount);
30422 inline void drawConvexPolygon(const QPolygon &polygon);
30423 void drawArc(const QRectF &rect, int a, int alen);
30424 inline void drawArc(const QRect &, int a, int alen);
30425 inline void drawArc(int x, int y, int w, int h, int a, int alen);
30426 void drawPie(const QRectF &rect, int a, int alen);
30427 inline void drawPie(int x, int y, int w, int h, int a, int alen);
30428 inline void drawPie(const QRect &, int a, int alen);
30429 void drawChord(const QRectF &rect, int a, int alen);
30430 inline void drawChord(int x, int y, int w, int h, int a, int alen);
30431 inline void drawChord(const QRect &, int a, int alen);
30432 void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
30433 Qt::SizeMode mode = Qt::AbsoluteSize);
30434 inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
30435 Qt::SizeMode mode = Qt::AbsoluteSize);
30436 inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
30437 Qt::SizeMode mode = Qt::AbsoluteSize);
30438 void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25);
30439 inline void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
30440 inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
30441 void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
30442 inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
30443 inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
30444 void drawPicture(const QPointF &p, const QPicture &picture);
30445 inline void drawPicture(int x, int y, const QPicture &picture);
30446 inline void drawPicture(const QPoint &p, const QPicture &picture);
30447 void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
30448 inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
30449 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
30450 int sx, int sy, int sw, int sh);
30451 inline void drawPixmap(int x, int y, const QPixmap &pm,
30452 int sx, int sy, int sw, int sh);
30453 inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
30454 inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
30455 void drawPixmap(const QPointF &p, const QPixmap &pm);
30456 inline void drawPixmap(const QPoint &p, const QPixmap &pm);
30457 inline void drawPixmap(int x, int y, const QPixmap &pm);
30458 inline void drawPixmap(const QRect &r, const QPixmap &pm);
30459 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
30460 void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
30461 Qt::ImageConversionFlags flags = Qt::AutoColor);
30462 inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
30463 Qt::ImageConversionFlags flags = Qt::AutoColor);
30464 inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
30465 Qt::ImageConversionFlags flags = Qt::AutoColor);
30466 inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
30467 Qt::ImageConversionFlags flags = Qt::AutoColor);
30468 inline void drawImage(const QRectF &r, const QImage &image);
30469 inline void drawImage(const QRect &r, const QImage &image);
30470 void drawImage(const QPointF &p, const QImage &image);
30471 inline void drawImage(const QPoint &p, const QImage &image);
30472 inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
30473 int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
30474 void setLayoutDirection(Qt::LayoutDirection direction);
30475 Qt::LayoutDirection layoutDirection() const;
30476 void drawText(const QPointF &p, const QString &s);
30477 inline void drawText(const QPoint &p, const QString &s);
30478 inline void drawText(int x, int y, const QString &s);
30479 void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
30480 void drawText(const QRectF &r, int flags, const QString &text, QRectF *br=0);
30481 void drawText(const QRect &r, int flags, const QString &text, QRect *br=0);
30482 inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0);
30483 void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
30484 QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
30485 QRect boundingRect(const QRect &rect, int flags, const QString &text);
30486 inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
30487 QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
30488 void drawTextItem(const QPointF &p, const QTextItem &ti);
30489 inline void drawTextItem(int x, int y, const QTextItem &ti);
30490 inline void drawTextItem(const QPoint &p, const QTextItem &ti);
30491 void fillRect(const QRectF &, const QBrush &);
30492 inline void fillRect(int x, int y, int w, int h, const QBrush &);
30493 void fillRect(const QRect &, const QBrush &);
30494 void fillRect(const QRectF &, const QColor &color);
30495 inline void fillRect(int x, int y, int w, int h, const QColor &color);
30496 void fillRect(const QRect &, const QColor &color);
30497 inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
30498 inline void fillRect(const QRect &r, Qt::GlobalColor c);
30499 inline void fillRect(const QRectF &r, Qt::GlobalColor c);
30500 inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
30501 inline void fillRect(const QRect &r, Qt::BrushStyle style);
30502 inline void fillRect(const QRectF &r, Qt::BrushStyle style);
30503 void eraseRect(const QRectF &);
30504 inline void eraseRect(int x, int y, int w, int h);
30505 inline void eraseRect(const QRect &);
30506 void setRenderHint(RenderHint hint, bool on = true);
30507 void setRenderHints(RenderHints hints, bool on = true);
30508 RenderHints renderHints() const;
30509 inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
30510 QPaintEngine *paintEngine() const;
30511 static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
30512 const QPoint& offset = QPoint());
30513 static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0);
30514 static void restoreRedirected(const QPaintDevice *device);
30515 private:
30516 QPainter(const QPainter &); QPainter &operator=(const QPainter &);
30517 friend class Q3Painter;
30518 QPainterPrivate *d_ptr;
30519 friend class QFontEngine;
30520 friend class QFontEngineBox;
30521 friend class QFontEngineFT;
30522 friend class QFontEngineMac;
30523 friend class QFontEngineWin;
30524 friend class QFontEngineXLFD;
30525 friend class QWSManager;
30526 friend class QPaintEngine;
30527 friend class QOpenGLPaintEngine;
30528 friend class QX11PaintEngine;
30529 friend class QX11PaintEnginePrivate;
30530 friend class QWin32PaintEngine;
30531 friend class QWin32PaintEnginePrivate;
30532 friend class QRasterPaintEngine;
30533 friend class QAlphaPaintEngine;
30534 friend class QPreviewPaintEngine;
30535 };
30536 inline QFlags<QPainter::RenderHints::enum_type> operator|(QPainter::RenderHints::enum_type f1, QPainter::RenderHints::enum_type f2) { return QFlags<QPainter::RenderHints::enum_type>(f1) | f2; } inline QFlags<QPainter::RenderHints::enum_type> operator|(QPainter::RenderHints::enum_type f1, QFlags<QPainter::RenderHints::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QPainter::RenderHints::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
30537 inline void QPainter::drawLine(const QLineF &l)
30538 {
30539 drawLines(&l, 1);
30540 }
30541 inline void QPainter::drawLine(const QLine &line)
30542 {
30543 drawLines(&line, 1);
30544 }
30545 inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
30546 {
30547 QLine l(x1, y1, x2, y2);
30548 drawLines(&l, 1);
30549 }
30550 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
30551 {
30552 QLine l(p1, p2);
30553 drawLines(&l, 1);
30554 }
30555 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
30556 {
30557 drawLine(QLineF(p1, p2));
30558 }
30559 inline void QPainter::drawLines(const QVector<QLineF> &lines)
30560 {
30561 drawLines(lines.constData(), lines.size());
30562 }
30563 inline void QPainter::drawLines(const QVector<QLine> &lines)
30564 {
30565 drawLines(lines.constData(), lines.size());
30566 }
30567 inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
30568 {
30569 drawLines(pointPairs.constData(), pointPairs.size() / 2);
30570 }
30571 inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
30572 {
30573 drawLines(pointPairs.constData(), pointPairs.size() / 2);
30574 }
30575 inline void QPainter::drawPolyline(const QPolygonF &polyline)
30576 {
30577 drawPolyline(polyline.constData(), polyline.size());
30578 }
30579 inline void QPainter::drawPolyline(const QPolygon &polyline)
30580 {
30581 drawPolyline(polyline.constData(), polyline.size());
30582 }
30583 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
30584 {
30585 drawPolygon(polygon.constData(), polygon.size(), fillRule);
30586 }
30587 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
30588 {
30589 drawPolygon(polygon.constData(), polygon.size(), fillRule);
30590 }
30591 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
30592 {
30593 drawConvexPolygon(poly.constData(), poly.size());
30594 }
30595 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
30596 {
30597 drawConvexPolygon(poly.constData(), poly.size());
30598 }
30599 inline void QPainter::drawRect(const QRectF &rect)
30600 {
30601 drawRects(&rect, 1);
30602 }
30603 inline void QPainter::drawRect(int x, int y, int w, int h)
30604 {
30605 QRect r(x, y, w, h);
30606 drawRects(&r, 1);
30607 }
30608 inline void QPainter::drawRect(const QRect &r)
30609 {
30610 drawRects(&r, 1);
30611 }
30612 inline void QPainter::drawRects(const QVector<QRectF> &rects)
30613 {
30614 drawRects(rects.constData(), rects.size());
30615 }
30616 inline void QPainter::drawRects(const QVector<QRect> &rects)
30617 {
30618 drawRects(rects.constData(), rects.size());
30619 }
30620 inline void QPainter::drawPoint(const QPointF &p)
30621 {
30622 drawPoints(&p, 1);
30623 }
30624 inline void QPainter::drawPoint(int x, int y)
30625 {
30626 QPoint p(x, y);
30627 drawPoints(&p, 1);
30628 }
30629 inline void QPainter::drawPoint(const QPoint &p)
30630 {
30631 drawPoints(&p, 1);
30632 }
30633 inline void QPainter::drawPoints(const QPolygonF &points)
30634 {
30635 drawPoints(points.constData(), points.size());
30636 }
30637 inline void QPainter::drawPoints(const QPolygon &points)
30638 {
30639 drawPoints(points.constData(), points.size());
30640 }
30641 inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
30642 {
30643 drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
30644 }
30645 inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
30646 {
30647 drawRoundRect(QRectF(rect), xRnd, yRnd);
30648 }
30649 inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
30650 Qt::SizeMode mode)
30651 {
30652 drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
30653 }
30654 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
30655 Qt::SizeMode mode)
30656 {
30657 drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
30658 }
30659 inline void QPainter::drawEllipse(int x, int y, int w, int h)
30660 {
30661 drawEllipse(QRect(x, y, w, h));
30662 }
30663 inline void QPainter::drawEllipse(const QPointF &center, qreal rx, qreal ry)
30664 {
30665 drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
30666 }
30667 inline void QPainter::drawEllipse(const QPoint &center, int rx, int ry)
30668 {
30669 drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
30670 }
30671 inline void QPainter::drawArc(const QRect &r, int a, int alen)
30672 {
30673 drawArc(QRectF(r), a, alen);
30674 }
30675 inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
30676 {
30677 drawArc(QRectF(x, y, w, h), a, alen);
30678 }
30679 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
30680 {
30681 drawPie(QRectF(rect), a, alen);
30682 }
30683 inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
30684 {
30685 drawPie(QRectF(x, y, w, h), a, alen);
30686 }
30687 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
30688 {
30689 drawChord(QRectF(rect), a, alen);
30690 }
30691 inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
30692 {
30693 drawChord(QRectF(x, y, w, h), a, alen);
30694 }
30695 inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
30696 {
30697 setClipRect(QRect(x, y, w, h), op);
30698 }
30699 inline void QPainter::eraseRect(const QRect &rect)
30700 {
30701 eraseRect(QRectF(rect));
30702 }
30703 inline void QPainter::eraseRect(int x, int y, int w, int h)
30704 {
30705 eraseRect(QRectF(x, y, w, h));
30706 }
30707 inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
30708 {
30709 fillRect(QRect(x, y, w, h), b);
30710 }
30711 inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
30712 {
30713 fillRect(QRect(x, y, w, h), b);
30714 }
30715 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
30716 {
30717 fillRect(QRect(x, y, w, h), QColor(c));
30718 }
30719 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
30720 {
30721 fillRect(r, QColor(c));
30722 }
30723 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
30724 {
30725 fillRect(r, QColor(c));
30726 }
30727 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
30728 {
30729 fillRect(QRectF(x, y, w, h), QBrush(style));
30730 }
30731 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
30732 {
30733 fillRect(QRectF(r), QBrush(style));
30734 }
30735 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
30736 {
30737 fillRect(r, QBrush(style));
30738 }
30739 inline void QPainter::setBrushOrigin(int x, int y)
30740 {
30741 setBrushOrigin(QPoint(x, y));
30742 }
30743 inline void QPainter::setBrushOrigin(const QPoint &p)
30744 {
30745 setBrushOrigin(QPointF(p));
30746 }
30747 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
30748 {
30749 drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
30750 }
30751 inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
30752 {
30753 drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
30754 }
30755 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
30756 {
30757 drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
30758 }
30759 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
30760 {
30761 drawPixmap(QPointF(p), pm);
30762 }
30763 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
30764 {
30765 drawPixmap(QRectF(r), pm, QRectF());
30766 }
30767 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
30768 {
30769 drawPixmap(QPointF(x, y), pm);
30770 }
30771 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
30772 {
30773 drawPixmap(QRectF(x, y, w, h), pm, QRectF());
30774 }
30775 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
30776 int sx, int sy, int sw, int sh)
30777 {
30778 drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
30779 }
30780 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
30781 int sx, int sy, int sw, int sh)
30782 {
30783 drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
30784 }
30785 inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
30786 {
30787 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
30788 }
30789 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
30790 {
30791 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
30792 }
30793 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
30794 {
30795 drawTextItem(QPointF(x, y), ti);
30796 }
30797 inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
30798 Qt::ImageConversionFlags flags)
30799 {
30800 drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
30801 }
30802 inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
30803 Qt::ImageConversionFlags flags)
30804 {
30805 drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
30806 }
30807 inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
30808 Qt::ImageConversionFlags flags)
30809 {
30810 drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
30811 }
30812 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
30813 {
30814 drawImage(r, image, QRect(0, 0, image.width(), image.height()));
30815 }
30816 inline void QPainter::drawImage(const QRect &r, const QImage &image)
30817 {
30818 drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
30819 }
30820 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
30821 {
30822 drawImage(QPointF(p), image);
30823 }
30824 inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
30825 Qt::ImageConversionFlags flags)
30826 {
30827 if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
30828 drawImage(QPointF(x, y), image);
30829 else
30830 drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
30831 }
30832 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
30833 {
30834 drawTextItem(QPointF(p), ti);
30835 }
30836 inline void QPainter::drawText(const QPoint &p, const QString &s)
30837 {
30838 drawText(QPointF(p), s);
30839 }
30840 inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
30841 {
30842 drawText(QRect(x, y, w, h), flags, str, br);
30843 }
30844 inline void QPainter::drawText(int x, int y, const QString &s)
30845 {
30846 drawText(QPointF(x, y), s);
30847 }
30848 inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
30849 {
30850 return boundingRect(QRect(x, y, w, h), flags, text);
30851 }
30852 inline void QPainter::translate(qreal dx, qreal dy)
30853 {
30854 translate(QPointF(dx, dy));
30855 }
30856 inline void QPainter::translate(const QPoint &offset)
30857 {
30858 translate(offset.x(), offset.y());
30859 }
30860 inline void QPainter::setViewport(int x, int y, int w, int h)
30861 {
30862 setViewport(QRect(x, y, w, h));
30863 }
30864 inline void QPainter::setWindow(int x, int y, int w, int h)
30865 {
30866 setWindow(QRect(x, y, w, h));
30867 }
30868 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
30869 {
30870 drawPicture(QPoint(x, y), p);
30871 }
30872 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
30873 {
30874 drawPicture(QPointF(pt), p);
30875 }
30876 typedef QtValidLicenseForGuiModule QtGuiModule;
30877 class QFontEngine;
30878 class QLineF;
30879 class QPaintDevice;
30880 class QPaintEnginePrivate;
30881 class QPainterPath;
30882 class QPointF;
30883 class QPolygonF;
30884 class QRectF;
30885 struct QGlyphLayout;
30886 class QTextItemInt;
30887 class QPaintEngineState;
30888 class __attribute__((visibility("default"))) QTextItem {
30889 public:
30890 enum RenderFlag {
30891 RightToLeft = 0x1,
30892 Overline = 0x10,
30893 Underline = 0x20,
30894 StrikeOut = 0x40,
30895 Dummy = 0xffffffff
30896 };
30897 typedef QFlags<RenderFlag> RenderFlags;
30898 qreal descent() const;
30899 qreal ascent() const;
30900 qreal width() const;
30901 RenderFlags renderFlags() const;
30902 QString text() const;
30903 QFont font() const;
30904 };
30905 template <> class QTypeInfo<QTextItem> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextItem)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextItem"; } };
30906 class __attribute__((visibility("default"))) QPaintEngine
30907 {
30908 inline QPaintEnginePrivate* d_func() { return reinterpret_cast<QPaintEnginePrivate *>(d_ptr); } inline const QPaintEnginePrivate* d_func() const { return reinterpret_cast<const QPaintEnginePrivate *>(d_ptr); } friend class QPaintEnginePrivate;
30909 public:
30910 enum PaintEngineFeature {
30911 PrimitiveTransform = 0x00000001,
30912 PatternTransform = 0x00000002,
30913 PixmapTransform = 0x00000004,
30914 PatternBrush = 0x00000008,
30915 LinearGradientFill = 0x00000010,
30916 RadialGradientFill = 0x00000020,
30917 ConicalGradientFill = 0x00000040,
30918 AlphaBlend = 0x00000080,
30919 PorterDuff = 0x00000100,
30920 PainterPaths = 0x00000200,
30921 Antialiasing = 0x00000400,
30922 BrushStroke = 0x00000800,
30923 ConstantOpacity = 0x00001000,
30924 MaskedBrush = 0x00002000,
30925 PerspectiveTransform = 0x00004000,
30926 BlendModes = 0x00008000,
30927 ObjectBoundingModeGradients = 0x00010000,
30928 RasterOpModes = 0x00020000,
30929 PaintOutsidePaintEvent = 0x20000000,
30930 AllFeatures = 0xffffffff
30931 };
30932 typedef QFlags<PaintEngineFeature> PaintEngineFeatures;
30933 enum DirtyFlag {
30934 DirtyPen = 0x0001,
30935 DirtyBrush = 0x0002,
30936 DirtyBrushOrigin = 0x0004,
30937 DirtyFont = 0x0008,
30938 DirtyBackground = 0x0010,
30939 DirtyBackgroundMode = 0x0020,
30940 DirtyTransform = 0x0040,
30941 DirtyClipRegion = 0x0080,
30942 DirtyClipPath = 0x0100,
30943 DirtyHints = 0x0200,
30944 DirtyCompositionMode = 0x0400,
30945 DirtyClipEnabled = 0x0800,
30946 DirtyOpacity = 0x1000,
30947 AllDirty = 0xffff
30948 };
30949 typedef QFlags<DirtyFlag> DirtyFlags;
30950 enum PolygonDrawMode {
30951 OddEvenMode,
30952 WindingMode,
30953 ConvexMode,
30954 PolylineMode
30955 };
30956 explicit QPaintEngine(PaintEngineFeatures features=0);
30957 virtual ~QPaintEngine();
30958 bool isActive() const { return active; }
30959 void setActive(bool newState) { active = newState; }
30960 virtual bool begin(QPaintDevice *pdev) = 0;
30961 virtual bool end() = 0;
30962 virtual void updateState(const QPaintEngineState &state) = 0;
30963 virtual void drawRects(const QRect *rects, int rectCount);
30964 virtual void drawRects(const QRectF *rects, int rectCount);
30965 virtual void drawLines(const QLine *lines, int lineCount);
30966 virtual void drawLines(const QLineF *lines, int lineCount);
30967 virtual void drawEllipse(const QRectF &r);
30968 virtual void drawEllipse(const QRect &r);
30969 virtual void drawPath(const QPainterPath &path);
30970 virtual void drawPoints(const QPointF *points, int pointCount);
30971 virtual void drawPoints(const QPoint *points, int pointCount);
30972 virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
30973 virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
30974 virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0;
30975 virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
30976 virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
30977 virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
30978 Qt::ImageConversionFlags flags = Qt::AutoColor);
30979 void setPaintDevice(QPaintDevice *device);
30980 QPaintDevice *paintDevice() const;
30981 void setSystemClip(const QRegion &baseClip);
30982 QRegion systemClip() const;
30983 void setSystemRect(const QRect &rect);
30984 QRect systemRect() const;
30985 virtual QPoint coordinateOffset() const;
30986 enum Type {
30987 X11,
30988 Windows,
30989 QuickDraw, CoreGraphics, MacPrinter,
30990 QWindowSystem,
30991 PostScript,
30992 OpenGL,
30993 Picture,
30994 SVG,
30995 Raster,
30996 Direct3D,
30997 Pdf,
30998 OpenVG,
30999 User = 50,
31000 MaxUser = 100
31001 };
31002 virtual Type type() const = 0;
31003 inline void fix_neg_rect(int *x, int *y, int *w, int *h);
31004 inline bool testDirty(DirtyFlags df);
31005 inline void setDirty(DirtyFlags df);
31006 inline void clearDirty(DirtyFlags df);
31007 bool hasFeature(PaintEngineFeatures feature) const { return (gccaps & feature) != 0; }
31008 QPainter *painter() const;
31009 void syncState();
31010 inline bool isExtended() const { return extended; }
31011 protected:
31012 QPaintEngine(QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0);
31013 QPaintEngineState *state;
31014 PaintEngineFeatures gccaps;
31015 uint active : 1;
31016 uint selfDestruct : 1;
31017 uint extended : 1;
31018 QPaintEnginePrivate *d_ptr;
31019 private:
31020 void setAutoDestruct(bool autoDestr) { selfDestruct = autoDestr; }
31021 bool autoDestruct() const { return selfDestruct; }
31022 QPaintEngine(const QPaintEngine &); QPaintEngine &operator=(const QPaintEngine &);
31023 friend class QFontEngineBox;
31024 friend class QFontEngineMac;
31025 friend class QFontEngineWin;
31026 friend class QFontEngineQPF1;
31027 friend class QFontEngineQPF;
31028 friend class QPSPrintEngine;
31029 friend class QMacPrintEngine;
31030 friend class QMacPrintEnginePrivate;
31031 friend class QtopiaPrintEngine;
31032 friend class QtopiaPrintEnginePrivate;
31033 friend class QProxyFontEngine;
31034 friend class QPainter;
31035 friend class QPainterPrivate;
31036 friend class QWidget;
31037 friend class QWidgetPrivate;
31038 friend class QWin32PaintEngine;
31039 friend class QWin32PaintEnginePrivate;
31040 friend class QMacCGContext;
31041 friend class QPreviewPaintEngine;
31042 };
31043 class __attribute__((visibility("default"))) QPaintEngineState
31044 {
31045 public:
31046 QPaintEngine::DirtyFlags state() const { return dirtyFlags; }
31047 QPen pen() const;
31048 QBrush brush() const;
31049 QPointF brushOrigin() const;
31050 QBrush backgroundBrush() const;
31051 Qt::BGMode backgroundMode() const;
31052 QFont font() const;
31053 QMatrix matrix() const;
31054 QTransform transform() const;
31055 Qt::ClipOperation clipOperation() const;
31056 QRegion clipRegion() const;
31057 QPainterPath clipPath() const;
31058 bool isClipEnabled() const;
31059 QPainter::RenderHints renderHints() const;
31060 QPainter::CompositionMode compositionMode() const;
31061 qreal opacity() const;
31062 QPainter *painter() const;
31063 bool brushNeedsResolving() const;
31064 bool penNeedsResolving() const;
31065 protected:
31066 friend class QPaintEngine;
31067 friend class QRasterPaintEngine;
31068 friend class QWidget;
31069 friend class QPainter;
31070 friend class QPainterPrivate;
31071 friend class QMacPrintEnginePrivate;
31072 QPaintEngine::DirtyFlags dirtyFlags;
31073 };
31074 inline void QPaintEngine::fix_neg_rect(int *x, int *y, int *w, int *h)
31075 {
31076 if (*w < 0) {
31077 *w = -*w;
31078 *x -= *w - 1;
31079 }
31080 if (*h < 0) {
31081 *h = -*h;
31082 *y -= *h - 1;
31083 }
31084 }
31085 inline bool QPaintEngine::testDirty(DirtyFlags df) {
31086 qt_noop();
31087 return ((state->dirtyFlags & df) != 0);
31088 }
31089 inline void QPaintEngine::setDirty(DirtyFlags df) {
31090 qt_noop();
31091 state->dirtyFlags |= df;
31092 }
31093 inline void QPaintEngine::clearDirty(DirtyFlags df)
31094 {
31095 qt_noop();
31096 state->dirtyFlags &= ~static_cast<uint>(df);
31097 }
31098 inline QFlags<QTextItem::RenderFlags::enum_type> operator|(QTextItem::RenderFlags::enum_type f1, QTextItem::RenderFlags::enum_type f2) { return QFlags<QTextItem::RenderFlags::enum_type>(f1) | f2; } inline QFlags<QTextItem::RenderFlags::enum_type> operator|(QTextItem::RenderFlags::enum_type f1, QFlags<QTextItem::RenderFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextItem::RenderFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
31099 inline QFlags<QPaintEngine::PaintEngineFeatures::enum_type> operator|(QPaintEngine::PaintEngineFeatures::enum_type f1, QPaintEngine::PaintEngineFeatures::enum_type f2) { return QFlags<QPaintEngine::PaintEngineFeatures::enum_type>(f1) | f2; } inline QFlags<QPaintEngine::PaintEngineFeatures::enum_type> operator|(QPaintEngine::PaintEngineFeatures::enum_type f1, QFlags<QPaintEngine::PaintEngineFeatures::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QPaintEngine::PaintEngineFeatures::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
31100 inline QFlags<QPaintEngine::DirtyFlags::enum_type> operator|(QPaintEngine::DirtyFlags::enum_type f1, QPaintEngine::DirtyFlags::enum_type f2) { return QFlags<QPaintEngine::DirtyFlags::enum_type>(f1) | f2; } inline QFlags<QPaintEngine::DirtyFlags::enum_type> operator|(QPaintEngine::DirtyFlags::enum_type f1, QFlags<QPaintEngine::DirtyFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QPaintEngine::DirtyFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
31101 typedef QtValidLicenseForGuiModule QtGuiModule;
31102 class QTextObjectPrivate;
31103 class QTextDocument;
31104 class QTextDocumentPrivate;
31105 class QTextCursor;
31106 class QTextBlock;
31107 class QTextFragment;
31108 class QTextLayout;
31109 class QTextList;
31110 class __attribute__((visibility("default"))) QTextObject : public QObject
31111 {
31112 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
31113 protected:
31114 explicit QTextObject(QTextDocument *doc);
31115 ~QTextObject();
31116 void setFormat(const QTextFormat &format);
31117 public:
31118 QTextFormat format() const;
31119 int formatIndex() const;
31120 QTextDocument *document() const;
31121 int objectIndex() const;
31122 QTextDocumentPrivate *docHandle() const;
31123 protected:
31124 QTextObject(QTextObjectPrivate &p, QTextDocument *doc);
31125 private:
31126 inline QTextObjectPrivate* d_func() { return reinterpret_cast<QTextObjectPrivate *>(d_ptr); } inline const QTextObjectPrivate* d_func() const { return reinterpret_cast<const QTextObjectPrivate *>(d_ptr); } friend class QTextObjectPrivate;
31127 QTextObject(const QTextObject &); QTextObject &operator=(const QTextObject &);
31128 friend class QTextDocumentPrivate;
31129 };
31130 class QTextBlockGroupPrivate;
31131 class __attribute__((visibility("default"))) QTextBlockGroup : public QTextObject
31132 {
31133 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
31134 protected:
31135 explicit QTextBlockGroup(QTextDocument *doc);
31136 ~QTextBlockGroup();
31137 virtual void blockInserted(const QTextBlock &block);
31138 virtual void blockRemoved(const QTextBlock &block);
31139 virtual void blockFormatChanged(const QTextBlock &block);
31140 QList<QTextBlock> blockList() const;
31141 protected:
31142 QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc);
31143 private:
31144 inline QTextBlockGroupPrivate* d_func() { return reinterpret_cast<QTextBlockGroupPrivate *>(d_ptr); } inline const QTextBlockGroupPrivate* d_func() const { return reinterpret_cast<const QTextBlockGroupPrivate *>(d_ptr); } friend class QTextBlockGroupPrivate;
31145 QTextBlockGroup(const QTextBlockGroup &); QTextBlockGroup &operator=(const QTextBlockGroup &);
31146 friend class QTextDocumentPrivate;
31147 };
31148 class __attribute__((visibility("default"))) QTextFrameLayoutData {
31149 public:
31150 virtual ~QTextFrameLayoutData();
31151 };
31152 class QTextFramePrivate;
31153 class __attribute__((visibility("default"))) QTextFrame : public QTextObject
31154 {
31155 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
31156 public:
31157 explicit QTextFrame(QTextDocument *doc);
31158 ~QTextFrame();
31159 inline void setFrameFormat(const QTextFrameFormat &format);
31160 QTextFrameFormat frameFormat() const { return QTextObject::format().toFrameFormat(); }
31161 QTextCursor firstCursorPosition() const;
31162 QTextCursor lastCursorPosition() const;
31163 int firstPosition() const;
31164 int lastPosition() const;
31165 QTextFrameLayoutData *layoutData() const;
31166 void setLayoutData(QTextFrameLayoutData *data);
31167 QList<QTextFrame *> childFrames() const;
31168 QTextFrame *parentFrame() const;
31169 class __attribute__((visibility("default"))) iterator {
31170 QTextFrame *f;
31171 int b;
31172 int e;
31173 QTextFrame *cf;
31174 int cb;
31175 friend class QTextFrame;
31176 friend class QTextTableCell;
31177 friend class QTextDocumentLayoutPrivate;
31178 iterator(QTextFrame *frame, int block, int begin, int end);
31179 public:
31180 iterator();
31181 iterator(const iterator &o);
31182 iterator &operator=(const iterator &o);
31183 QTextFrame *parentFrame() const { return f; }
31184 QTextFrame *currentFrame() const;
31185 QTextBlock currentBlock() const;
31186 bool atEnd() const { return !cf && cb == e; }
31187 inline bool operator==(const iterator &o) const { return f == o.f && cf == o.cf && cb == o.cb; }
31188 inline bool operator!=(const iterator &o) const { return f != o.f || cf != o.cf || cb != o.cb; }
31189 iterator &operator++();
31190 inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; }
31191 iterator &operator--();
31192 inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; }
31193 };
31194 friend class iterator;
31195 typedef iterator Iterator;
31196 iterator begin() const;
31197 iterator end() const;
31198 protected:
31199 QTextFrame(QTextFramePrivate &p, QTextDocument *doc);
31200 private:
31201 friend class QTextDocumentPrivate;
31202 inline QTextFramePrivate* d_func() { return reinterpret_cast<QTextFramePrivate *>(d_ptr); } inline const QTextFramePrivate* d_func() const { return reinterpret_cast<const QTextFramePrivate *>(d_ptr); } friend class QTextFramePrivate;
31203 QTextFrame(const QTextFrame &); QTextFrame &operator=(const QTextFrame &);
31204 };
31205 template <> class QTypeInfo<QTextFrame::iterator> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextFrame::iterator)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextFrame::iterator"; } };
31206 inline void QTextFrame::setFrameFormat(const QTextFrameFormat &aformat)
31207 { QTextObject::setFormat(aformat); }
31208 class __attribute__((visibility("default"))) QTextBlockUserData {
31209 public:
31210 virtual ~QTextBlockUserData();
31211 };
31212 class __attribute__((visibility("default"))) QTextBlock
31213 {
31214 friend class QSyntaxHighlighter;
31215 public:
31216 inline QTextBlock(QTextDocumentPrivate *priv, int b) : p(priv), n(b) {}
31217 inline QTextBlock() : p(0), n(0) {}
31218 inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {}
31219 inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; }
31220 inline bool isValid() const { return p != 0 && n != 0; }
31221 inline bool operator==(const QTextBlock &o) const { return p == o.p && n == o.n; }
31222 inline bool operator!=(const QTextBlock &o) const { return p != o.p || n != o.n; }
31223 inline bool operator<(const QTextBlock &o) const { return position() < o.position(); }
31224 int position() const;
31225 int length() const;
31226 bool contains(int position) const;
31227 QTextLayout *layout() const;
31228 void clearLayout();
31229 QTextBlockFormat blockFormat() const;
31230 int blockFormatIndex() const;
31231 QTextCharFormat charFormat() const;
31232 int charFormatIndex() const;
31233 QString text() const;
31234 const QTextDocument *document() const;
31235 QTextList *textList() const;
31236 QTextBlockUserData *userData() const;
31237 void setUserData(QTextBlockUserData *data);
31238 int userState() const;
31239 void setUserState(int state);
31240 int revision() const;
31241 void setRevision(int rev);
31242 bool isVisible() const;
31243 void setVisible(bool visible);
31244 int blockNumber() const;
31245 int firstLineNumber() const;
31246 void setLineCount(int count);
31247 int lineCount() const;
31248 class __attribute__((visibility("default"))) iterator {
31249 const QTextDocumentPrivate *p;
31250 int b;
31251 int e;
31252 int n;
31253 friend class QTextBlock;
31254 iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {}
31255 public:
31256 iterator() : p(0), b(0), e(0), n(0) {}
31257 iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {}
31258 QTextFragment fragment() const;
31259 bool atEnd() const { return n == e; }
31260 inline bool operator==(const iterator &o) const { return p == o.p && n == o.n; }
31261 inline bool operator!=(const iterator &o) const { return p != o.p || n != o.n; }
31262 iterator &operator++();
31263 inline iterator operator++(int) { iterator tmp = *this; operator++(); return tmp; }
31264 iterator &operator--();
31265 inline iterator operator--(int) { iterator tmp = *this; operator--(); return tmp; }
31266 };
31267 typedef iterator Iterator;
31268 iterator begin() const;
31269 iterator end() const;
31270 QTextBlock next() const;
31271 QTextBlock previous() const;
31272 inline QTextDocumentPrivate *docHandle() const { return p; }
31273 inline int fragmentIndex() const { return n; }
31274 private:
31275 QTextDocumentPrivate *p;
31276 int n;
31277 friend class QTextDocumentPrivate;
31278 friend class QTextLayout;
31279 };
31280 template <> class QTypeInfo<QTextBlock> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextBlock)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextBlock"; } };
31281 template <> class QTypeInfo<QTextBlock::iterator> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextBlock::iterator)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextBlock::iterator"; } };
31282 class __attribute__((visibility("default"))) QTextFragment
31283 {
31284 public:
31285 inline QTextFragment(const QTextDocumentPrivate *priv, int f, int fe) : p(priv), n(f), ne(fe) {}
31286 inline QTextFragment() : p(0), n(0), ne(0) {}
31287 inline QTextFragment(const QTextFragment &o) : p(o.p), n(o.n), ne(o.ne) {}
31288 inline QTextFragment &operator=(const QTextFragment &o) { p = o.p; n = o.n; ne = o.ne; return *this; }
31289 inline bool isValid() const { return p && n; }
31290 inline bool operator==(const QTextFragment &o) const { return p == o.p && n == o.n; }
31291 inline bool operator!=(const QTextFragment &o) const { return p != o.p || n != o.n; }
31292 inline bool operator<(const QTextFragment &o) const { return position() < o.position(); }
31293 int position() const;
31294 int length() const;
31295 bool contains(int position) const;
31296 QTextCharFormat charFormat() const;
31297 int charFormatIndex() const;
31298 QString text() const;
31299 private:
31300 const QTextDocumentPrivate *p;
31301 int n;
31302 int ne;
31303 };
31304 template <> class QTypeInfo<QTextFragment> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextFragment)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextFragment"; } };
31305 typedef QtValidLicenseForCoreModule QtCoreModule;
31306 template <class T>
31307 class QPointer
31308 {
31309 QObject *o;
31310 public:
31311 inline QPointer() : o(0) {}
31312 inline QPointer(T *p) : o(p)
31313 { QMetaObject::addGuard(&o); }
31314 inline QPointer(const QPointer<T> &p) : o(p.o)
31315 { QMetaObject::addGuard(&o); }
31316 inline ~QPointer()
31317 { QMetaObject::removeGuard(&o); }
31318 inline QPointer<T> &operator=(const QPointer<T> &p)
31319 { if (this != &p) QMetaObject::changeGuard(&o, p.o); return *this; }
31320 inline QPointer<T> &operator=(T* p)
31321 { if (o != p) QMetaObject::changeGuard(&o, p); return *this; }
31322 inline bool isNull() const
31323 { return !o; }
31324 inline T* operator->() const
31325 { return static_cast<T*>(const_cast<QObject*>(o)); }
31326 inline T& operator*() const
31327 { return *static_cast<T*>(const_cast<QObject*>(o)); }
31328 inline operator T*() const
31329 { return static_cast<T*>(const_cast<QObject*>(o)); }
31330 inline T* data() const
31331 { return static_cast<T*>(const_cast<QObject*>(o)); }
31332 };
31333 template <class T>
31334 inline bool operator==(const T *o, const QPointer<T> &p)
31335 { return o == p.operator->(); }
31336 template<class T>
31337 inline bool operator==(const QPointer<T> &p, const T *o)
31338 { return p.operator->() == o; }
31339 template <class T>
31340 inline bool operator==(T *o, const QPointer<T> &p)
31341 { return o == p.operator->(); }
31342 template<class T>
31343 inline bool operator==(const QPointer<T> &p, T *o)
31344 { return p.operator->() == o; }
31345 template<class T>
31346 inline bool operator==(const QPointer<T> &p1, const QPointer<T> &p2)
31347 { return p1.operator->() == p2.operator->(); }
31348 template <class T>
31349 inline bool operator!=(const T *o, const QPointer<T> &p)
31350 { return o != p.operator->(); }
31351 template<class T>
31352 inline bool operator!= (const QPointer<T> &p, const T *o)
31353 { return p.operator->() != o; }
31354 template <class T>
31355 inline bool operator!=(T *o, const QPointer<T> &p)
31356 { return o != p.operator->(); }
31357 template<class T>
31358 inline bool operator!= (const QPointer<T> &p, T *o)
31359 { return p.operator->() != o; }
31360 template<class T>
31361 inline bool operator!= (const QPointer<T> &p1, const QPointer<T> &p2)
31362 { return p1.operator->() != p2.operator->() ; }
31363 typedef QtValidLicenseForCoreModule QtCoreModule;
31364 struct QReadWriteLockPrivate;
31365 class __attribute__((visibility("default"))) QReadWriteLock
31366 {
31367 public:
31368 enum RecursionMode { NonRecursive, Recursive };
31369 QReadWriteLock();
31370 QReadWriteLock(RecursionMode recursionMode);
31371 ~QReadWriteLock();
31372 void lockForRead();
31373 bool tryLockForRead();
31374 bool tryLockForRead(int timeout);
31375 void lockForWrite();
31376 bool tryLockForWrite();
31377 bool tryLockForWrite(int timeout);
31378 void unlock();
31379 private:
31380 QReadWriteLock(const QReadWriteLock &); QReadWriteLock &operator=(const QReadWriteLock &);
31381 QReadWriteLockPrivate *d;
31382 friend class QWaitCondition;
31383 };
31384 class __attribute__((visibility("default"))) QReadLocker
31385 {
31386 public:
31387 inline QReadLocker(QReadWriteLock *readWriteLock);
31388 inline ~QReadLocker()
31389 { unlock(); }
31390 inline void unlock()
31391 {
31392 if (q_lock) {
31393 if ((q_val & quintptr(1u)) == quintptr(1u)) {
31394 q_val &= ~quintptr(1u);
31395 q_lock->unlock();
31396 }
31397 }
31398 }
31399 inline void relock()
31400 {
31401 if (q_lock) {
31402 if ((q_val & quintptr(1u)) == quintptr(0u)) {
31403 q_lock->lockForRead();
31404 q_val |= quintptr(1u);
31405 }
31406 }
31407 }
31408 inline QReadWriteLock *readWriteLock() const
31409 { return reinterpret_cast<QReadWriteLock *>(q_val & ~quintptr(1u)); }
31410 private:
31411 QReadLocker(const QReadLocker &); QReadLocker &operator=(const QReadLocker &);
31412 union {
31413 QReadWriteLock *q_lock;
31414 quintptr q_val;
31415 };
31416 };
31417 inline QReadLocker::QReadLocker(QReadWriteLock *areadWriteLock)
31418 : q_lock(areadWriteLock)
31419 {
31420 qt_noop();
31421 relock();
31422 }
31423 class __attribute__((visibility("default"))) QWriteLocker
31424 {
31425 public:
31426 inline QWriteLocker(QReadWriteLock *readWriteLock);
31427 inline ~QWriteLocker()
31428 { unlock(); }
31429 inline void unlock()
31430 {
31431 if (q_lock) {
31432 if ((q_val & quintptr(1u)) == quintptr(1u)) {
31433 q_val &= ~quintptr(1u);
31434 q_lock->unlock();
31435 }
31436 }
31437 }
31438 inline void relock()
31439 {
31440 if (q_lock) {
31441 if ((q_val & quintptr(1u)) == quintptr(0u)) {
31442 q_lock->lockForWrite();
31443 q_val |= quintptr(1u);
31444 }
31445 }
31446 }
31447 inline QReadWriteLock *readWriteLock() const
31448 { return reinterpret_cast<QReadWriteLock *>(q_val & ~quintptr(1u)); }
31449 private:
31450 QWriteLocker(const QWriteLocker &); QWriteLocker &operator=(const QWriteLocker &);
31451 union{
31452 QReadWriteLock *q_lock;
31453 quintptr q_val;
31454 };
31455 };
31456 inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock)
31457 : q_lock(areadWriteLock)
31458 {
31459 qt_noop();
31460 relock();
31461 }
31462 class QVariant;
31463 class QThreadData;
31464 class QObjectConnectionListVector;
31465 struct QSignalSpyCallbackSet
31466 {
31467 typedef void (*BeginCallback)(QObject *caller, int method_index, void **argv);
31468 typedef void (*EndCallback)(QObject *caller, int method_index);
31469 BeginCallback signal_begin_callback,
31470 slot_begin_callback;
31471 EndCallback signal_end_callback,
31472 slot_end_callback;
31473 };
31474 void __attribute__((visibility("default"))) qt_register_signal_spy_callbacks(const QSignalSpyCallbackSet &callback_set);
31475 extern QSignalSpyCallbackSet __attribute__((visibility("default"))) qt_signal_spy_callback_set;
31476 inline QObjectData::~QObjectData() {}
31477 enum { QObjectPrivateVersion = 0x040501 };
31478 class __attribute__((visibility("default"))) QObjectPrivate : public QObjectData
31479 {
31480 inline QObject* q_func() { return static_cast<QObject *>(q_ptr); } inline const QObject* q_func() const { return static_cast<const QObject *>(q_ptr); } friend class QObject;
31481 public:
31482 QObjectPrivate(int version = QObjectPrivateVersion);
31483 virtual ~QObjectPrivate();
31484 QList<QObject *> unused;
31485 QThreadData *threadData;
31486 void moveToThread_helper();
31487 void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
31488 void _q_reregisterTimers(void *pointer);
31489 struct Sender
31490 {
31491 QObject *sender;
31492 int signal;
31493 int ref;
31494 };
31495 Sender *currentSender;
31496 QObject *currentChildBeingDeleted;
31497 bool isSender(const QObject *receiver, const char *signal) const;
31498 QObjectList receiverList(const char *signal) const;
31499 QObjectList senderList() const;
31500 QList<QPointer<QObject> > eventFilters;
31501 void setParent_helper(QObject *);
31502 void deleteChildren();
31503 static void clearGuards(QObject *);
31504 struct ExtraData
31505 {
31506 QVector<QObjectUserData *> userData;
31507 QList<QByteArray> propertyNames;
31508 QList<QVariant> propertyValues;
31509 };
31510 ExtraData *extraData;
31511 mutable quint32 connectedSignals;
31512 QString objectName;
31513 struct Connection
31514 {
31515 QObject *receiver;
31516 int method;
31517 uint connectionType : 3;
31518 QBasicAtomicPointer<int> argumentTypes;
31519 };
31520 typedef QList<Connection> ConnectionList;
31521 QObjectConnectionListVector *connectionLists;
31522 void addConnection(int signal, Connection *c);
31523 void removeReceiver(int signal, QObject *receiver);
31524 void cleanConnectionLists();
31525 QList<Sender> senders;
31526 void refSender(QObject *sender, int signal);
31527 void derefSender(QObject *sender, int signal);
31528 void removeSender(QObject *sender, int signal);
31529 static Sender *setCurrentSender(QObject *receiver,
31530 Sender *sender);
31531 static void resetCurrentSender(QObject *receiver,
31532 Sender *currentSender,
31533 Sender *previousSender);
31534 static int *setDeleteWatch(QObjectPrivate *d, int *newWatch);
31535 static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch);
31536 int *deleteWatch;
31537 static QObjectPrivate *get(QObject *o) {
31538 return o->d_func();
31539 }
31540 };
31541 template <> class QTypeInfo<QObjectPrivate::Connection> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QObjectPrivate::Connection)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QObjectPrivate::Connection"; } };
31542 template <> class QTypeInfo<QObjectPrivate::Sender> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QObjectPrivate::Sender)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QObjectPrivate::Sender"; } };
31543 class QSemaphore;
31544 class __attribute__((visibility("default"))) QMetaCallEvent : public QEvent
31545 {
31546 public:
31547 QMetaCallEvent(int id, const QObject *sender, int signalId,
31548 int nargs = 0, int *types = 0, void **args = 0, QSemaphore *semaphore = 0);
31549 ~QMetaCallEvent();
31550 inline int id() const { return id_; }
31551 inline const QObject *sender() const { return sender_; }
31552 inline int signalId() const { return signalId_; }
31553 inline void **args() const { return args_; }
31554 virtual int placeMetaCall(QObject *object);
31555 private:
31556 int id_;
31557 const QObject *sender_;
31558 int signalId_;
31559 int nargs_;
31560 int *types_;
31561 void **args_;
31562 QSemaphore *semaphore_;
31563 };
31564 class __attribute__((visibility("default"))) QBoolBlocker
31565 {
31566 public:
31567 inline QBoolBlocker(bool &b, bool value=true):block(b), reset(b){block = value;}
31568 inline ~QBoolBlocker(){block = reset; }
31569 private:
31570 bool &block;
31571 bool reset;
31572 };
31573 void __attribute__((visibility("default"))) qDeleteInEventHandler(QObject *o);
31574 int __attribute__((visibility("default"))) qAllocMore(int alloc, int extra);
31575 template <int N = 1>
31576 class QFragment
31577 {
31578 public:
31579 quint32 parent;
31580 quint32 left;
31581 quint32 right;
31582 quint32 color;
31583 quint32 size_left_array[N];
31584 quint32 size_array[N];
31585 enum {size_array_max = N };
31586 };
31587 template <class Fragment>
31588 class QFragmentMapData
31589 {
31590 enum Color { Red, Black };
31591 public:
31592 QFragmentMapData();
31593 ~QFragmentMapData();
31594 void init();
31595 class Header
31596 {
31597 public:
31598 quint32 root;
31599 quint32 tag;
31600 quint32 freelist;
31601 quint32 node_count;
31602 quint32 allocated;
31603 };
31604 enum {fragmentSize = sizeof(Fragment) };
31605 int length(uint field = 0) const;
31606 inline Fragment *fragment(uint index) {
31607 return (fragments + index);
31608 }
31609 inline const Fragment *fragment(uint index) const {
31610 return (fragments + index);
31611 }
31612 inline Fragment &F(uint index) { return fragments[index] ; }
31613 inline const Fragment &F(uint index) const { return fragments[index] ; }
31614 inline bool isRoot(uint index) const {
31615 return !fragment(index)->parent;
31616 }
31617 inline uint position(uint node, uint field = 0) const {
31618 qt_noop();
31619 const Fragment *f = fragment(node);
31620 uint offset = f->size_left_array[field];
31621 while (f->parent) {
31622 uint p = f->parent;
31623 f = fragment(p);
31624 if (f->right == node)
31625 offset += f->size_left_array[field] + f->size_array[field];
31626 node = p;
31627 }
31628 return offset;
31629 }
31630 inline uint sizeRight(uint node, uint field = 0) const {
31631 qt_noop();
31632 uint sr = 0;
31633 const Fragment *f = fragment(node);
31634 node = f->right;
31635 while (node) {
31636 f = fragment(node);
31637 sr += f->size_left_array[field] + f->size_array[field];
31638 node = f->right;
31639 }
31640 return sr;
31641 }
31642 inline uint sizeLeft(uint node, uint field = 0) const {
31643 qt_noop();
31644 return fragment(node)->size_left_array[field];
31645 }
31646 inline uint size(uint node, uint field = 0) const {
31647 qt_noop();
31648 return fragment(node)->size_array[field];
31649 }
31650 inline void setSize(uint node, int new_size, uint field = 0) {
31651 qt_noop();
31652 Fragment *f = fragment(node);
31653 int diff = new_size - f->size_array[field];
31654 f->size_array[field] = new_size;
31655 while (f->parent) {
31656 uint p = f->parent;
31657 f = fragment(p);
31658 if (f->left == node)
31659 f->size_left_array[field] += diff;
31660 node = p;
31661 }
31662 }
31663 uint findNode(int k, uint field = 0) const;
31664 uint insert_single(int key, uint length);
31665 uint erase_single(uint f);
31666 uint minimum(uint n) const {
31667 while (n && fragment(n)->left)
31668 n = fragment(n)->left;
31669 return n;
31670 }
31671 uint maximum(uint n) const {
31672 while (n && fragment(n)->right)
31673 n = fragment(n)->right;
31674 return n;
31675 }
31676 uint next(uint n) const;
31677 uint previous(uint n) const;
31678 inline uint root() const {
31679 qt_noop();
31680 return head->root;
31681 }
31682 inline void setRoot(uint new_root) {
31683 qt_noop();
31684 head->root = new_root;
31685 }
31686 union {
31687 Header *head;
31688 Fragment *fragments;
31689 };
31690 private:
31691 void rotateLeft(uint x);
31692 void rotateRight(uint x);
31693 void rebalance(uint x);
31694 void removeAndRebalance(uint z);
31695 uint createFragment();
31696 void freeFragment(uint f);
31697 };
31698 template <class Fragment>
31699 QFragmentMapData<Fragment>::QFragmentMapData()
31700 {
31701 init();
31702 }
31703 template <class Fragment>
31704 void QFragmentMapData<Fragment>::init()
31705 {
31706 fragments = (Fragment *)malloc(64*fragmentSize);
31707 head->tag = (((quint32)'p') << 24) | (((quint32)'m') << 16) | (((quint32)'a') << 8) | 'p';
31708 head->root = 0;
31709 head->freelist = 1;
31710 head->node_count = 0;
31711 head->allocated = 64;
31712 F(head->freelist).right = 0;
31713 }
31714 template <class Fragment>
31715 QFragmentMapData<Fragment>::~QFragmentMapData()
31716 {
31717 free(head);
31718 }
31719 template <class Fragment>
31720 uint QFragmentMapData<Fragment>::createFragment()
31721 {
31722 qt_noop();
31723 uint freePos = head->freelist;
31724 if (freePos == head->allocated) {
31725 uint needed = qAllocMore((freePos+1)*fragmentSize, 0);
31726 qt_noop();
31727 fragments = (Fragment *)realloc(fragments, needed);
31728 head->allocated = needed/fragmentSize;
31729 F(freePos).right = 0;
31730 }
31731 uint nextPos = F(freePos).right;
31732 if (!nextPos) {
31733 nextPos = freePos+1;
31734 if (nextPos < head->allocated)
31735 F(nextPos).right = 0;
31736 }
31737 head->freelist = nextPos;
31738 ++head->node_count;
31739 return freePos;
31740 }
31741 template <class Fragment>
31742 void QFragmentMapData<Fragment>::freeFragment(uint i)
31743 {
31744 F(i).right = head->freelist;
31745 head->freelist = i;
31746 --head->node_count;
31747 }
31748 template <class Fragment>
31749 uint QFragmentMapData<Fragment>::next(uint n) const {
31750 qt_noop();
31751 if (F(n).right) {
31752 n = F(n).right;
31753 while (F(n).left)
31754 n = F(n).left;
31755 } else {
31756 uint y = F(n).parent;
31757 while (F(n).parent && n == F(y).right) {
31758 n = y;
31759 y = F(y).parent;
31760 }
31761 n = y;
31762 }
31763 return n;
31764 }
31765 template <class Fragment>
31766 uint QFragmentMapData<Fragment>::previous(uint n) const {
31767 if (!n)
31768 return maximum(root());
31769 if (F(n).left) {
31770 n = F(n).left;
31771 while (F(n).right)
31772 n = F(n).right;
31773 } else {
31774 uint y = F(n).parent;
31775 while (F(n).parent && n == F(y).left) {
31776 n = y;
31777 y = F(y).parent;
31778 }
31779 n = y;
31780 }
31781 return n;
31782 }
31783 template <class Fragment>
31784 void QFragmentMapData<Fragment>::rotateLeft(uint x)
31785 {
31786 uint p = F(x).parent;
31787 uint y = F(x).right;
31788 if (y) {
31789 F(x).right = F(y).left;
31790 if (F(y).left)
31791 F(F(y).left).parent = x;
31792 F(y).left = x;
31793 F(y).parent = p;
31794 } else {
31795 F(x).right = 0;
31796 }
31797 if (!p) {
31798 qt_noop();
31799 head->root = y;
31800 }
31801 else if (x == F(p).left)
31802 F(p).left = y;
31803 else
31804 F(p).right = y;
31805 F(x).parent = y;
31806 for (uint field = 0; field < Fragment::size_array_max; ++field)
31807 F(y).size_left_array[field] += F(x).size_left_array[field] + F(x).size_array[field];
31808 }
31809 template <class Fragment>
31810 void QFragmentMapData<Fragment>::rotateRight(uint x)
31811 {
31812 uint y = F(x).left;
31813 uint p = F(x).parent;
31814 if (y) {
31815 F(x).left = F(y).right;
31816 if (F(y).right)
31817 F(F(y).right).parent = x;
31818 F(y).right = x;
31819 F(y).parent = p;
31820 } else {
31821 F(x).left = 0;
31822 }
31823 if (!p) {
31824 qt_noop();
31825 head->root = y;
31826 }
31827 else if (x == F(p).right)
31828 F(p).right = y;
31829 else
31830 F(p).left = y;
31831 F(x).parent = y;
31832 for (uint field = 0; field < Fragment::size_array_max; ++field)
31833 F(x).size_left_array[field] -= F(y).size_left_array[field] + F(y).size_array[field];
31834 }
31835 template <class Fragment>
31836 void QFragmentMapData<Fragment>::rebalance(uint x)
31837 {
31838 F(x).color = Red;
31839 while (F(x).parent && F(F(x).parent).color == Red) {
31840 uint p = F(x).parent;
31841 uint pp = F(p).parent;
31842 qt_noop();
31843 if (p == F(pp).left) {
31844 uint y = F(pp).right;
31845 if (y && F(y).color == Red) {
31846 F(p).color = Black;
31847 F(y).color = Black;
31848 F(pp).color = Red;
31849 x = pp;
31850 } else {
31851 if (x == F(p).right) {
31852 x = p;
31853 rotateLeft(x);
31854 p = F(x).parent;
31855 pp = F(p).parent;
31856 }
31857 F(p).color = Black;
31858 if (pp) {
31859 F(pp).color = Red;
31860 rotateRight(pp);
31861 }
31862 }
31863 } else {
31864 uint y = F(pp).left;
31865 if (y && F(y).color == Red) {
31866 F(p).color = Black;
31867 F(y).color = Black;
31868 F(pp).color = Red;
31869 x = pp;
31870 } else {
31871 if (x == F(p).left) {
31872 x = p;
31873 rotateRight(x);
31874 p = F(x).parent;
31875 pp = F(p).parent;
31876 }
31877 F(p).color = Black;
31878 if (pp) {
31879 F(pp).color = Red;
31880 rotateLeft(pp);
31881 }
31882 }
31883 }
31884 }
31885 F(root()).color = Black;
31886 }
31887 template <class Fragment>
31888 uint QFragmentMapData<Fragment>::erase_single(uint z)
31889 {
31890 uint w = previous(z);
31891 uint y = z;
31892 uint x;
31893 uint p;
31894 if (!F(y).left) {
31895 x = F(y).right;
31896 } else if (!F(y).right) {
31897 x = F(y).left;
31898 } else {
31899 y = F(y).right;
31900 while (F(y).left)
31901 y = F(y).left;
31902 x = F(y).right;
31903 }
31904 if (y != z) {
31905 F(F(z).left).parent = y;
31906 F(y).left = F(z).left;
31907 for (uint field = 0; field < Fragment::size_array_max; ++field)
31908 F(y).size_left_array[field] = F(z).size_left_array[field];
31909 if (y != F(z).right) {
31910 p = F(y).parent;
31911 if (x)
31912 F(x).parent = p;
31913 F(p).left = x;
31914 F(y).right = F(z).right;
31915 F(F(z).right).parent = y;
31916 uint n = p;
31917 while (n != y) {
31918 for (uint field = 0; field < Fragment::size_array_max; ++field)
31919 F(n).size_left_array[field] -= F(y).size_array[field];
31920 n = F(n).parent;
31921 }
31922 } else {
31923 p = y;
31924 }
31925 uint zp = F(z).parent;
31926 if (!zp) {
31927 qt_noop();
31928 head->root = y;
31929 } else if (F(zp).left == z) {
31930 F(zp).left = y;
31931 for (uint field = 0; field < Fragment::size_array_max; ++field)
31932 F(zp).size_left_array[field] -= F(z).size_array[field];
31933 } else {
31934 F(zp).right = y;
31935 }
31936 F(y).parent = zp;
31937 uint c = F(y).color;
31938 F(y).color = F(z).color;
31939 F(z).color = c;
31940 y = z;
31941 } else {
31942 p = F(z).parent;
31943 if (x)
31944 F(x).parent = p;
31945 if (!p) {
31946 qt_noop();
31947 head->root = x;
31948 } else if (F(p).left == z) {
31949 F(p).left = x;
31950 for (uint field = 0; field < Fragment::size_array_max; ++field)
31951 F(p).size_left_array[field] -= F(z).size_array[field];
31952 } else {
31953 F(p).right = x;
31954 }
31955 }
31956 uint n = z;
31957 while (F(n).parent) {
31958 uint p = F(n).parent;
31959 if (F(p).left == n) {
31960 for (uint field = 0; field < Fragment::size_array_max; ++field)
31961 F(p).size_left_array[field] -= F(z).size_array[field];
31962 }
31963 n = p;
31964 }
31965 freeFragment(z);
31966 if (F(y).color != Red) {
31967 while (F(x).parent && (x == 0 || F(x).color == Black)) {
31968 if (x == F(p).left) {
31969 uint w = F(p).right;
31970 if (F(w).color == Red) {
31971 F(w).color = Black;
31972 F(p).color = Red;
31973 rotateLeft(p);
31974 w = F(p).right;
31975 }
31976 if ((F(w).left == 0 || F(F(w).left).color == Black) &&
31977 (F(w).right == 0 || F(F(w).right).color == Black)) {
31978 F(w).color = Red;
31979 x = p;
31980 p = F(x).parent;
31981 } else {
31982 if (F(w).right == 0 || F(F(w).right).color == Black) {
31983 if (F(w).left)
31984 F(F(w).left).color = Black;
31985 F(w).color = Red;
31986 rotateRight(F(p).right);
31987 w = F(p).right;
31988 }
31989 F(w).color = F(p).color;
31990 F(p).color = Black;
31991 if (F(w).right)
31992 F(F(w).right).color = Black;
31993 rotateLeft(p);
31994 break;
31995 }
31996 } else {
31997 uint w = F(p).left;
31998 if (F(w).color == Red) {
31999 F(w).color = Black;
32000 F(p).color = Red;
32001 rotateRight(p);
32002 w = F(p).left;
32003 }
32004 if ((F(w).right == 0 || F(F(w).right).color == Black) &&
32005 (F(w).left == 0 || F(F(w).left).color == Black)) {
32006 F(w).color = Red;
32007 x = p;
32008 p = F(x).parent;
32009 } else {
32010 if (F(w).left == 0 || F(F(w).left).color == Black) {
32011 if (F(w).right)
32012 F(F(w).right).color = Black;
32013 F(w).color = Red;
32014 rotateLeft(F(p).left);
32015 w = F(p).left;
32016 }
32017 F(w).color = F(p).color;
32018 F(p).color = Black;
32019 if (F(w).left)
32020 F(F(w).left).color = Black;
32021 rotateRight(p);
32022 break;
32023 }
32024 }
32025 }
32026 if (x)
32027 F(x).color = Black;
32028 }
32029 return w;
32030 }
32031 template <class Fragment>
32032 uint QFragmentMapData<Fragment>::findNode(int k, uint field) const
32033 {
32034 qt_noop();
32035 uint x = root();
32036 uint s = k;
32037 while (x) {
32038 if (sizeLeft(x, field) <= s) {
32039 if (s < sizeLeft(x, field) + size(x, field))
32040 return x;
32041 s -= sizeLeft(x, field) + size(x, field);
32042 x = F(x).right;
32043 } else {
32044 x = F(x).left;
32045 }
32046 }
32047 return 0;
32048 }
32049 template <class Fragment>
32050 uint QFragmentMapData<Fragment>::insert_single(int key, uint length)
32051 {
32052 qt_noop();
32053 uint z = createFragment();
32054 F(z).left = 0;
32055 F(z).right = 0;
32056 F(z).size_array[0] = length;
32057 for (uint field = 1; field < Fragment::size_array_max; ++field)
32058 F(z).size_array[field] = 1;
32059 for (uint field = 0; field < Fragment::size_array_max; ++field)
32060 F(z).size_left_array[field] = 0;
32061 uint y = 0;
32062 uint x = root();
32063 qt_noop();
32064 uint s = key;
32065 bool right = false;
32066 while (x) {
32067 y = x;
32068 if (s <= F(x).size_left_array[0]) {
32069 x = F(x).left;
32070 right = false;
32071 } else {
32072 s -= F(x).size_left_array[0] + F(x).size_array[0];
32073 x = F(x).right;
32074 right = true;
32075 }
32076 }
32077 F(z).parent = y;
32078 if (!y) {
32079 head->root = z;
32080 } else if (!right) {
32081 F(y).left = z;
32082 for (uint field = 0; field < Fragment::size_array_max; ++field)
32083 F(y).size_left_array[field] = F(z).size_array[field];
32084 } else {
32085 F(y).right = z;
32086 }
32087 while (y && F(y).parent) {
32088 uint p = F(y).parent;
32089 if (F(p).left == y) {
32090 for (uint field = 0; field < Fragment::size_array_max; ++field)
32091 F(p).size_left_array[field] += F(z).size_array[field];
32092 }
32093 y = p;
32094 }
32095 rebalance(z);
32096 return z;
32097 }
32098 template <class Fragment>
32099 int QFragmentMapData<Fragment>::length(uint field) const {
32100 uint root = this->root();
32101 return root ? sizeLeft(root, field) + size(root, field) + sizeRight(root, field) : 0;
32102 }
32103 template <class Fragment>
32104 class QFragmentMap
32105 {
32106 public:
32107 class Iterator
32108 {
32109 public:
32110 QFragmentMap *pt;
32111 quint32 n;
32112 Iterator() : pt(0), n(0) {}
32113 Iterator(QFragmentMap *p, int node) : pt(p), n(node) {}
32114 Iterator(const Iterator& it) : pt(it.pt), n(it.n) {}
32115 inline bool atEnd() const { return !n; }
32116 bool operator==(const Iterator& it) const { return pt == it.pt && n == it.n; }
32117 bool operator!=(const Iterator& it) const { return pt != it.pt || n != it.n; }
32118 bool operator<(const Iterator &it) const { return position() < it.position(); }
32119 Fragment *operator*() { qt_noop(); return pt->fragment(n); }
32120 const Fragment *operator*() const { qt_noop(); return pt->fragment(n); }
32121 Fragment *operator->() { qt_noop(); return pt->fragment(n); }
32122 const Fragment *operator->() const { qt_noop(); return pt->fragment(n); }
32123 int position() const { qt_noop(); return pt->data.position(n); }
32124 const Fragment *value() const { qt_noop(); return pt->fragment(n); }
32125 Fragment *value() { qt_noop(); return pt->fragment(n); }
32126 Iterator& operator++() {
32127 n = pt->data.next(n);
32128 return *this;
32129 }
32130 Iterator& operator--() {
32131 n = pt->data.previous(n);
32132 return *this;
32133 }
32134 };
32135 class ConstIterator
32136 {
32137 public:
32138 const QFragmentMap *pt;
32139 quint32 n;
32140 ConstIterator() : pt(0), n(0) {}
32141 ConstIterator(const QFragmentMap *p, int node) : pt(p), n(node) {}
32142 ConstIterator(const ConstIterator& it) : pt(it.pt), n(it.n) {}
32143 ConstIterator(const Iterator& it) : pt(it.pt), n(it.n) {}
32144 inline bool atEnd() const { return !n; }
32145 bool operator==(const ConstIterator& it) const { return pt == it.pt && n == it.n; }
32146 bool operator!=(const ConstIterator& it) const { return pt != it.pt || n != it.n; }
32147 bool operator<(const ConstIterator &it) const { return position() < it.position(); }
32148 const Fragment *operator*() const { qt_noop(); return pt->fragment(n); }
32149 const Fragment *operator->() const { qt_noop(); return pt->fragment(n); }
32150 int position() const { qt_noop(); return pt->data.position(n); }
32151 int size() const { qt_noop(); return pt->data.size(n); }
32152 const Fragment *value() const { qt_noop(); return pt->fragment(n); }
32153 ConstIterator& operator++() {
32154 n = pt->data.next(n);
32155 return *this;
32156 }
32157 ConstIterator& operator--() {
32158 n = pt->data.previous(n);
32159 return *this;
32160 }
32161 };
32162 QFragmentMap() {}
32163 ~QFragmentMap()
32164 {
32165 for (Iterator it = begin(); !it.atEnd(); ++it)
32166 it.value()->free();
32167 }
32168 inline void clear() {
32169 for (Iterator it = begin(); !it.atEnd(); ++it)
32170 it.value()->free();
32171 ::free(data.head);
32172 data.init();
32173 }
32174 inline Iterator begin() { return Iterator(this, data.minimum(data.root())); }
32175 inline Iterator end() { return Iterator(this, 0); }
32176 inline ConstIterator begin() const { return ConstIterator(this, data.minimum(data.root())); }
32177 inline ConstIterator end() const { return ConstIterator(this, 0); }
32178 inline ConstIterator last() const { return ConstIterator(this, data.maximum(data.root())); }
32179 inline bool isEmpty() const { return data.head->node_count == 0; }
32180 inline int numNodes() const { return data.head->node_count; }
32181 int length(uint field = 0) const { return data.length(field); }
32182 Iterator find(int k, uint field = 0) { return Iterator(this, data.findNode(k, field)); }
32183 ConstIterator find(int k, uint field = 0) const { return ConstIterator(this, data.findNode(k, field)); }
32184 uint findNode(int k, uint field = 0) const { return data.findNode(k, field); }
32185 uint insert_single(int key, uint length)
32186 {
32187 uint f = data.insert_single(key, length);
32188 if (f != 0) {
32189 Fragment *frag = fragment(f);
32190 qt_noop();
32191 frag->initialize();
32192 }
32193 return f;
32194 }
32195 uint erase_single(uint f)
32196 {
32197 if (f != 0) {
32198 Fragment *frag = fragment(f);
32199 qt_noop();
32200 frag->free();
32201 }
32202 return data.erase_single(f);
32203 }
32204 inline Fragment *fragment(uint index) {
32205 qt_noop();
32206 return data.fragment(index);
32207 }
32208 inline const Fragment *fragment(uint index) const {
32209 qt_noop();
32210 return data.fragment(index);
32211 }
32212 inline uint position(uint node, uint field = 0) const { return data.position(node, field); }
32213 inline uint next(uint n) const { return data.next(n); }
32214 inline uint previous(uint n) const { return data.previous(n); }
32215 inline uint size(uint node, uint field = 0) const { return data.size(node, field); }
32216 inline void setSize(uint node, int new_size, uint field = 0)
32217 { data.setSize(node, new_size, field);
32218 if (node != 0 && field == 0) {
32219 Fragment *frag = fragment(node);
32220 qt_noop();
32221 frag->invalidate();
32222 }
32223 }
32224 inline int firstNode() const { return data.minimum(data.root()); }
32225 private:
32226 friend class Iterator;
32227 friend class ConstIterator;
32228 QFragmentMapData<Fragment> data;
32229 QFragmentMap(const QFragmentMap& m);
32230 QFragmentMap& operator= (const QFragmentMap& m);
32231 };
32232 typedef QtValidLicenseForGuiModule QtGuiModule;
32233 class QTextFormatCollection;
32234 class QTextListFormat;
32235 class QRect;
32236 class QPainter;
32237 class QPrinter;
32238 class QAbstractTextDocumentLayout;
32239 class QPoint;
32240 class QTextCursor;
32241 class QTextObject;
32242 class QTextFormat;
32243 class QTextFrame;
32244 class QTextBlock;
32245 class QTextCodec;
32246 class QUrl;
32247 class QVariant;
32248 class QRectF;
32249 class QTextOption;
32250 template<typename T> class QVector;
32251 namespace Qt
32252 {
32253 enum HitTestAccuracy { ExactHit, FuzzyHit };
32254 enum WhiteSpaceMode {
32255 WhiteSpaceNormal,
32256 WhiteSpacePre,
32257 WhiteSpaceNoWrap,
32258 WhiteSpaceModeUndefined = -1
32259 };
32260 __attribute__((visibility("default"))) bool mightBeRichText(const QString&);
32261 __attribute__((visibility("default"))) QString escape(const QString& plain);
32262 __attribute__((visibility("default"))) QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
32263 __attribute__((visibility("default"))) QTextCodec *codecForHtml(const QByteArray &ba);
32264 }
32265 class __attribute__((visibility("default"))) QAbstractUndoItem
32266 {
32267 public:
32268 virtual ~QAbstractUndoItem() = 0;
32269 virtual void undo() = 0;
32270 virtual void redo() = 0;
32271 };
32272 inline QAbstractUndoItem::~QAbstractUndoItem()
32273 {
32274 }
32275 class QTextDocumentPrivate;
32276 class __attribute__((visibility("default"))) QTextDocument : public QObject
32277 {
32278 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
32279 public:
32280 explicit QTextDocument(QObject *parent = 0);
32281 explicit QTextDocument(const QString &text, QObject *parent = 0);
32282 ~QTextDocument();
32283 QTextDocument *clone(QObject *parent = 0) const;
32284 bool isEmpty() const;
32285 virtual void clear();
32286 void setUndoRedoEnabled(bool enable);
32287 bool isUndoRedoEnabled() const;
32288 bool isUndoAvailable() const;
32289 bool isRedoAvailable() const;
32290 int revision() const;
32291 void setDocumentLayout(QAbstractTextDocumentLayout *layout);
32292 QAbstractTextDocumentLayout *documentLayout() const;
32293 enum MetaInformation {
32294 DocumentTitle,
32295 DocumentUrl
32296 };
32297 void setMetaInformation(MetaInformation info, const QString &);
32298 QString metaInformation(MetaInformation info) const;
32299 QString toHtml(const QByteArray &encoding = QByteArray()) const;
32300 void setHtml(const QString &html);
32301 QString toPlainText() const;
32302 void setPlainText(const QString &text);
32303 QChar characterAt(int pos) const;
32304 enum FindFlag
32305 {
32306 FindBackward = 0x00001,
32307 FindCaseSensitively = 0x00002,
32308 FindWholeWords = 0x00004
32309 };
32310 typedef QFlags<FindFlag> FindFlags;
32311 QTextCursor find(const QString &subString, int from = 0, FindFlags options = 0) const;
32312 QTextCursor find(const QString &subString, const QTextCursor &from, FindFlags options = 0) const;
32313 QTextCursor find(const QRegExp &expr, int from = 0, FindFlags options = 0) const;
32314 QTextCursor find(const QRegExp &expr, const QTextCursor &from, FindFlags options = 0) const;
32315 QTextFrame *frameAt(int pos) const;
32316 QTextFrame *rootFrame() const;
32317 QTextObject *object(int objectIndex) const;
32318 QTextObject *objectForFormat(const QTextFormat &) const;
32319 QTextBlock findBlock(int pos) const;
32320 QTextBlock findBlockByNumber(int blockNumber) const;
32321 QTextBlock findBlockByLineNumber(int blockNumber) const;
32322 QTextBlock begin() const;
32323 QTextBlock end() const;
32324 QTextBlock firstBlock() const;
32325 QTextBlock lastBlock() const;
32326 void setPageSize(const QSizeF &size);
32327 QSizeF pageSize() const;
32328 void setDefaultFont(const QFont &font);
32329 QFont defaultFont() const;
32330 int pageCount() const;
32331 bool isModified() const;
32332 void print(QPrinter *printer) const;
32333 enum ResourceType {
32334 HtmlResource = 1,
32335 ImageResource = 2,
32336 StyleSheetResource = 3,
32337 UserResource = 100
32338 };
32339 QVariant resource(int type, const QUrl &name) const;
32340 void addResource(int type, const QUrl &name, const QVariant &resource);
32341 QVector<QTextFormat> allFormats() const;
32342 void markContentsDirty(int from, int length);
32343 void setUseDesignMetrics(bool b);
32344 bool useDesignMetrics() const;
32345 void drawContents(QPainter *painter, const QRectF &rect = QRectF());
32346 void setTextWidth(qreal width);
32347 qreal textWidth() const;
32348 qreal idealWidth() const;
32349 qreal indentWidth() const;
32350 void setIndentWidth(qreal width);
32351 qreal documentMargin() const;
32352 void setDocumentMargin(qreal margin);
32353 void adjustSize();
32354 QSizeF size() const;
32355 int blockCount() const;
32356 int lineCount() const;
32357 int characterCount() const;
32358 void setDefaultStyleSheet(const QString &sheet);
32359 QString defaultStyleSheet() const;
32360 void undo(QTextCursor *cursor);
32361 void redo(QTextCursor *cursor);
32362 int maximumBlockCount() const;
32363 void setMaximumBlockCount(int maximum);
32364 QTextOption defaultTextOption() const;
32365 void setDefaultTextOption(const QTextOption &option);
32366 protected:
32367 void contentsChange(int from, int charsRemoves, int charsAdded);
32368 void contentsChanged();
32369 void undoAvailable(bool);
32370 void redoAvailable(bool);
32371 void undoCommandAdded();
32372 void modificationChanged(bool m);
32373 void cursorPositionChanged(const QTextCursor &cursor);
32374 void blockCountChanged(int newBlockCount);
32375 void documentLayoutChanged();
32376 public :
32377 void undo();
32378 void redo();
32379 void appendUndoItem(QAbstractUndoItem *);
32380 void setModified(bool m = true);
32381 protected:
32382 virtual QTextObject *createObject(const QTextFormat &f);
32383 virtual QVariant loadResource(int type, const QUrl &name);
32384 QTextDocument(QTextDocumentPrivate &dd, QObject *parent);
32385 public:
32386 QTextDocumentPrivate *docHandle() const;
32387 private:
32388 QTextDocument(const QTextDocument &); QTextDocument &operator=(const QTextDocument &);
32389 inline QTextDocumentPrivate* d_func() { return reinterpret_cast<QTextDocumentPrivate *>(d_ptr); } inline const QTextDocumentPrivate* d_func() const { return reinterpret_cast<const QTextDocumentPrivate *>(d_ptr); } friend class QTextDocumentPrivate;
32390 friend class QTextObjectPrivate;
32391 };
32392 inline QFlags<QTextDocument::FindFlags::enum_type> operator|(QTextDocument::FindFlags::enum_type f1, QTextDocument::FindFlags::enum_type f2) { return QFlags<QTextDocument::FindFlags::enum_type>(f1) | f2; } inline QFlags<QTextDocument::FindFlags::enum_type> operator|(QTextDocument::FindFlags::enum_type f1, QFlags<QTextDocument::FindFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextDocument::FindFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
32393 typedef QtValidLicenseForCoreModule QtCoreModule;
32394 class QUrlPrivate;
32395 class QDataStream;
32396 class __attribute__((visibility("default"))) QUrl
32397 {
32398 public:
32399 enum ParsingMode {
32400 TolerantMode,
32401 StrictMode
32402 };
32403 enum FormattingOption {
32404 None = 0x0,
32405 RemoveScheme = 0x1,
32406 RemovePassword = 0x2,
32407 RemoveUserInfo = RemovePassword | 0x4,
32408 RemovePort = 0x8,
32409 RemoveAuthority = RemoveUserInfo | RemovePort | 0x10,
32410 RemovePath = 0x20,
32411 RemoveQuery = 0x40,
32412 RemoveFragment = 0x80,
32413 StripTrailingSlash = 0x10000
32414 };
32415 typedef QFlags<FormattingOption> FormattingOptions;
32416 QUrl();
32417 QUrl(const QString &url);
32418 QUrl(const QString &url, ParsingMode mode);
32419 QUrl(const QUrl &copy);
32420 QUrl &operator =(const QUrl &copy);
32421 QUrl &operator =(const QString &url);
32422 ~QUrl();
32423 void setUrl(const QString &url);
32424 void setUrl(const QString &url, ParsingMode mode);
32425 void setEncodedUrl(const QByteArray &url);
32426 void setEncodedUrl(const QByteArray &url, ParsingMode mode);
32427 bool isValid() const;
32428 bool isEmpty() const;
32429 void clear();
32430 void setScheme(const QString &scheme);
32431 QString scheme() const;
32432 void setAuthority(const QString &authority);
32433 QString authority() const;
32434 void setUserInfo(const QString &userInfo);
32435 QString userInfo() const;
32436 void setUserName(const QString &userName);
32437 QString userName() const;
32438 void setEncodedUserName(const QByteArray &userName);
32439 QByteArray encodedUserName() const;
32440 void setPassword(const QString &password);
32441 QString password() const;
32442 void setEncodedPassword(const QByteArray &password);
32443 QByteArray encodedPassword() const;
32444 void setHost(const QString &host);
32445 QString host() const;
32446 void setEncodedHost(const QByteArray &host);
32447 QByteArray encodedHost() const;
32448 void setPort(int port);
32449 int port() const;
32450 int port(int defaultPort) const;
32451 void setPath(const QString &path);
32452 QString path() const;
32453 void setEncodedPath(const QByteArray &path);
32454 QByteArray encodedPath() const;
32455 bool hasQuery() const;
32456 void setEncodedQuery(const QByteArray &query);
32457 QByteArray encodedQuery() const;
32458 void setQueryDelimiters(char valueDelimiter, char pairDelimiter);
32459 char queryValueDelimiter() const;
32460 char queryPairDelimiter() const;
32461 void setQueryItems(const QList<QPair<QString, QString> > &query);
32462 void addQueryItem(const QString &key, const QString &value);
32463 QList<QPair<QString, QString> > queryItems() const;
32464 bool hasQueryItem(const QString &key) const;
32465 QString queryItemValue(const QString &key) const;
32466 QStringList allQueryItemValues(const QString &key) const;
32467 void removeQueryItem(const QString &key);
32468 void removeAllQueryItems(const QString &key);
32469 void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query);
32470 void addEncodedQueryItem(const QByteArray &key, const QByteArray &value);
32471 QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const;
32472 bool hasEncodedQueryItem(const QByteArray &key) const;
32473 QByteArray encodedQueryItemValue(const QByteArray &key) const;
32474 QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const;
32475 void removeEncodedQueryItem(const QByteArray &key);
32476 void removeAllEncodedQueryItems(const QByteArray &key);
32477 void setFragment(const QString &fragment);
32478 QString fragment() const;
32479 void setEncodedFragment(const QByteArray &fragment);
32480 QByteArray encodedFragment() const;
32481 bool hasFragment() const;
32482 QUrl resolved(const QUrl &relative) const;
32483 bool isRelative() const;
32484 bool isParentOf(const QUrl &url) const;
32485 static QUrl fromLocalFile(const QString &localfile);
32486 QString toLocalFile() const;
32487 QString toString(FormattingOptions options = None) const;
32488 QByteArray toEncoded(FormattingOptions options = None) const;
32489 static QUrl fromEncoded(const QByteArray &url);
32490 static QUrl fromEncoded(const QByteArray &url, ParsingMode mode);
32491 void detach();
32492 bool isDetached() const;
32493 bool operator <(const QUrl &url) const;
32494 bool operator ==(const QUrl &url) const;
32495 bool operator !=(const QUrl &url) const;
32496 static QString fromPercentEncoding(const QByteArray &);
32497 static QByteArray toPercentEncoding(const QString &,
32498 const QByteArray &exclude = QByteArray(),
32499 const QByteArray &include = QByteArray());
32500 static QString fromPunycode(const QByteArray &);
32501 static QByteArray toPunycode(const QString &);
32502 static QString fromAce(const QByteArray &);
32503 static QByteArray toAce(const QString &);
32504 static QStringList idnWhitelist();
32505 static void setIdnWhitelist(const QStringList &);
32506 QString errorString() const;
32507 protected:
32508 private:
32509 QUrlPrivate *d;
32510 public:
32511 typedef QUrlPrivate * DataPtr;
32512 inline DataPtr &data_ptr() { return d; }
32513 };
32514 template <> class QTypeInfo<QUrl> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QUrl)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QUrl"; } };
32515 template <> inline bool qIsDetached<QUrl>(QUrl &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QUrl>(QUrl &value1, QUrl &value2) { const QUrl::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
32516 inline QFlags<QUrl::FormattingOptions::enum_type> operator|(QUrl::FormattingOptions::enum_type f1, QUrl::FormattingOptions::enum_type f2) { return QFlags<QUrl::FormattingOptions::enum_type>(f1) | f2; } inline QFlags<QUrl::FormattingOptions::enum_type> operator|(QUrl::FormattingOptions::enum_type f1, QFlags<QUrl::FormattingOptions::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QUrl::FormattingOptions::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
32517 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QUrl &);
32518 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QUrl &);
32519 __attribute__((visibility("default"))) QDebug operator<<(QDebug, const QUrl &);
32520 typedef QtValidLicenseForGuiModule QtGuiModule;
32521 class QPalettePrivate;
32522 class QVariant;
32523 class __attribute__((visibility("default"))) QPalette
32524 {
32525 public: static const QMetaObject staticMetaObject; private:
32526 public:
32527 QPalette();
32528 QPalette(const QColor &button);
32529 QPalette(Qt::GlobalColor button);
32530 QPalette(const QColor &button, const QColor &window);
32531 QPalette(const QBrush &windowText, const QBrush &button, const QBrush &light,
32532 const QBrush &dark, const QBrush &mid, const QBrush &text,
32533 const QBrush &bright_text, const QBrush &base, const QBrush &window);
32534 QPalette(const QColor &windowText, const QColor &window, const QColor &light,
32535 const QColor &dark, const QColor &mid, const QColor &text, const QColor &base);
32536 QPalette(const QPalette &palette);
32537 ~QPalette();
32538 QPalette &operator=(const QPalette &palette);
32539 operator QVariant() const;
32540 enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active };
32541 enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
32542 Text, BrightText, ButtonText, Base, Window, Shadow,
32543 Highlight, HighlightedText,
32544 Link, LinkVisited,
32545 AlternateBase,
32546 NoRole,
32547 ToolTipBase, ToolTipText,
32548 NColorRoles = ToolTipText + 1,
32549 Foreground = WindowText, Background = Window
32550 };
32551 inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(current_group); }
32552 inline void setCurrentColorGroup(ColorGroup cg) { current_group = cg; }
32553 inline const QColor &color(ColorGroup cg, ColorRole cr) const
32554 { return brush(cg, cr).color(); }
32555 const QBrush &brush(ColorGroup cg, ColorRole cr) const;
32556 inline void setColor(ColorGroup cg, ColorRole cr, const QColor &color);
32557 inline void setColor(ColorRole cr, const QColor &color);
32558 inline void setBrush(ColorRole cr, const QBrush &brush);
32559 bool isBrushSet(ColorGroup cg, ColorRole cr) const;
32560 void setBrush(ColorGroup cg, ColorRole cr, const QBrush &brush);
32561 void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button,
32562 const QBrush &light, const QBrush &dark, const QBrush &mid,
32563 const QBrush &text, const QBrush &bright_text, const QBrush &base,
32564 const QBrush &window);
32565 bool isEqual(ColorGroup cr1, ColorGroup cr2) const;
32566 inline const QColor &color(ColorRole cr) const { return color(Current, cr); }
32567 inline const QBrush &brush(ColorRole cr) const { return brush(Current, cr); }
32568 inline const QBrush &foreground() const { return brush(WindowText); }
32569 inline const QBrush &windowText() const { return brush(WindowText); }
32570 inline const QBrush &button() const { return brush(Button); }
32571 inline const QBrush &light() const { return brush(Light); }
32572 inline const QBrush &dark() const { return brush(Dark); }
32573 inline const QBrush &mid() const { return brush(Mid); }
32574 inline const QBrush &text() const { return brush(Text); }
32575 inline const QBrush &base() const { return brush(Base); }
32576 inline const QBrush &alternateBase() const { return brush(AlternateBase); }
32577 inline const QBrush &toolTipBase() const { return brush(ToolTipBase); }
32578 inline const QBrush &toolTipText() const { return brush(ToolTipText); }
32579 inline const QBrush &background() const { return brush(Window); }
32580 inline const QBrush &window() const { return brush(Window); }
32581 inline const QBrush &midlight() const { return brush(Midlight); }
32582 inline const QBrush &brightText() const { return brush(BrightText); }
32583 inline const QBrush &buttonText() const { return brush(ButtonText); }
32584 inline const QBrush &shadow() const { return brush(Shadow); }
32585 inline const QBrush &highlight() const { return brush(Highlight); }
32586 inline const QBrush &highlightedText() const { return brush(HighlightedText); }
32587 inline const QBrush &link() const { return brush(Link); }
32588 inline const QBrush &linkVisited() const { return brush(LinkVisited); }
32589 bool operator==(const QPalette &p) const;
32590 inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
32591 bool isCopyOf(const QPalette &p) const;
32592 int serialNumber() const;
32593 qint64 cacheKey() const;
32594 QPalette resolve(const QPalette &) const;
32595 inline uint resolve() const { return resolve_mask; }
32596 inline void resolve(uint mask) { resolve_mask = mask; }
32597 private:
32598 void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button,
32599 const QBrush &light, const QBrush &dark, const QBrush &mid,
32600 const QBrush &text, const QBrush &bright_text,
32601 const QBrush &base, const QBrush &alternate_base,
32602 const QBrush &window, const QBrush &midlight,
32603 const QBrush &button_text, const QBrush &shadow,
32604 const QBrush &highlight, const QBrush &highlighted_text,
32605 const QBrush &link, const QBrush &link_visited);
32606 void setColorGroup(ColorGroup cr, const QBrush &windowText, const QBrush &button,
32607 const QBrush &light, const QBrush &dark, const QBrush &mid,
32608 const QBrush &text, const QBrush &bright_text,
32609 const QBrush &base, const QBrush &alternate_base,
32610 const QBrush &window, const QBrush &midlight,
32611 const QBrush &button_text, const QBrush &shadow,
32612 const QBrush &highlight, const QBrush &highlighted_text,
32613 const QBrush &link, const QBrush &link_visited,
32614 const QBrush &toolTipBase, const QBrush &toolTipText);
32615 void init();
32616 void detach();
32617 QPalettePrivate *d;
32618 uint current_group : 4;
32619 uint resolve_mask : 28;
32620 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &s, const QPalette &p);
32621 };
32622 inline void QPalette::setColor(ColorGroup acg, ColorRole acr,
32623 const QColor &acolor)
32624 { setBrush(acg, acr, QBrush(acolor)); }
32625 inline void QPalette::setColor(ColorRole acr, const QColor &acolor)
32626 { setColor(All, acr, acolor); }
32627 inline void QPalette::setBrush(ColorRole acr, const QBrush &abrush)
32628 { setBrush(All, acr, abrush); }
32629 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &ds, const QPalette &p);
32630 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &ds, QPalette &p);
32631 typedef QtValidLicenseForGuiModule QtGuiModule;
32632 class QIconPrivate;
32633 class QIconEngine;
32634 class QIconEngineV2;
32635 class __attribute__((visibility("default"))) QIcon
32636 {
32637 public:
32638 enum Mode { Normal, Disabled, Active, Selected };
32639 enum State { On, Off };
32640 QIcon();
32641 QIcon(const QPixmap &pixmap);
32642 QIcon(const QIcon &other);
32643 explicit QIcon(const QString &fileName);
32644 explicit QIcon(QIconEngine *engine);
32645 explicit QIcon(QIconEngineV2 *engine);
32646 ~QIcon();
32647 QIcon &operator=(const QIcon &other);
32648 operator QVariant() const;
32649 QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const;
32650 inline QPixmap pixmap(int w, int h, Mode mode = Normal, State state = Off) const
32651 { return pixmap(QSize(w, h), mode, state); }
32652 inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const
32653 { return pixmap(QSize(extent, extent), mode, state); }
32654 QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const;
32655 void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const;
32656 inline void paint(QPainter *painter, int x, int y, int w, int h, Qt::Alignment alignment = Qt::AlignCenter, Mode mode = Normal, State state = Off) const
32657 { paint(painter, QRect(x, y, w, h), alignment, mode, state); }
32658 bool isNull() const;
32659 bool isDetached() const;
32660 void detach();
32661 int serialNumber() const;
32662 qint64 cacheKey() const;
32663 void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off);
32664 void addFile(const QString &fileName, const QSize &size = QSize(), Mode mode = Normal, State state = Off);
32665 QList<QSize> availableSizes(Mode mode = Normal, State state = Off) const;
32666 private:
32667 QIconPrivate *d;
32668 friend __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QIcon &);
32669 friend __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QIcon &);
32670 public:
32671 typedef QIconPrivate * DataPtr;
32672 inline DataPtr &data_ptr() { return d; }
32673 };
32674 template <> inline bool qIsDetached<QIcon>(QIcon &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QIcon>(QIcon &value1, QIcon &value2) { const QIcon::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
32675 template <> class QTypeInfo<QIcon> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QIcon)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QIcon"; } };
32676 __attribute__((visibility("default"))) QDataStream &operator<<(QDataStream &, const QIcon &);
32677 __attribute__((visibility("default"))) QDataStream &operator>>(QDataStream &, QIcon &);
32678 namespace QCss
32679 {
32680 enum Property {
32681 UnknownProperty,
32682 BackgroundColor,
32683 Color,
32684 Float,
32685 Font,
32686 FontFamily,
32687 FontSize,
32688 FontStyle,
32689 FontWeight,
32690 Margin,
32691 MarginBottom,
32692 MarginLeft,
32693 MarginRight,
32694 MarginTop,
32695 QtBlockIndent,
32696 QtListIndent,
32697 QtParagraphType,
32698 QtTableType,
32699 QtUserState,
32700 TextDecoration,
32701 TextIndent,
32702 TextUnderlineStyle,
32703 VerticalAlignment,
32704 Whitespace,
32705 QtSelectionForeground,
32706 QtSelectionBackground,
32707 Border,
32708 BorderLeft,
32709 BorderRight,
32710 BorderTop,
32711 BorderBottom,
32712 Padding,
32713 PaddingLeft,
32714 PaddingRight,
32715 PaddingTop,
32716 PaddingBottom,
32717 PageBreakBefore,
32718 PageBreakAfter,
32719 QtAlternateBackground,
32720 BorderLeftStyle,
32721 BorderRightStyle,
32722 BorderTopStyle,
32723 BorderBottomStyle,
32724 BorderStyles,
32725 BorderLeftColor,
32726 BorderRightColor,
32727 BorderTopColor,
32728 BorderBottomColor,
32729 BorderColor,
32730 BorderLeftWidth,
32731 BorderRightWidth,
32732 BorderTopWidth,
32733 BorderBottomWidth,
32734 BorderWidth,
32735 BorderTopLeftRadius,
32736 BorderTopRightRadius,
32737 BorderBottomLeftRadius,
32738 BorderBottomRightRadius,
32739 BorderRadius,
32740 Background,
32741 BackgroundOrigin,
32742 BackgroundClip,
32743 BackgroundRepeat,
32744 BackgroundPosition,
32745 BackgroundAttachment,
32746 BackgroundImage,
32747 BorderImage,
32748 QtSpacing,
32749 Width,
32750 Height,
32751 MinimumWidth,
32752 MinimumHeight,
32753 MaximumWidth,
32754 MaximumHeight,
32755 QtImage,
32756 Left,
32757 Right,
32758 Top,
32759 Bottom,
32760 QtOrigin,
32761 QtPosition,
32762 Position,
32763 QtStyleFeatures,
32764 QtBackgroundRole,
32765 ListStyleType,
32766 ListStyle,
32767 QtImageAlignment,
32768 TextAlignment,
32769 Outline,
32770 OutlineOffset,
32771 OutlineWidth,
32772 OutlineColor,
32773 OutlineStyle,
32774 OutlineRadius,
32775 OutlineTopLeftRadius,
32776 OutlineTopRightRadius,
32777 OutlineBottomLeftRadius,
32778 OutlineBottomRightRadius,
32779 FontVariant,
32780 TextTransform,
32781 NumProperties
32782 };
32783 enum KnownValue {
32784 UnknownValue,
32785 Value_Normal,
32786 Value_Pre,
32787 Value_NoWrap,
32788 Value_PreWrap,
32789 Value_Small,
32790 Value_Medium,
32791 Value_Large,
32792 Value_XLarge,
32793 Value_XXLarge,
32794 Value_Italic,
32795 Value_Oblique,
32796 Value_Bold,
32797 Value_Underline,
32798 Value_Overline,
32799 Value_LineThrough,
32800 Value_Sub,
32801 Value_Super,
32802 Value_Left,
32803 Value_Right,
32804 Value_Top,
32805 Value_Bottom,
32806 Value_Center,
32807 Value_Native,
32808 Value_Solid,
32809 Value_Dotted,
32810 Value_Dashed,
32811 Value_DotDash,
32812 Value_DotDotDash,
32813 Value_Double,
32814 Value_Groove,
32815 Value_Ridge,
32816 Value_Inset,
32817 Value_Outset,
32818 Value_Wave,
32819 Value_Middle,
32820 Value_Auto,
32821 Value_Always,
32822 Value_None,
32823 Value_Transparent,
32824 Value_Disc,
32825 Value_Circle,
32826 Value_Square,
32827 Value_Decimal,
32828 Value_LowerAlpha,
32829 Value_UpperAlpha,
32830 Value_SmallCaps,
32831 Value_Uppercase,
32832 Value_Lowercase,
32833 Value_FirstColorRole,
32834 Value_WindowText = Value_FirstColorRole,
32835 Value_Button,
32836 Value_Light,
32837 Value_Midlight,
32838 Value_Dark,
32839 Value_Mid,
32840 Value_Text,
32841 Value_BrightText,
32842 Value_ButtonText,
32843 Value_Base,
32844 Value_Window,
32845 Value_Shadow,
32846 Value_Highlight,
32847 Value_HighlightedText,
32848 Value_Link,
32849 Value_LinkVisited,
32850 Value_AlternateBase,
32851 Value_LastColorRole = Value_AlternateBase,
32852 Value_Disabled,
32853 Value_Active,
32854 Value_Selected,
32855 Value_On,
32856 Value_Off,
32857 NumKnownValues
32858 };
32859 enum BorderStyle {
32860 BorderStyle_Unknown,
32861 BorderStyle_None,
32862 BorderStyle_Dotted,
32863 BorderStyle_Dashed,
32864 BorderStyle_Solid,
32865 BorderStyle_Double,
32866 BorderStyle_DotDash,
32867 BorderStyle_DotDotDash,
32868 BorderStyle_Groove,
32869 BorderStyle_Ridge,
32870 BorderStyle_Inset,
32871 BorderStyle_Outset,
32872 BorderStyle_Native,
32873 NumKnownBorderStyles
32874 };
32875 enum Edge {
32876 TopEdge,
32877 RightEdge,
32878 BottomEdge,
32879 LeftEdge,
32880 NumEdges
32881 };
32882 enum Corner {
32883 TopLeftCorner,
32884 TopRightCorner,
32885 BottomLeftCorner,
32886 BottomRightCorner
32887 };
32888 enum TileMode {
32889 TileMode_Unknown,
32890 TileMode_Round,
32891 TileMode_Stretch,
32892 TileMode_Repeat,
32893 NumKnownTileModes
32894 };
32895 enum Repeat {
32896 Repeat_Unknown,
32897 Repeat_None,
32898 Repeat_X,
32899 Repeat_Y,
32900 Repeat_XY,
32901 NumKnownRepeats
32902 };
32903 enum Origin {
32904 Origin_Unknown,
32905 Origin_Padding,
32906 Origin_Border,
32907 Origin_Content,
32908 Origin_Margin,
32909 NumKnownOrigins
32910 };
32911 enum PositionMode {
32912 PositionMode_Unknown,
32913 PositionMode_Static,
32914 PositionMode_Relative,
32915 PositionMode_Absolute,
32916 PositionMode_Fixed,
32917 NumKnownPositionModes
32918 };
32919 enum Attachment {
32920 Attachment_Unknown,
32921 Attachment_Fixed,
32922 Attachment_Scroll,
32923 NumKnownAttachments
32924 };
32925 enum StyleFeature {
32926 StyleFeature_None = 0,
32927 StyleFeature_BackgroundColor = 1,
32928 StyleFeature_BackgroundGradient = 2,
32929 NumKnownStyleFeatures = 4
32930 };
32931 struct __attribute__((visibility("default"))) Value
32932 {
32933 enum Type {
32934 Unknown,
32935 Number,
32936 Percentage,
32937 Length,
32938 String,
32939 Identifier,
32940 KnownIdentifier,
32941 Uri,
32942 Color,
32943 Function,
32944 TermOperatorSlash,
32945 TermOperatorComma
32946 };
32947 inline Value() : type(Unknown) { }
32948 Type type;
32949 QVariant variant;
32950 QString toString() const;
32951 };
32952 struct ColorData {
32953 ColorData() : type(Invalid) {}
32954 ColorData(const QColor &col) : color(col) , type(Color) {}
32955 ColorData(QPalette::ColorRole r) : role(r) , type(Role) {}
32956 QColor color;
32957 QPalette::ColorRole role;
32958 enum { Invalid, Color, Role} type;
32959 };
32960 struct BrushData {
32961 BrushData() : type(Invalid) {}
32962 BrushData(const QBrush &br) : brush(br) , type(Brush) {}
32963 BrushData(QPalette::ColorRole r) : role(r) , type(Role) {}
32964 QBrush brush;
32965 QPalette::ColorRole role;
32966 enum { Invalid, Brush, Role, DependsOnThePalette } type;
32967 };
32968 struct BackgroundData {
32969 BrushData brush;
32970 QString image;
32971 Repeat repeat;
32972 Qt::Alignment alignment;
32973 };
32974 struct LengthData {
32975 qreal number;
32976 enum { None, Px, Ex, Em } unit;
32977 };
32978 struct BorderData {
32979 LengthData width;
32980 BorderStyle style;
32981 BrushData color;
32982 };
32983 struct __attribute__((visibility("default"))) Declaration
32984 {
32985 struct DeclarationData : public QSharedData
32986 {
32987 inline DeclarationData() : propertyId(UnknownProperty), important(false) {}
32988 QString property;
32989 Property propertyId;
32990 QVector<Value> values;
32991 QVariant parsed;
32992 bool important;
32993 };
32994 QExplicitlySharedDataPointer<DeclarationData> d;
32995 inline Declaration() : d(new DeclarationData()) {}
32996 inline bool isEmpty() const { return d->property.isEmpty() && d->propertyId == UnknownProperty; }
32997 QColor colorValue(const QPalette & = QPalette()) const;
32998 void colorValues(QColor *c, const QPalette & = QPalette()) const;
32999 QBrush brushValue(const QPalette & = QPalette()) const;
33000 void brushValues(QBrush *c, const QPalette & = QPalette()) const;
33001 BorderStyle styleValue() const;
33002 void styleValues(BorderStyle *s) const;
33003 Origin originValue() const;
33004 Repeat repeatValue() const;
33005 Qt::Alignment alignmentValue() const;
33006 PositionMode positionValue() const;
33007 Attachment attachmentValue() const;
33008 int styleFeaturesValue() const;
33009 bool intValue(int *i, const char *unit = 0) const;
33010 bool realValue(qreal *r, const char *unit = 0) const;
33011 QSize sizeValue() const;
33012 QRect rectValue() const;
33013 QString uriValue() const;
33014 QIcon iconValue() const;
33015 void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const;
33016 };
33017 const quint64 PseudoClass_Unknown = static_cast<unsigned long long>(0x0000000000000000ULL);
33018 const quint64 PseudoClass_Enabled = static_cast<unsigned long long>(0x0000000000000001ULL);
33019 const quint64 PseudoClass_Disabled = static_cast<unsigned long long>(0x0000000000000002ULL);
33020 const quint64 PseudoClass_Pressed = static_cast<unsigned long long>(0x0000000000000004ULL);
33021 const quint64 PseudoClass_Focus = static_cast<unsigned long long>(0x0000000000000008ULL);
33022 const quint64 PseudoClass_Hover = static_cast<unsigned long long>(0x0000000000000010ULL);
33023 const quint64 PseudoClass_Checked = static_cast<unsigned long long>(0x0000000000000020ULL);
33024 const quint64 PseudoClass_Unchecked = static_cast<unsigned long long>(0x0000000000000040ULL);
33025 const quint64 PseudoClass_Indeterminate = static_cast<unsigned long long>(0x0000000000000080ULL);
33026 const quint64 PseudoClass_Unspecified = static_cast<unsigned long long>(0x0000000000000100ULL);
33027 const quint64 PseudoClass_Selected = static_cast<unsigned long long>(0x0000000000000200ULL);
33028 const quint64 PseudoClass_Horizontal = static_cast<unsigned long long>(0x0000000000000400ULL);
33029 const quint64 PseudoClass_Vertical = static_cast<unsigned long long>(0x0000000000000800ULL);
33030 const quint64 PseudoClass_Window = static_cast<unsigned long long>(0x0000000000001000ULL);
33031 const quint64 PseudoClass_Children = static_cast<unsigned long long>(0x0000000000002000ULL);
33032 const quint64 PseudoClass_Sibling = static_cast<unsigned long long>(0x0000000000004000ULL);
33033 const quint64 PseudoClass_Default = static_cast<unsigned long long>(0x0000000000008000ULL);
33034 const quint64 PseudoClass_First = static_cast<unsigned long long>(0x0000000000010000ULL);
33035 const quint64 PseudoClass_Last = static_cast<unsigned long long>(0x0000000000020000ULL);
33036 const quint64 PseudoClass_Middle = static_cast<unsigned long long>(0x0000000000040000ULL);
33037 const quint64 PseudoClass_OnlyOne = static_cast<unsigned long long>(0x0000000000080000ULL);
33038 const quint64 PseudoClass_PreviousSelected = static_cast<unsigned long long>(0x0000000000100000ULL);
33039 const quint64 PseudoClass_NextSelected = static_cast<unsigned long long>(0x0000000000200000ULL);
33040 const quint64 PseudoClass_Flat = static_cast<unsigned long long>(0x0000000000400000ULL);
33041 const quint64 PseudoClass_Left = static_cast<unsigned long long>(0x0000000000800000ULL);
33042 const quint64 PseudoClass_Right = static_cast<unsigned long long>(0x0000000001000000ULL);
33043 const quint64 PseudoClass_Top = static_cast<unsigned long long>(0x0000000002000000ULL);
33044 const quint64 PseudoClass_Bottom = static_cast<unsigned long long>(0x0000000004000000ULL);
33045 const quint64 PseudoClass_Exclusive = static_cast<unsigned long long>(0x0000000008000000ULL);
33046 const quint64 PseudoClass_NonExclusive = static_cast<unsigned long long>(0x0000000010000000ULL);
33047 const quint64 PseudoClass_Frameless = static_cast<unsigned long long>(0x0000000020000000ULL);
33048 const quint64 PseudoClass_ReadOnly = static_cast<unsigned long long>(0x0000000040000000ULL);
33049 const quint64 PseudoClass_Active = static_cast<unsigned long long>(0x0000000080000000ULL);
33050 const quint64 PseudoClass_Closable = static_cast<unsigned long long>(0x0000000100000000ULL);
33051 const quint64 PseudoClass_Movable = static_cast<unsigned long long>(0x0000000200000000ULL);
33052 const quint64 PseudoClass_Floatable = static_cast<unsigned long long>(0x0000000400000000ULL);
33053 const quint64 PseudoClass_Minimized = static_cast<unsigned long long>(0x0000000800000000ULL);
33054 const quint64 PseudoClass_Maximized = static_cast<unsigned long long>(0x0000001000000000ULL);
33055 const quint64 PseudoClass_On = static_cast<unsigned long long>(0x0000002000000000ULL);
33056 const quint64 PseudoClass_Off = static_cast<unsigned long long>(0x0000004000000000ULL);
33057 const quint64 PseudoClass_Editable = static_cast<unsigned long long>(0x0000008000000000ULL);
33058 const quint64 PseudoClass_Item = static_cast<unsigned long long>(0x0000010000000000ULL);
33059 const quint64 PseudoClass_Closed = static_cast<unsigned long long>(0x0000020000000000ULL);
33060 const quint64 PseudoClass_Open = static_cast<unsigned long long>(0x0000040000000000ULL);
33061 const quint64 PseudoClass_EditFocus = static_cast<unsigned long long>(0x0000080000000000ULL);
33062 const quint64 PseudoClass_Alternate = static_cast<unsigned long long>(0x0000100000000000ULL);
33063 const quint64 PseudoClass_Any = static_cast<unsigned long long>(0x0000ffffffffffffULL);
33064 const int NumPseudos = 46;
33065 struct __attribute__((visibility("default"))) Pseudo
33066 {
33067 Pseudo() : negated(false) { }
33068 quint64 type;
33069 QString name;
33070 QString function;
33071 bool negated;
33072 };
33073 struct __attribute__((visibility("default"))) AttributeSelector
33074 {
33075 enum ValueMatchType {
33076 NoMatch,
33077 MatchEqual,
33078 MatchContains,
33079 MatchBeginsWith
33080 };
33081 inline AttributeSelector() : valueMatchCriterium(NoMatch) {}
33082 QString name;
33083 QString value;
33084 ValueMatchType valueMatchCriterium;
33085 };
33086 struct __attribute__((visibility("default"))) BasicSelector
33087 {
33088 inline BasicSelector() : relationToNext(NoRelation) {}
33089 enum Relation {
33090 NoRelation,
33091 MatchNextSelectorIfAncestor,
33092 MatchNextSelectorIfParent,
33093 MatchNextSelectorIfPreceeds
33094 };
33095 QString elementName;
33096 QStringList ids;
33097 QVector<Pseudo> pseudos;
33098 QVector<AttributeSelector> attributeSelectors;
33099 Relation relationToNext;
33100 };
33101 struct __attribute__((visibility("default"))) Selector
33102 {
33103 QVector<BasicSelector> basicSelectors;
33104 int specificity() const;
33105 quint64 pseudoClass(quint64 *negated = 0) const;
33106 QString pseudoElement() const;
33107 };
33108 struct StyleRule;
33109 struct MediaRule;
33110 struct PageRule;
33111 struct ImportRule;
33112 struct __attribute__((visibility("default"))) ValueExtractor
33113 {
33114 ValueExtractor(const QVector<Declaration> &declarations, const QPalette & = QPalette());
33115 bool extractFont(QFont *font, int *fontSizeAdjustment);
33116 bool extractBackground(QBrush *, QString *, Repeat *, Qt::Alignment *, QCss::Origin *, QCss::Attachment *,
33117 QCss::Origin *);
33118 bool extractGeometry(int *w, int *h, int *minw, int *minh, int *maxw, int *maxh);
33119 bool extractPosition(int *l, int *t, int *r, int *b, QCss::Origin *, Qt::Alignment *,
33120 QCss::PositionMode *, Qt::Alignment *);
33121 bool extractBox(int *margins, int *paddings, int *spacing = 0);
33122 bool extractBorder(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii);
33123 bool extractOutline(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii, int *offsets);
33124 bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg);
33125 int extractStyleFeatures();
33126 bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size);
33127 int lengthValue(const Declaration &decl);
33128 private:
33129 void extractFont();
33130 void borderValue(const Declaration &decl, int *width, QCss::BorderStyle *style, QBrush *color);
33131 LengthData lengthValue(const Value& v);
33132 void lengthValues(const Declaration &decl, int *m);
33133 QSize sizeValue(const Declaration &decl);
33134 void sizeValues(const Declaration &decl, QSize *radii);
33135 QVector<Declaration> declarations;
33136 QFont f;
33137 int adjustment;
33138 int fontExtracted;
33139 QPalette pal;
33140 };
33141 struct __attribute__((visibility("default"))) StyleRule
33142 {
33143 StyleRule() : order(0) { }
33144 QVector<Selector> selectors;
33145 QVector<Declaration> declarations;
33146 int order;
33147 };
33148 struct __attribute__((visibility("default"))) MediaRule
33149 {
33150 QStringList media;
33151 QVector<StyleRule> styleRules;
33152 };
33153 struct __attribute__((visibility("default"))) PageRule
33154 {
33155 QString selector;
33156 QVector<Declaration> declarations;
33157 };
33158 struct __attribute__((visibility("default"))) ImportRule
33159 {
33160 QString href;
33161 QStringList media;
33162 };
33163 enum StyleSheetOrigin {
33164 StyleSheetOrigin_Unspecified,
33165 StyleSheetOrigin_UserAgent,
33166 StyleSheetOrigin_User,
33167 StyleSheetOrigin_Author,
33168 StyleSheetOrigin_Inline
33169 };
33170 struct __attribute__((visibility("default"))) StyleSheet
33171 {
33172 StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { }
33173 QVector<StyleRule> styleRules;
33174 QVector<MediaRule> mediaRules;
33175 QVector<PageRule> pageRules;
33176 QVector<ImportRule> importRules;
33177 StyleSheetOrigin origin;
33178 int depth;
33179 QMultiHash<QString, StyleRule> nameIndex;
33180 QMultiHash<QString, StyleRule> idIndex;
33181 void buildIndexes(Qt::CaseSensitivity nameCaseSensitivity = Qt::CaseSensitive);
33182 };
33183 class __attribute__((visibility("default"))) StyleSelector
33184 {
33185 public:
33186 StyleSelector() : nameCaseSensitivity(Qt::CaseSensitive) {}
33187 virtual ~StyleSelector();
33188 union NodePtr {
33189 void *ptr;
33190 int id;
33191 };
33192 QVector<StyleRule> styleRulesForNode(NodePtr node);
33193 QVector<Declaration> declarationsForNode(NodePtr node, const char *extraPseudo = 0);
33194 virtual bool nodeNameEquals(NodePtr node, const QString& nodeName) const;
33195 virtual QString attribute(NodePtr node, const QString &name) const = 0;
33196 virtual bool hasAttributes(NodePtr node) const = 0;
33197 virtual QStringList nodeIds(NodePtr node) const;
33198 virtual QStringList nodeNames(NodePtr node) const = 0;
33199 virtual bool isNullNode(NodePtr node) const = 0;
33200 virtual NodePtr parentNode(NodePtr node) const = 0;
33201 virtual NodePtr previousSiblingNode(NodePtr node) const = 0;
33202 virtual NodePtr duplicateNode(NodePtr node) const = 0;
33203 virtual void freeNode(NodePtr node) const = 0;
33204 QVector<StyleSheet> styleSheets;
33205 QString medium;
33206 Qt::CaseSensitivity nameCaseSensitivity;
33207 private:
33208 void matchRule(NodePtr node, const StyleRule &rules, StyleSheetOrigin origin,
33209 int depth, QMap<uint, StyleRule> *weightedRules);
33210 bool selectorMatches(const Selector &rule, NodePtr node);
33211 bool basicSelectorMatches(const BasicSelector &rule, NodePtr node);
33212 };
33213 enum TokenType {
33214 NONE,
33215 S,
33216 CDO,
33217 CDC,
33218 INCLUDES,
33219 DASHMATCH,
33220 LBRACE,
33221 PLUS,
33222 GREATER,
33223 COMMA,
33224 STRING,
33225 INVALID,
33226 IDENT,
33227 HASH,
33228 ATKEYWORD_SYM,
33229 EXCLAMATION_SYM,
33230 LENGTH,
33231 PERCENTAGE,
33232 NUMBER,
33233 FUNCTION,
33234 COLON,
33235 SEMICOLON,
33236 RBRACE,
33237 SLASH,
33238 MINUS,
33239 DOT,
33240 STAR,
33241 LBRACKET,
33242 RBRACKET,
33243 EQUAL,
33244 LPAREN,
33245 RPAREN,
33246 OR
33247 };
33248 struct __attribute__((visibility("default"))) Symbol
33249 {
33250 inline Symbol() : start(0), len(-1) {}
33251 TokenType token;
33252 QString text;
33253 int start, len;
33254 QString lexem() const;
33255 };
33256 class Scanner
33257 {
33258 public:
33259 static QString preprocess(const QString &input, bool *hasEscapeSequences = 0);
33260 static void scan(const QString &preprocessedInput, QVector<Symbol> *symbols);
33261 static const char *tokenName(TokenType t);
33262 };
33263 class __attribute__((visibility("default"))) Parser
33264 {
33265 public:
33266 Parser();
33267 Parser(const QString &css, bool file = false);
33268 void init(const QString &css, bool file = false);
33269 bool parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity = Qt::CaseSensitive);
33270 Symbol errorSymbol();
33271 bool parseImport(ImportRule *importRule);
33272 bool parseMedia(MediaRule *mediaRule);
33273 bool parseMedium(QStringList *media);
33274 bool parsePage(PageRule *pageRule);
33275 bool parsePseudoPage(QString *selector);
33276 bool parseNextOperator(Value *value);
33277 bool parseCombinator(BasicSelector::Relation *relation);
33278 bool parseProperty(Declaration *decl);
33279 bool parseRuleset(StyleRule *styleRule);
33280 bool parseSelector(Selector *sel);
33281 bool parseSimpleSelector(BasicSelector *basicSel);
33282 bool parseClass(QString *name);
33283 bool parseElementName(QString *name);
33284 bool parseAttrib(AttributeSelector *attr);
33285 bool parsePseudo(Pseudo *pseudo);
33286 bool parseNextDeclaration(Declaration *declaration);
33287 bool parsePrio(Declaration *declaration);
33288 bool parseExpr(QVector<Value> *values);
33289 bool parseTerm(Value *value);
33290 bool parseFunction(QString *name, QString *args);
33291 bool parseHexColor(QColor *col);
33292 bool testAndParseUri(QString *uri);
33293 inline bool testRuleset() { return testSelector(); }
33294 inline bool testSelector() { return testSimpleSelector(); }
33295 inline bool parseNextSelector(Selector *sel) { if (!testSelector()) return recordError(); return parseSelector(sel); }
33296 bool testSimpleSelector();
33297 inline bool parseNextSimpleSelector(BasicSelector *basicSel) { if (!testSimpleSelector()) return recordError(); return parseSimpleSelector(basicSel); }
33298 inline bool testElementName() { return test(IDENT) || test(STAR); }
33299 inline bool testClass() { return test(DOT); }
33300 inline bool testAttrib() { return test(LBRACKET); }
33301 inline bool testPseudo() { return test(COLON); }
33302 inline bool testMedium() { return test(IDENT); }
33303 inline bool parseNextMedium(QStringList *media) { if (!testMedium()) return recordError(); return parseMedium(media); }
33304 inline bool testPseudoPage() { return test(COLON); }
33305 inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); }
33306 inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); }
33307 inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); }
33308 inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(S); }
33309 inline bool testProperty() { return test(IDENT); }
33310 bool testTerm();
33311 inline bool testExpr() { return testTerm(); }
33312 inline bool parseNextExpr(QVector<Value> *values) { if (!testExpr()) return recordError(); return parseExpr(values); }
33313 bool testPrio();
33314 inline bool testHexColor() { return test(HASH); }
33315 inline bool testFunction() { return test(FUNCTION); }
33316 inline bool parseNextFunction(QString *name, QString *args) { if (!testFunction()) return recordError(); return parseFunction(name, args); }
33317 inline bool lookupElementName() const { return lookup() == IDENT || lookup() == STAR; }
33318 inline void skipSpace() { while (test(S)) {}; }
33319 inline bool hasNext() const { return index < symbols.count(); }
33320 inline TokenType next() { return symbols.at(index++).token; }
33321 bool next(TokenType t);
33322 bool test(TokenType t);
33323 inline void prev() { index--; }
33324 inline const Symbol &symbol() const { return symbols.at(index - 1); }
33325 inline QString lexem() const { return symbol().lexem(); }
33326 QString unquotedLexem() const;
33327 QString lexemUntil(TokenType t);
33328 bool until(TokenType target, TokenType target2 = NONE);
33329 inline TokenType lookup() const {
33330 return (index - 1) < symbols.count() ? symbols.at(index - 1).token : NONE;
33331 }
33332 bool testTokenAndEndsWith(TokenType t, const QLatin1String &str);
33333 inline bool recordError() { errorIndex = index; return false; }
33334 QVector<Symbol> symbols;
33335 int index;
33336 int errorIndex;
33337 bool hasEscapeSequences;
33338 QString sourcePath;
33339 };
33340 }
33341 template <> struct QMetaTypeId< QCss::BackgroundData > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { (0) }; if (!metatype_id) metatype_id = qRegisterMetaType< QCss::BackgroundData >("QCss::BackgroundData"); return metatype_id; } };
33342 template <> struct QMetaTypeId< QCss::LengthData > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { (0) }; if (!metatype_id) metatype_id = qRegisterMetaType< QCss::LengthData >("QCss::LengthData"); return metatype_id; } };
33343 template <> struct QMetaTypeId< QCss::BorderData > { enum { Defined = 1 }; static int qt_metatype_id() { static QBasicAtomicInt metatype_id = { (0) }; if (!metatype_id) metatype_id = qRegisterMetaType< QCss::BorderData >("QCss::BorderData"); return metatype_id; } };
33344 class QTextFormatCollection;
33345 class QTextFormat;
33346 class QTextBlockFormat;
33347 class QTextCursorPrivate;
33348 class QAbstractTextDocumentLayout;
33349 class QTextDocument;
33350 class QTextFrame;
33351 class QTextFragmentData : public QFragment<>
33352 {
33353 public:
33354 inline void initialize() {}
33355 inline void invalidate() const {}
33356 inline void free() {}
33357 int stringPosition;
33358 int format;
33359 };
33360 class QTextBlockData : public QFragment<3>
33361 {
33362 public:
33363 inline void initialize()
33364 { layout = 0; userData = 0; userState = -1; revision = 0; hidden = 0; }
33365 void invalidate() const;
33366 inline void free()
33367 { delete layout; layout = 0; delete userData; userData = 0; }
33368 mutable int format;
33369 mutable QTextLayout *layout;
33370 mutable QTextBlockUserData *userData;
33371 mutable int userState;
33372 mutable int revision : 31;
33373 mutable uint hidden : 1;
33374 };
33375 class QAbstractUndoItem;
33376 class QTextUndoCommand
33377 {
33378 public:
33379 enum Command {
33380 Inserted = 0,
33381 Removed = 1,
33382 CharFormatChanged = 2,
33383 BlockFormatChanged = 3,
33384 BlockInserted = 4,
33385 BlockRemoved = 5,
33386 BlockAdded = 6,
33387 BlockDeleted = 7,
33388 GroupFormatChange = 8,
33389 Custom = 256
33390 };
33391 enum Operation {
33392 KeepCursor = 0,
33393 MoveCursor = 1
33394 };
33395 quint16 command;
33396 quint8 block;
33397 quint8 operation;
33398 int format;
33399 quint32 strPos;
33400 quint32 pos;
33401 union {
33402 int blockFormat;
33403 quint32 length;
33404 QAbstractUndoItem *custom;
33405 int objectIndex;
33406 };
33407 quint32 revision;
33408 bool tryMerge(const QTextUndoCommand &other);
33409 };
33410 template <> class QTypeInfo<QTextUndoCommand> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QTextUndoCommand)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QTextUndoCommand"; } };
33411 class QTextDocumentPrivate : public QObjectPrivate
33412 {
33413 inline QTextDocument* q_func() { return static_cast<QTextDocument *>(q_ptr); } inline const QTextDocument* q_func() const { return static_cast<const QTextDocument *>(q_ptr); } friend class QTextDocument;
33414 public:
33415 typedef QFragmentMap<QTextFragmentData> FragmentMap;
33416 typedef FragmentMap::ConstIterator FragmentIterator;
33417 typedef QFragmentMap<QTextBlockData> BlockMap;
33418 QTextDocumentPrivate();
33419 ~QTextDocumentPrivate();
33420 void init();
33421 void clear();
33422 void setLayout(QAbstractTextDocumentLayout *layout);
33423 void insert(int pos, const QString &text, int format);
33424 void insert(int pos, int strPos, int strLength, int format);
33425 int insertBlock(int pos, int blockFormat, int charFormat, QTextUndoCommand::Operation = QTextUndoCommand::MoveCursor);
33426 int insertBlock(const QChar &blockSeparator, int pos, int blockFormat, int charFormat,
33427 QTextUndoCommand::Operation op = QTextUndoCommand::MoveCursor);
33428 void move(int from, int to, int length, QTextUndoCommand::Operation = QTextUndoCommand::MoveCursor);
33429 void remove(int pos, int length, QTextUndoCommand::Operation = QTextUndoCommand::MoveCursor);
33430 void aboutToRemoveCell(int cursorFrom, int cursorEnd);
33431 QTextFrame *insertFrame(int start, int end, const QTextFrameFormat &format);
33432 void removeFrame(QTextFrame *frame);
33433 enum FormatChangeMode { MergeFormat, SetFormat, SetFormatAndPreserveObjectIndices };
33434 void setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode = SetFormat);
33435 void setBlockFormat(const QTextBlock &from, const QTextBlock &to,
33436 const QTextBlockFormat &newFormat, FormatChangeMode mode = SetFormat);
33437 void emitUndoAvailable(bool available);
33438 void emitRedoAvailable(bool available);
33439 int undoRedo(bool undo);
33440 inline void undo() { undoRedo(true); }
33441 inline void redo() { undoRedo(false); }
33442 void appendUndoItem(QAbstractUndoItem *);
33443 inline void beginEditBlock() { editBlock++; }
33444 void joinPreviousEditBlock();
33445 void endEditBlock();
33446 inline bool isInEditBlock() const { return editBlock; }
33447 void enableUndoRedo(bool enable);
33448 inline bool isUndoRedoEnabled() const { return undoEnabled; }
33449 inline bool isUndoAvailable() const { return undoEnabled && undoState > 0; }
33450 inline bool isRedoAvailable() const { return undoEnabled && undoState < undoStack.size(); }
33451 inline QString buffer() const { return text; }
33452 QString plainText() const;
33453 inline int length() const { return fragments.length(); }
33454 inline QTextFormatCollection *formatCollection() { return &formats; }
33455 inline const QTextFormatCollection *formatCollection() const { return &formats; }
33456 inline QAbstractTextDocumentLayout *layout() const { return lout; }
33457 inline FragmentIterator find(int pos) const { return fragments.find(pos); }
33458 inline FragmentIterator begin() const { return fragments.begin(); }
33459 inline FragmentIterator end() const { return fragments.end(); }
33460 inline QTextBlock blocksBegin() const { return QTextBlock(const_cast<QTextDocumentPrivate *>(this), blocks.firstNode()); }
33461 inline QTextBlock blocksEnd() const { return QTextBlock(const_cast<QTextDocumentPrivate *>(this), 0); }
33462 inline QTextBlock blocksFind(int pos) const { return QTextBlock(const_cast<QTextDocumentPrivate *>(this), blocks.findNode(pos)); }
33463 int blockCharFormatIndex(int node) const;
33464 inline int numBlocks() const { return blocks.numNodes(); }
33465 const BlockMap &blockMap() const { return blocks; }
33466 const FragmentMap &fragmentMap() const { return fragments; }
33467 BlockMap &blockMap() { return blocks; }
33468 FragmentMap &fragmentMap() { return fragments; }
33469 static const QTextBlockData *block(const QTextBlock &it) { return it.p->blocks.fragment(it.n); }
33470 int nextCursorPosition(int position, QTextLayout::CursorMode mode) const;
33471 int previousCursorPosition(int position, QTextLayout::CursorMode mode) const;
33472 void changeObjectFormat(QTextObject *group, int format);
33473 void setModified(bool m);
33474 inline bool isModified() const { return modified; }
33475 inline QFont defaultFont() const { return formats.defaultFont(); }
33476 inline void setDefaultFont(const QFont &f) { formats.setDefaultFont(f); }
33477 private:
33478 bool split(int pos);
33479 bool unite(uint f);
33480 void truncateUndoStack();
33481 void insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op);
33482 int insert_block(int pos, uint strPos, int format, int blockformat, QTextUndoCommand::Operation op, int command);
33483 int remove_string(int pos, uint length, QTextUndoCommand::Operation op);
33484 int remove_block(int pos, int *blockformat, int command, QTextUndoCommand::Operation op);
33485 void insert_frame(QTextFrame *f);
33486 void scan_frames(int pos, int charsRemoved, int charsAdded);
33487 static void clearFrame(QTextFrame *f);
33488 void adjustDocumentChangesAndCursors(int from, int addedOrRemoved, QTextUndoCommand::Operation op);
33489 bool wasUndoAvailable;
33490 bool wasRedoAvailable;
33491 public:
33492 void documentChange(int from, int length);
33493 inline void addCursor(QTextCursorPrivate *c) { cursors.append(c); }
33494 inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); changedCursors.removeAll(c); }
33495 QTextFrame *frameAt(int pos) const;
33496 QTextFrame *rootFrame() const;
33497 QTextObject *objectForIndex(int objectIndex) const;
33498 QTextObject *objectForFormat(int formatIndex) const;
33499 QTextObject *objectForFormat(const QTextFormat &f) const;
33500 QTextObject *createObject(const QTextFormat &newFormat, int objectIndex = -1);
33501 void deleteObject(QTextObject *object);
33502 QTextDocument *document() { return q_func(); }
33503 const QTextDocument *document() const { return q_func(); }
33504 bool ensureMaximumBlockCount();
33505 private:
33506 QTextDocumentPrivate(const QTextDocumentPrivate& m);
33507 QTextDocumentPrivate& operator= (const QTextDocumentPrivate& m);
33508 void appendUndoItem(const QTextUndoCommand &c);
33509 void contentsChanged();
33510 void compressPieceTable();
33511 QString text;
33512 uint unreachableCharacterCount;
33513 QVector<QTextUndoCommand> undoStack;
33514 bool undoEnabled;
33515 int undoState;
33516 int modifiedState;
33517 bool modified;
33518 int editBlock;
33519 int docChangeFrom;
33520 int docChangeOldLength;
33521 int docChangeLength;
33522 bool framesDirty;
33523 QTextFormatCollection formats;
33524 mutable QTextFrame *rtFrame;
33525 QAbstractTextDocumentLayout *lout;
33526 FragmentMap fragments;
33527 BlockMap blocks;
33528 int initialBlockCharFormatIndex;
33529 QList<QTextCursorPrivate*> cursors;
33530 QList<QTextCursorPrivate*> changedCursors;
33531 QMap<int, QTextObject *> objects;
33532 QMap<QUrl, QVariant> resources;
33533 QMap<QUrl, QVariant> cachedResources;
33534 QString defaultStyleSheet;
33535 int lastBlockCount;
33536 public:
33537 QTextOption defaultTextOption;
33538 QCss::StyleSheet parsedDefaultStyleSheet;
33539 int maximumBlockCount;
33540 bool needsEnsureMaximumBlockCount;
33541 bool inContentsChange;
33542 QSizeF pageSize;
33543 QString title;
33544 QString url;
33545 qreal indentWidth;
33546 qreal documentMargin;
33547 void mergeCachedResources(const QTextDocumentPrivate *priv);
33548 friend class QTextHtmlExporter;
33549 friend class QTextCursor;
33550 };
33551 class QTextTable;
33552 class QTextHtmlExporter
33553 {
33554 public:
33555 QTextHtmlExporter(const QTextDocument *_doc);
33556 enum ExportMode {
33557 ExportEntireDocument,
33558 ExportFragment
33559 };
33560 QString toHtml(const QByteArray &encoding, ExportMode mode = ExportEntireDocument);
33561 private:
33562 enum StyleMode { EmitStyleTag, OmitStyleTag };
33563 enum FrameType { TextFrame, TableFrame, RootFrame };
33564 void emitFrame(QTextFrame::Iterator frameIt);
33565 void emitTextFrame(const QTextFrame *frame);
33566 void emitBlock(const QTextBlock &block);
33567 void emitTable(const QTextTable *table);
33568 void emitFragment(const QTextFragment &fragment);
33569 void emitBlockAttributes(const QTextBlock &block);
33570 bool emitCharFormatStyle(const QTextCharFormat &format);
33571 void emitTextLength(const char *attribute, const QTextLength &length);
33572 void emitAlignment(Qt::Alignment alignment);
33573 void emitFloatStyle(QTextFrameFormat::Position pos, StyleMode mode = EmitStyleTag);
33574 void emitMargins(const QString &top, const QString &bottom, const QString &left, const QString &right);
33575 void emitAttribute(const char *attribute, const QString &value);
33576 void emitFrameStyle(const QTextFrameFormat &format, FrameType frameType);
33577 void emitBorderStyle(QTextFrameFormat::BorderStyle style);
33578 void emitPageBreakPolicy(QTextFormat::PageBreakFlags policy);
33579 void emitFontFamily(const QString &family);
33580 void emitBackgroundAttribute(const QTextFormat &format);
33581 QString findUrlForImage(const QTextDocument *doc, qint64 cacheKey, bool isPixmap);
33582 QString html;
33583 QTextCharFormat defaultCharFormat;
33584 const QTextDocument *doc;
33585 bool fragmentMarkers;
33586 };
33587 extern "C" {
33588 typedef char hb_int8;
33589 typedef unsigned char hb_uint8;
33590 typedef short hb_int16;
33591 typedef unsigned short hb_uint16;
33592 typedef int hb_int32;
33593 typedef unsigned int hb_uint32;
33594 typedef hb_uint8 HB_Bool;
33595 typedef hb_uint8 HB_Byte;
33596 typedef hb_uint16 HB_UShort;
33597 typedef hb_uint32 HB_UInt;
33598 typedef hb_int8 HB_Char;
33599 typedef hb_int16 HB_Short;
33600 typedef hb_int32 HB_Int;
33601 typedef hb_uint16 HB_UChar16;
33602 typedef hb_uint32 HB_UChar32;
33603 typedef hb_uint32 HB_Glyph;
33604 typedef hb_int32 HB_Fixed;
33605 typedef hb_int32 HB_16Dot16;
33606 typedef void * HB_Pointer;
33607 typedef hb_uint32 HB_Tag;
33608 typedef enum {
33609 HB_Err_Ok = 0x0000,
33610 HB_Err_Not_Covered = 0xFFFF,
33611 HB_Err_Invalid_Argument = 0x1A66,
33612 HB_Err_Invalid_SubTable_Format = 0x157F,
33613 HB_Err_Invalid_SubTable = 0x1570,
33614 HB_Err_Read_Error = 0x6EAD,
33615 HB_Err_Out_Of_Memory = 0xDEAD
33616 } HB_Error;
33617 typedef struct {
33618 HB_Fixed x;
33619 HB_Fixed y;
33620 } HB_FixedPoint;
33621 typedef struct HB_Font_ *HB_Font;
33622 typedef struct HB_StreamRec_ *HB_Stream;
33623 typedef struct HB_FaceRec_ *HB_Face;
33624 }
33625 extern "C" {
33626 struct HB_LangSys_
33627 {
33628 HB_UShort LookupOrderOffset;
33629 HB_UShort ReqFeatureIndex;
33630 HB_UShort FeatureCount;
33631 HB_UShort* FeatureIndex;
33632 };
33633 typedef struct HB_LangSys_ HB_LangSys;
33634 struct HB_LangSysRecord_
33635 {
33636 HB_UInt LangSysTag;
33637 HB_LangSys LangSys;
33638 };
33639 typedef struct HB_LangSysRecord_ HB_LangSysRecord;
33640 struct HB_ScriptTable_
33641 {
33642 HB_LangSys DefaultLangSys;
33643 HB_UShort LangSysCount;
33644 HB_LangSysRecord* LangSysRecord;
33645 };
33646 typedef struct HB_ScriptTable_ HB_ScriptTable;
33647 struct HB_ScriptRecord_
33648 {
33649 HB_UInt ScriptTag;
33650 HB_ScriptTable Script;
33651 };
33652 typedef struct HB_ScriptRecord_ HB_ScriptRecord;
33653 struct HB_ScriptList_
33654 {
33655 HB_UShort ScriptCount;
33656 HB_ScriptRecord* ScriptRecord;
33657 };
33658 typedef struct HB_ScriptList_ HB_ScriptList;
33659 struct HB_Feature_
33660 {
33661 HB_UShort FeatureParams;
33662 HB_UShort LookupListCount;
33663 HB_UShort* LookupListIndex;
33664 };
33665 typedef struct HB_Feature_ HB_Feature;
33666 struct HB_FeatureRecord_
33667 {
33668 HB_UInt FeatureTag;
33669 HB_Feature Feature;
33670 };
33671 typedef struct HB_FeatureRecord_ HB_FeatureRecord;
33672 struct HB_FeatureList_
33673 {
33674 HB_UShort FeatureCount;
33675 HB_FeatureRecord* FeatureRecord;
33676 HB_UShort* ApplyOrder;
33677 HB_UShort ApplyCount;
33678 };
33679 typedef struct HB_FeatureList_ HB_FeatureList;
33680 typedef struct HB_SubTable_ HB_SubTable;
33681 struct HB_Lookup_
33682 {
33683 HB_UShort LookupType;
33684 HB_UShort LookupFlag;
33685 HB_UShort SubTableCount;
33686 HB_SubTable* SubTable;
33687 };
33688 typedef struct HB_Lookup_ HB_Lookup;
33689 struct HB_LookupList_
33690 {
33691 HB_UShort LookupCount;
33692 HB_Lookup* Lookup;
33693 HB_UInt* Properties;
33694 };
33695 typedef struct HB_LookupList_ HB_LookupList;
33696 struct HB_CoverageFormat1_
33697 {
33698 HB_UShort GlyphCount;
33699 HB_UShort* GlyphArray;
33700 };
33701 typedef struct HB_CoverageFormat1_ HB_CoverageFormat1;
33702 struct HB_RangeRecord_
33703 {
33704 HB_UShort Start;
33705 HB_UShort End;
33706 HB_UShort StartCoverageIndex;
33707 };
33708 typedef struct HB_RangeRecord_ HB_RangeRecord;
33709 struct HB_CoverageFormat2_
33710 {
33711 HB_UShort RangeCount;
33712 HB_RangeRecord* RangeRecord;
33713 };
33714 typedef struct HB_CoverageFormat2_ HB_CoverageFormat2;
33715 struct HB_Coverage_
33716 {
33717 HB_UShort CoverageFormat;
33718 union
33719 {
33720 HB_CoverageFormat1 cf1;
33721 HB_CoverageFormat2 cf2;
33722 } cf;
33723 };
33724 typedef struct HB_Coverage_ HB_Coverage;
33725 struct HB_ClassDefFormat1_
33726 {
33727 HB_UShort StartGlyph;
33728 HB_UShort GlyphCount;
33729 HB_UShort* ClassValueArray;
33730 };
33731 typedef struct HB_ClassDefFormat1_ HB_ClassDefFormat1;
33732 struct HB_ClassRangeRecord_
33733 {
33734 HB_UShort Start;
33735 HB_UShort End;
33736 HB_UShort Class;
33737 };
33738 typedef struct HB_ClassRangeRecord_ HB_ClassRangeRecord;
33739 struct HB_ClassDefFormat2_
33740 {
33741 HB_UShort ClassRangeCount;
33742 HB_ClassRangeRecord* ClassRangeRecord;
33743 };
33744 typedef struct HB_ClassDefFormat2_ HB_ClassDefFormat2;
33745 struct HB_ClassDefinition_
33746 {
33747 HB_Bool loaded;
33748 HB_UShort ClassFormat;
33749 union
33750 {
33751 HB_ClassDefFormat1 cd1;
33752 HB_ClassDefFormat2 cd2;
33753 } cd;
33754 };
33755 typedef struct HB_ClassDefinition_ HB_ClassDefinition;
33756 struct HB_Device_
33757 {
33758 HB_UShort StartSize;
33759 HB_UShort EndSize;
33760 HB_UShort DeltaFormat;
33761 HB_UShort* DeltaValue;
33762 };
33763 typedef struct HB_Device_ HB_Device;
33764 enum HB_Type_
33765 {
33766 HB_Type_GSUB,
33767 HB_Type_GPOS
33768 };
33769 typedef enum HB_Type_ HB_Type;
33770 }
33771 extern "C" {
33772 typedef struct HB_StreamRec_
33773 {
33774 HB_Byte* base;
33775 HB_UInt size;
33776 HB_UInt pos;
33777 HB_Byte* cursor;
33778 } HB_StreamRec;
33779 }
33780 extern "C" {
33781 typedef struct HB_AttachPoint_ HB_AttachPoint;
33782 struct HB_AttachList_
33783 {
33784 HB_Bool loaded;
33785 HB_Coverage Coverage;
33786 HB_UShort GlyphCount;
33787 HB_AttachPoint* AttachPoint;
33788 };
33789 typedef struct HB_AttachList_ HB_AttachList;
33790 typedef struct HB_LigGlyph_ HB_LigGlyph;
33791 struct HB_LigCaretList_
33792 {
33793 HB_Bool loaded;
33794 HB_Coverage Coverage;
33795 HB_UShort LigGlyphCount;
33796 HB_LigGlyph* LigGlyph;
33797 };
33798 typedef struct HB_LigCaretList_ HB_LigCaretList;
33799 struct HB_GDEFHeader_
33800 {
33801 HB_UInt offset;
33802 HB_16Dot16 Version;
33803 HB_ClassDefinition GlyphClassDef;
33804 HB_AttachList AttachList;
33805 HB_LigCaretList LigCaretList;
33806 HB_UInt MarkAttachClassDef_offset;
33807 HB_ClassDefinition MarkAttachClassDef;
33808 HB_UShort LastGlyph;
33809 HB_UShort** NewGlyphClasses;
33810 };
33811 typedef struct HB_GDEFHeader_ HB_GDEFHeader;
33812 typedef struct HB_GDEFHeader_* HB_GDEF;
33813 HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
33814 HB_Error HB_Load_GDEF_Table( HB_Stream stream,
33815 HB_GDEFHeader** gdef );
33816 HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
33817 HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
33818 HB_UShort glyphID,
33819 HB_UShort* property );
33820 HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
33821 HB_UShort num_glyphs,
33822 HB_UShort glyph_count,
33823 HB_UShort* glyph_array,
33824 HB_UShort* class_array );
33825 }
33826 extern "C" {
33827 typedef struct HB_GlyphItemRec_ {
33828 HB_UInt gindex;
33829 HB_UInt properties;
33830 HB_UInt cluster;
33831 HB_UShort component;
33832 HB_UShort ligID;
33833 HB_UShort gproperties;
33834 } HB_GlyphItemRec, *HB_GlyphItem;
33835 typedef struct HB_PositionRec_ {
33836 HB_Fixed x_pos;
33837 HB_Fixed y_pos;
33838 HB_Fixed x_advance;
33839 HB_Fixed y_advance;
33840 HB_UShort back;
33841 HB_Bool new_advance;
33842 HB_Short cursive_chain;
33843 } HB_PositionRec, *HB_Position;
33844 typedef struct HB_BufferRec_{
33845 HB_UInt allocated;
33846 HB_UInt in_length;
33847 HB_UInt out_length;
33848 HB_UInt in_pos;
33849 HB_UInt out_pos;
33850 HB_Bool separate_out;
33851 HB_GlyphItem in_string;
33852 HB_GlyphItem out_string;
33853 HB_GlyphItem alt_string;
33854 HB_Position positions;
33855 HB_UShort max_ligID;
33856 } HB_BufferRec, *HB_Buffer;
33857 HB_Error
33858 hb_buffer_new( HB_Buffer *buffer );
33859 void
33860 hb_buffer_free( HB_Buffer buffer );
33861 void
33862 hb_buffer_clear( HB_Buffer buffer );
33863 HB_Error
33864 hb_buffer_add_glyph( HB_Buffer buffer,
33865 HB_UInt glyph_index,
33866 HB_UInt properties,
33867 HB_UInt cluster );
33868 }
33869 extern "C" {
33870 typedef HB_Error (*HB_MMFunction)(HB_Font font,
33871 HB_UShort metric_id,
33872 HB_Fixed* metric_value,
33873 void* data );
33874 struct HB_GPOSHeader_
33875 {
33876 HB_16Dot16 Version;
33877 HB_ScriptList ScriptList;
33878 HB_FeatureList FeatureList;
33879 HB_LookupList LookupList;
33880 HB_GDEFHeader* gdef;
33881 HB_MMFunction mmfunc;
33882 void* data;
33883 };
33884 typedef struct HB_GPOSHeader_ HB_GPOSHeader;
33885 typedef HB_GPOSHeader* HB_GPOS;
33886 HB_Error HB_Load_GPOS_Table( HB_Stream stream,
33887 HB_GPOSHeader** gpos,
33888 HB_GDEFHeader* gdef,
33889 HB_Stream gdefStream );
33890 HB_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
33891 HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos,
33892 HB_UInt script_tag,
33893 HB_UShort* script_index );
33894 HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos,
33895 HB_UInt language_tag,
33896 HB_UShort script_index,
33897 HB_UShort* language_index,
33898 HB_UShort* req_feature_index );
33899 HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos,
33900 HB_UInt feature_tag,
33901 HB_UShort script_index,
33902 HB_UShort language_index,
33903 HB_UShort* feature_index );
33904 HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos,
33905 HB_UInt** script_tag_list );
33906 HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos,
33907 HB_UShort script_index,
33908 HB_UInt** language_tag_list );
33909 HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos,
33910 HB_UShort script_index,
33911 HB_UShort language_index,
33912 HB_UInt** feature_tag_list );
33913 HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos,
33914 HB_UShort feature_index,
33915 HB_UInt property );
33916 HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos );
33917 HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos,
33918 HB_MMFunction mmfunc,
33919 void* data );
33920 HB_Error HB_GPOS_Apply_String( HB_Font font,
33921 HB_GPOSHeader* gpos,
33922 HB_UShort load_flags,
33923 HB_Buffer buffer,
33924 HB_Bool dvi,
33925 HB_Bool r2l );
33926 }
33927 extern "C" {
33928 typedef HB_UShort (*HB_AltFunction)(HB_UInt pos,
33929 HB_UShort glyphID,
33930 HB_UShort num_alternates,
33931 HB_UShort* alternates,
33932 void* data );
33933 struct HB_GSUBHeader_
33934 {
33935 HB_UInt offset;
33936 HB_16Dot16 Version;
33937 HB_ScriptList ScriptList;
33938 HB_FeatureList FeatureList;
33939 HB_LookupList LookupList;
33940 HB_GDEFHeader* gdef;
33941 HB_AltFunction altfunc;
33942 void* data;
33943 };
33944 typedef struct HB_GSUBHeader_ HB_GSUBHeader;
33945 typedef HB_GSUBHeader* HB_GSUB;
33946 HB_Error HB_Load_GSUB_Table( HB_Stream stream,
33947 HB_GSUBHeader** gsub,
33948 HB_GDEFHeader* gdef,
33949 HB_Stream gdefStream );
33950 HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub );
33951 HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub,
33952 HB_UInt script_tag,
33953 HB_UShort* script_index );
33954 HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub,
33955 HB_UInt language_tag,
33956 HB_UShort script_index,
33957 HB_UShort* language_index,
33958 HB_UShort* req_feature_index );
33959 HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub,
33960 HB_UInt feature_tag,
33961 HB_UShort script_index,
33962 HB_UShort language_index,
33963 HB_UShort* feature_index );
33964 HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
33965 HB_UInt** script_tag_list );
33966 HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
33967 HB_UShort script_index,
33968 HB_UInt** language_tag_list );
33969 HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
33970 HB_UShort script_index,
33971 HB_UShort language_index,
33972 HB_UInt** feature_tag_list );
33973 HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub,
33974 HB_UShort feature_index,
33975 HB_UInt property );
33976 HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub );
33977 HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub,
33978 HB_AltFunction altfunc,
33979 void* data );
33980 HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub,
33981 HB_Buffer buffer );
33982 }
33983 extern "C" {
33984 typedef enum {
33985 HB_LineBreak_OP, HB_LineBreak_CL, HB_LineBreak_QU, HB_LineBreak_GL, HB_LineBreak_NS,
33986 HB_LineBreak_EX, HB_LineBreak_SY, HB_LineBreak_IS, HB_LineBreak_PR, HB_LineBreak_PO,
33987 HB_LineBreak_NU, HB_LineBreak_AL, HB_LineBreak_ID, HB_LineBreak_IN, HB_LineBreak_HY,
33988 HB_LineBreak_BA, HB_LineBreak_BB, HB_LineBreak_B2, HB_LineBreak_ZW, HB_LineBreak_CM,
33989 HB_LineBreak_WJ, HB_LineBreak_H2, HB_LineBreak_H3, HB_LineBreak_JL, HB_LineBreak_JV,
33990 HB_LineBreak_JT, HB_LineBreak_SA, HB_LineBreak_SG,
33991 HB_LineBreak_SP, HB_LineBreak_CR, HB_LineBreak_LF, HB_LineBreak_BK
33992 } HB_LineBreakClass;
33993 typedef enum
33994 {
33995 HB_NoCategory,
33996 HB_Mark_NonSpacing,
33997 HB_Mark_SpacingCombining,
33998 HB_Mark_Enclosing,
33999 HB_Number_DecimalDigit,
34000 HB_Number_Letter,
34001 HB_Number_Other,
34002 HB_Separator_Space,
34003 HB_Separator_Line,
34004 HB_Separator_Paragraph,
34005 HB_Other_Control,
34006 HB_Other_Format,
34007 HB_Other_Surrogate,
34008 HB_Other_PrivateUse,
34009 HB_Other_NotAssigned,
34010 HB_Letter_Uppercase,
34011 HB_Letter_Lowercase,
34012 HB_Letter_Titlecase,
34013 HB_Letter_Modifier,
34014 HB_Letter_Other,
34015 HB_Punctuation_Connector,
34016 HB_Punctuation_Dash,
34017 HB_Punctuation_Open,
34018 HB_Punctuation_Close,
34019 HB_Punctuation_InitialQuote,
34020 HB_Punctuation_FinalQuote,
34021 HB_Punctuation_Other,
34022 HB_Symbol_Math,
34023 HB_Symbol_Currency,
34024 HB_Symbol_Modifier,
34025 HB_Symbol_Other
34026 } HB_CharCategory;
34027 typedef enum
34028 {
34029 HB_Grapheme_Other,
34030 HB_Grapheme_CR,
34031 HB_Grapheme_LF,
34032 HB_Grapheme_Control,
34033 HB_Grapheme_Extend,
34034 HB_Grapheme_L,
34035 HB_Grapheme_V,
34036 HB_Grapheme_T,
34037 HB_Grapheme_LV,
34038 HB_Grapheme_LVT
34039 } HB_GraphemeClass;
34040 typedef enum
34041 {
34042 HB_Word_Other,
34043 HB_Word_Format,
34044 HB_Word_Katakana,
34045 HB_Word_ALetter,
34046 HB_Word_MidLetter,
34047 HB_Word_MidNum,
34048 HB_Word_Numeric,
34049 HB_Word_ExtendNumLet
34050 } HB_WordClass;
34051 typedef enum
34052 {
34053 HB_Sentence_Other,
34054 HB_Sentence_Sep,
34055 HB_Sentence_Format,
34056 HB_Sentence_Sp,
34057 HB_Sentence_Lower,
34058 HB_Sentence_Upper,
34059 HB_Sentence_OLetter,
34060 HB_Sentence_Numeric,
34061 HB_Sentence_ATerm,
34062 HB_Sentence_STerm,
34063 HB_Sentence_Close
34064 } HB_SentenceClass;
34065 HB_GraphemeClass HB_GetGraphemeClass(HB_UChar32 ch);
34066 HB_WordClass HB_GetWordClass(HB_UChar32 ch);
34067 HB_SentenceClass HB_GetSentenceClass(HB_UChar32 ch);
34068 HB_LineBreakClass HB_GetLineBreakClass(HB_UChar32 ch);
34069 void HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *grapheme, HB_LineBreakClass *lineBreak);
34070 void HB_GetUnicodeCharProperties(HB_UChar32 ch, HB_CharCategory *category, int *combiningClass);
34071 HB_CharCategory HB_GetUnicodeCharCategory(HB_UChar32 ch);
34072 int HB_GetUnicodeCharCombiningClass(HB_UChar32 ch);
34073 HB_UChar16 HB_GetMirroredChar(HB_UChar16 ch);
34074 void *HB_Library_Resolve(const char *library, const char *symbol);
34075 void *HB_TextCodecForMib(int mib);
34076 char *HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint32 length, hb_uint32 *outputLength);
34077 void HB_TextCodec_FreeResult(char *);
34078 }
34079 extern "C" {
34080 HB_Pointer
34081 _hb_alloc( size_t size,
34082 HB_Error *perror_ );
34083 HB_Pointer
34084 _hb_realloc( HB_Pointer block,
34085 size_t new_size,
34086 HB_Error *perror_ );
34087 void
34088 _hb_free( HB_Pointer block );
34089 HB_Error
34090 _hb_err (HB_Error code);
34091 }
34092 extern "C" {
34093 void
34094 _hb_close_stream( HB_Stream stream );
34095 HB_Int
34096 _hb_stream_pos( HB_Stream stream );
34097 HB_Error
34098 _hb_stream_seek( HB_Stream stream,
34099 HB_UInt pos );
34100 HB_Error
34101 _hb_stream_frame_enter( HB_Stream stream,
34102 HB_UInt size );
34103 void
34104 _hb_stream_frame_exit( HB_Stream stream );
34105 }
34106 extern "C" {
34107 typedef enum {
34108 HB_Script_Common,
34109 HB_Script_Greek,
34110 HB_Script_Cyrillic,
34111 HB_Script_Armenian,
34112 HB_Script_Hebrew,
34113 HB_Script_Arabic,
34114 HB_Script_Syriac,
34115 HB_Script_Thaana,
34116 HB_Script_Devanagari,
34117 HB_Script_Bengali,
34118 HB_Script_Gurmukhi,
34119 HB_Script_Gujarati,
34120 HB_Script_Oriya,
34121 HB_Script_Tamil,
34122 HB_Script_Telugu,
34123 HB_Script_Kannada,
34124 HB_Script_Malayalam,
34125 HB_Script_Sinhala,
34126 HB_Script_Thai,
34127 HB_Script_Lao,
34128 HB_Script_Tibetan,
34129 HB_Script_Myanmar,
34130 HB_Script_Georgian,
34131 HB_Script_Hangul,
34132 HB_Script_Ogham,
34133 HB_Script_Runic,
34134 HB_Script_Khmer,
34135 HB_Script_Inherited,
34136 HB_ScriptCount = HB_Script_Inherited
34137 } HB_Script;
34138 typedef struct
34139 {
34140 hb_uint32 pos;
34141 hb_uint32 length;
34142 HB_Script script;
34143 hb_uint8 bidiLevel;
34144 } HB_ScriptItem;
34145 typedef enum {
34146 HB_NoBreak,
34147 HB_SoftHyphen,
34148 HB_Break,
34149 HB_ForcedBreak
34150 } HB_LineBreakType;
34151 typedef struct {
34152 unsigned lineBreakType :2;
34153 unsigned whiteSpace :1;
34154 unsigned charStop :1;
34155 unsigned wordBoundary :1;
34156 unsigned sentenceBoundary :1;
34157 unsigned unused :2;
34158 } HB_CharAttributes;
34159 void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
34160 const HB_ScriptItem *items, hb_uint32 numItems,
34161 HB_CharAttributes *attributes);
34162 void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
34163 const HB_ScriptItem *items, hb_uint32 numItems,
34164 HB_CharAttributes *attributes);
34165 void HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
34166 const HB_ScriptItem *items, hb_uint32 numItems,
34167 HB_CharAttributes *attributes);
34168 typedef enum {
34169 HB_LeftToRight = 0,
34170 HB_RightToLeft = 1
34171 } HB_StringToGlyphsFlags;
34172 typedef enum {
34173 HB_ShaperFlag_Default = 0,
34174 HB_ShaperFlag_NoKerning = 1,
34175 HB_ShaperFlag_UseDesignMetrics = 2
34176 } HB_ShaperFlag;
34177 typedef enum {
34178 HB_NoJustification= 0,
34179 HB_Arabic_Space = 1,
34180 HB_Character = 2,
34181 HB_Space = 4,
34182 HB_Arabic_Normal = 7,
34183 HB_Arabic_Waw = 8,
34184 HB_Arabic_BaRa = 9,
34185 HB_Arabic_Alef = 10,
34186 HB_Arabic_HaaDal = 11,
34187 HB_Arabic_Seen = 12,
34188 HB_Arabic_Kashida = 13
34189 } HB_JustificationClass;
34190 typedef struct {
34191 unsigned justification :4;
34192 unsigned clusterStart :1;
34193 unsigned mark :1;
34194 unsigned zeroWidth :1;
34195 unsigned dontPrint :1;
34196 unsigned combiningClass :8;
34197 } HB_GlyphAttributes;
34198 typedef struct HB_FaceRec_ {
34199 HB_Bool isSymbolFont;
34200 HB_GDEF gdef;
34201 HB_GSUB gsub;
34202 HB_GPOS gpos;
34203 HB_Bool supported_scripts[HB_ScriptCount];
34204 HB_Buffer buffer;
34205 HB_Script current_script;
34206 int current_flags;
34207 HB_Bool has_opentype_kerning;
34208 HB_Bool glyphs_substituted;
34209 HB_GlyphAttributes *tmpAttributes;
34210 unsigned int *tmpLogClusters;
34211 int length;
34212 int orig_nglyphs;
34213 } HB_FaceRec;
34214 typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
34215 HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
34216 void HB_FreeFace(HB_Face face);
34217 typedef struct {
34218 HB_Fixed x, y;
34219 HB_Fixed width, height;
34220 HB_Fixed xOffset, yOffset;
34221 } HB_GlyphMetrics;
34222 typedef enum {
34223 HB_FontAscent
34224 } HB_FontMetric;
34225 typedef struct {
34226 HB_Bool (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft);
34227 void (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags );
34228 HB_Bool (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 length);
34229 HB_Error (*getPointInOutline)(HB_Font font, HB_Glyph glyph, int flags , hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
34230 void (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics);
34231 HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric);
34232 } HB_FontClass;
34233 typedef struct HB_Font_ {
34234 const HB_FontClass *klass;
34235 HB_UShort x_ppem, y_ppem;
34236 HB_16Dot16 x_scale, y_scale;
34237 void *userData;
34238 } HB_FontRec;
34239 typedef struct {
34240 const HB_UChar16 *string;
34241 hb_uint32 stringLength;
34242 HB_ScriptItem item;
34243 HB_Font font;
34244 HB_Face face;
34245 int shaperFlags;
34246 HB_Bool glyphIndicesPresent;
34247 hb_uint32 initialGlyphCount;
34248 hb_uint32 num_glyphs;
34249 HB_Glyph *glyphs;
34250 HB_GlyphAttributes *attributes;
34251 HB_Fixed *advances;
34252 HB_FixedPoint *offsets;
34253 unsigned short *log_clusters;
34254 HB_Bool kerning_applied;
34255 } HB_ShaperItem;
34256 HB_Bool HB_ShapeItem(HB_ShaperItem *item);
34257 }
34258 __attribute__((visibility("default"))) void qGetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
34259 const HB_ScriptItem *items, hb_uint32 numItems,
34260 HB_CharAttributes *attributes);
34261 __attribute__((visibility("default"))) HB_Bool qShapeItem(HB_ShaperItem *item);
34262 __attribute__((visibility("default"))) HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc);
34263 __attribute__((visibility("default"))) void qHBFreeFace(HB_Face);
34264 template <> class QTypeInfo<HB_GlyphAttributes> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(HB_GlyphAttributes)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "HB_GlyphAttributes"; } };
34265 template <> class QTypeInfo<HB_FixedPoint> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(HB_FixedPoint)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "HB_FixedPoint"; } };
34266 class QFontPrivate;
34267 class QFontEngine;
34268 class QString;
34269 class QPainter;
34270 class QAbstractTextDocumentLayout;
34271 struct glyph_metrics_t
34272 {
34273 inline glyph_metrics_t()
34274 : x(100000), y(100000) {}
34275 inline glyph_metrics_t(QFixed _x, QFixed _y, QFixed _width, QFixed _height, QFixed _xoff, QFixed _yoff)
34276 : x(_x),
34277 y(_y),
34278 width(_width),
34279 height(_height),
34280 xoff(_xoff),
34281 yoff(_yoff)
34282 {}
34283 QFixed x;
34284 QFixed y;
34285 QFixed width;
34286 QFixed height;
34287 QFixed xoff;
34288 QFixed yoff;
34289 glyph_metrics_t transformed(const QTransform &xform) const;
34290 };
34291 template <> class QTypeInfo<glyph_metrics_t> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(glyph_metrics_t)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "glyph_metrics_t"; } };
34292 struct QScriptAnalysis
34293 {
34294 enum Flags {
34295 None = 0,
34296 Lowercase = 1,
34297 Uppercase = 2,
34298 SmallCaps = 3,
34299 LineOrParagraphSeparator = 4,
34300 Space = 5,
34301 SpaceTabOrObject = Space,
34302 Tab = 6,
34303 TabOrObject = Tab,
34304 Object = 7
34305 };
34306 unsigned short script : 8;
34307 unsigned short bidiLevel : 6;
34308 unsigned short flags : 3;
34309 inline bool operator == (const QScriptAnalysis &other) const {
34310 return script == other.script && bidiLevel == other.bidiLevel && flags == other.flags;
34311 }
34312 };
34313 template <> class QTypeInfo<QScriptAnalysis> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QScriptAnalysis)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QScriptAnalysis"; } };
34314 struct QGlyphJustification
34315 {
34316 inline QGlyphJustification()
34317 : type(0), nKashidas(0), space_18d6(0)
34318 {}
34319 enum JustificationType {
34320 JustifyNone,
34321 JustifySpace,
34322 JustifyKashida
34323 };
34324 uint type :2;
34325 uint nKashidas : 6;
34326 uint space_18d6 : 24;
34327 };
34328 template <> class QTypeInfo<QGlyphJustification> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QGlyphJustification)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QGlyphJustification"; } };
34329 struct QGlyphLayoutInstance
34330 {
34331 QFixedPoint offset;
34332 QFixedPoint advance;
34333 HB_Glyph glyph;
34334 QGlyphJustification justification;
34335 HB_GlyphAttributes attributes;
34336 };
34337 struct QGlyphLayout
34338 {
34339 QFixedPoint *offsets;
34340 HB_Glyph *glyphs;
34341 QFixed *advances_x;
34342 QFixed *advances_y;
34343 QGlyphJustification *justifications;
34344 HB_GlyphAttributes *attributes;
34345 int numGlyphs;
34346 inline QGlyphLayout() : numGlyphs(0) {}
34347 inline explicit QGlyphLayout(char *address, int totalGlyphs)
34348 {
34349 offsets = reinterpret_cast<QFixedPoint *>(address);
34350 int offset = totalGlyphs * sizeof(HB_FixedPoint);
34351 glyphs = reinterpret_cast<HB_Glyph *>(address + offset);
34352 offset += totalGlyphs * sizeof(HB_Glyph);
34353 advances_x = reinterpret_cast<QFixed *>(address + offset);
34354 offset += totalGlyphs * sizeof(QFixed);
34355 advances_y = reinterpret_cast<QFixed *>(address + offset);
34356 offset += totalGlyphs * sizeof(QFixed);
34357 justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
34358 offset += totalGlyphs * sizeof(QGlyphJustification);
34359 attributes = reinterpret_cast<HB_GlyphAttributes *>(address + offset);
34360 numGlyphs = totalGlyphs;
34361 }
34362 inline QGlyphLayout mid(int position, int n = -1) const {
34363 QGlyphLayout copy = *this;
34364 copy.glyphs += position;
34365 copy.advances_x += position;
34366 copy.advances_y += position;
34367 copy.offsets += position;
34368 copy.justifications += position;
34369 copy.attributes += position;
34370 if (n == -1)
34371 copy.numGlyphs -= position;
34372 else
34373 copy.numGlyphs = n;
34374 return copy;
34375 }
34376 static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
34377 return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
34378 + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
34379 + sizeof(QGlyphJustification));
34380 }
34381 inline QFixed effectiveAdvance(int item) const
34382 { return (advances_x[item] + QFixed::fromFixed(justifications[item].space_18d6)) * !attributes[item].dontPrint; }
34383 inline QGlyphLayoutInstance instance(int position) const {
34384 QGlyphLayoutInstance g;
34385 g.offset.x = offsets[position].x;
34386 g.offset.y = offsets[position].y;
34387 g.glyph = glyphs[position];
34388 g.advance.x = advances_x[position];
34389 g.advance.y = advances_y[position];
34390 g.justification = justifications[position];
34391 g.attributes = attributes[position];
34392 return g;
34393 }
34394 inline void setInstance(int position, const QGlyphLayoutInstance &g) {
34395 offsets[position].x = g.offset.x;
34396 offsets[position].y = g.offset.y;
34397 glyphs[position] = g.glyph;
34398 advances_x[position] = g.advance.x;
34399 advances_y[position] = g.advance.y;
34400 justifications[position] = g.justification;
34401 attributes[position] = g.attributes;
34402 }
34403 inline void clear(int first = 0, int last = -1) {
34404 if (last == -1)
34405 last = numGlyphs;
34406 if (first == 0 && last == numGlyphs
34407 && reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
34408 memset(offsets, 0, spaceNeededForGlyphLayout(numGlyphs));
34409 } else {
34410 const int num = last - first;
34411 memset(offsets + first, 0, num * sizeof(QFixedPoint));
34412 memset(glyphs + first, 0, num * sizeof(HB_Glyph));
34413 memset(advances_x + first, 0, num * sizeof(QFixed));
34414 memset(advances_y + first, 0, num * sizeof(QFixed));
34415 memset(justifications + first, 0, num * sizeof(QGlyphJustification));
34416 memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes));
34417 }
34418 }
34419 inline char *data() {
34420 return reinterpret_cast<char *>(offsets);
34421 }
34422 void grow(char *address, int totalGlyphs);
34423 };
34424 class QVarLengthGlyphLayoutArray : private QVarLengthArray<void *>, public QGlyphLayout
34425 {
34426 private:
34427 typedef QVarLengthArray<void *> Array;
34428 public:
34429 QVarLengthGlyphLayoutArray(int totalGlyphs)
34430 : Array(spaceNeededForGlyphLayout(totalGlyphs) / sizeof(void *) + 1)
34431 , QGlyphLayout(reinterpret_cast<char *>(Array::data()), totalGlyphs)
34432 {
34433 memset(Array::data(), 0, Array::size() * sizeof(void *));
34434 }
34435 void resize(int totalGlyphs)
34436 {
34437 Array::resize(spaceNeededForGlyphLayout(totalGlyphs) / sizeof(void *) + 1);
34438 *((QGlyphLayout *)this) = QGlyphLayout(reinterpret_cast<char *>(Array::data()), totalGlyphs);
34439 memset(Array::data(), 0, Array::size() * sizeof(void *));
34440 }
34441 };
34442 template <int N> struct QGlyphLayoutArray : public QGlyphLayout
34443 {
34444 public:
34445 QGlyphLayoutArray()
34446 : QGlyphLayout(reinterpret_cast<char *>(buffer), N)
34447 {
34448 memset(buffer, 0, sizeof(buffer));
34449 }
34450 private:
34451 void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
34452 + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
34453 + sizeof(QGlyphJustification)))
34454 / sizeof(void *) + 1];
34455 };
34456 struct QScriptItem;
34457 class QTextItemInt : public QTextItem
34458 {
34459 public:
34460 inline QTextItemInt()
34461 : justified(false), underlineStyle(QTextCharFormat::NoUnderline), num_chars(0), chars(0),
34462 logClusters(0), f(0), fontEngine(0)
34463 {}
34464 QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat());
34465 QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const;
34466 QFixed descent;
34467 QFixed ascent;
34468 QFixed width;
34469 RenderFlags flags;
34470 bool justified;
34471 QTextCharFormat::UnderlineStyle underlineStyle;
34472 const QTextCharFormat charFormat;
34473 int num_chars;
34474 const QChar *chars;
34475 const unsigned short *logClusters;
34476 const QFont *f;
34477 QGlyphLayout glyphs;
34478 QFontEngine *fontEngine;
34479 };
34480 inline bool qIsControlChar(ushort uc)
34481 {
34482 return uc >= 0x200b && uc <= 0x206f
34483 && (uc <= 0x200f
34484 || (uc >= 0x2028 && uc <= 0x202f )
34485 || uc >= 0x206a );
34486 }
34487 struct QScriptItem
34488 {
34489 inline QScriptItem()
34490 : position(0),
34491 num_glyphs(0), descent(-1), ascent(-1), width(-1),
34492 glyph_data_offset(0) {}
34493 inline QScriptItem(int p, const QScriptAnalysis &a)
34494 : position(p), analysis(a),
34495 num_glyphs(0), descent(-1), ascent(-1), width(-1),
34496 glyph_data_offset(0) {}
34497 int position;
34498 QScriptAnalysis analysis;
34499 unsigned short num_glyphs;
34500 QFixed descent;
34501 QFixed ascent;
34502 QFixed width;
34503 int glyph_data_offset;
34504 QFixed height() const { return ascent + descent + 1; }
34505 };
34506 template <> class QTypeInfo<QScriptItem> { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QScriptItem)>sizeof(void*)), isPointer = false, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QScriptItem"; } };
34507 typedef QVector<QScriptItem> QScriptItemArray;
34508 struct QScriptLine
34509 {
34510 QScriptLine()
34511 : from(0), length(0),
34512 justified(0), gridfitted(0),
34513 hasTrailingSpaces(0) {}
34514 QFixed descent;
34515 QFixed ascent;
34516 QFixed x;
34517 QFixed y;
34518 QFixed width;
34519 QFixed textWidth;
34520 int from;
34521 signed int length : 29;
34522 mutable uint justified : 1;
34523 mutable uint gridfitted : 1;
34524 uint hasTrailingSpaces : 1;
34525 QFixed height() const { return ascent + descent + 1; }
34526 void setDefaultHeight(QTextEngine *eng);
34527 void operator+=(const QScriptLine &other);
34528 };
34529 template <> class QTypeInfo<QScriptLine> { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QScriptLine)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0) }; static inline const char *name() { return "QScriptLine"; } };
34530 inline void QScriptLine::operator+=(const QScriptLine &other)
34531 {
34532 descent = qMax(descent, other.descent);
34533 ascent = qMax(ascent, other.ascent);
34534 textWidth += other.textWidth;
34535 length += other.length;
34536 }
34537 typedef QVector<QScriptLine> QScriptLineArray;
34538 class QFontPrivate;
34539 class QTextFormatCollection;
34540 class __attribute__((visibility("default"))) QTextEngine {
34541 public:
34542 struct LayoutData {
34543 LayoutData(const QString &str, void **stack_memory, int mem_size);
34544 LayoutData();
34545 ~LayoutData();
34546 mutable QScriptItemArray items;
34547 int allocated;
34548 int available_glyphs;
34549 void **memory;
34550 unsigned short *logClustersPtr;
34551 QGlyphLayout glyphLayout;
34552 mutable int used;
34553 uint hasBidi : 1;
34554 uint inLayout : 1;
34555 uint memory_on_stack : 1;
34556 bool haveCharAttributes;
34557 QString string;
34558 void reallocate(int totalGlyphs);
34559 };
34560 QTextEngine(LayoutData *data);
34561 QTextEngine();
34562 QTextEngine(const QString &str, const QFont &f);
34563 ~QTextEngine();
34564 enum Mode {
34565 WidthOnly = 0x07
34566 };
34567 enum ShaperFlag {
34568 RightToLeft = 0x0001,
34569 DesignMetrics = 0x0002,
34570 GlyphIndicesOnly = 0x0004
34571 };
34572 typedef QFlags<ShaperFlag> ShaperFlags;
34573 void invalidate();
34574 void clearLineData();
34575 void validate() const;
34576 void itemize() const;
34577 static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder);
34578 const HB_CharAttributes *attributes() const;
34579 void shape(int item) const;
34580 void justify(const QScriptLine &si);
34581 QFixed width(int charFrom, int numChars) const;
34582 glyph_metrics_t boundingBox(int from, int len) const;
34583 glyph_metrics_t tightBoundingBox(int from, int len) const;
34584 int length(int item) const {
34585 const QScriptItem &si = layoutData->items[item];
34586 int from = si.position;
34587 item++;
34588 return (item < layoutData->items.size() ? layoutData->items[item].position : layoutData->string.length()) - from;
34589 }
34590 int length(const QScriptItem *si) const {
34591 int end;
34592 if (si + 1 < layoutData->items.constData()+ layoutData->items.size())
34593 end = (si+1)->position;
34594 else
34595 end = layoutData->string.length();
34596 return end - si->position;
34597 }
34598 QFontEngine *fontEngine(const QScriptItem &si, QFixed *ascent = 0, QFixed *descent = 0) const;
34599 QFont font(const QScriptItem &si) const;
34600 inline QFont font() const { return fnt; }
34601 inline unsigned short *logClusters(const QScriptItem *si) const
34602 { return layoutData->logClustersPtr+si->position; }
34603 inline QGlyphLayout availableGlyphs(const QScriptItem *si) const {
34604 return layoutData->glyphLayout.mid(si->glyph_data_offset);
34605 }
34606 inline QGlyphLayout shapedGlyphs(const QScriptItem *si) const {
34607 return layoutData->glyphLayout.mid(si->glyph_data_offset, si->num_glyphs);
34608 }
34609 inline void ensureSpace(int nGlyphs) const {
34610 if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs)
34611 layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4);
34612 }
34613 void freeMemory();
34614 int findItem(int strPos) const;
34615 inline QTextFormatCollection *formats() const {
34616 return block.docHandle()->formatCollection();
34617 }
34618 QTextCharFormat format(const QScriptItem *si) const;
34619 inline QAbstractTextDocumentLayout *docLayout() const {
34620 return block.docHandle()->document()->documentLayout();
34621 }
34622 int formatIndex(const QScriptItem *si) const;
34623 QFixed calculateTabWidth(int index, QFixed x) const;
34624 mutable QScriptLineArray lines;
34625 QString text;
34626 QFont fnt;
34627 QTextBlock block;
34628 QTextOption option;
34629 QFixed minWidth;
34630 QFixed maxWidth;
34631 QPointF position;
34632 uint ignoreBidi : 1;
34633 uint cacheGlyphs : 1;
34634 uint stackEngine : 1;
34635 uint forceJustification : 1;
34636 int *underlinePositions;
34637 mutable LayoutData *layoutData;
34638 inline bool hasFormats() const { return (block.docHandle() || specialData); }
34639 struct SpecialData {
34640 int preeditPosition;
34641 QString preeditText;
34642 QList<QTextLayout::FormatRange> addFormats;
34643 QVector<int> addFormatIndices;
34644 QVector<int> resolvedFormatIndices;
34645 };
34646 SpecialData *specialData;
34647 bool atWordSeparator(int position) const;
34648 bool atSpace(int position) const;
34649 void indexAdditionalFormats();
34650 QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0) const;
34651 void shapeLine(const QScriptLine &line);
34652 private:
34653 void setBoundary(int strPos) const;
34654 void addRequiredBoundaries() const;
34655 void shapeText(int item) const;
34656 void shapeTextWithHarfbuzz(int item) const;
34657 void splitItem(int item, int pos) const;
34658 void resolveAdditionalFormats() const;
34659 };
34660 class QStackTextEngine : public QTextEngine {
34661 public:
34662 enum { MemSize = 256*40/sizeof(void *) };
34663 QStackTextEngine(const QString &string, const QFont &f);
34664 LayoutData _layoutData;
34665 void *_memory[MemSize];
34666 };
34667 inline QFlags<QTextEngine::ShaperFlags::enum_type> operator|(QTextEngine::ShaperFlags::enum_type f1, QTextEngine::ShaperFlags::enum_type f2) { return QFlags<QTextEngine::ShaperFlags::enum_type>(f1) | f2; } inline QFlags<QTextEngine::ShaperFlags::enum_type> operator|(QTextEngine::ShaperFlags::enum_type f1, QFlags<QTextEngine::ShaperFlags::enum_type> f2) { return f2 | f1; } inline QIncompatibleFlag operator|(QTextEngine::ShaperFlags::enum_type f1, int f2) { return QIncompatibleFlag(int(f1) | f2); }
34668 class __attribute__((visibility("default"))) QFontEngineGlyphCache
34669 {
34670 public:
34671 QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { }
34672 enum Type {
34673 Raster_RGBMask,
34674 Raster_A8,
34675 Raster_Mono
34676 };
34677 virtual ~QFontEngineGlyphCache();
34678 QTransform m_transform;
34679 };
34680 typedef QHash<void *, QList<QFontEngineGlyphCache *> > GlyphPointerHash;
34681 typedef QHash<int, QList<QFontEngineGlyphCache *> > GlyphIntHash;
34682 struct glyph_metrics_t;
34683 typedef unsigned int glyph_t;
34684 class QChar;
34685 class QPainterPath;
34686 class QTextEngine;
34687 struct QGlyphLayout;
34688 class __attribute__((visibility("default"))) QFontEngine : public QObject
34689 {
34690 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
34691 public:
34692 enum Type {
34693 Box,
34694 Multi,
34695 XLFD,
34696 Win,
34697 Mac,
34698 Freetype,
34699 QPF1,
34700 QPF2,
34701 Proxy,
34702 TestFontEngine = 0x1000
34703 };
34704 QFontEngine();
34705 virtual ~QFontEngine();
34706 struct Properties {
34707 QByteArray postscriptName;
34708 QByteArray copyright;
34709 QRectF boundingBox;
34710 QFixed emSquare;
34711 QFixed ascent;
34712 QFixed descent;
34713 QFixed leading;
34714 QFixed italicAngle;
34715 QFixed capHeight;
34716 QFixed lineWidth;
34717 };
34718 virtual Properties properties() const;
34719 virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
34720 QByteArray getSfntTable(uint ) const;
34721 virtual bool getSfntTableData(uint , uchar * , uint * ) const { return false; }
34722 struct FaceId {
34723 FaceId() : index(0), encoding(0) {}
34724 QByteArray filename;
34725 int index;
34726 int encoding;
34727 };
34728 virtual FaceId faceId() const { return FaceId(); }
34729 enum SynthesizedFlags {
34730 SynthesizedItalic = 0x1,
34731 SynthesizedBold = 0x2,
34732 SynthesizedStretch = 0x4
34733 };
34734 virtual int synthesized() const { return 0; }
34735 virtual QFixed emSquareSize() const { return ascent(); }
34736 virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const = 0;
34737 virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const {}
34738 virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
34739 virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0;
34740 virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
34741 QPainterPath *path, QTextItem::RenderFlags flags);
34742 void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags,
34743 QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions);
34744 virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags);
34745 void addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags);
34746 virtual QImage alphaMapForGlyph(glyph_t) = 0;
34747 virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
34748 virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
34749 virtual void removeGlyphFromCache(glyph_t);
34750 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0;
34751 virtual glyph_metrics_t boundingBox(glyph_t glyph) = 0;
34752 virtual glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix);
34753 glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
34754 virtual QFixed ascent() const = 0;
34755 virtual QFixed descent() const = 0;
34756 virtual QFixed leading() const = 0;
34757 virtual QFixed xHeight() const;
34758 virtual QFixed averageCharWidth() const;
34759 virtual QFixed lineThickness() const;
34760 virtual QFixed underlinePosition() const;
34761 virtual qreal maxCharWidth() const = 0;
34762 virtual qreal minLeftBearing() const { return qreal(); }
34763 virtual qreal minRightBearing() const { return qreal(); }
34764 virtual const char *name() const = 0;
34765 virtual bool canRender(const QChar *string, int len) = 0;
34766 virtual Type type() const = 0;
34767 virtual int glyphCount() const;
34768 HB_Font harfbuzzFont() const;
34769 HB_Face harfbuzzFace() const;
34770 virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
34771 void setGlyphCache(void *key, QFontEngineGlyphCache *data);
34772 void setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data);
34773 QFontEngineGlyphCache *glyphCache(void *key, const QTransform &transform) const;
34774 QFontEngineGlyphCache *glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const;
34775 static const uchar *getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize);
34776 static quint32 getTrueTypeGlyphIndex(const uchar *cmap, uint unicode);
34777 QAtomicInt ref;
34778 QFontDef fontDef;
34779 uint cache_cost;
34780 int cache_count;
34781 uint fsType : 16;
34782 bool symbol;
34783 mutable HB_FontRec hbFont;
34784 mutable HB_Face hbFace;
34785 struct KernPair {
34786 uint left_right;
34787 QFixed adjust;
34788 inline bool operator<(const KernPair &other) const
34789 {
34790 return left_right < other.left_right;
34791 }
34792 };
34793 QVector<KernPair> kerning_pairs;
34794 void loadKerningPairs(QFixed scalingFactor);
34795 int glyphFormat;
34796 private:
34797 void expireGlyphCache();
34798 GlyphPointerHash m_glyphPointerHash;
34799 GlyphIntHash m_glyphIntHash;
34800 mutable QList<QFontEngineGlyphCache*> m_glyphCacheQueue;
34801 };
34802 inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
34803 {
34804 return (f1.index == f2.index) && (f1.encoding == f2.encoding) && (f1.filename == f2.filename);
34805 }
34806 inline uint qHash(const QFontEngine::FaceId &f)
34807 {
34808 return qHash((f.index << 16) + f.encoding) + qHash(f.filename);
34809 }
34810 class QGlyph;
34811 class QFontEngineQPF1Data;
34812 class QFontEngineQPF1 : public QFontEngine
34813 {
34814 public:
34815 QFontEngineQPF1(const QFontDef&, const QString &fn);
34816 ~QFontEngineQPF1();
34817 virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
34818 virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
34819 virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
34820 virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
34821 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
34822 virtual glyph_metrics_t boundingBox(glyph_t glyph);
34823 virtual QFixed ascent() const;
34824 virtual QFixed descent() const;
34825 virtual QFixed leading() const;
34826 virtual qreal maxCharWidth() const;
34827 virtual qreal minLeftBearing() const;
34828 virtual qreal minRightBearing() const;
34829 virtual QFixed underlinePosition() const;
34830 virtual QFixed lineThickness() const;
34831 virtual Type type() const;
34832 virtual bool canRender(const QChar *string, int len);
34833 inline const char *name() const { return 0; }
34834 virtual QImage alphaMapForGlyph(glyph_t);
34835 QFontEngineQPF1Data *d;
34836 };
34837 class QFontEngineBox : public QFontEngine
34838 {
34839 public:
34840 QFontEngineBox(int size);
34841 ~QFontEngineBox();
34842 virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
34843 virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
34844 void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
34845 virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
34846 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
34847 virtual glyph_metrics_t boundingBox(glyph_t glyph);
34848 virtual QFixed ascent() const;
34849 virtual QFixed descent() const;
34850 virtual QFixed leading() const;
34851 virtual qreal maxCharWidth() const;
34852 virtual qreal minLeftBearing() const { return 0; }
34853 virtual qreal minRightBearing() const { return 0; }
34854 virtual QImage alphaMapForGlyph(glyph_t);
34855 virtual const char *name() const;
34856 virtual bool canRender(const QChar *string, int len);
34857 virtual Type type() const;
34858 inline int size() const { return _size; }
34859 private:
34860 friend class QFontPrivate;
34861 int _size;
34862 };
34863 class __attribute__((visibility("default"))) QFontEngineMulti : public QFontEngine
34864 {
34865 public:
34866 explicit QFontEngineMulti(int engineCount);
34867 ~QFontEngineMulti();
34868 virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
34869 QTextEngine::ShaperFlags flags) const;
34870 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
34871 virtual glyph_metrics_t boundingBox(glyph_t glyph);
34872 virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
34873 virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const;
34874 virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags);
34875 virtual QFixed ascent() const;
34876 virtual QFixed descent() const;
34877 virtual QFixed leading() const;
34878 virtual QFixed xHeight() const;
34879 virtual QFixed averageCharWidth() const;
34880 virtual QImage alphaMapForGlyph(glyph_t);
34881 virtual QFixed lineThickness() const;
34882 virtual QFixed underlinePosition() const;
34883 virtual qreal maxCharWidth() const;
34884 virtual qreal minLeftBearing() const;
34885 virtual qreal minRightBearing() const;
34886 virtual inline Type type() const
34887 { return QFontEngine::Multi; }
34888 virtual bool canRender(const QChar *string, int len);
34889 inline virtual const char *name() const
34890 { return "Multi"; }
34891 QFontEngine *engine(int at) const;
34892 protected:
34893 friend class QPSPrintEnginePrivate;
34894 friend class QPSPrintEngineFontMulti;
34895 virtual void loadEngine(int at) = 0;
34896 QVector<QFontEngine *> engines;
34897 };
34898 class QTestFontEngine : public QFontEngineBox
34899 {
34900 public:
34901 QTestFontEngine(int size) : QFontEngineBox(size) {}
34902 virtual Type type() const { return TestFontEngine; }
34903 };
34904 typedef QtValidLicenseForGuiModule QtGuiModule;
34905 class QVariant;
34906 class __attribute__((visibility("default"))) QBitmap : public QPixmap
34907 {
34908 public:
34909 QBitmap();
34910 QBitmap(const QPixmap &);
34911 QBitmap(int w, int h);
34912 explicit QBitmap(const QSize &);
34913 explicit QBitmap(const QString &fileName, const char *format=0);
34914 ~QBitmap();
34915 QBitmap &operator=(const QPixmap &);
34916 operator QVariant() const;
34917 inline void clear() { fill(Qt::color0); }
34918 static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
34919 static QBitmap fromData(const QSize &size, const uchar *bits,
34920 QImage::Format monoFormat = QImage::Format_MonoLSB);
34921 QBitmap transformed(const QMatrix &) const;
34922 QBitmap transformed(const QTransform &matrix) const;
34923 };
34924 template <> inline bool qIsDetached<QBitmap>(QBitmap &t) { return t.isDetached(); } template <typename T> inline void qSwap(T &, T &); template <> inline void qSwap<QBitmap>(QBitmap &value1, QBitmap &value2) { const QBitmap::DataPtr t = value1.data_ptr(); value1.data_ptr() = value2.data_ptr(); value2.data_ptr() = t; }
34925 template <typename Type> class QDataBuffer
34926 {
34927 public:
34928 QDataBuffer(int res = 64)
34929 {
34930 capacity = res;
34931 buffer = (Type*) qMalloc(capacity * sizeof(Type));
34932 siz = 0;
34933 }
34934 ~QDataBuffer()
34935 {
34936 qFree(buffer);
34937 }
34938 inline void reset() { siz = 0; }
34939 inline bool isEmpty() const { return siz==0; }
34940 inline int size() const { return siz; }
34941 inline Type *data() const { return buffer; }
34942 inline Type &at(int i) { qt_noop(); return buffer[i]; }
34943 inline const Type &at(int i) const { qt_noop(); return buffer[i]; }
34944 inline const Type &last() const { qt_noop(); return buffer[siz-1]; }
34945 inline const Type &first() const { qt_noop(); return buffer[0]; }
34946 inline void add(const Type &t) {
34947 reserve(siz + 1);
34948 buffer[siz] = t;
34949 ++siz;
34950 }
34951 inline void resize(int size) {
34952 reserve(size);
34953 siz = size;
34954 }
34955 inline void reserve(int size) {
34956 if (size > capacity) {
34957 while (capacity < size)
34958 capacity *= 2;
34959 buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
34960 }
34961 }
34962 inline void shrink(int size) {
34963 capacity = size;
34964 buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
34965 }
34966 inline void swap(QDataBuffer<Type> &other) {
34967 qSwap(capacity, other.capacity);
34968 qSwap(siz, other.siz);
34969 qSwap(buffer, other.buffer);
34970 }
34971 inline QDataBuffer &operator<<(const Type &t) { add(t); return *this; }
34972 private:
34973 int capacity;
34974 int siz;
34975 Type *buffer;
34976 };
34977 static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
34978 static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
34979 static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } };
34980 static inline double qt_inf()
34981 {
34982 return (QSysInfo::ByteOrder == QSysInfo::BigEndian
34983 ? qt_be_inf_bytes.d
34984 : qt_le_inf_bytes.d);
34985 }
34986 static const union { unsigned char c[8]; double d; } qt_be_snan_bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } };
34987 static const union { unsigned char c[8]; double d; } qt_le_snan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } };
34988 static const union { unsigned char c[8]; double d; } qt_armfpa_snan_bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } };
34989 static inline double qt_snan()
34990 {
34991 return (QSysInfo::ByteOrder == QSysInfo::BigEndian
34992 ? qt_be_snan_bytes.d
34993 : qt_le_snan_bytes.d);
34994 }
34995 static const union { unsigned char c[8]; double d; } qt_be_qnan_bytes = { { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 } };
34996 static const union { unsigned char c[8]; double d; } qt_le_qnan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0xff } };
34997 static const union { unsigned char c[8]; double d; } qt_armfpa_qnan_bytes = { { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 } };
34998 static inline double qt_qnan()
34999 {
35000 return (QSysInfo::ByteOrder == QSysInfo::BigEndian
35001 ? qt_be_qnan_bytes.d
35002 : qt_le_qnan_bytes.d);
35003 }
35004 static inline bool qt_is_inf(double d)
35005 {
35006 uchar *ch = (uchar *)&d;
35007 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35008 return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0;
35009 } else {
35010 return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0;
35011 }
35012 }
35013 static inline bool qt_is_nan(double d)
35014 {
35015 uchar *ch = (uchar *)&d;
35016 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35017 return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0;
35018 } else {
35019 return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0;
35020 }
35021 }
35022 static inline bool qt_is_finite(double d)
35023 {
35024 uchar *ch = (uchar *)&d;
35025 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35026 return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0;
35027 } else {
35028 return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0;
35029 }
35030 }
35031 static inline bool qt_is_inf(float d)
35032 {
35033 uchar *ch = (uchar *)&d;
35034 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35035 return (ch[0] & 0x7f) == 0x7f && ch[1] == 0x80;
35036 } else {
35037 return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80;
35038 }
35039 }
35040 static inline bool qt_is_nan(float d)
35041 {
35042 uchar *ch = (uchar *)&d;
35043 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35044 return (ch[0] & 0x7f) == 0x7f && ch[1] > 0x80;
35045 } else {
35046 return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80;
35047 }
35048 }
35049 static inline bool qt_is_finite(float d)
35050 {
35051 uchar *ch = (uchar *)&d;
35052 if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
35053 return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0x80) != 0x80;
35054 } else {
35055 return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80;
35056 }
35057 }
35058 typedef qreal qfixed;
35059 struct qfixed2d
35060 {
35061 qfixed x;
35062 qfixed y;
35063 bool operator==(const qfixed2d &other) const { return qFuzzyCompare(x, other.x)
35064 && qFuzzyCompare(y, other.y); }
35065 };
35066 QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLength,
35067 QPointF *controlPoints, int *point_count);
35068 qreal qt_t_for_arc_angle(qreal angle);
35069 typedef void (*qStrokerMoveToHook)(qfixed x, qfixed y, void *data);
35070 typedef void (*qStrokerLineToHook)(qfixed x, qfixed y, void *data);
35071 typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y,
35072 qfixed c2x, qfixed c2y,
35073 qfixed ex, qfixed ey,
35074 void *data);
35075 class __attribute__((visibility("default"))) QStrokerOps
35076 {
35077 public:
35078 struct Element {
35079 QPainterPath::ElementType type;
35080 qfixed x;
35081 qfixed y;
35082 inline bool isMoveTo() const { return type == QPainterPath::MoveToElement; }
35083 inline bool isLineTo() const { return type == QPainterPath::LineToElement; }
35084 inline bool isCurveTo() const { return type == QPainterPath::CurveToElement; }
35085 operator qfixed2d () { qfixed2d pt = { x, y }; return pt; }
35086 };
35087 QStrokerOps();
35088 virtual ~QStrokerOps();
35089 void setMoveToHook(qStrokerMoveToHook moveToHook) { m_moveTo = moveToHook; }
35090 void setLineToHook(qStrokerLineToHook lineToHook) { m_lineTo = lineToHook; }
35091 void setCubicToHook(qStrokerCubicToHook cubicToHook) { m_cubicTo = cubicToHook; }
35092 virtual void begin(void *customData);
35093 virtual void end();
35094 inline void moveTo(qfixed x, qfixed y);
35095 inline void lineTo(qfixed x, qfixed y);
35096 inline void cubicTo(qfixed x1, qfixed y1, qfixed x2, qfixed y2, qfixed ex, qfixed ey);
35097 void strokePath(const QPainterPath &path, void *data, const QTransform &matrix);
35098 void strokePolygon(const QPointF *points, int pointCount, bool implicit_close,
35099 void *data, const QTransform &matrix);
35100 void strokeEllipse(const QRectF &ellipse, void *data, const QTransform &matrix);
35101 QRectF clipRect() const { return m_clip_rect; }
35102 void setClipRect(const QRectF &clip) { m_clip_rect = clip; }
35103 protected:
35104 inline void emitMoveTo(qfixed x, qfixed y);
35105 inline void emitLineTo(qfixed x, qfixed y);
35106 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey);
35107 virtual void processCurrentSubpath() = 0;
35108 QDataBuffer<Element> m_elements;
35109 QRectF m_clip_rect;
35110 private:
35111 void *m_customData;
35112 qStrokerMoveToHook m_moveTo;
35113 qStrokerLineToHook m_lineTo;
35114 qStrokerCubicToHook m_cubicTo;
35115 };
35116 class __attribute__((visibility("default"))) QStroker : public QStrokerOps
35117 {
35118 public:
35119 enum LineJoinMode {
35120 FlatJoin,
35121 SquareJoin,
35122 MiterJoin,
35123 RoundJoin,
35124 RoundCap,
35125 SvgMiterJoin
35126 };
35127 QStroker();
35128 ~QStroker();
35129 void setStrokeWidth(qfixed width) { m_strokeWidth = width; }
35130 qfixed strokeWidth() const { return m_strokeWidth; }
35131 void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); }
35132 Qt::PenCapStyle capStyle() const { return capForJoinMode(m_capStyle); }
35133 LineJoinMode capStyleMode() const { return m_capStyle; }
35134 void setJoinStyle(Qt::PenJoinStyle style) { m_joinStyle = joinModeForJoin(style); }
35135 Qt::PenJoinStyle joinStyle() const { return joinForJoinMode(m_joinStyle); }
35136 LineJoinMode joinStyleMode() const { return m_joinStyle; }
35137 void setMiterLimit(qfixed length) { m_miterLimit = length; }
35138 qfixed miterLimit() const { return m_miterLimit; }
35139 void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; }
35140 qfixed curveThreshold() const { return m_curveThreshold; }
35141 void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join);
35142 inline void emitMoveTo(qfixed x, qfixed y);
35143 inline void emitLineTo(qfixed x, qfixed y);
35144 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey);
35145 protected:
35146 static Qt::PenCapStyle capForJoinMode(LineJoinMode mode);
35147 static LineJoinMode joinModeForCap(Qt::PenCapStyle);
35148 static Qt::PenJoinStyle joinForJoinMode(LineJoinMode mode);
35149 static LineJoinMode joinModeForJoin(Qt::PenJoinStyle joinStyle);
35150 virtual void processCurrentSubpath();
35151 qfixed m_strokeWidth;
35152 qfixed m_miterLimit;
35153 qfixed m_curveThreshold;
35154 LineJoinMode m_capStyle;
35155 LineJoinMode m_joinStyle;
35156 qfixed m_back1X;
35157 qfixed m_back1Y;
35158 qfixed m_back2X;
35159 qfixed m_back2Y;
35160 };
35161 class __attribute__((visibility("default"))) QDashStroker : public QStrokerOps
35162 {
35163 public:
35164 QDashStroker(QStroker *stroker);
35165 QStroker *stroker() const { return m_stroker; }
35166 static QVector<qfixed> patternForStyle(Qt::PenStyle style);
35167 void setDashPattern(const QVector<qfixed> &dashPattern) { m_dashPattern = dashPattern; }
35168 QVector<qfixed> dashPattern() const { return m_dashPattern; }
35169 void setDashOffset(qreal offset) { m_dashOffset = offset; }
35170 qreal dashOffset() const { return m_dashOffset; }
35171 virtual void begin(void *data);
35172 virtual void end();
35173 protected:
35174 virtual void processCurrentSubpath();
35175 QStroker *m_stroker;
35176 QVector<qfixed> m_dashPattern;
35177 qreal m_dashOffset;
35178 };
35179 inline void QStrokerOps::emitMoveTo(qfixed x, qfixed y)
35180 {
35181 qt_noop();
35182 m_moveTo(x, y, m_customData);
35183 }
35184 inline void QStrokerOps::emitLineTo(qfixed x, qfixed y)
35185 {
35186 qt_noop();
35187 m_lineTo(x, y, m_customData);
35188 }
35189 inline void QStrokerOps::emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey)
35190 {
35191 qt_noop();
35192 m_cubicTo(c1x, c1y, c2x, c2y, ex, ey, m_customData);
35193 }
35194 inline void QStrokerOps::moveTo(qfixed x, qfixed y)
35195 {
35196 if (m_elements.size()>1)
35197 processCurrentSubpath();
35198 m_elements.reset();
35199 Element e = { QPainterPath::MoveToElement, x, y };
35200 m_elements.add(e);
35201 }
35202 inline void QStrokerOps::lineTo(qfixed x, qfixed y)
35203 {
35204 Element e = { QPainterPath::LineToElement, x, y };
35205 m_elements.add(e);
35206 }
35207 inline void QStrokerOps::cubicTo(qfixed x1, qfixed y1, qfixed x2, qfixed y2, qfixed ex, qfixed ey)
35208 {
35209 Element c1 = { QPainterPath::CurveToElement, x1, y1 };
35210 Element c2 = { QPainterPath::CurveToDataElement, x2, y2 };
35211 Element e = { QPainterPath::CurveToDataElement, ex, ey };
35212 m_elements.add(c1);
35213 m_elements.add(c2);
35214 m_elements.add(e);
35215 }
35216 inline void QStroker::emitMoveTo(qfixed x, qfixed y)
35217 {
35218 m_back2X = m_back1X;
35219 m_back2Y = m_back1Y;
35220 m_back1X = x;
35221 m_back1Y = y;
35222 QStrokerOps::emitMoveTo(x, y);
35223 }
35224 inline void QStroker::emitLineTo(qfixed x, qfixed y)
35225 {
35226 m_back2X = m_back1X;
35227 m_back2Y = m_back1Y;
35228 m_back1X = x;
35229 m_back1Y = y;
35230 QStrokerOps::emitLineTo(x, y);
35231 }
35232 inline void QStroker::emitCubicTo(qfixed c1x, qfixed c1y,
35233 qfixed c2x, qfixed c2y,
35234 qfixed ex, qfixed ey)
35235 {
35236 if (c2x == ex && c2y == ey) {
35237 if (c1x == ex && c1y == ey) {
35238 m_back2X = m_back1X;
35239 m_back2Y = m_back1Y;
35240 } else {
35241 m_back2X = c1x;
35242 m_back2Y = c1y;
35243 }
35244 } else {
35245 m_back2X = c2x;
35246 m_back2Y = c2y;
35247 }
35248 m_back1X = ex;
35249 m_back1Y = ey;
35250 QStrokerOps::emitCubicTo(c1x, c1y, c2x, c2y, ex, ey);
35251 }
35252 inline void QDashStroker::begin(void *data)
35253 {
35254 qt_noop();
35255 m_stroker->begin(data);
35256 QStrokerOps::begin(data);
35257 }
35258 inline void QDashStroker::end()
35259 {
35260 qt_noop();
35261 QStrokerOps::end();
35262 m_stroker->end();
35263 }
35264 typedef QtValidLicenseForGuiModule QtGuiModule;
35265 class QPrinterPrivate;
35266 class QPaintEngine;
35267 class QPrintEngine;
35268 class QPrinterInfo;
35269 class __attribute__((visibility("default"))) QPrinter : public QPaintDevice
35270 {
35271 inline QPrinterPrivate* d_func() { return reinterpret_cast<QPrinterPrivate *>(d_ptr); } inline const QPrinterPrivate* d_func() const { return reinterpret_cast<const QPrinterPrivate *>(d_ptr); } friend class QPrinterPrivate;
35272 public:
35273 enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution };
35274 explicit QPrinter(PrinterMode mode = ScreenResolution);
35275 explicit QPrinter(const QPrinterInfo& printer, PrinterMode mode = ScreenResolution);
35276 ~QPrinter();
35277 int devType() const;
35278 enum Orientation { Portrait, Landscape };
35279 enum PageSize { A4, B5, Letter, Legal, Executive,
35280 A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
35281 B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
35282 DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom, NPaperSize = Custom };
35283 typedef PageSize PaperSize;
35284 enum PageOrder { FirstPageFirst,
35285 LastPageFirst };
35286 enum ColorMode { GrayScale,
35287 Color };
35288 enum PaperSource { OnlyOne,
35289 Lower,
35290 Middle,
35291 Manual,
35292 Envelope,
35293 EnvelopeManual,
35294 Auto,
35295 Tractor,
35296 SmallFormat,
35297 LargeFormat,
35298 LargeCapacity,
35299 Cassette,
35300 FormSource,
35301 MaxPageSource
35302 };
35303 enum PrinterState { Idle,
35304 Active,
35305 Aborted,
35306 Error };
35307 enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat };
35308 enum PrintRange { AllPages, Selection, PageRange };
35309 enum Unit {
35310 Millimeter,
35311 Point,
35312 Inch,
35313 Pica,
35314 Didot,
35315 Cicero,
35316 DevicePixel
35317 };
35318 enum DuplexMode {
35319 DuplexNone = 0,
35320 DuplexAuto,
35321 DuplexLongSide,
35322 DuplexShortSide
35323 };
35324 void setOutputFormat(OutputFormat format);
35325 OutputFormat outputFormat() const;
35326 void setPrinterName(const QString &);
35327 QString printerName() const;
35328 bool isValid() const;
35329 void setOutputFileName(const QString &);
35330 QString outputFileName()const;
35331 void setPrintProgram(const QString &);
35332 QString printProgram() const;
35333 void setDocName(const QString &);
35334 QString docName() const;
35335 void setCreator(const QString &);
35336 QString creator() const;
35337 void setOrientation(Orientation);
35338 Orientation orientation() const;
35339 void setPageSize(PageSize);
35340 PageSize pageSize() const;
35341 void setPaperSize(PaperSize);
35342 PaperSize paperSize() const;
35343 void setPaperSize(const QSizeF &paperSize, Unit unit);
35344 QSizeF paperSize(Unit unit) const;
35345 void setPageOrder(PageOrder);
35346 PageOrder pageOrder() const;
35347 void setResolution(int);
35348 int resolution() const;
35349 void setColorMode(ColorMode);
35350 ColorMode colorMode() const;
35351 void setCollateCopies(bool collate);
35352 bool collateCopies() const;
35353 void setFullPage(bool);
35354 bool fullPage() const;
35355 void setNumCopies(int);
35356 int numCopies() const;
35357 void setPaperSource(PaperSource);
35358 PaperSource paperSource() const;
35359 void setDuplex(DuplexMode duplex);
35360 DuplexMode duplex() const;
35361 QList<int> supportedResolutions() const;
35362 void setFontEmbeddingEnabled(bool enable);
35363 bool fontEmbeddingEnabled() const;
35364 void setDoubleSidedPrinting(bool enable);
35365 bool doubleSidedPrinting() const;
35366 QRect paperRect() const;
35367 QRect pageRect() const;
35368 QRectF paperRect(Unit) const;
35369 QRectF pageRect(Unit) const;
35370 QString printerSelectionOption() const;
35371 void setPrinterSelectionOption(const QString &);
35372 bool newPage();
35373 bool abort();
35374 PrinterState printerState() const;
35375 QPaintEngine *paintEngine() const;
35376 QPrintEngine *printEngine() const;
35377 void setFromTo(int fromPage, int toPage);
35378 int fromPage() const;
35379 int toPage() const;
35380 void setPrintRange(PrintRange range);
35381 PrintRange printRange() const;
35382 void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit);
35383 void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const;
35384 protected:
35385 int metric(PaintDeviceMetric) const;
35386 void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
35387 private:
35388 void init(PrinterMode mode);
35389 QPrinter(const QPrinter &); QPrinter &operator=(const QPrinter &);
35390 QPrinterPrivate *d_ptr;
35391 friend class QPrintDialogPrivate;
35392 friend class QAbstractPrintDialog;
35393 friend class QAbstractPrintDialogPrivate;
35394 friend class QPrintPreviewWidgetPrivate;
35395 friend class QTextDocument;
35396 friend class QPageSetupWidget;
35397 };
35398 class QFontSubset
35399 {
35400 public:
35401 QFontSubset(QFontEngine *fe, int obj_id = 0)
35402 : object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false)
35403 { fontEngine->ref.ref(); addGlyph(0); }
35404 ~QFontSubset() {
35405 if (!fontEngine->ref.deref())
35406 delete fontEngine;
35407 }
35408 QByteArray toTruetype() const;
35409 QByteArray toType1() const;
35410 QByteArray type1AddedGlyphs() const;
35411 QByteArray widthArray() const;
35412 QByteArray createToUnicodeMap() const;
35413 QVector<int> getReverseMap() const;
35414 QByteArray glyphName(unsigned int glyph, const QVector<int> reverseMap) const;
35415 static QByteArray glyphName(unsigned short unicode, bool symbol);
35416 int addGlyph(int index);
35417 const int object_id;
35418 bool noEmbed;
35419 QFontEngine *fontEngine;
35420 QList<int> glyph_indices;
35421 mutable int downloaded_glyphs;
35422 mutable bool standard_font;
35423 int nGlyphs() const { return glyph_indices.size(); }
35424 mutable QFixed emSquare;
35425 mutable QVector<QFixed> widths;
35426 };
35427 class QPaintDevice;
35428 class QPaintEnginePrivate
35429 {
35430 inline QPaintEngine* q_func() { return static_cast<QPaintEngine *>(q_ptr); } inline const QPaintEngine* q_func() const { return static_cast<const QPaintEngine *>(q_ptr); } friend class QPaintEngine;
35431 public:
35432 QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipWidget(0), hasSystemTransform(0),
35433 hasSystemViewport(0) {}
35434 virtual ~QPaintEnginePrivate() { }
35435 QPaintDevice *pdev;
35436 QPaintEngine *q_ptr;
35437 QRegion systemClip;
35438 QRegion systemViewport;
35439 QTransform systemTransform;
35440 QWidget *currentClipWidget;
35441 uint hasSystemTransform : 1;
35442 uint hasSystemViewport : 1;
35443 inline void transformSystemClip()
35444 {
35445 if (systemClip.isEmpty())
35446 return;
35447 if (systemTransform.type() <= QTransform::TxTranslate)
35448 systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
35449 else
35450 systemClip = systemTransform.map(systemClip);
35451 if (hasSystemViewport) {
35452 systemClip &= systemViewport;
35453 if (systemClip.isEmpty()) {
35454 systemClip = QRect(systemViewport.boundingRect().topLeft(), QSize(1, 1));
35455 }
35456 }
35457 }
35458 inline void setSystemTransform(const QTransform &xform)
35459 {
35460 systemTransform = xform;
35461 if ((hasSystemTransform = !xform.isIdentity()))
35462 transformSystemClip();
35463 systemStateChanged();
35464 }
35465 inline void setSystemViewport(const QRegion &region)
35466 {
35467 systemViewport = region;
35468 hasSystemViewport = !systemViewport.isEmpty();
35469 }
35470 virtual void systemStateChanged() { }
35471 void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti);
35472 private:
35473 QRect systemRect;
35474 };
35475 class QAlphaPaintEnginePrivate;
35476 class QAlphaPaintEngine : public QPaintEngine
35477 {
35478 inline QAlphaPaintEnginePrivate* d_func() { return reinterpret_cast<QAlphaPaintEnginePrivate *>(d_ptr); } inline const QAlphaPaintEnginePrivate* d_func() const { return reinterpret_cast<const QAlphaPaintEnginePrivate *>(d_ptr); } friend class QAlphaPaintEnginePrivate;
35479 public:
35480 ~QAlphaPaintEngine();
35481 virtual bool begin(QPaintDevice *pdev);
35482 virtual bool end();
35483 virtual void updateState(const QPaintEngineState &state);
35484 virtual void drawPath(const QPainterPath &path);
35485 virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
35486 virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
35487 virtual void drawImage(const QRectF &r, const QImage &image, const QRectF &sr);
35488 virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
35489 virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
35490 protected:
35491 QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps = 0);
35492 QRegion alphaClipping() const;
35493 bool continueCall() const;
35494 void flushAndInit(bool init = true);
35495 void cleanUp();
35496 };
35497 class QAlphaPaintEnginePrivate : public QPaintEnginePrivate
35498 {
35499 inline QAlphaPaintEngine* q_func() { return static_cast<QAlphaPaintEngine *>(q_ptr); } inline const QAlphaPaintEngine* q_func() const { return static_cast<const QAlphaPaintEngine *>(q_ptr); } friend class QAlphaPaintEngine;
35500 public:
35501 QAlphaPaintEnginePrivate();
35502 ~QAlphaPaintEnginePrivate();
35503 int m_pass;
35504 QPicture *m_pic;
35505 QPaintEngine *m_picengine;
35506 QPainter *m_picpainter;
35507 QPaintEngine::PaintEngineFeatures m_savedcaps;
35508 QPaintDevice *m_pdev;
35509 QRegion m_alphargn;
35510 QRegion m_cliprgn;
35511 bool m_hasalpha;
35512 bool m_alphaPen;
35513 bool m_alphaBrush;
35514 bool m_alphaOpacity;
35515 bool m_advancedPen;
35516 bool m_advancedBrush;
35517 bool m_complexTransform;
35518 bool m_emulateProjectiveTransforms;
35519 bool m_continueCall;
35520 QTransform m_transform;
35521 QPen m_pen;
35522 void addAlphaRect(const QRectF &rect);
35523 QRectF addPenWidth(const QPainterPath &path);
35524 void drawAlphaImage(const QRectF &rect);
35525 QRect toRect(const QRectF &rect) const;
35526 bool fullyContained(const QRectF &rect) const;
35527 void resetState(QPainter *p);
35528 };
35529 typedef QtValidLicenseForGuiModule QtGuiModule;
35530 class __attribute__((visibility("default"))) QPrintEngine
35531 {
35532 public:
35533 virtual ~QPrintEngine() {}
35534 enum PrintEnginePropertyKey {
35535 PPK_CollateCopies,
35536 PPK_ColorMode,
35537 PPK_Creator,
35538 PPK_DocumentName,
35539 PPK_FullPage,
35540 PPK_NumberOfCopies,
35541 PPK_Orientation,
35542 PPK_OutputFileName,
35543 PPK_PageOrder,
35544 PPK_PageRect,
35545 PPK_PageSize,
35546 PPK_PaperRect,
35547 PPK_PaperSource,
35548 PPK_PrinterName,
35549 PPK_PrinterProgram,
35550 PPK_Resolution,
35551 PPK_SelectionOption,
35552 PPK_SupportedResolutions,
35553 PPK_WindowsPageSize,
35554 PPK_FontEmbedding,
35555 PPK_SuppressSystemPrintStatus,
35556 PPK_Duplex,
35557 PPK_PaperSources,
35558 PPK_CustomPaperSize,
35559 PPK_PageMargins,
35560 PPK_PaperSize = PPK_PageSize,
35561 PPK_CustomBase = 0xff00
35562 };
35563 virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value) = 0;
35564 virtual QVariant property(PrintEnginePropertyKey key) const = 0;
35565 virtual bool newPage() = 0;
35566 virtual bool abort() = 0;
35567 virtual int metric(QPaintDevice::PaintDeviceMetric) const = 0;
35568 virtual QPrinter::PrinterState printerState() const = 0;
35569 };
35570 typedef QtValidLicenseForCoreModule QtCoreModule;
35571 class QObject;
35572 class QBufferPrivate;
35573 class __attribute__((visibility("default"))) QBuffer : public QIODevice
35574 {
35575 public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0) { return staticMetaObject.tr(s, c); } static inline QString trUtf8(const char *s, const char *c = 0) { return staticMetaObject.trUtf8(s, c); } static inline QString tr(const char *s, const char *c, int n) { return staticMetaObject.tr(s, c, n); } static inline QString trUtf8(const char *s, const char *c, int n) { return staticMetaObject.trUtf8(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private:
35576 public:
35577 explicit QBuffer(QObject *parent = 0);
35578 QBuffer(QByteArray *buf, QObject *parent = 0);
35579 ~QBuffer();
35580 QByteArray &buffer();
35581 const QByteArray &buffer() const;
35582 void setBuffer(QByteArray *a);
35583 void setData(const QByteArray &data);
35584 inline void setData(const char *data, int len);
35585 const QByteArray &data() const;
35586 bool open(OpenMode openMode);
35587 void close();
35588 qint64 size() const;
35589 qint64 pos() const;
35590 bool seek(qint64 off);
35591 bool atEnd() const;
35592 bool canReadLine() const;
35593 protected:
35594 void connectNotify(const char*);
35595 void disconnectNotify(const char*);
35596 qint64 readData(char *data, qint64 maxlen);
35597 qint64 writeData(const char *data, qint64 len);
35598 private:
35599 inline QBufferPrivate* d_func() { return reinterpret_cast<QBufferPrivate *>(d_ptr); } inline const QBufferPrivate* d_func() const { return reinterpret_cast<const QBufferPrivate *>(d_ptr); } friend class QBufferPrivate;
35600 QBuffer(const QBuffer &); QBuffer &operator=(const QBuffer &);
35601 };
35602 inline void QBuffer::setData(const char *adata, int alen)
35603 { setData(QByteArray(adata, alen)); }
35604 const char *qt_real_to_string(qreal val, char *buf);
35605 const char *qt_int_to_string(int val, char *buf);
35606 namespace QPdf {
35607 class ByteStream
35608 {
35609 public:
35610 explicit ByteStream(bool fileBacking = false);
35611 explicit ByteStream(QByteArray *ba, bool fileBacking = false);
35612 ~ByteStream();
35613 ByteStream &operator <<(char chr);
35614 ByteStream &operator <<(const char *str);
35615 ByteStream &operator <<(const QByteArray &str);
35616 ByteStream &operator <<(const ByteStream &src);
35617 ByteStream &operator <<(qreal val);
35618 ByteStream &operator <<(int val);
35619 ByteStream &operator <<(const QPointF &p);
35620 QIODevice *stream();
35621 void clear();
35622 static inline int maxMemorySize() { return 100000000; }
35623 static inline int chunkSize() { return 10000000; }
35624 protected:
35625 void constructor_helper(QIODevice *dev);
35626 void constructor_helper(QByteArray *ba);
35627 private:
35628 void prepareBuffer();
35629 private:
35630 QIODevice *dev;
35631 QByteArray ba;
35632 bool fileBackingEnabled;
35633 bool fileBackingActive;
35634 bool handleDirty;
35635 };
35636 enum PathFlags {
35637 ClipPath,
35638 FillPath,
35639 StrokePath,
35640 FillAndStrokePath
35641 };
35642 QByteArray generatePath(const QPainterPath &path, const QTransform &matrix, PathFlags flags);
35643 QByteArray generateMatrix(const QTransform &matrix);
35644 QByteArray generateDashes(const QPen &pen);
35645 QByteArray patternForBrush(const QBrush &b);
35646 struct Stroker {
35647 Stroker();
35648 void setPen(const QPen &pen);
35649 void strokePath(const QPainterPath &path);
35650 ByteStream *stream;
35651 bool first;
35652 QTransform matrix;
35653 bool cosmeticPen;
35654 private:
35655 QStroker basicStroker;
35656 QDashStroker dashStroker;
35657 QStrokerOps *stroker;
35658 };
35659 QByteArray ascii85Encode(const QByteArray &input);
35660 const char *toHex(ushort u, char *buffer);
35661 const char *toHex(uchar u, char *buffer);
35662 struct PaperSize {
35663 int width, height;
35664 };
35665 PaperSize paperSize(QPrinter::PaperSize paperSize);
35666 const char *paperSizeToString(QPrinter::PaperSize paperSize);
35667 QByteArray stripSpecialCharacters(const QByteArray &string);
35668 };
35669 class QPdfPage : public QPdf::ByteStream
35670 {
35671 public:
35672 QPdfPage();
35673 QVector<uint> images;
35674 QVector<uint> graphicStates;
35675 QVector<uint> patterns;
35676 QVector<uint> fonts;
35677 QVector<uint> annotations;
35678 void streamImage(int w, int h, int object);
35679 QSize pageSize;
35680 private:
35681 };
35682 class QPdfBaseEnginePrivate;
35683 class QPdfBaseEngine : public QAlphaPaintEngine, public QPrintEngine
35684 {
35685 inline QPdfBaseEnginePrivate* d_func() { return reinterpret_cast<QPdfBaseEnginePrivate *>(d_ptr); } inline const QPdfBaseEnginePrivate* d_func() const { return reinterpret_cast<const QPdfBaseEnginePrivate *>(d_ptr); } friend class QPdfBaseEnginePrivate;
35686 public:
35687 QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f);
35688 ~QPdfBaseEngine() {}
35689 bool begin(QPaintDevice *pdev);
35690 bool end();
35691 void drawPoints(const QPointF *points, int pointCount);
35692 void drawLines(const QLineF *lines, int lineCount);
35693 void drawRects(const QRectF *rects, int rectCount);
35694 void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
35695 void drawPath (const QPainterPath & path);
35696 void drawTextItem(const QPointF &p, const QTextItem &textItem);
35697 void updateState(const QPaintEngineState &state);
35698 int metric(QPaintDevice::PaintDeviceMetric metricType) const;
35699 bool newPage();
35700 void setProperty(PrintEnginePropertyKey key, const QVariant &value);
35701 QVariant property(PrintEnginePropertyKey key) const;
35702 void setPen();
35703 virtual void setBrush() = 0;
35704 void setupGraphicsState(QPaintEngine::DirtyFlags flags);
35705 private:
35706 void updateClipPath(const QPainterPath & path, Qt::ClipOperation op);
35707 friend int qt_printerRealNumCopies(QPaintEngine *);
35708 };
35709 class QPdfBaseEnginePrivate : public QAlphaPaintEnginePrivate
35710 {
35711 inline QPdfBaseEngine* q_func() { return static_cast<QPdfBaseEngine *>(q_ptr); } inline const QPdfBaseEngine* q_func() const { return static_cast<const QPdfBaseEngine *>(q_ptr); } friend class QPdfBaseEngine;
35712 public:
35713 QPdfBaseEnginePrivate(QPrinter::PrinterMode m);
35714 ~QPdfBaseEnginePrivate();
35715 bool openPrintDevice();
35716 void closePrintDevice();
35717 virtual void drawTextItem(const QPointF &p, const QTextItemInt &ti);
35718 inline uint requestObject() { return currentObject++; }
35719 QRect paperRect() const;
35720 QRect pageRect() const;
35721 bool postscript;
35722 int currentObject;
35723 QPdfPage* currentPage;
35724 QPdf::Stroker stroker;
35725 QPointF brushOrigin;
35726 QBrush brush;
35727 QPen pen;
35728 QList<QPainterPath> clips;
35729 bool clipEnabled;
35730 bool allClipped;
35731 bool hasPen;
35732 bool hasBrush;
35733 bool simplePen;
35734 qreal opacity;
35735 bool useAlphaEngine;
35736 QHash<QFontEngine::FaceId, QFontSubset *> fonts;
35737 QPaintDevice *pdev;
35738 QIODevice *outDevice;
35739 int fd;
35740 QString outputFileName;
35741 QString printerName;
35742 QString printProgram;
35743 QString selectionOption;
35744 QString title;
35745 QString creator;
35746 QPrinter::DuplexMode duplex;
35747 bool collate;
35748 bool fullPage;
35749 bool embedFonts;
35750 int copies;
35751 int resolution;
35752 QPrinter::PageOrder pageOrder;
35753 QPrinter::Orientation orientation;
35754 QPrinter::PaperSize paperSize;
35755 QPrinter::ColorMode colorMode;
35756 QPrinter::PaperSource paperSource;
35757 QStringList cupsOptions;
35758 QRect cupsPaperRect;
35759 QRect cupsPageRect;
35760 QString cupsStringPageSize;
35761 QSizeF customPaperSize;
35762 bool hasCustomPageMargins;
35763 qreal leftMargin, topMargin, rightMargin, bottomMargin;
35764 };
35765 extern "C" {
35766 typedef double float_t;
35767 typedef double double_t;
35768 extern double acos (double __x) throw (); extern double __acos (double __x) throw ();
35769 extern double asin (double __x) throw (); extern double __asin (double __x) throw ();
35770 extern double atan (double __x) throw (); extern double __atan (double __x) throw ();
35771 extern double atan2 (double __y, double __x) throw (); extern double __atan2 (double __y, double __x) throw ();
35772 extern double cos (double __x) throw (); extern double __cos (double __x) throw ();
35773 extern double sin (double __x) throw (); extern double __sin (double __x) throw ();
35774 extern double tan (double __x) throw (); extern double __tan (double __x) throw ();
35775 extern double cosh (double __x) throw (); extern double __cosh (double __x) throw ();
35776 extern double sinh (double __x) throw (); extern double __sinh (double __x) throw ();
35777 extern double tanh (double __x) throw (); extern double __tanh (double __x) throw ();
35778 extern double acosh (double __x) throw (); extern double __acosh (double __x) throw ();
35779 extern double asinh (double __x) throw (); extern double __asinh (double __x) throw ();
35780 extern double atanh (double __x) throw (); extern double __atanh (double __x) throw ();
35781 extern double exp (double __x) throw (); extern double __exp (double __x) throw ();
35782 extern double frexp (double __x, int *__exponent) throw (); extern double __frexp (double __x, int *__exponent) throw ();
35783 extern double ldexp (double __x, int __exponent) throw (); extern double __ldexp (double __x, int __exponent) throw ();
35784 extern double log (double __x) throw (); extern double __log (double __x) throw ();
35785 extern double log10 (double __x) throw (); extern double __log10 (double __x) throw ();
35786 extern double modf (double __x, double *__iptr) throw (); extern double __modf (double __x, double *__iptr) throw ();
35787 extern double expm1 (double __x) throw (); extern double __expm1 (double __x) throw ();
35788 extern double log1p (double __x) throw (); extern double __log1p (double __x) throw ();
35789 extern double logb (double __x) throw (); extern double __logb (double __x) throw ();
35790 extern double exp2 (double __x) throw (); extern double __exp2 (double __x) throw ();
35791 extern double log2 (double __x) throw (); extern double __log2 (double __x) throw ();
35792 extern double pow (double __x, double __y) throw (); extern double __pow (double __x, double __y) throw ();
35793 extern double sqrt (double __x) throw (); extern double __sqrt (double __x) throw ();
35794 extern double hypot (double __x, double __y) throw (); extern double __hypot (double __x, double __y) throw ();
35795 extern double cbrt (double __x) throw (); extern double __cbrt (double __x) throw ();
35796 extern double ceil (double __x) throw () __attribute__ ((__const__)); extern double __ceil (double __x) throw () __attribute__ ((__const__));
35797 extern double fabs (double __x) throw () __attribute__ ((__const__)); extern double __fabs (double __x) throw () __attribute__ ((__const__));
35798 extern double floor (double __x) throw () __attribute__ ((__const__)); extern double __floor (double __x) throw () __attribute__ ((__const__));
35799 extern double fmod (double __x, double __y) throw (); extern double __fmod (double __x, double __y) throw ();
35800 extern int __isinf (double __value) throw () __attribute__ ((__const__));
35801 extern int __finite (double __value) throw () __attribute__ ((__const__));
35802 extern int isinf (double __value) throw () __attribute__ ((__const__));
35803 extern int finite (double __value) throw () __attribute__ ((__const__));
35804 extern double drem (double __x, double __y) throw (); extern double __drem (double __x, double __y) throw ();
35805 extern double significand (double __x) throw (); extern double __significand (double __x) throw ();
35806 extern double copysign (double __x, double __y) throw () __attribute__ ((__const__)); extern double __copysign (double __x, double __y) throw () __attribute__ ((__const__));
35807 extern double nan (__const char *__tagb) throw () __attribute__ ((__const__)); extern double __nan (__const char *__tagb) throw () __attribute__ ((__const__));
35808 extern int __isnan (double __value) throw () __attribute__ ((__const__));
35809 extern int isnan (double __value) throw () __attribute__ ((__const__));
35810 extern double j0 (double) throw (); extern double __j0 (double) throw ();
35811 extern double j1 (double) throw (); extern double __j1 (double) throw ();
35812 extern double jn (int, double) throw (); extern double __jn (int, double) throw ();
35813 extern double y0 (double) throw (); extern double __y0 (double) throw ();
35814 extern double y1 (double) throw (); extern double __y1 (double) throw ();
35815 extern double yn (int, double) throw (); extern double __yn (int, double) throw ();
35816 extern double erf (double) throw (); extern double __erf (double) throw ();
35817 extern double erfc (double) throw (); extern double __erfc (double) throw ();
35818 extern double lgamma (double) throw (); extern double __lgamma (double) throw ();
35819 extern double tgamma (double) throw (); extern double __tgamma (double) throw ();
35820 extern double gamma (double) throw (); extern double __gamma (double) throw ();
35821 extern double lgamma_r (double, int *__signgamp) throw (); extern double __lgamma_r (double, int *__signgamp) throw ();
35822 extern double rint (double __x) throw (); extern double __rint (double __x) throw ();
35823 extern double nextafter (double __x, double __y) throw () __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) throw () __attribute__ ((__const__));
35824 extern double nexttoward (double __x, long double __y) throw () __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) throw () __attribute__ ((__const__));
35825 extern double remainder (double __x, double __y) throw (); extern double __remainder (double __x, double __y) throw ();
35826 extern double scalbn (double __x, int __n) throw (); extern double __scalbn (double __x, int __n) throw ();
35827 extern int ilogb (double __x) throw (); extern int __ilogb (double __x) throw ();
35828 extern double scalbln (double __x, long int __n) throw (); extern double __scalbln (double __x, long int __n) throw ();
35829 extern double nearbyint (double __x) throw (); extern double __nearbyint (double __x) throw ();
35830 extern double round (double __x) throw () __attribute__ ((__const__)); extern double __round (double __x) throw () __attribute__ ((__const__));
35831 extern double trunc (double __x) throw () __attribute__ ((__const__)); extern double __trunc (double __x) throw () __attribute__ ((__const__));
35832 extern double remquo (double __x, double __y, int *__quo) throw (); extern double __remquo (double __x, double __y, int *__quo) throw ();
35833 extern long int lrint (double __x) throw (); extern long int __lrint (double __x) throw ();
35834 extern long long int llrint (double __x) throw (); extern long long int __llrint (double __x) throw ();
35835 extern long int lround (double __x) throw (); extern long int __lround (double __x) throw ();
35836 extern long long int llround (double __x) throw (); extern long long int __llround (double __x) throw ();
35837 extern double fdim (double __x, double __y) throw (); extern double __fdim (double __x, double __y) throw ();
35838 extern double fmax (double __x, double __y) throw (); extern double __fmax (double __x, double __y) throw ();
35839 extern double fmin (double __x, double __y) throw (); extern double __fmin (double __x, double __y) throw ();
35840 extern int __fpclassify (double __value) throw ()
35841 __attribute__ ((__const__));
35842 extern int __signbit (double __value) throw ()
35843 __attribute__ ((__const__));
35844 extern double fma (double __x, double __y, double __z) throw (); extern double __fma (double __x, double __y, double __z) throw ();
35845 extern double scalb (double __x, double __n) throw (); extern double __scalb (double __x, double __n) throw ();
35846 extern float acosf (float __x) throw (); extern float __acosf (float __x) throw ();
35847 extern float asinf (float __x) throw (); extern float __asinf (float __x) throw ();
35848 extern float atanf (float __x) throw (); extern float __atanf (float __x) throw ();
35849 extern float atan2f (float __y, float __x) throw (); extern float __atan2f (float __y, float __x) throw ();
35850 extern float cosf (float __x) throw (); extern float __cosf (float __x) throw ();
35851 extern float sinf (float __x) throw (); extern float __sinf (float __x) throw ();
35852 extern float tanf (float __x) throw (); extern float __tanf (float __x) throw ();
35853 extern float coshf (float __x) throw (); extern float __coshf (float __x) throw ();
35854 extern float sinhf (float __x) throw (); extern float __sinhf (float __x) throw ();
35855 extern float tanhf (float __x) throw (); extern float __tanhf (float __x) throw ();
35856 extern float acoshf (float __x) throw (); extern float __acoshf (float __x) throw ();
35857 extern float asinhf (float __x) throw (); extern float __asinhf (float __x) throw ();
35858 extern float atanhf (float __x) throw (); extern float __atanhf (float __x) throw ();
35859 extern float expf (float __x) throw (); extern float __expf (float __x) throw ();
35860 extern float frexpf (float __x, int *__exponent) throw (); extern float __frexpf (float __x, int *__exponent) throw ();
35861 extern float ldexpf (float __x, int __exponent) throw (); extern float __ldexpf (float __x, int __exponent) throw ();
35862 extern float logf (float __x) throw (); extern float __logf (float __x) throw ();
35863 extern float log10f (float __x) throw (); extern float __log10f (float __x) throw ();
35864 extern float modff (float __x, float *__iptr) throw (); extern float __modff (float __x, float *__iptr) throw ();
35865 extern float expm1f (float __x) throw (); extern float __expm1f (float __x) throw ();
35866 extern float log1pf (float __x) throw (); extern float __log1pf (float __x) throw ();
35867 extern float logbf (float __x) throw (); extern float __logbf (float __x) throw ();
35868 extern float exp2f (float __x) throw (); extern float __exp2f (float __x) throw ();
35869 extern float log2f (float __x) throw (); extern float __log2f (float __x) throw ();
35870 extern float powf (float __x, float __y) throw (); extern float __powf (float __x, float __y) throw ();
35871 extern float sqrtf (float __x) throw (); extern float __sqrtf (float __x) throw ();
35872 extern float hypotf (float __x, float __y) throw (); extern float __hypotf (float __x, float __y) throw ();
35873 extern float cbrtf (float __x) throw (); extern float __cbrtf (float __x) throw ();
35874 extern float ceilf (float __x) throw () __attribute__ ((__const__)); extern float __ceilf (float __x) throw () __attribute__ ((__const__));
35875 extern float fabsf (float __x) throw () __attribute__ ((__const__)); extern float __fabsf (float __x) throw () __attribute__ ((__const__));
35876 extern float floorf (float __x) throw () __attribute__ ((__const__)); extern float __floorf (float __x) throw () __attribute__ ((__const__));
35877 extern float fmodf (float __x, float __y) throw (); extern float __fmodf (float __x, float __y) throw ();
35878 extern int __isinff (float __value) throw () __attribute__ ((__const__));
35879 extern int __finitef (float __value) throw () __attribute__ ((__const__));
35880 extern int isinff (float __value) throw () __attribute__ ((__const__));
35881 extern int finitef (float __value) throw () __attribute__ ((__const__));
35882 extern float dremf (float __x, float __y) throw (); extern float __dremf (float __x, float __y) throw ();
35883 extern float significandf (float __x) throw (); extern float __significandf (float __x) throw ();
35884 extern float copysignf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) throw () __attribute__ ((__const__));
35885 extern float nanf (__const char *__tagb) throw () __attribute__ ((__const__)); extern float __nanf (__const char *__tagb) throw () __attribute__ ((__const__));
35886 extern int __isnanf (float __value) throw () __attribute__ ((__const__));
35887 extern int isnanf (float __value) throw () __attribute__ ((__const__));
35888 extern float j0f (float) throw (); extern float __j0f (float) throw ();
35889 extern float j1f (float) throw (); extern float __j1f (float) throw ();
35890 extern float jnf (int, float) throw (); extern float __jnf (int, float) throw ();
35891 extern float y0f (float) throw (); extern float __y0f (float) throw ();
35892 extern float y1f (float) throw (); extern float __y1f (float) throw ();
35893 extern float ynf (int, float) throw (); extern float __ynf (int, float) throw ();
35894 extern float erff (float) throw (); extern float __erff (float) throw ();
35895 extern float erfcf (float) throw (); extern float __erfcf (float) throw ();
35896 extern float lgammaf (float) throw (); extern float __lgammaf (float) throw ();
35897 extern float tgammaf (float) throw (); extern float __tgammaf (float) throw ();
35898 extern float gammaf (float) throw (); extern float __gammaf (float) throw ();
35899 extern float lgammaf_r (float, int *__signgamp) throw (); extern float __lgammaf_r (float, int *__signgamp) throw ();
35900 extern float rintf (float __x) throw (); extern float __rintf (float __x) throw ();
35901 extern float nextafterf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) throw () __attribute__ ((__const__));
35902 extern float nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__));
35903 extern float remainderf (float __x, float __y) throw (); extern float __remainderf (float __x, float __y) throw ();
35904 extern float scalbnf (float __x, int __n) throw (); extern float __scalbnf (float __x, int __n) throw ();
35905 extern int ilogbf (float __x) throw (); extern int __ilogbf (float __x) throw ();
35906 extern float scalblnf (float __x, long int __n) throw (); extern float __scalblnf (float __x, long int __n) throw ();
35907 extern float nearbyintf (float __x) throw (); extern float __nearbyintf (float __x) throw ();
35908 extern float roundf (float __x) throw () __attribute__ ((__const__)); extern float __roundf (float __x) throw () __attribute__ ((__const__));
35909 extern float truncf (float __x) throw () __attribute__ ((__const__)); extern float __truncf (float __x) throw () __attribute__ ((__const__));
35910 extern float remquof (float __x, float __y, int *__quo) throw (); extern float __remquof (float __x, float __y, int *__quo) throw ();
35911 extern long int lrintf (float __x) throw (); extern long int __lrintf (float __x) throw ();
35912 extern long long int llrintf (float __x) throw (); extern long long int __llrintf (float __x) throw ();
35913 extern long int lroundf (float __x) throw (); extern long int __lroundf (float __x) throw ();
35914 extern long long int llroundf (float __x) throw (); extern long long int __llroundf (float __x) throw ();
35915 extern float fdimf (float __x, float __y) throw (); extern float __fdimf (float __x, float __y) throw ();
35916 extern float fmaxf (float __x, float __y) throw (); extern float __fmaxf (float __x, float __y) throw ();
35917 extern float fminf (float __x, float __y) throw (); extern float __fminf (float __x, float __y) throw ();
35918 extern int __fpclassifyf (float __value) throw ()
35919 __attribute__ ((__const__));
35920 extern int __signbitf (float __value) throw ()
35921 __attribute__ ((__const__));
35922 extern float fmaf (float __x, float __y, float __z) throw (); extern float __fmaf (float __x, float __y, float __z) throw ();
35923 extern float scalbf (float __x, float __n) throw (); extern float __scalbf (float __x, float __n) throw ();
35924 extern int signgam;
35925 enum
35926 {
35927 FP_NAN,
35928 FP_INFINITE,
35929 FP_ZERO,
35930 FP_SUBNORMAL,
35931 FP_NORMAL
35932 };
35933 typedef enum
35934 {
35935 _IEEE_ = -1,
35936 _SVID_,
35937 _XOPEN_,
35938 _POSIX_,
35939 _ISOC_
35940 } _LIB_VERSION_TYPE;
35941 extern _LIB_VERSION_TYPE _LIB_VERSION;
35942 struct __exception
35943 {
35944 int type;
35945 char *name;
35946 double arg1;
35947 double arg2;
35948 double retval;
35949 };
35950 extern int matherr (struct __exception *__exc) throw ();
35951 }
35952 typedef QtValidLicenseForCoreModule QtCoreModule;
35953 inline int qCeil(qreal v)
35954 {
35955 if (sizeof(qreal) == sizeof(float))
35956 return int(ceilf(v));
35957 else
35958 return int(ceil(v));
35959 }
35960 inline int qFloor(qreal v)
35961 {
35962 if (sizeof(qreal) == sizeof(float))
35963 return int(floorf(v));
35964 else
35965 return int(floor(v));
35966 }
35967 inline qreal qSin(qreal v)
35968 {
35969 if (sizeof(qreal) == sizeof(float))
35970 return sinf(v);
35971 else
35972 return sin(v);
35973 }
35974 inline qreal qCos(qreal v)
35975 {
35976 if (sizeof(qreal) == sizeof(float))
35977 return cosf(v);
35978 else
35979 return cos(v);
35980 }
35981 inline qreal qAcos(qreal v)
35982 {
35983 if (sizeof(qreal) == sizeof(float))
35984 return acosf(v);
35985 else
35986 return acos(v);
35987 }
35988 inline qreal qSqrt(qreal v)
35989 {
35990 if (sizeof(qreal) == sizeof(float))
35991 return sqrtf(v);
35992 else
35993 return sqrt(v);
35994 }
35995 inline qreal qLn(qreal v)
35996 {
35997 if (sizeof(qreal) == sizeof(float))
35998 return logf(v);
35999 else
36000 return log(v);
36001 }
36002 inline qreal qPow(qreal x, qreal y)
36003 {
36004 if (sizeof(qreal) == sizeof(float))
36005 return powf(x, y);
36006 else
36007 return pow(x, y);
36008 }
36009 typedef QtValidLicenseForCoreModule QtCoreModule;
36010 inline void qbswap_helper(const uchar *src, uchar *dest, int size)
36011 {
36012 for (int i = 0; i < size ; ++i) dest[i] = src[size - 1 - i];
36013 }
36014 template <typename T> inline void qbswap(const T src, uchar *dest)
36015 {
36016 qbswap_helper(reinterpret_cast<const uchar *>(&src), dest, sizeof(T));
36017 }
36018 template <typename T> inline void qToUnaligned(const T src, uchar *dest)
36019 {
36020 qMemCopy(dest, &src, sizeof(T));
36021 }
36022 template <typename T> inline T qFromLittleEndian(const uchar *src);
36023 template <> inline quint64 qFromLittleEndian<quint64>(const uchar *src)
36024 {
36025 return 0
36026 | src[0]
36027 | src[1] * static_cast<unsigned long long>(0x0000000000000100ULL)
36028 | src[2] * static_cast<unsigned long long>(0x0000000000010000ULL)
36029 | src[3] * static_cast<unsigned long long>(0x0000000001000000ULL)
36030 | src[4] * static_cast<unsigned long long>(0x0000000100000000ULL)
36031 | src[5] * static_cast<unsigned long long>(0x0000010000000000ULL)
36032 | src[6] * static_cast<unsigned long long>(0x0001000000000000ULL)
36033 | src[7] * static_cast<unsigned long long>(0x0100000000000000ULL);
36034 }
36035 template <> inline quint32 qFromLittleEndian<quint32>(const uchar *src)
36036 {
36037 return 0
36038 | src[0]
36039 | src[1] * quint32(0x00000100)
36040 | src[2] * quint32(0x00010000)
36041 | src[3] * quint32(0x01000000);
36042 }
36043 template <> inline quint16 qFromLittleEndian<quint16>(const uchar *src)
36044 {
36045 return 0
36046 | src[0]
36047 | src[1] * 0x0100;
36048 }
36049 template <> inline qint64 qFromLittleEndian<qint64>(const uchar *src)
36050 { return static_cast<qint64>(qFromLittleEndian<quint64>(src)); }
36051 template <> inline qint32 qFromLittleEndian<qint32>(const uchar *src)
36052 { return static_cast<qint32>(qFromLittleEndian<quint32>(src)); }
36053 template <> inline qint16 qFromLittleEndian<qint16>(const uchar *src)
36054 { return static_cast<qint16>(qFromLittleEndian<quint16>(src)); }
36055 template <class T> inline T qFromBigEndian(const uchar *src);
36056 template<>
36057 inline quint64 qFromBigEndian<quint64>(const uchar *src)
36058 {
36059 return 0
36060 | src[7]
36061 | src[6] * static_cast<unsigned long long>(0x0000000000000100ULL)
36062 | src[5] * static_cast<unsigned long long>(0x0000000000010000ULL)
36063 | src[4] * static_cast<unsigned long long>(0x0000000001000000ULL)
36064 | src[3] * static_cast<unsigned long long>(0x0000000100000000ULL)
36065 | src[2] * static_cast<unsigned long long>(0x0000010000000000ULL)
36066 | src[1] * static_cast<unsigned long long>(0x0001000000000000ULL)
36067 | src[0] * static_cast<unsigned long long>(0x0100000000000000ULL);
36068 }
36069 template<>
36070 inline quint32 qFromBigEndian<quint32>(const uchar *src)
36071 {
36072 return 0
36073 | src[3]
36074 | src[2] * quint32(0x00000100)
36075 | src[1] * quint32(0x00010000)
36076 | src[0] * quint32(0x01000000);
36077 }
36078 template<>
36079 inline quint16 qFromBigEndian<quint16>(const uchar *src)
36080 {
36081 return 0
36082 | src[1]
36083 | src[0] * quint16(0x0100);
36084 }
36085 template <> inline qint64 qFromBigEndian<qint64>(const uchar *src)
36086 { return static_cast<qint64>(qFromBigEndian<quint64>(src)); }
36087 template <> inline qint32 qFromBigEndian<qint32>(const uchar *src)
36088 { return static_cast<qint32>(qFromBigEndian<quint32>(src)); }
36089 template <> inline qint16 qFromBigEndian<qint16>(const uchar *src)
36090 { return static_cast<qint16>(qFromBigEndian<quint16>(src)); }
36091 template <typename T> T qbswap(T source);
36092 template <> inline quint64 qbswap<quint64>(quint64 source)
36093 {
36094 return 0
36095 | ((source & static_cast<unsigned long long>(0x00000000000000ffULL)) << 56)
36096 | ((source & static_cast<unsigned long long>(0x000000000000ff00ULL)) << 40)
36097 | ((source & static_cast<unsigned long long>(0x0000000000ff0000ULL)) << 24)
36098 | ((source & static_cast<unsigned long long>(0x00000000ff000000ULL)) << 8)
36099 | ((source & static_cast<unsigned long long>(0x000000ff00000000ULL)) >> 8)
36100 | ((source & static_cast<unsigned long long>(0x0000ff0000000000ULL)) >> 24)
36101 | ((source & static_cast<unsigned long long>(0x00ff000000000000ULL)) >> 40)
36102 | ((source & static_cast<unsigned long long>(0xff00000000000000ULL)) >> 56);
36103 }
36104 template <> inline quint32 qbswap<quint32>(quint32 source)
36105 {
36106 return 0
36107 | ((source & 0x000000ff) << 24)
36108 | ((source & 0x0000ff00) << 8)
36109 | ((source & 0x00ff0000) >> 8)
36110 | ((source & 0xff000000) >> 24);
36111 }
36112 template <> inline quint16 qbswap<quint16>(quint16 source)
36113 {
36114 return 0
36115 | ((source & 0x00ff) << 8)
36116 | ((source & 0xff00) >> 8);
36117 }
36118 template <> inline qint64 qbswap<qint64>(qint64 source)
36119 {
36120 return qbswap<quint64>(quint64(source));
36121 }
36122 template <> inline qint32 qbswap<qint32>(qint32 source)
36123 {
36124 return qbswap<quint32>(quint32(source));
36125 }
36126 template <> inline qint16 qbswap<qint16>(qint16 source)
36127 {
36128 return qbswap<quint16>(quint16(source));
36129 }
36130 template <typename T> inline T qToBigEndian(T source)
36131 { return qbswap<T>(source); }
36132 template <typename T> inline T qFromBigEndian(T source)
36133 { return qbswap<T>(source); }
36134 template <typename T> inline T qToLittleEndian(T source)
36135 { return source; }
36136 template <typename T> inline T qFromLittleEndian(T source)
36137 { return source; }
36138 template <typename T> inline void qToBigEndian(T src, uchar *dest)
36139 { qbswap<T>(src, dest); }
36140 template <typename T> inline void qToLittleEndian(T src, uchar *dest)
36141 { qToUnaligned<T>(src, dest); }
36142 static inline bool qtransform_equals_no_translate(const QTransform &a, const QTransform &b)
36143 {
36144 if (a.type() <= QTransform::TxTranslate && b.type() <= QTransform::TxTranslate) {
36145 return true;
36146 } else {
36147 qt_noop();
36148 qt_noop();
36149 return a.m11() == b.m11()
36150 && a.m12() == b.m12()
36151 && a.m21() == b.m21()
36152 && a.m22() == b.m22();
36153 }
36154 }
36155 QFontEngineGlyphCache::~QFontEngineGlyphCache()
36156 {
36157 }
36158 static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft)
36159 {
36160 QFontEngine *fe = (QFontEngine *)font->userData;
36161 QVarLengthGlyphLayoutArray qglyphs(*numGlyphs);
36162 QTextEngine::ShaperFlags shaperFlags(QTextEngine::GlyphIndicesOnly);
36163 if (rightToLeft)
36164 shaperFlags |= QTextEngine::RightToLeft;
36165 int nGlyphs = *numGlyphs;
36166 bool result = fe->stringToCMap(reinterpret_cast<const QChar *>(string), length, &qglyphs, &nGlyphs, shaperFlags);
36167 *numGlyphs = nGlyphs;
36168 if (!result)
36169 return false;
36170 for (hb_uint32 i = 0; i < *numGlyphs; ++i)
36171 glyphs[i] = qglyphs.glyphs[i];
36172 return true;
36173 }
36174 static void hb_getAdvances(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags)
36175 {
36176 QFontEngine *fe = (QFontEngine *)font->userData;
36177 QVarLengthGlyphLayoutArray qglyphs(numGlyphs);
36178 for (hb_uint32 i = 0; i < numGlyphs; ++i)
36179 qglyphs.glyphs[i] = glyphs[i];
36180 fe->recalcAdvances(&qglyphs, flags & HB_ShaperFlag_UseDesignMetrics ? QFlags<QTextEngine::ShaperFlag>(QTextEngine::DesignMetrics) : QFlags<QTextEngine::ShaperFlag>(0));
36181 for (hb_uint32 i = 0; i < numGlyphs; ++i)
36182 advances[i] = qglyphs.advances_x[i].value();
36183 }
36184 static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length)
36185 {
36186 QFontEngine *fe = (QFontEngine *)font->userData;
36187 return fe->canRender(reinterpret_cast<const QChar *>(string), length);
36188 }
36189 static void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
36190 {
36191 QFontEngine *fe = (QFontEngine *)font->userData;
36192 glyph_metrics_t m = fe->boundingBox(glyph);
36193 metrics->x = m.x.value();
36194 metrics->y = m.y.value();
36195 metrics->width = m.width.value();
36196 metrics->height = m.height.value();
36197 metrics->xOffset = m.xoff.value();
36198 metrics->yOffset = m.yoff.value();
36199 }
36200 static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
36201 {
36202 if (metric == HB_FontAscent) {
36203 QFontEngine *fe = (QFontEngine *)font->userData;
36204 return fe->ascent().value();
36205 }
36206 return 0;
36207 }
36208 HB_Error QFontEngine::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
36209 {
36210 (void)glyph;
36211 (void)flags;
36212 (void)point;
36213 (void)xpos;
36214 (void)ypos;
36215 (void)nPoints;
36216 return HB_Err_Not_Covered;
36217 }
36218 static HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
36219 {
36220 QFontEngine *fe = (QFontEngine *)font->userData;
36221 return fe->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints);
36222 }
36223 static const HB_FontClass hb_fontClass = {
36224 hb_stringToGlyphs, hb_getAdvances, hb_canRender, hb_getPointInOutline,
36225 hb_getGlyphMetrics, hb_getFontMetric
36226 };
36227 static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length)
36228 {
36229 QFontEngine *fe = (QFontEngine *)font;
36230 if (!fe->getSfntTableData(tableTag, buffer, length))
36231 return HB_Err_Invalid_Argument;
36232 return HB_Err_Ok;
36233 }
36234 QFontEngine::QFontEngine()
36235 : QObject()
36236 {
36237 ref = 0;
36238 cache_count = 0;
36239 fsType = 0;
36240 symbol = false;
36241 memset(&hbFont, 0, sizeof(hbFont));
36242 hbFont.klass = &hb_fontClass;
36243 hbFont.userData = this;
36244 hbFace = 0;
36245 glyphFormat = -1;
36246 }
36247 QFontEngine::~QFontEngine()
36248 {
36249 for (GlyphPointerHash::iterator it = m_glyphPointerHash.begin(), end = m_glyphPointerHash.end();
36250 it != end; ++it) {
36251 for (QList<QFontEngineGlyphCache*>::iterator it2 = it.value().begin(), end2 = it.value().end();
36252 it2 != end2; ++it2)
36253 delete *it2;
36254 }
36255 m_glyphPointerHash.clear();
36256 for (GlyphIntHash::iterator it = m_glyphIntHash.begin(), end = m_glyphIntHash.end();
36257 it != end; ++it) {
36258 for (QList<QFontEngineGlyphCache*>::iterator it2 = it.value().begin(), end2 = it.value().end();
36259 it2 != end2; ++it2)
36260 delete *it2;
36261 }
36262 m_glyphIntHash.clear();
36263 qHBFreeFace(hbFace);
36264 }
36265 QFixed QFontEngine::lineThickness() const
36266 {
36267 int score = fontDef.weight * fontDef.pixelSize;
36268 int lw = score / 700;
36269 if (lw < 2 && score >= 1050) lw = 2;
36270 if (lw == 0) lw = 1;
36271 return lw;
36272 }
36273 QFixed QFontEngine::underlinePosition() const
36274 {
36275 return ((lineThickness() * 2) + 3) / 6;
36276 }
36277 HB_Font QFontEngine::harfbuzzFont() const
36278 {
36279 if (!hbFont.x_ppem) {
36280 QFixed emSquare = emSquareSize();
36281 hbFont.x_ppem = fontDef.pixelSize;
36282 hbFont.y_ppem = fontDef.pixelSize * fontDef.stretch / 100;
36283 hbFont.x_scale = (QFixed(hbFont.x_ppem * (1 << 16)) / emSquare).value();
36284 hbFont.y_scale = (QFixed(hbFont.y_ppem * (1 << 16)) / emSquare).value();
36285 }
36286 return &hbFont;
36287 }
36288 HB_Face QFontEngine::harfbuzzFace() const
36289 {
36290 if (!hbFace)
36291 hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable);
36292 return hbFace;
36293 }
36294 glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
36295 {
36296 glyph_metrics_t metrics = boundingBox(glyph);
36297 if (matrix.type() > QTransform::TxTranslate) {
36298 return metrics.transformed(matrix);
36299 }
36300 return metrics;
36301 }
36302 QFixed QFontEngine::xHeight() const
36303 {
36304 QGlyphLayoutArray<8> glyphs;
36305 int nglyphs = 7;
36306 QChar x((ushort)'x');
36307 stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
36308 glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]);
36309 return bb.height;
36310 }
36311 QFixed QFontEngine::averageCharWidth() const
36312 {
36313 QGlyphLayoutArray<8> glyphs;
36314 int nglyphs = 7;
36315 QChar x((ushort)'x');
36316 stringToCMap(&x, 1, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
36317 glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyphs.glyphs[0]);
36318 return bb.xoff;
36319 }
36320 void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags,
36321 QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &positions)
36322 {
36323 QFixed xpos;
36324 QFixed ypos;
36325 const bool transform = matrix.m11() != 1.
36326 || matrix.m12() != 0.
36327 || matrix.m21() != 0.
36328 || matrix.m22() != 1.;
36329 if (!transform) {
36330 xpos = QFixed::fromReal(matrix.dx());
36331 ypos = QFixed::fromReal(matrix.dy());
36332 }
36333 int current = 0;
36334 if (flags & QTextItem::RightToLeft) {
36335 int i = glyphs.numGlyphs;
36336 int totalKashidas = 0;
36337 while(i--) {
36338 xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
36339 ypos += glyphs.advances_y[i];
36340 totalKashidas += glyphs.justifications[i].nKashidas;
36341 }
36342 positions.resize(glyphs.numGlyphs+totalKashidas);
36343 glyphs_out.resize(glyphs.numGlyphs+totalKashidas);
36344 i = 0;
36345 while(i < glyphs.numGlyphs) {
36346 if (glyphs.attributes[i].dontPrint) {
36347 ++i;
36348 continue;
36349 }
36350 xpos -= glyphs.advances_x[i];
36351 ypos -= glyphs.advances_y[i];
36352 QFixed gpos_x = xpos + glyphs.offsets[i].x;
36353 QFixed gpos_y = ypos + glyphs.offsets[i].y;
36354 if (transform) {
36355 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
36356 gpos = gpos * matrix;
36357 gpos_x = QFixed::fromReal(gpos.x());
36358 gpos_y = QFixed::fromReal(gpos.y());
36359 }
36360 positions[current].x = gpos_x;
36361 positions[current].y = gpos_y;
36362 glyphs_out[current] = glyphs.glyphs[i];
36363 ++current;
36364 if (glyphs.justifications[i].nKashidas) {
36365 QChar ch(0x640);
36366 QGlyphLayoutArray<8> g;
36367 int nglyphs = 7;
36368 stringToCMap(&ch, 1, &g, &nglyphs, 0);
36369 for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) {
36370 xpos -= g.advances_x[0];
36371 ypos -= g.advances_y[0];
36372 QFixed gpos_x = xpos + glyphs.offsets[i].x;
36373 QFixed gpos_y = ypos + glyphs.offsets[i].y;
36374 if (transform) {
36375 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
36376 gpos = gpos * matrix;
36377 gpos_x = QFixed::fromReal(gpos.x());
36378 gpos_y = QFixed::fromReal(gpos.y());
36379 }
36380 positions[current].x = gpos_x;
36381 positions[current].y = gpos_y;
36382 glyphs_out[current] = g.glyphs[0];
36383 ++current;
36384 }
36385 } else {
36386 xpos -= QFixed::fromFixed(glyphs.justifications[i].space_18d6);
36387 }
36388 ++i;
36389 }
36390 } else {
36391 positions.resize(glyphs.numGlyphs);
36392 glyphs_out.resize(glyphs.numGlyphs);
36393 int i = 0;
36394 if (!transform) {
36395 while (i < glyphs.numGlyphs) {
36396 if (!glyphs.attributes[i].dontPrint) {
36397 positions[current].x = xpos + glyphs.offsets[i].x;
36398 positions[current].y = ypos + glyphs.offsets[i].y;
36399 glyphs_out[current] = glyphs.glyphs[i];
36400 xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
36401 ypos += glyphs.advances_y[i];
36402 ++current;
36403 }
36404 ++i;
36405 }
36406 } else {
36407 positions.resize(glyphs.numGlyphs);
36408 glyphs_out.resize(glyphs.numGlyphs);
36409 int i = 0;
36410 while (i < glyphs.numGlyphs) {
36411 if (!glyphs.attributes[i].dontPrint) {
36412 QFixed gpos_x = xpos + glyphs.offsets[i].x;
36413 QFixed gpos_y = ypos + glyphs.offsets[i].y;
36414 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
36415 gpos = gpos * matrix;
36416 positions[current].x = QFixed::fromReal(gpos.x());
36417 positions[current].y = QFixed::fromReal(gpos.y());
36418 glyphs_out[current] = glyphs.glyphs[i];
36419 xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
36420 ypos += glyphs.advances_y[i];
36421 ++current;
36422 }
36423 ++i;
36424 }
36425 }
36426 }
36427 positions.resize(current);
36428 glyphs_out.resize(current);
36429 qt_noop();
36430 }
36431 glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
36432 {
36433 glyph_metrics_t overall;
36434 QFixed ymax = 0;
36435 QFixed xmax = 0;
36436 for (int i = 0; i < glyphs.numGlyphs; i++) {
36437 glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]);
36438 QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x;
36439 QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y;
36440 overall.x = qMin(overall.x, x);
36441 overall.y = qMin(overall.y, y);
36442 xmax = qMax(xmax, x + bb.width);
36443 ymax = qMax(ymax, y + bb.height);
36444 overall.xoff += bb.xoff;
36445 overall.yoff += bb.yoff;
36446 }
36447 overall.height = qMax(overall.height, ymax - overall.y);
36448 overall.width = xmax - overall.x;
36449 return overall;
36450 }
36451 void QFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path,
36452 QTextItem::RenderFlags flags)
36453 {
36454 if (!glyphs.numGlyphs)
36455 return;
36456 QVarLengthArray<QFixedPoint> positions;
36457 QVarLengthArray<glyph_t> positioned_glyphs;
36458 QTransform matrix;
36459 matrix.translate(x, y);
36460 getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
36461 addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags);
36462 }
36463 enum { EdgeRight = 0x1,
36464 EdgeDown = 0x2,
36465 EdgeLeft = 0x4,
36466 EdgeUp = 0x8
36467 };
36468 static void collectSingleContour(qreal x0, qreal y0, uint *grid, int x, int y, int w, int h, QPainterPath *path)
36469 {
36470 (void)h;;
36471 path->moveTo(x + x0, y + y0);
36472 while (grid[(y)*(w+1) + (x)]) {
36473 if (grid[(y)*(w+1) + (x)] & EdgeRight) {
36474 while (grid[(y)*(w+1) + (x)] & EdgeRight) {
36475 grid[(y)*(w+1) + (x)] &= ~EdgeRight;
36476 ++x;
36477 }
36478 qt_noop();
36479 path->lineTo(x + x0, y + y0);
36480 continue;
36481 }
36482 if (grid[(y)*(w+1) + (x)] & EdgeDown) {
36483 while (grid[(y)*(w+1) + (x)] & EdgeDown) {
36484 grid[(y)*(w+1) + (x)] &= ~EdgeDown;
36485 ++y;
36486 }
36487 qt_noop();
36488 path->lineTo(x + x0, y + y0);
36489 continue;
36490 }
36491 if (grid[(y)*(w+1) + (x)] & EdgeLeft) {
36492 while (grid[(y)*(w+1) + (x)] & EdgeLeft) {
36493 grid[(y)*(w+1) + (x)] &= ~EdgeLeft;
36494 --x;
36495 }
36496 qt_noop();
36497 path->lineTo(x + x0, y + y0);
36498 continue;
36499 }
36500 if (grid[(y)*(w+1) + (x)] & EdgeUp) {
36501 while (grid[(y)*(w+1) + (x)] & EdgeUp) {
36502 grid[(y)*(w+1) + (x)] &= ~EdgeUp;
36503 --y;
36504 }
36505 qt_noop();
36506 path->lineTo(x + x0, y + y0);
36507 continue;
36508 }
36509 }
36510 path->closeSubpath();
36511 }
36512 void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path)
36513 {
36514 uint *grid = new uint[(w+1)*(h+1)];
36515 for (int y = 0; y <= h; ++y) {
36516 for (int x = 0; x <= w; ++x) {
36517 bool topLeft = (x == 0)|(y == 0) ? false : (*(image_data + (y - 1)*bpl + ((x - 1) >> 3)) & (0x80 >> ((x - 1) & 7)));
36518 bool topRight = (x == w)|(y == 0) ? false : (*(image_data + (y - 1)*bpl + ((x) >> 3)) & (0x80 >> ((x) & 7)));
36519 bool bottomLeft = (x == 0)|(y == h) ? false : (*(image_data + (y)*bpl + ((x - 1) >> 3)) & (0x80 >> ((x - 1) & 7)));
36520 bool bottomRight = (x == w)|(y == h) ? false : (*(image_data + (y)*bpl + ((x) >> 3)) & (0x80 >> ((x) & 7)));
36521 grid[(y)*(w+1) + (x)] = 0;
36522 if ((!topRight) & bottomRight)
36523 grid[(y)*(w+1) + (x)] |= EdgeRight;
36524 if ((!bottomRight) & bottomLeft)
36525 grid[(y)*(w+1) + (x)] |= EdgeDown;
36526 if ((!bottomLeft) & topLeft)
36527 grid[(y)*(w+1) + (x)] |= EdgeLeft;
36528 if ((!topLeft) & topRight)
36529 grid[(y)*(w+1) + (x)] |= EdgeUp;
36530 }
36531 }
36532 for (int y = 0; y < h; ++y) {
36533 for (int x = 0; x < w; ++x) {
36534 if (!grid[(y)*(w+1) + (x)])
36535 continue;
36536 collectSingleContour(x0, y0, grid, x, y, w, h, path);
36537 }
36538 }
36539 delete [] grid;
36540 }
36541 void QFontEngine::addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
36542 QPainterPath *path, QTextItem::RenderFlags flags)
36543 {
36544 (void)flags;;
36545 QFixed advanceX = QFixed::fromReal(x);
36546 QFixed advanceY = QFixed::fromReal(y);
36547 for (int i=0; i < glyphs.numGlyphs; ++i) {
36548 glyph_metrics_t metrics = boundingBox(glyphs.glyphs[i]);
36549 if (metrics.width.value() == 0 || metrics.height.value() == 0) {
36550 advanceX += glyphs.advances_x[i];
36551 advanceY += glyphs.advances_y[i];
36552 continue;
36553 }
36554 const QImage alphaMask = alphaMapForGlyph(glyphs.glyphs[i]);
36555 const int w = alphaMask.width();
36556 const int h = alphaMask.height();
36557 const int srcBpl = alphaMask.bytesPerLine();
36558 QImage bitmap;
36559 if (alphaMask.depth() == 1) {
36560 bitmap = alphaMask;
36561 } else {
36562 bitmap = QImage(w, h, QImage::Format_Mono);
36563 const uchar *imageData = alphaMask.bits();
36564 const int destBpl = bitmap.bytesPerLine();
36565 uchar *bitmapData = bitmap.bits();
36566 for (int yi = 0; yi < h; ++yi) {
36567 const uchar *src = imageData + yi*srcBpl;
36568 uchar *dst = bitmapData + yi*destBpl;
36569 for (int xi = 0; xi < w; ++xi) {
36570 const int byte = xi / 8;
36571 const int bit = xi % 8;
36572 if (bit == 0)
36573 dst[byte] = 0;
36574 if (src[xi])
36575 dst[byte] |= 128 >> bit;
36576 }
36577 }
36578 }
36579 const uchar *bitmap_data = bitmap.bits();
36580 QFixedPoint offset = glyphs.offsets[i];
36581 advanceX += offset.x;
36582 advanceY += offset.y;
36583 qt_addBitmapToPath((advanceX + metrics.x).toReal(), (advanceY + metrics.y).toReal(), bitmap_data, bitmap.bytesPerLine(), w, h, path);
36584 advanceX += glyphs.advances_x[i];
36585 advanceY += glyphs.advances_y[i];
36586 }
36587 }
36588 void QFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nGlyphs,
36589 QPainterPath *path, QTextItem::RenderFlags flags)
36590 {
36591 qreal x = positions[0].x.toReal();
36592 qreal y = positions[0].y.toReal();
36593 QVarLengthGlyphLayoutArray g(nGlyphs);
36594 for (int i = 0; i < nGlyphs; ++i) {
36595 g.glyphs[i] = glyphs[i];
36596 if (i < nGlyphs - 1) {
36597 g.advances_x[i] = positions[i+1].x - positions[i].x;
36598 g.advances_y[i] = positions[i+1].y - positions[i].y;
36599 } else {
36600 g.advances_x[i] = QFixed::fromReal(maxCharWidth());
36601 g.advances_y[i] = 0;
36602 }
36603 }
36604 addBitmapFontToPath(x, y, g, path, flags);
36605 }
36606 QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
36607 {
36608 QImage i = alphaMapForGlyph(glyph);
36609 if (t.type() > QTransform::TxTranslate)
36610 i = i.transformed(t);
36611 qt_noop();
36612 return i;
36613 }
36614 QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int , const QTransform &t)
36615 {
36616 QImage alphaMask = alphaMapForGlyph(glyph, t);
36617 QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
36618 for (int y=0; y<alphaMask.height(); ++y) {
36619 uint *dst = (uint *) rgbMask.scanLine(y);
36620 uchar *src = (uchar *) alphaMask.scanLine(y);
36621 for (int x=0; x<alphaMask.width(); ++x)
36622 dst[x] = qRgb(src[x], src[x], src[x]);
36623 }
36624 return rgbMask;
36625 }
36626 void QFontEngine::removeGlyphFromCache(glyph_t)
36627 {
36628 }
36629 QFontEngine::Properties QFontEngine::properties() const
36630 {
36631 Properties p;
36632 QByteArray psname = QPdf::stripSpecialCharacters(fontDef.family.toUtf8());
36633 psname += '-';
36634 psname += QByteArray::number(fontDef.style);
36635 psname += '-';
36636 psname += QByteArray::number(fontDef.weight);
36637 p.postscriptName = psname;
36638 p.ascent = ascent();
36639 p.descent = descent();
36640 p.leading = leading();
36641 p.emSquare = p.ascent;
36642 p.boundingBox = QRectF(0, -p.ascent.toReal(), maxCharWidth(), (p.ascent + p.descent).toReal());
36643 p.italicAngle = 0;
36644 p.capHeight = p.ascent;
36645 p.lineWidth = lineThickness();
36646 return p;
36647 }
36648 void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
36649 {
36650 *metrics = boundingBox(glyph);
36651 QFixedPoint p;
36652 p.x = 0;
36653 p.y = 0;
36654 addGlyphsToPath(&glyph, &p, 1, path, QFlag(0));
36655 }
36656 QByteArray QFontEngine::getSfntTable(uint tag) const
36657 {
36658 QByteArray table;
36659 uint len = 0;
36660 if (!getSfntTableData(tag, 0, &len))
36661 return table;
36662 if (!len)
36663 return table;
36664 table.resize(len);
36665 if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len))
36666 return QByteArray();
36667 return table;
36668 }
36669 void QFontEngine::expireGlyphCache()
36670 {
36671 if (m_glyphCacheQueue.count() > 10) {
36672 QFontEngineGlyphCache *old = m_glyphCacheQueue.takeFirst();
36673 for (GlyphPointerHash::iterator i = m_glyphPointerHash.begin(); i != m_glyphPointerHash.end(); ++i) {
36674 QList<QFontEngineGlyphCache *> list = i.value();
36675 if (list.removeAll(old)) {
36676 if (list.isEmpty())
36677 m_glyphPointerHash.remove(i.key());
36678 else
36679 m_glyphPointerHash.insert(i.key(), list);
36680 break;
36681 }
36682 }
36683 for (GlyphIntHash::iterator i = m_glyphIntHash.begin(); i != m_glyphIntHash.end(); ++i) {
36684 QList<QFontEngineGlyphCache *> list = i.value();
36685 if (list.removeAll(old)) {
36686 if (list.isEmpty())
36687 m_glyphIntHash.remove(i.key());
36688 else
36689 m_glyphIntHash.insert(i.key(), list);
36690 break;
36691 }
36692 }
36693 delete old;
36694 }
36695 }
36696 void QFontEngine::setGlyphCache(void *key, QFontEngineGlyphCache *data)
36697 {
36698 qt_noop();
36699 QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
36700 for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
36701 QFontEngineGlyphCache *c = *it;
36702 if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
36703 if (c == data)
36704 return;
36705 items.removeAll(c);
36706 delete c;
36707 break;
36708 }
36709 }
36710 items.append(data);
36711 m_glyphPointerHash.insert(key, items);
36712 m_glyphCacheQueue.append(data);
36713 expireGlyphCache();
36714 }
36715 void QFontEngine::setGlyphCache(QFontEngineGlyphCache::Type key, QFontEngineGlyphCache *data)
36716 {
36717 qt_noop();
36718 QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
36719 for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
36720 QFontEngineGlyphCache *c = *it;
36721 if (qtransform_equals_no_translate(c->m_transform, data->m_transform)) {
36722 if (c == data)
36723 return;
36724 items.removeAll(c);
36725 delete c;
36726 break;
36727 }
36728 }
36729 items.append(data);
36730 m_glyphIntHash.insert(key, items);
36731 m_glyphCacheQueue.append(data);
36732 expireGlyphCache();
36733 }
36734 QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, const QTransform &transform) const
36735 {
36736 QList<QFontEngineGlyphCache*> items = m_glyphPointerHash.value(key);
36737 for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
36738 QFontEngineGlyphCache *c = *it;
36739 if (qtransform_equals_no_translate(c->m_transform, transform)) {
36740 m_glyphCacheQueue.removeAll(c);
36741 m_glyphCacheQueue.append(c);
36742 return c;
36743 }
36744 }
36745 return 0;
36746 }
36747 QFontEngineGlyphCache *QFontEngine::glyphCache(QFontEngineGlyphCache::Type key, const QTransform &transform) const
36748 {
36749 QList<QFontEngineGlyphCache*> items = m_glyphIntHash.value(key);
36750 for (QList<QFontEngineGlyphCache*>::iterator it = items.begin(), end = items.end(); it != end; ++it) {
36751 QFontEngineGlyphCache *c = *it;
36752 if (qtransform_equals_no_translate(c->m_transform, transform)) {
36753 m_glyphCacheQueue.removeAll(c);
36754 m_glyphCacheQueue.append(c);
36755 return c;
36756 }
36757 }
36758 return 0;
36759 }
36760 static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
36761 {
36762 uint left_right = (left << 16) + right;
36763 left = 0, right = numPairs - 1;
36764 while (left <= right) {
36765 int middle = left + ( ( right - left ) >> 1 );
36766 if(pairs[middle].left_right == left_right)
36767 return pairs[middle].adjust;
36768 if (pairs[middle].left_right < left_right)
36769 left = middle + 1;
36770 else
36771 right = middle - 1;
36772 }
36773 return 0;
36774 }
36775 void QFontEngine::doKerning(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
36776 {
36777 int numPairs = kerning_pairs.size();
36778 if(!numPairs)
36779 return;
36780 const KernPair *pairs = kerning_pairs.constData();
36781 if(flags & QTextEngine::DesignMetrics) {
36782 for(int i = 0; i < glyphs->numGlyphs - 1; ++i)
36783 glyphs->advances_x[i] += kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs);
36784 } else {
36785 for(int i = 0; i < glyphs->numGlyphs - 1; ++i)
36786 glyphs->advances_x[i] += qRound(kerning(glyphs->glyphs[i], glyphs->glyphs[i+1] , pairs, numPairs));
36787 }
36788 }
36789 void QFontEngine::loadKerningPairs(QFixed scalingFactor)
36790 {
36791 kerning_pairs.clear();
36792 QByteArray tab = getSfntTable(( (((quint32)('k')) << 24) | (((quint32)('e')) << 16) | (((quint32)('r')) << 8) | ((quint32)('n')) ));
36793 if (tab.isEmpty())
36794 return;
36795 const uchar *table = reinterpret_cast<const uchar *>(tab.constData());
36796 unsigned short version = qFromBigEndian<quint16>(table);
36797 if (version != 0) {
36798 return;
36799 }
36800 unsigned short numTables = qFromBigEndian<quint16>(table + 2);
36801 {
36802 int offset = 4;
36803 for(int i = 0; i < numTables; ++i) {
36804 if (offset + 6 > tab.size()) {
36805 goto end;
36806 }
36807 const uchar *header = table + offset;
36808 ushort version = qFromBigEndian<quint16>(header);
36809 ushort length = qFromBigEndian<quint16>(header+2);
36810 ushort coverage = qFromBigEndian<quint16>(header+4);
36811 if(version == 0 && coverage == 0x0001) {
36812 if (offset + length > tab.size()) {
36813 goto end;
36814 }
36815 const uchar *data = table + offset + 6;
36816 ushort nPairs = qFromBigEndian<quint16>(data);
36817 if(nPairs * 6 + 8 > length - 6) {
36818 goto end;
36819 }
36820 int off = 8;
36821 for(int i = 0; i < nPairs; ++i) {
36822 QFontEngine::KernPair p;
36823 p.left_right = (((uint)qFromBigEndian<quint16>(data+off)) << 16) + qFromBigEndian<quint16>(data+off+2);
36824 p.adjust = QFixed(((int)(short)qFromBigEndian<quint16>(data+off+4))) / scalingFactor;
36825 kerning_pairs.append(p);
36826 off += 6;
36827 }
36828 }
36829 offset += length;
36830 }
36831 }
36832 end:
36833 qSort(kerning_pairs);
36834 }
36835 int QFontEngine::glyphCount() const
36836 {
36837 QByteArray maxpTable = getSfntTable(( (((quint32)('m')) << 24) | (((quint32)('a')) << 16) | (((quint32)('x')) << 8) | ((quint32)('p')) ));
36838 if (maxpTable.size() < 6)
36839 return 0;
36840 return qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(maxpTable.constData() + 4));
36841 }
36842 const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
36843 {
36844 const uchar *header = table;
36845 if (tableSize < 4)
36846 return 0;
36847 const uchar *endPtr = table + tableSize;
36848 if (qFromBigEndian<quint16>(header) != 0)
36849 return 0;
36850 unsigned short numTables = qFromBigEndian<quint16>(header + 2);
36851 const uchar *maps = table + 4;
36852 if (maps + 8 * numTables > endPtr)
36853 return 0;
36854 int tableToUse = -1;
36855 int score = 0;
36856 for (int n = 0; n < numTables; ++n) {
36857 const quint16 platformId = qFromBigEndian<quint16>(maps + 8 * n);
36858 const quint16 platformSpecificId = qFromBigEndian<quint16>(maps + 8 * n + 2);
36859 switch (platformId) {
36860 case 0:
36861 if (score < 4 &&
36862 (platformSpecificId == 0 ||
36863 platformSpecificId == 2 ||
36864 platformSpecificId == 3)) {
36865 tableToUse = n;
36866 score = 4;
36867 } else if (score < 3 && platformSpecificId == 1) {
36868 tableToUse = n;
36869 score = 3;
36870 }
36871 break;
36872 case 1:
36873 if (score < 2 && platformSpecificId == 0) {
36874 tableToUse = n;
36875 score = 2;
36876 }
36877 break;
36878 case 3:
36879 switch (platformSpecificId) {
36880 case 0:
36881 if (score < 1) {
36882 tableToUse = n;
36883 score = 1;
36884 }
36885 break;
36886 case 1:
36887 if (score < 5) {
36888 tableToUse = n;
36889 score = 5;
36890 }
36891 break;
36892 case 0xa:
36893 if (score < 6) {
36894 tableToUse = n;
36895 score = 6;
36896 }
36897 break;
36898 default:
36899 break;
36900 }
36901 default:
36902 break;
36903 }
36904 }
36905 if(tableToUse < 0)
36906 return 0;
36907 *isSymbolFont = (score == 1);
36908 unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4);
36909 if (!unicode_table || unicode_table + 8 > tableSize)
36910 return 0;
36911 header = table + unicode_table;
36912 unsigned short format = qFromBigEndian<quint16>(header);
36913 unsigned int length;
36914 if(format < 8)
36915 length = qFromBigEndian<quint16>(header + 2);
36916 else
36917 length = qFromBigEndian<quint32>(header + 4);
36918 if (table + unicode_table + length > endPtr)
36919 return 0;
36920 *cmapSize = length;
36921 return table + unicode_table;
36922 }
36923 quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, uint unicode)
36924 {
36925 unsigned short format = qFromBigEndian<quint16>(cmap);
36926 if (format == 0) {
36927 if (unicode < 256)
36928 return (int) *(cmap+6+unicode);
36929 } else if (format == 4) {
36930 if(unicode >= 0xffff)
36931 return 0;
36932 quint16 segCountX2 = qFromBigEndian<quint16>(cmap + 6);
36933 const unsigned char *ends = cmap + 14;
36934 quint16 endIndex = 0;
36935 int i = 0;
36936 for (; i < segCountX2/2 && (endIndex = qFromBigEndian<quint16>(ends + 2*i)) < unicode; i++) {}
36937 const unsigned char *idx = ends + segCountX2 + 2 + 2*i;
36938 quint16 startIndex = qFromBigEndian<quint16>(idx);
36939 if (startIndex > unicode)
36940 return 0;
36941 idx += segCountX2;
36942 qint16 idDelta = (qint16)qFromBigEndian<quint16>(idx);
36943 idx += segCountX2;
36944 quint16 idRangeoffset_t = (quint16)qFromBigEndian<quint16>(idx);
36945 quint16 glyphIndex;
36946 if (idRangeoffset_t) {
36947 quint16 id = qFromBigEndian<quint16>(idRangeoffset_t + 2*(unicode - startIndex) + idx);
36948 if (id)
36949 glyphIndex = (idDelta + id) % 0x10000;
36950 else
36951 glyphIndex = 0;
36952 } else {
36953 glyphIndex = (idDelta + unicode) % 0x10000;
36954 }
36955 return glyphIndex;
36956 } else if (format == 6) {
36957 quint16 tableSize = qFromBigEndian<quint16>(cmap + 2);
36958 quint16 firstCode6 = qFromBigEndian<quint16>(cmap + 6);
36959 if (unicode < firstCode6)
36960 return 0;
36961 quint16 entryCount6 = qFromBigEndian<quint16>(cmap + 8);
36962 if (entryCount6 * 2 + 10 > tableSize)
36963 return 0;
36964 quint16 sentinel6 = firstCode6 + entryCount6;
36965 if (unicode >= sentinel6)
36966 return 0;
36967 quint16 entryIndex6 = unicode - firstCode6;
36968 return qFromBigEndian<quint16>(cmap + 10 + (entryIndex6 * 2));
36969 } else if (format == 12) {
36970 quint32 nGroups = qFromBigEndian<quint32>(cmap + 12);
36971 cmap += 16;
36972 int left = 0, right = nGroups - 1;
36973 while (left <= right) {
36974 int middle = left + ( ( right - left ) >> 1 );
36975 quint32 startCharCode = qFromBigEndian<quint32>(cmap + 12*middle);
36976 if(unicode < startCharCode)
36977 right = middle - 1;
36978 else {
36979 quint32 endCharCode = qFromBigEndian<quint32>(cmap + 12*middle + 4);
36980 if(unicode <= endCharCode)
36981 return qFromBigEndian<quint32>(cmap + 12*middle + 8) + unicode - startCharCode;
36982 left = middle + 1;
36983 }
36984 }
36985 } else {
36986 qDebug("cmap table of format %d not implemented", format);
36987 }
36988 return 0;
36989 }
36990 QFontEngineBox::QFontEngineBox(int size)
36991 : _size(size)
36992 {
36993 cache_cost = sizeof(QFontEngineBox);
36994 }
36995 QFontEngineBox::~QFontEngineBox()
36996 {
36997 }
36998 bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags) const
36999 {
37000 if (*nglyphs < len) {
37001 *nglyphs = len;
37002 return false;
37003 }
37004 for (int i = 0; i < len; i++) {
37005 glyphs->glyphs[i] = 0;
37006 glyphs->advances_x[i] = _size;
37007 glyphs->advances_y[i] = 0;
37008 }
37009 *nglyphs = len;
37010 glyphs->numGlyphs = len;
37011 return true;
37012 }
37013 void QFontEngineBox::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const
37014 {
37015 for (int i = 0; i < glyphs->numGlyphs; i++) {
37016 glyphs->advances_x[i] = _size;
37017 glyphs->advances_y[i] = 0;
37018 }
37019 }
37020 void QFontEngineBox::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
37021 {
37022 if (!glyphs.numGlyphs)
37023 return;
37024 QVarLengthArray<QFixedPoint> positions;
37025 QVarLengthArray<glyph_t> positioned_glyphs;
37026 QTransform matrix;
37027 matrix.translate(x, y - _size);
37028 getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
37029 QSize s(_size - 3, _size - 3);
37030 for (int k = 0; k < positions.size(); k++)
37031 path->addRect(QRectF(positions[k].toPointF(), s));
37032 }
37033 glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs)
37034 {
37035 glyph_metrics_t overall;
37036 overall.width = _size*glyphs.numGlyphs;
37037 overall.height = _size;
37038 overall.xoff = overall.width;
37039 return overall;
37040 }
37041 void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti)
37042 {
37043 if (!ti.glyphs.numGlyphs)
37044 return;
37045 QSize s(_size - 3, _size - 3);
37046 QVarLengthArray<QFixedPoint> positions;
37047 QVarLengthArray<glyph_t> glyphs;
37048 QTransform matrix;
37049 matrix.translate(x, y - _size);
37050 ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
37051 if (glyphs.size() == 0)
37052 return;
37053 QPainter *painter = p->painter();
37054 painter->save();
37055 painter->setBrush(Qt::NoBrush);
37056 QPen pen = painter->pen();
37057 pen.setWidthF(lineThickness().toReal());
37058 painter->setPen(pen);
37059 for (int k = 0; k < positions.size(); k++)
37060 painter->drawRect(QRectF(positions[k].toPointF(), s));
37061 painter->restore();
37062 }
37063 glyph_metrics_t QFontEngineBox::boundingBox(glyph_t)
37064 {
37065 return glyph_metrics_t(0, -_size, _size, _size, _size, 0);
37066 }
37067 QFixed QFontEngineBox::ascent() const
37068 {
37069 return _size;
37070 }
37071 QFixed QFontEngineBox::descent() const
37072 {
37073 return 0;
37074 }
37075 QFixed QFontEngineBox::leading() const
37076 {
37077 QFixed l = _size * QFixed::fromReal(qreal(0.15));
37078 return l.ceil();
37079 }
37080 qreal QFontEngineBox::maxCharWidth() const
37081 {
37082 return _size;
37083 }
37084 const char *QFontEngineBox::name() const
37085 {
37086 return "null";
37087 }
37088 bool QFontEngineBox::canRender(const QChar *, int)
37089 {
37090 return true;
37091 }
37092 QFontEngine::Type QFontEngineBox::type() const
37093 {
37094 return Box;
37095 }
37096 QImage QFontEngineBox::alphaMapForGlyph(glyph_t)
37097 {
37098 QImage image(_size, _size, QImage::Format_Indexed8);
37099 QVector<QRgb> colors(256);
37100 for (int i=0; i<256; ++i)
37101 colors[i] = qRgba(0, 0, 0, i);
37102 image.setColorTable(colors);
37103 image.fill(0);
37104 for (int i=2; i <= _size-3; ++i) {
37105 image.setPixel(i, 2, 255);
37106 image.setPixel(i, _size-3, 255);
37107 image.setPixel(2, i, 255);
37108 image.setPixel(_size-3, i, 255);
37109 }
37110 return image;
37111 }
37112 static inline uchar highByte(glyph_t glyph)
37113 { return glyph >> 24; }
37114 static inline glyph_t stripped(glyph_t glyph)
37115 { return glyph & 0x00ffffff; }
37116 QFontEngineMulti::QFontEngineMulti(int engineCount)
37117 {
37118 engines.fill(0, engineCount);
37119 cache_cost = 0;
37120 }
37121 QFontEngineMulti::~QFontEngineMulti()
37122 {
37123 for (int i = 0; i < engines.size(); ++i) {
37124 QFontEngine *fontEngine = engines.at(i);
37125 if (fontEngine) {
37126 fontEngine->ref.deref();
37127 if (fontEngine->cache_count == 0 && fontEngine->ref == 0)
37128 delete fontEngine;
37129 }
37130 }
37131 }
37132 bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
37133 QGlyphLayout *glyphs, int *nglyphs,
37134 QTextEngine::ShaperFlags flags) const
37135 {
37136 int ng = *nglyphs;
37137 if (!engine(0)->stringToCMap(str, len, glyphs, &ng, flags))
37138 return false;
37139 int glyph_pos = 0;
37140 for (int i = 0; i < len; ++i) {
37141 bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1
37142 && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
37143 if (glyphs->glyphs[glyph_pos] == 0) {
37144 QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
37145 for (int x = 1; x < engines.size(); ++x) {
37146 QFontEngine *engine = engines.at(x);
37147 if (!engine) {
37148 const_cast<QFontEngineMulti *>(this)->loadEngine(x);
37149 engine = engines.at(x);
37150 }
37151 qt_noop();
37152 if (engine->type() == Box)
37153 continue;
37154 glyphs->advances_x[glyph_pos] = glyphs->advances_y[glyph_pos] = 0;
37155 glyphs->offsets[glyph_pos] = QFixedPoint();
37156 int num = 2;
37157 QGlyphLayout offs = glyphs->mid(glyph_pos, num);
37158 engine->stringToCMap(str + i, surrogate ? 2 : 1, &offs, &num, flags);
37159 qt_noop();
37160 if (glyphs->glyphs[glyph_pos]) {
37161 glyphs->glyphs[glyph_pos] |= (x << 24);
37162 break;
37163 }
37164 }
37165 if (!glyphs->glyphs[glyph_pos]) {
37166 glyphs->setInstance(glyph_pos, tmp);
37167 }
37168 }
37169 if (surrogate)
37170 ++i;
37171 ++glyph_pos;
37172 }
37173 *nglyphs = ng;
37174 glyphs->numGlyphs = ng;
37175 return true;
37176 }
37177 glyph_metrics_t QFontEngineMulti::boundingBox(const QGlyphLayout &glyphs)
37178 {
37179 if (glyphs.numGlyphs <= 0)
37180 return glyph_metrics_t();
37181 glyph_metrics_t overall;
37182 int which = highByte(glyphs.glyphs[0]);
37183 int start = 0;
37184 int end, i;
37185 for (end = 0; end < glyphs.numGlyphs; ++end) {
37186 const int e = highByte(glyphs.glyphs[end]);
37187 if (e == which)
37188 continue;
37189 for (i = start; i < end; ++i)
37190 glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
37191 const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start));
37192 overall.x = qMin(overall.x, gm.x);
37193 overall.y = qMin(overall.y, gm.y);
37194 overall.width = overall.xoff + gm.width;
37195 overall.height = qMax(overall.height + overall.y, gm.height + gm.y) -
37196 qMin(overall.y, gm.y);
37197 overall.xoff += gm.xoff;
37198 overall.yoff += gm.yoff;
37199 const int hi = which << 24;
37200 for (i = start; i < end; ++i)
37201 glyphs.glyphs[i] = hi | glyphs.glyphs[i];
37202 start = end;
37203 which = e;
37204 }
37205 for (i = start; i < end; ++i)
37206 glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
37207 const glyph_metrics_t gm = engine(which)->boundingBox(glyphs.mid(start, end - start));
37208 overall.x = qMin(overall.x, gm.x);
37209 overall.y = qMin(overall.y, gm.y);
37210 overall.width = overall.xoff + gm.width;
37211 overall.height = qMax(overall.height + overall.y, gm.height + gm.y) -
37212 qMin(overall.y, gm.y);
37213 overall.xoff += gm.xoff;
37214 overall.yoff += gm.yoff;
37215 const int hi = which << 24;
37216 for (i = start; i < end; ++i)
37217 glyphs.glyphs[i] = hi | glyphs.glyphs[i];
37218 return overall;
37219 }
37220 void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
37221 QPainterPath *path, QTextItem::RenderFlags flags)
37222 {
37223 if (glyphs.numGlyphs <= 0)
37224 return;
37225 int which = highByte(glyphs.glyphs[0]);
37226 int start = 0;
37227 int end, i;
37228 if (flags & QTextItem::RightToLeft) {
37229 for (int gl = 0; gl < glyphs.numGlyphs; gl++) {
37230 x += glyphs.advances_x[gl].toReal();
37231 y += glyphs.advances_y[gl].toReal();
37232 }
37233 }
37234 for (end = 0; end < glyphs.numGlyphs; ++end) {
37235 const int e = highByte(glyphs.glyphs[end]);
37236 if (e == which)
37237 continue;
37238 if (flags & QTextItem::RightToLeft) {
37239 for (i = start; i < end; ++i) {
37240 x -= glyphs.advances_x[i].toReal();
37241 y -= glyphs.advances_y[i].toReal();
37242 }
37243 }
37244 for (i = start; i < end; ++i)
37245 glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
37246 engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags);
37247 const int hi = which << 24;
37248 for (i = start; i < end; ++i)
37249 glyphs.glyphs[i] = hi | glyphs.glyphs[i];
37250 if (!(flags & QTextItem::RightToLeft)) {
37251 for (i = start; i < end; ++i) {
37252 x += glyphs.advances_x[i].toReal();
37253 y += glyphs.advances_y[i].toReal();
37254 }
37255 }
37256 start = end;
37257 which = e;
37258 }
37259 if (flags & QTextItem::RightToLeft) {
37260 for (i = start; i < end; ++i) {
37261 x -= glyphs.advances_x[i].toReal();
37262 y -= glyphs.advances_y[i].toReal();
37263 }
37264 }
37265 for (i = start; i < end; ++i)
37266 glyphs.glyphs[i] = stripped(glyphs.glyphs[i]);
37267 engine(which)->addOutlineToPath(x, y, glyphs.mid(start, end - start), path, flags);
37268 const int hi = which << 24;
37269 for (i = start; i < end; ++i)
37270 glyphs.glyphs[i] = hi | glyphs.glyphs[i];
37271 }
37272 void QFontEngineMulti::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
37273 {
37274 if (glyphs->numGlyphs <= 0)
37275 return;
37276 int which = highByte(glyphs->glyphs[0]);
37277 int start = 0;
37278 int end, i;
37279 for (end = 0; end < glyphs->numGlyphs; ++end) {
37280 const int e = highByte(glyphs->glyphs[end]);
37281 if (e == which)
37282 continue;
37283 for (i = start; i < end; ++i)
37284 glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
37285 QGlyphLayout offs = glyphs->mid(start, end - start);
37286 engine(which)->recalcAdvances(&offs, flags);
37287 const int hi = which << 24;
37288 for (i = start; i < end; ++i)
37289 glyphs->glyphs[i] = hi | glyphs->glyphs[i];
37290 start = end;
37291 which = e;
37292 }
37293 for (i = start; i < end; ++i)
37294 glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
37295 QGlyphLayout offs = glyphs->mid(start, end - start);
37296 engine(which)->recalcAdvances(&offs, flags);
37297 const int hi = which << 24;
37298 for (i = start; i < end; ++i)
37299 glyphs->glyphs[i] = hi | glyphs->glyphs[i];
37300 }
37301 void QFontEngineMulti::doKerning(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
37302 {
37303 if (glyphs->numGlyphs <= 0)
37304 return;
37305 int which = highByte(glyphs->glyphs[0]);
37306 int start = 0;
37307 int end, i;
37308 for (end = 0; end < glyphs->numGlyphs; ++end) {
37309 const int e = highByte(glyphs->glyphs[end]);
37310 if (e == which)
37311 continue;
37312 for (i = start; i < end; ++i)
37313 glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
37314 QGlyphLayout offs = glyphs->mid(start, end - start);
37315 engine(which)->doKerning(&offs, flags);
37316 const int hi = which << 24;
37317 for (i = start; i < end; ++i)
37318 glyphs->glyphs[i] = hi | glyphs->glyphs[i];
37319 start = end;
37320 which = e;
37321 }
37322 for (i = start; i < end; ++i)
37323 glyphs->glyphs[i] = stripped(glyphs->glyphs[i]);
37324 QGlyphLayout offs = glyphs->mid(start, end - start);
37325 engine(which)->doKerning(&offs, flags);
37326 const int hi = which << 24;
37327 for (i = start; i < end; ++i)
37328 glyphs->glyphs[i] = hi | glyphs->glyphs[i];
37329 }
37330 glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
37331 {
37332 const int which = highByte(glyph);
37333 qt_noop();
37334 return engine(which)->boundingBox(stripped(glyph));
37335 }
37336 QFixed QFontEngineMulti::ascent() const
37337 { return engine(0)->ascent(); }
37338 QFixed QFontEngineMulti::descent() const
37339 { return engine(0)->descent(); }
37340 QFixed QFontEngineMulti::leading() const
37341 {
37342 return engine(0)->leading();
37343 }
37344 QFixed QFontEngineMulti::xHeight() const
37345 {
37346 return engine(0)->xHeight();
37347 }
37348 QFixed QFontEngineMulti::averageCharWidth() const
37349 {
37350 return engine(0)->averageCharWidth();
37351 }
37352 QFixed QFontEngineMulti::lineThickness() const
37353 {
37354 return engine(0)->lineThickness();
37355 }
37356 QFixed QFontEngineMulti::underlinePosition() const
37357 {
37358 return engine(0)->underlinePosition();
37359 }
37360 qreal QFontEngineMulti::maxCharWidth() const
37361 {
37362 return engine(0)->maxCharWidth();
37363 }
37364 qreal QFontEngineMulti::minLeftBearing() const
37365 {
37366 return engine(0)->minLeftBearing();
37367 }
37368 qreal QFontEngineMulti::minRightBearing() const
37369 {
37370 return engine(0)->minRightBearing();
37371 }
37372 bool QFontEngineMulti::canRender(const QChar *string, int len)
37373 {
37374 if (engine(0)->canRender(string, len))
37375 return true;
37376 QVarLengthGlyphLayoutArray glyphs(len);
37377 int nglyphs = len;
37378 if (stringToCMap(string, len, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly) == false) {
37379 glyphs.resize(nglyphs);
37380 stringToCMap(string, len, &glyphs, &nglyphs, QTextEngine::GlyphIndicesOnly);
37381 }
37382 bool allExist = true;
37383 for (int i = 0; i < nglyphs; i++) {
37384 if (!glyphs.glyphs[i]) {
37385 allExist = false;
37386 break;
37387 }
37388 }
37389 return allExist;
37390 }
37391 QFontEngine *QFontEngineMulti::engine(int at) const
37392 {
37393 qt_noop();
37394 return engines.at(at);
37395 }
37396 QImage QFontEngineMulti::alphaMapForGlyph(glyph_t)
37397 {
37398 qt_noop();
37399 return QImage();
37400 }