From 959ec46a167203e69f2f1bad1569034206f02420 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 31 Jan 2012 13:38:06 +0000 Subject: [PATCH] Context: add methods bool has_{buffer,window) --- src/context.hh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/context.hh b/src/context.hh index 53f4ad1b..3b292e54 100644 --- a/src/context.hh +++ b/src/context.hh @@ -1,11 +1,12 @@ #ifndef context_hh_INCLUDED #define context_hh_INCLUDED -#include "window.hh" - namespace Kakoune { +class Buffer; +class Window; + struct Context { Context() @@ -21,12 +22,15 @@ struct Context throw runtime_error("no buffer in context"); return *m_buffer; } + bool has_buffer() const { return m_buffer; } + Window& window() const { if (not m_window) throw runtime_error("no window in context"); return *m_window; } + bool has_window() const { return m_window; } public: Window* m_window; Buffer* m_buffer;