Class for abstract detail.

--HG--
branch : feature
This commit is contained in:
dismine 2015-01-02 18:32:26 +02:00
parent 67c93e2b5b
commit 112dbd7f4e
4 changed files with 310 additions and 2 deletions

View file

@ -0,0 +1,168 @@
/************************************************************************
**
** @file vabstractdetail.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 2 1, 2015
**
** @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) 2015 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/>.
**
*************************************************************************/
#include "vabstractdetail.h"
#include "vabstractdetail_p.h"
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VAbstractDetail default contructor. Create empty detail.
*/
VAbstractDetail::VAbstractDetail()
:d(new VAbstractDetailData)
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VAbstractDetail constructor.
* @param name detail name.
*/
VAbstractDetail::VAbstractDetail(const QString &name)
:d(new VAbstractDetailData(name))
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VAbstractDetail copy constructor.
* @param detail detail.
*/
VAbstractDetail::VAbstractDetail(const VAbstractDetail &detail)
:d (detail.d)
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief operator = assignment operator.
* @param detail detail.
* @return new detail.
*/
VAbstractDetail &VAbstractDetail::operator=(const VAbstractDetail &detail)
{
if ( &detail == this )
{
return *this;
}
d = detail.d;
return *this;
}
//---------------------------------------------------------------------------------------------------------------------
VAbstractDetail::~VAbstractDetail()
{}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Clear detail full clear.
*/
void VAbstractDetail::Clear()
{
d->name.clear();
d->seamAllowance = false;
d->closed = true;
d->width = 0;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getName return detail name.
* @return name.
*/
QString VAbstractDetail::getName() const
{
return d->name;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setName set detail name.
* @param value new name.
*/
void VAbstractDetail::setName(const QString &value)
{
d->name = value;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getSeamAllowance keep status for seam allowance detail.
* @return true - need seam allowance, false - no need seam allowance.
*/
bool VAbstractDetail::getSeamAllowance() const
{
return d->seamAllowance;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setSeamAllowance set status for seam allowance detail.
* @param value true - need seam allowance, false - no need seam allowance.
*/
void VAbstractDetail::setSeamAllowance(bool value)
{
d->seamAllowance = value;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getClosed keep close status for detail equdistant.
* @return true - close equdistant, false - don't close equdistant.
*/
bool VAbstractDetail::getClosed() const
{
return d->closed;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setClosed set close status for detail equdistant.
* @param value true - close equdistant, false - don't close equdistant.
*/
void VAbstractDetail::setClosed(bool value)
{
d->closed = value;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief getWidth return value detail seam allowance.
* @return value in mm.
*/
qreal VAbstractDetail::getWidth() const
{
return d->width;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief setWidth set value detail seam allowance.
* @param value width in mm.
*/
void VAbstractDetail::setWidth(const qreal &value)
{
d->width = value;
}

View file

@ -0,0 +1,66 @@
/************************************************************************
**
** @file vabstractdetail.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 2 1, 2015
**
** @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) 2015 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 VABSTRACTDETAIL_H
#define VABSTRACTDETAIL_H
#include <QSharedDataPointer>
class QString;
class VAbstractDetailData;
/**
* @brief The VAbstractDetail class abstract class for all details.
*/
class VAbstractDetail
{
public:
VAbstractDetail();
VAbstractDetail(const QString &name);
VAbstractDetail(const VAbstractDetail &detail);
VAbstractDetail &operator=(const VAbstractDetail &detail);
~VAbstractDetail();
void Clear();
QString getName() const;
void setName(const QString &value);
bool getSeamAllowance() const;
void setSeamAllowance(bool value);
bool getClosed() const;
void setClosed(bool value);
qreal getWidth() const;
void setWidth(const qreal &value);
private:
QSharedDataPointer<VAbstractDetailData> d;
};
#endif // VABSTRACTDETAIL_H

View file

@ -0,0 +1,71 @@
/************************************************************************
**
** @file vabstractdetail_p.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 2 1, 2015
**
** @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) 2015 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 VABSTRACTDETAIL_P_H
#define VABSTRACTDETAIL_P_H
#include <QSharedData>
#ifdef Q_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
class VAbstractDetailData : public QSharedData
{
public:
VAbstractDetailData()
:name(QString()), seamAllowance(false), closed(true), width(0)
{}
VAbstractDetailData(const QString &name)
:name(name), seamAllowance(false), closed(true), width(0)
{}
VAbstractDetailData(const VAbstractDetailData &detail)
:QSharedData(detail), name(detail.name), seamAllowance(detail.seamAllowance), closed(detail.closed),
width(detail.width)
{}
~VAbstractDetailData() {}
/** @brief name detail name. */
QString name;
/** @brief seamAllowance status seamAllowance detail. */
bool seamAllowance;
/** @brief closed status equdistant detail. */
bool closed;
/** @brief width value seamAllowance in mm. */
qreal width;
};
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif
#endif // VABSTRACTDETAIL_P_H

View file

@ -4,9 +4,12 @@
HEADERS += \
$$PWD/stable.h \
$$PWD/vlayoutgenerator.h \
$$PWD/vlayoutdetail.h
$$PWD/vlayoutdetail.h \
$$PWD/vabstractdetail.h \
$$PWD/vabstractdetail_p.h
SOURCES += \
$$PWD/stable.cpp \
$$PWD/vlayoutgenerator.cpp \
$$PWD/vlayoutdetail.cpp
$$PWD/vlayoutdetail.cpp \
$$PWD/vabstractdetail.cpp