diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-03 12:52:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-03 12:52:23 +0100 |
commit | 028bda7293b7ed3c908b0a35db9d48e4e411cfb5 (patch) | |
tree | 5c4331209871ec39404b108878e2eda3b88f3a41 | |
parent | 0751ed286c565d0aaf7b3eacc0773c2e1ed6625a (diff) | |
download | rspamd-028bda7293b7ed3c908b0a35db9d48e4e411cfb5.tar.gz rspamd-028bda7293b7ed3c908b0a35db9d48e4e411cfb5.zip |
[Minor] Add some more helpers
-rw-r--r-- | src/libmime/mime_string.hxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libmime/mime_string.hxx b/src/libmime/mime_string.hxx index 3294cd980..890708de2 100644 --- a/src/libmime/mime_string.hxx +++ b/src/libmime/mime_string.hxx @@ -310,19 +310,19 @@ public: const Allocator& alloc = Allocator()) noexcept : basic_mime_string(st.data(), st.size(), std::forward<filter_type>(filt), alloc) {} - auto size() const -> std::size_t { + constexpr auto size() const noexcept -> std::size_t { return storage.size(); } - auto data() const -> const CharT* { + constexpr auto data() const noexcept -> const CharT* { return storage.data(); } - constexpr auto has_zeroes() const -> bool { + constexpr auto has_zeroes() const noexcept -> bool { return !!(flags & mime_string_flags::MIME_STRING_SEEN_ZEROES); } - constexpr auto has_invalid() const -> bool { + constexpr auto has_invalid() const noexcept -> bool { return !!(flags & mime_string_flags::MIME_STRING_SEEN_INVALID); } @@ -476,12 +476,15 @@ public: return view_type{storage}; } - constexpr CharT operator[](std::size_t pos) const { + constexpr CharT operator[](std::size_t pos) const noexcept { return storage[pos]; } constexpr CharT at(std::size_t pos) const { return storage.at(pos); } + constexpr bool empty() const noexcept { + return storage.empty(); + } /* For doctest stringify */ |