Convertor need throw exceptions.

--HG--
branch : feature
This commit is contained in:
dismine 2014-12-10 20:01:33 +02:00
parent c97668d3d3
commit 394d54e9c1
30 changed files with 145 additions and 103 deletions

View File

@ -1,7 +1,6 @@
# Suport subdirectories. Just better project code tree.
include(container/container.pri)
include(dialogs/dialogs.pri)
include(exception/exception.pri)
include(geometry/geometry.pri)
include(tools/tools.pri)
include(widgets/widgets.pri)

View File

@ -32,7 +32,7 @@
#include "variables.h"
#include "../geometry/vdetail.h"
#include "../geometry/vgobject.h"
#include "../exception/vexceptionbadid.h"
#include "../libs/ifc/exception/vexceptionbadid.h"
#include "../geometry/vabstractcurve.h"
#include <QCoreApplication>

View File

@ -27,11 +27,11 @@
*************************************************************************/
#include "vapplication.h"
#include "../exception/vexceptionobjecterror.h"
#include "../exception/vexceptionbadid.h"
#include "../exception/vexceptionconversionerror.h"
#include "../exception/vexceptionemptyparameter.h"
#include "../exception/vexceptionwrongid.h"
#include "../libs/ifc/exception/vexceptionobjecterror.h"
#include "../libs/ifc/exception/vexceptionbadid.h"
#include "../libs/ifc/exception/vexceptionconversionerror.h"
#include "../libs/ifc/exception/vexceptionemptyparameter.h"
#include "../libs/ifc/exception/vexceptionwrongid.h"
#include "vmaingraphicsview.h"
#include "../container/calculator.h"
#include "../version.h"

View File

@ -29,7 +29,7 @@
#include "dialogundo.h"
#include "ui_dialogundo.h"
#include "../../core/vapplication.h"
#include "../../exception/vexceptionundo.h"
#include "../../libs/ifc/exception/vexceptionundo.h"
#include <QCloseEvent>
#include <QUndoStack>

View File

@ -28,7 +28,7 @@
#include "vsplinepath.h"
#include "vsplinepath_p.h"
#include "../exception/vexception.h"
#include "../libs/ifc/exception/vexception.h"
//---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Draw mode)

View File

@ -29,8 +29,8 @@
#ifndef OPTIONS_H
#define OPTIONS_H
#include <csignal>
#include <QtGlobal>
#include "../libs/ifc/ifcdef.h"
#ifdef Q_OS_WIN32
# if defined( Q_CC_MSVC ) // MSVC USED
@ -46,12 +46,8 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
class QString;
class QStringList;
static const quint32 null_id = 0;
#define SceneSize 50000
#define DefPointRadius 2.0//mm
#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value.
#define NULL_ID_STR "0"
extern const QString nameRegExp;
extern const QString degreeSymbol;
@ -324,76 +320,4 @@ extern const QString cm_Oprt;
extern const QString mm_Oprt;
extern const QString in_Oprt;
/*
* This macros SCASSERT (for Stop and Continue Assert) will break into the debugger on the line of the assert and allow
* you to continue afterwards should you choose to.
* idea: Q_ASSERT no longer pauses debugger - http://qt-project.org/forums/viewthread/13148
* Usefull links:
* 1. What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__? -
* https://stackoverflow.com/questions/4384765/whats-the-difference-between-pretty-function-function-func
*
* 2. Windows Predefined Macros - http://msdn.microsoft.com/library/b0084kay.aspx
*
* 3. Windows DebugBreak function - http://msdn.microsoft.com/en-us/library/ms679297%28VS.85%29.aspx
*
* 4. Continue to debug after failed assertion on Linux? [C/C++] -
* https://stackoverflow.com/questions/1721543/continue-to-debug-after-failed-assertion-on-linux-c-c
*/
#ifndef QT_NO_DEBUG
#ifdef Q_OS_WIN32
#ifdef Q_CC_MSVC
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __FUNCSIG__, __FILE__, __LINE__); \
DebugBreak(); \
} \
} \
#else
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\
DebugBreak(); \
} \
} \
#endif /*Q_CC_MSVC*/
#else
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\
std::raise(SIGTRAP); \
} \
} \
#endif /* Q_OS_WIN32 */
#else // define but disable this function if debugging is not set
#define SCASSERT(cond) qt_noop();
#endif /* QT_NO_DEBUG */
// Detect whether the compiler supports C++11 noexcept exception specifications.
# if defined(__clang__)
# if __has_feature(cxx_noexcept)
# define V_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 V_NOEXCEPT_EXPR(x) noexcept(x) // GCC 4.7 and following have noexcept
# endif
# elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 180021114
# define QMUP_NOEXCEPT_EXPR(x) noexcept(x)
# else
# define V_NOEXCEPT_EXPR(x)
# endif
#endif // OPTIONS_H

View File

@ -34,7 +34,7 @@
#include "../container/calculator.h"
#include "../../undocommands/addtocalc.h"
#include "../../undocommands/savetooloptions.h"
#include "../../exception/vexceptionundo.h"
#include "../../libs/ifc/exception/vexceptionundo.h"
qreal VDrawTool::factor = 1;

View File

@ -30,7 +30,7 @@
#include "../../container/calculator.h"
#include "../../dialogs/tools/dialogalongline.h"
#include "../../geometry/vpointf.h"
#include "../../exception/vexceptionobjecterror.h"
#include "../../libs/ifc/exception/vexceptionobjecterror.h"
#include "../../visualization/vistoolalongline.h"
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");

