make several member functions const

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-08-26 13:06:52 -07:00
parent 9ca64d5fb3
commit 53ffcf455c
7 changed files with 15 additions and 15 deletions

View File

@ -194,7 +194,7 @@ struct Instance final
#endif #endif
#ifdef ENABLE_SQLITE #ifdef ENABLE_SQLITE
bool HasStickerDatabase() noexcept { bool HasStickerDatabase() const noexcept {
return sticker_database != nullptr; return sticker_database != nullptr;
} }
#endif #endif

View File

@ -143,34 +143,34 @@ struct DecoderPlugin {
scan_stream(_scan_stream) {} scan_stream(_scan_stream) {}
constexpr auto WithInit(bool (*_init)(const ConfigBlock &block), constexpr auto WithInit(bool (*_init)(const ConfigBlock &block),
void (*_finish)() noexcept = nullptr) noexcept { void (*_finish)() noexcept = nullptr) const noexcept {
auto copy = *this; auto copy = *this;
copy.init = _init; copy.init = _init;
copy.finish = _finish; copy.finish = _finish;
return copy; return copy;
} }
constexpr auto WithContainer(std::forward_list<DetachedSong> (*_container_scan)(Path path_fs)) noexcept { constexpr auto WithContainer(std::forward_list<DetachedSong> (*_container_scan)(Path path_fs)) const noexcept {
auto copy = *this; auto copy = *this;
copy.container_scan = _container_scan; copy.container_scan = _container_scan;
return copy; return copy;
} }
constexpr auto WithProtocols(std::set<std::string> (*_protocols)() noexcept, constexpr auto WithProtocols(std::set<std::string> (*_protocols)() noexcept,
void (*_uri_decode)(DecoderClient &client, const char *uri)) noexcept { void (*_uri_decode)(DecoderClient &client, const char *uri)) const noexcept {
auto copy = *this; auto copy = *this;
copy.protocols = _protocols; copy.protocols = _protocols;
copy.uri_decode = _uri_decode; copy.uri_decode = _uri_decode;
return copy; return copy;
} }
constexpr auto WithSuffixes(const char *const*_suffixes) noexcept { constexpr auto WithSuffixes(const char *const*_suffixes) const noexcept {
auto copy = *this; auto copy = *this;
copy.suffixes = _suffixes; copy.suffixes = _suffixes;
return copy; return copy;
} }
constexpr auto WithMimeTypes(const char *const*_mime_types) noexcept { constexpr auto WithMimeTypes(const char *const*_mime_types) const noexcept {
auto copy = *this; auto copy = *this;
copy.mime_types = _mime_types; copy.mime_types = _mime_types;
return copy; return copy;

View File

@ -75,7 +75,7 @@ InputCacheManager::Flush() noexcept
} }
bool bool
InputCacheManager::IsEligible(const InputStream &input) noexcept InputCacheManager::IsEligible(const InputStream &input) const noexcept
{ {
assert(input.IsReady()); assert(input.IsReady());

View File

@ -98,7 +98,7 @@ private:
* Check whether the given #InputStream can be stored in this * Check whether the given #InputStream can be stored in this
* cache. * cache.
*/ */
bool IsEligible(const InputStream &input) noexcept; bool IsEligible(const InputStream &input) const noexcept;
void Remove(InputCacheItem &item) noexcept; void Remove(InputCacheItem &item) noexcept;
void Delete(InputCacheItem *item) noexcept; void Delete(InputCacheItem *item) noexcept;

View File

@ -66,7 +66,7 @@ public:
return *pipe; return *pipe;
} }
bool IsInitial() { bool IsInitial() const {
return chunk == nullptr; return chunk == nullptr;
} }

View File

@ -85,32 +85,32 @@ struct PlaylistPlugin {
:name(_name), open_stream(_open_stream) {} :name(_name), open_stream(_open_stream) {}
constexpr auto WithInit(bool (*_init)(const ConfigBlock &block), constexpr auto WithInit(bool (*_init)(const ConfigBlock &block),
void (*_finish)() noexcept = nullptr) noexcept { void (*_finish)() noexcept = nullptr) const noexcept {
auto copy = *this; auto copy = *this;
copy.init = _init; copy.init = _init;
copy.finish = _finish; copy.finish = _finish;
return copy; return copy;
} }
constexpr auto WithSchemes(const char *const*_schemes) noexcept { constexpr auto WithSchemes(const char *const*_schemes) const noexcept {
auto copy = *this; auto copy = *this;
copy.schemes = _schemes; copy.schemes = _schemes;
return copy; return copy;
} }
constexpr auto WithSuffixes(const char *const*_suffixes) noexcept { constexpr auto WithSuffixes(const char *const*_suffixes) const noexcept {
auto copy = *this; auto copy = *this;
copy.suffixes = _suffixes; copy.suffixes = _suffixes;
return copy; return copy;
} }
constexpr auto WithMimeTypes(const char *const*_mime_types) noexcept { constexpr auto WithMimeTypes(const char *const*_mime_types) const noexcept {
auto copy = *this; auto copy = *this;
copy.mime_types = _mime_types; copy.mime_types = _mime_types;
return copy; return copy;
} }
constexpr auto WithAsFolder(bool value=true) noexcept { constexpr auto WithAsFolder(bool value=true) const noexcept {
auto copy = *this; auto copy = *this;
copy.as_folder = value; copy.as_folder = value;
return copy; return copy;

View File

@ -49,7 +49,7 @@ public:
int index; int index;
const char *value; const char *value;
constexpr operator bool() noexcept { constexpr operator bool() const noexcept {
return index >= 0; return index >= 0;
} }
}; };