From c4d07125dcd55f6e7701bc634825bdd907c76687 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 26 Mar 2019 17:15:03 +0200 Subject: [PATCH] Refactoring define new type for id value. --HG-- branch : develop --- src/libs/ifc/ifcdef.h | 6 +----- src/libs/vlayout/vlayoutdef.h | 2 ++ src/libs/vmisc/typedef.h | 40 +++++++++++++++++++++++++++++++++++ src/libs/vmisc/vmisc.pri | 3 ++- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/libs/vmisc/typedef.h diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 471d2f929..19c44eb08 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -33,6 +33,7 @@ #include #include +#include "../vmisc/typedef.h" #include "../vmisc/def.h" #include "../vmisc/diagnostic.h" @@ -44,11 +45,6 @@ extern const QString CustomIncrSign; #include #endif /*Q_OS_WIN32*/ -static const quint32 null_id = 0; - -#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value. -#define NULL_ID_STR QChar('0') - // Detect whether the compiler supports C++11 noexcept exception specifications. # if defined(__clang__) # if __has_feature(cxx_noexcept) diff --git a/src/libs/vlayout/vlayoutdef.h b/src/libs/vlayout/vlayoutdef.h index 787452ac7..13d0030f2 100644 --- a/src/libs/vlayout/vlayoutdef.h +++ b/src/libs/vlayout/vlayoutdef.h @@ -31,6 +31,8 @@ #include +#include "../vmisc/typedef.h" + enum class LayoutErrors : char { NoError, diff --git a/src/libs/vmisc/typedef.h b/src/libs/vmisc/typedef.h new file mode 100644 index 000000000..84f5db440 --- /dev/null +++ b/src/libs/vmisc/typedef.h @@ -0,0 +1,40 @@ +/************************************************************************ + ** + ** @file typedef.h + ** @author Roman Telezhynskyi + ** @date 1 3, 2019 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentina project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2019 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ +#ifndef TYPEDEF_H +#define TYPEDEF_H + +#include + +using vidtype = quint32; + +static const vidtype null_id = 0; + +#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value. +#define NULL_ID_STR QChar('0') + +#endif // TYPEDEF_H diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index 4b25de22f..c74e77682 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -42,7 +42,8 @@ HEADERS += \ $$PWD/literals.h \ $$PWD/qt_dispatch/qt_dispatch.h \ $$PWD/vdatastreamenum.h \ - $$PWD/vmodifierkey.h + $$PWD/vmodifierkey.h \ + $$PWD/typedef.h # Qt's versions # 5.2.0, 5.2.1