2011-12-02 15:28:27 +01:00
|
|
|
#ifndef filter_hh_INCLUDED
|
|
|
|
#define filter_hh_INCLUDED
|
|
|
|
|
2012-11-23 13:40:20 +01:00
|
|
|
#include <functional>
|
|
|
|
|
2012-04-14 03:17:09 +02:00
|
|
|
#include "string.hh"
|
2012-11-23 13:40:20 +01:00
|
|
|
#include "utils.hh"
|
|
|
|
#include "memoryview.hh"
|
|
|
|
#include "function_registry.hh"
|
2011-12-02 15:28:27 +01:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class Buffer;
|
2012-11-23 18:35:05 +01:00
|
|
|
class 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>;
|
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
|