From 4c8b4890e669f4fbd902dbdd9607a3df647863c9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 10 Oct 2012 13:57:15 +0200 Subject: [PATCH] Context: explicit constructors and more comments --- src/context.hh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/context.hh b/src/context.hh index ecca3137..7b03708e 100644 --- a/src/context.hh +++ b/src/context.hh @@ -8,19 +8,24 @@ namespace Kakoune { -// A Context is provided to all commands, it permits -// to access a client, window, editor or buffer if available. +// A Context is used to access non singleton objects for various services +// in commands. +// +// The Context object links a Client, an Editor (which may be a Window), +// and a UserInterface. It may represent an interactive user window, or +// a hook execution or a macro replay. struct Context { Context() {} - Context(Editor& editor) + explicit Context(Editor& editor) : m_editor(&editor) {} - Context(Client& client) + explicit Context(Client& client) : m_client(&client) {} // to allow func(Context(Editor(...))) - Context(Editor&& editor) + // make sure the context will not survive the next ';' + explicit Context(Editor&& editor) : m_editor(&editor) {} Context(const Context&) = delete;