comparison src/xlsx/xlsxrichstring.h @ 1:93d3106bb9a4

Add qt xlsx library
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 22 Mar 2016 10:38:08 +0100
parents
children
comparison
equal deleted inserted replaced
0:49cd5cc0b072 1:93d3106bb9a4
1 /****************************************************************************
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
3 ** All right reserved.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining
6 ** a copy of this software and associated documentation files (the
7 ** "Software"), to deal in the Software without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Software, and to
10 ** permit persons to whom the Software is furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be
14 ** included in all copies or substantial portions of the Software.
15 **
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 **
24 ****************************************************************************/
25 #ifndef XLSXRICHSTRING_H
26 #define XLSXRICHSTRING_H
27
28 #include "xlsxglobal.h"
29 #include "xlsxformat.h"
30 #include <QVariant>
31 #include <QStringList>
32 #include <QSharedDataPointer>
33
34 QT_BEGIN_NAMESPACE_XLSX
35 class RichStringPrivate;
36 class RichString;
37 // qHash is a friend, but we can't use default arguments for friends (ยง8.3.6.4)
38 Q_XLSX_EXPORT uint qHash(const RichString &rs, uint seed = 0) Q_DECL_NOTHROW;
39
40 class Q_XLSX_EXPORT RichString
41 {
42 public:
43 RichString();
44 explicit RichString(const QString text);
45 RichString(const RichString &other);
46 ~RichString();
47
48 bool isRichString() const;
49 bool isNull() const;
50 bool isEmtpy() const;
51 QString toPlainString() const;
52 QString toHtml() const;
53 void setHtml(const QString &text);
54
55 int fragmentCount() const;
56 void addFragment(const QString &text, const Format &format);
57 QString fragmentText(int index) const;
58 Format fragmentFormat(int index) const;
59
60 operator QVariant() const;
61
62 RichString &operator=(const RichString &other);
63 private:
64 friend Q_XLSX_EXPORT uint qHash(const RichString &rs, uint seed) Q_DECL_NOTHROW;
65 friend Q_XLSX_EXPORT bool operator==(const RichString &rs1, const RichString &rs2);
66 friend Q_XLSX_EXPORT bool operator!=(const RichString &rs1, const RichString &rs2);
67 friend Q_XLSX_EXPORT bool operator<(const RichString &rs1, const RichString &rs2);
68 friend Q_XLSX_EXPORT QDebug operator<<(QDebug dbg, const RichString &rs);
69
70 QSharedDataPointer<RichStringPrivate> d;
71 };
72
73 Q_XLSX_EXPORT bool operator==(const RichString &rs1, const RichString &rs2);
74 Q_XLSX_EXPORT bool operator!=(const RichString &rs1, const RichString &rs2);
75 Q_XLSX_EXPORT bool operator<(const RichString &rs1, const RichString &rs2);
76 Q_XLSX_EXPORT bool operator==(const RichString &rs1, const QString &rs2);
77 Q_XLSX_EXPORT bool operator==(const QString &rs1, const RichString &rs2);
78 Q_XLSX_EXPORT bool operator!=(const RichString &rs1, const QString &rs2);
79 Q_XLSX_EXPORT bool operator!=(const QString &rs1, const RichString &rs2);
80
81 #ifndef QT_NO_DEBUG_STREAM
82 Q_XLSX_EXPORT QDebug operator<<(QDebug dbg, const RichString &rs);
83 #endif
84
85 QT_END_NAMESPACE_XLSX
86
87 Q_DECLARE_METATYPE(QXlsx::RichString)
88
89 #endif // XLSXRICHSTRING_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)