From 5d1c4caba03c40dc66aac235a6ffe65d7c0c7499 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 19 Feb 2024 21:02:34 -0600 Subject: [PATCH] Base: Rename ASCIIInputStream to TextInputStream --- src/App/StringHasher.cpp | 2 +- src/Base/Stream.cpp | 2 +- src/Base/Stream.h | 42 ++++++++++++++++++++-------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/App/StringHasher.cpp b/src/App/StringHasher.cpp index 37c1cb1626..ff3218d054 100644 --- a/src/App/StringHasher.cpp +++ b/src/App/StringHasher.cpp @@ -621,7 +621,7 @@ void StringHasher::RestoreDocFile(Base::Reader& reader) void StringHasher::restoreStreamNew(std::istream& stream, std::size_t count) { - Base::ASCIIInputStream asciiStream (stream); + Base::TextInputStream asciiStream (stream); _hashes->clear(); std::string content; boost::io::ios_flags_saver ifs(stream); diff --git a/src/Base/Stream.cpp b/src/Base/Stream.cpp index a62de1a245..eb9a8743fb 100644 --- a/src/Base/Stream.cpp +++ b/src/Base/Stream.cpp @@ -836,7 +836,7 @@ std::streambuf::pos_type Streambuf::seekpos(std::streambuf::pos_type pos, // The custom string handler written by realthunder for the LinkStage3 toponaming code, to handle // reading multi-line strings directly into a std::string. Imported from LinkStage3 and refactored // during the TNP mitigation project in February 2024. -ASCIIInputStream& ASCIIInputStream::operator>>(std::string& outputString) +TextInputStream& TextInputStream::operator>>(std::string& outputString) { uint32_t numberOfLines; char inputChar; diff --git a/src/Base/Stream.h b/src/Base/Stream.h index 7193275fe6..e7bec16d54 100644 --- a/src/Base/Stream.h +++ b/src/Base/Stream.h @@ -142,38 +142,38 @@ private: }; /** - * The ASCIIInputStream class provides reading of ASCII data from an istream, with custom handling + * The TextInputStream class provides reading of ASCII data from an istream, with custom handling * for std::string to make it easier to read a single multi-line (or multi-word) string. This is * designed for easy compatibility with the LinkStage3 implementation of the InputStream class, used * to store StringHashers for the toponaming mitigation technique. */ -class BaseExport ASCIIInputStream: public Stream +class BaseExport TextInputStream: public Stream { public: /** Constructor * @param rin: upstream input */ - explicit ASCIIInputStream(std::istream& rin) + explicit TextInputStream(std::istream& rin) : _in(rin) {} - ASCIIInputStream(const ASCIIInputStream&) = delete; + TextInputStream(const TextInputStream&) = delete; - ASCIIInputStream(const ASCIIInputStream&&) noexcept = delete; + TextInputStream(const TextInputStream&&) noexcept = delete; - void operator=(const ASCIIInputStream&) = delete; + void operator=(const TextInputStream&) = delete; - void operator=(const ASCIIInputStream&&) = delete; + void operator=(const TextInputStream&&) = delete; - ~ASCIIInputStream() override = default; + ~TextInputStream() override = default; - ASCIIInputStream& operator>>(bool& input) + TextInputStream& operator>>(bool& input) { _in >> input; return *this; } - ASCIIInputStream& operator>>(int8_t& ch) + TextInputStream& operator>>(int8_t& ch) { int index {}; _in >> index; @@ -181,7 +181,7 @@ public: return *this; } - ASCIIInputStream& operator>>(uint8_t& uch) + TextInputStream& operator>>(uint8_t& uch) { unsigned uns {}; _in >> uns; @@ -189,57 +189,57 @@ public: return *this; } - ASCIIInputStream& operator>>(int16_t& int16) + TextInputStream& operator>>(int16_t& int16) { _in >> int16; return *this; } - ASCIIInputStream& operator>>(uint16_t& us) + TextInputStream& operator>>(uint16_t& us) { _in >> us; return *this; } - ASCIIInputStream& operator>>(int32_t& int32) + TextInputStream& operator>>(int32_t& int32) { _in >> int32; return *this; } - ASCIIInputStream& operator>>(uint32_t& ui) + TextInputStream& operator>>(uint32_t& ui) { _in >> ui; return *this; } - ASCIIInputStream& operator>>(int64_t& int64) + TextInputStream& operator>>(int64_t& int64) { _in >> int64; return *this; } - ASCIIInputStream& operator>>(uint64_t& ul) + TextInputStream& operator>>(uint64_t& ul) { _in >> ul; return *this; } - ASCIIInputStream& operator>>(float& flt) + TextInputStream& operator>>(float& flt) { _in >> flt; return *this; } - ASCIIInputStream& operator>>(double& dbl) + TextInputStream& operator>>(double& dbl) { _in >> dbl; return *this; } - ASCIIInputStream& operator>>(std::string& str); + TextInputStream& operator>>(std::string& str); - ASCIIInputStream& operator>>(char& chr) + TextInputStream& operator>>(char& chr) { chr = (char)_in.get(); return *this;