mirror of
https://github.com/transmission/transmission
synced 2024-12-30 11:36:07 +00:00
bd72b8c3fc
* Fix `readability-avoid-const-params-in-decls` clang-tidy issues * Fix `bugprone-macro-parentheses` clang-tidy issues * Fix `modernize-use-using` clang-tidy issues * Fix `readability-named-parameter` clang-tidy issues * Fix `cppcoreguidelines-owning-memory` clang-tidy issues * Fix `cppcoreguidelines-special-member-functions` clang-tidy issues * Fix `cppcoreguidelines-macro-usage` clang-tidy issues * Fix `modernize-use-nodiscard` clang-tidy issues * Fix `cppcoreguidelines-macro-usage` clang-tidy issues * Add headers filter for /gtk/ subdirectory
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
// This file Copyright © 2022-2023 Mnemosyne LLC.
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
#pragma once
|
|
|
|
#include "GtkCompat.h"
|
|
|
|
#include <libtransmission/tr-macros.h>
|
|
|
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
|
#include <gtkmm/filter.h>
|
|
#else
|
|
#include <glibmm/object.h>
|
|
#endif
|
|
|
|
template<typename T>
|
|
class FilterBase : public IF_GTKMM4(Gtk::Filter, Glib::Object)
|
|
{
|
|
public:
|
|
#if !GTKMM_CHECK_VERSION(4, 0, 0)
|
|
enum class Change{
|
|
DIFFERENT,
|
|
LESS_STRICT,
|
|
MORE_STRICT,
|
|
};
|
|
#endif
|
|
|
|
public:
|
|
FilterBase() = default;
|
|
~FilterBase() override = default;
|
|
|
|
TR_DISABLE_COPY_MOVE(FilterBase)
|
|
|
|
virtual bool match(T const& item) const = 0;
|
|
|
|
virtual bool matches_all() const;
|
|
virtual bool matches_none() const;
|
|
|
|
#if !GTKMM_CHECK_VERSION(4, 0, 0)
|
|
sigc::signal<void(Change)>& signal_changed();
|
|
#endif
|
|
|
|
protected:
|
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
|
// Gtk::Filter
|
|
bool match_vfunc(Glib::RefPtr<Glib::ObjectBase> const& object) override;
|
|
Match get_strictness_vfunc() override;
|
|
#else
|
|
void changed(Change change);
|
|
#endif
|
|
|
|
private:
|
|
#if !GTKMM_CHECK_VERSION(4, 0, 0)
|
|
sigc::signal<void(Change)> signal_changed_;
|
|
#endif
|
|
};
|