Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
util
Compatibility.cpp
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2020 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3
* under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4
* LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5
******************************************************************************************************/
6
7
#include "
Compatibility.h
"
8
#include "
Logger.h
"
9
#include <QTextStream>
10
#include <QtGlobal>
11
12
using namespace
std;
13
14
Compatibility::Compatibility
()
15
{
16
}
17
18
QTextStream &
Compatibility::endl
(QTextStream &str)
19
{
20
qCInfo(ENGAUGE_LOG) <<
"Compatibility::endl"
;
21
22
// Comments:
23
// 1) QTextStream in text mode uses \n\r for carriage return
24
// 2) \n by itself does not flush
25
// 3) \n by itself could be safely used wherever this method is used, but this method has nice comments
26
// and the performance gain from skipping the flush that end() adds is insignificant
27
28
#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0)
29
str <<
"\n"
;
// std::endl will not compile
30
#else
31
str << Qt::endl;
// Enum
32
#endif
33
34
return
str;
35
}
36
37
QTextStream &
Compatibility::flush
(QTextStream &str)
38
{
39
40
#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0)
41
// std::flush will not compile so we skip flushing
42
#else
43
str << Qt::flush;
// Enum
44
#endif
45
46
return
str;
47
}
48
49
#if QT_VERSION < QT_VERSION_CHECK (5, 14, 0)
50
QString::SplitBehavior
Compatibility::SkipEmptyParts
()
51
{
52
return
QString::SkipEmptyParts;
53
}
54
#else
55
Qt::SplitBehavior
Compatibility::SkipEmptyParts
()
56
{
57
return
Qt::SkipEmptyParts;
58
}
59
#endif
Compatibility.h
Logger.h
Compatibility::Compatibility
Compatibility()
Single default constructor.
Definition
Compatibility.cpp:14
Compatibility::endl
static QTextStream & endl(QTextStream &stream)
End of line.
Definition
Compatibility.cpp:18
Compatibility::SkipEmptyParts
static Qt::SplitBehavior SkipEmptyParts()
SplitBehavior.
Definition
Compatibility.cpp:55
Compatibility::flush
static QTextStream & flush(QTextStream &stream)
Flush.
Definition
Compatibility.cpp:37
Generated on
for Engauge Digitizer by
1.17.0