Notcurses 3.0.13
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
Root Class Reference

#include <Root.hh>

Inheritance diagram for Root:

Public Member Functions

notcursesget_notcurses () const
 
NotCursesget_notcurses_cpp () const
 

Protected Member Functions

 Root (NotCurses *ncinst)
 
bool is_notcurses_stopped () const noexcept
 

Static Protected Member Functions

template<typename TRet = bool, typename TValue = int>
static TRet error_guard (TValue ret, TValue error_value)
 
template<typename TRet = bool, typename TValue = int>
static TRet error_guard_cond (TValue ret, bool error_value)
 

Static Protected Attributes

static constexpr char ncpp_invalid_state_message [] = "notcurses++ is in an invalid state (already stopped?)"
 

Detailed Description

Definition at line 20 of file Root.hh.

Constructor & Destructor Documentation

◆ Root()

Root ( NotCurses ncinst)
inlineexplicitprotected

Definition at line 34 of file Root.hh.

35 : nc (ncinst)
36 {}
static TRet error_guard(TValue ret, TValue error_value)
Definition Root.hh:39

Member Function Documentation

◆ error_guard()

template<typename TRet = bool, typename TValue = int>
static TRet error_guard ( TValue  ret,
TValue  error_value 
)
inlinestaticprotected

Definition at line 39 of file Root.hh.

40 {
41 static constexpr bool ret_is_bool = std::is_same_v<TRet, bool>;
42
43 if constexpr (!ret_is_bool) {
44 static_assert (std::is_same_v<TRet, TValue>, "Both TRet and TValue must be the same type unless TValue is 'bool'");
45 }
46
47 if (ret != error_value) {
48 if constexpr (ret_is_bool) {
49 return true;
50 } else {
51 return ret;
52 }
53 }
54
55#if defined (NCPP_EXCEPTIONS_PLEASE)
56 throw call_error ("Call returned an error value");
57#else
58 if constexpr (ret_is_bool) {
59 return false;
60 } else {
61 return ret;
62 }
63#endif
64 }

◆ error_guard_cond()

template<typename TRet = bool, typename TValue = int>
static TRet error_guard_cond ( TValue  ret,
bool  error_value 
)
inlinestaticprotected

Definition at line 67 of file Root.hh.

68 {
69 static constexpr bool ret_is_bool = std::is_same_v<TRet, bool>;
70
71 if constexpr (!ret_is_bool) {
72 static_assert (std::is_same_v<TRet, TValue>, "Both TRet and TValue must be the same type unless TValue is 'bool'");
73 }
74
75 if (!error_value) {
76 if constexpr (ret_is_bool) {
77 return true;
78 } else {
79 return ret;
80 }
81 }
82
83#if defined (NCPP_EXCEPTIONS_PLEASE)
84 throw call_error ("Call returned an error value");
85#else
86 if constexpr (ret_is_bool) {
87 return false;
88 } else {
89 return ret;
90 }
91#endif
92 }

◆ get_notcurses()

notcurses * get_notcurses ( ) const

◆ get_notcurses_cpp()

NotCurses * get_notcurses_cpp ( ) const
inline

Definition at line 28 of file Root.hh.

29 {
30 return nc;
31 }

◆ is_notcurses_stopped()

bool is_notcurses_stopped ( ) const
protectednoexcept

Field Documentation

◆ ncpp_invalid_state_message

constexpr char ncpp_invalid_state_message[] = "notcurses++ is in an invalid state (already stopped?)"
staticconstexprprotected

Definition at line 23 of file Root.hh.


The documentation for this class was generated from the following file: