From: Mikko Rasa Date: Sun, 31 Oct 2021 18:16:57 +0000 (+0200) Subject: Mark overridden virtual functions as such X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=991fabc1956b73a4007859058fb44171000b452e;p=libs%2Fcore.git Mark overridden virtual functions as such --- diff --git a/source/core/android/errorlogger.h b/source/core/android/errorlogger.h index 4512f09..77fcec7 100644 --- a/source/core/android/errorlogger.h +++ b/source/core/android/errorlogger.h @@ -9,7 +9,7 @@ namespace Android { class ErrorLogger: public Debug::ErrorReporter { public: - virtual bool report_uncaught_exception(const std::exception &) const; + bool report_uncaught_exception(const std::exception &) const override; }; } // namespace Android diff --git a/source/core/android/mainthread.h b/source/core/android/mainthread.h index 9ce9428..ab587ff 100644 --- a/source/core/android/mainthread.h +++ b/source/core/android/mainthread.h @@ -41,7 +41,7 @@ public: void set_window_flags(unsigned, unsigned); private: - virtual void main(); + void main() override; static void app_created(void *); static void activity_destroyed(ANativeActivity *); diff --git a/source/core/getopt.h b/source/core/getopt.h index ade620b..575184f 100644 --- a/source/core/getopt.h +++ b/source/core/getopt.h @@ -17,7 +17,7 @@ private: public: usage_error(const std::string &w, const std::string &h = std::string()): std::runtime_error(w), m_help(h) { } - virtual ~usage_error() throw() = default; + ~usage_error() throw() override = default; const char *help() const throw() { return m_help.c_str(); } }; @@ -128,17 +128,17 @@ private: public: OptionImpl(char, const std::string &, const Store &, ArgType); - virtual ~OptionImpl(); + ~OptionImpl() override; - virtual OptionImpl &set_help(const std::string &); - virtual OptionImpl &set_help(const std::string &, const std::string &); - virtual OptionImpl &bind_seen_count(unsigned &); + OptionImpl &set_help(const std::string &) override; + OptionImpl &set_help(const std::string &, const std::string &) override; + OptionImpl &bind_seen_count(unsigned &) override; char get_short() const { return shrt; } const std::string &get_long() const { return lng; } ArgType get_arg_type() const { return arg_type; } const std::string &get_help() const { return help; } const std::string &get_metavar() const { return metavar; } - virtual unsigned get_seen_count() const { return seen_count; } + unsigned get_seen_count() const override { return seen_count; } void process(); void process(const std::string &); }; @@ -153,9 +153,9 @@ private: public: ArgumentImpl(const std::string &, const Store &, ArgType); - virtual ~ArgumentImpl(); + ~ArgumentImpl() override; - virtual ArgumentImpl &set_help(const std::string &); + ArgumentImpl &set_help(const std::string &) override; const std::string &get_name() const { return name; } ArgType get_type() const { return type; } const std::string &get_help() const { return help; } @@ -172,14 +172,14 @@ private: public: SimpleStore(T &d): data(d) { } - virtual SimpleStore *clone() const + SimpleStore *clone() const override { return new SimpleStore(data); } - virtual bool is_list() const { return false; } + bool is_list() const override { return false; } - virtual void store() { } + void store() override { } - virtual void store(const std::string &a) + void store(const std::string &a) override { data = lexical_cast(a); } }; @@ -192,14 +192,14 @@ private: public: ListStore(T &d): data(d) { } - virtual ListStore *clone() const + ListStore *clone() const override { return new ListStore(data); } - virtual bool is_list() const { return true; } + bool is_list() const override { return true; } - virtual void store() { } + void store() override { } - virtual void store(const std::string &a) + void store(const std::string &a) override { data.push_back(lexical_cast(a)); } }; diff --git a/source/core/maputils.h b/source/core/maputils.h index 7eae134..26b72cc 100644 --- a/source/core/maputils.h +++ b/source/core/maputils.h @@ -47,7 +47,7 @@ public: runtime_error(make_what(typeid(T), MapUtilsInternal::stringify_key(k))) { } - virtual ~key_error() throw() = default; + ~key_error() throw() override = default; private: static std::string make_what(const std::type_info &, const std::string &); diff --git a/source/core/systemerror.h b/source/core/systemerror.h index 1662cec..c2387fa 100644 --- a/source/core/systemerror.h +++ b/source/core/systemerror.h @@ -14,7 +14,7 @@ private: public: system_error(const std::string &, int = -1); system_error(const std::string &, const std::string &); - virtual ~system_error() throw() = default; + ~system_error() throw() override = default; int code() const throw() { return m_code; } diff --git a/source/core/typeregistry.h b/source/core/typeregistry.h index dd5dc01..193fe07 100644 --- a/source/core/typeregistry.h +++ b/source/core/typeregistry.h @@ -40,7 +40,7 @@ private: RegisteredType(const std::string &kw): TypeBase(kw) { } - virtual void invoke(T arg) const { action(this->keyword, arg); } + void invoke(T arg) const override { action(this->keyword, arg); } }; std::map types; diff --git a/source/core/variant.h b/source/core/variant.h index 338ec90..af204f2 100644 --- a/source/core/variant.h +++ b/source/core/variant.h @@ -12,7 +12,7 @@ class type_mismatch: public std::runtime_error { public: type_mismatch(const std::type_info &, const std::type_info &); - virtual ~type_mismatch() throw() = default; + ~type_mismatch() throw() override = default; }; @@ -36,10 +36,10 @@ private: Store(const T &d): data(d) { } - virtual const std::type_info &type_id() const { return typeid(T); } - virtual StoreBase *clone() const { return new Store(data); } - virtual bool type_equals(const StoreBase &s) const { return dynamic_cast *>(&s); } - virtual bool value_equals(const StoreBase &s) const { return _value_equals(s); } + const std::type_info &type_id() const override { return typeid(T); } + StoreBase *clone() const override { return new Store(data); } + bool type_equals(const StoreBase &s) const override { return dynamic_cast *>(&s); } + bool value_equals(const StoreBase &s) const override { return _value_equals(s); } template typename std::enable_if::value, bool>::type _value_equals(const StoreBase &s) const diff --git a/source/fs/dir.h b/source/fs/dir.h index fa2793a..bef89c6 100644 --- a/source/fs/dir.h +++ b/source/fs/dir.h @@ -13,7 +13,7 @@ class not_a_directory: public std::runtime_error { public: not_a_directory(const Path &); - virtual ~not_a_directory() throw() = default; + ~not_a_directory() throw() override = default; }; /// Creates a directory diff --git a/source/fs/unix/filemonitor_platform.h b/source/fs/unix/filemonitor_platform.h index ab3fa28..a6e67a6 100644 --- a/source/fs/unix/filemonitor_platform.h +++ b/source/fs/unix/filemonitor_platform.h @@ -20,16 +20,16 @@ public: int add_watch(const FS::Path &, int); void remove_watch(int); - virtual void set_block(bool) { } - virtual void set_inherit(bool) { } + void set_block(bool) override { } + void set_inherit(bool) override { } protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual const IO::Handle &get_handle(IO::Mode) { return fd; } - virtual const IO::Handle &get_event_handle() { return fd; } + const IO::Handle &get_handle(IO::Mode) override { return fd; } + const IO::Handle &get_event_handle() override { return fd; } }; diff --git a/source/io/asset.h b/source/io/asset.h index d59db94..84c2837 100644 --- a/source/io/asset.h +++ b/source/io/asset.h @@ -22,18 +22,18 @@ public: Asset(const std::string &); ~Asset(); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; private: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; - virtual SeekOffset seek(SeekOffset, SeekType); - virtual SeekOffset tell() const; + SeekOffset seek(SeekOffset, SeekType) override; + SeekOffset tell() const override; }; } // namespace IO diff --git a/source/io/buffered.h b/source/io/buffered.h index a5f6348..f078ea1 100644 --- a/source/io/buffered.h +++ b/source/io/buffered.h @@ -21,21 +21,21 @@ public: Buffered(Base &, unsigned = 8192); ~Buffered(); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; void flush(); protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual std::size_t put(char); + std::size_t put(char) override; bool getline(std::string &); int get(); - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; private: void set_op(Mode); diff --git a/source/io/console.h b/source/io/console.h index 1200086..ac66288 100644 --- a/source/io/console.h +++ b/source/io/console.h @@ -31,8 +31,8 @@ private: public: ~Console(); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; /** If local echo is enabled, characters will appear on the console as they are typed. Can only be used on an input Console. */ @@ -54,12 +54,12 @@ public: void redirect(Base &); protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual const Handle &get_handle(Mode); - virtual const Handle &get_event_handle() { return handle; } + const Handle &get_handle(Mode) override; + const Handle &get_event_handle() override { return handle; } static Console &instance(Stream); }; diff --git a/source/io/eventobject.h b/source/io/eventobject.h index 5a3b280..cf987e4 100644 --- a/source/io/eventobject.h +++ b/source/io/eventobject.h @@ -29,7 +29,7 @@ private: protected: EventObject(); - virtual ~EventObject(); + ~EventObject() override; void set_events(PollEvent); public: diff --git a/source/io/file.h b/source/io/file.h index 292897b..f23cc93 100644 --- a/source/io/file.h +++ b/source/io/file.h @@ -14,14 +14,14 @@ class file_not_found: public std::runtime_error { public: file_not_found(const std::string &fn): std::runtime_error(fn) { } - virtual ~file_not_found() throw() = default; + ~file_not_found() throw() override = default; }; class file_already_exists: public std::runtime_error { public: file_already_exists(const std::string &fn): std::runtime_error(fn) { } - virtual ~file_already_exists() throw() = default; + ~file_already_exists() throw() override = default; }; @@ -54,22 +54,22 @@ public: private: void platform_init(const std::string &, CreateMode); public: - virtual ~File(); + ~File() override; - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual void sync(); + void sync(); - virtual SeekOffset seek(SeekOffset, SeekType); - virtual SeekOffset tell() const; + SeekOffset seek(SeekOffset, SeekType) override; + SeekOffset tell() const override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; }; inline File::CreateMode operator|(File::CreateMode m, File::CreateMode n) @@ -92,22 +92,22 @@ private: public: BufferedFile(const std::string &, Mode = M_READ, File::CreateMode = File::C_OVERWRITE); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual std::size_t put(char); + std::size_t put(char) override; - virtual bool getline(std::string &); - virtual int get(); + bool getline(std::string &) override; + int get() override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; - virtual SeekOffset seek(SeekOffset, SeekType); - virtual SeekOffset tell() const { return position; } + SeekOffset seek(SeekOffset, SeekType) override; + SeekOffset tell() const override { return position; } }; } // namespace IO diff --git a/source/io/memory.h b/source/io/memory.h index c24d3f7..75cf7f5 100644 --- a/source/io/memory.h +++ b/source/io/memory.h @@ -19,21 +19,21 @@ public: Memory(const char *d, std::size_t s): Memory(const_cast(d), const_cast(d+s), M_READ) { } Memory(const char *b, const char *e): Memory(const_cast(b), const_cast(e), M_READ) { } - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; private: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual std::size_t put(char); - virtual bool getline(std::string &); - virtual int get(); + std::size_t put(char) override; + bool getline(std::string &) override; + int get() override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; - virtual SeekOffset seek(SeekOffset, SeekType); - virtual SeekOffset tell() const { return pos-begin; } + SeekOffset seek(SeekOffset, SeekType) override; + SeekOffset tell() const override { return pos-begin; } }; } // namespace IO diff --git a/source/io/mode.h b/source/io/mode.h index a643a7f..565eb0f 100644 --- a/source/io/mode.h +++ b/source/io/mode.h @@ -34,7 +34,7 @@ class invalid_access: public std::logic_error { public: invalid_access(Mode); - virtual ~invalid_access() throw() = default; + ~invalid_access() throw() override = default; }; } // namespace IO diff --git a/source/io/pipe.h b/source/io/pipe.h index 5fc0b3d..df5353a 100644 --- a/source/io/pipe.h +++ b/source/io/pipe.h @@ -23,16 +23,16 @@ public: ~Pipe(); void set_mode(Mode); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual const Handle &get_handle(Mode); - virtual const Handle &get_event_handle() { return reader.get_event(); } + const Handle &get_handle(Mode) override; + const Handle &get_event_handle() override { return reader.get_event(); } }; } // namespace IO diff --git a/source/io/seekable.h b/source/io/seekable.h index 68454d0..84a5561 100644 --- a/source/io/seekable.h +++ b/source/io/seekable.h @@ -24,7 +24,7 @@ class bad_seek: public std::runtime_error { public: bad_seek(SeekOffset, SeekType); - virtual ~bad_seek() throw() = default; + ~bad_seek() throw() override = default; }; diff --git a/source/io/serial.h b/source/io/serial.h index 1e93f10..a07cd1f 100644 --- a/source/io/serial.h +++ b/source/io/serial.h @@ -29,14 +29,14 @@ public: private: void platform_init(const std::string &); public: - virtual ~Serial(); + ~Serial() override; private: void close(); public: - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; void set_baud_rate(unsigned); void set_data_bits(unsigned); @@ -45,12 +45,12 @@ public: void set_parameters(const std::string &); private: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual const Handle &get_handle(Mode); - virtual const Handle &get_event_handle() { return reader.get_event(); } + const Handle &get_handle(Mode) override; + const Handle &get_event_handle() override { return reader.get_event(); } }; } // namespace IO diff --git a/source/io/slice.h b/source/io/slice.h index cec1fcf..2965f98 100644 --- a/source/io/slice.h +++ b/source/io/slice.h @@ -28,25 +28,25 @@ private: public: Slice(Seekable &, SeekOffset, SeekOffset); - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; private: void flush(); unsigned prepare_op(unsigned, Mode); protected: - virtual std::size_t do_write(const char *, std::size_t); - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; + std::size_t do_read(char *, std::size_t) override; public: - virtual std::size_t put(char); - virtual int get(); + std::size_t put(char) override; + int get() override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; - virtual SeekOffset seek(SeekOffset, SeekType); - virtual SeekOffset tell() const { return position; } + SeekOffset seek(SeekOffset, SeekType) override; + SeekOffset tell() const override { return position; } }; } // namespace IO diff --git a/source/io/zlibcompressed.h b/source/io/zlibcompressed.h index 7a79734..eb35f6c 100644 --- a/source/io/zlibcompressed.h +++ b/source/io/zlibcompressed.h @@ -16,7 +16,7 @@ private: public: zlib_error(const std::string &, int); - virtual ~zlib_error() throw() = default; + ~zlib_error() throw() override = default; int code() const throw() { return m_code; } }; @@ -50,15 +50,15 @@ public: write, and compatible with the underlying object. */ ZlibCompressed(Base &, Mode, unsigned level = 9); - virtual ~ZlibCompressed(); + ~ZlibCompressed() override; - virtual void set_block(bool); - virtual void set_inherit(bool); + void set_block(bool) override; + void set_inherit(bool) override; void flush(); protected: - virtual std::size_t do_write(const char *, std::size_t); + std::size_t do_write(const char *, std::size_t) override; private: /** Compresses data and writes it to the underlying object. Returns true if @@ -68,9 +68,9 @@ private: bool compress_data(int flush_mode); public: - virtual std::size_t do_read(char *, std::size_t); + std::size_t do_read(char *, std::size_t) override; - virtual const Handle &get_handle(Mode); + const Handle &get_handle(Mode) override; }; } // namespace IO diff --git a/source/stringcodec/ascii.h b/source/stringcodec/ascii.h index 6980494..bb5d0ee 100644 --- a/source/stringcodec/ascii.h +++ b/source/stringcodec/ascii.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Ascii(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "ASCII"; } + const char *get_name() const override { return "ASCII"; } }; } // namespace StringCodec diff --git a/source/stringcodec/codec.h b/source/stringcodec/codec.h index f434ed8..5e67d46 100644 --- a/source/stringcodec/codec.h +++ b/source/stringcodec/codec.h @@ -171,10 +171,10 @@ protected: { return (em==DEFAULT ? err_mode : em); } public: - virtual Encoder *create_encoder(ErrorMode em = DEFAULT) const + Encoder *create_encoder(ErrorMode em = DEFAULT) const override { return new typename C::Encoder(get_error_mode(em)); } - virtual Decoder *create_decoder(ErrorMode em = DEFAULT) const + Decoder *create_decoder(ErrorMode em = DEFAULT) const override { return new typename C::Decoder(get_error_mode(em)); } }; diff --git a/source/stringcodec/except.h b/source/stringcodec/except.h index a1126e7..0c7b690 100644 --- a/source/stringcodec/except.h +++ b/source/stringcodec/except.h @@ -14,7 +14,7 @@ class codec_error: public std::runtime_error { public: codec_error(const std::string &w): std::runtime_error(w) { } - virtual ~codec_error() throw() = default; + ~codec_error() throw() override = default; }; @@ -25,7 +25,7 @@ class invalid_character: public codec_error { public: invalid_character(unichar, const std::string &); - virtual ~invalid_character() throw() = default; + ~invalid_character() throw() override = default; }; @@ -36,7 +36,7 @@ class invalid_sequence: public codec_error { public: invalid_sequence(const std::string::const_iterator &, const std::string::const_iterator &, const std::string &); - virtual ~invalid_sequence() throw() = default; + ~invalid_sequence() throw() override = default; private: std::string format_sequence(const std::string::const_iterator &, const std::string::const_iterator &); diff --git a/source/stringcodec/iso2022jp.h b/source/stringcodec/iso2022jp.h index a304c56..a9bc1c2 100644 --- a/source/stringcodec/iso2022jp.h +++ b/source/stringcodec/iso2022jp.h @@ -24,12 +24,12 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); - virtual void sync(std::string &); - virtual void reset(); + void encode_char(unichar, std::string &) override; + void sync(std::string &) override; + void reset() override; private: void switch_mode(Mode, std::string &); - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -41,15 +41,15 @@ public: public: Decoder(ErrorMode = DEFAULT); - virtual unichar decode_char(const std::string &, std::string::const_iterator &); - virtual void reset(); + unichar decode_char(const std::string &, std::string::const_iterator &) override; + void reset() override; private: void switch_mode(Mode); }; Iso2022Jp(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "ISO-2022-JP"; } + const char *get_name() const override { return "ISO-2022-JP"; } }; } // namespace StringCodec diff --git a/source/stringcodec/iso646fi.h b/source/stringcodec/iso646fi.h index 2266c2c..fdb3d60 100644 --- a/source/stringcodec/iso646fi.h +++ b/source/stringcodec/iso646fi.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Iso646Fi(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "ISO-646-FI"; } + const char *get_name() const override { return "ISO-646-FI"; } }; } // namespace StringCodec diff --git a/source/stringcodec/iso88591.h b/source/stringcodec/iso88591.h index 2b5a624..a8ba809 100644 --- a/source/stringcodec/iso88591.h +++ b/source/stringcodec/iso88591.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Iso88591(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "ISO-8859-1"; } + const char *get_name() const override { return "ISO-8859-1"; } }; } // namespace StringCodec diff --git a/source/stringcodec/iso885915.h b/source/stringcodec/iso885915.h index ffb3c9a..3791d05 100644 --- a/source/stringcodec/iso885915.h +++ b/source/stringcodec/iso885915.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Iso885915(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "ISO-8859-15"; } + const char *get_name() const override { return "ISO-8859-15"; } }; } // namespace StringCodec diff --git a/source/stringcodec/jisx0201.h b/source/stringcodec/jisx0201.h index 1e7c8ef..5cbda03 100644 --- a/source/stringcodec/jisx0201.h +++ b/source/stringcodec/jisx0201.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; JisX0201(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "JIS X 0201"; } + const char *get_name() const override { return "JIS X 0201"; } }; } // namespace StringCodec diff --git a/source/stringcodec/jisx0208.h b/source/stringcodec/jisx0208.h index 3941282..b0c03b2 100644 --- a/source/stringcodec/jisx0208.h +++ b/source/stringcodec/jisx0208.h @@ -19,9 +19,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -29,12 +29,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; JisX0208(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "JIS X 0208"; } + const char *get_name() const override { return "JIS X 0208"; } }; diff --git a/source/stringcodec/utf16.h b/source/stringcodec/utf16.h index 1850258..73d81cb 100644 --- a/source/stringcodec/utf16.h +++ b/source/stringcodec/utf16.h @@ -30,9 +30,9 @@ public: public: Encoder(ErrorMode em = DEFAULT, Endian en = BIG); - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -43,7 +43,7 @@ public: public: Decoder(ErrorMode em = DEFAULT, Endian en = AUTO); - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; private: unichar decode_unit(const std::string &, const std::string::const_iterator &, std::string::const_iterator &); }; @@ -57,13 +57,13 @@ public: endian(en) { } - virtual const char *get_name() const + const char *get_name() const override { return endian==BIG ? "UTF-16-BE" : endian==LITTLE ? "UTF-16-LE" : "UTF-16"; } - virtual Encoder *create_encoder(ErrorMode em = DEFAULT) const + Encoder *create_encoder(ErrorMode em = DEFAULT) const override { return new Encoder(get_error_mode(em), endian); } - virtual Decoder *create_decoder(ErrorMode em = DEFAULT) const + Decoder *create_decoder(ErrorMode em = DEFAULT) const override { return new Decoder(get_error_mode(em), endian); } }; diff --git a/source/stringcodec/utf8.h b/source/stringcodec/utf8.h index 94c627e..f170916 100644 --- a/source/stringcodec/utf8.h +++ b/source/stringcodec/utf8.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Utf8(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "UTF-8"; } + const char *get_name() const override { return "UTF-8"; } }; } // namespace StringCodec diff --git a/source/stringcodec/windows1252.h b/source/stringcodec/windows1252.h index c5d140f..bcea69b 100644 --- a/source/stringcodec/windows1252.h +++ b/source/stringcodec/windows1252.h @@ -14,9 +14,9 @@ public: public: Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder @@ -24,12 +24,12 @@ public: public: Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; Windows1252(ErrorMode em = DEFAULT): StandardCodec(em) { } - virtual const char *get_name() const { return "Windows-1252"; } + const char *get_name() const override { return "Windows-1252"; } }; } // namespace StringCodec diff --git a/source/strings/fmt.h b/source/strings/fmt.h index 3c1db9d..45ae917 100644 --- a/source/strings/fmt.h +++ b/source/strings/fmt.h @@ -11,7 +11,7 @@ class format_error: public std::logic_error { public: format_error(const std::string &w): std::logic_error(w) { } - virtual ~format_error() throw() = default; + ~format_error() throw() override = default; }; diff --git a/source/strings/lexicalcast.h b/source/strings/lexicalcast.h index 0c5f0a3..393622d 100644 --- a/source/strings/lexicalcast.h +++ b/source/strings/lexicalcast.h @@ -16,7 +16,7 @@ class lexical_error: public std::runtime_error { public: lexical_error(const std::string &w): runtime_error(w) { } - virtual ~lexical_error() throw() = default; + ~lexical_error() throw() override = default; }; @@ -27,7 +27,7 @@ class format_mismatch: public lexical_error { public: format_mismatch(const std::string &w): lexical_error(w) { } - virtual ~format_mismatch() throw() = default; + ~format_mismatch() throw() override = default; }; diff --git a/source/strings/regex.h b/source/strings/regex.h index ed53009..bef5231 100644 --- a/source/strings/regex.h +++ b/source/strings/regex.h @@ -11,7 +11,7 @@ class bad_regex: public std::logic_error { public: bad_regex(const std::string &, const std::string &, const std::string::const_iterator &); - virtual ~bad_regex() throw() = default; + ~bad_regex() throw() override = default; private: std::string make_where(const std::string &, const std::string::const_iterator &);