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" #include "drw_textcodec.h"
class dxfWriter { class dxfWriter
{
public: public:
explicit dxfWriter(std::ofstream *stream) explicit dxfWriter(std::ofstream *stream)
: filestr(stream), : filestr(stream),
encoder() encoder()
{} {
}
virtual ~dxfWriter() = default; virtual ~dxfWriter() = default;
virtual auto writeString(int code, std::string text) -> bool = 0; virtual auto writeString(int code, std::string text) -> bool = 0;
@ -38,16 +40,17 @@ public:
protected: protected:
std::ofstream *filestr; std::ofstream *filestr;
private: private:
Q_DISABLE_COPY_MOVE(dxfWriter) // NOLINT Q_DISABLE_COPY_MOVE(dxfWriter) // NOLINT
DRW_TextCodec encoder; DRW_TextCodec encoder;
}; };
class dxfWriterBinary : public dxfWriter { class dxfWriterBinary : public dxfWriter
{
public: public:
explicit dxfWriterBinary(std::ofstream *stream) using dxfWriter::dxfWriter;
: dxfWriter(stream)
{}
virtual ~dxfWriterBinary() = default; virtual ~dxfWriterBinary() = default;
virtual auto writeString(int code, std::string text) -> bool override; virtual auto writeString(int code, std::string text) -> bool override;
virtual auto writeInt16(int code, int data) -> 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; virtual auto writeBool(int code, bool data) -> bool override;
}; };
class dxfWriterAscii final : public dxfWriter { class dxfWriterAscii final : public dxfWriter
{
public: public:
explicit dxfWriterAscii(std::ofstream *stream); explicit dxfWriterAscii(std::ofstream *stream);
virtual ~dxfWriterAscii() = default; virtual ~dxfWriterAscii() = default;

View File

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

View File

@ -46,10 +46,7 @@ class VFormula;
struct VToolCutInitData : VToolSinglePointInitData struct VToolCutInitData : VToolSinglePointInitData
{ {
VToolCutInitData() using VToolSinglePointInitData::VToolSinglePointInitData;
: VToolSinglePointInitData()
{
}
quint32 baseCurveId{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes) quint32 baseCurveId{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
QString formula{}; // 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 struct VToolLinePointInitData : VToolSinglePointInitData
{ {
VToolLinePointInitData() using VToolSinglePointInitData::VToolSinglePointInitData;
: VToolSinglePointInitData()
{
}
QString typeLine{TypeLineLine}; QString typeLine{TypeLineLine};
QString lineColor{ColorBlack}; QString lineColor{ColorBlack};