2014-10-30 02:22:54 +03:00
|
|
|
#ifndef alias_registry_hh_INCLUDED
|
|
|
|
#define alias_registry_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "safe_ptr.hh"
|
|
|
|
#include "string.hh"
|
2017-03-07 04:12:37 +03:00
|
|
|
#include "hash_map.hh"
|
2014-10-30 02:22:54 +03:00
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
class AliasRegistry : public SafeCountable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AliasRegistry(AliasRegistry& parent) : m_parent(&parent) {}
|
|
|
|
void add_alias(String alias, String command);
|
2015-09-17 00:32:02 +03:00
|
|
|
void remove_alias(StringView alias);
|
|
|
|
StringView operator[](StringView name) const;
|
2014-10-30 02:22:54 +03:00
|
|
|
|
2017-03-07 04:12:37 +03:00
|
|
|
using AliasMap = HashMap<String, String, MemoryDomain::Aliases>;
|
2015-09-06 20:09:32 +03:00
|
|
|
using iterator = AliasMap::const_iterator;
|
|
|
|
|
2015-01-12 16:58:41 +03:00
|
|
|
Vector<StringView> aliases_for(StringView command) const;
|
2014-10-30 02:22:54 +03:00
|
|
|
|
|
|
|
private:
|
2014-10-30 17:00:42 +03:00
|
|
|
friend class Scope;
|
2014-10-30 02:22:54 +03:00
|
|
|
AliasRegistry() {}
|
|
|
|
|
2015-02-19 16:58:25 +03:00
|
|
|
SafePtr<AliasRegistry> m_parent;
|
2015-09-17 00:32:02 +03:00
|
|
|
AliasMap m_aliases;
|
2014-10-30 02:22:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // alias_registry_hh_INCLUDED
|