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
|
|
|
|
{
|
|
|
|
|
2012-06-12 20:24:29 +02:00
|
|
|
class FilterGroup;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
typedef memoryview<String> FilterParameters;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2012-06-12 20:24:29 +02:00
|
|
|
typedef std::function<FilterAndId (const FilterParameters& params)> FilterFactory;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-06-12 20:24:29 +02:00
|
|
|
void add_filter_to_group(FilterGroup& group,
|
|
|
|
const String& factory_name,
|
|
|
|
const FilterParameters& parameters);
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
CandidateList complete_filter(const String& prefix,
|
2012-08-23 23:56:35 +02:00
|
|
|
CharCount cursor_pos);
|
2011-12-02 15:28:27 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|