Add a using-declaration to derived class to inherit the constructors, and remove the ones manually duplicated.

This commit is contained in:
Roman Telezhynskyi 2024-02-21 11:59:52 +02:00
parent 587d7aadd4
commit 2f53e38ad7
4 changed files with 18 additions and 23 deletions

View File

@ -15,12 +15,14 @@
#include "drw_textcodec.h"
class dxfWriter {
class dxfWriter
{
public:
explicit dxfWriter(std::ofstream *stream)
: filestr(stream),
encoder()
{}
{
}
virtual ~dxfWriter() = default;
virtual auto writeString(int code, std::string text) -> bool = 0;
@ -32,22 +34,23 @@ public:
virtual auto writeInt64(int code, unsigned long long int data) -> bool = 0;
virtual auto writeDouble(int code, double data) -> bool = 0;
virtual auto writeBool(int code, bool data) -> bool = 0;
void setVersion(const std::string &v, bool dxfFormat){encoder.setVersion(v, dxfFormat);}
void setCodePage(const std::string &c){encoder.setCodePage(c, true);}
void setVersion(const std::string &v, bool dxfFormat) { encoder.setVersion(v, dxfFormat); }
void setCodePage(const std::string &c) { encoder.setCodePage(c, true); }
auto getCodePage() const -> std::string { return encoder.getCodePage(); }
protected:
std::ofstream *filestr;
private:
Q_DISABLE_COPY_MOVE(dxfWriter) // NOLINT
DRW_TextCodec encoder;
};
class dxfWriterBinary : public dxfWriter {
class dxfWriterBinary : public dxfWriter
{
public:
explicit dxfWriterBinary(std::ofstream *stream)
: dxfWriter(stream)
{}
using dxfWriter::dxfWriter;
virtual ~dxfWriterBinary() = default;
virtual auto writeString(int code, std::string text) -> bool override;
virtual auto writeInt16(int code, int data) -> bool override;
@ -57,7 +60,8 @@ public:
virtual auto writeBool(int code, bool data) -> bool override;
};
class dxfWriterAscii final : public dxfWriter {
class dxfWriterAscii final : public dxfWriter
{
public:
explicit dxfWriterAscii(std::ofstream *stream);
virtual ~dxfWriterAscii() = default;

View File

@ -52,10 +52,7 @@ struct DestinationItem
struct VAbstractOperationInitData : VDrawToolInitData
{
VAbstractOperationInitData()
: VDrawToolInitData()
{
}
using VDrawToolInitData::VDrawToolInitData;
QString suffix{};
QVector<SourceItem> source{};

View File

@ -46,10 +46,7 @@ class VFormula;
struct VToolCutInitData : VToolSinglePointInitData
{
VToolCutInitData()
: VToolSinglePointInitData()
{
}
using VToolSinglePointInitData::VToolSinglePointInitData;
quint32 baseCurveId{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
QString formula{}; // NOLINT(misc-non-private-member-variables-in-classes)

View File

@ -43,10 +43,7 @@ template <class T> class QSharedPointer;
struct VToolLinePointInitData : VToolSinglePointInitData
{
VToolLinePointInitData()
: VToolSinglePointInitData()
{
}
using VToolSinglePointInitData::VToolSinglePointInitData;
QString typeLine{TypeLineLine};
QString lineColor{ColorBlack};