From cfc2f47221807a0a41c10533878ea8780882f694 Mon Sep 17 00:00:00 2001 From: Sean Alling Date: Thu, 26 Jan 2023 21:46:01 -0800 Subject: [PATCH] [modernization] First pass updating codebase to C++11 Four clang-tidy riles used 1. cppcoreguidelines-pro-type-member-init 1. modernize-use-default-member-init 1. readability-redundant-member-init 1. readability-redundant-string-init [modernization] updated existing constructors [modernization] Added missing delete statements [modernization] Resolved megalinter errors [modernization] Updated multiple constructors Pt.1 [modernization] Updated multiple constructors Pt.2 --- .clang-tidy | 5 +- doc/dictionaries/names.txt | 1 + srec_cat/arglex3.cc | 5 -- srec_cat/arglex3.h | 26 +++++++---- srecord/adler16.cc | 32 ------------- srecord/adler16.h | 24 +--------- srecord/adler32.cc | 32 ------------- srecord/adler32.h | 24 +--------- srecord/arglex.cc | 11 +---- srecord/arglex.h | 52 ++++++++++++--------- srecord/arglex/tool.cc | 12 +---- srecord/arglex/tool.h | 37 +++++++++------ srecord/arglex/tool/get_interval.cc | 32 ++++++------- srecord/arglex/tool/input.cc | 1 - srecord/crc16.cc | 5 -- srecord/crc16.h | 4 +- srecord/crc32.cc | 12 ----- srecord/crc32.h | 4 +- srecord/fletcher16.cc | 30 ------------ srecord/fletcher16.h | 15 ------ srecord/fletcher32.cc | 20 -------- srecord/fletcher32.h | 10 ++-- srecord/input.cc | 6 --- srecord/input.h | 12 ++--- srecord/input/catenate.cc | 6 --- srecord/input/catenate.h | 25 +++++----- srecord/input/file.cc | 18 +------- srecord/input/file.h | 31 +++++++------ srecord/input/file/aomf.cc | 9 +--- srecord/input/file/aomf.h | 35 +++++++------- srecord/input/file/ascii_hex.cc | 13 +----- srecord/input/file/ascii_hex.h | 29 ++++++------ srecord/input/file/atmel_generic.cc | 6 --- srecord/input/file/atmel_generic.h | 24 +++++----- srecord/input/file/binary.cc | 8 +--- srecord/input/file/binary.h | 25 +++++----- srecord/input/file/brecord.cc | 12 ++--- srecord/input/file/brecord.h | 23 +++++----- srecord/input/file/cosmac.cc | 11 +---- srecord/input/file/cosmac.h | 27 +++++------ srecord/input/file/dec_binary.cc | 11 +---- srecord/input/file/dec_binary.h | 27 +++++------ srecord/input/file/emon52.cc | 6 --- srecord/input/file/emon52.h | 21 +++++---- srecord/input/file/fairchild.cc | 11 +---- srecord/input/file/fairchild.h | 29 ++++++------ srecord/input/file/fastload.cc | 9 +--- srecord/input/file/fastload.h | 25 +++++----- srecord/input/file/formatted_binary.cc | 5 -- srecord/input/file/formatted_binary.h | 18 ++++---- srecord/input/file/four_packed_code.cc | 12 +---- srecord/input/file/four_packed_code.h | 34 +++++++------- srecord/input/file/hexdump.cc | 10 +--- srecord/input/file/hexdump.h | 27 +++++------ srecord/input/file/hp64k.cc | 9 +--- srecord/input/file/hp64k.h | 29 ++++++------ srecord/input/file/idt.cc | 9 +--- srecord/input/file/idt.h | 27 +++++------ srecord/input/file/intel.cc | 10 +--- srecord/input/file/intel.h | 37 +++++++-------- srecord/input/file/intel16.cc | 10 +--- srecord/input/file/intel16.h | 37 +++++++-------- srecord/input/file/logisim.cc | 10 +--- srecord/input/file/logisim.h | 19 ++++---- srecord/input/file/mif.cc | 15 +----- srecord/input/file/mif.h | 37 +++++++-------- srecord/input/file/mips_flash.cc | 12 +---- srecord/input/file/mips_flash.h | 31 +++++++------ srecord/input/file/mos_tech.cc | 11 +---- srecord/input/file/mos_tech.h | 27 +++++------ srecord/input/file/motorola.cc | 14 +----- srecord/input/file/motorola.h | 35 +++++++------- srecord/input/file/msbin.cc | 10 +--- srecord/input/file/msbin.h | 47 +++++++++---------- srecord/input/file/needham.cc | 9 +--- srecord/input/file/needham.h | 27 +++++------ srecord/input/file/os65v.cc | 11 +---- srecord/input/file/os65v.h | 30 ++++++------ srecord/input/file/ppb.cc | 12 +---- srecord/input/file/ppb.h | 46 +++++++------------ srecord/input/file/ppx.cc | 14 +----- srecord/input/file/ppx.h | 37 +++++++-------- srecord/input/file/signetics.cc | 10 +--- srecord/input/file/signetics.h | 29 ++++++------ srecord/input/file/spasm.cc | 6 --- srecord/input/file/spasm.h | 23 +++++----- srecord/input/file/spectrum.cc | 11 +---- srecord/input/file/spectrum.h | 27 +++++------ srecord/input/file/stewie.cc | 12 +---- srecord/input/file/stewie.h | 35 +++++++------- srecord/input/file/tektronix.cc | 13 +----- srecord/input/file/tektronix.h | 33 +++++++------- srecord/input/file/tektronix_extended.cc | 13 +----- srecord/input/file/tektronix_extended.h | 40 ++++++++-------- srecord/input/file/ti_tagged.cc | 9 +--- srecord/input/file/ti_tagged.h | 27 +++++------ srecord/input/file/ti_tagged_16.cc | 10 +--- srecord/input/file/ti_tagged_16.h | 28 ++++++------ srecord/input/file/ti_txt.cc | 13 +----- srecord/input/file/ti_txt.h | 37 +++++++-------- srecord/input/file/trs80.cc | 6 +-- srecord/input/file/trs80.h | 27 +++++------ srecord/input/file/vmem.cc | 9 +--- srecord/input/file/vmem.h | 25 +++++----- srecord/input/file/wilson.cc | 10 +--- srecord/input/file/wilson.h | 42 +++++++++++------ srecord/input/filter.cc | 5 -- srecord/input/filter.h | 26 +++++------ srecord/input/filter/and.cc | 5 -- srecord/input/filter/and.h | 17 +++---- srecord/input/filter/bitrev.cc | 5 -- srecord/input/filter/bitrev.h | 18 ++++---- srecord/input/filter/byte_swap.cc | 10 +--- srecord/input/filter/byte_swap.h | 23 +++++----- srecord/input/filter/checksum.cc | 6 --- srecord/input/filter/checksum.h | 20 ++++---- srecord/input/filter/checksum/bitnot.cc | 6 --- srecord/input/filter/checksum/bitnot.h | 18 ++++---- srecord/input/filter/checksum/negative.cc | 5 -- srecord/input/filter/checksum/negative.h | 19 ++++---- srecord/input/filter/checksum/positive.cc | 5 -- srecord/input/filter/checksum/positive.h | 19 ++++---- srecord/input/filter/crop.cc | 10 +--- srecord/input/filter/crop.h | 17 +++---- srecord/input/filter/fill.cc | 1 - srecord/input/filter/fill.h | 19 ++++---- srecord/input/filter/interval.cc | 5 -- srecord/input/filter/interval.h | 17 +++---- srecord/input/filter/interval/length.cc | 6 --- srecord/input/filter/interval/length.h | 11 +++-- srecord/input/filter/interval/maximum.cc | 6 --- srecord/input/filter/interval/maximum.h | 19 ++++---- srecord/input/filter/interval/minimum.cc | 5 -- srecord/input/filter/interval/minimum.h | 19 ++++---- srecord/input/filter/message.cc | 11 +---- srecord/input/filter/message.h | 25 +++++----- srecord/input/filter/message/adler16.cc | 5 -- srecord/input/filter/message/adler16.h | 19 ++++---- srecord/input/filter/message/adler32.cc | 5 -- srecord/input/filter/message/adler32.h | 19 ++++---- srecord/input/filter/message/crc16.cc | 11 +---- srecord/input/filter/message/crc16.h | 31 +++++++------ srecord/input/filter/message/crc32.cc | 5 -- srecord/input/filter/message/crc32.h | 23 ++++++---- srecord/input/filter/message/fletcher16.cc | 11 +---- srecord/input/filter/message/fletcher16.h | 28 ++++++------ srecord/input/filter/message/fletcher32.cc | 6 --- srecord/input/filter/message/fletcher32.h | 20 ++++---- srecord/input/filter/message/gcrypt.cc | 6 --- srecord/input/filter/message/gcrypt.h | 20 ++++---- srecord/input/filter/message/stm32.cc | 5 -- srecord/input/filter/message/stm32.h | 24 +++++----- srecord/input/filter/not.cc | 5 -- srecord/input/filter/not.h | 18 ++++---- srecord/input/filter/offset.cc | 5 -- srecord/input/filter/offset.h | 17 +++---- srecord/input/filter/or.cc | 5 -- srecord/input/filter/or.h | 17 +++---- srecord/input/filter/random_fill.cc | 5 -- srecord/input/filter/random_fill.h | 18 ++++---- srecord/input/filter/sequence.cc | 9 +--- srecord/input/filter/sequence.h | 21 +++++---- srecord/input/filter/split.cc | 9 +--- srecord/input/filter/split.h | 19 ++++---- srecord/input/filter/unfill.cc | 10 +--- srecord/input/filter/unfill.h | 19 ++++---- srecord/input/filter/unsplit.cc | 10 +--- srecord/input/filter/unsplit.h | 19 ++++---- srecord/input/filter/xor.cc | 5 -- srecord/input/filter/xor.h | 17 +++---- srecord/input/generator.cc | 6 --- srecord/input/generator.h | 13 +++--- srecord/input/generator/constant.cc | 6 --- srecord/input/generator/constant.h | 22 +++++---- srecord/input/generator/random.cc | 5 -- srecord/input/generator/random.h | 22 ++++----- srecord/input/generator/repeat.h | 21 +++++---- srecord/interval.cc | 11 ----- srecord/interval.h | 12 ++--- srecord/memory.cc | 21 +-------- srecord/memory.h | 16 +++---- srecord/memory/chunk.cc | 5 -- srecord/memory/chunk.h | 11 +++-- srecord/memory/walker.cc | 10 ---- srecord/memory/walker.h | 14 +++--- srecord/memory/walker/adler16.cc | 10 ---- srecord/memory/walker/adler16.h | 15 +++--- srecord/memory/walker/adler32.cc | 10 ---- srecord/memory/walker/adler32.h | 15 +++--- srecord/memory/walker/alignment.cc | 10 +--- srecord/memory/walker/alignment.h | 22 +++++---- srecord/memory/walker/compare.cc | 5 -- srecord/memory/walker/compare.h | 17 +++---- srecord/memory/walker/continuity.cc | 14 ------ srecord/memory/walker/continuity.h | 18 ++++---- srecord/memory/walker/crc16.h | 9 ++-- srecord/memory/walker/crc32.cc | 5 -- srecord/memory/walker/crc32.h | 13 +++--- srecord/memory/walker/fletcher16.cc | 5 -- srecord/memory/walker/fletcher16.h | 20 ++++---- srecord/memory/walker/fletcher32.cc | 11 ----- srecord/memory/walker/fletcher32.h | 16 ++++--- srecord/memory/walker/gcrypt.cc | 5 -- srecord/memory/walker/gcrypt.h | 17 +++---- srecord/memory/walker/stm32.cc | 10 ---- srecord/memory/walker/stm32.h | 15 +++--- srecord/memory/walker/writer.cc | 5 -- srecord/memory/walker/writer.h | 23 +++++----- srecord/output.cc | 10 ---- srecord/output.h | 14 +++--- srecord/output/file.cc | 17 ++----- srecord/output/file.h | 25 +++++----- srecord/output/file/aomf.cc | 5 -- srecord/output/file/aomf.h | 27 +++++------ srecord/output/file/ascii_hex.cc | 9 +--- srecord/output/file/ascii_hex.h | 41 +++++++++-------- srecord/output/file/asm.cc | 12 +---- srecord/output/file/asm.h | 49 ++++++++++---------- srecord/output/file/atmel_generic.cc | 6 --- srecord/output/file/atmel_generic.h | 28 ++++++------ srecord/output/file/basic.cc | 6 +-- srecord/output/file/basic.h | 35 +++++++------- srecord/output/file/binary.cc | 6 --- srecord/output/file/binary.h | 30 ++++++------ srecord/output/file/brecord.cc | 6 --- srecord/output/file/brecord.h | 27 +++++------ srecord/output/file/c.cc | 16 +------ srecord/output/file/c.h | 53 +++++++++++----------- srecord/output/file/coe.cc | 11 +---- srecord/output/file/coe.h | 53 ++++++++++------------ srecord/output/file/cosmac.cc | 12 +---- srecord/output/file/cosmac.h | 37 +++++++-------- srecord/output/file/dec_binary.cc | 26 +---------- srecord/output/file/dec_binary.h | 43 ++++++++---------- srecord/output/file/emon52.cc | 9 +--- srecord/output/file/emon52.h | 29 ++++++------ srecord/output/file/fairchild.cc | 8 +--- srecord/output/file/fairchild.h | 31 +++++++------ srecord/output/file/fastload.cc | 8 +--- srecord/output/file/fastload.h | 39 ++++++++-------- srecord/output/file/formatted_binary.cc | 5 +- srecord/output/file/formatted_binary.h | 37 +++++++-------- srecord/output/file/forth.cc | 3 +- srecord/output/file/forth.h | 31 +++++++------ srecord/output/file/four_packed_code.cc | 5 +- srecord/output/file/four_packed_code.h | 35 +++++++------- srecord/output/file/hexdump.cc | 8 +--- srecord/output/file/hexdump.h | 41 +++++++++-------- srecord/output/file/idt.cc | 6 +-- srecord/output/file/idt.h | 31 +++++++------ srecord/output/file/intel.cc | 5 +- srecord/output/file/intel.h | 33 +++++++------- srecord/output/file/intel16.cc | 4 +- srecord/output/file/intel16.h | 31 +++++++------ srecord/output/file/logisim.cc | 5 +- srecord/output/file/logisim.h | 27 +++++------ srecord/output/file/mem.cc | 10 +--- srecord/output/file/mem.h | 47 +++++++++---------- srecord/output/file/mif.cc | 8 +--- srecord/output/file/mif.h | 43 +++++++++--------- srecord/output/file/mips_flash.cc | 8 +--- srecord/output/file/mips_flash.h | 41 +++++++++-------- srecord/output/file/mos_tech.cc | 4 +- srecord/output/file/mos_tech.h | 31 +++++++------ srecord/output/file/motorola.cc | 8 +--- srecord/output/file/motorola.h | 35 +++++++------- srecord/output/file/msbin.cc | 5 +- srecord/output/file/msbin.h | 39 ++++++++-------- srecord/output/file/needham.cc | 6 +-- srecord/output/file/needham.h | 35 +++++++------- srecord/output/file/os65v.cc | 5 +- srecord/output/file/os65v.h | 33 +++++++------- srecord/output/file/ppb.cc | 5 +- srecord/output/file/ppb.h | 37 +++++++-------- srecord/output/file/ppx.cc | 7 +-- srecord/output/file/ppx.h | 37 +++++++-------- srecord/output/file/signetics.cc | 4 +- srecord/output/file/signetics.h | 33 +++++++------- srecord/output/file/spasm.cc | 5 -- srecord/output/file/spasm.h | 27 +++++------ srecord/output/file/spectrum.h | 27 +++++------ srecord/output/file/stewie.cc | 5 +- srecord/output/file/stewie.h | 35 +++++++------- srecord/output/file/tektronix.cc | 9 +--- srecord/output/file/tektronix.h | 31 +++++++------ srecord/output/file/tektronix_extended.cc | 10 +--- srecord/output/file/tektronix_extended.h | 32 +++++++------ srecord/output/file/ti_tagged.cc | 6 +-- srecord/output/file/ti_tagged.h | 37 +++++++-------- srecord/output/file/ti_tagged_16.cc | 6 +-- srecord/output/file/ti_tagged_16.h | 38 ++++++++-------- srecord/output/file/ti_txt.cc | 5 -- srecord/output/file/ti_txt.h | 37 +++++++-------- srecord/output/file/trs80.cc | 4 +- srecord/output/file/trs80.h | 37 +++++++-------- srecord/output/file/vhdl.cc | 5 +- srecord/output/file/vhdl.h | 35 +++++++------- srecord/output/file/vmem.h | 29 ++++++------ srecord/output/file/wilson.cc | 5 -- srecord/output/file/wilson.h | 31 +++++++------ srecord/output/filter.cc | 5 -- srecord/output/filter.h | 33 +++++++------- srecord/output/filter/reblock.cc | 7 +-- srecord/output/filter/reblock.h | 35 +++++++------- srecord/quit.cc | 23 ---------- srecord/quit.h | 8 ++-- srecord/quit/exception.cc | 11 ----- srecord/quit/exception.h | 18 ++++---- srecord/quit/normal.cc | 10 ---- srecord/quit/normal.h | 18 ++++---- srecord/quit/prefix.cc | 5 -- srecord/quit/prefix.h | 19 ++++---- srecord/record.cc | 21 +-------- srecord/record.h | 12 ++--- srecord/stm32.cc | 16 +------ srecord/stm32.h | 10 ++-- 316 files changed, 2274 insertions(+), 3354 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index fd998f0d..fbe9a139 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -42,8 +42,8 @@ Checks: >- -modernize-avoid-c-arrays, -modernize-loop-convert, -modernize-use-default-member-init, - -modernize-use-equals-default, - -modernize-use-equals-delete, + modernize-use-equals-default, + modernize-use-equals-delete, -modernize-use-nullptr, -modernize-use-override, -performance-unnecessary-copy-initialization, @@ -59,7 +59,6 @@ Checks: >- -readability-named-parameter, -readability-redundant-member-init, -readability-redundant-string-init, - # All enabled checks shall be reported as error. WarningsAsErrors: "*" diff --git a/doc/dictionaries/names.txt b/doc/dictionaries/names.txt index 6fc1049c..f50fb9bc 100644 --- a/doc/dictionaries/names.txt +++ b/doc/dictionaries/names.txt @@ -108,6 +108,7 @@ Sadowski Schmitt SDSMAC Sean +SeanAlling-DojoFive segfault Seitz Sergeev diff --git a/srec_cat/arglex3.cc b/srec_cat/arglex3.cc index 83d71bb2..d99f605a 100644 --- a/srec_cat/arglex3.cc +++ b/srec_cat/arglex3.cc @@ -51,8 +51,3 @@ srec_cat_arglex3::srec_cat_arglex3(int argc, char **argv) : table_set(table); } - - -srec_cat_arglex3::~srec_cat_arglex3() -{ -} diff --git a/srec_cat/arglex3.h b/srec_cat/arglex3.h index fc19fd00..8c19f549 100644 --- a/srec_cat/arglex3.h +++ b/srec_cat/arglex3.h @@ -46,28 +46,38 @@ class srec_cat_arglex3: /** * The destructor. */ - virtual ~srec_cat_arglex3(); + ~srec_cat_arglex3() override = default; /** * The constructor. */ srec_cat_arglex3(int, char **); -private: /** - * The default constructor. Do not use. + * The default constructor. */ - srec_cat_arglex3(); + srec_cat_arglex3() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - srec_cat_arglex3(const srec_cat_arglex3 &); + srec_cat_arglex3(const srec_cat_arglex3 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - srec_cat_arglex3 &operator=(const srec_cat_arglex3 &); + srec_cat_arglex3 &operator=(const srec_cat_arglex3 &) = delete; + + /** + * The move constructor + */ + srec_cat_arglex3 ( srec_cat_arglex3 && ) = delete; + + /** + * The move assignment operator + */ + srec_cat_arglex3& operator=(srec_cat_arglex3&&) = delete; + }; #endif // PROG_SREC_CAT_ARGLEX3_H diff --git a/srecord/adler16.cc b/srecord/adler16.cc index 0b81b3d8..ca003570 100644 --- a/srecord/adler16.cc +++ b/srecord/adler16.cc @@ -18,38 +18,6 @@ #include - -srecord::adler16::~adler16() -{ -} - - -srecord::adler16::adler16() : - sum_a(1), - sum_b(0) -{ -} - - -srecord::adler16::adler16(const adler16 &rhs) : - sum_a(rhs.sum_a), - sum_b(rhs.sum_b) -{ -} - - -srecord::adler16 & -srecord::adler16::operator=(const adler16 &rhs) -{ - if (this != &rhs) - { - sum_a = rhs.sum_a; - sum_b = rhs.sum_b; - } - return *this; -} - - unsigned short srecord::adler16::get() const diff --git a/srecord/adler16.h b/srecord/adler16.h index 2cb4f107..e670fe0a 100644 --- a/srecord/adler16.h +++ b/srecord/adler16.h @@ -32,26 +32,6 @@ namespace srecord class adler16 { public: - /** - * The destructor. - */ - virtual ~adler16(); - - /** - * The default constructor. - */ - adler16(); - - /** - * The copy constructor. - */ - adler16(const adler16 &); - - /** - * The assignment operator. - */ - adler16 &operator=(const adler16 &); - /** * The get method is used to obtain the running value of the checksum. */ @@ -72,13 +52,13 @@ class adler16 * The sum_a instance variable is used to remember the sum of bytes * scanned. */ - unsigned char sum_a; + unsigned char sum_a{1}; /** * The sum_b instance variable is used to remember the sum of the * sum of bytes scanned. */ - unsigned char sum_b; + unsigned char sum_b{0}; }; }; diff --git a/srecord/adler32.cc b/srecord/adler32.cc index 45f2500b..137d1537 100644 --- a/srecord/adler32.cc +++ b/srecord/adler32.cc @@ -18,38 +18,6 @@ #include - -srecord::adler32::~adler32() -{ -} - - -srecord::adler32::adler32() : - sum_a(1), - sum_b(0) -{ -} - - -srecord::adler32::adler32(const adler32 &rhs) : - sum_a(rhs.sum_a), - sum_b(rhs.sum_b) -{ -} - - -srecord::adler32 & -srecord::adler32::operator=(const adler32 &rhs) -{ - if (this != &rhs) - { - sum_a = rhs.sum_a; - sum_b = rhs.sum_b; - } - return *this; -} - - unsigned long srecord::adler32::get() const diff --git a/srecord/adler32.h b/srecord/adler32.h index 752f4abf..62846d60 100644 --- a/srecord/adler32.h +++ b/srecord/adler32.h @@ -34,26 +34,6 @@ namespace srecord class adler32 { public: - /** - * The destructor. - */ - virtual ~adler32(); - - /** - * The default constructor. - */ - adler32(); - - /** - * The copy constructor. - */ - adler32(const adler32 &); - - /** - * The assignment operator. - */ - adler32 &operator=(const adler32 &); - /** * The get method is used to obtain the running value of the * checksum. @@ -75,13 +55,13 @@ class adler32 * The sum_a instance variable is used to remember the sum of bytes * scanned. */ - unsigned short sum_a; + unsigned short sum_a{1}; /** * The sum_b instance variable is used to remember the sum of the * sum of bytes scanned. */ - unsigned short sum_b; + unsigned short sum_b{0}; }; }; diff --git a/srecord/arglex.cc b/srecord/arglex.cc index 34882297..beafcaee 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -49,15 +49,13 @@ static const srecord::arglex::table_ty default_table[] = }; -srecord::arglex::arglex() : - usage_tail_(0) +srecord::arglex::arglex() { table_set(default_table); } -srecord::arglex::arglex(int ac, char **av) : - usage_tail_(0) +srecord::arglex::arglex(int ac, char **av) { progname_set(av[0]); for (int j = 1; j < ac; ++j) @@ -131,11 +129,6 @@ srecord::arglex::read_arguments_file(const char *filename) } -srecord::arglex::~arglex() -{ -} - - void srecord::arglex::table_set(const table_ty *tp) { diff --git a/srecord/arglex.h b/srecord/arglex.h index c153df05..8014a184 100644 --- a/srecord/arglex.h +++ b/srecord/arglex.h @@ -41,7 +41,33 @@ class arglex /** * The destructor. */ - virtual ~arglex(); + virtual ~arglex() = default; + + /** + * The default constructor. + */ + arglex(); + + /** + * The copy constructor. + */ + arglex(arglex &) = default; + + /** + * The move constructor + */ + arglex ( arglex && ) = default; + + /** + * The move assignment operator + */ + arglex& operator=(arglex&&) = default; + + /** + * The normal constructor. The argv and argv should be those + * passed to main(). Not manipulation is required. + */ + arglex(int argc, char **argv); /** * The "normal" command line tokens common to all programs. @@ -169,7 +195,7 @@ class arglex * The token instance variable tracks the current token in the * parse sequence. */ - int token; + int token{}; /** * The value_string_ instance variable tracks the value of the @@ -182,7 +208,7 @@ class arglex * of the current command line argument. Usually zero unless * the current command line argument is a number. */ - long value_number_; + long value_number_{}; /** * The table_ptr_vec_t type is used to declare the 'tables' @@ -215,22 +241,6 @@ class arglex void table_set(const table_ty *); public: - /** - * The default constructor. - */ - arglex(); - - /** - * The copy constructor. - */ - arglex(arglex &); - - /** - * The normal constructor. The argv and argv should be those - * passed to main(). Not manipulation is required. - */ - arglex(int argc, char **argv); - /** * The token_cur method is used to get the type of the current * token. @@ -288,7 +298,7 @@ class arglex /** * The help method is used to print a help message. */ - void help(const char * = 0) const; + void help(const char * = nullptr) const; /** * The version method is used to print a version message. @@ -326,7 +336,7 @@ class arglex * the command line printed by the 'usage' method. * Defaults to the empty string. */ - mutable const char *usage_tail_; + mutable const char *usage_tail_{nullptr}; /** * The usage_tail_get method is used to get the tail end of diff --git a/srecord/arglex/tool.cc b/srecord/arglex/tool.cc index a6fb1315..bf4e7d2e 100644 --- a/srecord/arglex/tool.cc +++ b/srecord/arglex/tool.cc @@ -24,12 +24,7 @@ srecord::arglex_tool::arglex_tool(int argc, char **argv) : - arglex(argc, argv), - stdin_used(false), - stdout_used(false), - issue_sequence_warnings(-1), - redundant_bytes(srecord::defcon_warning), - contradictory_bytes(srecord::defcon_fatal_error) + arglex(argc, argv) { static const table_ty table[] = { @@ -255,11 +250,6 @@ srecord::arglex_tool::arglex_tool(int argc, char **argv) : } -srecord::arglex_tool::~arglex_tool() -{ -} - - bool srecord::arglex_tool::can_get_number() const diff --git a/srecord/arglex/tool.h b/srecord/arglex/tool.h index 16f7e8b6..ff3504e4 100644 --- a/srecord/arglex/tool.h +++ b/srecord/arglex/tool.h @@ -211,7 +211,7 @@ class arglex_tool: /** * The destructor. */ - virtual ~arglex_tool(); + ~arglex_tool() override = default; /** * The constructor. Pass the argc and argv as given to main; @@ -299,7 +299,7 @@ class arglex_tool: std::string get_string(const char *caption); // See base class for documentation. - void default_command_line_processing(); + void default_command_line_processing() override; defcon_t get_redundant_bytes() const { return redundant_bytes; } defcon_t get_contradictory_bytes() const { return contradictory_bytes; } @@ -375,7 +375,7 @@ class arglex_tool: * Only one use of the standard input may be made; the second * use will result in a fatal error. */ - bool stdin_used; + bool stdin_used{false}; /** * The stdout_used instance variable is used to remember whether @@ -383,7 +383,7 @@ class arglex_tool: * Only one use of the standard output may be made; the second * use will result in a fatal error. */ - bool stdout_used; + bool stdout_used{false}; /** * The issue_sequence_warnings instance variable is used to @@ -394,7 +394,7 @@ class arglex_tool: * from the command line, positive means enabled on the command * line. */ - int issue_sequence_warnings; + int issue_sequence_warnings{-1}; /** * The get_simple_input method is used to parse an input filename @@ -454,29 +454,40 @@ class arglex_tool: * to do when faced with multiple identical byte values for a * memory address. */ - defcon_t redundant_bytes; + defcon_t redundant_bytes{srecord::defcon_warning}; /** * The contradictory_bytes instance variable is used to remember what * to do when faced with multiple different byte values for a * memory address. */ - defcon_t contradictory_bytes; + defcon_t contradictory_bytes{srecord::defcon_fatal_error}; + +public: + /** + * The default constructor. + */ + arglex_tool() = delete; + + /** + * The copy constructor. + */ + arglex_tool(const arglex_tool &) = delete; /** - * The default constructor. Do not use. + * The assignment operator. */ - arglex_tool(); + arglex_tool &operator=(const arglex_tool &) = delete; /** - * The copy constructor. Do not use. + * The move constructor */ - arglex_tool(const arglex_tool &); + arglex_tool ( arglex_tool && ) = delete; /** - * The assignment operator. Do not use. + * The move assignment operator */ - arglex_tool &operator=(const arglex_tool &); + arglex_tool& operator=(arglex_tool&&) = delete; }; }; diff --git a/srecord/arglex/tool/get_interval.cc b/srecord/arglex/tool/get_interval.cc index 83334fb3..5adb92eb 100644 --- a/srecord/arglex/tool/get_interval.cc +++ b/srecord/arglex/tool/get_interval.cc @@ -47,6 +47,22 @@ srecord::arglex_tool::get_interval_factor(const char *name) return retval; } + case token_within: + { + token_next(); + srecord::input::pointer ifp = get_input(); + interval result = srecord::input_interval(ifp); + return result; + } + + case token_over: + { + token_next(); + srecord::input::pointer ifp = get_input(); + interval result = srecord::input_interval(ifp); + return result.flatten(); + } + default: { if (!can_get_number()) @@ -78,22 +94,6 @@ srecord::arglex_tool::get_interval_factor(const char *name) interval result(n1, n2); return result; } - - case token_within: - { - token_next(); - srecord::input::pointer ifp = get_input(); - interval result = srecord::input_interval(ifp); - return result; - } - - case token_over: - { - token_next(); - srecord::input::pointer ifp = get_input(); - interval result = srecord::input_interval(ifp); - return result.flatten(); - } } } diff --git a/srecord/arglex/tool/input.cc b/srecord/arglex/tool/input.cc index 90d45930..2bb18a94 100644 --- a/srecord/arglex/tool/input.cc +++ b/srecord/arglex/tool/input.cc @@ -484,7 +484,6 @@ srecord::arglex_tool::get_simple_input() ifp = input_file_wilson::create(fn); break; } - // assert(ifp); // // Process any additional format-specific command line options. diff --git a/srecord/crc16.cc b/srecord/crc16.cc index b860a686..4961f77a 100644 --- a/srecord/crc16.cc +++ b/srecord/crc16.cc @@ -165,11 +165,6 @@ srecord::crc16::operator=(const crc16 &rhs) } -srecord::crc16::~crc16() -{ -} - - #if (IMPL == IMPL_CH9) // diff --git a/srecord/crc16.h b/srecord/crc16.h index 2a09be6a..eb1e98a6 100644 --- a/srecord/crc16.h +++ b/srecord/crc16.h @@ -89,7 +89,7 @@ class crc16 /** * The destructor. */ - virtual ~crc16(); + virtual ~crc16() = default; enum bit_direction_t { @@ -180,7 +180,7 @@ class crc16 * to improve efficiency. It is filled in the the #calculate_table * method, called from the constructor. */ - unsigned short table[256]; + unsigned short table[256]{}; /** * The calculate_table method is called by the constructor to fill diff --git a/srecord/crc32.cc b/srecord/crc32.cc index de0caa01..985e4dcd 100644 --- a/srecord/crc32.cc +++ b/srecord/crc32.cc @@ -119,12 +119,6 @@ srecord::crc32::crc32(seed_mode_t seed_mode) : } -srecord::crc32::crc32(const crc32 &arg) : - state(arg.state) -{ -} - - srecord::crc32 & srecord::crc32::operator=(const crc32 &arg) { @@ -135,12 +129,6 @@ srecord::crc32::operator=(const crc32 &arg) return *this; } - -srecord::crc32::~crc32() -{ -} - - static inline unsigned long UPDC32(unsigned char octet, unsigned long crc) { diff --git a/srecord/crc32.h b/srecord/crc32.h index 2acb9267..8e955698 100644 --- a/srecord/crc32.h +++ b/srecord/crc32.h @@ -41,7 +41,7 @@ class crc32 /** * The destructor. */ - virtual ~crc32(); + virtual ~crc32() = default; /** * The default constructor. @@ -51,7 +51,7 @@ class crc32 /** * The copy constructor. */ - crc32(const crc32 &); + crc32(const crc32 &) = default; /** * The assignment operator. diff --git a/srecord/fletcher16.cc b/srecord/fletcher16.cc index 8ac4e624..f8cd3d7a 100644 --- a/srecord/fletcher16.cc +++ b/srecord/fletcher16.cc @@ -26,12 +26,6 @@ // RFC 905 Annex B // - -srecord::fletcher16::~fletcher16() -{ -} - - srecord::fletcher16::fletcher16( unsigned char a_sum1, unsigned char a_sum2, @@ -57,30 +51,6 @@ srecord::fletcher16::fletcher16( } } - -srecord::fletcher16::fletcher16(const fletcher16 &rhs) : - sum1(rhs.sum1), - sum2(rhs.sum2), - answer(rhs.answer), - end(rhs.end) -{ -} - - -srecord::fletcher16 & -srecord::fletcher16::operator=(const fletcher16 &rhs) -{ - if (this != &rhs) - { - sum1 = rhs.sum1; - sum2 = rhs.sum2; - answer = rhs.answer; - end = rhs.end; - } - return *this; -} - - void srecord::fletcher16::next(unsigned char ch) { diff --git a/srecord/fletcher16.h b/srecord/fletcher16.h index e0974065..d35c87c6 100644 --- a/srecord/fletcher16.h +++ b/srecord/fletcher16.h @@ -58,11 +58,6 @@ namespace srecord class fletcher16 { public: - /** - * The destructor. - */ - virtual ~fletcher16(); - /** * The default constructor. * @@ -83,16 +78,6 @@ class fletcher16 fletcher16(unsigned char sum1 = 0, unsigned char sum2 = 0, int answer = -1, endian_t end = endian_little); - /** - * The copy constructor. - */ - fletcher16(const fletcher16 &); - - /** - * The assignment operator. - */ - fletcher16 &operator=(const fletcher16 &); - /** * The get method is used to obtain the running value of the cyclic * redundancy check. diff --git a/srecord/fletcher32.cc b/srecord/fletcher32.cc index df58d927..8c493c4e 100644 --- a/srecord/fletcher32.cc +++ b/srecord/fletcher32.cc @@ -19,26 +19,6 @@ #include -srecord::fletcher32::~fletcher32() -{ -} - - -srecord::fletcher32::fletcher32() : - sum1(0xFFFF), - sum2(0xFFFF) -{ - // See notes in the nextbuf() method, below. -} - - -srecord::fletcher32::fletcher32(const fletcher32 &rhs) : - sum1(rhs.sum1), - sum2(rhs.sum2) -{ -} - - srecord::fletcher32 & srecord::fletcher32::operator=(const fletcher32 &rhs) { diff --git a/srecord/fletcher32.h b/srecord/fletcher32.h index b28fc82a..dad1f472 100644 --- a/srecord/fletcher32.h +++ b/srecord/fletcher32.h @@ -59,17 +59,17 @@ class fletcher32 /** * The destructor. */ - virtual ~fletcher32(); + virtual ~fletcher32() = default; /** * The default constructor. */ - fletcher32(); + fletcher32() = default; /** * The copy constructor. */ - fletcher32(const fletcher32 &); + fletcher32(const fletcher32 &) = default; /** * The assignment operator. @@ -96,13 +96,13 @@ class fletcher32 /** * The sum1 instance variable is used to remember the sum of the bytes. */ - unsigned long sum1; + unsigned long sum1{0xFFFF}; /** * The sum2 instance variable is used to remember the sum of the * sum of the bytes. */ - unsigned long sum2; + unsigned long sum2{0xFFFF}; }; }; diff --git a/srecord/input.cc b/srecord/input.cc index d4a2d7eb..77ca4e20 100644 --- a/srecord/input.cc +++ b/srecord/input.cc @@ -31,12 +31,6 @@ srecord::input::input() : { } - -srecord::input::~input() -{ -} - - void srecord::input::fatal_error(const char *fmt, ...) const diff --git a/srecord/input.h b/srecord/input.h index 0cba99a0..8373c8fe 100644 --- a/srecord/input.h +++ b/srecord/input.h @@ -43,7 +43,7 @@ class input /** * The destructor. */ - virtual ~input(); + virtual ~input() = default; /** * The read method is used to read one record from the input. @@ -166,16 +166,16 @@ class input */ input(); -private: +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - input(const input &); + input(const input &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input &operator=(const input &); + input &operator=(const input &) = delete; }; }; diff --git a/srecord/input/catenate.cc b/srecord/input/catenate.cc index b5bd9cdb..96f28a6b 100644 --- a/srecord/input/catenate.cc +++ b/srecord/input/catenate.cc @@ -21,12 +21,6 @@ #include #include - -srecord::input_catenate::~input_catenate() -{ -} - - srecord::input_catenate::input_catenate(const pointer &a1, const pointer &a2) : in1(a1), in2(a2) diff --git a/srecord/input/catenate.h b/srecord/input/catenate.h index a99b6139..14ca6fba 100644 --- a/srecord/input/catenate.h +++ b/srecord/input/catenate.h @@ -35,7 +35,7 @@ class input_catenate: /** * The destructor. */ - virtual ~input_catenate(); + ~input_catenate() override = default; private: /** @@ -63,19 +63,19 @@ class input_catenate: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - std::string filename_and_line() const; + std::string filename_and_line() const override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - void disable_checksum_validation(); + void disable_checksum_validation() override; private: /** @@ -90,20 +90,21 @@ class input_catenate: */ pointer in2; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_catenate(); + input_catenate() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_catenate(const input_catenate &); + input_catenate(const input_catenate &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_catenate &operator=(const input_catenate &); + input_catenate &operator=(const input_catenate &) = delete; }; }; diff --git a/srecord/input/file.cc b/srecord/input/file.cc index 9908e191..315f9f2d 100644 --- a/srecord/input/file.cc +++ b/srecord/input/file.cc @@ -27,17 +27,6 @@ bool srecord::input_file::ignore_checksums_default = false; -srecord::input_file::input_file() : - file_name("standard input"), - line_number(1), - prev_was_newline(false), - vfp(stdin), - checksum(0), - ignore_checksums(ignore_checksums_default) -{ -} - - bool srecord::input_file::is_binary() const @@ -47,12 +36,7 @@ srecord::input_file::is_binary() srecord::input_file::input_file(const std::string &a_file_name) : - file_name(a_file_name), - line_number(1), - prev_was_newline(false), - vfp(0), - checksum(0), - ignore_checksums(ignore_checksums_default) + file_name(a_file_name) { if (file_name == "-") { diff --git a/srecord/input/file.h b/srecord/input/file.h index c24ae7a8..0fe32ff1 100644 --- a/srecord/input/file.h +++ b/srecord/input/file.h @@ -41,7 +41,7 @@ class input_file: /** * The destructor. */ - virtual ~input_file(); + ~input_file() override; /** * The guess class method is used to open a file of an unknown @@ -69,13 +69,13 @@ class input_file: protected: // See base class for documentation. - virtual std::string filename() const; + std::string filename() const override; // See base class for documentation. - virtual std::string filename_and_line() const; + std::string filename_and_line() const override; // See base class for documentation. - void disable_checksum_validation(); + void disable_checksum_validation() override; /** * The constructor. The input will be taken from the named file @@ -252,7 +252,7 @@ class input_file: * method to remember the current line number. It us used by the * filename_and_line method to report the current file location. */ - int line_number; + int line_number{1}; /** * The prev_was_newline instance variable is used by the @@ -263,7 +263,7 @@ class input_file: * the the error message must be issued only when the whole * line has bean read in, including the newline. error message. */ - bool prev_was_newline; + bool prev_was_newline{false}; /** * The vfp instance variable is used by the get_fp method to @@ -272,7 +272,7 @@ class input_file: * always go via the get_fp method. This ensures the file has * been opened first! */ - void *vfp; + void *vfp{nullptr}; protected: /** @@ -283,7 +283,7 @@ class input_file: * Always use the #checksum_get or #checksum_get16 methods to * read its value. */ - int checksum; + int checksum{0}; /** * The use_checksums method is used to determine whether or not to @@ -300,7 +300,7 @@ class input_file: * whether or not checksums should be ignored (true) or validated * (false). */ - bool ignore_checksums; + bool ignore_checksums{ignore_checksums_default}; /** * The ignore_checksums_default class variable is used to remember @@ -319,20 +319,21 @@ class input_file: */ void *get_fp(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file(); + input_file() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file(const input_file &); + input_file(const input_file &) = delete; /** - * the assignment operator. Do not use. + * the assignment operator. */ - input_file &operator=(const input_file &); + input_file &operator=(const input_file &) = delete; }; }; diff --git a/srecord/input/file/aomf.cc b/srecord/input/file/aomf.cc index 5d454ca5..b7701ee4 100644 --- a/srecord/input/file/aomf.cc +++ b/srecord/input/file/aomf.cc @@ -120,13 +120,8 @@ srecord::input_file_aomf::~input_file_aomf() srecord::input_file_aomf::input_file_aomf(const std::string &a_filename) : - srecord::input_file(a_filename), - current_buffer(0), - current_length(0), - current_maximum(0), - current_pos(0), - current_address(0), - state(expecting_header) + srecord::input_file(a_filename) + { } diff --git a/srecord/input/file/aomf.h b/srecord/input/file/aomf.h index e94aeb8f..fae9ce60 100644 --- a/srecord/input/file/aomf.h +++ b/srecord/input/file/aomf.h @@ -34,7 +34,7 @@ class input_file_aomf: /** * The destructor. */ - virtual ~input_file_aomf(); + ~input_file_aomf() override; private: /** @@ -45,7 +45,7 @@ class input_file_aomf: * @param file_name * The name of the file to be read. */ - input_file_aomf(const std::string &file_name); + explicit input_file_aomf(const std::string &file_name); public: /** @@ -61,16 +61,16 @@ class input_file_aomf: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -78,33 +78,33 @@ class input_file_aomf: * update the checksum. We over-ride the base implementation, * because we use raw bytes rather than two hex digits. */ - int get_byte(); + int get_byte() override; /** * The current_buffer instance variable is used to remember the * base of an array which buffers the current input record. */ - unsigned char *current_buffer; + unsigned char *current_buffer{nullptr}; /** * The current_length instance variable is used to remember * the length of the current record. It is zero if there is no * "current" record. */ - size_t current_length; + size_t current_length{0}; /** * The current_maximum instance variable is used to remember the * length of the current_buffer array. It is zero if there is no * "current" buffer. */ - size_t current_maximum; + size_t current_maximum{0}; /** * The current_pos instance variable is used to remember the * position within the current_buffer array. */ - size_t current_pos; + size_t current_pos{0}; /** * The current_address instance variable is used to track the @@ -112,7 +112,7 @@ class input_file_aomf: * we return a partial block, so that we always return the * correct load address. */ - unsigned long current_address; + unsigned long current_address{0}; enum state_t { @@ -125,7 +125,7 @@ class input_file_aomf: * The state instance variable is used to remember what to expect * next from the file. */ - state_t state; + state_t state{expecting_header}; /** * The slurp method is used to fill the current_buffer array, @@ -133,15 +133,16 @@ class input_file_aomf: */ int slurp(); +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_aomf(const input_file_aomf &); + input_file_aomf(const input_file_aomf &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_aomf &operator=(const input_file_aomf &); + input_file_aomf &operator=(const input_file_aomf &) = delete; }; }; diff --git a/srecord/input/file/ascii_hex.cc b/srecord/input/file/ascii_hex.cc index e9f0a5d0..b0a74e31 100644 --- a/srecord/input/file/ascii_hex.cc +++ b/srecord/input/file/ascii_hex.cc @@ -22,21 +22,10 @@ #include #include - -srecord::input_file_ascii_hex::~input_file_ascii_hex() -{ - // check termination? -} - - srecord::input_file_ascii_hex::input_file_ascii_hex( const std::string &a_filename ) : - input_file(a_filename), - garbage_warning(false), - seen_some_input(false), - address(0), - state(state_initial) + input_file(a_filename) { } diff --git a/srecord/input/file/ascii_hex.h b/srecord/input/file/ascii_hex.h index 830570f8..ce0e40e1 100644 --- a/srecord/input/file/ascii_hex.h +++ b/srecord/input/file/ascii_hex.h @@ -34,7 +34,7 @@ class input_file_ascii_hex: /** * The destructor. */ - virtual ~input_file_ascii_hex(); + ~input_file_ascii_hex() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_ascii_hex: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -76,40 +76,41 @@ class input_file_ascii_hex: * The garbage_warning instance variable is used to remember whether * a warning has already been issued if the file contains garbage. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * any data has been seen in the input to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The address instance variable is used to remember where we are * up to in the input file, so it may be associated with data bytes. */ - unsigned long address; + unsigned long address{0}; /** * The state instance variable is used to remember what state the * input is in at present. */ - enum { state_initial, state_body, state_ignore } state; + enum { state_initial, state_body, state_ignore } state {state_initial}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ascii_hex(); + input_file_ascii_hex() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ascii_hex(const input_file_ascii_hex &); + input_file_ascii_hex(const input_file_ascii_hex &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ascii_hex &operator=(const input_file_ascii_hex &); + input_file_ascii_hex &operator=(const input_file_ascii_hex &) = delete; }; }; diff --git a/srecord/input/file/atmel_generic.cc b/srecord/input/file/atmel_generic.cc index 27620ed0..9a695d66 100644 --- a/srecord/input/file/atmel_generic.cc +++ b/srecord/input/file/atmel_generic.cc @@ -23,15 +23,9 @@ #include -srecord::input_file_atmel_generic::~input_file_atmel_generic() -{ -} - - srecord::input_file_atmel_generic::input_file_atmel_generic( const std::string &a_file_name, endian_t a_end) : srecord::input_file(a_file_name), - seen_some_input(false), end(a_end) { } diff --git a/srecord/input/file/atmel_generic.h b/srecord/input/file/atmel_generic.h index be1074bf..f09a5a98 100644 --- a/srecord/input/file/atmel_generic.h +++ b/srecord/input/file/atmel_generic.h @@ -35,7 +35,7 @@ class input_file_atmel_generic: /** * The destructor. */ - virtual ~input_file_atmel_generic(); + ~input_file_atmel_generic() override = default; /** * The create class method is used to create new dynamically @@ -64,13 +64,13 @@ class input_file_atmel_generic: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -93,7 +93,7 @@ class input_file_atmel_generic: * The seen_some_input instance variable is used to remember whether * any input data has been seen to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The end instance variable is used to remember whether the @@ -101,20 +101,22 @@ class input_file_atmel_generic: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_atmel_generic(); + input_file_atmel_generic() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_atmel_generic(const input_file_atmel_generic &); + input_file_atmel_generic(const input_file_atmel_generic &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_atmel_generic &operator=(const input_file_atmel_generic &); + input_file_atmel_generic &operator=( + const input_file_atmel_generic &) = delete; }; }; diff --git a/srecord/input/file/binary.cc b/srecord/input/file/binary.cc index 6b227002..b4705f1a 100644 --- a/srecord/input/file/binary.cc +++ b/srecord/input/file/binary.cc @@ -21,14 +21,8 @@ #include -srecord::input_file_binary::~input_file_binary() -{ -} - - srecord::input_file_binary::input_file_binary(const std::string &a_file_name) : - srecord::input_file(a_file_name), - address(0) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/binary.h b/srecord/input/file/binary.h index 106c94cb..60029fb3 100644 --- a/srecord/input/file/binary.h +++ b/srecord/input/file/binary.h @@ -34,7 +34,7 @@ class input_file_binary: /** * The destructor. */ - virtual ~input_file_binary(); + ~input_file_binary() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_binary: protected: // See nase class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -70,25 +70,26 @@ class input_file_binary: * The address instance variable is used to remember where we are * up to in the file. */ - unsigned long address; + unsigned long address{0}; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_binary(); + input_file_binary() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_binary(const input_file_binary &); + input_file_binary(const input_file_binary &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_binary &operator=(const input_file_binary &); + input_file_binary &operator=(const input_file_binary &) = delete; }; }; diff --git a/srecord/input/file/brecord.cc b/srecord/input/file/brecord.cc index fffbe452..d118ad73 100644 --- a/srecord/input/file/brecord.cc +++ b/srecord/input/file/brecord.cc @@ -20,17 +20,10 @@ #include #include - -srecord::input_file_brecord::~input_file_brecord() -{ -} - - srecord::input_file_brecord::input_file_brecord( const std::string &a_file_name ) : - input_file(a_file_name), - seen_some_input(false) + input_file(a_file_name) { } @@ -61,7 +54,8 @@ srecord::input_file_brecord::read_inner(record &result) if (length == 0) { - result = record(record::type_execution_start_address, address, 0, 0); + result = record(record::type_execution_start_address, + address, nullptr, 0); } else { diff --git a/srecord/input/file/brecord.h b/srecord/input/file/brecord.h index 83428f26..4547ef3f 100644 --- a/srecord/input/file/brecord.h +++ b/srecord/input/file/brecord.h @@ -34,7 +34,7 @@ class input_file_brecord: /** * The destructor. */ - virtual ~input_file_brecord(); + ~input_file_brecord() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_brecord: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -76,22 +76,23 @@ class input_file_brecord: * The seen_some_input instance variable is used to remember whether * or not any data has been seen from this file to date. */ - bool seen_some_input; + bool seen_some_input{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_brecord(); + input_file_brecord() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_brecord(const input_file_brecord &); + input_file_brecord(const input_file_brecord &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_brecord &operator=(const input_file_brecord &); + input_file_brecord &operator=(const input_file_brecord &) = delete; }; }; diff --git a/srecord/input/file/cosmac.cc b/srecord/input/file/cosmac.cc index 911ec5a7..31b9cd95 100644 --- a/srecord/input/file/cosmac.cc +++ b/srecord/input/file/cosmac.cc @@ -20,17 +20,8 @@ #include #include - -srecord::input_file_cosmac::~input_file_cosmac() -{ -} - - srecord::input_file_cosmac::input_file_cosmac(const std::string &a_file_name) : - input_file(a_file_name), - state('\n'), - address(0), - seen_some_input(false) + input_file(a_file_name) { } diff --git a/srecord/input/file/cosmac.h b/srecord/input/file/cosmac.h index 44fedb9d..3f47c9ba 100644 --- a/srecord/input/file/cosmac.h +++ b/srecord/input/file/cosmac.h @@ -34,7 +34,7 @@ class input_file_cosmac: /** * The destructor. */ - virtual ~input_file_cosmac(); + ~input_file_cosmac() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_cosmac: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -77,34 +77,35 @@ class input_file_cosmac: * , have seen , character, discarding to \n, then resume sp state * ; have seen , character, discarding to \n, then resume M state */ - char state; + char state{'\n'}; /** * The address instance variable is used to remember what address * we are up to in the input. */ - unsigned long address; + unsigned long address{0}; /** * The seen_some_input instance variable is used to remember whether * the file has any contents or not. */ - bool seen_some_input; + bool seen_some_input{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_cosmac(); + input_file_cosmac() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_cosmac(const input_file_cosmac &); + input_file_cosmac(const input_file_cosmac &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_cosmac &operator=(const input_file_cosmac &); + input_file_cosmac &operator=(const input_file_cosmac &) = delete; }; }; diff --git a/srecord/input/file/dec_binary.cc b/srecord/input/file/dec_binary.cc index 60d31aec..36992167 100644 --- a/srecord/input/file/dec_binary.cc +++ b/srecord/input/file/dec_binary.cc @@ -21,17 +21,10 @@ #include -srecord::input_file_dec_binary::~input_file_dec_binary() -{ -} - - srecord::input_file_dec_binary::input_file_dec_binary( const std::string &a_file_name) : - srecord::input_file(a_file_name), - current_pos(0), - current_length(0), - current_address(0) + srecord::input_file(a_file_name) + { } diff --git a/srecord/input/file/dec_binary.h b/srecord/input/file/dec_binary.h index e541a8c4..7976a9d1 100644 --- a/srecord/input/file/dec_binary.h +++ b/srecord/input/file/dec_binary.h @@ -35,7 +35,7 @@ class input_file_dec_binary: /** * The destructor. */ - virtual ~input_file_dec_binary(); + ~input_file_dec_binary() override = default; /** * The create class method is used to create new dynamically @@ -50,16 +50,16 @@ class input_file_dec_binary: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -76,7 +76,7 @@ class input_file_dec_binary: * update the checksum. We over-ride the base implementation, * because we use raw bytes rather than two hex digits. */ - int get_byte(); + int get_byte() override; /** * This format has NUL characters for optional padding around @@ -92,14 +92,14 @@ class input_file_dec_binary: * because DEC Binary records can be significantly longer than * other formats. */ - unsigned long current_pos; + unsigned long current_pos{0}; /** * The current_length instance variable is used to remember * the length of the current record. It is zero if there is no * "current" record. */ - unsigned long current_length; + unsigned long current_length{0}; /** * The current_address instance variable is used to track the @@ -107,17 +107,18 @@ class input_file_dec_binary: * we return a partial block, so that we always return the * correct load address. */ - unsigned long current_address; + unsigned long current_address{0}; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_dec_binary(const input_file_dec_binary &); + input_file_dec_binary(const input_file_dec_binary &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_dec_binary &operator=(const input_file_dec_binary &); + input_file_dec_binary &operator=(const input_file_dec_binary &) = delete; }; }; diff --git a/srecord/input/file/emon52.cc b/srecord/input/file/emon52.cc index 85ab2924..afc4067c 100644 --- a/srecord/input/file/emon52.cc +++ b/srecord/input/file/emon52.cc @@ -21,12 +21,6 @@ #include #include - -srecord::input_file_emon52::~input_file_emon52() -{ -} - - srecord::input_file_emon52::input_file_emon52(const std::string &a_file_name) : srecord::input_file(a_file_name) { diff --git a/srecord/input/file/emon52.h b/srecord/input/file/emon52.h index 0aacf22b..368fff4b 100644 --- a/srecord/input/file/emon52.h +++ b/srecord/input/file/emon52.h @@ -34,7 +34,7 @@ class input_file_emon52: /** * The destructor. */ - virtual ~input_file_emon52(); + ~input_file_emon52() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_emon52: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -74,20 +74,21 @@ class input_file_emon52: */ void skip_white_space(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_emon52(); + input_file_emon52() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_emon52(const input_file_emon52 &); + input_file_emon52(const input_file_emon52 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_emon52 &operator=(const input_file_emon52 &); + input_file_emon52 &operator=(const input_file_emon52 &) = delete; }; }; diff --git a/srecord/input/file/fairchild.cc b/srecord/input/file/fairchild.cc index ae7ffafe..9c08fe50 100644 --- a/srecord/input/file/fairchild.cc +++ b/srecord/input/file/fairchild.cc @@ -20,19 +20,10 @@ #include #include - -srecord::input_file_fairchild::~input_file_fairchild() -{ -} - - srecord::input_file_fairchild::input_file_fairchild( const std::string &a_filename ) : - input_file(a_filename), - header_seen(false), - address(0), - file_contains_data(false) + input_file(a_filename) { } diff --git a/srecord/input/file/fairchild.h b/srecord/input/file/fairchild.h index 4affbf5e..0d775d22 100644 --- a/srecord/input/file/fairchild.h +++ b/srecord/input/file/fairchild.h @@ -34,7 +34,7 @@ class input_file_fairchild: /** * The destructor. */ - virtual ~input_file_fairchild(); + ~input_file_fairchild() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_fairchild: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -71,47 +71,48 @@ class input_file_fairchild: * We override the one in the base class because the checksum is * nibble-based, not byte-based. */ - int get_nibble(); + int get_nibble() override; /** * The get_byte method gets a two hex-digit from input and assembles * them (big-endian) into a byte. We override the one in the base * class because the checksum is nibble-based, not byte-based. */ - int get_byte(); + int get_byte() override; /** * The header_seen instance variable is used to member whether the * file header has been processed yet. */ - bool header_seen; + bool header_seen{false}; /** * The address instance variable is used to member the address at * the current point in the input file. */ - unsigned long address; + unsigned long address{0}; /** * The file_contains_data instance variable is used to member * whether any data records have been seen yet. */ - bool file_contains_data; + bool file_contains_data{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_fairchild(); + input_file_fairchild() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_fairchild(const input_file_fairchild &); + input_file_fairchild(const input_file_fairchild &) = delete; /** * The assignment operator. */ - input_file_fairchild &operator=(const input_file_fairchild &); + input_file_fairchild &operator=(const input_file_fairchild &) = delete; }; }; diff --git a/srecord/input/file/fastload.cc b/srecord/input/file/fastload.cc index a1433c3e..fbc0d568 100644 --- a/srecord/input/file/fastload.cc +++ b/srecord/input/file/fastload.cc @@ -23,17 +23,10 @@ #include -srecord::input_file_fastload::~input_file_fastload() -{ -} - - srecord::input_file_fastload::input_file_fastload( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - seen_some_input(false), - address(0) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/fastload.h b/srecord/input/file/fastload.h index 4fdc61b9..0e50e053 100644 --- a/srecord/input/file/fastload.h +++ b/srecord/input/file/fastload.h @@ -33,7 +33,7 @@ class input_file_fastload: /** * The destructor. */ - virtual ~input_file_fastload(); + ~input_file_fastload() override = default; /** * The create class method is used to create new dynamically @@ -48,13 +48,13 @@ class input_file_fastload: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -89,14 +89,14 @@ class input_file_fastload: * The seen_some_input instance variable is used to * remember whether any input has been seen. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The address instance variable is used to represent the * current address within the file. It is set by the /A command, * and advanced by the data, /B and /Z commands. */ - unsigned long address; + unsigned long address{0}; /** * The expect_white_space method is used to ensure that while @@ -105,20 +105,21 @@ class input_file_fastload: */ void expect_white_space(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_fastload(); + input_file_fastload() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_fastload(const input_file_fastload &); + input_file_fastload(const input_file_fastload &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_fastload &operator=(const input_file_fastload &); + input_file_fastload &operator=(const input_file_fastload &) = delete; }; }; diff --git a/srecord/input/file/formatted_binary.cc b/srecord/input/file/formatted_binary.cc index 4f307701..8bd711b0 100644 --- a/srecord/input/file/formatted_binary.cc +++ b/srecord/input/file/formatted_binary.cc @@ -21,11 +21,6 @@ #include -srecord::input_file_formatted_binary::~input_file_formatted_binary() -{ -} - - srecord::input_file_formatted_binary::input_file_formatted_binary( const std::string &a_file_name ) : diff --git a/srecord/input/file/formatted_binary.h b/srecord/input/file/formatted_binary.h index b0df594f..76e5e923 100644 --- a/srecord/input/file/formatted_binary.h +++ b/srecord/input/file/formatted_binary.h @@ -34,7 +34,7 @@ class input_file_formatted_binary: /** * The destructor. */ - virtual ~input_file_formatted_binary(); + ~input_file_formatted_binary() override = default; /** * The create class method is used to create new dynamically @@ -49,16 +49,16 @@ class input_file_formatted_binary: protected: // See base class for documentation. - bool read (record &record); + bool read (record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -99,20 +99,22 @@ class input_file_formatted_binary: */ unsigned short check_sum; +public: /** * The default constructor. */ - input_file_formatted_binary(); + input_file_formatted_binary() = delete; /** * The copy constructor. */ - input_file_formatted_binary(const input_file_formatted_binary &); + input_file_formatted_binary(const input_file_formatted_binary &) = delete; /** * The assignment operator. */ - input_file_formatted_binary &operator=(const input_file_formatted_binary &); + input_file_formatted_binary &operator=( + const input_file_formatted_binary &) = delete; }; }; diff --git a/srecord/input/file/four_packed_code.cc b/srecord/input/file/four_packed_code.cc index 27cc4d83..b4d3cff3 100644 --- a/srecord/input/file/four_packed_code.cc +++ b/srecord/input/file/four_packed_code.cc @@ -20,19 +20,11 @@ #include #include - -srecord::input_file_four_packed_code::~input_file_four_packed_code() -{ -} - - srecord::input_file_four_packed_code::input_file_four_packed_code( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - garbage_warning(false), - seen_some_input(false), - running_address(0) + srecord::input_file(a_file_name) + { } diff --git a/srecord/input/file/four_packed_code.h b/srecord/input/file/four_packed_code.h index d7ae2585..23f9457e 100644 --- a/srecord/input/file/four_packed_code.h +++ b/srecord/input/file/four_packed_code.h @@ -35,7 +35,7 @@ class input_file_four_packed_code: /** * The destructor. */ - virtual ~input_file_four_packed_code(); + ~input_file_four_packed_code() override = default; /** * The create class method is used to create new dynamically @@ -50,13 +50,13 @@ class input_file_four_packed_code: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -81,7 +81,7 @@ class input_file_four_packed_code: * bytes) at a time. The usual get_word (etc) continue to work * without additional modifications. */ - int get_byte(); + int get_byte() override; /** * The get_digit method is used to fetch one base85 digit from @@ -95,7 +95,7 @@ class input_file_four_packed_code: * 5-character (4-byte) input multiple. (Only the get_byte * method may use this instance variable.) */ - unsigned get_byte_pos; + unsigned get_byte_pos{}; /** * The get_byte_value instance variable is used by the bet_byte @@ -103,43 +103,45 @@ class input_file_four_packed_code: * input multiple. (Only the get_byte method may use this * instance variable.) */ - unsigned long get_byte_value; + unsigned long get_byte_value{}; /** * The garbage_warning instance variable is used by the read * method to record whether or not a warning about non-format * lines has been issued (only one warning is issued per file). */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used by the read * and read_inner methods to record whether or not any valid * input has been seen. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The running_address instance variable method is used by the * read_inner method to record the current address. This is * so that record types 1 and 2 can be processed accurately. */ - unsigned long running_address; + unsigned long running_address{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_four_packed_code(); + input_file_four_packed_code() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_four_packed_code(const input_file_four_packed_code &); + input_file_four_packed_code(const input_file_four_packed_code &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_four_packed_code &operator=(const input_file_four_packed_code &); + input_file_four_packed_code &operator=( + const input_file_four_packed_code &) = delete; }; }; diff --git a/srecord/input/file/hexdump.cc b/srecord/input/file/hexdump.cc index 9b6a2825..a2cd3110 100644 --- a/srecord/input/file/hexdump.cc +++ b/srecord/input/file/hexdump.cc @@ -20,16 +20,8 @@ #include #include - -srecord::input_file_hexdump::~input_file_hexdump() -{ -} - - srecord::input_file_hexdump::input_file_hexdump(const std::string &filename) : - input_file(filename), - address(0), - data_seen(false) + input_file(filename) { } diff --git a/srecord/input/file/hexdump.h b/srecord/input/file/hexdump.h index e81795c5..cee0b2ed 100644 --- a/srecord/input/file/hexdump.h +++ b/srecord/input/file/hexdump.h @@ -34,7 +34,7 @@ class input_file_hexdump: /** * The destructor. */ - virtual ~input_file_hexdump(); + ~input_file_hexdump() override = default; /** * The create class method is used to create new dynamically @@ -47,13 +47,13 @@ class input_file_hexdump: protected: // See base class for documentation. - bool read(class record &rec); + bool read(class record &rec) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -92,7 +92,7 @@ class input_file_hexdump: * address of the next data record. This is set and advanced by * the #read method. */ - unsigned long address; + unsigned long address{0}; /** * The data_seen instance variable is used to remember whether or @@ -100,28 +100,29 @@ class input_file_hexdump: * an error when there is apparently no data in the file, and this * helps #guess to figure out the file is not of this type. */ - bool data_seen; + bool data_seen{false}; /** * The current_token_value instance variable is used to remember * the value of the most recent token_byte seen. */ - unsigned current_token_value; + unsigned current_token_value{}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_hexdump(); + input_file_hexdump() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_hexdump(const input_file_hexdump &); + input_file_hexdump(const input_file_hexdump &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_hexdump &operator=(const input_file_hexdump &); + input_file_hexdump &operator=(const input_file_hexdump &) = delete; }; }; diff --git a/srecord/input/file/hp64k.cc b/srecord/input/file/hp64k.cc index 764919ec..017c2f47 100644 --- a/srecord/input/file/hp64k.cc +++ b/srecord/input/file/hp64k.cc @@ -49,16 +49,9 @@ #include -srecord::input_file_hp64k::~input_file_hp64k() -{ -} - - srecord::input_file_hp64k::input_file_hp64k( const std::string &a_file_name) : - input_file(a_file_name), - rec_count(0), - state(need_hdr) + input_file(a_file_name) { } diff --git a/srecord/input/file/hp64k.h b/srecord/input/file/hp64k.h index 7c328b0b..6d792885 100644 --- a/srecord/input/file/hp64k.h +++ b/srecord/input/file/hp64k.h @@ -35,7 +35,7 @@ class input_file_hp64k: /** * The destructor. */ - virtual ~input_file_hp64k(); + ~input_file_hp64k() override = default; /** * The create class method is used to create new dynamically @@ -50,16 +50,16 @@ class input_file_hp64k: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -71,12 +71,12 @@ class input_file_hp64k: input_file_hp64k(const std::string &file_name); // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; /** * Number of parsed data records */ - unsigned long rec_count; + unsigned long rec_count{0}; /** Helper function: read two bytes, big-endian. Ret 1 if ok */ bool read_u16be(uint16_t *dest); @@ -93,22 +93,23 @@ class input_file_hp64k: /** * Parsing state. Files always have header, then PIR, then data records. */ - enum { need_hdr, need_pir, data } state; + enum { need_hdr, need_pir, data } state{need_hdr}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_hp64k(); + input_file_hp64k() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_hp64k(const input_file_hp64k &); + input_file_hp64k(const input_file_hp64k &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_hp64k &operator=(const input_file_hp64k &); + input_file_hp64k &operator=(const input_file_hp64k &) = delete; }; }; diff --git a/srecord/input/file/idt.cc b/srecord/input/file/idt.cc index 629f0287..c3e870e0 100644 --- a/srecord/input/file/idt.cc +++ b/srecord/input/file/idt.cc @@ -21,17 +21,10 @@ #include -srecord::input_file_idt::~input_file_idt() -{ -} - - srecord::input_file_idt::input_file_idt( const std::string &a_file_name ) : - input_file(a_file_name), - data_count(0), - seen_some_input(false) + input_file(a_file_name) { } diff --git a/srecord/input/file/idt.h b/srecord/input/file/idt.h index a8c65c65..5e38a011 100644 --- a/srecord/input/file/idt.h +++ b/srecord/input/file/idt.h @@ -34,7 +34,7 @@ class input_file_idt: /** * The destructor. */ - virtual ~input_file_idt(); + ~input_file_idt() override = default; /** * The create class method is used to create new dynamically @@ -49,16 +49,16 @@ class input_file_idt: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -73,7 +73,7 @@ class input_file_idt: * The data_count instance variable is used to remember the number * of data lines has occurred so far in the input file. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The read_inner method is used to read a record of input. @@ -85,7 +85,7 @@ class input_file_idt: * The seen_some_input instance variable is used to remember where * any data has been seen in this file yet. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The record_format_error is a wrapper around #fatal_error to @@ -93,20 +93,21 @@ class input_file_idt: */ void record_format_error(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_idt(); + input_file_idt() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_idt(const input_file_idt &); + input_file_idt(const input_file_idt &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_idt &operator=(const input_file_idt &); + input_file_idt &operator=(const input_file_idt &) = delete; }; }; diff --git a/srecord/input/file/intel.cc b/srecord/input/file/intel.cc index 1e460709..2cd297f7 100644 --- a/srecord/input/file/intel.cc +++ b/srecord/input/file/intel.cc @@ -28,15 +28,7 @@ srecord::input_file_intel::~input_file_intel() srecord::input_file_intel::input_file_intel(const std::string &a_file_name) : - srecord::input_file(a_file_name), - data_record_count(0), - garbage_warning(false), - seen_some_input(false), - termination_seen(false), - mode(mode_i8hex), - address_base(0), - pushback(0), - end_seen(false) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/intel.h b/srecord/input/file/intel.h index 623d0586..fdccff40 100644 --- a/srecord/input/file/intel.h +++ b/srecord/input/file/intel.h @@ -34,7 +34,7 @@ class input_file_intel: /** * The destructor. */ - virtual ~input_file_intel(); + ~input_file_intel() override; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_intel: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -76,26 +76,26 @@ class input_file_intel: * The data_record_count instance variable is used to remember the * number of data records seen to date. */ - int data_record_count; + int data_record_count{0}; /** * The garbage_warning instance variable is used to remember whether * or not a warning has already been issued about garbage lines * of input. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * or not the file contains any data. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The termination_seen instance variable is used to remember * whether or not a termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; enum mode_t { @@ -108,40 +108,41 @@ class input_file_intel: * The mode instance variable is used to remember what addressing * mode the file is currently in. */ - mode_t mode; + mode_t mode{mode_i8hex}; /** * The address_base instance variable is used to remember the * segment base address when in segmented addressing mode. */ - unsigned long address_base; + unsigned long address_base{0}; /** * The pushback instance variable is used to remember the previous * record in the file. This is needed in some instances, but not always. */ - record *pushback; + record *pushback{nullptr}; /** * The end_seen instance variable is used to remember whether or * not the end of file has been seen yet. */ - bool end_seen; + bool end_seen{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_intel(); + input_file_intel() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_intel(const input_file_intel &); + input_file_intel(const input_file_intel &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_intel &operator=(const input_file_intel &); + input_file_intel &operator=(const input_file_intel &) = delete; }; }; diff --git a/srecord/input/file/intel16.cc b/srecord/input/file/intel16.cc index 10c91c65..9722c74c 100644 --- a/srecord/input/file/intel16.cc +++ b/srecord/input/file/intel16.cc @@ -30,15 +30,7 @@ srecord::input_file_intel16::~input_file_intel16() srecord::input_file_intel16::input_file_intel16( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - data_record_count(0), - garbage_warning(false), - seen_some_input(false), - termination_seen(false), - mode(linear), - address_base(0), - pushback(0), - end_seen(false) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/intel16.h b/srecord/input/file/intel16.h index 5bfb11c6..a6ee8120 100644 --- a/srecord/input/file/intel16.h +++ b/srecord/input/file/intel16.h @@ -35,7 +35,7 @@ class input_file_intel16: /** * The destructor. */ - virtual ~input_file_intel16(); + ~input_file_intel16() override; /** * The create class method is used to create new dynamically @@ -50,13 +50,13 @@ class input_file_intel16: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -77,65 +77,66 @@ class input_file_intel16: * The data_record_count instance variable is used to remember the * number of data records seen to date. */ - int data_record_count; + int data_record_count{0}; /** * The garbage_warning instance variable is used to remember whether * or not a warning has already been issued about garbage lines * of input. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * or not the file contains any data. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The termination_seen instance variable is used to remember * whether or not a termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; /** * The mode instance variable is used to remember what addressing * mode the file is currently in. */ - enum { linear, segmented } mode; + enum { linear, segmented } mode{linear}; /** * The address_base instance variable is used to remember the * segment base address when in segmented addressing mode. */ - unsigned long address_base; + unsigned long address_base{0}; /** * The pushback instance variable is used to remember the previous * record in the file. This is needed in some instances, but not always. */ - record *pushback; + record *pushback{nullptr}; /** * The end_seen instance variable is used to remember whether or * not the end of file has been seen yet. */ - bool end_seen; + bool end_seen{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_intel16(); + input_file_intel16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_intel16(const input_file_intel16 &); + input_file_intel16(const input_file_intel16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_intel16 &operator=(const input_file_intel16 &); + input_file_intel16 &operator=(const input_file_intel16 &) = delete; }; }; diff --git a/srecord/input/file/logisim.cc b/srecord/input/file/logisim.cc index 4152bae5..4d3079a7 100644 --- a/srecord/input/file/logisim.cc +++ b/srecord/input/file/logisim.cc @@ -25,18 +25,10 @@ #include #include - -srecord::input_file_logisim::~input_file_logisim() -{ -} - - srecord::input_file_logisim::input_file_logisim( const std::string &a_file_name ) : - input_file(a_file_name), - address(0), - state(state_line_one) + input_file(a_file_name) { } diff --git a/srecord/input/file/logisim.h b/srecord/input/file/logisim.h index 7d0326e1..a39d249e 100644 --- a/srecord/input/file/logisim.h +++ b/srecord/input/file/logisim.h @@ -84,7 +84,7 @@ class input_file_logisim: /** * The destructor. */ - virtual ~input_file_logisim(); + ~input_file_logisim() override = default; static input_file::pointer create(const std::string &file_name); @@ -97,13 +97,13 @@ class input_file_logisim: protected: // See base class for documentation - bool read(srecord::record &rec); + bool read(srecord::record &rec) override; // See base class for documentation - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation - int format_option_number() const; + int format_option_number() const override; /** * The constructor. @@ -111,8 +111,8 @@ class input_file_logisim: input_file_logisim(const std::string &file_name); private: - srecord::record::address_t address; - state_t state; + srecord::record::address_t address{0}; + state_t state{state_line_one}; struct datum_t { @@ -132,20 +132,21 @@ class input_file_logisim: void read_inner_two(); void read_inner_job(); +public: /** * The default constructor. */ - input_file_logisim(); + input_file_logisim() = delete; /** * The copy constructor. */ - input_file_logisim(const input_file_logisim &); + input_file_logisim(const input_file_logisim &) = delete; /** * The assignment operator. */ - input_file_logisim &operator=(const input_file_logisim &); + input_file_logisim &operator=(const input_file_logisim &) = delete; }; }; diff --git a/srecord/input/file/mif.cc b/srecord/input/file/mif.cc index 95f6fb74..50dcacaa 100644 --- a/srecord/input/file/mif.cc +++ b/srecord/input/file/mif.cc @@ -20,21 +20,8 @@ #include #include - -srecord::input_file_mif::~input_file_mif() -{ -} - - srecord::input_file_mif::input_file_mif(const std::string &a_file_name) : - srecord::input_file(a_file_name), - state(state_header), - address(0), - lex_radix(10), - lex_addr_radix(16), - lex_data_radix(16), - width(8), - width_in_bytes(1) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/mif.h b/srecord/input/file/mif.h index fd869997..a2251061 100644 --- a/srecord/input/file/mif.h +++ b/srecord/input/file/mif.h @@ -34,7 +34,7 @@ class input_file_mif: /** * The destructor. */ - virtual ~input_file_mif(); + ~input_file_mif() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_mif: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -79,31 +79,31 @@ class input_file_mif: * The state instance variable is used to remember the parse state * as we progress through the file. */ - state_t state; + state_t state{state_header}; /** * The address instance variable is used to remember where we are * up to in the input file, so it may be associated with data bytes. */ - unsigned long address; + unsigned long address{0}; /** * The lex_radix instance variable is used to remember the numeric * radix to be used when parsing numbers. */ - unsigned lex_radix; + unsigned lex_radix{10}; /** * The lex_addr_radix instance variable is used to remember the * numeric radix to be used when parsing address values. */ - unsigned lex_addr_radix; + unsigned lex_addr_radix{16}; /** * The lex_data_radix instance variable is used to remember the * numeric radix to be used when parsing data values. */ - unsigned lex_data_radix; + unsigned lex_data_radix{16}; enum token_t { @@ -141,7 +141,7 @@ class input_file_mif: * The token_value instance variable is used to remember the * numeric value of token_number returns from #lex. */ - long token_value; + long token_value{}; /** * The lex_addr method is used to obtain the next lexical token @@ -170,23 +170,24 @@ class input_file_mif: int get_radix(); void get_colon(); - unsigned width; - unsigned width_in_bytes; + unsigned width{8}; + unsigned width_in_bytes{1}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_mif(); + input_file_mif() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_mif(const input_file_mif &); + input_file_mif(const input_file_mif &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_mif &operator=(const input_file_mif &); + input_file_mif &operator=(const input_file_mif &) = delete; }; }; diff --git a/srecord/input/file/mips_flash.cc b/srecord/input/file/mips_flash.cc index 62cd8224..e210ee5c 100644 --- a/srecord/input/file/mips_flash.cc +++ b/srecord/input/file/mips_flash.cc @@ -21,22 +21,12 @@ #include -srecord::input_file_mips_flash::~input_file_mips_flash() -{ -} - - srecord::input_file_mips_flash::input_file_mips_flash( const std::string &a_file_name, endian_t a_endian ) : input_file(a_file_name), - seen_some_input(false), - endian(a_endian), - address(0), - token(token_eof), - token_value(0), - seen_reset(false) + endian(a_endian) { } diff --git a/srecord/input/file/mips_flash.h b/srecord/input/file/mips_flash.h index e2d52384..394ead12 100644 --- a/srecord/input/file/mips_flash.h +++ b/srecord/input/file/mips_flash.h @@ -35,7 +35,7 @@ class input_file_mips_flash: /** * The destructor. */ - virtual ~input_file_mips_flash(); + ~input_file_mips_flash() override = default; /** * The create_be class method is used to create new dynamically @@ -62,13 +62,13 @@ class input_file_mips_flash: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -92,7 +92,7 @@ class input_file_mips_flash: * The seen_some_input instance variable is used to remember whether * or not any data has been seen from this file to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The endian instance variable is used to remember whether the @@ -104,7 +104,7 @@ class input_file_mips_flash: * The address instance variable is used to remember where we are * up to in the input file, for when we build the next data record. */ - unsigned long address; + unsigned long address{0}; /** * The tokenizer method is used to determine the next token in the @@ -129,35 +129,36 @@ class input_file_mips_flash: * The token instance variable is used to remember the kind of * token was found by the preceding #tokenizer call. */ - token_t token; + token_t token{token_eof}; /** * The token_value instance variable is used to remember the value * of the number, if the preceding #tokenizer call saw a number. * Otherwise, its value is undefined. */ - unsigned long token_value; + unsigned long token_value{0}; /** * The seen_reset instance variable is used to remember * whether or not the initial '!R' token has already been seen. */ - bool seen_reset; + bool seen_reset{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_mips_flash(); + input_file_mips_flash() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_mips_flash(const input_file_mips_flash &); + input_file_mips_flash(const input_file_mips_flash &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_mips_flash &operator=(const input_file_mips_flash &); + input_file_mips_flash &operator=(const input_file_mips_flash &) = delete; }; }; diff --git a/srecord/input/file/mos_tech.cc b/srecord/input/file/mos_tech.cc index 6be2f24c..6086d852 100644 --- a/srecord/input/file/mos_tech.cc +++ b/srecord/input/file/mos_tech.cc @@ -20,19 +20,10 @@ #include #include - -srecord::input_file_mos_tech::~input_file_mos_tech() -{ -} - - srecord::input_file_mos_tech::input_file_mos_tech( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - garbage_warning(false), - seen_some_input(false), - data_record_count(0) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/mos_tech.h b/srecord/input/file/mos_tech.h index 77c66830..194d3720 100644 --- a/srecord/input/file/mos_tech.h +++ b/srecord/input/file/mos_tech.h @@ -33,7 +33,7 @@ class input_file_mos_tech: /** * The destructor. */ - virtual ~input_file_mos_tech(); + ~input_file_mos_tech() override = default; /** * The create class method is used to create new dynamically @@ -48,13 +48,13 @@ class input_file_mos_tech: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -77,34 +77,35 @@ class input_file_mos_tech: * whether or not a warning has been issued about non-format * lines in the file. Only one warning per file is issued. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to * remember whether any input has been seen. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The data_record_count instance variable is used to remember the * number of data records seen to date. */ - int data_record_count; + int data_record_count{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_mos_tech(); + input_file_mos_tech() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_mos_tech(const input_file_mos_tech &); + input_file_mos_tech(const input_file_mos_tech &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_mos_tech &operator=(const input_file_mos_tech &); + input_file_mos_tech &operator=(const input_file_mos_tech &) = delete; }; }; diff --git a/srecord/input/file/motorola.cc b/srecord/input/file/motorola.cc index 2d392c12..b4c77cc9 100644 --- a/srecord/input/file/motorola.cc +++ b/srecord/input/file/motorola.cc @@ -20,22 +20,10 @@ #include #include - -srecord::input_file_motorola::~input_file_motorola() -{ -} - - srecord::input_file_motorola::input_file_motorola( const std::string &a_file_name ) : - input_file(a_file_name), - data_count(0), - garbage_warning(false), - seen_some_input(false), - header_seen(false), - termination_seen(false), - address_shift(0) + input_file(a_file_name) { } diff --git a/srecord/input/file/motorola.h b/srecord/input/file/motorola.h index c201d5d0..388cb53e 100644 --- a/srecord/input/file/motorola.h +++ b/srecord/input/file/motorola.h @@ -34,7 +34,7 @@ class input_file_motorola: /** * The destructor. */ - virtual ~input_file_motorola(); + ~input_file_motorola() override = default; /** * The create class method is used to create new dynamically @@ -49,16 +49,16 @@ class input_file_motorola: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -73,7 +73,7 @@ class input_file_motorola: * The data_count instance variable is used to remember the number * of data lines has occurred so far in the input file. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The read_inner method is used to read a record of input. @@ -85,25 +85,25 @@ class input_file_motorola: * The garbage_warning instance variable is used to remember whether * or not a warning about garbage input lines has been issued yet. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember where * any data has been seen in this file yet. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The header_seen instance variable is used to remember whether * or not the header record has been seen yet. */ - bool header_seen; + bool header_seen{false}; /** * The termination_seen instance variable is used to remember * whether or not the termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; /** * The address_shift method is used to remember how far to the left @@ -117,22 +117,23 @@ class input_file_motorola: * the lines are jumbled just right, the first few lines are no * more enlightening). */ - unsigned address_shift; + unsigned address_shift{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_motorola(); + input_file_motorola() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_motorola(const input_file_motorola &); + input_file_motorola(const input_file_motorola &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_motorola &operator=(const input_file_motorola &); + input_file_motorola &operator=(const input_file_motorola &) = delete; }; }; diff --git a/srecord/input/file/msbin.cc b/srecord/input/file/msbin.cc index 536795e3..25a58857 100644 --- a/srecord/input/file/msbin.cc +++ b/srecord/input/file/msbin.cc @@ -58,15 +58,7 @@ srecord::input_file_msbin::~input_file_msbin() srecord::input_file_msbin::input_file_msbin(const std::string &a_file_name) : - input_file(a_file_name), - header_read(false), - first_record_read(false), - execution_start_record_seen(false), - last_record_warning(false), - address(0), - remaining(0), - record_checksum(0), - running_checksum(0) + input_file(a_file_name) { } diff --git a/srecord/input/file/msbin.h b/srecord/input/file/msbin.h index 596820b7..496da2d6 100644 --- a/srecord/input/file/msbin.h +++ b/srecord/input/file/msbin.h @@ -42,7 +42,7 @@ class input_file_msbin: /** * The destructor. */ - virtual ~input_file_msbin(); + ~input_file_msbin() override; /** * The create class method is used to create new dynamically @@ -57,13 +57,13 @@ class input_file_msbin: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -78,7 +78,7 @@ class input_file_msbin: * The header_read instance variable is used to remember whether * the file header was read already. */ - bool header_read; + bool header_read{false}; /** * The first_record_read instance variable is used to remember @@ -86,70 +86,70 @@ class input_file_msbin: * * While false, lowest_address and highest_address are not valid. */ - bool first_record_read; + bool first_record_read{false}; /** * The execution_start_record_seen instance variable is used to * remember whether we already read the execution start address * record, which is supposed to be the last record in a file. */ - bool execution_start_record_seen; + bool execution_start_record_seen{false}; /** * The last_record_warning instance variable is used to remember * whether a warning about extra records after the execution start * record was already issued. */ - bool last_record_warning; + bool last_record_warning{false}; /** * The address instance variable is used to remember the current * address. */ - record::address_t address; + record::address_t address{0}; /** * The remaining instance variable is used to remember the number * of bytes remaining in this record to be read. */ - uint32_t remaining; + uint32_t remaining{0}; /** * The record_checksum instance variable is used to remember the * checksum of the current record, as read from the record header. */ - uint32_t record_checksum; + uint32_t record_checksum{0}; /** * The running_checksum instance variable is used to remember the * checksum of the data read from this record so far. */ - uint32_t running_checksum; + uint32_t running_checksum{0}; /** * The image_start instance variable is used to remember the image * start, the lowest data address in the file, as read from the * file header. */ - record::address_t image_start; + record::address_t image_start{}; /** * The image_length instance variable is used to remember the image * length, as read from the file header. */ - record::address_t image_length; + record::address_t image_length{}; /** * The lowest_address instance variable is used to remember the * lowest address encountered in records read so far. */ - record::address_t lowest_address; + record::address_t lowest_address{}; /** * The highest_address instance variable is used to remember the * highest address encountered in records read so far. */ - record::address_t highest_address; + record::address_t highest_address{}; /** * The read_file_header method is used to read the (optional) magic @@ -182,22 +182,23 @@ class input_file_msbin: static uint32_t checksum(const unsigned char *data, size_t len); // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_msbin(); + input_file_msbin() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_msbin(const input_file_msbin &); + input_file_msbin(const input_file_msbin &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_msbin &operator=(const input_file_msbin &); + input_file_msbin &operator=(const input_file_msbin &) = delete; }; }; diff --git a/srecord/input/file/needham.cc b/srecord/input/file/needham.cc index 275eee3b..b0e344ec 100644 --- a/srecord/input/file/needham.cc +++ b/srecord/input/file/needham.cc @@ -23,17 +23,10 @@ #include -srecord::input_file_needham::~input_file_needham() -{ -} - - srecord::input_file_needham::input_file_needham( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - seen_some_input(false), - address(0) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/needham.h b/srecord/input/file/needham.h index 53847b95..fae3a97c 100644 --- a/srecord/input/file/needham.h +++ b/srecord/input/file/needham.h @@ -34,7 +34,7 @@ class input_file_needham: /** * The destructor. */ - virtual ~input_file_needham(); + ~input_file_needham() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_needham: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -67,24 +67,25 @@ class input_file_needham: input_file_needham(const std::string &file_name); bool read_inner(record &); - bool garbage_warning; - bool seen_some_input; - unsigned long address; + bool garbage_warning{}; + bool seen_some_input{false}; + unsigned long address{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_needham(); + input_file_needham() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_needham(const input_file_needham &); + input_file_needham(const input_file_needham &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_needham &operator=(const input_file_needham &); + input_file_needham &operator=(const input_file_needham &) = delete; }; }; diff --git a/srecord/input/file/os65v.cc b/srecord/input/file/os65v.cc index 06a46ba5..d7128c8c 100644 --- a/srecord/input/file/os65v.cc +++ b/srecord/input/file/os65v.cc @@ -21,17 +21,8 @@ #include -srecord::input_file_os65v::~input_file_os65v() -{ -} - - srecord::input_file_os65v::input_file_os65v(const std::string &a_file_name) : - srecord::input_file(a_file_name), - seen_some_input(false), - address(0), - state(0), - ignore_the_rest(false) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/os65v.h b/srecord/input/file/os65v.h index 9a83b34f..bd66c64a 100644 --- a/srecord/input/file/os65v.h +++ b/srecord/input/file/os65v.h @@ -35,7 +35,7 @@ class input_file_os65v: /** * The destructor. */ - virtual ~input_file_os65v(); + ~input_file_os65v() override = default; /** * The create class method is used to create new dynamically @@ -50,15 +50,15 @@ class input_file_os65v: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; -private: +public: /** * The constructor. * @@ -68,19 +68,19 @@ class input_file_os65v: input_file_os65v(const std::string &file_name); /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_os65v(); + input_file_os65v() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_os65v(const input_file_os65v &); + input_file_os65v(const input_file_os65v &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_os65v &operator=(const input_file_os65v &); + input_file_os65v &operator=(const input_file_os65v &) = delete; /** * The read_inner method is used by the read method to get @@ -92,26 +92,26 @@ class input_file_os65v: * The seen_some_input instance variable is used to remember whether * or not some valid input has been seen. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The address instance variable is used to remember the current * address. It is advanced for every byte read. */ - unsigned long address; + unsigned long address{0}; /** * The state instance variable is used to member the current input * state (unknown, address, data). */ - char state; + char state{0}; /** * The ignore_the_rest instance variable is used to remember when * it is time to ignore the rest of the file. This happens after a * "return to monitor" sequence, or after a "GO" command. */ - bool ignore_the_rest; + bool ignore_the_rest{false}; }; }; diff --git a/srecord/input/file/ppb.cc b/srecord/input/file/ppb.cc index 41729d2c..0dfd2811 100644 --- a/srecord/input/file/ppb.cc +++ b/srecord/input/file/ppb.cc @@ -23,18 +23,8 @@ #include -srecord::input_file_ppb::~input_file_ppb() -{ -} - - srecord::input_file_ppb::input_file_ppb(const std::string &filename) : - input_file(filename), - address(0), - data_seen(false), - packet_address(-1UL), - packet_length(0), - packet_used(0) + input_file(filename) { } diff --git a/srecord/input/file/ppb.h b/srecord/input/file/ppb.h index 94f1f238..29c45013 100644 --- a/srecord/input/file/ppb.h +++ b/srecord/input/file/ppb.h @@ -35,7 +35,7 @@ class input_file_ppb: /** * The destructor. */ - virtual ~input_file_ppb(); + ~input_file_ppb() override = default; /** * The create class method is used to create new dynamically @@ -48,16 +48,16 @@ class input_file_ppb: protected: // See base class for documentation. - bool read(class record &rec); + bool read(class record &rec) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -68,44 +68,29 @@ class input_file_ppb: */ input_file_ppb(const std::string &filename); - /** - * The address instance variable is used to remember the current - * address of the next data record. This is set and advanced by - * the #read method. - */ - record::address_t address; - - /** - * The data_seen instance variable is used to remember whether or - * not any data has been seen in the file. This is used to issue - * an error when there is apparently no data in the file, and this - * helps #guess to figure out the file is not of this type. - */ - bool data_seen; - /** * The packet_address instance variable is used to remember the * address of the first byte in the most recently read packet. */ - unsigned long packet_address; + unsigned long packet_address{-1UL}; /** * The packet instance variable is used to remember the most recent * #packet_length data bytes read from the file in the most recent packet. */ - record::data_t packet[65536]; + record::data_t packet[65536]{}; /** * The packet_length instance variable is used to remember the * number of data bytes in the #packet array. */ - size_t packet_length; + size_t packet_length{0}; /** * The packet_used instance variable is used to remember how many * bytes of the most recently read packet have been consumed. */ - size_t packet_used; + size_t packet_used{0}; /** * The get_packet method is used to read another packet, setting @@ -120,20 +105,21 @@ class input_file_ppb: */ void packet_format_error(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ppb(); + input_file_ppb() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ppb(const input_file_ppb &); + input_file_ppb(const input_file_ppb &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ppb &operator=(const input_file_ppb &); + input_file_ppb &operator=(const input_file_ppb &) = delete; }; }; diff --git a/srecord/input/file/ppx.cc b/srecord/input/file/ppx.cc index b0fb371c..0f8f5a45 100644 --- a/srecord/input/file/ppx.cc +++ b/srecord/input/file/ppx.cc @@ -23,20 +23,8 @@ #include -srecord::input_file_ppx::~input_file_ppx() -{ -} - - srecord::input_file_ppx::input_file_ppx(const std::string &filename) : - input_file(filename), - state(0), - token(token_eof), - token_value(0), - address(0), - data_seen(false), - dsum(0), - buffer_length(0) + input_file(filename) { } diff --git a/srecord/input/file/ppx.h b/srecord/input/file/ppx.h index 3d634aba..92bbb94b 100644 --- a/srecord/input/file/ppx.h +++ b/srecord/input/file/ppx.h @@ -35,7 +35,7 @@ class input_file_ppx: /** * The destructor. */ - virtual ~input_file_ppx(); + ~input_file_ppx() override = default; /** * The create class method is used to create new dynamically @@ -48,13 +48,13 @@ class input_file_ppx: protected: // See base class for documentation. - bool read(class record &rec); + bool read(class record &rec) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -70,7 +70,7 @@ class input_file_ppx: * processing state as the file is progressively parsed. The parse * is, of course, interrupted to return data records when they are seen. */ - int state; + int state{0}; enum token_t { @@ -86,14 +86,14 @@ class input_file_ppx: * The token instance variable is used to remember the kind of the * most recent token seen. Set by the #get_next_token method. */ - token_t token; + token_t token{token_eof}; /** * The token_value instance variable is used to remember the value * of the most recent token_byte or token_address seen. * Set by the #get_next_token method. */ - unsigned token_value; + unsigned token_value{0}; /** * The get_next_token method is used to read the next lexical token @@ -109,7 +109,7 @@ class input_file_ppx: * address of the next data record. This is set and advanced by * the #read method. */ - record::address_t address; + record::address_t address{0}; /** * The data_seen instance variable is used to remember whether or @@ -117,7 +117,7 @@ class input_file_ppx: * an error when there is apparently no data in the file, and this * helps #guess to figure out the file is not of this type. */ - bool data_seen; + bool data_seen{false}; /** * The syntax_error method is a convenience wrapper around @@ -129,34 +129,35 @@ class input_file_ppx: * The dsum instance variable is used to remember the simple sum of * the data bytes, and the data bytes alone. */ - unsigned short dsum; + unsigned short dsum{0}; /** * The buffer instance variable is used to remember the most recent * #buffer_length data bytes read from the file. */ - record::data_t buffer[record::max_data_length]; + record::data_t buffer[record::max_data_length]{}; /** * The buffer_length instance variable is used to remember the * number of data bytes in the #buffer array. */ - size_t buffer_length; + size_t buffer_length{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ppx(); + input_file_ppx() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ppx(const input_file_ppx &); + input_file_ppx(const input_file_ppx &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ppx &operator=(const input_file_ppx &); + input_file_ppx &operator=(const input_file_ppx &) = delete; }; }; diff --git a/srecord/input/file/signetics.cc b/srecord/input/file/signetics.cc index b0c0a919..3ae188cd 100644 --- a/srecord/input/file/signetics.cc +++ b/srecord/input/file/signetics.cc @@ -20,18 +20,10 @@ #include #include - -srecord::input_file_signetics::~input_file_signetics() -{ -} - - srecord::input_file_signetics::input_file_signetics( const std::string &a_filename ) : - srecord::input_file(a_filename), - garbage_warning(false), - seen_some_input(false) + srecord::input_file(a_filename) { } diff --git a/srecord/input/file/signetics.h b/srecord/input/file/signetics.h index f7089842..209f3a0e 100644 --- a/srecord/input/file/signetics.h +++ b/srecord/input/file/signetics.h @@ -34,7 +34,7 @@ class input_file_signetics: /** * The destructor. */ - virtual ~input_file_signetics(); + ~input_file_signetics() override = default; /** * The create class method is used to create new dynamically @@ -49,21 +49,21 @@ class input_file_signetics: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; /** * See base class for documentation. We over-ride this method * because signetics uses its own XOR-ROL checksum algorithm. */ - void checksum_add(unsigned char); + void checksum_add(unsigned char) override; -private: +public: /** * The constructor. The input will be read from the named file * (or the standard input if the filename is "-"). @@ -74,20 +74,21 @@ class input_file_signetics: input_file_signetics(const std::string &file_name); /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_signetics(); + input_file_signetics() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_signetics(const input_file_signetics &); + input_file_signetics(const input_file_signetics &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_signetics &operator=(const input_file_signetics &); + input_file_signetics &operator=(const input_file_signetics &) = delete; +private: /** * The read_inner method is used to read one line/record from * the input. Used by the `read' method. @@ -99,13 +100,13 @@ class input_file_signetics: * whether or not a warning has been issued about non-format * lines in the file. Only one warning per file is issued. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to * remember whether any input has been seen. */ - bool seen_some_input; + bool seen_some_input{false}; }; }; diff --git a/srecord/input/file/spasm.cc b/srecord/input/file/spasm.cc index 7147975d..2372fb0e 100644 --- a/srecord/input/file/spasm.cc +++ b/srecord/input/file/spasm.cc @@ -23,17 +23,11 @@ #include -srecord::input_file_spasm::~input_file_spasm() -{ -} - - srecord::input_file_spasm::input_file_spasm( const std::string &a_file_name, endian_t a_end ) : input_file(a_file_name), - seen_some_input(false), end(a_end) { } diff --git a/srecord/input/file/spasm.h b/srecord/input/file/spasm.h index b3b82e37..b599476b 100644 --- a/srecord/input/file/spasm.h +++ b/srecord/input/file/spasm.h @@ -35,7 +35,7 @@ class input_file_spasm: /** * The destructor. */ - virtual ~input_file_spasm(); + ~input_file_spasm() override = default; /** * The create_be class method is used to create new dynamically @@ -64,13 +64,13 @@ class input_file_spasm: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -93,7 +93,7 @@ class input_file_spasm: * The seen_some_input instance variable is used to remember whether * or not any data has been seen from this file to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The end instance variable is used to remember whether the @@ -101,20 +101,21 @@ class input_file_spasm: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_spasm(); + input_file_spasm() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_spasm(const input_file_spasm &); + input_file_spasm(const input_file_spasm &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_spasm &operator=(const input_file_spasm &); + input_file_spasm &operator=(const input_file_spasm &) = delete; }; }; diff --git a/srecord/input/file/spectrum.cc b/srecord/input/file/spectrum.cc index 1883e971..5338bc26 100644 --- a/srecord/input/file/spectrum.cc +++ b/srecord/input/file/spectrum.cc @@ -22,19 +22,10 @@ #include #include - -srecord::input_file_spectrum::~input_file_spectrum() -{ -} - - srecord::input_file_spectrum::input_file_spectrum( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - header_seen(false), - trailer_seen(false), - file_contains_data(false) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/spectrum.h b/srecord/input/file/spectrum.h index d6e9b11b..9f80d6a5 100644 --- a/srecord/input/file/spectrum.h +++ b/srecord/input/file/spectrum.h @@ -34,7 +34,7 @@ class input_file_spectrum: /** * The destructor. */ - virtual ~input_file_spectrum(); + ~input_file_spectrum() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_spectrum: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -70,19 +70,19 @@ class input_file_spectrum: * The header_seen instance variable is used to remember whether * the file header (the start character STX=0x02) has been seen yet. */ - bool header_seen; + bool header_seen{false}; /** * The trailer_seen instance variable is used to remember whether * the file trailer (the end character ETX=0x03) has been seen yet. */ - bool trailer_seen; + bool trailer_seen{false}; /** * The file_contains_data instance variable is used to remember * whether any file data has been seen yet. */ - bool file_contains_data; + bool file_contains_data{false}; /** * The get_decimal method is used to get a decimal number from @@ -96,20 +96,21 @@ class input_file_spectrum: */ int get_binary(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_spectrum(); + input_file_spectrum() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_spectrum(const input_file_spectrum &); + input_file_spectrum(const input_file_spectrum &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_spectrum &operator=(const input_file_spectrum &); + input_file_spectrum &operator=(const input_file_spectrum &) = delete; }; }; diff --git a/srecord/input/file/stewie.cc b/srecord/input/file/stewie.cc index 13c61417..274d3a1c 100644 --- a/srecord/input/file/stewie.cc +++ b/srecord/input/file/stewie.cc @@ -21,18 +21,8 @@ #include -srecord::input_file_stewie::~input_file_stewie() -{ -} - - srecord::input_file_stewie::input_file_stewie(const std::string &a_file_name) : - input_file(a_file_name), - data_count(0), - garbage_warning(false), - seen_some_input(false), - header_seen(false), - termination_seen(false) + input_file(a_file_name) { } diff --git a/srecord/input/file/stewie.h b/srecord/input/file/stewie.h index c96eda74..6ff095a3 100644 --- a/srecord/input/file/stewie.h +++ b/srecord/input/file/stewie.h @@ -35,7 +35,7 @@ class input_file_stewie: /** * The destructor. */ - virtual ~input_file_stewie(); + ~input_file_stewie() override = default; /** * The create class method is used to create new dynamically @@ -50,19 +50,19 @@ class input_file_stewie: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int get_byte(); + int get_byte() override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -77,7 +77,7 @@ class input_file_stewie: * The data_count instance variable is used to remember the number * of data lines has occurred so far in the input file. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The read_inner method is used to read a record of input. @@ -89,40 +89,41 @@ class input_file_stewie: * The garbage_warning instance variable is used to remember whether * or not a warning about garbage input lines has been issued yet. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember where * any data has been seen in this file yet. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The header_seen instance variable is used to remember whether * or not the header record has been seen yet. */ - bool header_seen; + bool header_seen{false}; /** * The termination_seen instance variable is used to remember * whether or not the termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_stewie(); + input_file_stewie() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_stewie(const input_file_stewie &); + input_file_stewie(const input_file_stewie &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_stewie &operator=(const input_file_stewie &); + input_file_stewie &operator=(const input_file_stewie &) = delete; }; }; diff --git a/srecord/input/file/tektronix.cc b/srecord/input/file/tektronix.cc index 4e209197..52437d72 100644 --- a/srecord/input/file/tektronix.cc +++ b/srecord/input/file/tektronix.cc @@ -20,21 +20,10 @@ #include #include - -srecord::input_file_tektronix::~input_file_tektronix() -{ - // make sure the termination record is done -} - - srecord::input_file_tektronix::input_file_tektronix( const std::string &a_filename ) : - srecord::input_file(a_filename), - data_record_count(0), - garbage_warning(false), - seen_some_input(false), - termination_seen(false) + srecord::input_file(a_filename) { } diff --git a/srecord/input/file/tektronix.h b/srecord/input/file/tektronix.h index 2fbb6675..036d4ffc 100644 --- a/srecord/input/file/tektronix.h +++ b/srecord/input/file/tektronix.h @@ -34,7 +34,7 @@ class input_file_tektronix: /** * The destructor. */ - virtual ~input_file_tektronix(); + ~input_file_tektronix() = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_tektronix: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -71,14 +71,14 @@ class input_file_tektronix: * We override the one in the base class because the checksum is * nibble-based, not byte-based. */ - int get_nibble(); + int get_nibble() override; /** * The get_byte method gets a two hex-digit from input and assembles * them (big-endian) into a byte. We override the one in the base * class because the checksum is nibble-based, not byte-based. */ - int get_byte(); + int get_byte() override; /** * The read_inner method is used to read a single record from @@ -90,40 +90,41 @@ class input_file_tektronix: * The data_record_count instance variable is used to remember the * number of data records seen so far. */ - int data_record_count; + int data_record_count{0}; /** * The garbage_warning instance variable is used to remember whether * a warning about input line containing garbage has been issued yet. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * the file contains any data so far. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The termination_seen instance variable is used to remember * whether the termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_tektronix(); + input_file_tektronix() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_tektronix(const input_file_tektronix &); + input_file_tektronix(const input_file_tektronix &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_tektronix &operator=(const input_file_tektronix &); + input_file_tektronix &operator=(const input_file_tektronix &) = delete; }; }; diff --git a/srecord/input/file/tektronix_extended.cc b/srecord/input/file/tektronix_extended.cc index 56b48649..97e20fef 100644 --- a/srecord/input/file/tektronix_extended.cc +++ b/srecord/input/file/tektronix_extended.cc @@ -20,20 +20,11 @@ #include #include - -srecord::input_file_tektronix_extended::~input_file_tektronix_extended() -{ -} - - srecord::input_file_tektronix_extended::input_file_tektronix_extended( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - garbage_warning(false), - seen_some_input(false), - termination_seen(false), - nibble_sum(0) + srecord::input_file(a_file_name) + { } diff --git a/srecord/input/file/tektronix_extended.h b/srecord/input/file/tektronix_extended.h index 018908c5..63309290 100644 --- a/srecord/input/file/tektronix_extended.h +++ b/srecord/input/file/tektronix_extended.h @@ -37,7 +37,7 @@ class input_file_tektronix_extended: /** * The destructor. */ - virtual ~input_file_tektronix_extended(); + ~input_file_tektronix_extended() override = default; /** * The create class method is used to create new dynamically @@ -52,16 +52,16 @@ class input_file_tektronix_extended: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; // See base class for documentation. - int get_nibble(); + int get_nibble() override; private: /** @@ -76,7 +76,7 @@ class input_file_tektronix_extended: * The data_record_count instance variable is used to remember the * number of data records seen in the input so far. */ - int data_record_count; + int data_record_count{}; /** * The read_inner method is used to read a record of input. @@ -89,47 +89,43 @@ class input_file_tektronix_extended: * whether or not a warning about garbage line in the input has * been issued yet. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * any data has been seen in this file yet. */ - bool seen_some_input; - - /** - * The header_seen instance variable is used to remember whether - * the header record has been seen yet. - */ - bool header_seen; + bool seen_some_input{false}; /** * The termination_seen instance variable is used to remember * whether the termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; /** * The nibble_sum instance variable is usd to remember the running * checksum, of each nibble on the record line. */ - unsigned char nibble_sum; + unsigned char nibble_sum{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_tektronix_extended(); + input_file_tektronix_extended() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_tektronix_extended(const input_file_tektronix_extended &); + input_file_tektronix_extended( + const input_file_tektronix_extended &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_file_tektronix_extended &operator=( - const input_file_tektronix_extended &); + const input_file_tektronix_extended &) = delete; }; }; diff --git a/srecord/input/file/ti_tagged.cc b/srecord/input/file/ti_tagged.cc index 2d7f59c5..cde2e9d4 100644 --- a/srecord/input/file/ti_tagged.cc +++ b/srecord/input/file/ti_tagged.cc @@ -23,17 +23,10 @@ #include -srecord::input_file_ti_tagged::~input_file_ti_tagged() -{ -} - - srecord::input_file_ti_tagged::input_file_ti_tagged( const std::string &a_filename ) : - input_file(a_filename), - address(0), - csum(0) + input_file(a_filename) { } diff --git a/srecord/input/file/ti_tagged.h b/srecord/input/file/ti_tagged.h index a39ce47a..6c9ebb85 100644 --- a/srecord/input/file/ti_tagged.h +++ b/srecord/input/file/ti_tagged.h @@ -34,7 +34,7 @@ class input_file_ti_tagged: /** * The destructor. */ - virtual ~input_file_ti_tagged(); + ~input_file_ti_tagged() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_ti_tagged: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -71,7 +71,7 @@ class input_file_ti_tagged: * We override bacsie the checksum is character based, not byte * based. */ - int get_char(); + int get_char() override; typedef input_file inherited; @@ -85,28 +85,29 @@ class input_file_ti_tagged: * The address instance variable is used to remember where we are * up to in the input file. */ - unsigned long address; + unsigned long address{0}; /** * The csum instance variable is used to remember the running * checksum. */ - int csum; + int csum{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ti_tagged(); + input_file_ti_tagged() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ti_tagged(const input_file_ti_tagged &); + input_file_ti_tagged(const input_file_ti_tagged &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ti_tagged &operator=(const input_file_ti_tagged &); + input_file_ti_tagged &operator=(const input_file_ti_tagged &) = delete; }; }; diff --git a/srecord/input/file/ti_tagged_16.cc b/srecord/input/file/ti_tagged_16.cc index ea4b0510..dfce42aa 100644 --- a/srecord/input/file/ti_tagged_16.cc +++ b/srecord/input/file/ti_tagged_16.cc @@ -22,18 +22,10 @@ #include #include - -srecord::input_file_ti_tagged_16::~input_file_ti_tagged_16() -{ -} - - srecord::input_file_ti_tagged_16::input_file_ti_tagged_16( const std::string &a_file_name ) : - input_file(a_file_name), - address(0), - csum(0) + input_file(a_file_name) { } diff --git a/srecord/input/file/ti_tagged_16.h b/srecord/input/file/ti_tagged_16.h index b0936e6d..0d9b807d 100644 --- a/srecord/input/file/ti_tagged_16.h +++ b/srecord/input/file/ti_tagged_16.h @@ -34,7 +34,7 @@ class input_file_ti_tagged_16: /** * The destructor. */ - virtual ~input_file_ti_tagged_16(); + ~input_file_ti_tagged_16() override = default; /** * The create class method is used to create new dynamically @@ -49,20 +49,20 @@ class input_file_ti_tagged_16: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; /** * The get_char method is used to get a character from the input. * We override because the checksum is character based, not byte * based. */ - int get_char(); + int get_char() override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -85,28 +85,30 @@ class input_file_ti_tagged_16: * The address instance variable is used to remember where we are * up to in the input file. */ - unsigned long address; + unsigned long address{0}; /** * The csum instance variable is used to remember the running * checksum. */ - int csum; + int csum{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ti_tagged_16(); + input_file_ti_tagged_16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ti_tagged_16(const input_file_ti_tagged_16 &); + input_file_ti_tagged_16(const input_file_ti_tagged_16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ti_tagged_16 &operator=(const input_file_ti_tagged_16 &); + input_file_ti_tagged_16 &operator=( + const input_file_ti_tagged_16 &) = delete; }; }; diff --git a/srecord/input/file/ti_txt.cc b/srecord/input/file/ti_txt.cc index 48532778..aac6f70a 100644 --- a/srecord/input/file/ti_txt.cc +++ b/srecord/input/file/ti_txt.cc @@ -22,19 +22,8 @@ #include #include - -srecord::input_file_ti_txt::~input_file_ti_txt() -{ -} - - srecord::input_file_ti_txt::input_file_ti_txt(const std::string &a_file_name) : - input_file(a_file_name), - seen_some_input(false), - address(0), - token(token_start_up), - token_value(0), - address_warning(false) + input_file(a_file_name) { } diff --git a/srecord/input/file/ti_txt.h b/srecord/input/file/ti_txt.h index cabbe21c..16261326 100644 --- a/srecord/input/file/ti_txt.h +++ b/srecord/input/file/ti_txt.h @@ -34,7 +34,7 @@ class input_file_ti_txt: /** * The destructor. */ - virtual ~input_file_ti_txt(); + ~input_file_ti_txt() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_ti_txt: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -66,23 +66,17 @@ class input_file_ti_txt: */ input_file_ti_txt(const std::string &file_name); - /** - * The garbage_warning instance variable is used to remember whether - * a warning has already been issued if the file contains garbage. - */ - bool garbage_warning; - /** * The seen_some_input instance variable is used to remember whether * any data has been seen in the input to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The address instance variable is used to remember where we are * up to in the input file, so it may be associated with data bytes. */ - unsigned long address; + unsigned long address{0}; enum token_t { @@ -98,21 +92,21 @@ class input_file_ti_txt: * the token instance variable is used to remember the type of the * most recent token, as determined by the get_next_token method. */ - token_t token; + token_t token{token_start_up}; /** * the token_value instance variable is used to remember the value * of the most recent token, as determined by the get_next_token * method. Only meaningful for token_number, zero otherwise. */ - unsigned long token_value; + unsigned long token_value{0}; /** * The address_warning instance variable is used to remember * whether or not we have already warned about addresses which are * too large. */ - bool address_warning; + bool address_warning{false}; /** * The get_next_token method is used to partition the input into @@ -121,20 +115,21 @@ class input_file_ti_txt: */ void get_next_token(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_ti_txt(); + input_file_ti_txt() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_ti_txt(const input_file_ti_txt &); + input_file_ti_txt(const input_file_ti_txt &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_ti_txt &operator=(const input_file_ti_txt &); + input_file_ti_txt &operator=(const input_file_ti_txt &) = delete; }; }; diff --git a/srecord/input/file/trs80.cc b/srecord/input/file/trs80.cc index 24b14423..7bfda345 100644 --- a/srecord/input/file/trs80.cc +++ b/srecord/input/file/trs80.cc @@ -37,10 +37,8 @@ srecord::input_file_trs80::~input_file_trs80() srecord::input_file_trs80::input_file_trs80( const std::string &a_file_name ) : - srecord::input_file(a_file_name), - termination_seen(false), - data_seen(false), - pending(0) + srecord::input_file(a_file_name) + { } diff --git a/srecord/input/file/trs80.h b/srecord/input/file/trs80.h index 9f64b923..c540cfa8 100644 --- a/srecord/input/file/trs80.h +++ b/srecord/input/file/trs80.h @@ -38,7 +38,7 @@ class input_file_trs80: /** * The destructor. */ - virtual ~input_file_trs80(); + ~input_file_trs80() override; /** * The create class method is used to create new dynamically @@ -53,29 +53,29 @@ class input_file_trs80: protected: // See base class for documentation. - bool read(record &result); + bool read(record &result) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** * The termination_seen instance variable is used to remember * whether or not a termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; /** * The data_seen instance variable is used to remember * whether or not a data record has been seen yet. */ - bool data_seen; + bool data_seen{false}; /** * A constructor. The input is read from the named file (or @@ -91,23 +91,24 @@ class input_file_trs80: * update the checksum. We over-ride the base implementation, * because we use raw bytes rather than two hex digits. */ - int get_byte(); + int get_byte() override; /** * The pending instance variable is used to remember the second * half of large data packets, in the case where they must be split. */ - record *pending; + record *pending{0}; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_trs80(const input_file_trs80 &); + input_file_trs80(const input_file_trs80 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_trs80 &operator=(const input_file_trs80 &); + input_file_trs80 &operator=(const input_file_trs80 &) = delete; }; }; diff --git a/srecord/input/file/vmem.cc b/srecord/input/file/vmem.cc index adc6c168..48609824 100644 --- a/srecord/input/file/vmem.cc +++ b/srecord/input/file/vmem.cc @@ -23,15 +23,8 @@ #include -srecord::input_file_vmem::~input_file_vmem() -{ -} - - srecord::input_file_vmem::input_file_vmem(const std::string &a_file_name) : - srecord::input_file(a_file_name), - seen_some_input(false), - address(0) + srecord::input_file(a_file_name) { } diff --git a/srecord/input/file/vmem.h b/srecord/input/file/vmem.h index e9bba765..f1b39e12 100644 --- a/srecord/input/file/vmem.h +++ b/srecord/input/file/vmem.h @@ -34,7 +34,7 @@ class input_file_vmem: /** * The destructor. */ - virtual ~input_file_vmem(); + ~input_file_vmem() override = default; /** * The create class method is used to create new dynamically @@ -49,13 +49,13 @@ class input_file_vmem: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; private: /** @@ -70,28 +70,29 @@ class input_file_vmem: * The seen_some_input instance variable is used to remember whether * any data has been seen in the input to date. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The address instance variable is used to remember where we are * up to in the input file, so it may be associated with data bytes. */ - unsigned long address; + unsigned long address{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_file_vmem(); + input_file_vmem() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_file_vmem(const input_file_vmem &); + input_file_vmem(const input_file_vmem &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_file_vmem &operator=(const input_file_vmem &); + input_file_vmem &operator=(const input_file_vmem &) = delete; }; }; diff --git a/srecord/input/file/wilson.cc b/srecord/input/file/wilson.cc index 00a222e2..027bc5a5 100644 --- a/srecord/input/file/wilson.cc +++ b/srecord/input/file/wilson.cc @@ -21,16 +21,8 @@ #include -srecord::input_file_wilson::~input_file_wilson() -{ -} - - srecord::input_file_wilson::input_file_wilson(const std::string &a_file_name) : - input_file(a_file_name), - garbage_warning(false), - seen_some_input(false), - termination_seen(false) + input_file(a_file_name) { } diff --git a/srecord/input/file/wilson.h b/srecord/input/file/wilson.h index 0a58e3b9..d0f5f1d2 100644 --- a/srecord/input/file/wilson.h +++ b/srecord/input/file/wilson.h @@ -36,7 +36,7 @@ class input_file_wilson: /** * The destructor. */ - virtual ~input_file_wilson(); + ~input_file_wilson() override = default; /** * The create class method is used to create new dynamically @@ -51,23 +51,23 @@ class input_file_wilson: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; // See base class for documentation. - int format_option_number() const; + int format_option_number() const override; /** * The get_byte method is used to get a byte of input. We override * because the byte encoding is one character of input sometimes, * and two characters of input at other times. */ - virtual int get_byte(); + int get_byte() override; private: /** @@ -88,34 +88,46 @@ class input_file_wilson: * The garbage_warning instance variable is used to remember whether * a warning about garbage input has been issued yet. */ - bool garbage_warning; + bool garbage_warning{false}; /** * The seen_some_input instance variable is used to remember whether * this file contains any data so far. */ - bool seen_some_input; + bool seen_some_input{false}; /** * The termination_seen instance variable is used to remember * whether the termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; + +public: + /** + * The default constructor. + */ + input_file_wilson() = delete; /** - * The default constructor. Do not use. + * The copy constructor. */ - input_file_wilson(); + input_file_wilson(const input_file_wilson &) = delete; /** - * The copy constructor. Do not use. + * The assignment operator. */ - input_file_wilson(const input_file_wilson &); + input_file_wilson &operator=(const input_file_wilson &) = delete; /** - * The assignment operator. Do not use. + * The move constructor */ - input_file_wilson &operator=(const input_file_wilson &); + input_file_wilson ( input_file_wilson && ) = delete; + + /** + * The move assignment operator + */ + input_file_wilson& operator=(input_file_wilson&&) = delete; + }; }; diff --git a/srecord/input/filter.cc b/srecord/input/filter.cc index 2216dfc2..b53b5ee2 100644 --- a/srecord/input/filter.cc +++ b/srecord/input/filter.cc @@ -20,11 +20,6 @@ #include -srecord::input_filter::~input_filter() -{ -} - - srecord::input_filter::input_filter(srecord::input::pointer arg) : ifp(arg) { diff --git a/srecord/input/filter.h b/srecord/input/filter.h index 4e5740b6..60b654dd 100644 --- a/srecord/input/filter.h +++ b/srecord/input/filter.h @@ -39,22 +39,22 @@ class input_filter: /** * The destructor. */ - virtual ~input_filter(); + ~input_filter() override = default; // See base class for documentation. - bool read(class record &record); + bool read(class record &record) override; // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - std::string filename_and_line() const; + std::string filename_and_line() const override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - void disable_checksum_validation(); + void disable_checksum_validation() override; protected: /** @@ -72,21 +72,21 @@ class input_filter: // pointer ifp; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter(); + input_filter() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter(const input_filter &); + input_filter(const input_filter &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter &operator=(const input_filter &); + input_filter &operator=(const input_filter &) = delete; }; }; diff --git a/srecord/input/filter/and.cc b/srecord/input/filter/and.cc index a02a2de5..1a959e74 100644 --- a/srecord/input/filter/and.cc +++ b/srecord/input/filter/and.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_and::~input_filter_and() -{ -} - - srecord::input_filter_and::input_filter_and(const input::pointer &a1, int a2) : input_filter(a1), diff --git a/srecord/input/filter/and.h b/srecord/input/filter/and.h index 9c79586b..676017f8 100644 --- a/srecord/input/filter/and.h +++ b/srecord/input/filter/and.h @@ -36,7 +36,7 @@ class input_filter_and: /** * The destructor. */ - virtual ~input_filter_and(); + ~input_filter_and() override = default; private: /** @@ -63,7 +63,7 @@ class input_filter_and: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -72,20 +72,21 @@ class input_filter_and: */ int value; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_and(); + input_filter_and() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_and(const input_filter_and &); + input_filter_and(const input_filter_and &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_and &operator=(const input_filter_and &); + input_filter_and &operator=(const input_filter_and &) = delete; }; }; diff --git a/srecord/input/filter/bitrev.cc b/srecord/input/filter/bitrev.cc index f1704ba5..7fef722c 100644 --- a/srecord/input/filter/bitrev.cc +++ b/srecord/input/filter/bitrev.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_bitrev::~input_filter_bitrev() -{ -} - - srecord::input_filter_bitrev::input_filter_bitrev( const srecord::input::pointer &arg ) : diff --git a/srecord/input/filter/bitrev.h b/srecord/input/filter/bitrev.h index 687f8783..4d5a3cdc 100644 --- a/srecord/input/filter/bitrev.h +++ b/srecord/input/filter/bitrev.h @@ -34,7 +34,7 @@ class input_filter_bitrev: /** * The destructor. */ - virtual ~input_filter_bitrev(); + ~input_filter_bitrev() override = default; private: /** @@ -57,23 +57,23 @@ class input_filter_bitrev: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_bitrev(); + input_filter_bitrev() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_bitrev(const input_filter_bitrev &); + input_filter_bitrev(const input_filter_bitrev &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_bitrev &operator=(const input_filter_bitrev &); + input_filter_bitrev &operator=(const input_filter_bitrev &) = delete; }; }; diff --git a/srecord/input/filter/byte_swap.cc b/srecord/input/filter/byte_swap.cc index 5d7e7bc8..b89bafad 100644 --- a/srecord/input/filter/byte_swap.cc +++ b/srecord/input/filter/byte_swap.cc @@ -22,17 +22,9 @@ #include -srecord::input_filter_byte_swap::~input_filter_byte_swap() -{ -} - - srecord::input_filter_byte_swap::input_filter_byte_swap( const srecord::input::pointer &arg) : - srecord::input_filter(arg), - buffer(), - buffer_pos(0), - mask(1) + srecord::input_filter(arg) { } diff --git a/srecord/input/filter/byte_swap.h b/srecord/input/filter/byte_swap.h index e57b6799..4007c08d 100644 --- a/srecord/input/filter/byte_swap.h +++ b/srecord/input/filter/byte_swap.h @@ -36,7 +36,7 @@ class input_filter_byte_swap: /** * The destructor. */ - virtual ~input_filter_byte_swap(); + ~input_filter_byte_swap() override = default; private: /** @@ -59,10 +59,10 @@ class input_filter_byte_swap: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; private: /** @@ -75,29 +75,30 @@ class input_filter_byte_swap: * The buffer_pos instance variable is used to remember the byte * position within the buffer instance variable. */ - size_t buffer_pos; + size_t buffer_pos{0}; /** * The mask instance variable is used to remember the bit mask to * be xor-ed with the address to form the byte-swapped address. * It defaults to 1, but can be altered by command line option. */ - record::address_t mask; + record::address_t mask{1}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_byte_swap(); + input_filter_byte_swap() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_byte_swap(const input_filter_byte_swap &); + input_filter_byte_swap(const input_filter_byte_swap &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_byte_swap &operator=(const input_filter_byte_swap &); + input_filter_byte_swap &operator=(const input_filter_byte_swap &) = delete; }; }; diff --git a/srecord/input/filter/checksum.cc b/srecord/input/filter/checksum.cc index 6bd6b9ad..7303cd44 100644 --- a/srecord/input/filter/checksum.cc +++ b/srecord/input/filter/checksum.cc @@ -33,7 +33,6 @@ srecord::input_filter_checksum::input_filter_checksum( checksum_address(a_checksum_address), length(a_length), end(a_end), - sum(0), width(a_width) { if (length < 0) @@ -47,11 +46,6 @@ srecord::input_filter_checksum::input_filter_checksum( } -srecord::input_filter_checksum::~input_filter_checksum() -{ -} - - bool srecord::input_filter_checksum::generate(record &result) { diff --git a/srecord/input/filter/checksum.h b/srecord/input/filter/checksum.h index c3dad8ad..8b2bba2e 100644 --- a/srecord/input/filter/checksum.h +++ b/srecord/input/filter/checksum.h @@ -39,11 +39,11 @@ class input_filter_checksum: /** * The destructor. */ - virtual ~input_filter_checksum(); + ~input_filter_checksum() override = default; protected: // See bas class for documentation. - bool read(record &record); + bool read(record &record) override; /** * The constructor. @@ -90,7 +90,7 @@ class input_filter_checksum: * The sum instance variable is used to remember the running * checksum of the incoming data source. */ - sum_t sum; + sum_t sum{0}; /** * The width instance variable is used to remember the swathe width @@ -117,21 +117,21 @@ class input_filter_checksum: */ bool generate(record &record); -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_checksum(); + input_filter_checksum() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_checksum(const input_filter_checksum &); + input_filter_checksum(const input_filter_checksum &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_checksum &operator=(const input_filter_checksum &); + input_filter_checksum &operator=(const input_filter_checksum &) = delete; }; }; diff --git a/srecord/input/filter/checksum/bitnot.cc b/srecord/input/filter/checksum/bitnot.cc index dfa8c00a..435d95fb 100644 --- a/srecord/input/filter/checksum/bitnot.cc +++ b/srecord/input/filter/checksum/bitnot.cc @@ -20,12 +20,6 @@ #include - -srecord::input_filter_checksum_bitnot::~input_filter_checksum_bitnot() -{ -} - - srecord::input_filter_checksum_bitnot::input_filter_checksum_bitnot( input::pointer a1, int a2, int a3, endian_t a_end, int a5) : input_filter_checksum(a1, a2, a3, a_end, a5) diff --git a/srecord/input/filter/checksum/bitnot.h b/srecord/input/filter/checksum/bitnot.h index e95a70d8..a999bd21 100644 --- a/srecord/input/filter/checksum/bitnot.h +++ b/srecord/input/filter/checksum/bitnot.h @@ -35,7 +35,7 @@ class input_filter_checksum_bitnot: /** * The destructor. */ - virtual ~input_filter_checksum_bitnot(); + ~input_filter_checksum_bitnot() override = default; private: /** @@ -82,25 +82,25 @@ class input_filter_checksum_bitnot: protected: // See base class for documentation. - sum_t calculate(); + sum_t calculate() override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_checksum_bitnot(); + input_filter_checksum_bitnot() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_checksum_bitnot(const input_filter_checksum_bitnot &); + input_filter_checksum_bitnot(const input_filter_checksum_bitnot &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_checksum_bitnot &operator=( - const input_filter_checksum_bitnot &); + const input_filter_checksum_bitnot &) = delete; }; }; diff --git a/srecord/input/filter/checksum/negative.cc b/srecord/input/filter/checksum/negative.cc index 03031dfb..396c3e7a 100644 --- a/srecord/input/filter/checksum/negative.cc +++ b/srecord/input/filter/checksum/negative.cc @@ -20,11 +20,6 @@ #include -srecord::input_filter_checksum_negative::~input_filter_checksum_negative() -{ -} - - srecord::input_filter_checksum_negative::input_filter_checksum_negative( const input::pointer &a1, int a2, int a3, endian_t a_end, int a5) : input_filter_checksum(a1, a2, a3, a_end, a5) diff --git a/srecord/input/filter/checksum/negative.h b/srecord/input/filter/checksum/negative.h index 4042787a..2c5c0c1e 100644 --- a/srecord/input/filter/checksum/negative.h +++ b/srecord/input/filter/checksum/negative.h @@ -35,7 +35,7 @@ class input_filter_checksum_negative: /** * The destructor. */ - virtual ~input_filter_checksum_negative(); + ~input_filter_checksum_negative() override = default; private: /** @@ -82,24 +82,25 @@ class input_filter_checksum_negative: protected: // See base class for document. - sum_t calculate(); + sum_t calculate() override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_checksum_negative(); + input_filter_checksum_negative() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_checksum_negative(const input_filter_checksum_negative &); + input_filter_checksum_negative(\ + const input_filter_checksum_negative &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_checksum_negative &operator=( - const input_filter_checksum_negative &); + const input_filter_checksum_negative &) = delete; }; }; diff --git a/srecord/input/filter/checksum/positive.cc b/srecord/input/filter/checksum/positive.cc index 37cb262f..c1a781f9 100644 --- a/srecord/input/filter/checksum/positive.cc +++ b/srecord/input/filter/checksum/positive.cc @@ -20,11 +20,6 @@ #include -srecord::input_filter_checksum_positive::~input_filter_checksum_positive() -{ -} - - srecord::input_filter_checksum_positive::input_filter_checksum_positive( const input::pointer &a1, int a2, int a3, endian_t a_end, int a5) : input_filter_checksum(a1, a2, a3, a_end, a5) diff --git a/srecord/input/filter/checksum/positive.h b/srecord/input/filter/checksum/positive.h index 196a7365..2288e29c 100644 --- a/srecord/input/filter/checksum/positive.h +++ b/srecord/input/filter/checksum/positive.h @@ -35,7 +35,7 @@ class input_filter_checksum_positive: /** * The destructor. */ - virtual ~input_filter_checksum_positive(); + ~input_filter_checksum_positive() override = default; private: /** @@ -82,24 +82,25 @@ class input_filter_checksum_positive: protected: // See base class for documentation. - sum_t calculate(); + sum_t calculate() override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_checksum_positive(); + input_filter_checksum_positive() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_checksum_positive(const input_filter_checksum_positive &); + input_filter_checksum_positive( + const input_filter_checksum_positive &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_checksum_positive &operator=( - const input_filter_checksum_positive &); + const input_filter_checksum_positive &) = delete; }; }; diff --git a/srecord/input/filter/crop.cc b/srecord/input/filter/crop.cc index 6b4d9c00..53002d47 100644 --- a/srecord/input/filter/crop.cc +++ b/srecord/input/filter/crop.cc @@ -22,17 +22,11 @@ #include -srecord::input_filter_crop::~input_filter_crop() -{ -} - - srecord::input_filter_crop::input_filter_crop( const srecord::input::pointer &a_deeper, const interval &a_range) : srecord::input_filter(a_deeper), - range(a_range), - data(), - data_range() + range(a_range) + { } diff --git a/srecord/input/filter/crop.h b/srecord/input/filter/crop.h index 98d70977..f03c6714 100644 --- a/srecord/input/filter/crop.h +++ b/srecord/input/filter/crop.h @@ -37,7 +37,7 @@ class input_filter_crop: /** * The destructor. */ - virtual ~input_filter_crop(); + ~input_filter_crop() override = default; private: /** @@ -66,7 +66,7 @@ class input_filter_crop: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -87,20 +87,21 @@ class input_filter_crop: */ interval data_range; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_crop(); + input_filter_crop() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_crop(const input_filter_crop &); + input_filter_crop(const input_filter_crop &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_crop &operator=(const input_filter_crop &); + input_filter_crop &operator=(const input_filter_crop &) = delete; }; }; diff --git a/srecord/input/filter/fill.cc b/srecord/input/filter/fill.cc index 1cf47176..6a02a516 100644 --- a/srecord/input/filter/fill.cc +++ b/srecord/input/filter/fill.cc @@ -35,7 +35,6 @@ srecord::input_filter_fill::input_filter_fill(const input::pointer &a1, int a2, const interval &a3) : input_filter(a1), filler_value(a2), - filler_block(0), range(a3) { } diff --git a/srecord/input/filter/fill.h b/srecord/input/filter/fill.h index a2a24f28..175fcf9b 100644 --- a/srecord/input/filter/fill.h +++ b/srecord/input/filter/fill.h @@ -37,7 +37,7 @@ class input_filter_fill: /** * The destructor. */ - virtual ~input_filter_fill(); + ~input_filter_fill() override; private: /** @@ -70,7 +70,7 @@ class input_filter_fill: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -84,7 +84,7 @@ class input_filter_fill: * of a dynamically allocated array of bytes, used to construct * filler block records. */ - unsigned char *filler_block; + unsigned char *filler_block{nullptr}; /** * The range instance variable is used to remember the range of @@ -98,20 +98,21 @@ class input_filter_fill: */ bool generate(record &record); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_fill(); + input_filter_fill() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_fill(const input_filter_fill &); + input_filter_fill(const input_filter_fill &) = delete; /** - * The assignment. Do not use. + * The assignment. */ - input_filter_fill &operator=(const input_filter_fill &); + input_filter_fill &operator=(const input_filter_fill &) = delete; }; }; diff --git a/srecord/input/filter/interval.cc b/srecord/input/filter/interval.cc index c103148d..d0351b48 100644 --- a/srecord/input/filter/interval.cc +++ b/srecord/input/filter/interval.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_interval::~input_filter_interval() -{ -} - - srecord::input_filter_interval::input_filter_interval( const input::pointer &a_deeper, long a_address, diff --git a/srecord/input/filter/interval.h b/srecord/input/filter/interval.h index 47e67dd5..e66f6620 100644 --- a/srecord/input/filter/interval.h +++ b/srecord/input/filter/interval.h @@ -37,7 +37,7 @@ class input_filter_interval: /** * The destructor. */ - virtual ~input_filter_interval(); + ~input_filter_interval() override = default; protected: /** @@ -71,7 +71,7 @@ class input_filter_interval: const interval &get_range() const { return range; } // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -110,20 +110,21 @@ class input_filter_interval: */ bool generate(record &record); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_interval(); + input_filter_interval() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_interval(const input_filter_interval &); + input_filter_interval(const input_filter_interval &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_interval &operator=(const input_filter_interval &); + input_filter_interval &operator=(const input_filter_interval &) = delete; }; }; diff --git a/srecord/input/filter/interval/length.cc b/srecord/input/filter/interval/length.cc index 2000b7a1..cc4513d6 100644 --- a/srecord/input/filter/interval/length.cc +++ b/srecord/input/filter/interval/length.cc @@ -19,12 +19,6 @@ #include - -srecord::input_filter_interval_length::~input_filter_interval_length() -{ -} - - srecord::input_filter_interval_length::input_filter_interval_length( const pointer &a_deeper, long a_address, int a_length, endian_t a_end, int a_width, bool inclusive) : diff --git a/srecord/input/filter/interval/length.h b/srecord/input/filter/interval/length.h index 923869fe..314ba636 100644 --- a/srecord/input/filter/interval/length.h +++ b/srecord/input/filter/interval/length.h @@ -36,7 +36,7 @@ class input_filter_interval_length: /** * The destructor. */ - virtual ~input_filter_interval_length(); + ~input_filter_interval_length() override = default; private: /** @@ -83,7 +83,7 @@ class input_filter_interval_length: protected: // See base class for documentation. - long calculate_result() const; + long calculate_result() const override; private: /** @@ -91,21 +91,22 @@ class input_filter_interval_length: */ int width; +public: /** * The default constructor. */ - input_filter_interval_length(); + input_filter_interval_length() = delete; /** * The copy constructor. */ - input_filter_interval_length(const input_filter_interval_length &); + input_filter_interval_length(const input_filter_interval_length &) = delete; /** * The assignment operator. */ input_filter_interval_length &operator=( - const input_filter_interval_length &); + const input_filter_interval_length &) = delete; }; }; diff --git a/srecord/input/filter/interval/maximum.cc b/srecord/input/filter/interval/maximum.cc index bb3c4949..d2ca4b47 100644 --- a/srecord/input/filter/interval/maximum.cc +++ b/srecord/input/filter/interval/maximum.cc @@ -19,12 +19,6 @@ #include - -srecord::input_filter_interval_maximum::~input_filter_interval_maximum() -{ -} - - srecord::input_filter_interval_maximum::input_filter_interval_maximum( const pointer &a_deeper, long a_address, int a_length, endian_t a_end, bool inclusive) : diff --git a/srecord/input/filter/interval/maximum.h b/srecord/input/filter/interval/maximum.h index ea0d5ba2..65df9af1 100644 --- a/srecord/input/filter/interval/maximum.h +++ b/srecord/input/filter/interval/maximum.h @@ -37,7 +37,7 @@ class input_filter_interval_maximum: /** * The destructor. */ - virtual ~input_filter_interval_maximum(); + ~input_filter_interval_maximum() override = default; private: /** @@ -79,24 +79,25 @@ class input_filter_interval_maximum: protected: // See base class for documentation. - long calculate_result() const; + long calculate_result() const override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_interval_maximum(); + input_filter_interval_maximum() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_interval_maximum(const input_filter_interval_maximum &); + input_filter_interval_maximum( + const input_filter_interval_maximum &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_interval_maximum &operator=( - const input_filter_interval_maximum &); + const input_filter_interval_maximum &) = delete; }; }; diff --git a/srecord/input/filter/interval/minimum.cc b/srecord/input/filter/interval/minimum.cc index 322f64a4..d5928476 100644 --- a/srecord/input/filter/interval/minimum.cc +++ b/srecord/input/filter/interval/minimum.cc @@ -20,11 +20,6 @@ #include -srecord::input_filter_interval_minimum::~input_filter_interval_minimum() -{ -} - - srecord::input_filter_interval_minimum::input_filter_interval_minimum( const pointer &a_deeper, long a_address, int a_length, endian_t a_end, bool inclusive) : diff --git a/srecord/input/filter/interval/minimum.h b/srecord/input/filter/interval/minimum.h index f0d1947f..4bd9a00e 100644 --- a/srecord/input/filter/interval/minimum.h +++ b/srecord/input/filter/interval/minimum.h @@ -36,7 +36,7 @@ class input_filter_interval_minimum: /** * The destructor. */ - virtual ~input_filter_interval_minimum(); + ~input_filter_interval_minimum() override = default; private: /** @@ -78,24 +78,25 @@ class input_filter_interval_minimum: protected: // See base class for documentation. - long calculate_result() const; + long calculate_result() const override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_interval_minimum(); + input_filter_interval_minimum() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_interval_minimum(const input_filter_interval_minimum &); + input_filter_interval_minimum( + const input_filter_interval_minimum &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_interval_minimum &operator=( - const input_filter_interval_minimum &); + const input_filter_interval_minimum &) = delete; }; }; diff --git a/srecord/input/filter/message.cc b/srecord/input/filter/message.cc index a1c3c9ef..a9aacfe8 100644 --- a/srecord/input/filter/message.cc +++ b/srecord/input/filter/message.cc @@ -20,21 +20,12 @@ #include -srecord::input_filter_message::~input_filter_message() -{ -} - - srecord::input_filter_message::input_filter_message( const input::pointer &a_deeper, bool a_naked ) : input_filter(a_deeper), - naked(a_naked), - buffer_pos(0), - have_forwarded_header(false), - have_given_result(false), - have_forwarded_start_address(false) + naked(a_naked) { } diff --git a/srecord/input/filter/message.h b/srecord/input/filter/message.h index 37629893..64de9b85 100644 --- a/srecord/input/filter/message.h +++ b/srecord/input/filter/message.h @@ -42,7 +42,7 @@ class input_filter_message: /** * The destructor. */ - virtual ~input_filter_message(); + ~input_filter_message() override = default; protected: /** @@ -57,7 +57,7 @@ class input_filter_message: input_filter_message(const input::pointer &deeper, bool naked = false); // See base class for documentation. - bool read(record &record); + bool read(record &record) override; /** * The process method is used to process the data from the input. @@ -100,41 +100,42 @@ class input_filter_message: * The buffer_pos instance variable is used to remember where we * are up to in processing 'buffer'. */ - unsigned long buffer_pos; + unsigned long buffer_pos{0}; /** * The have_forwarded_header instance variable is used to remember * whether we have returned the file header to our reader yet. */ - bool have_forwarded_header; + bool have_forwarded_header{false}; /** * The have_given_result instance variable is used to remember * whether we have returned the result to our reader yet. */ - bool have_given_result; + bool have_given_result{false}; /** * The have_forwarded_start_address instance variable is used to * remember whether we have returned the execution start address to * our reader yet. */ - bool have_forwarded_start_address; + bool have_forwarded_start_address{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message(); + input_filter_message() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message(const input_filter_message &); + input_filter_message(const input_filter_message &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_message &operator=(const input_filter_message &); + input_filter_message &operator=(const input_filter_message &) = delete; }; }; diff --git a/srecord/input/filter/message/adler16.cc b/srecord/input/filter/message/adler16.cc index 75b01bf9..cd9336fb 100644 --- a/srecord/input/filter/message/adler16.cc +++ b/srecord/input/filter/message/adler16.cc @@ -23,11 +23,6 @@ #include -srecord::input_filter_message_adler16::~input_filter_message_adler16() -{ -} - - srecord::input_filter_message_adler16::input_filter_message_adler16( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/adler16.h b/srecord/input/filter/message/adler16.h index 7f0464c3..9272bdaa 100644 --- a/srecord/input/filter/message/adler16.h +++ b/srecord/input/filter/message/adler16.h @@ -38,7 +38,7 @@ class input_filter_message_adler16: /** * The destructor. */ - virtual ~input_filter_message_adler16(); + ~input_filter_message_adler16() override = default; private: /** @@ -71,10 +71,10 @@ class input_filter_message_adler16: protected: // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -89,21 +89,22 @@ class input_filter_message_adler16: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_adler16(); + input_filter_message_adler16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_adler16(const input_filter_message_adler16 &); + input_filter_message_adler16(const input_filter_message_adler16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_message_adler16 &operator=( - const input_filter_message_adler16 &); + const input_filter_message_adler16 &) = delete; }; }; diff --git a/srecord/input/filter/message/adler32.cc b/srecord/input/filter/message/adler32.cc index 9283c6dd..def2c85e 100644 --- a/srecord/input/filter/message/adler32.cc +++ b/srecord/input/filter/message/adler32.cc @@ -23,11 +23,6 @@ #include -srecord::input_filter_message_adler32::~input_filter_message_adler32() -{ -} - - srecord::input_filter_message_adler32::input_filter_message_adler32( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/adler32.h b/srecord/input/filter/message/adler32.h index fcec06e3..22531fdb 100644 --- a/srecord/input/filter/message/adler32.h +++ b/srecord/input/filter/message/adler32.h @@ -38,7 +38,7 @@ class input_filter_message_adler32: /** * The destructor. */ - virtual ~input_filter_message_adler32(); + ~input_filter_message_adler32() override = default; private: /** @@ -71,10 +71,10 @@ class input_filter_message_adler32: protected: // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -89,22 +89,23 @@ class input_filter_message_adler32: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_adler32(); + input_filter_message_adler32() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ input_filter_message_adler32( - const input_filter_message_adler32 &); + const input_filter_message_adler32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_message_adler32 &operator=( - const input_filter_message_adler32 &); + const input_filter_message_adler32 &) = delete; }; }; diff --git a/srecord/input/filter/message/crc16.cc b/srecord/input/filter/message/crc16.cc index d36051b2..874b92bd 100644 --- a/srecord/input/filter/message/crc16.cc +++ b/srecord/input/filter/message/crc16.cc @@ -24,21 +24,12 @@ #include -srecord::input_filter_message_crc16::~input_filter_message_crc16() -{ -} - - srecord::input_filter_message_crc16::input_filter_message_crc16( const input::pointer &deeper_arg, unsigned long address_arg, endian_t a_end) : input_filter_message(deeper_arg), address(address_arg), - end(a_end), - seed_mode(crc16::seed_mode_ccitt), - augment_flag(true), - polynomial(crc16::polynomial_ccitt), - bitdir(crc16::bit_direction_most_to_least) + end(a_end) { } diff --git a/srecord/input/filter/message/crc16.h b/srecord/input/filter/message/crc16.h index 2aa1e9b0..4bad34f6 100644 --- a/srecord/input/filter/message/crc16.h +++ b/srecord/input/filter/message/crc16.h @@ -38,7 +38,7 @@ class input_filter_message_crc16: /** * The destructor. */ - virtual ~input_filter_message_crc16(); + ~input_filter_message_crc16() override = default; private: /** @@ -71,13 +71,13 @@ class input_filter_message_crc16: protected: // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -96,37 +96,40 @@ class input_filter_message_crc16: * The seed_mode instance variable is used to remember the desired * seed for the CRC16 calculation. Defaults to CCITT. */ - crc16::seed_mode_t seed_mode; + crc16::seed_mode_t seed_mode{crc16::seed_mode_ccitt}; /** * The augment_flag instance variable is used to remember whether * or not the final 16-zero-bits augmentation should be applied to * the CRC. Almost always true. */ - bool augment_flag; + bool augment_flag{true}; - unsigned short polynomial; + unsigned short polynomial{crc16::polynomial_ccitt}; /** * The bitdir instance variable is used to remember the bit * direction of the CRC. */ - crc16::bit_direction_t bitdir; + crc16::bit_direction_t bitdir{crc16::bit_direction_most_to_least}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_crc16(); + input_filter_message_crc16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_crc16(const input_filter_message_crc16 &); + input_filter_message_crc16( + const input_filter_message_crc16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_message_crc16 &operator=(const input_filter_message_crc16 &); + input_filter_message_crc16 &operator=( + const input_filter_message_crc16 &) = delete; }; }; diff --git a/srecord/input/filter/message/crc32.cc b/srecord/input/filter/message/crc32.cc index 11cd40b1..b07a028c 100644 --- a/srecord/input/filter/message/crc32.cc +++ b/srecord/input/filter/message/crc32.cc @@ -23,11 +23,6 @@ #include -srecord::input_filter_message_crc32::~input_filter_message_crc32() -{ -} - - srecord::input_filter_message_crc32::input_filter_message_crc32( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/crc32.h b/srecord/input/filter/message/crc32.h index 3dac747d..75653bf2 100644 --- a/srecord/input/filter/message/crc32.h +++ b/srecord/input/filter/message/crc32.h @@ -38,7 +38,7 @@ class input_filter_message_crc32: /** * The destructor. */ - virtual ~input_filter_message_crc32(); + ~input_filter_message_crc32() override = default; private: /** @@ -71,13 +71,13 @@ class input_filter_message_crc32: protected: // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -99,20 +99,23 @@ class input_filter_message_crc32: */ crc32::seed_mode_t seed_mode; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_crc32(); + input_filter_message_crc32() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_crc32(const input_filter_message_crc32 &); + input_filter_message_crc32( + const input_filter_message_crc32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_message_crc32 &operator=(const input_filter_message_crc32 &); + input_filter_message_crc32 &operator=( + const input_filter_message_crc32 &) = delete; }; }; diff --git a/srecord/input/filter/message/fletcher16.cc b/srecord/input/filter/message/fletcher16.cc index d65c4082..3c16b34f 100644 --- a/srecord/input/filter/message/fletcher16.cc +++ b/srecord/input/filter/message/fletcher16.cc @@ -21,12 +21,6 @@ #include #include - -srecord::input_filter_message_fletcher16::~input_filter_message_fletcher16() -{ -} - - srecord::input_filter_message_fletcher16::input_filter_message_fletcher16( const input::pointer &a_deeper, unsigned long a_address, @@ -34,10 +28,7 @@ srecord::input_filter_message_fletcher16::input_filter_message_fletcher16( ) : input_filter_message(a_deeper), address(a_address), - end(a_end), - sum1(0xFF), - sum2(0xFF), - answer(-1) + end(a_end) { } diff --git a/srecord/input/filter/message/fletcher16.h b/srecord/input/filter/message/fletcher16.h index e4ff0e3c..1758df9a 100644 --- a/srecord/input/filter/message/fletcher16.h +++ b/srecord/input/filter/message/fletcher16.h @@ -38,7 +38,7 @@ class input_filter_message_fletcher16: /** * The destructor. */ - virtual ~input_filter_message_fletcher16(); + ~input_filter_message_fletcher16() override = default; private: /** @@ -71,13 +71,13 @@ class input_filter_message_fletcher16: protected: // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; // See base class for documentation. - void command_line(srecord::arglex_tool *cmdln); + void command_line(srecord::arglex_tool *cmdln) override; private: /** @@ -92,27 +92,29 @@ class input_filter_message_fletcher16: */ endian_t end; - unsigned char sum1; + unsigned char sum1{0xFF}; - unsigned char sum2; + unsigned char sum2{0xFF}; - int answer; + int answer{-1}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_fletcher16(); + input_filter_message_fletcher16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_fletcher16(const input_filter_message_fletcher16 &); + input_filter_message_fletcher16( + const input_filter_message_fletcher16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_message_fletcher16 &operator=( - const input_filter_message_fletcher16 &); + const input_filter_message_fletcher16 &) = delete; }; }; diff --git a/srecord/input/filter/message/fletcher32.cc b/srecord/input/filter/message/fletcher32.cc index dc82bf84..bd22abb8 100644 --- a/srecord/input/filter/message/fletcher32.cc +++ b/srecord/input/filter/message/fletcher32.cc @@ -21,12 +21,6 @@ #include #include - -srecord::input_filter_message_fletcher32::~input_filter_message_fletcher32() -{ -} - - srecord::input_filter_message_fletcher32::input_filter_message_fletcher32( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/fletcher32.h b/srecord/input/filter/message/fletcher32.h index 01101cb4..bfee9493 100644 --- a/srecord/input/filter/message/fletcher32.h +++ b/srecord/input/filter/message/fletcher32.h @@ -38,7 +38,7 @@ class input_filter_message_fletcher32: /** * The destructor. */ - virtual ~input_filter_message_fletcher32(); + ~input_filter_message_fletcher32() override = default; private: /** @@ -71,10 +71,10 @@ class input_filter_message_fletcher32: protected: // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -89,21 +89,23 @@ class input_filter_message_fletcher32: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_fletcher32(); + input_filter_message_fletcher32() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_fletcher32(const input_filter_message_fletcher32 &); + input_filter_message_fletcher32( + const input_filter_message_fletcher32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ input_filter_message_fletcher32 &operator=( - const input_filter_message_fletcher32 &); + const input_filter_message_fletcher32 &) = delete; }; }; diff --git a/srecord/input/filter/message/gcrypt.cc b/srecord/input/filter/message/gcrypt.cc index 0a3b8cc9..b57cbfbc 100644 --- a/srecord/input/filter/message/gcrypt.cc +++ b/srecord/input/filter/message/gcrypt.cc @@ -22,12 +22,6 @@ #include #include - -srecord::input_filter_message_gcrypt::~input_filter_message_gcrypt() -{ -} - - srecord::input_filter_message_gcrypt::input_filter_message_gcrypt( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/gcrypt.h b/srecord/input/filter/message/gcrypt.h index 19d6e8c8..4da6c7c6 100644 --- a/srecord/input/filter/message/gcrypt.h +++ b/srecord/input/filter/message/gcrypt.h @@ -39,7 +39,7 @@ class input_filter_message_gcrypt: /** * The destructor. */ - virtual ~input_filter_message_gcrypt(); + ~input_filter_message_gcrypt() override = default; private: /** @@ -294,10 +294,10 @@ class input_filter_message_gcrypt: protected: // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; private: /** @@ -318,20 +318,22 @@ class input_filter_message_gcrypt: */ unsigned long address; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_gcrypt(); + input_filter_message_gcrypt() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_gcrypt(const input_filter_message_gcrypt &); + input_filter_message_gcrypt(const input_filter_message_gcrypt &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_message_gcrypt &operator=(const input_filter_message_gcrypt &); + input_filter_message_gcrypt &operator=( + const input_filter_message_gcrypt &) = delete; }; }; diff --git a/srecord/input/filter/message/stm32.cc b/srecord/input/filter/message/stm32.cc index a1d49257..75e5db6e 100644 --- a/srecord/input/filter/message/stm32.cc +++ b/srecord/input/filter/message/stm32.cc @@ -31,11 +31,6 @@ #include -srecord::input_filter_message_stm32::~input_filter_message_stm32() -{ -} - - srecord::input_filter_message_stm32::input_filter_message_stm32( const input::pointer &a_deeper, unsigned long a_address, diff --git a/srecord/input/filter/message/stm32.h b/srecord/input/filter/message/stm32.h index 30cf295f..2a020d82 100644 --- a/srecord/input/filter/message/stm32.h +++ b/srecord/input/filter/message/stm32.h @@ -47,7 +47,7 @@ class input_filter_message_stm32: /** * The destructor. */ - virtual ~input_filter_message_stm32(); + ~input_filter_message_stm32() override = default; private: /** @@ -80,16 +80,16 @@ class input_filter_message_stm32: protected: // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - void process(const memory &input, record &output); + void process(const memory &input, record &output) override; // See base class for documentation. - const char *get_algorithm_name() const; + const char *get_algorithm_name() const override; // See base class for documentation. - unsigned get_minimum_alignment() const; + unsigned get_minimum_alignment() const override; private: /** @@ -104,20 +104,22 @@ class input_filter_message_stm32: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_message_stm32(); + input_filter_message_stm32() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_message_stm32(const input_filter_message_stm32 &); + input_filter_message_stm32(const input_filter_message_stm32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_message_stm32 &operator=(const input_filter_message_stm32 &); + input_filter_message_stm32 &operator=( + const input_filter_message_stm32 &) = delete; }; }; diff --git a/srecord/input/filter/not.cc b/srecord/input/filter/not.cc index df13c7b0..f043a1ee 100644 --- a/srecord/input/filter/not.cc +++ b/srecord/input/filter/not.cc @@ -22,11 +22,6 @@ #include -srecord::input_filter_not::~input_filter_not() -{ -} - - srecord::input_filter_not::input_filter_not(const input::pointer &arg) : srecord::input_filter(arg) { diff --git a/srecord/input/filter/not.h b/srecord/input/filter/not.h index 47aa5417..fab8eb79 100644 --- a/srecord/input/filter/not.h +++ b/srecord/input/filter/not.h @@ -36,7 +36,7 @@ class input_filter_not: /** * The destructor. */ - virtual ~input_filter_not(); + ~input_filter_not() override = default; private: /** @@ -59,23 +59,23 @@ class input_filter_not: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_not(); + input_filter_not() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_not(const input_filter_not &); + input_filter_not(const input_filter_not &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_not &operator=(const input_filter_not &); + input_filter_not &operator=(const input_filter_not &) = delete; }; }; diff --git a/srecord/input/filter/offset.cc b/srecord/input/filter/offset.cc index 72fdb420..6b87b2cf 100644 --- a/srecord/input/filter/offset.cc +++ b/srecord/input/filter/offset.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_offset::~input_filter_offset() -{ -} - - srecord::input_filter_offset::input_filter_offset( const srecord::input::pointer &a1, long a2) : srecord::input_filter(a1), diff --git a/srecord/input/filter/offset.h b/srecord/input/filter/offset.h index 70815cc0..161a8892 100644 --- a/srecord/input/filter/offset.h +++ b/srecord/input/filter/offset.h @@ -37,7 +37,7 @@ class input_filter_offset: /** * The destructor. */ - virtual ~input_filter_offset(); + ~input_filter_offset() override = default; private: /** @@ -66,7 +66,7 @@ class input_filter_offset: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -75,20 +75,21 @@ class input_filter_offset: */ long nbytes; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_offset(); + input_filter_offset() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_offset(const input_filter_offset &); + input_filter_offset(const input_filter_offset &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_offset &operator=(const input_filter_offset &); + input_filter_offset &operator=(const input_filter_offset &) = delete; }; }; diff --git a/srecord/input/filter/or.cc b/srecord/input/filter/or.cc index b691bb76..eea4620a 100644 --- a/srecord/input/filter/or.cc +++ b/srecord/input/filter/or.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_or::~input_filter_or() -{ -} - - srecord::input_filter_or::input_filter_or(const srecord::input::pointer &a1, int a2) : srecord::input_filter(a1), diff --git a/srecord/input/filter/or.h b/srecord/input/filter/or.h index f61df862..f5e0aa24 100644 --- a/srecord/input/filter/or.h +++ b/srecord/input/filter/or.h @@ -37,7 +37,7 @@ class input_filter_or: /** * The destructor. */ - virtual ~input_filter_or(); + ~input_filter_or() override = default; private: /** @@ -64,7 +64,7 @@ class input_filter_or: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -73,20 +73,21 @@ class input_filter_or: */ int value; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_or(); + input_filter_or() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_or(const input_filter_or &); + input_filter_or(const input_filter_or &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_or &operator=(const input_filter_or &); + input_filter_or &operator=(const input_filter_or &) = delete; }; }; diff --git a/srecord/input/filter/random_fill.cc b/srecord/input/filter/random_fill.cc index 6df7ddb3..f023926b 100644 --- a/srecord/input/filter/random_fill.cc +++ b/srecord/input/filter/random_fill.cc @@ -23,11 +23,6 @@ #include -srecord::input_filter_random_fill::~input_filter_random_fill() -{ -} - - srecord::input_filter_random_fill::input_filter_random_fill( const srecord::input::pointer &a1, const interval &a3) : srecord::input_filter(a1), diff --git a/srecord/input/filter/random_fill.h b/srecord/input/filter/random_fill.h index 6f1607b8..0f0f47d1 100644 --- a/srecord/input/filter/random_fill.h +++ b/srecord/input/filter/random_fill.h @@ -38,7 +38,7 @@ class input_filter_random_fill: /** * The destructor. */ - virtual ~input_filter_random_fill(); + ~input_filter_random_fill() override = default; private: /** @@ -66,7 +66,7 @@ class input_filter_random_fill: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -81,20 +81,22 @@ class input_filter_random_fill: */ bool generate(record &record); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_random_fill(); + input_filter_random_fill() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_random_fill(const input_filter_random_fill &); + input_filter_random_fill(const input_filter_random_fill &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_random_fill &operator=(const input_filter_random_fill &); + input_filter_random_fill &operator=( + const input_filter_random_fill &) = delete; }; }; diff --git a/srecord/input/filter/sequence.cc b/srecord/input/filter/sequence.cc index 5ed9ee85..333a546c 100644 --- a/srecord/input/filter/sequence.cc +++ b/srecord/input/filter/sequence.cc @@ -21,16 +21,9 @@ #include -srecord::input_filter_sequence::~input_filter_sequence() -{ -} - - srecord::input_filter_sequence::input_filter_sequence( srecord::input::pointer arg) : - srecord::input_filter(arg), - last_address(0), - warned(false) + srecord::input_filter(arg) { } diff --git a/srecord/input/filter/sequence.h b/srecord/input/filter/sequence.h index b2b22674..cc8f1d0c 100644 --- a/srecord/input/filter/sequence.h +++ b/srecord/input/filter/sequence.h @@ -37,7 +37,7 @@ class input_filter_sequence: /** * The destructor. */ - virtual ~input_filter_sequence(); + ~input_filter_sequence() override = default; private: /** @@ -54,7 +54,7 @@ class input_filter_sequence: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -63,7 +63,7 @@ class input_filter_sequence: * addresses less than this cause an "out of sequence" warning. * It is check and updated by the read() method. */ - unsigned long last_address; + unsigned long last_address{0}; /** * The warned instance variable is used to remember whether or not @@ -74,22 +74,23 @@ class input_filter_sequence: * embedded too chains emit zillions of these as they walk across * object files updating segments in parallel. */ - bool warned; + bool warned{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_sequence(); + input_filter_sequence() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_sequence(const input_filter_sequence &); + input_filter_sequence(const input_filter_sequence &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_sequence &operator=(const input_filter_sequence &); + input_filter_sequence &operator=(const input_filter_sequence &) = delete; }; }; diff --git a/srecord/input/filter/split.cc b/srecord/input/filter/split.cc index de0a1e48..9025197a 100644 --- a/srecord/input/filter/split.cc +++ b/srecord/input/filter/split.cc @@ -21,19 +21,12 @@ #include -srecord::input_filter_split::~input_filter_split() -{ -} - - srecord::input_filter_split::input_filter_split(const input::pointer &a1, int a2, int a3, int a4) : srecord::input_filter(a1), modulus(a2), offset(a2 - a3), - width(a4), - buffer(), - buffer_pos(0) + width(a4) { // // The offset is expressed as a positive number (by subtracting diff --git a/srecord/input/filter/split.h b/srecord/input/filter/split.h index 343c678a..97e861dd 100644 --- a/srecord/input/filter/split.h +++ b/srecord/input/filter/split.h @@ -63,7 +63,7 @@ class input_filter_split: /** * The destructor. */ - virtual ~input_filter_split(); + ~input_filter_split() override = default; private: /** @@ -100,7 +100,7 @@ class input_filter_split: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -132,22 +132,23 @@ class input_filter_split: * The buffer_pos instance variable is used to remember where we * are up to in the "buffer" instance variable. */ - size_t buffer_pos; + size_t buffer_pos{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_split(); + input_filter_split() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_split(const input_filter_split &); + input_filter_split(const input_filter_split &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_split &operator=(const input_filter_split &); + input_filter_split &operator=(const input_filter_split &) = delete; }; }; diff --git a/srecord/input/filter/unfill.cc b/srecord/input/filter/unfill.cc index eadc33d4..8cc9569f 100644 --- a/srecord/input/filter/unfill.cc +++ b/srecord/input/filter/unfill.cc @@ -20,19 +20,11 @@ #include - -srecord::input_filter_unfill::~input_filter_unfill() -{ -} - - srecord::input_filter_unfill::input_filter_unfill( const srecord::input::pointer &a1, int a2, int a3) : srecord::input_filter(a1), fill_value(a2), - fill_minimum(a3), - buffer(), - buffer_pos(0) + fill_minimum(a3) { } diff --git a/srecord/input/filter/unfill.h b/srecord/input/filter/unfill.h index 0ab98440..b660e20f 100644 --- a/srecord/input/filter/unfill.h +++ b/srecord/input/filter/unfill.h @@ -45,7 +45,7 @@ class input_filter_unfill: /** * The destructor. */ - virtual ~input_filter_unfill(); + ~input_filter_unfill() override = default; private: /** @@ -76,7 +76,7 @@ class input_filter_unfill: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -102,22 +102,23 @@ class input_filter_unfill: * The fill_value instance variable is used to remember where we * are up to in the "buffer" instance variable. */ - size_t buffer_pos; + size_t buffer_pos{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_unfill(); + input_filter_unfill() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_unfill(const input_filter_unfill &); + input_filter_unfill(const input_filter_unfill &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_unfill &operator=(const input_filter_unfill &); + input_filter_unfill &operator=(const input_filter_unfill &) = delete; }; }; diff --git a/srecord/input/filter/unsplit.cc b/srecord/input/filter/unsplit.cc index ea6a8d9a..32b952eb 100644 --- a/srecord/input/filter/unsplit.cc +++ b/srecord/input/filter/unsplit.cc @@ -20,20 +20,12 @@ #include #include - -srecord::input_filter_unsplit::~input_filter_unsplit() -{ -} - - srecord::input_filter_unsplit::input_filter_unsplit( const srecord::input::pointer &a1, int a2, int a3, int a4) : srecord::input_filter(a1), modulus(a2), offset(a3), - width(a4), - buffer(), - buffer_pos(0) + width(a4) { } diff --git a/srecord/input/filter/unsplit.h b/srecord/input/filter/unsplit.h index 105234fb..d1a22464 100644 --- a/srecord/input/filter/unsplit.h +++ b/srecord/input/filter/unsplit.h @@ -43,7 +43,7 @@ class input_filter_unsplit: /** * The destructor. */ - virtual ~input_filter_unsplit(); + ~input_filter_unsplit() override = default; private: /** @@ -80,7 +80,7 @@ class input_filter_unsplit: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -112,22 +112,23 @@ class input_filter_unsplit: * The buffer_pos instance variable is used to remember where we * are up to in the "buffer" instance variable. */ - size_t buffer_pos; + size_t buffer_pos{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_unsplit(); + input_filter_unsplit() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_unsplit(const input_filter_unsplit &); + input_filter_unsplit(const input_filter_unsplit &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_unsplit &operator=(const input_filter_unsplit &); + input_filter_unsplit &operator=(const input_filter_unsplit &) = delete; }; }; diff --git a/srecord/input/filter/xor.cc b/srecord/input/filter/xor.cc index e31aad67..91361db5 100644 --- a/srecord/input/filter/xor.cc +++ b/srecord/input/filter/xor.cc @@ -21,11 +21,6 @@ #include -srecord::input_filter_xor::~input_filter_xor() -{ -} - - srecord::input_filter_xor::input_filter_xor(const srecord::input::pointer &a1, int a2) : srecord::input_filter(a1), diff --git a/srecord/input/filter/xor.h b/srecord/input/filter/xor.h index 97da91f0..4fce407a 100644 --- a/srecord/input/filter/xor.h +++ b/srecord/input/filter/xor.h @@ -37,7 +37,7 @@ class input_filter_xor: /** * The destructor. */ - virtual ~input_filter_xor(); + ~input_filter_xor() override = default; private: /** @@ -64,7 +64,7 @@ class input_filter_xor: protected: // See base class for documentation. - bool read(record &record); + bool read(record &record) override; private: /** @@ -73,20 +73,21 @@ class input_filter_xor: */ int value; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_filter_xor(); + input_filter_xor() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_filter_xor(const input_filter_xor &); + input_filter_xor(const input_filter_xor &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_filter_xor &operator=(const input_filter_xor &); + input_filter_xor &operator=(const input_filter_xor &) = delete; }; }; diff --git a/srecord/input/generator.cc b/srecord/input/generator.cc index 6a289687..8f37b5db 100644 --- a/srecord/input/generator.cc +++ b/srecord/input/generator.cc @@ -27,12 +27,6 @@ #include #include - -srecord::input_generator::~input_generator() -{ -} - - srecord::input_generator::input_generator(const interval &a_range) : range(a_range) { diff --git a/srecord/input/generator.h b/srecord/input/generator.h index 207b0b09..167382a9 100644 --- a/srecord/input/generator.h +++ b/srecord/input/generator.h @@ -37,7 +37,7 @@ class input_generator: /** * The destructor. */ - virtual ~input_generator(); + ~input_generator() override = default; /** * The constructor. @@ -58,10 +58,10 @@ class input_generator: protected: // See base class for documentation - bool read(record &record); + bool read(record &record) override; // See base class for documentation - void disable_checksum_validation(); + void disable_checksum_validation() override; /** * The generate_data method is used to manufacture data for a @@ -82,20 +82,21 @@ class input_generator: */ interval range; +public: /** * The default constructor. */ - input_generator(); + input_generator() = delete; /** * The copy constructor. */ - input_generator(const input_generator &); + input_generator(const input_generator &) = delete; /** * The assignment operator. */ - input_generator &operator=(const input_generator &); + input_generator &operator=(const input_generator &) = delete; }; }; diff --git a/srecord/input/generator/constant.cc b/srecord/input/generator/constant.cc index 62638754..b5461959 100644 --- a/srecord/input/generator/constant.cc +++ b/srecord/input/generator/constant.cc @@ -21,12 +21,6 @@ #include - -srecord::input_generator_constant::~input_generator_constant() -{ -} - - srecord::input_generator_constant::input_generator_constant( const interval &a_range, unsigned char a_datum) : srecord::input_generator(a_range), diff --git a/srecord/input/generator/constant.h b/srecord/input/generator/constant.h index 7ad51eba..72c8cda5 100644 --- a/srecord/input/generator/constant.h +++ b/srecord/input/generator/constant.h @@ -36,7 +36,7 @@ class input_generator_constant: /** * The destructor. */ - virtual ~input_generator_constant(); + ~input_generator_constant() override = default; private: /** @@ -53,13 +53,13 @@ class input_generator_constant: protected: // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - unsigned char generate_data(unsigned long address); + unsigned char generate_data(unsigned long address) override; private: /** @@ -68,20 +68,22 @@ class input_generator_constant: */ unsigned char datum; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_generator_constant(); + input_generator_constant() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_generator_constant(const input_generator_constant &); + input_generator_constant(const input_generator_constant &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_generator_constant &operator=(const input_generator_constant &); + input_generator_constant &operator=( + const input_generator_constant &) = delete; }; }; diff --git a/srecord/input/generator/random.cc b/srecord/input/generator/random.cc index c44045e0..6fa63f3c 100644 --- a/srecord/input/generator/random.cc +++ b/srecord/input/generator/random.cc @@ -21,11 +21,6 @@ #include -srecord::input_generator_random::~input_generator_random() -{ -} - - srecord::input_generator_random::input_generator_random( const interval &a_range) : srecord::input_generator(a_range) diff --git a/srecord/input/generator/random.h b/srecord/input/generator/random.h index 8b3b18c5..a4aa0ce4 100644 --- a/srecord/input/generator/random.h +++ b/srecord/input/generator/random.h @@ -36,7 +36,7 @@ class input_generator_random: /** * The destructor. */ - virtual ~input_generator_random(); + ~input_generator_random() override = default; private: /** @@ -53,29 +53,29 @@ class input_generator_random: protected: // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; // See base class for documentation. - unsigned char generate_data(unsigned long address); + unsigned char generate_data(unsigned long address) override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_generator_random(); + input_generator_random() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_generator_random(const input_generator_random &); + input_generator_random(const input_generator_random &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_generator_random &operator=(const input_generator_random &); + input_generator_random &operator=(const input_generator_random &) = delete; }; }; diff --git a/srecord/input/generator/repeat.h b/srecord/input/generator/repeat.h index af31e01c..96aed992 100644 --- a/srecord/input/generator/repeat.h +++ b/srecord/input/generator/repeat.h @@ -36,7 +36,7 @@ class input_generator_repeat: /** * The destructor. */ - virtual ~input_generator_repeat(); + ~input_generator_repeat() override; private: /** @@ -69,13 +69,13 @@ class input_generator_repeat: protected: // See base class for documentation. - unsigned char generate_data(unsigned long address); + unsigned char generate_data(unsigned long address) override; // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - const char *get_file_format_name() const; + const char *get_file_format_name() const override; private: /** @@ -97,20 +97,21 @@ class input_generator_repeat: */ size_t length; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - input_generator_repeat(); + input_generator_repeat() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - input_generator_repeat(const input_generator_repeat &); + input_generator_repeat(const input_generator_repeat &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - input_generator_repeat &operator=(const input_generator_repeat &); + input_generator_repeat &operator=(const input_generator_repeat &) = delete; }; }; diff --git a/srecord/interval.cc b/srecord/interval.cc index 1f7c90db..3a2beac5 100644 --- a/srecord/interval.cc +++ b/srecord/interval.cc @@ -43,17 +43,6 @@ // Use the interval_free function for this purpose. // -srecord::interval::interval() -{ - length = 0; - size = 0; - scan_index = 0; - scan_next_datum = 0; - data = 0; - // assert(valid()); -} - - static inline srecord::interval::long_data_t promote(srecord::interval::data_t datum, size_t pos) { diff --git a/srecord/interval.h b/srecord/interval.h index 5602e8b8..077d286c 100644 --- a/srecord/interval.h +++ b/srecord/interval.h @@ -50,7 +50,7 @@ class interval /** * The default constructor. The interval is empty. */ - interval(); + interval() = default; /** * The constructor. The interval contains the single integer supplied. @@ -212,26 +212,26 @@ class interval * the data instance variable. This is almost always even, because * the internal is a series of [lo, hi) sub-intervals. */ - size_t length; + size_t length{0}; /** * The size instance variable is used to remember the maximum size * of the data instance variable. The length can go up and down * depending on the calculation, but the size only ever rises. */ - size_t size; + size_t size{0}; /** * The scan_index instance variable is used to remember where the * scan us up to. Used by the scan_next method, et al. */ - size_t scan_index; + size_t scan_index{0}; /** * The scan_next_datum instance variable is used to remember where * the scan us up to. Used by the scan_next method, et al. */ - data_t scan_next_datum; + data_t scan_next_datum{0}; /** * The data instance variable is used to remember a pointer to @@ -239,7 +239,7 @@ class interval * pairs. As a sanity check, there is an extra item, which contains * the same value as the length instance variable. */ - data_t *data; + data_t *data{nullptr}; /** * The valid method is used to test whether the interval is diff --git a/srecord/memory.cc b/srecord/memory.cc index 293b9c32..2ddf107b 100644 --- a/srecord/memory.cc +++ b/srecord/memory.cc @@ -27,27 +27,8 @@ #include #include +srecord::memory::memory(const srecord::memory &rhs) -srecord::memory::memory() : - nchunks(0), - nchunks_max(0), - chunk(0), - cache(0), - find_next_chunk_index(0), - header(0), - execution_start_address(0) -{ -} - - -srecord::memory::memory(const srecord::memory &rhs) : - nchunks(0), - nchunks_max(0), - chunk(0), - cache(0), - find_next_chunk_index(0), - header(0), - execution_start_address(0) { copy(rhs); } diff --git a/srecord/memory.h b/srecord/memory.h index bbb9c5ea..7f0dc7f4 100644 --- a/srecord/memory.h +++ b/srecord/memory.h @@ -42,7 +42,7 @@ class memory /** * The default constructor. */ - memory(); + memory() = default; /** * The copy constructor. @@ -236,13 +236,13 @@ class memory * The nchunks instance variable is used to member how large * our pool of memory chunks is. It is always <= nchunks_max; */ - mutable int nchunks; + mutable int nchunks{0}; /** * The max_chunks instance variable is used to remember the * size of the chunk array, which holds the pool of memory chunks. */ - mutable int nchunks_max; + mutable int nchunks_max{0}; /** * The chunk instance variable is used to hold the pointer to @@ -250,7 +250,7 @@ class memory * settings of the various bytes. By using a sparse array, * we can cope with arbitrary memory usages. */ - mutable memory_chunk **chunk; + mutable memory_chunk **chunk{0}; /** * The find method is used to find the chunk which contains @@ -266,7 +266,7 @@ class memory * method, based on the fact that most memory accesses are * sequential, in the same chunk. */ - mutable memory_chunk *cache; + mutable memory_chunk *cache{0}; /** * The find_next_chunk method is used to visit each and every @@ -280,14 +280,14 @@ class memory * the find_next_chunk() method to keep track of where it is * positioned across the chunk array. */ - mutable int find_next_chunk_index; + mutable int find_next_chunk_index{0}; /** * The header instance variable is used to track the file header. * It is set by the reader() and set_header() methods. It is * read by the get_header() method. */ - record *header; + record *header{0}; /** * The execution_start_address instance variable is used to track @@ -295,7 +295,7 @@ class memory * set_execution_start_address() methods. It is read by the * get_execution_start_address() method. */ - record *execution_start_address; + record *execution_start_address{0}; /** * The clear method is used to discard all data, as if when diff --git a/srecord/memory/chunk.cc b/srecord/memory/chunk.cc index 65e2007c..f232ce6c 100644 --- a/srecord/memory/chunk.cc +++ b/srecord/memory/chunk.cc @@ -52,11 +52,6 @@ srecord::memory_chunk::operator=(const srecord::memory_chunk &arg) } -srecord::memory_chunk::~memory_chunk() -{ -} - - void srecord::memory_chunk::set(unsigned long offset, int datum) { diff --git a/srecord/memory/chunk.h b/srecord/memory/chunk.h index c3821d87..5d61f052 100644 --- a/srecord/memory/chunk.h +++ b/srecord/memory/chunk.h @@ -68,7 +68,7 @@ class memory_chunk /** * The destructor. */ - ~memory_chunk(); + ~memory_chunk() = default; /** * The set method is used to set the byte at the given offset within @@ -139,18 +139,19 @@ class memory_chunk /** * The data array is used to remember the values of valid data bytes. */ - unsigned char data[size]; + unsigned char data[size]{}; /** * The mask array is used to remember which values in the data * array contain valid values. */ - unsigned char mask[(size + 7) / 8]; + unsigned char mask[(size + 7) / 8]{}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - memory_chunk(); + memory_chunk() = delete; }; bool operator == (const srecord::memory_chunk &, const srecord::memory_chunk &); diff --git a/srecord/memory/walker.cc b/srecord/memory/walker.cc index 536d9887..fc77fa50 100644 --- a/srecord/memory/walker.cc +++ b/srecord/memory/walker.cc @@ -21,16 +21,6 @@ #include -srecord::memory_walker::memory_walker() -{ -} - - -srecord::memory_walker::~memory_walker() -{ -} - - void srecord::memory_walker::notify_upper_bound(unsigned long) { diff --git a/srecord/memory/walker.h b/srecord/memory/walker.h index e77c1a46..08a2e0ed 100644 --- a/srecord/memory/walker.h +++ b/srecord/memory/walker.h @@ -38,7 +38,7 @@ class memory_walker /** * The destructor. */ - virtual ~memory_walker(); + virtual ~memory_walker() = default; /** * The observe method is used by the memory walker to provide data. @@ -94,18 +94,18 @@ class memory_walker /** * The default constructor. May only be called by derived classes. */ - memory_walker(); + memory_walker() = default; -private: +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker(const memory_walker &); + memory_walker(const memory_walker &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker &operator=(const memory_walker &); + memory_walker &operator=(const memory_walker &) = delete; }; }; diff --git a/srecord/memory/walker/adler16.cc b/srecord/memory/walker/adler16.cc index 2b6e1d47..24e6836d 100644 --- a/srecord/memory/walker/adler16.cc +++ b/srecord/memory/walker/adler16.cc @@ -21,16 +21,6 @@ #include -srecord::memory_walker_adler16::~memory_walker_adler16() -{ -} - - -srecord::memory_walker_adler16::memory_walker_adler16() -{ -} - - srecord::memory_walker_adler16::pointer srecord::memory_walker_adler16::create() { diff --git a/srecord/memory/walker/adler16.h b/srecord/memory/walker/adler16.h index c42a2016..3ff36ed6 100644 --- a/srecord/memory/walker/adler16.h +++ b/srecord/memory/walker/adler16.h @@ -39,14 +39,14 @@ class memory_walker_adler16: /** * The destructor. */ - virtual ~memory_walker_adler16(); + ~memory_walker_adler16() override = default; private: /** * The default constructor. It is private on purpose, use the * #create method instead. */ - memory_walker_adler16(); + memory_walker_adler16() = default; public: /** @@ -63,7 +63,7 @@ class memory_walker_adler16: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -72,15 +72,16 @@ class memory_walker_adler16: */ adler16 checksum; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_adler16(const memory_walker_adler16 &); + memory_walker_adler16(const memory_walker_adler16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_adler16 &operator=(const memory_walker_adler16 &); + memory_walker_adler16 &operator=(const memory_walker_adler16 &) = delete; }; }; diff --git a/srecord/memory/walker/adler32.cc b/srecord/memory/walker/adler32.cc index 0107a9dd..a29aa223 100644 --- a/srecord/memory/walker/adler32.cc +++ b/srecord/memory/walker/adler32.cc @@ -21,16 +21,6 @@ #include -srecord::memory_walker_adler32::~memory_walker_adler32() -{ -} - - -srecord::memory_walker_adler32::memory_walker_adler32() -{ -} - - srecord::memory_walker_adler32::pointer srecord::memory_walker_adler32::create() { diff --git a/srecord/memory/walker/adler32.h b/srecord/memory/walker/adler32.h index 5fd672be..c9e13636 100644 --- a/srecord/memory/walker/adler32.h +++ b/srecord/memory/walker/adler32.h @@ -39,14 +39,14 @@ class memory_walker_adler32: /** * The destructor. */ - virtual ~memory_walker_adler32(); + ~memory_walker_adler32() override = default; private: /** * The default constructor. It is private on purpose, use the * #create method instead. */ - memory_walker_adler32(); + memory_walker_adler32() = default; public: /** @@ -63,7 +63,7 @@ class memory_walker_adler32: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -72,15 +72,16 @@ class memory_walker_adler32: */ adler32 checksum; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_adler32(const memory_walker_adler32 &); + memory_walker_adler32(const memory_walker_adler32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_adler32 &operator=(const memory_walker_adler32 &); + memory_walker_adler32 &operator=(const memory_walker_adler32 &) = delete; }; }; diff --git a/srecord/memory/walker/alignment.cc b/srecord/memory/walker/alignment.cc index ea0f42cc..fa8f7f1c 100644 --- a/srecord/memory/walker/alignment.cc +++ b/srecord/memory/walker/alignment.cc @@ -21,16 +21,8 @@ #include -srecord::memory_walker_alignment::~memory_walker_alignment() -{ -} - - srecord::memory_walker_alignment::memory_walker_alignment(unsigned a_multiple) : - multiple(a_multiple), - current_address(0), - data_seen(false), - well_aligned(true) + multiple(a_multiple) { assert(multiple >= 2); } diff --git a/srecord/memory/walker/alignment.h b/srecord/memory/walker/alignment.h index 00935c7b..81251159 100644 --- a/srecord/memory/walker/alignment.h +++ b/srecord/memory/walker/alignment.h @@ -38,7 +38,7 @@ class memory_walker_alignment: /** * The destructor. */ - virtual ~memory_walker_alignment(); + ~memory_walker_alignment() override = default; /** * The create class method is used to create new dynamically @@ -60,10 +60,10 @@ class memory_walker_alignment: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; // See base class for documentation. - void observe_end(); + void observe_end() override; private: /** @@ -75,26 +75,28 @@ class memory_walker_alignment: */ memory_walker_alignment(unsigned multiple); - unsigned multiple; - unsigned long current_address; - bool data_seen; - bool well_aligned; + unsigned multiple{2}; + unsigned long current_address{0}; + bool data_seen{false}; + bool well_aligned{true}; +public: /** * The default constructor. * Do not use. */ - memory_walker_alignment(); + memory_walker_alignment() = delete; /** * The copy constructor. No not use. */ - memory_walker_alignment(const memory_walker_alignment &); + memory_walker_alignment(const memory_walker_alignment &) = delete; /** * The assignment operator. No not use. */ - memory_walker_alignment &operator=(const memory_walker_alignment &); + memory_walker_alignment &operator=( + const memory_walker_alignment &) = delete; }; }; diff --git a/srecord/memory/walker/compare.cc b/srecord/memory/walker/compare.cc index 228aafc6..404d6138 100644 --- a/srecord/memory/walker/compare.cc +++ b/srecord/memory/walker/compare.cc @@ -24,11 +24,6 @@ #include -srecord::memory_walker_compare::~memory_walker_compare() -{ -} - - srecord::memory_walker_compare::memory_walker_compare(const srecord::memory &a1, bool a2) : other(a1), diff --git a/srecord/memory/walker/compare.h b/srecord/memory/walker/compare.h index 3ea12064..d22b3d95 100644 --- a/srecord/memory/walker/compare.h +++ b/srecord/memory/walker/compare.h @@ -48,7 +48,7 @@ class memory_walker_compare: /** * The destructor. */ - virtual ~memory_walker_compare(); + ~memory_walker_compare() override = default; private: /** @@ -77,7 +77,7 @@ class memory_walker_compare: static pointer create(const memory &other, bool check_wrong); // See base class for documentation. - virtual void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; /** * The print method is used to print the results of the comparison @@ -121,20 +121,21 @@ class memory_walker_compare: */ interval wrong; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - memory_walker_compare(); + memory_walker_compare() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_compare(const memory_walker_compare &); + memory_walker_compare(const memory_walker_compare &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_compare &operator=(const memory_walker_compare &); + memory_walker_compare &operator=(const memory_walker_compare &) = delete; }; }; diff --git a/srecord/memory/walker/continuity.cc b/srecord/memory/walker/continuity.cc index de4883d5..c0c4e9e8 100644 --- a/srecord/memory/walker/continuity.cc +++ b/srecord/memory/walker/continuity.cc @@ -20,20 +20,6 @@ #include - -srecord::memory_walker_continuity::~memory_walker_continuity() -{ -} - - -srecord::memory_walker_continuity::memory_walker_continuity() : - current_address(0), - data_seen(false), - nholes(0) -{ -} - - srecord::memory_walker_continuity::pointer srecord::memory_walker_continuity::create() { diff --git a/srecord/memory/walker/continuity.h b/srecord/memory/walker/continuity.h index 95b4f6af..15e38283 100644 --- a/srecord/memory/walker/continuity.h +++ b/srecord/memory/walker/continuity.h @@ -39,14 +39,14 @@ class memory_walker_continuity: /** * The destructor. */ - virtual ~memory_walker_continuity(); + ~memory_walker_continuity() override = default; private: /** * The default constructor. It is private on purpose, use the * #create class method instead. */ - memory_walker_continuity(); + memory_walker_continuity() = default; public: /** @@ -66,22 +66,24 @@ class memory_walker_continuity: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: - unsigned long current_address; - bool data_seen; - int nholes; + unsigned long current_address{0}; + bool data_seen{false}; + int nholes{0}; +public: /** * The copy constructor. No not use. */ - memory_walker_continuity(const memory_walker_continuity &); + memory_walker_continuity(const memory_walker_continuity &) = delete; /** * The assignment operator. No not use. */ - memory_walker_continuity &operator=(const memory_walker_continuity &); + memory_walker_continuity &operator=( + const memory_walker_continuity &) = delete; }; }; diff --git a/srecord/memory/walker/crc16.h b/srecord/memory/walker/crc16.h index 4d3a3964..9733cfeb 100644 --- a/srecord/memory/walker/crc16.h +++ b/srecord/memory/walker/crc16.h @@ -39,7 +39,7 @@ class memory_walker_crc16: /** * The destructor. */ - virtual ~memory_walker_crc16(); + ~memory_walker_crc16() override; private: /** @@ -83,7 +83,7 @@ class memory_walker_crc16: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -92,15 +92,16 @@ class memory_walker_crc16: */ crc16 *checksum; +public: /** * The copy constructor. No not use. */ - memory_walker_crc16(const memory_walker_crc16 &); + memory_walker_crc16(const memory_walker_crc16 &) = delete; /** * The assignment operator. No not use. */ - memory_walker_crc16 &operator=(const memory_walker_crc16 &); + memory_walker_crc16 &operator=(const memory_walker_crc16 &) = delete; }; }; diff --git a/srecord/memory/walker/crc32.cc b/srecord/memory/walker/crc32.cc index 753bd01a..f5dcf009 100644 --- a/srecord/memory/walker/crc32.cc +++ b/srecord/memory/walker/crc32.cc @@ -21,11 +21,6 @@ #include -srecord::memory_walker_crc32::~memory_walker_crc32() -{ -} - - srecord::memory_walker_crc32::memory_walker_crc32( crc32::seed_mode_t seed_mode) : checksum(seed_mode) diff --git a/srecord/memory/walker/crc32.h b/srecord/memory/walker/crc32.h index 8d660337..d62fb789 100644 --- a/srecord/memory/walker/crc32.h +++ b/srecord/memory/walker/crc32.h @@ -39,7 +39,7 @@ class memory_walker_crc32: /** * The destructor. */ - virtual ~memory_walker_crc32(); + ~memory_walker_crc32() override = default; private: /** @@ -69,7 +69,7 @@ class memory_walker_crc32: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -78,15 +78,16 @@ class memory_walker_crc32: */ crc32 checksum; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_crc32(const memory_walker_crc32 &); + memory_walker_crc32(const memory_walker_crc32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_crc32 &operator=(const memory_walker_crc32 &); + memory_walker_crc32 &operator=(const memory_walker_crc32 &) = delete; }; }; diff --git a/srecord/memory/walker/fletcher16.cc b/srecord/memory/walker/fletcher16.cc index a355dde6..5db09325 100644 --- a/srecord/memory/walker/fletcher16.cc +++ b/srecord/memory/walker/fletcher16.cc @@ -20,11 +20,6 @@ #include -srecord::memory_walker_fletcher16::~memory_walker_fletcher16() -{ -} - - srecord::memory_walker_fletcher16::memory_walker_fletcher16( int a_sum1, int a_sum2, diff --git a/srecord/memory/walker/fletcher16.h b/srecord/memory/walker/fletcher16.h index dc16d632..c7b71b9b 100644 --- a/srecord/memory/walker/fletcher16.h +++ b/srecord/memory/walker/fletcher16.h @@ -38,7 +38,7 @@ class memory_walker_fletcher16: /** * The destructor. */ - virtual ~memory_walker_fletcher16(); + ~memory_walker_fletcher16() override = default; private: /** @@ -90,7 +90,9 @@ class memory_walker_fletcher16: protected: // See base class for documentation. - void observe(unsigned long address, const void *data, int data_size); + void observe(unsigned long address, + const void *data, + int data_size) override; private: /** @@ -99,20 +101,22 @@ class memory_walker_fletcher16: */ fletcher16 checksum; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - memory_walker_fletcher16(); + memory_walker_fletcher16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_fletcher16(const memory_walker_fletcher16 &); + memory_walker_fletcher16(const memory_walker_fletcher16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_fletcher16 &operator=(const memory_walker_fletcher16 &); + memory_walker_fletcher16 &operator=( + const memory_walker_fletcher16 &) = delete; }; }; diff --git a/srecord/memory/walker/fletcher32.cc b/srecord/memory/walker/fletcher32.cc index d801f47c..8a744569 100644 --- a/srecord/memory/walker/fletcher32.cc +++ b/srecord/memory/walker/fletcher32.cc @@ -19,17 +19,6 @@ #include #include - -srecord::memory_walker_fletcher32::~memory_walker_fletcher32() -{ -} - - -srecord::memory_walker_fletcher32::memory_walker_fletcher32() -{ -} - - srecord::memory_walker_fletcher32::pointer srecord::memory_walker_fletcher32::create() { diff --git a/srecord/memory/walker/fletcher32.h b/srecord/memory/walker/fletcher32.h index 614b2c3d..0c896daf 100644 --- a/srecord/memory/walker/fletcher32.h +++ b/srecord/memory/walker/fletcher32.h @@ -38,14 +38,14 @@ class memory_walker_fletcher32: /** * The destructor. */ - virtual ~memory_walker_fletcher32(); + ~memory_walker_fletcher32() override = default; private: /** * The default constructor. It is private on purpose, use the * #create method instead. */ - memory_walker_fletcher32(); + memory_walker_fletcher32() = default; public: /** @@ -62,7 +62,7 @@ class memory_walker_fletcher32: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -71,15 +71,17 @@ class memory_walker_fletcher32: */ fletcher32 checksum; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_fletcher32(const memory_walker_fletcher32 &); + memory_walker_fletcher32(const memory_walker_fletcher32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_fletcher32 &operator=(const memory_walker_fletcher32 &); + memory_walker_fletcher32 &operator=( + const memory_walker_fletcher32 &) = delete; }; }; diff --git a/srecord/memory/walker/gcrypt.cc b/srecord/memory/walker/gcrypt.cc index a1163641..249516a8 100644 --- a/srecord/memory/walker/gcrypt.cc +++ b/srecord/memory/walker/gcrypt.cc @@ -19,11 +19,6 @@ #include -srecord::memory_walker_gcrypt::~memory_walker_gcrypt() -{ -} - - srecord::memory_walker_gcrypt::memory_walker_gcrypt(gcry_md_hd_t a_handle) : handle(a_handle) { diff --git a/srecord/memory/walker/gcrypt.h b/srecord/memory/walker/gcrypt.h index 4e5860a8..d8f205a9 100644 --- a/srecord/memory/walker/gcrypt.h +++ b/srecord/memory/walker/gcrypt.h @@ -43,7 +43,7 @@ class memory_walker_gcrypt: /** * The destructor. */ - virtual ~memory_walker_gcrypt(); + ~memory_walker_gcrypt() override = default; private: /** @@ -69,7 +69,7 @@ class memory_walker_gcrypt: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** @@ -78,20 +78,21 @@ class memory_walker_gcrypt: */ gcry_md_hd_t handle; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - memory_walker_gcrypt(); + memory_walker_gcrypt() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_gcrypt(const memory_walker_gcrypt &); + memory_walker_gcrypt(const memory_walker_gcrypt &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_gcrypt &operator=(const memory_walker_gcrypt &); + memory_walker_gcrypt &operator=(const memory_walker_gcrypt &) = delete; }; }; diff --git a/srecord/memory/walker/stm32.cc b/srecord/memory/walker/stm32.cc index d4b3bf21..f12d8728 100644 --- a/srecord/memory/walker/stm32.cc +++ b/srecord/memory/walker/stm32.cc @@ -33,16 +33,6 @@ #include -srecord::memory_walker_stm32::~memory_walker_stm32() -{ -} - - -srecord::memory_walker_stm32::memory_walker_stm32() -{ -} - - srecord::memory_walker_stm32::pointer srecord::memory_walker_stm32::create() { diff --git a/srecord/memory/walker/stm32.h b/srecord/memory/walker/stm32.h index 70b83017..687897b2 100644 --- a/srecord/memory/walker/stm32.h +++ b/srecord/memory/walker/stm32.h @@ -51,7 +51,7 @@ class memory_walker_stm32: /** * The destructor. */ - virtual ~memory_walker_stm32(); + ~memory_walker_stm32() override = default; /** * The create class method is used to create new dynamically @@ -68,14 +68,14 @@ class memory_walker_stm32: protected: // See base class for documentation. - void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; private: /** * The default constructor. * It is private on purpose, use the #create class method instead. */ - memory_walker_stm32(); + memory_walker_stm32() = default; /** * The checksum instance variable is used to remember the running @@ -83,15 +83,16 @@ class memory_walker_stm32: */ stm32 checksum; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_stm32(const memory_walker_stm32 &); + memory_walker_stm32(const memory_walker_stm32 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_stm32 &operator=(const memory_walker_stm32 &); + memory_walker_stm32 &operator=(const memory_walker_stm32 &) = delete; }; }; diff --git a/srecord/memory/walker/writer.cc b/srecord/memory/walker/writer.cc index 75d3d541..f30a58a9 100644 --- a/srecord/memory/walker/writer.cc +++ b/srecord/memory/walker/writer.cc @@ -22,11 +22,6 @@ #include -srecord::memory_walker_writer::~memory_walker_writer() -{ -} - - srecord::memory_walker_writer::memory_walker_writer( const srecord::output::pointer &arg) : op(arg) diff --git a/srecord/memory/walker/writer.h b/srecord/memory/walker/writer.h index ce21f8a1..c9f2a8a0 100644 --- a/srecord/memory/walker/writer.h +++ b/srecord/memory/walker/writer.h @@ -36,7 +36,7 @@ class memory_walker_writer: /** * the destructor. */ - virtual ~memory_walker_writer(); + ~memory_walker_writer() override = default; private: /** @@ -60,16 +60,16 @@ class memory_walker_writer: protected: // See base class for documentation. - virtual void observe(unsigned long, const void *, int); + void observe(unsigned long, const void *, int) override; // See base class for documentation. - void notify_upper_bound(long unsigned); + void notify_upper_bound(long unsigned) override; // See base class for documentation. - void observe_header(const record *); + void observe_header(const record *) override; // See base class for documentation. - void observe_start_address(const record *); + void observe_start_address(const record *) override; private: /** @@ -78,20 +78,21 @@ class memory_walker_writer: */ output::pointer op; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - memory_walker_writer(); + memory_walker_writer() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - memory_walker_writer(const memory_walker_writer &); + memory_walker_writer(const memory_walker_writer &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - memory_walker_writer &operator=(const memory_walker_writer &); + memory_walker_writer &operator=(const memory_walker_writer &) = delete; }; } diff --git a/srecord/output.cc b/srecord/output.cc index e0ef1e58..bde8c312 100644 --- a/srecord/output.cc +++ b/srecord/output.cc @@ -26,16 +26,6 @@ #include -srecord::output::output() -{ -} - - -srecord::output::~output() -{ -} - - void srecord::output::fatal_error(const char *fmt, ...) const diff --git a/srecord/output.h b/srecord/output.h index 03ffb7f5..3fff60ca 100644 --- a/srecord/output.h +++ b/srecord/output.h @@ -43,7 +43,7 @@ class output /** * The destructor. */ - virtual ~output(); + virtual ~output() = default; /** * The write method is used to write a record onto an output. @@ -207,18 +207,18 @@ class output /** * The default constructor. Only derived classes may use. */ - output(); + output() = default; -private: +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - output(const output &); + output(const output &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output &operator=(const output &); + output &operator=(const output &) = delete; }; }; diff --git a/srecord/output/file.cc b/srecord/output/file.cc index d4ea6601..e03216ed 100644 --- a/srecord/output/file.cc +++ b/srecord/output/file.cc @@ -47,13 +47,7 @@ srecord::output_file::~output_file() } -srecord::output_file::output_file() : - file_name("standard output"), - line_number(1), - vfp(0), - checksum(0), - position(0), - is_regular(true) +srecord::output_file::output_file() { vfp = stdout; set_is_regular(); @@ -62,12 +56,7 @@ srecord::output_file::output_file() : srecord::output_file::output_file(const std::string &a_file_name) : - file_name(a_file_name), - line_number(1), - vfp(0), - checksum(0), - position(0), - is_regular(true) + file_name(a_file_name) { if (file_name == "-") { @@ -431,7 +420,7 @@ void srecord::output_file::set_is_regular() { FILE *fp = (FILE *)vfp; - struct stat st; + struct stat st{}; is_regular = fstat(fileno(fp), &st) == 0 && S_ISREG(st.st_mode); } diff --git a/srecord/output/file.h b/srecord/output/file.h index 532db996..3a233e5a 100644 --- a/srecord/output/file.h +++ b/srecord/output/file.h @@ -37,7 +37,7 @@ class output_file: /** * The destructor. */ - virtual ~output_file(); + ~output_file() override; /** * The default constructor. @@ -55,7 +55,7 @@ class output_file: output_file(const std::string &file_name); // See base class for documentation. - virtual std::string filename() const; + std::string filename() const override; /** * The enable_header class method is used to enable or disable @@ -339,14 +339,14 @@ class output_file: * filename_and_line methods to report the name of the input * file. This makes for informative error messages. */ - std::string file_name; + std::string file_name{"standard output"}; /** * The line_number instance variable is used by the get_char * method to remember the current line number. It us used by the * filename_and_line method to report the current file location. */ - int line_number; + int line_number{1}; /** * The vfp instance variable is used by the #get_fp method to @@ -355,7 +355,7 @@ class output_file: * always go via the #get_fp method. This ensures the file has * been opened first! */ - void *vfp; + void *vfp{nullptr}; protected: /** @@ -366,7 +366,7 @@ class output_file: * Always use the #checksum_get or #checksum_get16 methods to * read its value. */ - int checksum; + int checksum{0}; /** * The fatal_alignment_error method is used to report problems @@ -403,14 +403,14 @@ class output_file: * current position within the output file. Set by the put_char * method, and the seek_to method. Used by the seek_to method. */ - unsigned long position; + unsigned long position{0}; /** * The is_regular instance variable is used to remember whether * or not the file is a regular file. This is set by the * set_is_regular method. It is used by the seek_to method. */ - bool is_regular; + bool is_regular{true}; /** * The set_is_regular method shall be used whenever vfp is assigned, @@ -437,15 +437,16 @@ class output_file: */ virtual bool is_binary() const; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file(const output_file &); + output_file(const output_file &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file &operator=(const output_file &); + output_file &operator=(const output_file &) = delete; }; }; diff --git a/srecord/output/file/aomf.cc b/srecord/output/file/aomf.cc index 4bbac9b2..e0308a0b 100644 --- a/srecord/output/file/aomf.cc +++ b/srecord/output/file/aomf.cc @@ -23,11 +23,6 @@ #include -srecord::output_file_aomf::~output_file_aomf() -{ -} - - srecord::output_file_aomf::output_file_aomf(const std::string &a_file_name) : srecord::output_file(a_file_name) { diff --git a/srecord/output/file/aomf.h b/srecord/output/file/aomf.h index bc6700c2..9044f3e0 100644 --- a/srecord/output/file/aomf.h +++ b/srecord/output/file/aomf.h @@ -36,7 +36,7 @@ class output_file_aomf: /** * The destructor. */ - virtual ~output_file_aomf(); + ~output_file_aomf() override = default; private: /** @@ -61,22 +61,22 @@ class output_file_aomf: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -110,13 +110,13 @@ class output_file_aomf: * This method also tracks the byte_offset, so that we can * align to specific boundaries. Calls the #checksum_add method. */ - void put_byte(unsigned char); + void put_byte(unsigned char) override; /** * The byte_offset instance variable is used to track the location * in the output file. Maintained by the #put_byte method. */ - unsigned long byte_offset; + unsigned long byte_offset{}; /** * The module_name instance variable is used to remember the @@ -125,15 +125,16 @@ class output_file_aomf: */ std::string module_name; +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_aomf(const output_file_aomf &); + output_file_aomf(const output_file_aomf &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_aomf &operator=(const output_file_aomf &); + output_file_aomf &operator=(const output_file_aomf &) = delete; }; }; diff --git a/srecord/output/file/ascii_hex.cc b/srecord/output/file/ascii_hex.cc index f15da519..3d885485 100644 --- a/srecord/output/file/ascii_hex.cc +++ b/srecord/output/file/ascii_hex.cc @@ -30,14 +30,7 @@ srecord::output_file_ascii_hex::~output_file_ascii_hex() srecord::output_file_ascii_hex::output_file_ascii_hex( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(0), - column(0), - pref_block_size(16), - line_length(pref_block_size * 3 - 1), - address_length(2), - start_code_emitted(false), - end_code_emitted(false) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/ascii_hex.h b/srecord/output/file/ascii_hex.h index bbfd44cb..0f0a1575 100644 --- a/srecord/output/file/ascii_hex.h +++ b/srecord/output/file/ascii_hex.h @@ -36,7 +36,7 @@ class output_file_ascii_hex: /** * The destructor. */ - virtual ~output_file_ascii_hex(); + ~output_file_ascii_hex() override; private: /** @@ -60,66 +60,66 @@ class output_file_ascii_hex: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The address instance variable is used to remember where we are * up to in the output. Used to limit the number of $A line emitted. */ - unsigned long address; + unsigned long address{0}; /** * The column instance variable is used to remember which column * we are up to in the output. Used to limit the length of lines * in the output. */ - int column; + int column{0}; /** * The pref_block_size instance variable is used to remember the * number of bytes in the preferred block size. */ - int pref_block_size; + int pref_block_size{16}; /** * The line_length instance variable is used to remember the * maximum length of text lines. */ - int line_length; + int line_length{pref_block_size * 3 - 1}; /** * The address_length instance variable is used to remember * how many bytes of addresses are are to emit. */ - int address_length; + int address_length{2}; /** * The start_code_emitted instance variable is used to remember * whether or not the start code (Ctrl-B) has been emitted. */ - bool start_code_emitted; + bool start_code_emitted{false}; /** * The end_code_emitted instance variable is used to remember * whether or not the end code (Ctrl-C) has been emitted. */ - bool end_code_emitted; + bool end_code_emitted{false}; /** * The emit_end_of_file method is used to write the ETX and @@ -128,20 +128,21 @@ class output_file_ascii_hex: */ void emit_end_of_file(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ascii_hex(); + output_file_ascii_hex() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ascii_hex(const output_file_ascii_hex &); + output_file_ascii_hex(const output_file_ascii_hex &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ascii_hex &operator=(const output_file_ascii_hex &); + output_file_ascii_hex &operator=(const output_file_ascii_hex &) = delete; }; }; diff --git a/srecord/output/file/asm.cc b/srecord/output/file/asm.cc index a89780f7..ff727920 100644 --- a/srecord/output/file/asm.cc +++ b/srecord/output/file/asm.cc @@ -201,17 +201,7 @@ srecord::output_file_asm::~output_file_asm() srecord::output_file_asm::output_file_asm(const std::string &filename) : - srecord::output_file(filename), - prefix("eprom"), - taddr(0), - column(0), - current_address(0), - line_length(75), - org_warn(false), - output_word(false), - dot_style(false), - section_style(false), - hex_style(false) + srecord::output_file(filename) { } diff --git a/srecord/output/file/asm.h b/srecord/output/file/asm.h index 80521a5b..94e33647 100644 --- a/srecord/output/file/asm.h +++ b/srecord/output/file/asm.h @@ -37,7 +37,7 @@ class output_file_asm: /** * The destructor. */ - virtual ~output_file_asm(); + ~output_file_asm() override; private: /** @@ -61,38 +61,38 @@ class output_file_asm: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The prefix instance variable is used to remember the variable * name prefix to be used in the output. */ - std::string prefix; + std::string prefix{"eprom"}; /** * The taddr instance variable is used to remember the * termination address, to be emitted in the footer. */ - unsigned long taddr; + unsigned long taddr{0}; /** * The range instance variable is used to remember the range @@ -104,32 +104,32 @@ class output_file_asm: * The column instance variable is used to remember the current * printing column on the line. */ - int column; + int column{0}; /** * The current_address instance variable is used to remember * the current address that the file is positioned at. This is * used to know whether we need to add padding. */ - unsigned long current_address; + unsigned long current_address{0}; /** * The line_length instance variable is used to remember the * maximum line length. The output usually does not exceed it. */ - int line_length; + int line_length{75}; /** * The org_warn instance variable is used to remember if the ORG * directive warning comment has been issued. */ - bool org_warn; + bool org_warn{false}; /** * The output_word instance variable is used to remember whether or not * the input bytes should be emitted as word. */ - bool output_word; + bool output_word{false}; /** * The emit_byte method is used to emit a single byte. It uses @@ -163,7 +163,7 @@ class output_file_asm: * ORG .org * PUBLIC .global */ - bool dot_style; + bool dot_style{false}; /** * The section_style instance variable is used to remember whether @@ -174,28 +174,29 @@ class output_file_asm: * tables of addresses and lengths are emitted, and the actual data * is intended to be relocated at run time. */ - bool section_style; + bool section_style{false}; /** * The hex_style is used to remember whether or not we are using * hexadecimal constants or decimal constants. */ - bool hex_style; + bool hex_style{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_asm(); + output_file_asm() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_asm(const output_file_asm &); + output_file_asm(const output_file_asm &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_asm &operator=(const output_file_asm &); + output_file_asm &operator=(const output_file_asm &) = delete; }; }; diff --git a/srecord/output/file/atmel_generic.cc b/srecord/output/file/atmel_generic.cc index 2c2347a1..2d1fbc25 100644 --- a/srecord/output/file/atmel_generic.cc +++ b/srecord/output/file/atmel_generic.cc @@ -20,12 +20,6 @@ #include #include - -srecord::output_file_atmel_generic::~output_file_atmel_generic() -{ -} - - srecord::output_file_atmel_generic::output_file_atmel_generic( const std::string &a_file_name, endian_t a_end diff --git a/srecord/output/file/atmel_generic.h b/srecord/output/file/atmel_generic.h index 6a967f91..1b9dd152 100644 --- a/srecord/output/file/atmel_generic.h +++ b/srecord/output/file/atmel_generic.h @@ -37,7 +37,7 @@ class output_file_atmel_generic: /** * The destructor. */ - virtual ~output_file_atmel_generic(); + ~output_file_atmel_generic() override = default; private: /** @@ -66,22 +66,22 @@ class output_file_atmel_generic: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -90,20 +90,22 @@ class output_file_atmel_generic: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_atmel_generic(); + output_file_atmel_generic() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_atmel_generic(const output_file_atmel_generic &); + output_file_atmel_generic(const output_file_atmel_generic &) = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_atmel_generic &operator=(const output_file_atmel_generic &); + output_file_atmel_generic &operator=( + const output_file_atmel_generic &) = delete; }; }; diff --git a/srecord/output/file/basic.cc b/srecord/output/file/basic.cc index d814f98b..cad731d3 100644 --- a/srecord/output/file/basic.cc +++ b/srecord/output/file/basic.cc @@ -46,11 +46,7 @@ srecord::output_file_basic::~output_file_basic() srecord::output_file_basic::output_file_basic(const std::string &a_file_name) : - srecord::output_file(a_file_name), - taddr(0), - column(0), - current_address(0), - line_length(75) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/basic.h b/srecord/output/file/basic.h index 28a925e5..a4ad0d72 100644 --- a/srecord/output/file/basic.h +++ b/srecord/output/file/basic.h @@ -37,7 +37,7 @@ class output_file_basic: /** * The destructor. */ - virtual ~output_file_basic(); + ~output_file_basic() override; private: /** @@ -61,29 +61,29 @@ class output_file_basic: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The taddr instance variable is used to remember the * termination address, to be emitted in the footer. */ - unsigned long taddr; + unsigned long taddr{0}; /** * The range instance variable is used to remember the range @@ -95,20 +95,20 @@ class output_file_basic: * The column instance variable is used to remember the current * printing column on the line. */ - int column; + int column{0}; /** * The current_address instance variable is used to remember * the current address that the file is positioned at. This is * used to know whether we need to add padding. */ - unsigned long current_address; + unsigned long current_address{0}; /** * The line_length instance variable is used to remember the * maximum line length. The output usually does not exceed it. */ - int line_length; + int line_length{75}; /** * The emit_byte method is used to emit a single byte. It uses @@ -116,20 +116,21 @@ class output_file_basic: */ void emit_byte(int); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_basic(); + output_file_basic() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_basic(const output_file_basic &); + output_file_basic(const output_file_basic &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_basic &operator=(const output_file_basic &); + output_file_basic &operator=(const output_file_basic &) = delete; }; }; diff --git a/srecord/output/file/binary.cc b/srecord/output/file/binary.cc index 8cba5003..9ae41dfc 100644 --- a/srecord/output/file/binary.cc +++ b/srecord/output/file/binary.cc @@ -20,12 +20,6 @@ #include #include - -srecord::output_file_binary::~output_file_binary() -{ -} - - srecord::output_file_binary::output_file_binary( const std::string &a_file_name ) : diff --git a/srecord/output/file/binary.h b/srecord/output/file/binary.h index d9848588..4ff10b31 100644 --- a/srecord/output/file/binary.h +++ b/srecord/output/file/binary.h @@ -36,7 +36,7 @@ class output_file_binary: /** * The destructor. */ - virtual ~output_file_binary(); + ~output_file_binary() override = default; private: /** @@ -60,41 +60,41 @@ class output_file_binary: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; -private: +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_binary(); + output_file_binary() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_binary(const output_file_binary &); + output_file_binary(const output_file_binary &) = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_binary &operator=(const output_file_binary &); + output_file_binary &operator=(const output_file_binary &) = delete; }; }; diff --git a/srecord/output/file/brecord.cc b/srecord/output/file/brecord.cc index 2ab9d0e7..ca488135 100644 --- a/srecord/output/file/brecord.cc +++ b/srecord/output/file/brecord.cc @@ -22,12 +22,6 @@ #include #include - -srecord::output_file_brecord::~output_file_brecord() -{ -} - - srecord::output_file_brecord::output_file_brecord( const std::string &a_file_name ) : diff --git a/srecord/output/file/brecord.h b/srecord/output/file/brecord.h index 717f5463..0f0b4153 100644 --- a/srecord/output/file/brecord.h +++ b/srecord/output/file/brecord.h @@ -36,7 +36,7 @@ class output_file_brecord: /** * The destructor. */ - virtual ~output_file_brecord(); + ~output_file_brecord() override = default; private: /** @@ -61,41 +61,42 @@ class output_file_brecord: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: enum { BUFFER_MAXIMUM_MAXIMUM = 31 }; unsigned block_size; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_brecord(); + output_file_brecord() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_brecord(const output_file_brecord &); + output_file_brecord(const output_file_brecord &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_brecord &operator=(const output_file_brecord &); + output_file_brecord &operator=(const output_file_brecord &) = delete; }; }; diff --git a/srecord/output/file/c.cc b/srecord/output/file/c.cc index b40a967d..f0c720de 100644 --- a/srecord/output/file/c.cc +++ b/srecord/output/file/c.cc @@ -440,21 +440,7 @@ build_include_file_name(const std::string &filename) srecord::output_file_c::output_file_c(const std::string &a_file_name) : srecord::output_file(a_file_name), - prefix("eprom"), - header_prefix(""), - header_postfix(""), - taddr(0), - header_done(false), - column(0), - current_address(0), - line_length(75), - address_length(4), - constant(true), - include(false), - include_file_name(build_include_file_name(a_file_name)), - output_word(false), - hex_style(true), - section_style(false) + include_file_name(build_include_file_name(a_file_name)) { } diff --git a/srecord/output/file/c.h b/srecord/output/file/c.h index faab28fe..d04138c5 100644 --- a/srecord/output/file/c.h +++ b/srecord/output/file/c.h @@ -38,7 +38,7 @@ class output_file_c: /** * The destructor. */ - virtual ~output_file_c(); + ~output_file_c() override; private: /** @@ -63,32 +63,32 @@ class output_file_c: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The prefix instance variable is used to remember the variable * name prefix to be used in the output. */ - std::string prefix; + std::string prefix{"eprom"}; /** * The prefix instance variable is used to remember the definition @@ -106,7 +106,7 @@ class output_file_c: * The taddr instance variable is used to remember the * termination address, to be emitted in the footer. */ - unsigned long taddr; + unsigned long taddr{0}; /** * The range instance variable is used to remember the range @@ -118,44 +118,44 @@ class output_file_c: * The header_done instance variable is used t remember whether * the emit_header method has been called. */ - bool header_done; + bool header_done{false}; /** * The column instance variable is used to remember the current * printing column on the line. */ - int column; + int column{0}; /** * The current_address instance variable is used to remember * the current address that the file is positioned at. This is * used to know whether we need to add padding. */ - unsigned long current_address; + unsigned long current_address{0}; /** * The line_length instance variable is used to remember the * maximum line length. The output usually does not exceed it. */ - int line_length; + int line_length{75}; /** * The address_length instance variable is used to remember how * many bytes to emit when emitting addresses. */ - int address_length; + int address_length{4}; /** * The constant instance variable is used to remember whether or * not to use the "const" keyword. */ - bool constant; + bool constant{true}; /** * The include instance variable is used to remember whether or not * to generate an include file. */ - bool include; + bool include{false}; /** * The include_file_name instance variable is used to remember the @@ -167,14 +167,14 @@ class output_file_c: * The output_word instance variable is used to remember whether or not * the input bytes should be emitted as word. */ - bool output_word; + bool output_word{false}; /** * The hex_style instance variable is used to remember whether or * not we are to output number in hexadecimal (true) or decimal * (false). */ - bool hex_style; + bool hex_style{true}; /** * The section_style instance variable is used to remember whether @@ -185,7 +185,7 @@ class output_file_c: * and lengths are emitted, and the actual data is intended to be * relocated at run time. */ - bool section_style; + bool section_style{false}; /** * The emit_header method is used to emit the initial portion @@ -215,20 +215,21 @@ class output_file_c: */ std::string format_address(unsigned long addr) const; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_c(); + output_file_c() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_c(const output_file_c &); + output_file_c(const output_file_c &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_c &operator=(const output_file_c &); + output_file_c &operator=(const output_file_c &) = delete; }; }; diff --git a/srecord/output/file/coe.cc b/srecord/output/file/coe.cc index 743269ac..6461b1c8 100644 --- a/srecord/output/file/coe.cc +++ b/srecord/output/file/coe.cc @@ -43,16 +43,7 @@ srecord::output_file_coe::~output_file_coe() srecord::output_file_coe::output_file_coe(const std::string &a_file_name) : - srecord::output_file(a_file_name), - address(0), - column(0), - depth(0), - width(8), - width_in_bytes(1), - actual_depth(0), - header_done(false), - pref_blk_sz(32), - got_data(false) + srecord::output_file(a_file_name) { line_length_set(80); } diff --git a/srecord/output/file/coe.h b/srecord/output/file/coe.h index b94c56c3..803d754a 100644 --- a/srecord/output/file/coe.h +++ b/srecord/output/file/coe.h @@ -35,7 +35,7 @@ class output_file_coe: /** * The destructor. */ - virtual ~output_file_coe(); + ~output_file_coe() override; private: /** @@ -60,28 +60,28 @@ class output_file_coe: protected: // See base class for documentation - void write(const record &); + void write(const record &) override; // See base class for documentation - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - void notify_upper_bound(unsigned long addr); + void notify_upper_bound(unsigned long addr) override; private: /** @@ -89,50 +89,44 @@ class output_file_coe: * memory address to be written. This is also used to detect holes * in the input data. */ - unsigned long address; - - /** - * The column instance variable is used to remember the output text - * column. This is used to know when ti wrap lines. - */ - int column; + unsigned long address{0}; /** * The depth instance variable is used to remember how many bytes * of data there is. Kind of broken, because we don't know this * when the header is actually printed. */ - unsigned long depth; + unsigned long depth{0}; /** * The width instance variable is used to remember how many bits * there are per data item. Default to 8 (traditional bytes). */ - unsigned width; + unsigned width{8}; /** * The width_in_bytes instance variable is used to remember how * many bytes there are per data item. Defaults to 1. */ - unsigned width_in_bytes; + unsigned width_in_bytes{1}; /** * The actual_depth instance variable is used to remember how many * bytes of data there were. This is printed in the footer. */ - unsigned long actual_depth; + unsigned long actual_depth{0}; /** * The header_done instance variable is used to remember whether * the emit_header method has already been called. */ - bool header_done; + bool header_done{false}; /** * The pref_blk_sz instance variable is used to remember the * preferred block size, in bytes. */ - int pref_blk_sz; + int pref_blk_sz{32}; /** * The emit_header method is used to emit the file header, @@ -146,22 +140,23 @@ class output_file_coe: * with commas, but to suppress the first comma before the first * data. */ - bool got_data; + bool got_data{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_coe(); + output_file_coe() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_coe(const output_file_coe &); + output_file_coe(const output_file_coe &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_coe &operator=(const output_file_coe &); + output_file_coe &operator=(const output_file_coe &) = delete; }; }; diff --git a/srecord/output/file/cosmac.cc b/srecord/output/file/cosmac.cc index dd1803f7..e68e5b2d 100644 --- a/srecord/output/file/cosmac.cc +++ b/srecord/output/file/cosmac.cc @@ -20,20 +20,10 @@ #include #include -srecord::output_file_cosmac::~output_file_cosmac() -{ -} - - srecord::output_file_cosmac::output_file_cosmac( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(0), - address_length(4), - line_length(80), - column(0), - header_required(true) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/cosmac.h b/srecord/output/file/cosmac.h index e8618fc4..cd361fdb 100644 --- a/srecord/output/file/cosmac.h +++ b/srecord/output/file/cosmac.h @@ -36,7 +36,7 @@ class output_file_cosmac: /** * The destructor. */ - virtual ~output_file_cosmac(); + ~output_file_cosmac() override = default; private: /** @@ -60,69 +60,70 @@ class output_file_cosmac: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The address instance variable is used to remember the current * output address, so that file size can be optimized. */ - unsigned long address; + unsigned long address{0}; /** * The address_length is used to remember the preferred number of * characters used to represent an address in the output file. * Defaults to 4 characters. */ - unsigned address_length; + unsigned address_length{4}; /** * The line_length instance variable is used to remember the maximum * line length of the output. Defaults to 80 characters. */ - unsigned line_length; + unsigned line_length{80}; /** * The column instance variable is used to remember which output * column the current output position is on. */ - unsigned column; + unsigned column{0}; /** * The header_required instance variable is used to remember whether * or not the header (the !M command) has been issued, or not. */ - bool header_required; + bool header_required{true}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_cosmac(); + output_file_cosmac() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_cosmac(const output_file_cosmac &); + output_file_cosmac(const output_file_cosmac &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_cosmac &operator=(const output_file_cosmac &); + output_file_cosmac &operator=(const output_file_cosmac &) = delete; }; }; diff --git a/srecord/output/file/dec_binary.cc b/srecord/output/file/dec_binary.cc index 8c3950c8..d35dc4b9 100644 --- a/srecord/output/file/dec_binary.cc +++ b/srecord/output/file/dec_binary.cc @@ -35,8 +35,7 @@ srecord::output_file_dec_binary::~output_file_dec_binary() srecord::output_file_dec_binary::output_file_dec_binary( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - pref_block_size(preferred_block_size_calculate()) + srecord::output_file(a_file_name) { if (line_termination == line_termination_native) line_termination = line_termination_binary; @@ -160,29 +159,6 @@ srecord::output_file_dec_binary::preferred_block_size_get() } -int -srecord::output_file_dec_binary::preferred_block_size_calculate() -{ -#if 0 - // - // Because we don't cross BLOCK_SIZE boundaries, we need a number - // less than srecord::record::max_data_length that, when you add 7 - // and double, gives - // - int max = BLOCK_SIZE; - for (;;) - { - if (max - 7 <= srecord::record::max_data_length) - return (max - 7); - max >>= 1; - } - return 1; -#else - return srecord::record::max_data_length; -#endif -} - - const char * srecord::output_file_dec_binary::format_name() const diff --git a/srecord/output/file/dec_binary.h b/srecord/output/file/dec_binary.h index fd680f3d..1af38fad 100644 --- a/srecord/output/file/dec_binary.h +++ b/srecord/output/file/dec_binary.h @@ -22,6 +22,8 @@ #include +#include + namespace srecord { @@ -36,7 +38,7 @@ class output_file_dec_binary: /** * The destructor. */ - virtual ~output_file_dec_binary(); + ~output_file_dec_binary() override; private: /** @@ -62,25 +64,25 @@ class output_file_dec_binary: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** @@ -89,41 +91,36 @@ class output_file_dec_binary: * method also tracks the byte_offset, so that we can align to * specific boundaries. Calls the checksum_add() method. */ - void put_byte(unsigned char); + void put_byte(unsigned char) override; /** * The byte_offset instance variable is used to track the location * in the output file. Maintained by the put_byte() method. */ - unsigned long byte_offset; + unsigned long byte_offset{}; /** * The pref_block_size is used to remember the preferred * block size. Set by the constructor. Read by the * preferred_block_size_get() method. */ - int pref_block_size; - - /** - * The preferred_block_size_calculate method is used to determine - * the best block size to pack into 512 byte blocks. - */ - static int preferred_block_size_calculate(); + int pref_block_size{srecord::record::max_data_length}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_dec_binary(); + output_file_dec_binary() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_dec_binary(const output_file_dec_binary &); + output_file_dec_binary(const output_file_dec_binary &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_dec_binary &operator=(const output_file_dec_binary &); + output_file_dec_binary &operator=(const output_file_dec_binary &) = delete; }; }; diff --git a/srecord/output/file/emon52.cc b/srecord/output/file/emon52.cc index ec6d9dfd..38639380 100644 --- a/srecord/output/file/emon52.cc +++ b/srecord/output/file/emon52.cc @@ -21,17 +21,10 @@ #include -srecord::output_file_emon52::~output_file_emon52() -{ - // check for termination record -} - - srecord::output_file_emon52::output_file_emon52( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - pref_block_size(16) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/emon52.h b/srecord/output/file/emon52.h index 384417fc..c8ccaad4 100644 --- a/srecord/output/file/emon52.h +++ b/srecord/output/file/emon52.h @@ -36,7 +36,7 @@ class output_file_emon52: /** * The destructor. */ - virtual ~output_file_emon52(); + ~output_file_emon52() = default; private: /** @@ -62,22 +62,22 @@ class output_file_emon52: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -85,7 +85,7 @@ class output_file_emon52: * size. Set by the line_length_set() method. Read by the * preferred_block_size_get() method. */ - int pref_block_size; + int pref_block_size{16}; /** * The write_inner method is used to write a single line (record) @@ -94,20 +94,21 @@ class output_file_emon52: void write_inner(int type, unsigned long addr, int addr_len, const void *data, int data_len); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_emon52(); + output_file_emon52() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_emon52(const output_file_emon52 &); + output_file_emon52(const output_file_emon52 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_emon52 &operator=(const output_file_emon52 &); + output_file_emon52 &operator=(const output_file_emon52 &) = delete; }; }; diff --git a/srecord/output/file/fairchild.cc b/srecord/output/file/fairchild.cc index c00ce243..486e8614 100644 --- a/srecord/output/file/fairchild.cc +++ b/srecord/output/file/fairchild.cc @@ -21,16 +21,10 @@ #include -srecord::output_file_fairchild::~output_file_fairchild() -{ -} - - srecord::output_file_fairchild::output_file_fairchild( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(~0UL) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/fairchild.h b/srecord/output/file/fairchild.h index 635a70da..1bece89c 100644 --- a/srecord/output/file/fairchild.h +++ b/srecord/output/file/fairchild.h @@ -36,7 +36,7 @@ class output_file_fairchild: /** * The destructor. */ - virtual ~output_file_fairchild(); + ~output_file_fairchild() override = default; private: /** @@ -60,22 +60,22 @@ class output_file_fairchild: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -90,28 +90,29 @@ class output_file_fairchild: * We override the one in the base class because the checksum is * nibble-based, not byte-based. */ - void put_byte(unsigned char); + void put_byte(unsigned char) override; /** * The address instance variable is used to remember the current * memory position within the output. */ - unsigned long address; + unsigned long address{~0UL}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_fairchild(); + output_file_fairchild() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_fairchild(const output_file_fairchild &); + output_file_fairchild(const output_file_fairchild &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_fairchild &operator=(const output_file_fairchild &); + output_file_fairchild &operator=(const output_file_fairchild &) = delete; }; }; diff --git a/srecord/output/file/fastload.cc b/srecord/output/file/fastload.cc index 40891c19..10c9f192 100644 --- a/srecord/output/file/fastload.cc +++ b/srecord/output/file/fastload.cc @@ -41,13 +41,7 @@ srecord::output_file_fastload::~output_file_fastload() srecord::output_file_fastload::output_file_fastload( const std::string &a_filename ) : - srecord::output_file(a_filename), - line_length(0), - address(~0UL), - column(0), - bytes_since_checksum(0), - max_since_checksum(0), - prev_was_command(false) + srecord::output_file(a_filename) { line_length_set(80); } diff --git a/srecord/output/file/fastload.h b/srecord/output/file/fastload.h index 3455bb89..d1acb57a 100644 --- a/srecord/output/file/fastload.h +++ b/srecord/output/file/fastload.h @@ -36,7 +36,7 @@ class output_file_fastload: /** * The destructor. */ - virtual ~output_file_fastload(); + ~output_file_fastload() override; private: /** @@ -63,48 +63,48 @@ class output_file_fastload: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The line_length instance variable is used to remember the * preferred line length for the output. */ - int line_length; + int line_length{0}; /** * The address instance variable is used to track the current * address location within the file. */ - unsigned long address; + unsigned long address{~0UL}; /** * The column instance variable is used to track the current output * column, to ensure that the lines don't exceed 80 characters. */ - int column; + int column{0}; /** * The bytes_since_checksum instance variable is used to track how * many bytes have ben emitted since the last checksum was issued. * Don't leave it too long, or the checksum isn't any use. */ - int bytes_since_checksum; + int bytes_since_checksum{0}; /** * The max_since_checksum instance variable is used to remember how @@ -112,14 +112,14 @@ class output_file_fastload: * such a way as to minimize line length. There is no point going * over 256 bytes, because it's a simple 16-bit additive sum. */ - int max_since_checksum; + int max_since_checksum{0}; /** * The prev_was_command instance variable is used to track that was * last output, because a newline must be thrown between commands * and data, but not at any other time. */ - bool prev_was_command; + bool prev_was_command{false}; /** * The write_inner method is used to write a single line (record) @@ -140,20 +140,21 @@ class output_file_fastload: */ void put_command(int c, unsigned long n, int ndigits); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_fastload(); + output_file_fastload() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_fastload(const output_file_fastload &); + output_file_fastload(const output_file_fastload &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_fastload &operator=(const output_file_fastload &); + output_file_fastload &operator=(const output_file_fastload &) = delete; }; }; diff --git a/srecord/output/file/formatted_binary.cc b/srecord/output/file/formatted_binary.cc index 3349b40e..3fa181c8 100644 --- a/srecord/output/file/formatted_binary.cc +++ b/srecord/output/file/formatted_binary.cc @@ -37,10 +37,7 @@ srecord::output_file_formatted_binary::~output_file_formatted_binary() srecord::output_file_formatted_binary::output_file_formatted_binary( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - upper_bound(0), - address(0), - check_sum(0) + srecord::output_file(a_file_name) { if (line_termination == line_termination_native) line_termination = line_termination_binary; diff --git a/srecord/output/file/formatted_binary.h b/srecord/output/file/formatted_binary.h index 691a71e3..a3d8e4db 100644 --- a/srecord/output/file/formatted_binary.h +++ b/srecord/output/file/formatted_binary.h @@ -36,7 +36,7 @@ class output_file_formatted_binary: /** * The destructor. */ - virtual ~output_file_formatted_binary(); + ~output_file_formatted_binary() override; private: /** @@ -60,63 +60,64 @@ class output_file_formatted_binary: protected: // See base class for documentation. - void notify_upper_bound(long unsigned); + void notify_upper_bound(long unsigned) override; // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** * The upper_bound instance variable is used to remember the upper * bound of memory addresses (maximum address plus one). */ - unsigned long upper_bound; + unsigned long upper_bound{0}; /** * The address instance variable is used to remember the current * output address, to know if padding is required. */ - unsigned long address; + unsigned long address{0}; /** * The check_sum instance variable is used to remember the running * sum of data bytes written to date. */ - unsigned short check_sum; + unsigned short check_sum{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_formatted_binary(); + output_file_formatted_binary() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_formatted_binary(const output_file_formatted_binary &); + output_file_formatted_binary(const output_file_formatted_binary &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ output_file_formatted_binary &operator=( - const output_file_formatted_binary &); + const output_file_formatted_binary &) = delete; }; }; diff --git a/srecord/output/file/forth.cc b/srecord/output/file/forth.cc index ab08697e..8d7aff64 100644 --- a/srecord/output/file/forth.cc +++ b/srecord/output/file/forth.cc @@ -31,8 +31,7 @@ srecord::output_file_forth::~output_file_forth() srecord::output_file_forth::output_file_forth( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - store_cmd("C!") + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/forth.h b/srecord/output/file/forth.h index fb7833f4..ec4f4963 100644 --- a/srecord/output/file/forth.h +++ b/srecord/output/file/forth.h @@ -36,7 +36,7 @@ class output_file_forth: /** * The destructor. */ - virtual ~output_file_forth(); + ~output_file_forth() override; private: /** @@ -60,31 +60,31 @@ class output_file_forth: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The FORTH store command to use. Either C! for RAM or EEC! for EEPROM */ - std::string store_cmd; + std::string store_cmd{"C!"}; /** * The emit_end_of_file method is used to write the ETX and @@ -93,20 +93,21 @@ class output_file_forth: */ void emit_end_of_file(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_forth(); + output_file_forth() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_forth(const output_file_forth &); + output_file_forth(const output_file_forth &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_forth &operator=(const output_file_forth &); + output_file_forth &operator=(const output_file_forth &) = delete; }; }; diff --git a/srecord/output/file/four_packed_code.cc b/srecord/output/file/four_packed_code.cc index 40648887..0fefd9a6 100644 --- a/srecord/output/file/four_packed_code.cc +++ b/srecord/output/file/four_packed_code.cc @@ -120,10 +120,7 @@ srecord::output_file_four_packed_code::~output_file_four_packed_code() srecord::output_file_four_packed_code::output_file_four_packed_code( const std::string &a_file_name): - srecord::output_file(a_file_name), - pref_block_size(32), - put_byte_pos(0), - put_byte_value(0) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/four_packed_code.h b/srecord/output/file/four_packed_code.h index a5a190ba..4e1af02e 100644 --- a/srecord/output/file/four_packed_code.h +++ b/srecord/output/file/four_packed_code.h @@ -36,7 +36,7 @@ class output_file_four_packed_code: /** * The destructor. */ - virtual ~output_file_four_packed_code(); + ~output_file_four_packed_code() override; private: /** @@ -61,22 +61,22 @@ class output_file_four_packed_code: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -85,14 +85,14 @@ class output_file_four_packed_code: * preferred_block_size_get method. Set by the line_length_set * method. */ - int pref_block_size; + int pref_block_size{32}; /** * The put_byte_pos instance variable is used by the put_byte * method to remember where we are positioned within each * 4-byte chunk. */ - unsigned put_byte_pos; + unsigned put_byte_pos{0}; /** * The put_byte_value instance variable is used by the put_byte @@ -100,7 +100,7 @@ class output_file_four_packed_code: * At the end of 4 bytes, the 5-character base85 encoding * is issued. */ - unsigned long put_byte_value; + unsigned long put_byte_value{0}; /** * The write_inner method is used by the write method to @@ -113,23 +113,24 @@ class output_file_four_packed_code: * See base class for documentation. We over-ride this method * so that we can do the base85 encoding of each 4-byte chunk. */ - void put_byte(unsigned char); + void put_byte(unsigned char) override; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_four_packed_code(); + output_file_four_packed_code() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_four_packed_code(const output_file_four_packed_code &); + output_file_four_packed_code(const output_file_four_packed_code &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ output_file_four_packed_code &operator=( - const output_file_four_packed_code &); + const output_file_four_packed_code &) = delete; }; }; diff --git a/srecord/output/file/hexdump.cc b/srecord/output/file/hexdump.cc index a5e25755..6c4511ca 100644 --- a/srecord/output/file/hexdump.cc +++ b/srecord/output/file/hexdump.cc @@ -33,13 +33,7 @@ srecord::output_file_hexdump::~output_file_hexdump() srecord::output_file_hexdump::output_file_hexdump( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - number_of_columns(0), - row_cache_address((unsigned long)-1), - row_cache_address_mask(0), - row_cache_size(0), - row_cache(0), - address_length(4) + srecord::output_file(a_file_name) { line_length_set(80); } diff --git a/srecord/output/file/hexdump.h b/srecord/output/file/hexdump.h index 4956f2fc..f8f7e9af 100644 --- a/srecord/output/file/hexdump.h +++ b/srecord/output/file/hexdump.h @@ -36,7 +36,7 @@ class output_file_hexdump: /** * The destructor. */ - virtual ~output_file_hexdump(); + ~output_file_hexdump() override; private: /** @@ -61,25 +61,25 @@ class output_file_hexdump: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -87,7 +87,7 @@ class output_file_hexdump: * many columns of hex bytes to display on a single line. It is * always a power of two. */ - int number_of_columns; + int number_of_columns{0}; /** * The row_cache_address instance variable is used to remember @@ -95,33 +95,33 @@ class output_file_hexdump: * address of the beginning of the row, NOT the current byte. * The lower "number_of_columns" bits are always zero. */ - unsigned long row_cache_address; + unsigned long row_cache_address{(unsigned long)-1}; /** * The row_cache_address_mask instance variable is used to remember * the mask to calculate the column within the output line, give a * byte address. */ - unsigned long row_cache_address_mask; + unsigned long row_cache_address_mask{0}; /** * The row_cache_size instance variable is used to remember the * number of printing columns wide the output is. */ - size_t row_cache_size; + size_t row_cache_size{0}; /** * The row_cache instance variable is used to remember the text of * the line to be printed. It contains ASCII hex representations * of the bytes "written" to this output. */ - char *row_cache; + char *row_cache{nullptr}; /** * The address_length instance variable is used to remember how * many bytes to emit when emitting addresses. */ - int address_length; + int address_length{4}; /** * The emit_byte method is used to emit a single byte. It uses @@ -140,20 +140,21 @@ class output_file_hexdump: */ int columns_to_line_length(int cols) const; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_hexdump(); + output_file_hexdump() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_hexdump(const output_file_hexdump &); + output_file_hexdump(const output_file_hexdump &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_hexdump &operator=(const output_file_hexdump &); + output_file_hexdump &operator=(const output_file_hexdump &) = delete; }; }; diff --git a/srecord/output/file/idt.cc b/srecord/output/file/idt.cc index a1623711..723ad980 100644 --- a/srecord/output/file/idt.cc +++ b/srecord/output/file/idt.cc @@ -29,11 +29,7 @@ srecord::output_file_idt::~output_file_idt() srecord::output_file_idt::output_file_idt( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - data_count(0), - pref_block_size(128), - address_length(4), - data_count_written(false) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/idt.h b/srecord/output/file/idt.h index 85e519e2..84175be7 100644 --- a/srecord/output/file/idt.h +++ b/srecord/output/file/idt.h @@ -39,7 +39,7 @@ class output_file_idt: /** * The destructor. */ - virtual ~output_file_idt(); + ~output_file_idt() override; /** * The create class method is used to create new dynamically @@ -53,25 +53,25 @@ class output_file_idt: protected: // See base class for documentation. - void write(const record &rec); + void write(const record &rec) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int nbytes); + void address_length_set(int nbytes) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** @@ -88,20 +88,20 @@ class output_file_idt: * number of output data lines have occurred to date. This is used * at the end of the file to emit an S5 record. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The pref_block_size instance variable is used to remember the * preferred number of data bytes (NOT encoded hex characters) to * be placed in each output line. */ - int pref_block_size; + int pref_block_size{128}; /** * The address_length instance variable is used to remember the * minimum number of address bytes to be emitted into output lines. */ - int address_length; + int address_length{4}; /** * The data_count_written instance variable is used to remember @@ -110,7 +110,7 @@ class output_file_idt: * are circumstances where it will be needed when the file is * closed. */ - bool data_count_written; + bool data_count_written{false}; /** * The write_data_count method is used to write out a data count @@ -136,23 +136,24 @@ class output_file_idt: void write_inner(int tag, unsigned long address, unsigned address_nbytes, const unsigned char *data, size_t data_nbytes); +public: /** * The default constructor. * Do not use. */ - output_file_idt(); + output_file_idt() = delete; /** * The copy constructor. * Do not use. */ - output_file_idt(const output_file_idt &); + output_file_idt(const output_file_idt &) = delete; /** * The assignment operator. * Do not use. */ - output_file_idt &operator=(const output_file_idt &); + output_file_idt &operator=(const output_file_idt &) = delete; }; }; diff --git a/srecord/output/file/intel.cc b/srecord/output/file/intel.cc index b159e9fc..0e0e5d06 100644 --- a/srecord/output/file/intel.cc +++ b/srecord/output/file/intel.cc @@ -29,10 +29,7 @@ srecord::output_file_intel::~output_file_intel() srecord::output_file_intel::output_file_intel(const std::string &a_file_name) : - srecord::output_file(a_file_name), - address_base(0), - pref_block_size(32), - mode(mode_linear) + srecord::output_file(a_file_name) { // The address base always has the lower 16 bits set to zero. // By making it be 1, we force the first data record to emit an diff --git a/srecord/output/file/intel.h b/srecord/output/file/intel.h index 652b6dec..9fe941ca 100644 --- a/srecord/output/file/intel.h +++ b/srecord/output/file/intel.h @@ -36,7 +36,7 @@ class output_file_intel: /** * The destructor. */ - virtual ~output_file_intel(); + ~output_file_intel() override; private: /** @@ -61,22 +61,22 @@ class output_file_intel: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -89,13 +89,13 @@ class output_file_intel: * The address_base instance variable is used to remember the * current position within the output file */ - unsigned long address_base; + unsigned long address_base{0}; /** * The pref_block_size instance variable is used to remember the * preferred number of bytes on each line of the output file. */ - int pref_block_size; + int pref_block_size{32}; enum mode_t { @@ -112,22 +112,23 @@ class output_file_intel: * "linear" gets you 32-bit output (record type 4, extended linear * address record). */ - mode_t mode; + mode_t mode{mode_linear}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_intel(); + output_file_intel() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_intel(const output_file_intel &); + output_file_intel(const output_file_intel &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_intel &operator=(const output_file_intel &); + output_file_intel &operator=(const output_file_intel &) = delete; }; }; diff --git a/srecord/output/file/intel16.cc b/srecord/output/file/intel16.cc index 6ec2101d..e0768ee6 100644 --- a/srecord/output/file/intel16.cc +++ b/srecord/output/file/intel16.cc @@ -31,9 +31,7 @@ srecord::output_file_intel16::~output_file_intel16() srecord::output_file_intel16::output_file_intel16( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address_base(0), - pref_block_size(32) + srecord::output_file(a_file_name) { // The address base always has the lower 16 bits set to zero. // By making it be 1, we force the first data record to emit an diff --git a/srecord/output/file/intel16.h b/srecord/output/file/intel16.h index d7d2dc5c..c6459a12 100644 --- a/srecord/output/file/intel16.h +++ b/srecord/output/file/intel16.h @@ -36,7 +36,7 @@ class output_file_intel16: /** * The destructor. */ - virtual ~output_file_intel16(); + ~output_file_intel16() override; private: /** @@ -61,22 +61,22 @@ class output_file_intel16: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -89,28 +89,29 @@ class output_file_intel16: * The address_base instance variable is used to remember the * current position within the output file */ - unsigned long address_base; + unsigned long address_base{0}; /** * The pref_block_size instance variable is used to remember the * preferred number of bytes on each line of the output file. */ - int pref_block_size; + int pref_block_size{32}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_intel16(); + output_file_intel16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_intel16(const output_file_intel16 &); + output_file_intel16(const output_file_intel16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_intel16 &operator=(const output_file_intel16 &); + output_file_intel16 &operator=(const output_file_intel16 &) = delete; }; }; diff --git a/srecord/output/file/logisim.cc b/srecord/output/file/logisim.cc index 29ec9bf1..f8f2d47e 100644 --- a/srecord/output/file/logisim.cc +++ b/srecord/output/file/logisim.cc @@ -34,10 +34,7 @@ srecord::output_file_logisim::~output_file_logisim() srecord::output_file_logisim::output_file_logisim( const std::string &a_file_name ) : - output_file(a_file_name), - address(0), - line_length(80), - column(0) + output_file(a_file_name) { put_string("v2.0 raw\n\n"); } diff --git a/srecord/output/file/logisim.h b/srecord/output/file/logisim.h index 4000cbe7..c527c038 100644 --- a/srecord/output/file/logisim.h +++ b/srecord/output/file/logisim.h @@ -34,7 +34,7 @@ class output_file_logisim: /** * The destructor. */ - virtual ~output_file_logisim(); + ~output_file_logisim() override; /** * The create class method is used to create new dynamically @@ -47,22 +47,22 @@ class output_file_logisim: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -71,29 +71,30 @@ class output_file_logisim: */ output_file_logisim(const std::string &file_name); - long address; - int line_length; - int column; + long address{0}; + int line_length{80}; + int column{0}; void emit(int count, int value); +public: /** * The default constructor. * Do not use. */ - output_file_logisim(); + output_file_logisim() = delete; /** * The copy constructor. * Do not use. */ - output_file_logisim(const output_file_logisim &rhs); + output_file_logisim(const output_file_logisim &rhs) = delete; /** * The assignment operator. * Do not use. */ - output_file_logisim &operator=(const output_file_logisim &rhs); + output_file_logisim &operator=(const output_file_logisim &rhs) = delete; }; }; diff --git a/srecord/output/file/mem.cc b/srecord/output/file/mem.cc index 08e62b98..559c4635 100644 --- a/srecord/output/file/mem.cc +++ b/srecord/output/file/mem.cc @@ -33,15 +33,7 @@ srecord::output_file_mem::~output_file_mem() srecord::output_file_mem::output_file_mem(const std::string &a_file_name) : - srecord::output_file(a_file_name), - address(0), - column(0), - depth(0), - width(8), - width_in_bytes(1), - actual_depth(0), - header_done(false), - pref_blk_sz(32) + srecord::output_file(a_file_name) { line_length_set(80); } diff --git a/srecord/output/file/mem.h b/srecord/output/file/mem.h index 3423e6c3..2c83da35 100644 --- a/srecord/output/file/mem.h +++ b/srecord/output/file/mem.h @@ -35,7 +35,7 @@ class output_file_mem: /** * The destructor. */ - virtual ~output_file_mem(); + ~output_file_mem() override; private: /** @@ -60,28 +60,28 @@ class output_file_mem: protected: // See base class for documentation - void write(const record &); + void write(const record &) override; // See base class for documentation - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - void notify_upper_bound(unsigned long addr); + void notify_upper_bound(unsigned long addr) override; private: /** @@ -89,50 +89,50 @@ class output_file_mem: * memory address to be written. This is also used to detect holes * in the input data. */ - unsigned long address; + unsigned long address{0}; /** * The column instance variable is used to remember the output text * column. This is used to know when ti wrap lines. */ - int column; + int column{0}; /** * The depth instance variable is used to remember how many bytes * of data there is. Kind of broken, because we don't know this * when the header is actually printed. */ - unsigned long depth; + unsigned long depth{0}; /** * The width instance variable is used to remember how many bits * there are per data item. Default to 8 (traditional bytes). */ - unsigned width; + unsigned width{8}; /** * The width_in_bytes instance variable is used to remember how * many bytes there are per data item. Defaults to 1. */ - unsigned width_in_bytes; + unsigned width_in_bytes{1}; /** * The actual_depth instance variable is used to remember how many * bytes of data there were. This is printed in the footer. */ - unsigned long actual_depth; + unsigned long actual_depth{0}; /** * The header_done instance variable is used to remember whether * the emit_header method has already been called. */ - bool header_done; + bool header_done{false}; /** * The pref_blk_sz instance variable is used to remember the * preferred block size, in bytes. */ - int pref_blk_sz; + int pref_blk_sz{32}; /** * The emit_header method is used to emit the file header, @@ -140,20 +140,21 @@ class output_file_mem: */ void emit_header(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_mem(); + output_file_mem() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_mem(const output_file_mem &); + output_file_mem(const output_file_mem &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_mem &operator=(const output_file_mem &); + output_file_mem &operator=(const output_file_mem &) = delete; }; }; diff --git a/srecord/output/file/mif.cc b/srecord/output/file/mif.cc index ffe1c2b0..4783c3f5 100644 --- a/srecord/output/file/mif.cc +++ b/srecord/output/file/mif.cc @@ -32,13 +32,7 @@ srecord::output_file_mif::~output_file_mif() srecord::output_file_mif::output_file_mif(const std::string &a_file_name) : - srecord::output_file(a_file_name), - depth(65536), - width(8), - width_in_bytes(1), - actual_depth(0), - header_done(false), - pref_blk_sz(32) + srecord::output_file(a_file_name) { line_length_set(80); } diff --git a/srecord/output/file/mif.h b/srecord/output/file/mif.h index d5cdbb40..a157210c 100644 --- a/srecord/output/file/mif.h +++ b/srecord/output/file/mif.h @@ -35,7 +35,7 @@ class output_file_mif: /** * The destructor. */ - virtual ~output_file_mif(); + ~output_file_mif() override; private: /** @@ -60,28 +60,28 @@ class output_file_mif: protected: // See base class for documentation - void write(const record &); + void write(const record &) override; // See base class for documentation - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - void notify_upper_bound(unsigned long addr); + void notify_upper_bound(unsigned long addr) override; private: /** @@ -89,37 +89,37 @@ class output_file_mif: * of data there is. Kind of broken, because we don't know this * when the header is actually printed. */ - unsigned long depth; + unsigned long depth{65536}; /** * The width instance variable is used to remember how many bits * there are per data item. Default to 8 (traditional bytes). */ - unsigned width; + unsigned width{8}; /** * The width_in_bytes instance variable is used to remember how * many bytes there are per data item. Defaults to 1. */ - unsigned width_in_bytes; + unsigned width_in_bytes{1}; /** * The actual_depth instance variable is used to remember how many * bytes of data there were. This is printed in the footer. */ - unsigned long actual_depth; + unsigned long actual_depth{0}; /** * The header_done instance variable is used to remember whether * the emit_header method has already been called. */ - bool header_done; + bool header_done{false}; /** * The pref_blk_sz instance variable is used to remember the * preferred block size, in bytes. */ - int pref_blk_sz; + int pref_blk_sz{32}; /** * The emit_header method is used to emit the file header, @@ -127,20 +127,21 @@ class output_file_mif: */ void emit_header(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_mif(); + output_file_mif() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_mif(const output_file_mif &); + output_file_mif(const output_file_mif &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_mif &operator=(const output_file_mif &); + output_file_mif &operator=(const output_file_mif &) = delete; }; }; diff --git a/srecord/output/file/mips_flash.cc b/srecord/output/file/mips_flash.cc index fb60f7fc..2f2d0126 100644 --- a/srecord/output/file/mips_flash.cc +++ b/srecord/output/file/mips_flash.cc @@ -50,13 +50,7 @@ srecord::output_file_mips_flash::output_file_mips_flash( endian_t a_endian ) : srecord::output_file(a_filename), - endian(a_endian), - address(0), - base(0), - base_set(false), - buffer_length(0), - line_length(80), - column(0) + endian(a_endian) { } diff --git a/srecord/output/file/mips_flash.h b/srecord/output/file/mips_flash.h index c88ddf37..7513df2c 100644 --- a/srecord/output/file/mips_flash.h +++ b/srecord/output/file/mips_flash.h @@ -35,7 +35,7 @@ class output_file_mips_flash: /** * The destructor. */ - virtual ~output_file_mips_flash(); + ~output_file_mips_flash() override; /** * The create_le class method is used to create new dynamically @@ -59,22 +59,22 @@ class output_file_mips_flash: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -106,32 +106,32 @@ class output_file_mips_flash: * The address instance variable is used to remember the address at * which the next byte is to be placed. */ - unsigned long address; + unsigned long address{0}; /** * The base instance variable is used to remember the base address * of the current flash segment. */ - unsigned long base; + unsigned long base{0}; /** * The base_set instance variable is used to remember whether or * not the #base instance variable has been set yet. This also * implies no data has been seen yet. */ - bool base_set; + bool base_set{false}; /** * The buffer instance variable is used to remember the accumulated * data so far. Must be a multiple of 4 bytes long. */ - unsigned char buffer[256]; + unsigned char buffer[256]{}; /** * The buffer_length instance variable is used to remember how many * bytes of the #buffer array have been consumed to date. */ - size_t buffer_length; + size_t buffer_length{0}; /** * The buffer_flush method is used to write the #buffer_length @@ -152,29 +152,30 @@ class output_file_mips_flash: * preferred line length for the output, in fixed width character * columns. */ - int line_length; + int line_length{80}; /** * The column instance variable is used to remember the current * output column. If zero, it means we are positioned at the * beginning of a new line of text. */ - int column; + int column{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_mips_flash(); + output_file_mips_flash() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_mips_flash(const output_file_mips_flash &); + output_file_mips_flash(const output_file_mips_flash &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_mips_flash &operator=(const output_file_mips_flash &); + output_file_mips_flash &operator=(const output_file_mips_flash &) = delete; }; }; diff --git a/srecord/output/file/mos_tech.cc b/srecord/output/file/mos_tech.cc index 10f3aa38..acc693d7 100644 --- a/srecord/output/file/mos_tech.cc +++ b/srecord/output/file/mos_tech.cc @@ -44,9 +44,7 @@ srecord::output_file_mos_tech::~output_file_mos_tech() srecord::output_file_mos_tech::output_file_mos_tech( const std::string &a_filename ) : - srecord::output_file(a_filename), - pref_block_size(24), - data_record_count(0) + srecord::output_file(a_filename) { // The block size of 24 comes from the sole example I have seen of a // valid MOS Tech file. diff --git a/srecord/output/file/mos_tech.h b/srecord/output/file/mos_tech.h index 83f8434e..53e8bb26 100644 --- a/srecord/output/file/mos_tech.h +++ b/srecord/output/file/mos_tech.h @@ -36,7 +36,7 @@ class output_file_mos_tech: /** * The destructor. */ - virtual ~output_file_mos_tech(); + ~output_file_mos_tech() override; private: /** @@ -61,22 +61,22 @@ class output_file_mos_tech: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -84,14 +84,14 @@ class output_file_mos_tech: * size. Set by the line_length_set() method. Read by the * preferred_block_size_get() method. */ - int pref_block_size; + int pref_block_size{24}; /** * The data_record_count instance variable is used to remember the * number of data records present in the output. This is used * when writing the end-of-file record. */ - int data_record_count; + int data_record_count{0}; /** * The write_inner method is used to write a single line (record) @@ -100,20 +100,21 @@ class output_file_mos_tech: void write_inner(int type, unsigned long addr, int addr_len, const void *data, int data_len); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_mos_tech(); + output_file_mos_tech() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_mos_tech(const output_file_mos_tech &); + output_file_mos_tech(const output_file_mos_tech &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_mos_tech &operator=(const output_file_mos_tech &); + output_file_mos_tech &operator=(const output_file_mos_tech &) = delete; }; }; diff --git a/srecord/output/file/motorola.cc b/srecord/output/file/motorola.cc index 259ba42c..234bfc35 100644 --- a/srecord/output/file/motorola.cc +++ b/srecord/output/file/motorola.cc @@ -34,12 +34,8 @@ srecord::output_file_motorola::~output_file_motorola() srecord::output_file_motorola::output_file_motorola( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - data_count(0), - pref_block_size(32), - address_length(2), - address_shift(0), - data_count_written(false) + srecord::output_file(a_file_name) + { } diff --git a/srecord/output/file/motorola.h b/srecord/output/file/motorola.h index d9fe6e27..e064f13a 100644 --- a/srecord/output/file/motorola.h +++ b/srecord/output/file/motorola.h @@ -40,7 +40,7 @@ class output_file_motorola: /** * The destructor. */ - virtual ~output_file_motorola(); + ~output_file_motorola() override; private: /** @@ -65,25 +65,25 @@ class output_file_motorola: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -91,20 +91,20 @@ class output_file_motorola: * number of output data lines have occurred to date. This is used * at the end of the file to emit an S5 record. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The pref_block_size instance variable is used to remember the * preferred number of data bytes (NOT encoded hex characters) to * be placed in each output line. */ - int pref_block_size; + int pref_block_size{32}; /** * The address_length instance variable is used to remember the * minimum number of address bytes to be emitted into output lines. */ - int address_length; + int address_length{2}; /** * The address_shift method is used to remember how far to the left @@ -116,7 +116,7 @@ class output_file_motorola: * thought out" because the no way (zero, zip, nada) of discovering * this just by looking at the data. */ - int address_shift; + int address_shift{0}; /** * The data_count_written instance variable is used to remember @@ -125,7 +125,7 @@ class output_file_motorola: * are circumstances where it will be needed when the file is * closed. */ - bool data_count_written; + bool data_count_written{false}; /** * The write_data_count method is used to write out a data count @@ -151,15 +151,16 @@ class output_file_motorola: void write_inner(int tag, unsigned long address, int address_nbytes, const void *data, int data_nbytes); +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_motorola(const output_file_motorola &); + output_file_motorola(const output_file_motorola &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_motorola &operator=(const output_file_motorola &); + output_file_motorola &operator=(const output_file_motorola &) = delete; }; }; diff --git a/srecord/output/file/msbin.cc b/srecord/output/file/msbin.cc index 34ef6a2f..de6c0f74 100644 --- a/srecord/output/file/msbin.cc +++ b/srecord/output/file/msbin.cc @@ -53,10 +53,7 @@ srecord::output_file_msbin::~output_file_msbin() srecord::output_file_msbin::output_file_msbin( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - start_address_set(false), - start_address(0), - beginning_of_file(true) + srecord::output_file(a_file_name) { line_termination = line_termination_binary; } diff --git a/srecord/output/file/msbin.h b/srecord/output/file/msbin.h index 92241705..a0b8908b 100644 --- a/srecord/output/file/msbin.h +++ b/srecord/output/file/msbin.h @@ -44,7 +44,7 @@ class output_file_msbin: /** * The destructor. */ - virtual ~output_file_msbin(); + ~output_file_msbin() override; private: /** @@ -68,28 +68,28 @@ class output_file_msbin: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - void notify_upper_bound(unsigned long addr); + void notify_upper_bound(unsigned long addr) override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** @@ -188,26 +188,26 @@ class output_file_msbin: * Becomes true once we encounter a record of type * record::type_execution_start_address. */ - bool start_address_set; + bool start_address_set{false}; /** * The start_address instance variable is used to remember * the execution start address, taken from a record of type * record::type_execution_start_address. */ - record::address_t start_address; + record::address_t start_address{0}; /** * The upper_bound instance variable is used to remember the upper * bound address as received via the #notify_upper_bound method. */ - record::address_t upper_bound; + record::address_t upper_bound{}; /** * The beginning_of_file instance variable is used to remember * that we haven't written the file header yet. */ - bool beginning_of_file; + bool beginning_of_file{true}; /** * Type holding copies of records. @@ -222,20 +222,21 @@ class output_file_msbin: */ record_vector pending_records; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_msbin(); + output_file_msbin() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_msbin(const output_file_msbin &); + output_file_msbin(const output_file_msbin &) = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_msbin &operator=(const output_file_msbin &); + output_file_msbin &operator=(const output_file_msbin &) = delete; }; }; diff --git a/srecord/output/file/needham.cc b/srecord/output/file/needham.cc index 0f58e2df..c0523724 100644 --- a/srecord/output/file/needham.cc +++ b/srecord/output/file/needham.cc @@ -34,11 +34,7 @@ srecord::output_file_needham::~output_file_needham() srecord::output_file_needham::output_file_needham( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(0), - column(0), - pref_block_size(16), - address_length(4) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/needham.h b/srecord/output/file/needham.h index c9efa852..e73e4c49 100644 --- a/srecord/output/file/needham.h +++ b/srecord/output/file/needham.h @@ -35,7 +35,7 @@ class output_file_needham: /** * The destructor. */ - virtual ~output_file_needham(); + ~output_file_needham() override; private: /** @@ -60,63 +60,64 @@ class output_file_needham: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The address instance variable is used to remember where in the * file the output has reached. This is used to fill gaps. */ - unsigned long address; + unsigned long address{0}; /** * The column instance variable is used to remember the column of * the output text we have reached. This is used when calculating * when to throw new lines. */ - int column; + int column{0}; /** * The pref_block_size instance variable is used to remember The * preferred line length of the output text. */ - int pref_block_size; + int pref_block_size{16}; /** * The address_length instance variable is used to remember the * minimum number of bytes to use for addresses in the output text. */ - int address_length; + int address_length{4}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_needham(); + output_file_needham() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_needham(const output_file_needham &); + output_file_needham(const output_file_needham &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_needham &operator=(const output_file_needham &); + output_file_needham &operator=(const output_file_needham &) = delete; }; }; diff --git a/srecord/output/file/os65v.cc b/srecord/output/file/os65v.cc index 5944aedb..cd1b37fd 100644 --- a/srecord/output/file/os65v.cc +++ b/srecord/output/file/os65v.cc @@ -43,10 +43,7 @@ srecord::output_file_os65v::~output_file_os65v() srecord::output_file_os65v::output_file_os65v(const std::string &a_file_name) : - srecord::output_file(a_file_name), - address(0), - state(0), - seen_start_address(false) + srecord::output_file(a_file_name) { if (line_termination == line_termination_native) { diff --git a/srecord/output/file/os65v.h b/srecord/output/file/os65v.h index cdd5de8c..5f6bb5ae 100644 --- a/srecord/output/file/os65v.h +++ b/srecord/output/file/os65v.h @@ -36,7 +36,7 @@ class output_file_os65v: /** * The destructor. */ - virtual ~output_file_os65v(); + ~output_file_os65v() override; private: /** @@ -61,38 +61,38 @@ class output_file_os65v: protected: // See base class for documentation - void write(const record &); + void write(const record &) override; // See base class for documentation - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation const char *mode() const; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The address instance variable is used to remember the current * file location. */ - unsigned long address; + unsigned long address{0}; /** * The output mode is either address mode ('.') or data mode ('/'). * Initially the file is in an unidentified mode (NUL). */ - char state; + char state{0}; /** * The seen_start_address instance variable is used to remember @@ -101,22 +101,23 @@ class output_file_os65v: * is used to determine whether to emit the "return to monitor" * sequence, if a "GO" command has not been issued. */ - bool seen_start_address; + bool seen_start_address{false}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_os65v(); + output_file_os65v() = delete; /** - * Copy constructor. Do not use. + * Copy constructor. */ - output_file_os65v(const output_file_os65v &); + output_file_os65v(const output_file_os65v &) = delete; /** - * Assignment operator. Do not use. + * Assignment operator. */ - output_file_os65v &operator=(const output_file_os65v &); + output_file_os65v &operator=(const output_file_os65v &) = delete; }; }; diff --git a/srecord/output/file/ppb.cc b/srecord/output/file/ppb.cc index dc5f9208..5f5a8209 100644 --- a/srecord/output/file/ppb.cc +++ b/srecord/output/file/ppb.cc @@ -35,10 +35,7 @@ srecord::output_file_ppb::~output_file_ppb() srecord::output_file_ppb::output_file_ppb( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(-1UL), - buffer_length(0), - seen_some_data(false) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/ppb.h b/srecord/output/file/ppb.h index 8fc23cc8..3e7341d8 100644 --- a/srecord/output/file/ppb.h +++ b/srecord/output/file/ppb.h @@ -34,7 +34,7 @@ class output_file_ppb: /** * The destructor. */ - virtual ~output_file_ppb(); + ~output_file_ppb() override; /** * The create class method is used to create new dynamically @@ -47,25 +47,25 @@ class output_file_ppb: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** @@ -82,25 +82,25 @@ class output_file_ppb: * The address instance variable is used to remember the address of * the next data byte to be parsed. */ - unsigned long address; + unsigned long address{-1UL}; /** * The buffer instance variable is used to remember the accumulated * data bytes to be written to the file. */ - unsigned char buffer[8192]; + unsigned char buffer[8192]{}; /** * The buffer_length instance variable is used to remember how many * bytes are valid in the #buffer array. */ - unsigned buffer_length; + unsigned buffer_length{0}; /** * The seen_some_data instance variable is used to remember whether * or not any data has been written to the file yet. */ - bool seen_some_data; + bool seen_some_data{false}; /** * The buffer_flush method is used to write out the #buffer_length @@ -126,20 +126,21 @@ class output_file_ppb: */ unsigned char sum_ulong(unsigned long value, unsigned char sum); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ppb(); + output_file_ppb() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ppb(const output_file_ppb &); + output_file_ppb(const output_file_ppb &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ppb &operator=(const output_file_ppb &); + output_file_ppb &operator=(const output_file_ppb &) = delete; }; }; diff --git a/srecord/output/file/ppx.cc b/srecord/output/file/ppx.cc index 9df9148f..e31bdacc 100644 --- a/srecord/output/file/ppx.cc +++ b/srecord/output/file/ppx.cc @@ -47,12 +47,7 @@ srecord::output_file_ppx::~output_file_ppx() srecord::output_file_ppx::output_file_ppx( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - started(false), - address(0), - line_length(80), - column(0), - dsum(0) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/ppx.h b/srecord/output/file/ppx.h index 6b783af0..2f8f6025 100644 --- a/srecord/output/file/ppx.h +++ b/srecord/output/file/ppx.h @@ -34,7 +34,7 @@ class output_file_ppx: /** * The destructor. */ - virtual ~output_file_ppx(); + ~output_file_ppx() override; /** * The create class method is used to create new dynamically @@ -47,22 +47,22 @@ class output_file_ppx: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -79,46 +79,47 @@ class output_file_ppx: * The started instance variable is used to remember whether or not * we have emitted the start sequence. */ - bool started; + bool started{false}; /** * The address instance variable is used to remember the address of * the next data byte to be parsed. */ - unsigned long address; + unsigned long address{0}; /** * The line_length instance variable is used to remember how long * the output lines are to be. */ - int line_length; + int line_length{80}; /** * The column instance variable is used to remember the current * output column. Used for determining when to start a new line. */ - int column; + int column{0}; /** * The dsum instance variable is used to remember the simple sum of * all the data bytes, but not the address bytes. */ - unsigned short dsum; + unsigned short dsum{0}; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ppx(); + output_file_ppx() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ppx(const output_file_ppx &); + output_file_ppx(const output_file_ppx &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ppx &operator=(const output_file_ppx &); + output_file_ppx &operator=(const output_file_ppx &) = delete; }; }; diff --git a/srecord/output/file/signetics.cc b/srecord/output/file/signetics.cc index 18329bb4..51b2e02f 100644 --- a/srecord/output/file/signetics.cc +++ b/srecord/output/file/signetics.cc @@ -33,9 +33,7 @@ srecord::output_file_signetics::~output_file_signetics() srecord::output_file_signetics::output_file_signetics( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - pref_block_size(32), - last_address(0) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/signetics.h b/srecord/output/file/signetics.h index 7dec8df6..38e1d856 100644 --- a/srecord/output/file/signetics.h +++ b/srecord/output/file/signetics.h @@ -38,7 +38,7 @@ class output_file_signetics: /** * The destructor. */ - virtual ~output_file_signetics(); + ~output_file_signetics() override; private: /** @@ -63,28 +63,28 @@ class output_file_signetics: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; /** * See base class for documentation. We over-ride the base * implementation because signetics uses its own XOR-ROL algorithm. */ - void checksum_add(unsigned char); + void checksum_add(unsigned char) override; private: /** @@ -92,14 +92,14 @@ class output_file_signetics: * size. Set by the line_length_set() method. Read by the * preferred_block_size_get() method. */ - int pref_block_size; + int pref_block_size{32}; /** * The last_address instance variable is used to remember the * address immediately beyond the last address of data in the file. * This is used to write the file termination record. */ - unsigned long last_address; + unsigned long last_address{0}; /** * The write_inner method is used to write one line/record to the @@ -107,20 +107,21 @@ class output_file_signetics: */ void write_inner(int, unsigned long, int, const void *, int); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_signetics(); + output_file_signetics() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_signetics(const output_file_signetics &); + output_file_signetics(const output_file_signetics &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_signetics &operator=(const output_file_signetics &); + output_file_signetics &operator=(const output_file_signetics &) = delete; }; }; diff --git a/srecord/output/file/spasm.cc b/srecord/output/file/spasm.cc index 4e8ba1ef..a60a1a36 100644 --- a/srecord/output/file/spasm.cc +++ b/srecord/output/file/spasm.cc @@ -21,11 +21,6 @@ #include -srecord::output_file_spasm::~output_file_spasm() -{ -} - - srecord::output_file_spasm::output_file_spasm( const std::string &a_file_name, endian_t a_end diff --git a/srecord/output/file/spasm.h b/srecord/output/file/spasm.h index 35d2a252..05c7d2c0 100644 --- a/srecord/output/file/spasm.h +++ b/srecord/output/file/spasm.h @@ -37,7 +37,7 @@ class output_file_spasm: /** * The destructor. */ - virtual ~output_file_spasm(); + ~output_file_spasm() override = default; private: /** @@ -67,22 +67,22 @@ class output_file_spasm: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -91,20 +91,21 @@ class output_file_spasm: */ endian_t end; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_spasm(); + output_file_spasm() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_spasm(const output_file_spasm &); + output_file_spasm(const output_file_spasm &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_spasm &operator=(const output_file_spasm &); + output_file_spasm &operator=(const output_file_spasm &) = delete; }; }; diff --git a/srecord/output/file/spectrum.h b/srecord/output/file/spectrum.h index 0587ed70..5618c2ed 100644 --- a/srecord/output/file/spectrum.h +++ b/srecord/output/file/spectrum.h @@ -36,7 +36,7 @@ class output_file_spectrum: /** * The destructor. */ - virtual ~output_file_spectrum(); + ~output_file_spectrum() override; private: /** @@ -61,22 +61,22 @@ class output_file_spectrum: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -93,20 +93,21 @@ class output_file_spectrum: */ void put_binary(unsigned char); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_spectrum(); + output_file_spectrum() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_spectrum(const output_file_spectrum &); + output_file_spectrum(const output_file_spectrum &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_spectrum &operator=(const output_file_spectrum &); + output_file_spectrum &operator=(const output_file_spectrum &) = delete; }; }; diff --git a/srecord/output/file/stewie.cc b/srecord/output/file/stewie.cc index 7733c033..22e594cd 100644 --- a/srecord/output/file/stewie.cc +++ b/srecord/output/file/stewie.cc @@ -39,10 +39,7 @@ srecord::output_file_stewie::~output_file_stewie() srecord::output_file_stewie::output_file_stewie( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - data_count(0), - address_length(2), - preferred_block_size(128) + srecord::output_file(a_file_name) { if (line_termination == line_termination_native) line_termination = line_termination_binary; diff --git a/srecord/output/file/stewie.h b/srecord/output/file/stewie.h index 94192d13..280f2228 100644 --- a/srecord/output/file/stewie.h +++ b/srecord/output/file/stewie.h @@ -37,7 +37,7 @@ class output_file_stewie: /** * The destructor. */ - virtual ~output_file_stewie(); + ~output_file_stewie() override; private: /** @@ -62,64 +62,65 @@ class output_file_stewie: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void put_byte(unsigned char); + void put_byte(unsigned char) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** * The data_count instance variable is used to remember how many * data records have occurred so far in the output file. */ - unsigned long data_count; + unsigned long data_count{0}; /** * The address_length instance variable is used to remember the * minimum number of bytes to use for addresses. */ - int address_length; + int address_length{2}; /** * The preferred_block_size instance variable is used to remember * the preferred block size for records. */ - int preferred_block_size; + int preferred_block_size{128}; /** * Write a data record. */ void write_inner(int, unsigned long, int, const void *, int); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_stewie(); + output_file_stewie() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_stewie(const output_file_stewie &); + output_file_stewie(const output_file_stewie &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_stewie &operator=(const output_file_stewie &); + output_file_stewie &operator=(const output_file_stewie &) = delete; }; }; diff --git a/srecord/output/file/tektronix.cc b/srecord/output/file/tektronix.cc index e38f374d..6de5bc01 100644 --- a/srecord/output/file/tektronix.cc +++ b/srecord/output/file/tektronix.cc @@ -21,17 +21,10 @@ #include -srecord::output_file_tektronix::~output_file_tektronix() -{ - // make sure terminator is written -} - - srecord::output_file_tektronix::output_file_tektronix( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - pref_block_size(32) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/tektronix.h b/srecord/output/file/tektronix.h index e537f112..d5894cb6 100644 --- a/srecord/output/file/tektronix.h +++ b/srecord/output/file/tektronix.h @@ -36,7 +36,7 @@ class output_file_tektronix: /** * The destructor. */ - virtual ~output_file_tektronix(); + ~output_file_tektronix() = default; private: /** @@ -61,28 +61,28 @@ class output_file_tektronix: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. void put_nibble(int); // See base class for documentation. - void put_byte(unsigned char); + void put_byte(unsigned char) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -90,7 +90,7 @@ class output_file_tektronix: * preferred number of data bytes (NOT encoded hex characters) to * be placed in each output line. */ - int pref_block_size; + int pref_block_size{32}; /** * The write_inner method is used to write a line of output. @@ -104,20 +104,21 @@ class output_file_tektronix: */ void write_inner(unsigned long address, const void *data, int data_nbytes); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_tektronix(); + output_file_tektronix() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_tektronix(const output_file_tektronix &); + output_file_tektronix(const output_file_tektronix &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_tektronix &operator=(const output_file_tektronix &); + output_file_tektronix &operator=(const output_file_tektronix &) = delete; }; }; diff --git a/srecord/output/file/tektronix_extended.cc b/srecord/output/file/tektronix_extended.cc index 6994ea6c..ac0b130b 100644 --- a/srecord/output/file/tektronix_extended.cc +++ b/srecord/output/file/tektronix_extended.cc @@ -21,18 +21,10 @@ #include -srecord::output_file_tektronix_extended::~output_file_tektronix_extended() -{ - // check for termination record -} - - srecord::output_file_tektronix_extended::output_file_tektronix_extended( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - pref_block_size(32), - address_length(4) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/tektronix_extended.h b/srecord/output/file/tektronix_extended.h index bf62a586..6064d200 100644 --- a/srecord/output/file/tektronix_extended.h +++ b/srecord/output/file/tektronix_extended.h @@ -36,7 +36,7 @@ class output_file_tektronix_extended: /** * The destructor. */ - virtual ~output_file_tektronix_extended(); + ~output_file_tektronix_extended() = default; private: /** @@ -61,22 +61,22 @@ class output_file_tektronix_extended: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -84,13 +84,13 @@ class output_file_tektronix_extended: * preferred number of data bytes (NOT encoded hex characters) to * be placed in each output line. */ - int pref_block_size; + int pref_block_size{32}; /** * The address_length instance variable is used to remember the * minimum number of address bytes to be emitted into output lines. */ - int address_length; + int address_length{4}; /** * The write_inner method is used to write a line of output. @@ -109,21 +109,23 @@ class output_file_tektronix_extended: void write_inner(int tag, unsigned long address, int address_nbytes, const void *data, int data_nbytes); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_tektronix_extended(); + output_file_tektronix_extended() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_tektronix_extended(const output_file_tektronix_extended &); + output_file_tektronix_extended( + const output_file_tektronix_extended &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ output_file_tektronix_extended &operator=( - const output_file_tektronix_extended &); + const output_file_tektronix_extended &) = delete; }; }; diff --git a/srecord/output/file/ti_tagged.cc b/srecord/output/file/ti_tagged.cc index bda327c5..0eec7f2e 100644 --- a/srecord/output/file/ti_tagged.cc +++ b/srecord/output/file/ti_tagged.cc @@ -39,11 +39,7 @@ srecord::output_file_ti_tagged::~output_file_ti_tagged() srecord::output_file_ti_tagged::output_file_ti_tagged( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(0), - column(0), - line_length(74), - csum(0) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/ti_tagged.h b/srecord/output/file/ti_tagged.h index 24be46ff..687e789f 100644 --- a/srecord/output/file/ti_tagged.h +++ b/srecord/output/file/ti_tagged.h @@ -36,7 +36,7 @@ class output_file_ti_tagged: /** * The destructor. */ - virtual ~output_file_ti_tagged(); + ~output_file_ti_tagged() override; private: /** @@ -61,25 +61,25 @@ class output_file_ti_tagged: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void put_char(int); + void put_char(int) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: typedef output_file inherited; @@ -88,27 +88,27 @@ class output_file_ti_tagged: * The address instance variable is used to remember the current * address within the output file. */ - unsigned long address; + unsigned long address{0}; /** * The column instance variable is used to remember the current * text column within the output file. This is so that we can * decide when to throw a new line. */ - int column; + int column{0}; /** * The line_length instance variable is used to remember the maximum * permitted text line length. This is so that we can decide when * to throw a new line. */ - int line_length; + int line_length{74}; /** * The csum instance variable is used to remember the 16-bit running * total of the bytes emitted so far. It gets reset by put_eoln. */ - int csum; + int csum{0}; /** * The put_eoln method is used to output the line termination, @@ -116,20 +116,21 @@ class output_file_ti_tagged: */ void put_eoln(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ti_tagged(); + output_file_ti_tagged() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ti_tagged(const output_file_ti_tagged &); + output_file_ti_tagged(const output_file_ti_tagged &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ti_tagged &operator=(const output_file_ti_tagged &); + output_file_ti_tagged &operator=(const output_file_ti_tagged &) = delete; }; }; diff --git a/srecord/output/file/ti_tagged_16.cc b/srecord/output/file/ti_tagged_16.cc index c79b43ac..5bdce2cf 100644 --- a/srecord/output/file/ti_tagged_16.cc +++ b/srecord/output/file/ti_tagged_16.cc @@ -38,11 +38,7 @@ srecord::output_file_ti_tagged_16::~output_file_ti_tagged_16() srecord::output_file_ti_tagged_16::output_file_ti_tagged_16( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - address(0), - column(0), - line_length(74), - csum(0) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/ti_tagged_16.h b/srecord/output/file/ti_tagged_16.h index c7567ebc..5d92576d 100644 --- a/srecord/output/file/ti_tagged_16.h +++ b/srecord/output/file/ti_tagged_16.h @@ -36,7 +36,7 @@ class output_file_ti_tagged_16: /** * The destructor. */ - virtual ~output_file_ti_tagged_16(); + ~output_file_ti_tagged_16() override; private: /** @@ -61,25 +61,25 @@ class output_file_ti_tagged_16: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void put_char(int); + void put_char(int) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: typedef output_file inherited; @@ -88,27 +88,27 @@ class output_file_ti_tagged_16: * The address instance variable is used to remember the current * address within the output file. */ - unsigned long address; + unsigned long address{0}; /** * The column instance variable is used to remember the current * text column within the output file. This is so that we can * decide when to throw a new line. */ - int column; + int column{0}; /** * The line_length instance variable is used to remember the maximum * permitted text line length. This is so that we can decide when * to throw a new line. */ - int line_length; + int line_length{74}; /** * The csum instance variable is used to remember the 16-bit running * total of the bytes emitted so far. It gets reset by put_eoln. */ - int csum; + int csum{0}; /** * The put_eoln method is used to output the line termination, @@ -116,20 +116,22 @@ class output_file_ti_tagged_16: */ void put_eoln(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ti_tagged_16(); + output_file_ti_tagged_16() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ti_tagged_16(const output_file_ti_tagged_16 &); + output_file_ti_tagged_16(const output_file_ti_tagged_16 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ti_tagged_16 &operator=(const output_file_ti_tagged_16 &); + output_file_ti_tagged_16 &operator=( + const output_file_ti_tagged_16 &) = delete; }; }; diff --git a/srecord/output/file/ti_txt.cc b/srecord/output/file/ti_txt.cc index 8663c777..da62d85c 100644 --- a/srecord/output/file/ti_txt.cc +++ b/srecord/output/file/ti_txt.cc @@ -34,11 +34,6 @@ srecord::output_file_ti_txt::output_file_ti_txt( const std::string &a_file_name ) : srecord::output_file(a_file_name), - address(), - address_set(false), - address_length(2), - pref_block_size(16), - column(0), line_length(pref_block_size * 3 - 1) { } diff --git a/srecord/output/file/ti_txt.h b/srecord/output/file/ti_txt.h index 451de883..2c10fb84 100644 --- a/srecord/output/file/ti_txt.h +++ b/srecord/output/file/ti_txt.h @@ -36,7 +36,7 @@ class output_file_ti_txt: /** * The destructor. */ - virtual ~output_file_ti_txt(); + ~output_file_ti_txt() override; private: /** @@ -61,22 +61,22 @@ class output_file_ti_txt: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -84,20 +84,20 @@ class output_file_ti_txt: * are up to in the output. Used to limit the number of @ lines * emitted. */ - unsigned long address; + unsigned long address{0}; /** * The address_set instance variable is used to remember whether or * not we have emitted the first address line. The first address, * even if it is zero, is not optional. */ - bool address_set; + bool address_set{false}; /** * The address_length instance variable is used to remember how * many bytes of address to emit. Range: 2 to 4. Default: 2. */ - int address_length; + int address_length{2}; /** * The pref_block_size instance variable is used to remember the @@ -106,14 +106,14 @@ class output_file_ti_txt: * The format definition says it must be exactly 16. We will allow * some leeway. */ - int pref_block_size; + int pref_block_size{16}; /** * The column instance variable is used to remember which column * we are up to in the output. Used to limit the length of lines * in the output. */ - int column; + int column{0}; /** * The line_length instance variable is used to remember how many @@ -133,20 +133,21 @@ class output_file_ti_txt: */ void put_byte_wrap(unsigned char c); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_ti_txt(); + output_file_ti_txt() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_ti_txt(const output_file_ti_txt &); + output_file_ti_txt(const output_file_ti_txt &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_ti_txt &operator=(const output_file_ti_txt &); + output_file_ti_txt &operator=(const output_file_ti_txt &) = delete; }; }; diff --git a/srecord/output/file/trs80.cc b/srecord/output/file/trs80.cc index a6fa7aec..b4486054 100644 --- a/srecord/output/file/trs80.cc +++ b/srecord/output/file/trs80.cc @@ -37,9 +37,7 @@ srecord::output_file_trs80::~output_file_trs80() srecord::output_file_trs80::output_file_trs80( const std::string &a_file_name ) : - srecord::output_file(a_file_name), - termination_seen(false), - pref_block_size(253) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/trs80.h b/srecord/output/file/trs80.h index ee327590..a875de67 100644 --- a/srecord/output/file/trs80.h +++ b/srecord/output/file/trs80.h @@ -38,7 +38,7 @@ class output_file_trs80: /** * The destructor. */ - virtual ~output_file_trs80(); + ~output_file_trs80() override; private: /** @@ -64,32 +64,32 @@ class output_file_trs80: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** * The termination_seen instance variable is used to remember * whether or not a termination record has been seen yet. */ - bool termination_seen; + bool termination_seen{false}; /** * See base class for documentation. We are over-riding it because @@ -97,20 +97,20 @@ class output_file_trs80: * method also tracks the byte_offset, so that we can align to * specific boundaries. Calls the checksum_add() method. */ - void put_byte(unsigned char); + void put_byte(unsigned char) override; /** * The byte_offset instance variable is used to track the location * in the output file. Maintained by the put_byte() method. */ - unsigned long byte_offset; + unsigned long byte_offset{}; /** * The pref_block_size is used to remember the preferred * block size. Set by the constructor. Read by the * preferred_block_size_get() method. */ - int pref_block_size; + int pref_block_size{253}; /** * The preferred_block_size_calculate method is used to determine @@ -118,20 +118,21 @@ class output_file_trs80: */ static int preferred_block_size_calculate(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_trs80(); + output_file_trs80() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_trs80(const output_file_trs80 &); + output_file_trs80(const output_file_trs80 &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_trs80 &operator=(const output_file_trs80 &); + output_file_trs80 &operator=(const output_file_trs80 &) = delete; }; }; diff --git a/srecord/output/file/vhdl.cc b/srecord/output/file/vhdl.cc index 1ca72914..9ef22540 100644 --- a/srecord/output/file/vhdl.cc +++ b/srecord/output/file/vhdl.cc @@ -36,10 +36,7 @@ srecord::output_file_vhdl::~output_file_vhdl() srecord::output_file_vhdl::output_file_vhdl(const std::string &a_file_name) : - srecord::output_file(a_file_name), - bytes_per_word(1), - prefix("eprom"), - header_done(false) + srecord::output_file(a_file_name) { } diff --git a/srecord/output/file/vhdl.h b/srecord/output/file/vhdl.h index feb5d516..5289e8a3 100644 --- a/srecord/output/file/vhdl.h +++ b/srecord/output/file/vhdl.h @@ -36,7 +36,7 @@ class output_file_vhdl: /** * The destructor. */ - virtual ~output_file_vhdl(); + ~output_file_vhdl() override; private: /** @@ -61,25 +61,25 @@ class output_file_vhdl: protected: // See base class for documentation - void write(const record &); + void write(const record &) override; // See base class for documentation - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -87,19 +87,19 @@ class output_file_vhdl: * many bytes to emit per output row. This is because words are * packed into an array of values larger than a single byte. */ - unsigned bytes_per_word; + unsigned bytes_per_word{1}; /** * The prefix instance variable is used to remember the prefix of * the various names emitted into the output. */ - std::string prefix; + std::string prefix{"eprom"}; /** * The header_done instance variable is used to remember whether * the emit_header method has already been called. */ - bool header_done; + bool header_done{false}; /** * The emit_header method is used to emit the file header, @@ -107,20 +107,21 @@ class output_file_vhdl: */ void emit_header(); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_vhdl(); + output_file_vhdl() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_vhdl(const output_file_vhdl &); + output_file_vhdl(const output_file_vhdl &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_vhdl &operator=(const output_file_vhdl &); + output_file_vhdl &operator=(const output_file_vhdl &) = delete; }; }; diff --git a/srecord/output/file/vmem.h b/srecord/output/file/vmem.h index 17fa3339..bc6d255b 100644 --- a/srecord/output/file/vmem.h +++ b/srecord/output/file/vmem.h @@ -36,7 +36,7 @@ class output_file_vmem: /** * The destructor. */ - virtual ~output_file_vmem(); + ~output_file_vmem() override; private: /** @@ -61,25 +61,25 @@ class output_file_vmem: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; private: /** @@ -122,20 +122,21 @@ class output_file_vmem: */ unsigned width_mask; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_vmem(); + output_file_vmem() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_vmem(const output_file_vmem &); + output_file_vmem(const output_file_vmem &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_vmem &operator=(const output_file_vmem &); + output_file_vmem &operator=(const output_file_vmem &) = delete; }; }; diff --git a/srecord/output/file/wilson.cc b/srecord/output/file/wilson.cc index 86b2b953..e9475045 100644 --- a/srecord/output/file/wilson.cc +++ b/srecord/output/file/wilson.cc @@ -23,11 +23,6 @@ #include -srecord::output_file_wilson::~output_file_wilson() -{ -} - - srecord::output_file_wilson::output_file_wilson( const std::string &a_file_name ) : diff --git a/srecord/output/file/wilson.h b/srecord/output/file/wilson.h index 2195e4c8..161bb254 100644 --- a/srecord/output/file/wilson.h +++ b/srecord/output/file/wilson.h @@ -42,7 +42,7 @@ class output_file_wilson: /** * The destructor. */ - virtual ~output_file_wilson(); + ~output_file_wilson() override = default; private: /** @@ -67,28 +67,28 @@ class output_file_wilson: protected: // See base class for documentation. - void write(const record &); + void write(const record &) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - void put_byte(unsigned char); + void put_byte(unsigned char) override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - bool is_binary() const; + bool is_binary() const override; private: /** @@ -113,20 +113,21 @@ class output_file_wilson: void write_inner(int tag, unsigned long address, const void *data, int data_nbytes); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_file_wilson(); + output_file_wilson() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_file_wilson(const output_file_wilson &); + output_file_wilson(const output_file_wilson &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_file_wilson &operator=(const output_file_wilson &); + output_file_wilson &operator=(const output_file_wilson &) = delete; }; }; diff --git a/srecord/output/filter.cc b/srecord/output/filter.cc index b60a503c..c290f8b3 100644 --- a/srecord/output/filter.cc +++ b/srecord/output/filter.cc @@ -19,11 +19,6 @@ #include -srecord::output_filter::~output_filter() -{ -} - - srecord::output_filter::output_filter(const output::pointer &a_deeper) : deeper(a_deeper) { diff --git a/srecord/output/filter.h b/srecord/output/filter.h index 32b52515..ed3bdde4 100644 --- a/srecord/output/filter.h +++ b/srecord/output/filter.h @@ -35,7 +35,7 @@ class output_filter: /** * The destructor. */ - virtual ~output_filter(); + ~output_filter() override = default; protected: /** @@ -48,31 +48,31 @@ class output_filter: output_filter(const output::pointer &deeper); // See base class for documentation. - void write(const record &r); + void write(const record &r) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; // See base class for documentation. - std::string filename() const; + std::string filename() const override; // See base class for documentation. - const char *format_name() const; + const char *format_name() const override; // See base class for documentation. - void notify_upper_bound(unsigned long addr); + void notify_upper_bound(unsigned long addr) override; // See base class for documentation. - void command_line(arglex_tool *cmdln); + void command_line(arglex_tool *cmdln) override; private: /** @@ -81,20 +81,21 @@ class output_filter: */ output::pointer deeper; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_filter(); + output_filter() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_filter(const output_filter &); + output_filter(const output_filter &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_filter &operator=(const output_filter &); + output_filter &operator=(const output_filter &) = delete; }; }; diff --git a/srecord/output/filter/reblock.cc b/srecord/output/filter/reblock.cc index ed9d1382..e849014c 100644 --- a/srecord/output/filter/reblock.cc +++ b/srecord/output/filter/reblock.cc @@ -36,12 +36,7 @@ srecord::output_filter_reblock::output_filter_reblock( bool a_align ) : output_filter(a_deeper), - align(a_align), - block_size(0), - buffer_address(0), - buffer(0), - buffer_pos(0), - buffer_max(0) + align(a_align) { track_block_size(); diff --git a/srecord/output/filter/reblock.h b/srecord/output/filter/reblock.h index 3921ca07..037a3eb1 100644 --- a/srecord/output/filter/reblock.h +++ b/srecord/output/filter/reblock.h @@ -40,7 +40,7 @@ class output_filter_reblock: /** * The destructor. */ - virtual ~output_filter_reblock(); + ~output_filter_reblock() override; /** * The create class method is used to create new dynamically @@ -57,19 +57,19 @@ class output_filter_reblock: protected: // See base class for documentation. - void write(const record &r); + void write(const record &r) override; // See base class for documentation. - void line_length_set(int); + void line_length_set(int) override; // See base class for documentation. - void address_length_set(int); + void address_length_set(int) override; // See base class for documentation. - int preferred_block_size_get() const; + int preferred_block_size_get() const override; // See base class for documentation. - bool preferred_block_size_set(int nbytes); + bool preferred_block_size_set(int nbytes) override; private: /** @@ -99,14 +99,14 @@ class output_filter_reblock: * deeper->preferred_block_size_get() value, the cache is updated * at strategic times, by calling the #track_block_size method. */ - unsigned block_size; + unsigned block_size{0}; /** * The buffer_address instance variable is used to remember the * byte address of the first byte of the output buffer. Not * meaningful if #buffer_pos is zero. */ - unsigned long buffer_address; + unsigned long buffer_address{0}; /** * The buffer instance variable is used to remember the base @@ -116,7 +116,7 @@ class output_filter_reblock: * * assert(!buffer == !buffer_max); */ - unsigned char *buffer; + unsigned char *buffer{0}; /** * The buffer_pos instance variable is used to remember how many @@ -124,13 +124,13 @@ class output_filter_reblock: * * assert(buffer_pos < buffer_max); */ - size_t buffer_pos; + size_t buffer_pos{0}; /** * The buffer_max instance variable is used to remember how many * data bytes were allocated when the #buffer was created. */ - size_t buffer_max; + size_t buffer_max{0}; /** * The track_block_size method is used to re-cache the @@ -150,20 +150,21 @@ class output_filter_reblock: */ void flush_buffer(bool partial); +public: /** - * The default constructor. Do not use. + * The default constructor. */ - output_filter_reblock(); + output_filter_reblock() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - output_filter_reblock(const output_filter_reblock &); + output_filter_reblock(const output_filter_reblock &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - output_filter_reblock &operator=(const output_filter_reblock &); + output_filter_reblock &operator=(const output_filter_reblock &) = delete; }; }; diff --git a/srecord/quit.cc b/srecord/quit.cc index 03999cf9..9fcf900d 100644 --- a/srecord/quit.cc +++ b/srecord/quit.cc @@ -23,29 +23,6 @@ #include - -srecord::quit::~quit() -{ -} - - -srecord::quit::quit() -{ -} - - -srecord::quit::quit(const quit &) -{ -} - - -srecord::quit & -srecord::quit::operator=(const quit &) -{ - return *this; -} - - void srecord::quit::fatal_error(const char *fmt, ...) { diff --git a/srecord/quit.h b/srecord/quit.h index 973f2c90..7ea9f8f8 100644 --- a/srecord/quit.h +++ b/srecord/quit.h @@ -35,22 +35,22 @@ class quit /** * The destructor. */ - virtual ~quit(); + virtual ~quit() = default; /** * The default constructor. */ - quit(); + quit() = default; /** * The copy constructor. */ - quit(const quit &); + quit(const quit &) = default; /** * The assignment operator. */ - quit &operator=(const quit &); + quit &operator=(const quit &) = default; /** * The fatal_error method is used to report fatal errors. diff --git a/srecord/quit/exception.cc b/srecord/quit/exception.cc index ab4cfb59..41d76f26 100644 --- a/srecord/quit/exception.cc +++ b/srecord/quit/exception.cc @@ -18,17 +18,6 @@ #include - -srecord::quit_exception::~quit_exception() -{ -} - - -srecord::quit_exception::quit_exception() -{ -} - - void srecord::quit_exception::exit(int) { diff --git a/srecord/quit/exception.h b/srecord/quit/exception.h index bbbd0389..4ba97ee4 100644 --- a/srecord/quit/exception.h +++ b/srecord/quit/exception.h @@ -35,12 +35,12 @@ class quit_exception: /** * The destructor. */ - virtual ~quit_exception(); + ~quit_exception() override = default; /** * The default constructor. */ - quit_exception(); + quit_exception() = default; /** * the vomit class is used for the throw. @@ -49,21 +49,21 @@ class quit_exception: protected: // see base class for documentation - virtual void exit(int n); + void exit(int n) override; // see base class for documentation - virtual void message_v(const char *fmt, va_list); + void message_v(const char *fmt, va_list) override; -private: +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - quit_exception(const quit_exception &); + quit_exception(const quit_exception &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - quit_exception &operator=(const quit_exception &); + quit_exception &operator=(const quit_exception &) = delete; }; }; diff --git a/srecord/quit/normal.cc b/srecord/quit/normal.cc index b2d7204e..7f3bc46a 100644 --- a/srecord/quit/normal.cc +++ b/srecord/quit/normal.cc @@ -26,16 +26,6 @@ #include -srecord::quit_normal::~quit_normal() -{ -} - - -srecord::quit_normal::quit_normal() -{ -} - - void srecord::quit_normal::exit(int n) { diff --git a/srecord/quit/normal.h b/srecord/quit/normal.h index f4aef94b..cfaddf21 100644 --- a/srecord/quit/normal.h +++ b/srecord/quit/normal.h @@ -36,30 +36,30 @@ class quit_normal: /** * The destructor. */ - virtual ~quit_normal(); + ~quit_normal() override = default; /** * The default constructor. */ - quit_normal(); + quit_normal() = default; protected: // see base class for documentation - virtual void exit(int); + void exit(int) override; // see base class for documentation - virtual void message_v(const char *, va_list); + void message_v(const char *, va_list) override; -private: +public: /** - * The copy constructor. Do not use. + * The copy constructor. */ - quit_normal(const quit_normal &); + quit_normal(const quit_normal &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - quit_normal &operator=(const quit_normal &); + quit_normal &operator=(const quit_normal &) = delete; }; }; diff --git a/srecord/quit/prefix.cc b/srecord/quit/prefix.cc index f0c30940..a0840f6d 100644 --- a/srecord/quit/prefix.cc +++ b/srecord/quit/prefix.cc @@ -22,11 +22,6 @@ #include -srecord::quit_prefix::~quit_prefix() -{ -} - - srecord::quit_prefix::quit_prefix(quit &a1, const char *a2) : prefix(a2), deeper(a1) diff --git a/srecord/quit/prefix.h b/srecord/quit/prefix.h index 20cdbd7a..a4649f5f 100644 --- a/srecord/quit/prefix.h +++ b/srecord/quit/prefix.h @@ -36,7 +36,7 @@ class quit_prefix: /** * The destructor. */ - virtual ~quit_prefix(); + ~quit_prefix() override = default; /** * A constructor. The given handler is used to process the @@ -53,10 +53,10 @@ class quit_prefix: quit_prefix(quit &deeper, const std::string &prefix); // See base class for documentation. - virtual void exit(int); + void exit(int) override; // See base class for documentation. - virtual void message_v(const char *, va_list); + void message_v(const char *, va_list) override; private: /** @@ -72,20 +72,21 @@ class quit_prefix: */ quit &deeper; +public: /** - * The default constructor. Do not use. + * The default constructor. */ - quit_prefix(); + quit_prefix() = delete; /** - * The copy constructor. Do not use. + * The copy constructor. */ - quit_prefix(const quit_prefix &); + quit_prefix(const quit_prefix &) = delete; /** - * The assignment operator. Do not use. + * The assignment operator. */ - quit_prefix &operator=(const quit_prefix &); + quit_prefix &operator=(const quit_prefix &) = delete; }; }; diff --git a/srecord/record.cc b/srecord/record.cc index f17d6fbe..9e4067b2 100644 --- a/srecord/record.cc +++ b/srecord/record.cc @@ -23,14 +23,6 @@ #include -srecord::record::record(): - type(type_unknown), - address(0), - length(0) -{ -} - - srecord::record::record(const srecord::record &arg) : type(arg.type), address(arg.address), @@ -42,17 +34,14 @@ srecord::record::record(const srecord::record &arg) : srecord::record::record(type_t arg) : - type(arg), - address(0), - length(0) + type(arg) { } srecord::record::record(type_t a1, address_t a2) : type(a1), - address(a2), - length(0) + address(a2) { } @@ -82,12 +71,6 @@ srecord::record::operator=(const srecord::record &arg) return *this; } - -srecord::record::~record() -{ -} - - size_t srecord::record::maximum_data_length(address_t address) { diff --git a/srecord/record.h b/srecord/record.h index 175b6efb..3309b379 100644 --- a/srecord/record.h +++ b/srecord/record.h @@ -38,7 +38,7 @@ class record * The destructor. It isn't virtual, so don't derive anything * from this class. */ - ~record(); + ~record() = default; /** * The type of the various record types. @@ -66,7 +66,7 @@ class record * The default constructor. The record will have an * indeterminate type, zero address, and no data. */ - record(); + record() = default; /** * The copy constructor. @@ -352,26 +352,26 @@ class record * The type instance variable is used to remember the type of * the record. */ - type_t type; + type_t type{type_unknown}; /** * The address instance variable is used to remember the address * of the record. */ - address_t address; + address_t address{0}; /** * The length instance variable is used to remember the number * of valid bytes in the #data array. */ - size_t length; + size_t length{0}; /** * The data instance variable is used to remember the data * of the record. Only the first #length bytes are valid, * the rest are undefined. */ - data_t data[max_data_length]; + data_t data[max_data_length]{}; }; }; diff --git a/srecord/stm32.cc b/srecord/stm32.cc index c0ec87aa..f66b772c 100644 --- a/srecord/stm32.cc +++ b/srecord/stm32.cc @@ -36,21 +36,7 @@ #define POLYNOMIAL 0x04C11DB7 -srecord::stm32::~stm32() -{ -} - - -srecord::stm32::stm32() : - state(0xFFFFFFFF), - cnt(0) -{ -} - - -srecord::stm32::stm32(const stm32 &arg) : - state(arg.state), - cnt(0) +srecord::stm32::stm32(const stm32 &arg) : state(arg.state) { while (cnt < arg.cnt) { diff --git a/srecord/stm32.h b/srecord/stm32.h index d2b61c55..adf14dbc 100644 --- a/srecord/stm32.h +++ b/srecord/stm32.h @@ -45,12 +45,12 @@ class stm32 /** * The destructor. */ - virtual ~stm32(); + virtual ~stm32() = default; /** * The default constructor. */ - stm32(); + stm32() = default; /** * The copy constructor. @@ -95,18 +95,18 @@ class stm32 * The state instance variable is used to remember the running * value of the 32-bit cyclic redundancy check. */ - unsigned long state; + unsigned long state{0xFFFFFFFF}; /** * Current counter of the byte feeding */ - size_t cnt; + size_t cnt{0}; /** * Buffer the incoming stream to build a word to feed to the * CRC generator. */ - unsigned char buf[wordsize]; + unsigned char buf[wordsize]{}; }; };