Context: add methods bool has_{buffer,window)
This commit is contained in:
parent
6579b43ffb
commit
959ec46a16
|
@ -1,11 +1,12 @@
|
||||||
#ifndef context_hh_INCLUDED
|
#ifndef context_hh_INCLUDED
|
||||||
#define context_hh_INCLUDED
|
#define context_hh_INCLUDED
|
||||||
|
|
||||||
#include "window.hh"
|
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class Buffer;
|
||||||
|
class Window;
|
||||||
|
|
||||||
struct Context
|
struct Context
|
||||||
{
|
{
|
||||||
Context()
|
Context()
|
||||||
|
@ -21,12 +22,15 @@ struct Context
|
||||||
throw runtime_error("no buffer in context");
|
throw runtime_error("no buffer in context");
|
||||||
return *m_buffer;
|
return *m_buffer;
|
||||||
}
|
}
|
||||||
|
bool has_buffer() const { return m_buffer; }
|
||||||
|
|
||||||
Window& window() const
|
Window& window() const
|
||||||
{
|
{
|
||||||
if (not m_window)
|
if (not m_window)
|
||||||
throw runtime_error("no window in context");
|
throw runtime_error("no window in context");
|
||||||
return *m_window;
|
return *m_window;
|
||||||
}
|
}
|
||||||
|
bool has_window() const { return m_window; }
|
||||||
public:
|
public:
|
||||||
Window* m_window;
|
Window* m_window;
|
||||||
Buffer* m_buffer;
|
Buffer* m_buffer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user