Assistant: Fix minor const-correctness issues

This commit is contained in:
Andreas Kling 2023-02-20 00:47:48 +01:00
parent 70d7fb6a03
commit 87e26d2fa4
Notes: sideshowbarker 2024-07-18 02:13:10 +09:00
2 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@ private:
class AppResult final : public Result {
public:
AppResult(RefPtr<Gfx::Bitmap> bitmap, DeprecatedString title, DeprecatedString tooltip, NonnullRefPtr<Desktop::AppFile> af, DeprecatedString arguments, int score)
AppResult(RefPtr<Gfx::Bitmap const> bitmap, DeprecatedString title, DeprecatedString tooltip, NonnullRefPtr<Desktop::AppFile> af, DeprecatedString arguments, int score)
: Result(move(title), move(tooltip), score)
, m_app_file(move(af))
, m_arguments(move(arguments))
@ -67,7 +67,7 @@ public:
private:
NonnullRefPtr<Desktop::AppFile> m_app_file;
DeprecatedString m_arguments;
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Gfx::Bitmap const> m_bitmap;
};
class CalculatorResult final : public Result {
@ -83,7 +83,7 @@ public:
virtual Gfx::Bitmap const* bitmap() const override { return m_bitmap; }
private:
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Gfx::Bitmap const> m_bitmap;
};
class FileResult final : public Result {
@ -111,7 +111,7 @@ public:
virtual Gfx::Bitmap const* bitmap() const override { return m_bitmap; }
private:
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Gfx::Bitmap const> m_bitmap;
};
class URLResult final : public Result {
@ -127,7 +127,7 @@ public:
virtual Gfx::Bitmap const* bitmap() const override { return m_bitmap; }
private:
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<Gfx::Bitmap const> m_bitmap;
};
class Provider : public RefCounted<Provider> {

View File

@ -36,7 +36,7 @@ namespace Assistant {
struct AppState {
Optional<size_t> selected_index;
NonnullRefPtrVector<Result> results;
NonnullRefPtrVector<Result const> results;
size_t visible_result_count { 0 };
Threading::Mutex lock;
@ -84,7 +84,7 @@ public:
{
}
Function<void(NonnullRefPtrVector<Result>)> on_new_results;
Function<void(NonnullRefPtrVector<Result const>)> on_new_results;
void search(DeprecatedString const& query)
{
@ -121,7 +121,7 @@ private:
// NonnullRefPtrVector will provide dual_pivot_quick_sort references rather than pointers,
// and dual_pivot_quick_sort requires being able to construct the underlying type on the
// stack. Assistant::Result is pure virtual, thus cannot be constructed on the stack.
Vector<NonnullRefPtr<Result>> all_results;
Vector<NonnullRefPtr<Result const>> all_results;
for (auto const& results_for_provider : new_results->value) {
if (results_for_provider == nullptr)
continue;