2011-12-02 15:28:27 +01:00
|
|
|
#ifndef filter_hh_INCLUDED
|
|
|
|
#define filter_hh_INCLUDED
|
|
|
|
|
2013-04-09 20:05:40 +02:00
|
|
|
#include "function_group.hh"
|
|
|
|
#include "function_registry.hh"
|
|
|
|
#include "memoryview.hh"
|
2012-04-14 03:17:09 +02:00
|
|
|
#include "string.hh"
|
2012-11-23 13:40:20 +01:00
|
|
|
#include "utils.hh"
|
2013-04-09 20:05:40 +02:00
|
|
|
|
|
|
|
#include <functional>
|
2011-12-02 15:28:27 +01:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class Buffer;
|
2013-02-18 14:00:43 +01:00
|
|
|
struct Selection;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2012-01-11 15:21:58 +01:00
|
|
|
// A Filter is a function which is applied to a Buffer and a pending
|
|
|
|
// Modification in order to mutate the Buffer or the Modification
|
|
|
|
// prior to it's application.
|
|
|
|
|
2012-11-19 13:40:23 +01:00
|
|
|
using FilterFunc = std::function<void (Buffer& buffer, Selection& selection, String& content)>;
|
|
|
|
using FilterAndId = std::pair<String, FilterFunc>;
|
2013-03-27 13:41:41 +01:00
|
|
|
using FilterGroup = FunctionGroup<Buffer&, Selection&, String&>;
|
2011-12-02 15:28:27 +01:00
|
|
|
|
2012-11-23 13:40:20 +01:00
|
|
|
using FilterParameters = memoryview<String>;
|
|
|
|
using FilterFactory = std::function<FilterAndId (const FilterParameters& params)>;
|
|
|
|
|
|
|
|
struct FilterRegistry : FunctionRegistry<FilterFactory>,
|
|
|
|
Singleton<FilterRegistry>
|
|
|
|
{};
|
|
|
|
|
2011-12-02 15:28:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // filter_hh_INCLUDED
|