Seamly2D
Code documentation
qmudef.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  **
3  ** Copyright (C) 2015 Roman Telezhynskyi <dismine(at)gmail.com>
4  **
5  ** Permission is hereby granted, free of charge, to any person obtaining a copy of this
6  ** software and associated documentation files (the "Software"), to deal in the Software
7  ** without restriction, including without limitation the rights to use, copy, modify,
8  ** merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9  ** permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  **
11  ** The above copyright notice and this permission notice shall be included in all copies or
12  ** substantial portions of the Software.
13  **
14  ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15  ** NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16  ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17  ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  **
20  ******************************************************************************************************/
21 
22 #ifndef QMUDEF_H
23 #define QMUDEF_H
24 
25 #include <qcompilerdetection.h>
26 #include <QtGlobal>
27 #include <QChar>
28 #include <QString>
29 #include <QLocale>
30 
31 QT_WARNING_PUSH
32 QT_WARNING_DISABLE_GCC("-Wattributes")
33 
34 #ifdef Q_CC_MSVC
35  #include <ciso646>
36 #endif /* Q_CC_MSVC */
37 
38 #define INIT_LOCALE_VARIABLES(locale) \
39 const QChar positiveSign = (locale).positiveSign(); \
40 const QChar negativeSign = (locale).negativeSign(); \
41 const QChar sign0 = (locale).toString(0).at(0); \
42 const QChar sign1 = (locale).toString(1).at(0); \
43 const QChar sign2 = (locale).toString(2).at(0); \
44 const QChar sign3 = (locale).toString(3).at(0); \
45 const QChar sign4 = (locale).toString(4).at(0); \
46 const QChar sign5 = (locale).toString(5).at(0); \
47 const QChar sign6 = (locale).toString(6).at(0); \
48 const QChar sign7 = (locale).toString(7).at(0); \
49 const QChar sign8 = (locale).toString(8).at(0); \
50 const QChar sign9 = (locale).toString(9).at(0); \
51 const QChar expUpper = (locale).exponential().toUpper(); \
52 const QChar expLower = (locale).exponential().toLower(); \
53 const QChar decimalPoint = (locale).decimalPoint(); \
54 const QChar groupSeparator = (locale).groupSeparator() \
55 
56 QString NameRegExp();
57 
59 
60 Q_REQUIRED_RESULT static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2);
61 static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
62 {
63  if(qFuzzyIsNull(p1))
64  {
65  return qFuzzyIsNull(p2);
66  }
67  else if(qFuzzyIsNull(p2))
68  {
69  return false;
70  }
71  else
72  {
73  return qFuzzyCompare(p1, p2);
74  }
75 }
76 
77 int ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
78  const QChar &thousand);
79 
80 #endif // QMUDEF_H
QString NameRegExp()
Definition: qmudef.cpp:281
QT_WARNING_POP static Q_REQUIRED_RESULT bool QmuFuzzyComparePossibleNulls(double p1, double p2)
Definition: qmudef.h:61
int ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal, const QChar &thousand)
Definition: qmudef.cpp:170