Refactoring define new type for id value.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-03-26 17:15:03 +02:00
parent d0f738c0f0
commit c4d07125dc
4 changed files with 45 additions and 6 deletions

View File

@ -33,6 +33,7 @@
#include <QStringList> #include <QStringList>
#include <QtGlobal> #include <QtGlobal>
#include "../vmisc/typedef.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
@ -44,11 +45,6 @@ extern const QString CustomIncrSign;
#include <windows.h> #include <windows.h>
#endif /*Q_OS_WIN32*/ #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. // Detect whether the compiler supports C++11 noexcept exception specifications.
# if defined(__clang__) # if defined(__clang__)
# if __has_feature(cxx_noexcept) # if __has_feature(cxx_noexcept)

View File

@ -31,6 +31,8 @@
#include <ciso646> #include <ciso646>
#include "../vmisc/typedef.h"
enum class LayoutErrors : char enum class LayoutErrors : char
{ {
NoError, NoError,

40
src/libs/vmisc/typedef.h Normal file
View File

@ -0,0 +1,40 @@
/************************************************************************
**
** @file typedef.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef TYPEDEF_H
#define TYPEDEF_H
#include <QtGlobal>
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

View File

@ -42,7 +42,8 @@ HEADERS += \
$$PWD/literals.h \ $$PWD/literals.h \
$$PWD/qt_dispatch/qt_dispatch.h \ $$PWD/qt_dispatch/qt_dispatch.h \
$$PWD/vdatastreamenum.h \ $$PWD/vdatastreamenum.h \
$$PWD/vmodifierkey.h $$PWD/vmodifierkey.h \
$$PWD/typedef.h
# Qt's versions # Qt's versions
# 5.2.0, 5.2.1 # 5.2.0, 5.2.1