2011-12-02 15:28:27 +01:00
|
|
|
#ifndef filter_registry_h_INCLUDED
|
|
|
|
#define filter_registry_h_INCLUDED
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
#include "string.hh"
|
2011-12-02 15:28:27 +01:00
|
|
|
#include "filter.hh"
|
|
|
|
#include "utils.hh"
|
|
|
|
#include "completion.hh"
|
2012-02-03 20:14:35 +01:00
|
|
|
#include "memoryview.hh"
|
2011-12-02 15:28:27 +01:00
|
|
|
#include "idvaluemap.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class Window;
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
typedef memoryview<String> FilterParameters;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2011-12-07 15:29:10 +01:00
|
|
|
typedef std::function<FilterAndId (Window& window,
|
2011-12-02 15:28:27 +01:00
|
|
|
const FilterParameters& params)> FilterFactory;
|
|
|
|
|
|
|
|
class FilterRegistry : public Singleton<FilterRegistry>
|
|
|
|
{
|
|
|
|
public:
|
2012-04-14 03:17:09 +02:00
|
|
|
void register_factory(const String& name,
|
2011-12-02 15:28:27 +01:00
|
|
|
const FilterFactory& factory);
|
|
|
|
|
2011-12-07 15:29:10 +01:00
|
|
|
void add_filter_to_window(Window& window,
|
2012-04-14 03:17:09 +02:00
|
|
|
const String& factory_name,
|
2011-12-02 15:28:27 +01:00
|
|
|
const FilterParameters& parameters);
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
CandidateList complete_filter(const String& prefix,
|
2011-12-02 15:28:27 +01:00
|
|
|
size_t cursor_pos);
|
|
|
|
|
|
|
|
private:
|
2012-04-14 03:17:09 +02:00
|
|
|
idvaluemap<String, FilterFactory> m_factories;
|
2011-12-02 15:28:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // filter_registry_h_INCLUDED
|
|
|
|
|