2014-10-30 00:22:54 +01:00
|
|
|
#ifndef alias_registry_hh_INCLUDED
|
|
|
|
#define alias_registry_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "safe_ptr.hh"
|
|
|
|
#include "string.hh"
|
2014-12-16 19:57:19 +01:00
|
|
|
#include "unordered_map.hh"
|
2014-10-30 00:22:54 +01:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class AliasRegistry : public SafeCountable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AliasRegistry(AliasRegistry& parent) : m_parent(&parent) {}
|
|
|
|
void add_alias(String alias, String command);
|
|
|
|
void remove_alias(const String& alias);
|
|
|
|
StringView operator[](const String& name) const;
|
|
|
|
|
|
|
|
std::vector<StringView> aliases_for(StringView command) const;
|
|
|
|
|
|
|
|
private:
|
2014-10-30 15:00:42 +01:00
|
|
|
friend class Scope;
|
2014-10-30 00:22:54 +01:00
|
|
|
AliasRegistry() {}
|
|
|
|
|
|
|
|
safe_ptr<AliasRegistry> m_parent;
|
2014-12-16 19:57:19 +01:00
|
|
|
UnorderedMap<String, String> m_aliases;
|
2014-10-30 00:22:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // alias_registry_hh_INCLUDED
|