View File

@ -27,9 +27,9 @@
*************************************************************************/
#include "vdomdocument.h"
#include "../exception/vexceptionconversionerror.h"
#include "../exception/vexceptionemptyparameter.h"
#include "../exception/vexceptionbadid.h"
#include "../libs/ifc/exception/vexceptionconversionerror.h"
#include "../libs/ifc/exception/vexceptionemptyparameter.h"
#include "../libs/ifc/exception/vexceptionbadid.h"
#include "../options.h"
#include "../core/vapplication.h"

View File

@ -32,11 +32,11 @@
#include "../tools/vtooluniondetails.h"
#include "../tools/drawTools/drawtools.h"
#include "../tools/nodeDetails/nodedetails.h"
#include "../exception/vexceptionobjecterror.h"
#include "../exception/vexceptionwrongid.h"
#include "../exception/vexceptionconversionerror.h"
#include "../exception/vexceptionemptyparameter.h"
#include "../exception/vexceptionundo.h"
#include "../libs/ifc/exception/vexceptionobjecterror.h"
#include "../libs/ifc/exception/vexceptionwrongid.h"
#include "../libs/ifc/exception/vexceptionconversionerror.h"
#include "../libs/ifc/exception/vexceptionemptyparameter.h"
#include "../libs/ifc/exception/vexceptionundo.h"
#include "../core/undoevent.h"
#include "../core/vsettings.h"
#include "vstandardmeasurements.h"

View File

@ -31,7 +31,6 @@
#include <QMessageBox>
#include <QSpacerItem>
#include <QApplication>
#include "../options.h"
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(vExcep, "v.excep")

View File

@ -31,8 +31,7 @@
#include <QException>
#include <QString>
#include <QCoreApplication>
#include "../options.h"
#include "ifcdef.h"
class QWidget;

View File

@ -27,7 +27,6 @@
*************************************************************************/
#include "vexceptionbadid.h"
#include "../options.h"
//---------------------------------------------------------------------------------------------------------------------
/**

View File

@ -1,10 +1,13 @@
# Suport subdirectories. Just better project code tree.
include(exception/exception.pri)
include(xml/xml.pri)
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro
HEADERS += \
$$PWD/vabstractconverter.h \
$$PWD/stable.h
$$PWD/stable.h \
$$PWD/ifcdef.h
SOURCES += \
$$PWD/vabstractconverter.cpp \
$$PWD/stable.cpp

111
src/libs/ifc/ifcdef.h Normal file
View File

@ -0,0 +1,111 @@
/************************************************************************
**
** @file ifcdef.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 10 12, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 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 IFCDEF_H
#define IFCDEF_H
#include <csignal>
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 "0"
/*
* This macros SCASSERT (for Stop and Continue Assert) will break into the debugger on the line of the assert and allow
* you to continue afterwards should you choose to.
* idea: Q_ASSERT no longer pauses debugger - http://qt-project.org/forums/viewthread/13148
* Usefull links:
* 1. What's the difference between __PRETTY_FUNCTION__, __FUNCTION__, __func__? -
* https://stackoverflow.com/questions/4384765/whats-the-difference-between-pretty-function-function-func
*
* 2. Windows Predefined Macros - http://msdn.microsoft.com/library/b0084kay.aspx
*
* 3. Windows DebugBreak function - http://msdn.microsoft.com/en-us/library/ms679297%28VS.85%29.aspx
*
* 4. Continue to debug after failed assertion on Linux? [C/C++] -
* https://stackoverflow.com/questions/1721543/continue-to-debug-after-failed-assertion-on-linux-c-c
*/
#ifndef QT_NO_DEBUG
#ifdef Q_OS_WIN32
#ifdef Q_CC_MSVC
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __FUNCSIG__, __FILE__, __LINE__); \
DebugBreak(); \
} \
} \
#else
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\
DebugBreak(); \
} \
} \
#endif /*Q_CC_MSVC*/
#else
#define SCASSERT(cond) \
{ \
if (!(cond)) \
{ \
qDebug("ASSERT: %s in %s (%s:%u)", \
#cond, __PRETTY_FUNCTION__, __FILE__, __LINE__);\
std::raise(SIGTRAP); \
} \
} \
#endif /* Q_OS_WIN32 */
#else // define but disable this function if debugging is not set
#define SCASSERT(cond) qt_noop();
#endif /* QT_NO_DEBUG */
// Detect whether the compiler supports C++11 noexcept exception specifications.
# if defined(__clang__)
# if __has_feature(cxx_noexcept)
# define V_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 V_NOEXCEPT_EXPR(x) noexcept(x) // GCC 4.7 and following have noexcept
# endif
# elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 180021114
# define QMUP_NOEXCEPT_EXPR(x) noexcept(x)
# else
# define V_NOEXCEPT_EXPR(x)
# endif
#endif // IFCDEF_H

8
src/libs/ifc/xml/xml.pri Normal file
View File

@ -0,0 +1,8 @@
# ADD TO EACH PATH $$PWD VARIABLE!!!!!!
# This need for corect working file translations.pro
HEADERS += \
$$PWD/vabstractconverter.h
SOURCES += \
$$PWD/vabstractconverter.cpp