Context: add methods bool has_{buffer,window)

This commit is contained in:
Maxime Coste 2012-01-31 13:38:06 +00:00
parent 6579b43ffb
commit 959ec46a16

View File

@ -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;