Commit 53ffcf45 authored by Rosen Penev's avatar Rosen Penev

make several member functions const

Signed-off-by: 's avatarRosen Penev <rosenp@gmail.com>
parent 9ca64d5f
...@@ -194,7 +194,7 @@ struct Instance final ...@@ -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
......
...@@ -143,34 +143,34 @@ struct DecoderPlugin { ...@@ -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;
......
...@@ -75,7 +75,7 @@ InputCacheManager::Flush() noexcept ...@@ -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());
......
...@@ -98,7 +98,7 @@ private: ...@@ -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;
......
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
return *pipe; return *pipe;
} }
bool IsInitial() { bool IsInitial() const {
return chunk == nullptr; return chunk == nullptr;
} }
......
...@@ -85,32 +85,32 @@ struct PlaylistPlugin { ...@@ -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;
......
...@@ -49,7 +49,7 @@ public: ...@@ -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;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment