do not include <ciso646> with C++20

This commit is contained in:
Roman Telezhynskyi 2023-07-17 16:33:57 +03:00
parent 62f468b57b
commit c8844853b5
24 changed files with 745 additions and 581 deletions

View File

@ -30,9 +30,13 @@
#include <QCommandLineParser>
#include <QCoreApplication>
#include <ciso646>
#include <memory>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif

View File

@ -36,16 +36,18 @@
#include "../vgeometry/vlayoutplacelabel.h"
#include "../vlayout/vlayoutpiecepath.h"
#include "../vlayout/vtextmanager.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/vcommonsettings.h"
#include "../vpatterndb/floatItemData/floatitemdef.h"
#include "compatibility.h"
#include "svgfont/vsvgfont.h"
#include "vpiecegrainline.h"
#include "../vwidgets/vpiecegrainline.h"
#include "vplayoutliterals.h"
#include <QFont>
#include <QXmlStreamAttributes>
#include <Qt>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")

View File

@ -29,15 +29,19 @@
#ifndef VPLAYOUTFILEWRITER_H
#define VPLAYOUTFILEWRITER_H
#include <QCoreApplication>
#include <QLocale>
#include <QXmlStreamWriter>
#include <QCoreApplication>
#include <functional>
#include <ciso646>
#include "../vmisc/literals.h"
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#include "../layout/layoutdef.h"
#include "../qmuparser/qmudef.h"
#include "../vmisc/literals.h"
class VPLayout;
class VPSheet;
@ -53,8 +57,8 @@ class VPLayoutFileWriter : public QXmlStreamWriter
Q_DECLARE_TR_FUNCTIONS(VPLayoutFileWriter) // NOLINT
public:
VPLayoutFileWriter()= default;
~VPLayoutFileWriter()= default;
VPLayoutFileWriter() = default;
~VPLayoutFileWriter() = default;
void WriteFile(const VPLayoutPtr &layout, QIODevice *file);
@ -75,20 +79,20 @@ private:
void WriteMargins(const QMarginsF &margins, bool ignore);
void WriteSize(QSizeF size);
template <typename T>
void SetAttribute(const QString &name, const T &value);
template <typename T> void SetAttribute(const QString &name, const T &value);
template <size_t N>
void SetAttribute(const QString &name, const char (&value)[N]); //NOLINT(cppcoreguidelines-avoid-c-arrays) NOLINT(hicpp-avoid-c-arrays) NOLINT(modernize-avoid-c-arrays)
void SetAttribute(const QString &name,
const char (&value)[N]); // NOLINT(cppcoreguidelines-avoid-c-arrays) NOLINT(hicpp-avoid-c-arrays)
// NOLINT(modernize-avoid-c-arrays)
template <typename T>
void SetAttributeOrRemoveIf(const QString &name, const T &value,
const std::function<bool(const T&)> &removeCondition);
const std::function<bool(const T &)> &removeCondition);
};
//---------------------------------------------------------------------------------------------------------------------
template<typename T>
void VPLayoutFileWriter::SetAttribute(const QString &name, const T &value)
template <typename T> void VPLayoutFileWriter::SetAttribute(const QString &name, const T &value)
{
// See specification for xs:decimal
const QLocale locale = QLocale::c();
@ -96,29 +100,28 @@ void VPLayoutFileWriter::SetAttribute(const QString &name, const T &value)
}
//---------------------------------------------------------------------------------------------------------------------
template <>
inline void VPLayoutFileWriter::SetAttribute<QString>(const QString &name, const QString &value)
template <> inline void VPLayoutFileWriter::SetAttribute<QString>(const QString &name, const QString &value)
{
writeAttribute(name, value);
}
//---------------------------------------------------------------------------------------------------------------------
template <>
inline void VPLayoutFileWriter::SetAttribute<QChar>(const QString &name, const QChar &value)
template <> inline void VPLayoutFileWriter::SetAttribute<QChar>(const QString &name, const QChar &value)
{
writeAttribute(name, value);
}
//---------------------------------------------------------------------------------------------------------------------
template <>
inline void VPLayoutFileWriter::SetAttribute<bool>(const QString &name, const bool &value)
template <> inline void VPLayoutFileWriter::SetAttribute<bool>(const QString &name, const bool &value)
{
writeAttribute(name, value ? trueStr : falseStr);
}
//---------------------------------------------------------------------------------------------------------------------
template <size_t N>
inline void VPLayoutFileWriter::SetAttribute(const QString &name, const char (&value)[N]) //NOLINT(cppcoreguidelines-avoid-c-arrays) NOLINT(hicpp-avoid-c-arrays) NOLINT(modernize-avoid-c-arrays)
inline void VPLayoutFileWriter::SetAttribute(
const QString &name, const char (&value)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays)
// NOLINT(hicpp-avoid-c-arrays) NOLINT(modernize-avoid-c-arrays)
{
writeAttribute(name, QString(value));
}
@ -126,7 +129,7 @@ inline void VPLayoutFileWriter::SetAttribute(const QString &name, const char (&v
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
inline void VPLayoutFileWriter::SetAttributeOrRemoveIf(const QString &name, const T &value,
const std::function<bool(const T&)> &removeCondition)
const std::function<bool(const T &)> &removeCondition)
{
if (not removeCondition(value))
{

View File

@ -28,16 +28,20 @@
#include "dialogdatetimeformats.h"
#include "ui_dialogdatetimeformats.h"
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
DialogDateTimeFormats::DialogDateTimeFormats(const QDate &date, const QStringList &predefinedFormats,
const QStringList &userDefinedFormats, QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogDateTimeFormats),
m_dateMode(true),
m_date(date),
m_predefined(predefinedFormats)
: QDialog(parent),
ui(new Ui::DialogDateTimeFormats),
m_dateMode(true),
m_date(date),
m_predefined(predefinedFormats)
{
ui->setupUi(this);
@ -47,11 +51,11 @@ DialogDateTimeFormats::DialogDateTimeFormats(const QDate &date, const QStringLis
//---------------------------------------------------------------------------------------------------------------------
DialogDateTimeFormats::DialogDateTimeFormats(const QTime &time, const QStringList &predefinedFormats,
const QStringList &userDefinedFormats, QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogDateTimeFormats),
m_dateMode(false),
m_time(time),
m_predefined(predefinedFormats)
: QDialog(parent),
ui(new Ui::DialogDateTimeFormats),
m_dateMode(false),
m_time(time),
m_predefined(predefinedFormats)
{
ui->setupUi(this);
@ -69,7 +73,7 @@ auto DialogDateTimeFormats::GetFormats() const -> QStringList
{
QStringList formats;
for (int i=0; i<ui->listWidget->count(); ++i)
for (int i = 0; i < ui->listWidget->count(); ++i)
{
if (const QListWidgetItem *lineItem = ui->listWidget->item(i))
{

View File

@ -28,12 +28,16 @@
#include "dialogknownmaterials.h"
#include "ui_dialogknownmaterials.h"
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
DialogKnownMaterials::DialogKnownMaterials(QWidget *parent)
: QDialog(parent),
ui(new Ui::DialogKnownMaterials)
: QDialog(parent),
ui(new Ui::DialogKnownMaterials)
{
ui->setupUi(this);
@ -80,7 +84,7 @@ auto DialogKnownMaterials::GetList() const -> QStringList
{
QStringList list;
for (int i=0; i<ui->listWidget->count(); ++i)
for (int i = 0; i < ui->listWidget->count(); ++i)
{
if (const QListWidgetItem *item = ui->listWidget->item(i))
{

View File

@ -34,7 +34,11 @@
#include <QSet>
#include <QStringList>
#include <QSvgRenderer>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#include "../vmisc/compatibility.h"
@ -72,7 +76,7 @@ auto MimeTypeFromByteArray(const QByteArray &data) -> QMimeType
QSet<QString> aliases = ConvertToSet<QString>(mime.aliases());
aliases.insert(mime.name());
QSet<QString> gzipMime {"application/gzip", "application/x-gzip"};
QSet<QString> gzipMime{"application/gzip", "application/x-gzip"};
if (gzipMime.contains(aliases))
{
@ -92,7 +96,7 @@ auto PrepareImageFilters() -> QString
const QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
const QSet<QString> filterFormats{"bmp", "jpeg", "jpg", "png", "svg", "svgz", "tif", "tiff", "webp"};
QStringList sufixes;
for (const auto& format : supportedFormats)
for (const auto &format : supportedFormats)
{
if (filterFormats.contains(format))
{

View File

@ -27,20 +27,24 @@
*************************************************************************/
#include "vbackgroundpatternimage.h"
#include "utils.h"
#include "../vmisc/compatibility.h"
#include "../vmisc/defglobal.h"
#include "utils.h"
#include <QMimeType>
#include <QBuffer>
#include <QDebug>
#include <QFile>
#include <QMimeDatabase>
#include <QPixmap>
#include <QBuffer>
#include <QImageReader>
#include <ciso646>
#include <QMimeDatabase>
#include <QMimeType>
#include <QPixmap>
#include <QSvgRenderer>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
const QString VBackgroundPatternImage::brokenImage = QStringLiteral("://icon/svg/broken_path.svg");
namespace
@ -57,7 +61,7 @@ auto ScaleRasterImage(const QImage &image) -> QSize
const double ratioX = PrintDPI / (image.dotsPerMeterX() / 100. * 2.54);
const double ratioY = PrintDPI / (image.dotsPerMeterY() / 100. * 2.54);
const QSize imageSize = image.size();
return {qRound(imageSize.width()*ratioX), qRound(imageSize.height()*ratioY)};
return {qRound(imageSize.width() * ratioX), qRound(imageSize.height() * ratioY)};
}
//---------------------------------------------------------------------------------------------------------------------
@ -65,9 +69,9 @@ auto ScaleVectorImage(const QSvgRenderer &renderer) -> QSize
{
const QSize imageSize = renderer.defaultSize();
constexpr double ratio = PrintDPI / 90.;
return {qRound(imageSize.width()*ratio), qRound(imageSize.height()*ratio)};
return {qRound(imageSize.width() * ratio), qRound(imageSize.height() * ratio)};
}
} // namespace
} // namespace
//---------------------------------------------------------------------------------------------------------------------
auto VBackgroundPatternImage::FromFile(const QString &fileName, bool builtIn) -> VBackgroundPatternImage

View File

@ -27,22 +27,25 @@
*************************************************************************/
#include "vpatternimage.h"
#include <QBuffer>
#include <QDebug>
#include <QFile>
#include <QImage>
#include <QImageReader>
#include <QMimeDatabase>
#include <QPainter>
#include <QPixmap>
#include <QRegularExpressionMatch>
#include <QSvgRenderer>
#include <QDebug>
#include <QBuffer>
#include <QSize>
#include <QFile>
#include <ciso646>
#include <QSvgRenderer>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#include "utils.h"
#include "../vmisc/compatibility.h"
#include "utils.h"
//---------------------------------------------------------------------------------------------------------------------
auto VPatternImage::FromFile(const QString &fileName) -> VPatternImage
@ -148,7 +151,7 @@ auto VPatternImage::GetPixmap(int width, int height) const -> QPixmap
QImage image = imageReader.read();
if (image.isNull())
{
qCritical()<< tr("Couldn't read the image. Error: %1").arg(imageReader.errorString());
qCritical() << tr("Couldn't read the image. Error: %1").arg(imageReader.errorString());
return {};
}

View File

@ -31,76 +31,79 @@
* Warning/diagnostic handling
*/
#define QT_DO_PRAGMA(text) _Pragma(#text)
#define QT_DO_PRAGMA(text) _Pragma(#text)
#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC)
/* icl.exe: Intel compiler on Windows */
# undef QT_DO_PRAGMA /* not needed */
# define QT_WARNING_PUSH __pragma(warning(push))
# define QT_WARNING_POP __pragma(warning(pop))
# define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number))
# define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text)
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_INTEL)
/* icc: Intel compiler on Linux or OS X */
# define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push))
# define QT_WARNING_POP QT_DO_PRAGMA(warning(pop))
# define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number))
# define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push))
#define QT_WARNING_POP QT_DO_PRAGMA(warning(pop))
#define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable : number))
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500
# undef QT_DO_PRAGMA /* not needed */
# define QT_WARNING_PUSH __pragma(warning(push))
# define QT_WARNING_POP __pragma(warning(pop))
# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number))
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text)
#undef QT_DO_PRAGMA /* not needed */
#define QT_WARNING_PUSH __pragma(warning(push))
#define QT_WARNING_POP __pragma(warning(pop))
#define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable : number))
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_CLANG)
# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)// GCC directives work in Clang too
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
#define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
# define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number)
#else // All other compilers, GCC < 4.6 and MSVC < 2008
# define QT_WARNING_DISABLE_GCC(text)
# define QT_WARNING_PUSH
# define QT_WARNING_POP
# define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
#define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
#define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#else // All other compilers, GCC < 4.6 and MSVC < 2008
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_PUSH
#define QT_WARNING_POP
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_MSVC(number)
#define QT_WARNING_DISABLE_CLANG(text)
#define QT_WARNING_DISABLE_GCC(text)
#endif
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Class(Class &&) = delete; \
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wattributes")
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
class QLocale;
class QChar;
@ -125,23 +128,23 @@ QMUPARSERSHARED_EXPORT auto LocaleExpLower(const QLocale &locale) -> QChar;
QMUPARSERSHARED_EXPORT auto LocaleDecimalPoint(const QLocale &locale) -> QChar;
QMUPARSERSHARED_EXPORT auto LocaleGroupSeparator(const QLocale &locale) -> QChar;
#define INIT_LOCALE_VARIABLES(locale) \
const QChar positiveSign = LocalePositiveSign((locale)); \
const QChar negativeSign = LocaleNegativeSign((locale)); \
const QChar sign0 = LocaleSign0((locale)); \
const QChar sign1 = LocaleSign1((locale)); \
const QChar sign2 = LocaleSign2((locale)); \
const QChar sign3 = LocaleSign3((locale)); \
const QChar sign4 = LocaleSign4((locale)); \
const QChar sign5 = LocaleSign5((locale)); \
const QChar sign6 = LocaleSign6((locale)); \
const QChar sign7 = LocaleSign7((locale)); \
const QChar sign8 = LocaleSign8((locale)); \
const QChar sign9 = LocaleSign9((locale)); \
const QChar expUpper = LocaleExpUpper((locale)); \
const QChar expLower = LocaleExpLower((locale)); \
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
const QChar groupSeparator = LocaleGroupSeparator((locale));
#define INIT_LOCALE_VARIABLES(locale) \
const QChar positiveSign = LocalePositiveSign((locale)); \
const QChar negativeSign = LocaleNegativeSign((locale)); \
const QChar sign0 = LocaleSign0((locale)); \
const QChar sign1 = LocaleSign1((locale)); \
const QChar sign2 = LocaleSign2((locale)); \
const QChar sign3 = LocaleSign3((locale)); \
const QChar sign4 = LocaleSign4((locale)); \
const QChar sign5 = LocaleSign5((locale)); \
const QChar sign6 = LocaleSign6((locale)); \
const QChar sign7 = LocaleSign7((locale)); \
const QChar sign8 = LocaleSign8((locale)); \
const QChar sign9 = LocaleSign9((locale)); \
const QChar expUpper = LocaleExpUpper((locale)); \
const QChar expLower = LocaleExpLower((locale)); \
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
const QChar groupSeparator = LocaleGroupSeparator((locale));
QMUPARSERSHARED_EXPORT auto NameRegExp() -> QString;
@ -150,12 +153,12 @@ QT_WARNING_POP
Q_REQUIRED_RESULT static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
if (qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}
if(qFuzzyIsNull(p2))
if (qFuzzyIsNull(p2))
{
return false;
}

View File

@ -24,9 +24,13 @@
#include <QMap>
#include <QString>
#include <locale>
#include <ciso646>
#include <QtGlobal>
#include <locale>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#ifdef __INTEL_COMPILER
#include "qmuparserfixes.h"
@ -42,60 +46,60 @@
#define QMUP_VERSION_DATE "20191030; GC"
// Detect whether the compiler supports C++11 noexcept exception specifications.
# if defined(__clang__)
# if __has_feature(cxx_noexcept)
# define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // Clang 3.0 and above have noexcept
# endif
# elif defined(__GNUC__)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // GCC 4.7 and following have noexcept
# endif
# elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
# define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // Visual Studio 2015 and following have noexcept
# else
# define QMUP_NOEXCEPT_EXPR(x)
# endif
#if defined(__clang__)
#if __has_feature(cxx_noexcept)
#define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // Clang 3.0 and above have noexcept
#endif
#elif defined(__GNUC__)
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // GCC 4.7 and following have noexcept
#endif
#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
#define QMUP_NOEXCEPT_EXPR(x) noexcept(x) // Visual Studio 2015 and following have noexcept
#else
#define QMUP_NOEXCEPT_EXPR(x)
#endif
#ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
#define __has_cpp_attribute(x) 0
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#ifndef QT_HAS_CPP_ATTRIBUTE
#ifdef __has_cpp_attribute
# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
# define QT_HAS_CPP_ATTRIBUTE(x) 0
#define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif
#endif // QT_HAS_CPP_ATTRIBUTE
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
# define Q_FALLTHROUGH() [[fallthrough]]
#define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
#ifndef Q_FALLTHROUGH
# if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
# define Q_FALLTHROUGH() __attribute__((fallthrough))
# else
# define Q_FALLTHROUGH() (void)0
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
#define Q_FALLTHROUGH() __attribute__((fallthrough))
#else
#define Q_FALLTHROUGH() (void)0
#endif
#endif // defined(__cplusplus)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
/** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
//#define QMUP_MATH_EXCEPTIONS
// #define QMUP_MATH_EXCEPTIONS
/** @brief Activate this option in order to compile with OpenMP support.
OpenMP is used only in the bulk mode it may increase the performance a bit.
*/
//#define QMUP_USE_OPENMP
// #define QMUP_USE_OPENMP
/** @brief Definition of the basic parser string type. */
#define QMUP_STRING_TYPE std::wstring
@ -120,28 +124,28 @@ enum ECmdCode
// The following are codes for built in binary operators
// apart from built in operators the user has the opportunity to
// add user defined operators.
cmLE = 0, ///< Operator item: less or equal
cmGE = 1, ///< Operator item: greater or equal
cmNEQ = 2, ///< Operator item: not equal
cmEQ = 3, ///< Operator item: equals
cmLT = 4, ///< Operator item: less than
cmGT = 5, ///< Operator item: greater than
cmADD = 6, ///< Operator item: add
cmSUB = 7, ///< Operator item: subtract
cmMUL = 8, ///< Operator item: multiply
cmDIV = 9, ///< Operator item: division
cmPOW = 10, ///< Operator item: y to the power of ...
cmLAND = 11,
cmLOR = 12,
cmASSIGN = 13, ///< Operator item: Assignment operator
cmBO = 14, ///< Operator item: opening bracket
cmBC = 15, ///< Operator item: closing bracket
cmIF = 16, ///< For use in the ternary if-then-else operator
cmELSE = 17, ///< For use in the ternary if-then-else operator
cmENDIF = 18, ///< For use in the ternary if-then-else operator
cmARG_SEP = 19, ///< function argument separator
cmVAR = 20, ///< variable item
cmVAL = 21, ///< value item
cmLE = 0, ///< Operator item: less or equal
cmGE = 1, ///< Operator item: greater or equal
cmNEQ = 2, ///< Operator item: not equal
cmEQ = 3, ///< Operator item: equals
cmLT = 4, ///< Operator item: less than
cmGT = 5, ///< Operator item: greater than
cmADD = 6, ///< Operator item: add
cmSUB = 7, ///< Operator item: subtract
cmMUL = 8, ///< Operator item: multiply
cmDIV = 9, ///< Operator item: division
cmPOW = 10, ///< Operator item: y to the power of ...
cmLAND = 11,
cmLOR = 12,
cmASSIGN = 13, ///< Operator item: Assignment operator
cmBO = 14, ///< Operator item: opening bracket
cmBC = 15, ///< Operator item: closing bracket
cmIF = 16, ///< For use in the ternary if-then-else operator
cmELSE = 17, ///< For use in the ternary if-then-else operator
cmENDIF = 18, ///< For use in the ternary if-then-else operator
cmARG_SEP = 19, ///< function argument separator
cmVAR = 20, ///< variable item
cmVAL = 21, ///< value item
// For optimization purposes
cmVARPOW2,
@ -151,25 +155,25 @@ enum ECmdCode
cmPOW2,
// operators and functions
cmFUNC, ///< Code for a generic function item
cmFUNC_STR, ///< Code for a function with a string parameter
cmFUNC_BULK, ///< Special callbacks for Bulk mode with an additional parameter for the bulk index
cmSTRING, ///< Code for a string token
cmOPRT_BIN, ///< user defined binary operator
cmOPRT_POSTFIX, ///< code for postfix operators
cmOPRT_INFIX, ///< code for infix operators
cmEND, ///< end of formula
cmUNKNOWN ///< uninitialized item
cmFUNC, ///< Code for a generic function item
cmFUNC_STR, ///< Code for a function with a string parameter
cmFUNC_BULK, ///< Special callbacks for Bulk mode with an additional parameter for the bulk index
cmSTRING, ///< Code for a string token
cmOPRT_BIN, ///< user defined binary operator
cmOPRT_POSTFIX, ///< code for postfix operators
cmOPRT_INFIX, ///< code for infix operators
cmEND, ///< end of formula
cmUNKNOWN ///< uninitialized item
};
//------------------------------------------------------------------------------
/** @brief Types internally used by the parser.
*/
*/
enum ETypeCode
{
tpSTR = 0, ///< String type (Function arguments and constants only, no string variables)
tpDBL = 1, ///< Floating point variables
tpVOID = 2 ///< Undefined type.
tpSTR = 0, ///< String type (Function arguments and constants only, no string variables)
tpDBL = 1, ///< Floating point variables
tpVOID = 2 ///< Undefined type.
};
//------------------------------------------------------------------------------
@ -183,9 +187,9 @@ enum EParserVersionInfo
/** @brief Parser operator precedence values. */
enum EOprtAssociativity
{
oaLEFT = 0,
oaLEFT = 0,
oaRIGHT = 1,
oaNONE = 2
oaNONE = 2
};
//------------------------------------------------------------------------------
@ -193,17 +197,17 @@ enum EOprtAssociativity
enum EOprtPrecedence
{
// binary operators
prLOR = 1,
prLAND = 2,
prLOGIC = 3, ///< logic operators
prCMP = 4, ///< comparsion operators
prADD_SUB = 5, ///< addition
prMUL_DIV = 6, ///< multiplication/division
prPOW = 7, ///< power operator priority (highest)
prLOR = 1,
prLAND = 2,
prLOGIC = 3, ///< logic operators
prCMP = 4, ///< comparsion operators
prADD_SUB = 5, ///< addition
prMUL_DIV = 6, ///< multiplication/division
prPOW = 7, ///< power operator priority (highest)
// infix operators
prINFIX = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
prPOSTFIX = 6 ///< Postfix operator priority (currently unused)
prINFIX = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
prPOSTFIX = 6 ///< Postfix operator priority (currently unused)
};
//------------------------------------------------------------------------------
@ -222,12 +226,12 @@ typedef QMUP_STRING_TYPE string_type;
typedef string_type::value_type char_type;
/** @brief Typedef for easily using stringstream that respect the parser stringtype. */
typedef std::basic_stringstream < char_type, std::char_traits<char_type>, std::allocator<char_type> > stringstream_type;
typedef std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type>> stringstream_type;
// Data container types
/** @brief Type used for storing variables. */
typedef std::map<QString, qreal*> varmap_type;
typedef std::map<QString, qreal *> varmap_type;
/** @brief Type used for storing constants. */
typedef std::map<QString, qreal> valmap_type;
@ -238,92 +242,92 @@ typedef std::map<QString, qmusizetype> strmap_type;
// Parser callbacks
/** @brief Callback type used for functions without arguments. */
typedef qreal ( *generic_fun_type ) ();
typedef qreal (*generic_fun_type)();
/** @brief Callback type used for functions without arguments. */
typedef qreal ( *fun_type0 ) ();
typedef qreal (*fun_type0)();
/** @brief Callback type used for functions with a single arguments. */
typedef qreal ( *fun_type1 ) ( qreal );
typedef qreal (*fun_type1)(qreal);
/** @brief Callback type used for functions with two arguments. */
typedef qreal ( *fun_type2 ) ( qreal, qreal );
typedef qreal (*fun_type2)(qreal, qreal);
/** @brief Callback type used for functions with three arguments. */
typedef qreal ( *fun_type3 ) ( qreal, qreal, qreal );
typedef qreal (*fun_type3)(qreal, qreal, qreal);
/** @brief Callback type used for functions with four arguments. */
typedef qreal ( *fun_type4 ) ( qreal, qreal, qreal, qreal );
typedef qreal (*fun_type4)(qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type5 ) ( qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type5)(qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type6 ) ( qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type6)(qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type7 ) ( qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type7)(qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type8 ) ( qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type8)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type9 ) ( qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type9)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *fun_type10 ) ( qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*fun_type10)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions without arguments. */
typedef qreal ( *bulkfun_type0 ) ( int, int );
typedef qreal (*bulkfun_type0)(int, int);
/** @brief Callback type used for functions with a single arguments. */
typedef qreal ( *bulkfun_type1 ) ( int, int, qreal );
typedef qreal (*bulkfun_type1)(int, int, qreal);
/** @brief Callback type used for functions with two arguments. */
typedef qreal ( *bulkfun_type2 ) ( int, int, qreal, qreal );
typedef qreal (*bulkfun_type2)(int, int, qreal, qreal);
/** @brief Callback type used for functions with three arguments. */
typedef qreal ( *bulkfun_type3 ) ( int, int, qreal, qreal, qreal );
typedef qreal (*bulkfun_type3)(int, int, qreal, qreal, qreal);
/** @brief Callback type used for functions with four arguments. */
typedef qreal ( *bulkfun_type4 ) ( int, int, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type4)(int, int, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type5 ) ( int, int, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type5)(int, int, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type6 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type6)(int, int, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type7 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type7)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type8 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type8)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type9 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type9)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal ( *bulkfun_type10 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
typedef qreal (*bulkfun_type10)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with a variable argument list. */
typedef qreal ( *multfun_type ) ( const qreal*, qmusizetype );
typedef qreal (*multfun_type)(const qreal *, qmusizetype);
/** @brief Callback type used for functions taking a string as an argument. */
typedef qreal ( *strfun_type1 ) ( const QString & );
typedef qreal (*strfun_type1)(const QString &);
/** @brief Callback type used for functions taking a string and a value as arguments. */
typedef qreal ( *strfun_type2 ) ( const QString &, qreal );
typedef qreal (*strfun_type2)(const QString &, qreal);
/** @brief Callback type used for functions taking a string and two values as arguments. */
typedef qreal ( *strfun_type3 ) ( const QString &, qreal, qreal );
typedef qreal (*strfun_type3)(const QString &, qreal, qreal);
/** @brief Callback used for functions that identify values in a string. */
typedef int ( *identfun_type ) ( const QString &sExpr, qmusizetype *nPos, qreal *fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand );
typedef int (*identfun_type)(const QString &sExpr, qmusizetype *nPos, qreal *fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand);
/** @brief Callback used for variable creation factory functions. */
typedef qreal* ( *facfun_type ) ( const QString &, void* );
} // end of namespace
typedef qreal *(*facfun_type)(const QString &, void *);
} // namespace qmu
#endif

View File

@ -29,14 +29,27 @@
#ifndef DXFDEF_H
#define DXFDEF_H
#include <QtGlobal>
#include <ciso646>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal>
enum class VarMeasurement : quint8 { English=0, Metric=1 };
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//Default drawing units for AutoCAD DesignCenter blocks:
enum class VarInsunits : quint8 { Inches=1, Millimeters=4, Centimeters=5 };
enum class VarMeasurement : quint8
{
English = 0,
Metric = 1
};
// Default drawing units for AutoCAD DesignCenter blocks:
enum class VarInsunits : quint8
{
Inches = 1,
Millimeters = 4,
Centimeters = 5
};
// Helps mark end of string. See VDxfEngine::drawTextItem for more details
extern const QString endStringPlaceholder;
@ -44,7 +57,7 @@ extern const QString endStringPlaceholder;
Q_REQUIRED_RESULT static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
if (qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}

View File

@ -15,166 +15,161 @@
#define DRW_VERSION "0.6.3"
#include <string>
#include <list>
#include <cmath>
#include <unordered_map>
#include <QtGlobal>
#include <ciso646>
#include <cmath>
#include <list>
#include <string>
#include <unordered_map>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#ifdef DRW_ASSERTS
# define drw_assert(a) assert(a)
#define drw_assert(a) assert(a)
#else
# define drw_assert(a)
#define drw_assert(a)
#endif
#define UTF8STRING std::string
#define DRW_UNUSED(x) (void)x
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
# define DRW_WIN
#define DRW_WIN
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define DRW_WIN
#define DRW_WIN
#elif defined(__MWERKS__) && defined(__INTEL__)
# define DRW_WIN
#define DRW_WIN
#else
# define DRW_POSIX
#define DRW_POSIX
#endif
#ifndef M_PI
#define M_PI 3.141592653589793238462643
#define M_PI 3.141592653589793238462643
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#define M_PI_2 1.57079632679489661923
#endif
#define M_PIx2 6.283185307179586 // 2*PI
#define M_PIx2 6.283185307179586 // 2*PI
#define ARAD 57.29577951308232
#ifndef __has_cpp_attribute
# define __has_cpp_attribute(x) 0
#define __has_cpp_attribute(x) 0
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#ifndef QT_HAS_CPP_ATTRIBUTE
#ifdef __has_cpp_attribute
# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
# define QT_HAS_CPP_ATTRIBUTE(x) 0
#define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif
#endif // QT_HAS_CPP_ATTRIBUTE
#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
#define Q_FALLTHROUGH() [[clang::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
#define Q_FALLTHROUGH() [[gnu::fallthrough]]
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
# define Q_FALLTHROUGH() [[fallthrough]]
#define Q_FALLTHROUGH() [[fallthrough]]
#endif
#endif
#ifndef Q_FALLTHROUGH
# if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
# define Q_FALLTHROUGH() __attribute__((fallthrough))
# else
# define Q_FALLTHROUGH() (void)0
#if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL)
#define Q_FALLTHROUGH() __attribute__((fallthrough))
#else
#define Q_FALLTHROUGH() (void)0
#endif
#endif // defined(__cplusplus)
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
#define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
#ifndef Q_DISABLE_ASSIGN_MOVE
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Class(Class &&) = delete; \
#define Q_DISABLE_ASSIGN_MOVE(Class) \
Q_DISABLE_ASSIGN(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#endif
typedef signed char dint8; /* 8 bit signed */
typedef signed short dint16; /* 16 bit signed */
typedef signed int dint32; /* 32 bit signed */
typedef long long int dint64; /* 64 bit signed */
typedef signed char dint8; /* 8 bit signed */
typedef signed short dint16; /* 16 bit signed */
typedef signed int dint32; /* 32 bit signed */
typedef long long int dint64; /* 64 bit signed */
typedef unsigned char duint8; /* 8 bit unsigned */
typedef unsigned short duint16; /* 16 bit unsigned */
typedef unsigned int duint32; /* 32 bit unsigned */
typedef unsigned long long int duint64; /* 64 bit unsigned */
typedef float dfloat32; /* 32 bit floating point */
typedef double ddouble64; /* 64 bit floating point */
typedef long double ddouble80; /* 80 bit floating point */
typedef float dfloat32; /* 32 bit floating point */
typedef double ddouble64; /* 64 bit floating point */
typedef long double ddouble80; /* 80 bit floating point */
namespace DRW {
namespace DRW
{
//! Version numbers for the DXF Format.
enum Version {
UNKNOWNV, //!< UNKNOWN VERSION.
MC00, //!< DWG Release 1.1
AC12, //!< DWG Release 1.2
AC14, //!< DWG Release 1.4
AC150, //!< DWG Release 2.0
AC210, //!< DWG Release 2.10
AC1002, //!< DWG Release 2.5
AC1003, //!< DWG Release 2.6
AC1004, //!< DWG Relase 9
AC1006, //!< DWG Release 10 (R10)
AC1009, //!< DWG Release 11/12 (LT R1/R2) (R11 & R12)
AC1012, //!< DWG Release 13 (LT95) (R13)
AC1014, //!< DWG Release 14/14.01 (LT97/LT98) (R14)
AC1015, //!< AutoCAD 2000/2000i/2002 (ACAD 2000)
AC1018, //!< AutoCAD 2004/2005/2006 (ACAD 2004)
AC1021, //!< AutoCAD 2007/2008/2009 (ACAD 2007)
AC1024, //!< AutoCAD 2010/2011/2012 (ACAD 2010)
AC1027, //!< AutoCAD 2013/2014/2015/2016/2017 (ACAD 2013)
AC1032, //!< AutoCAD 2018/2019/2020 (ACAD 2018)
enum Version
{
UNKNOWNV, //!< UNKNOWN VERSION.
MC00, //!< DWG Release 1.1
AC12, //!< DWG Release 1.2
AC14, //!< DWG Release 1.4
AC150, //!< DWG Release 2.0
AC210, //!< DWG Release 2.10
AC1002, //!< DWG Release 2.5
AC1003, //!< DWG Release 2.6
AC1004, //!< DWG Relase 9
AC1006, //!< DWG Release 10 (R10)
AC1009, //!< DWG Release 11/12 (LT R1/R2) (R11 & R12)
AC1012, //!< DWG Release 13 (LT95) (R13)
AC1014, //!< DWG Release 14/14.01 (LT97/LT98) (R14)
AC1015, //!< AutoCAD 2000/2000i/2002 (ACAD 2000)
AC1018, //!< AutoCAD 2004/2005/2006 (ACAD 2004)
AC1021, //!< AutoCAD 2007/2008/2009 (ACAD 2007)
AC1024, //!< AutoCAD 2010/2011/2012 (ACAD 2010)
AC1027, //!< AutoCAD 2013/2014/2015/2016/2017 (ACAD 2013)
AC1032, //!< AutoCAD 2018/2019/2020 (ACAD 2018)
};
const std::unordered_map< const char*, DRW::Version > dwgVersionStrings {
{ "MC0.0", DRW::MC00 },
{ "AC1.2", DRW::AC12 },
{ "AC1.4", DRW::AC14 },
{ "AC1.50", DRW::AC150 },
{ "AC2.10", DRW::AC210 },
{ "AC1002", DRW::AC1002 },
{ "AC1003", DRW::AC1003 },
{ "AC1004", DRW::AC1004 },
{ "AC1006", DRW::AC1006 },
{ "AC1009", DRW::AC1009 },
{ "AC1012", DRW::AC1012 },
{ "AC1014", DRW::AC1014 },
{ "AC1015", DRW::AC1015 },
{ "AC1018", DRW::AC1018 },
{ "AC1021", DRW::AC1021 },
{ "AC1024", DRW::AC1024 },
{ "AC1027", DRW::AC1027 },
{ "AC1032", DRW::AC1032 },
const std::unordered_map<const char *, DRW::Version> dwgVersionStrings{
{"MC0.0", DRW::MC00}, {"AC1.2", DRW::AC12}, {"AC1.4", DRW::AC14}, {"AC1.50", DRW::AC150},
{"AC2.10", DRW::AC210}, {"AC1002", DRW::AC1002}, {"AC1003", DRW::AC1003}, {"AC1004", DRW::AC1004},
{"AC1006", DRW::AC1006}, {"AC1009", DRW::AC1009}, {"AC1012", DRW::AC1012}, {"AC1014", DRW::AC1014},
{"AC1015", DRW::AC1015}, {"AC1018", DRW::AC1018}, {"AC1021", DRW::AC1021}, {"AC1024", DRW::AC1024},
{"AC1027", DRW::AC1027}, {"AC1032", DRW::AC1032},
};
enum error {
BAD_NONE, /*!< No error. */
BAD_UNKNOWN, /*!< UNKNOWN. */
BAD_OPEN, /*!< error opening file. */
BAD_VERSION, /*!< unsupported version. */
BAD_READ_METADATA, /*!< error reading matadata. */
BAD_READ_FILE_HEADER, /*!< error in file header read process. */
BAD_READ_HEADER, /*!< error in header vars read process. */
BAD_READ_HANDLES, /*!< error in object map read process. */
BAD_READ_CLASSES, /*!< error in classes read process. */
BAD_READ_TABLES, /*!< error in tables read process. */
BAD_READ_BLOCKS, /*!< error in block read process. */
BAD_READ_ENTITIES, /*!< error in entities read process. */
BAD_READ_OBJECTS, /*!< error in objects read process. */
BAD_READ_SECTION, /*!< error in sections read process. */
BAD_CODE_PARSED, /*!< error in any parseCodes() method. */
enum error
{
BAD_NONE, /*!< No error. */
BAD_UNKNOWN, /*!< UNKNOWN. */
BAD_OPEN, /*!< error opening file. */
BAD_VERSION, /*!< unsupported version. */
BAD_READ_METADATA, /*!< error reading matadata. */
BAD_READ_FILE_HEADER, /*!< error in file header read process. */
BAD_READ_HEADER, /*!< error in header vars read process. */
BAD_READ_HANDLES, /*!< error in object map read process. */
BAD_READ_CLASSES, /*!< error in classes read process. */
BAD_READ_TABLES, /*!< error in tables read process. */
BAD_READ_BLOCKS, /*!< error in block read process. */
BAD_READ_ENTITIES, /*!< error in entities read process. */
BAD_READ_OBJECTS, /*!< error in objects read process. */
BAD_READ_SECTION, /*!< error in sections read process. */
BAD_CODE_PARSED, /*!< error in any parseCodes() method. */
};
enum class DebugLevel {
enum class DebugLevel
{
None,
Debug
};
@ -184,18 +179,29 @@ enum class DebugLevel {
*
* The base class is silent and ignores all debugging.
*/
class DebugPrinter {
class DebugPrinter
{
public:
virtual void printS(const std::string &s){(void)s;}
virtual void printI(long long int i){(void)i;}
virtual void printUI(long long unsigned int i){(void)i;}
virtual void printD(double d){(void)d;}
virtual void printH(long long int i){(void)i;}
virtual void printB(int i){(void)i;}
virtual void printHL(int c, int s, int h){(void)c;(void)s;(void)h;}
virtual void printPT(double x, double y, double z){(void)x;(void)y;(void)z;}
DebugPrinter()=default;
virtual ~DebugPrinter()=default;
virtual void printS(const std::string &s) { (void)s; }
virtual void printI(long long int i) { (void)i; }
virtual void printUI(long long unsigned int i) { (void)i; }
virtual void printD(double d) { (void)d; }
virtual void printH(long long int i) { (void)i; }
virtual void printB(int i) { (void)i; }
virtual void printHL(int c, int s, int h)
{
(void)c;
(void)s;
(void)h;
}
virtual void printPT(double x, double y, double z)
{
(void)x;
(void)y;
(void)z;
}
DebugPrinter() = default;
virtual ~DebugPrinter() = default;
};
/**
@ -203,10 +209,11 @@ public:
*
* Ownership of `printer` is transferred.
*/
void setCustomDebugPrinter( DebugPrinter* printer );
void setCustomDebugPrinter(DebugPrinter *printer);
//! Special codes for colors
enum ColorCodes {
enum ColorCodes
{
black = 250,
green = 3,
red = 1,
@ -228,18 +235,21 @@ enum ColorCodes {
};
//! Spaces
enum Space {
enum Space
{
ModelSpace = 0,
PaperSpace = 1
};
//! Special kinds of handles
enum HandleCodes {
enum HandleCodes
{
NoHandle = 0
};
//! Shadow mode
enum ShadowMode {
enum ShadowMode
{
CastAndReceieveShadows = 0,
CastShadows = 1,
ReceiveShadows = 2,
@ -247,17 +257,20 @@ enum ShadowMode {
};
//! Special kinds of materials
enum MaterialCodes {
enum MaterialCodes
{
MaterialByLayer = 0
};
//! Special kinds of plot styles
enum PlotStyleCodes {
enum PlotStyleCodes
{
DefaultPlotStyle = 0
};
//! Special kinds of transparencies
enum TransparencyCodes {
enum TransparencyCodes
{
Opaque = 0,
Transparent = -1
};
@ -267,7 +280,7 @@ enum TransparencyCodes {
Q_REQUIRED_RESULT static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
if (qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}
@ -286,24 +299,27 @@ static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool
* Class to handle 3D coordinate point
* @author Rallaz
*/
class DRW_Coord {
class DRW_Coord
{
public:
DRW_Coord() = default;
DRW_Coord(double ix, double iy, double iz)
: x(ix),
y(iy),
z(iz)
{}
: x(ix),
y(iy),
z(iz)
{
}
DRW_Coord(const DRW_Coord &data)
: x(data.x),
y(data.y),
z(data.z)
{}
: x(data.x),
y(data.y),
z(data.z)
{
}
auto operator=(const DRW_Coord &data) -> DRW_Coord &
{
if ( &data == this )
if (&data == this)
{
return *this;
}
@ -313,136 +329,141 @@ public:
z = data.z;
return *this;
}
/*!< convert to unitary vector */
void unitize(){
/*!< convert to unitary vector */
void unitize()
{
double dist;
dist = hypot(hypot(x, y), z);
if (dist > 0.0) {
x= x/dist;
y= y/dist;
z= z/dist;
if (dist > 0.0)
{
x = x / dist;
y = y / dist;
z = z / dist;
}
}
public:
double x {0};
double y {0};
double z {0};
double x{0};
double y{0};
double z{0};
};
//! Class to handle vertex
/*!
* Class to handle vertex for lwpolyline entity
* @author Rallaz
*/
class DRW_Vertex2D {
* Class to handle vertex for lwpolyline entity
* @author Rallaz
*/
class DRW_Vertex2D
{
public:
DRW_Vertex2D()
: x(),
y(),
stawidth(0),
endwidth(0),
bulge(0)
: x(),
y(),
stawidth(0),
endwidth(0),
bulge(0)
{
// eType = DRW::LWPOLYLINE;
// eType = DRW::LWPOLYLINE;
}
DRW_Vertex2D(double sx, double sy, double b = 0.0)
: x(sx),
y(sy),
stawidth(0),
endwidth(0),
bulge(b)
{}
: x(sx),
y(sy),
stawidth(0),
endwidth(0),
bulge(b)
{
}
public:
double x; /*!< x coordinate, code 10 */
double y; /*!< y coordinate, code 20 */
double stawidth; /*!< Start width, code 40 */
double endwidth; /*!< End width, code 41 */
double bulge; /*!< bulge, code 42 */
double x; /*!< x coordinate, code 10 */
double y; /*!< y coordinate, code 20 */
double stawidth; /*!< Start width, code 40 */
double endwidth; /*!< End width, code 41 */
double bulge; /*!< bulge, code 42 */
};
//! Class to handle header vars
/*!
* Class to handle header vars
* @author Rallaz
*/
class DRW_Variant {
* Class to handle header vars
* @author Rallaz
*/
class DRW_Variant
{
public:
enum TYPE {
enum TYPE
{
STRING,
INTEGER,
DOUBLE,
COORD,
INVALID
};
//TODO: add INT64 support
// TODO: add INT64 support
DRW_Variant()
: content(),
type(INVALID),
code(),
sdata(),
vdata()
{}
: content(),
type(INVALID),
code(),
sdata(),
vdata()
{
}
DRW_Variant(int c, dint32 i)
: content(),
type(),
code(c),
sdata(),
vdata()
: content(),
type(),
code(c),
sdata(),
vdata()
{
addInt(i);
}
DRW_Variant(int c, duint32 i)
: content(),
type(),
code(c),
sdata(),
vdata()
: content(),
type(),
code(c),
sdata(),
vdata()
{
addInt(static_cast<dint32>(i));//RLZ: verify if work with big numbers
addInt(static_cast<dint32>(i)); // RLZ: verify if work with big numbers
}
DRW_Variant(int c, double d)
: content(),
type(),
code(c),
sdata(),
vdata()
: content(),
type(),
code(c),
sdata(),
vdata()
{
addDouble(d);
}
DRW_Variant(int c, const UTF8STRING &s)
: content(),
type(),
code(c),
sdata(),
vdata()
: content(),
type(),
code(c),
sdata(),
vdata()
{
addString(s);
}
DRW_Variant(int c, const DRW_Coord &crd)
: content(),
type(),
code(c),
sdata(),
vdata()
: content(),
type(),
code(c),
sdata(),
vdata()
{
addCoord(crd);
}
DRW_Variant(const DRW_Variant& d)
: content(d.content),
type(d.type),
code(d.code),
sdata(),
vdata()
DRW_Variant(const DRW_Variant &d)
: content(d.content),
type(d.type),
code(d.code),
sdata(),
vdata()
{
if (d.type == COORD)
{
@ -459,18 +480,56 @@ public:
~DRW_Variant() = default;
void addString(const UTF8STRING &s) {setType(STRING); sdata = s; content.s = &sdata;}
void addInt(int i) {setType(INTEGER); content.i = i;}
void addDouble(double d) {setType(DOUBLE); content.d = d;}
void addCoord() {setType(COORD); vdata.x=0.0; vdata.y=0.0; vdata.z=0.0; content.v = &vdata;}
void addCoord(const DRW_Coord &v) {setType(COORD); vdata = v; content.v = &vdata;}
void setType(TYPE t) { type = t;}
void setCoordX(double d) { if (type == COORD) vdata.x = d;}
void setCoordY(double d) { if (type == COORD) vdata.y = d;}
void setCoordZ(double d) { if (type == COORD) vdata.z = d;}
void addString(const UTF8STRING &s)
{
setType(STRING);
sdata = s;
content.s = &sdata;
}
void addInt(int i)
{
setType(INTEGER);
content.i = i;
}
void addDouble(double d)
{
setType(DOUBLE);
content.d = d;
}
void addCoord()
{
setType(COORD);
vdata.x = 0.0;
vdata.y = 0.0;
vdata.z = 0.0;
content.v = &vdata;
}
void addCoord(const DRW_Coord &v)
{
setType(COORD);
vdata = v;
content.v = &vdata;
}
void setType(TYPE t) { type = t; }
void setCoordX(double d)
{
if (type == COORD)
vdata.x = d;
}
void setCoordY(double d)
{
if (type == COORD)
vdata.y = d;
}
void setCoordZ(double d)
{
if (type == COORD)
vdata.z = d;
}
private:
typedef union {
typedef union
{
UTF8STRING *s;
dint32 i;
double d;
@ -480,7 +539,7 @@ private:
public:
DRW_VarContent content;
TYPE type;
int code; /*!< dxf code of this value*/
int code; /*!< dxf code of this value*/
private:
auto operator=(const DRW_Variant &) -> DRW_Variant &Q_DECL_EQ_DELETE;
@ -490,14 +549,16 @@ private:
//! Class to convert between line width and integer
/*!
* Class to convert between line width and integer
* verifing valid values, if value is not valid
* returns widthDefault.
* @author Rallaz
*/
class DRW_LW_Conv{
* Class to convert between line width and integer
* verifing valid values, if value is not valid
* returns widthDefault.
* @author Rallaz
*/
class DRW_LW_Conv
{
public:
enum lineWidth {
enum lineWidth
{
width00 = 0, /*!< 0.00mm (dxf 0)*/
width01 = 1, /*!< 0.05mm (dxf 5)*/
width02 = 2, /*!< 0.09mm (dxf 9)*/
@ -529,71 +590,73 @@ public:
static auto lineWidth2dxfInt(lineWidth lw) -> int
{
switch (lw){
case widthByLayer:
return -1;
case widthByBlock:
return -2;
case widthDefault:
return -3;
case width00:
return 0;
case width01:
return 5;
case width02:
return 9;
case width03:
return 13;
case width04:
return 15;
case width05:
return 18;
case width06:
return 20;
case width07:
return 25;
case width08:
return 30;
case width09:
return 35;
case width10:
return 40;
case width11:
return 50;
case width12:
return 53;
case width13:
return 60;
case width14:
return 70;
case width15:
return 80;
case width16:
return 90;
case width17:
return 100;
case width18:
return 106;
case width19:
return 120;
case width20:
return 140;
case width21:
return 158;
case width22:
return 200;
case width23:
return 211;
default:
break;
switch (lw)
{
case widthByLayer:
return -1;
case widthByBlock:
return -2;
case widthDefault:
return -3;
case width00:
return 0;
case width01:
return 5;
case width02:
return 9;
case width03:
return 13;
case width04:
return 15;
case width05:
return 18;
case width06:
return 20;
case width07:
return 25;
case width08:
return 30;
case width09:
return 35;
case width10:
return 40;
case width11:
return 50;
case width12:
return 53;
case width13:
return 60;
case width14:
return 70;
case width15:
return 80;
case width16:
return 90;
case width17:
return 100;
case width18:
return 106;
case width19:
return 120;
case width20:
return 140;
case width21:
return 158;
case width22:
return 200;
case width23:
return 211;
default:
break;
}
return -3;
}
static auto dxfInt2lineWidth(int i) -> lineWidth
{
if (i<0) {
if (i==-1)
if (i < 0)
{
if (i == -1)
return widthByLayer;
if (i == -2)
return widthByBlock;
@ -696,7 +759,7 @@ public:
{
return width23;
}
//default by default
// default by default
return widthDefault;
}
};

View File

@ -13,20 +13,25 @@
#ifndef LIBDXFRW_H
#define LIBDXFRW_H
#include <string>
#include <unordered_map>
#include "drw_entities.h"
#include "drw_objects.h"
#include "drw_header.h"
#include "drw_interface.h"
#include <ciso646>
#include "drw_objects.h"
#include <string>
#include <unordered_map>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
class dxfReader;
class dxfWriter;
class dxfRW {
class dxfRW
{
public:
explicit dxfRW(const char* name);
explicit dxfRW(const char *name);
~dxfRW();
static void setDebug(DRW::DebugLevel lvl);
/// reads the file specified in constructor
@ -38,8 +43,8 @@ public:
* @return true for success
*/
auto read(DRW_Interface *interface_, bool ext) -> bool;
void setBinary(bool b) {binFile = b;}
void AddXSpaceBlock(bool add) {m_xSpaceBlock = add;}
void setBinary(bool b) { binFile = b; }
void AddXSpaceBlock(bool add) { m_xSpaceBlock = add; }
auto write(DRW_Interface *interface_, DRW::Version ver, bool bin) -> bool;
auto writeLineType(DRW_LType *ent) -> bool;
@ -72,7 +77,7 @@ public:
auto writeImage(DRW_Image *ent, const std::string &name) -> DRW_ImageDef *;
auto writeLeader(DRW_Leader *ent) -> bool;
auto writeDimension(DRW_Dimension *ent) -> bool;
void setEllipseParts(int parts){elParts = parts;} /*!< set parts number when convert ellipse to polyline */
void setEllipseParts(int parts) { elParts = parts; } /*!< set parts number when convert ellipse to polyline */
auto writePlotSettings(DRW_PlotSettings *ent) -> bool;
auto ErrorString() const -> std::string;
@ -135,7 +140,7 @@ private:
private:
DRW::Version version;
DRW::error error {DRW::BAD_NONE};
DRW::error error{DRW::BAD_NONE};
std::string fileName;
std::string codePage;
bool binFile;
@ -144,16 +149,16 @@ private:
dxfWriter *writer;
DRW_Interface *iface;
DRW_Header header;
// int section;
// int section;
std::string nextentity;
int entCount;
bool wlayer0;
bool dimstyleStd;
bool applyExt;
bool writingBlock;
int elParts; /*!< parts number when convert ellipse to polyline */
std::unordered_map<std::string,int> blockMap;
std::vector<DRW_ImageDef*> imageDef; /*!< imageDef list */
int elParts; /*!< parts number when convert ellipse to polyline */
std::unordered_map<std::string, int> blockMap;
std::vector<DRW_ImageDef *> imageDef; /*!< imageDef list */
int currHandle;

View File

@ -33,6 +33,11 @@
#include <QString>
#include <QtMath>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"
#endif

View File

@ -32,9 +32,13 @@
#include <QPainterPath>
#include <QSize>
#include <QTransform>
#include <ciso646>
#include <climits>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
enum class LayoutExportFormats : qint8
{
SVG = 0,

View File

@ -50,7 +50,10 @@
template <class T> class QSharedPointer;
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
// Backport of relaxed constexpr
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)

View File

@ -53,6 +53,11 @@
#include "../vmisc/backport/text.h"
#endif
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
class QPaintDevice;
class QPixmap;
class QPoint;
@ -60,8 +65,6 @@ class QPointF;
class QPolygonF;
class QRectF;
#include <ciso646>
//---------------------------------------------------------------------------------------------------------------------
static inline auto svgEngineFeatures() -> QPaintEngine::PaintEngineFeatures
{

View File

@ -21,7 +21,6 @@
#ifndef VPROPERTY_H
#define VPROPERTY_H
#include <QAbstractItemDelegate>
#include <QEvent>
#include <QMap>
@ -32,30 +31,39 @@
#include <QStringList>
#include <QStyleOptionViewItem>
#include <QVariant>
#include <Qt>
#include <QtGlobal>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal>
#include "vpropertyexplorer_global.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#include "vpropertydef.h"
namespace VPE
{
enum class Property : qint8 {Simple, Complex};
enum class Property : qint8
{
Simple,
Complex
};
static const int MyCustomEventType = 1099;
class VPROPERTYEXPLORERSHARED_EXPORT UserChangeEvent : public QEvent
{
public:
UserChangeEvent() : QEvent(static_cast<QEvent::Type>(MyCustomEventType)) {}
UserChangeEvent()
: QEvent(static_cast<QEvent::Type>(MyCustomEventType))
{
}
virtual ~UserChangeEvent() override;
};
@ -68,6 +76,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class VPROPERTYEXPLORERSHARED_EXPORT VProperty : public QObject
{
Q_OBJECT // NOLINT
public:
enum DPC_DisplayColumn
{
@ -76,7 +85,7 @@ public:
};
//! Standard constructor, takes a name and a parent property as argument
explicit VProperty(const QString& name,
explicit VProperty(const QString &name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMetaType::Type type = QMetaType::QString);
#else
@ -122,7 +131,7 @@ public:
virtual auto flags(int column = DPC_Name) const -> Qt::ItemFlags;
//! Sets the value of the property
virtual void setValue(const QVariant& value);
virtual void setValue(const QVariant &value);
//! Returns the value of the property as a QVariant
virtual auto getValue() const -> QVariant;
@ -131,7 +140,7 @@ public:
virtual auto serialize() const -> QString;
//! Deserializes the value from a string
virtual void deserialize(const QString& value);
virtual void deserialize(const QString &value);
// The following functions are experimental and not yet implemented.
/*//! Returns a pointer to the data stored and handled by this property. In most cases this function shouldn't be
@ -146,13 +155,13 @@ public:
virtual bool setDataPointer(void* pointer);*/
//! Sets the name of the property
virtual void setName(const QString& name);
virtual void setName(const QString &name);
//! Gets the name of the property
virtual auto getName() const -> QString;
//! Sets the name of the property
virtual void setDescription(const QString& desc);
virtual void setDescription(const QString &desc);
//! Gets the name of the property
virtual auto getDescription() const -> QString;
@ -176,10 +185,10 @@ public:
virtual auto getParent() const -> VProperty *;
//! Sets the parent of this property
virtual void setParent(VProperty* parent);
virtual void setParent(VProperty *parent);
//! Removes a child from the children list, doesn't delete the child!
virtual void removeChild(VProperty* child);
virtual void removeChild(VProperty *child);
//! Returns the row the child has
virtual auto getChildRow(VProperty *child) const -> vpesizetype;
@ -195,13 +204,13 @@ public:
//! Sets the settings by calling the overloaded setSetting(const QString& key, const QVariant& value) for each item
//! in the map.
virtual void setSettings(const QMap<QString, QVariant>& settings);
virtual void setSettings(const QMap<QString, QVariant> &settings);
//! Get the settings.
virtual auto getSettings() const -> QMap<QString, QVariant>;
//! Sets the settings. This function has to be implemented in a subclass in order to have an effect
virtual void setSetting(const QString& key, const QVariant& value);
virtual void setSetting(const QString &key, const QVariant &value);
//! Get the settings. This function has to be implemented in a subclass in order to have an effect
virtual auto getSetting(const QString &key) const -> QVariant;
@ -218,7 +227,7 @@ public:
-> VProperty *;
auto propertyType() const -> Property;
void setPropertyType(const Property &type);
void setPropertyType(const Property &type);
virtual void UpdateParent(const QVariant &value);
public slots:
@ -228,10 +237,10 @@ signals:
protected:
//! Protected constructor
explicit VProperty(VPropertyPrivate* d);
explicit VProperty(VPropertyPrivate *d);
//! The protected structure holding the member variables (to assure binary compatibility)
VPropertyPrivate* d_ptr;
VPropertyPrivate *d_ptr;
private:
// Provide access functions for the d_ptr
@ -241,6 +250,6 @@ private:
QT_WARNING_POP
}
} // namespace VPE
#endif // VPROPERTY_H

View File

@ -44,7 +44,10 @@
#include "../vlayout/vrawsapoint.h"
#include "../vlayout/vsapoint.h"
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#ifdef __GNUC__
#define V_UNUSED __attribute__((unused))
@ -81,7 +84,9 @@ class VRawSAPoint;
class AbstractTest : public QObject
{
Q_OBJECT // NOLINT
public : explicit AbstractTest(QObject *parent = nullptr);
public:
explicit AbstractTest(QObject *parent = nullptr);
template <class T> static auto VectorFromJson(const QString &json) -> QVector<T>;

View File

@ -29,11 +29,15 @@
#include <QPainter>
#include <QTextLayout>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
VElidedLabel::VElidedLabel(QWidget *parent)
: QFrame(parent)
: QFrame(parent)
{
// reserve size for one line of text
setMinimumHeight(fontMetrics().lineSpacing());
@ -41,8 +45,8 @@ VElidedLabel::VElidedLabel(QWidget *parent)
//---------------------------------------------------------------------------------------------------------------------
VElidedLabel::VElidedLabel(const QString &text, QWidget *parent)
: QFrame(parent),
m_content(text)
: QFrame(parent),
m_content(text)
{
// reserve size for one line of text
setMinimumHeight(fontMetrics().lineSpacing());
@ -71,7 +75,7 @@ void VElidedLabel::paintEvent(QPaintEvent *event)
if (not DrawParagraph(painter, paragraphs.at(i), y, didElide))
{
// It text has empty strings a user will not see elided string, but we still want to show a tooltip.
if (i != paragraphs.size()-1 && !didElide)
if (i != paragraphs.size() - 1 && !didElide)
{
didElide = true;
}
@ -90,7 +94,7 @@ void VElidedLabel::paintEvent(QPaintEvent *event)
// Show a tooltip in case we cannot show a whole text in the widget
// Use dumb html tag to separate paragraphs.
QString toolTip;
for(int i = 0; i < paragraphs.size(); ++i)
for (int i = 0; i < paragraphs.size(); ++i)
{
if (i != 0)
{

View File

@ -27,20 +27,23 @@
*************************************************************************/
#include "vplaintextedit.h"
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
VPlainTextEdit::VPlainTextEdit(QWidget * parent)
: QPlainTextEdit(parent),
m_highlighter(document())
VPlainTextEdit::VPlainTextEdit(QWidget *parent)
: QPlainTextEdit(parent),
m_highlighter(document())
{
connect(this, &QPlainTextEdit::cursorPositionChanged, this, &VPlainTextEdit::MatchParentheses);
}
//---------------------------------------------------------------------------------------------------------------------
VPlainTextEdit::VPlainTextEdit(const QString & text, QWidget * parent)
: QPlainTextEdit(text, parent),
m_highlighter(document())
VPlainTextEdit::VPlainTextEdit(const QString &text, QWidget *parent)
: QPlainTextEdit(text, parent),
m_highlighter(document())
{
connect(this, &QPlainTextEdit::cursorPositionChanged, this, &VPlainTextEdit::MatchParentheses);
}
@ -54,13 +57,13 @@ VPlainTextEdit::~VPlainTextEdit()
//---------------------------------------------------------------------------------------------------------------------
void VPlainTextEdit::SetFilter(const QString &filter)
{
if(m_filter.isEmpty() && not filter.isEmpty())
if (m_filter.isEmpty() && not filter.isEmpty())
{
QTextDocument *doc = document();
m_allLines.clear();
m_allLines.reserve(doc->lineCount());
for(int i=0; i < doc->blockCount(); ++i)
for (int i = 0; i < doc->blockCount(); ++i)
{
m_allLines.append(doc->findBlockByNumber(i).text());
}
@ -70,7 +73,7 @@ void VPlainTextEdit::SetFilter(const QString &filter)
Filter();
if(m_filter.isEmpty())
if (m_filter.isEmpty())
{
m_allLines.clear();
}
@ -232,9 +235,9 @@ void VPlainTextEdit::CreateParenthesisSelection(int pos, bool match)
void VPlainTextEdit::Filter()
{
clear();
if(not m_filter.isEmpty())
if (not m_filter.isEmpty())
{
for(auto &line : m_allLines)
for (auto &line : m_allLines)
{
if (line.contains(m_filter))
{
@ -244,7 +247,7 @@ void VPlainTextEdit::Filter()
}
else
{
for(auto &line : m_allLines)
for (auto &line : m_allLines)
{
QPlainTextEdit::appendPlainText(line);
}

View File

@ -32,7 +32,11 @@
#include <QFile>
#include <QObject>
#include <QSharedPointer>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
#include "../vmisc/defglobal.h"

View File

@ -30,11 +30,15 @@
#include "../vmisc/commandoptions.h"
#include <QtTest>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
TST_VCommandLine::TST_VCommandLine(QObject *parent)
:QObject(parent)
: QObject(parent)
{
}

View File

@ -30,11 +30,15 @@
#include "../vmisc/vlockguard.h"
#include <QtTest>
#include <ciso646>
// Header <ciso646> is removed in C++20.
#if __cplusplus <= 201703L
#include <ciso646> // and, not, or
#endif
//---------------------------------------------------------------------------------------------------------------------
TST_VLockGuard::TST_VLockGuard(QObject *parent)
:QObject(parent)
: QObject(parent)
{
}