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

#include <NotCurses.hh>

Inheritance diagram for NotCurses:
Collaboration diagram for NotCurses:

Public Member Functions

 NotCurses (FILE *fp=nullptr)
 
 NotCurses (const notcurses_options &nc_opts, FILE *fp=nullptr)
 
 NotCurses (const NotCurses &other)=delete
 
 NotCurses (NotCurses &&other)=delete
 
 ~NotCurses ()
 
 operator notcurses * () noexcept
 
 operator notcurses const * () const noexcept
 
bool stop ()
 
bool can_sextant () const noexcept
 
bool can_octant () const noexcept
 
bool can_utf8 () const noexcept
 
bool can_fade () const noexcept
 
bool can_open_images () const noexcept
 
bool can_open_videos () const noexcept
 
bool can_change_color () const noexcept
 
bool can_truecolor () const noexcept
 
int cursor_enable (int y, int x) const NOEXCEPT_MAYBE
 
int cursor_disable () const NOEXCEPT_MAYBE
 
void get_stats (ncstats *stats) const noexcept
 
void reset_stats (ncstats *stats) const
 
bool use (const Palette *p) const
 
bool use (const Palette &p) const NOEXCEPT_MAYBE
 
bool render () const NOEXCEPT_MAYBE
 
void get_term_dim (unsigned *rows, unsigned *cols) const noexcept
 
void get_term_dim (unsigned &rows, unsigned &cols) const noexcept
 
bool refresh (unsigned *rows, unsigned *cols) const NOEXCEPT_MAYBE
 
bool refresh (unsigned &rows, unsigned &cols) const NOEXCEPT_MAYBE
 
unsigned get_palette_size () const noexcept
 
bool mouse_enable (unsigned eventmask) const NOEXCEPT_MAYBE
 
bool mouse_disable () const NOEXCEPT_MAYBE
 
CellStyle get_supported_styles () const noexcept
 
uint32_t get (const timespec *ts, ncinput *ni=nullptr) const noexcept
 
uint32_t get (bool blocking=false, ncinput *ni=nullptr) const noexcept
 
charget_at (int yoff, int xoff, uint16_t *attr, uint64_t *channels) const noexcept
 
int get_inputready_fd () const noexcept
 
void drop_planes () const noexcept
 
void debug (FILE *debugfp) const noexcept
 
bool align (int availcols, ncalign_e align, int cols) const NOEXCEPT_MAYBE
 
bool linesigs_enable () const NOEXCEPT_MAYBE
 
bool linesigs_disable () const NOEXCEPT_MAYBE
 
ncstatsstats_alloc () const noexcept
 
ncblitter_e get_media_defblitter (ncscale_e scale) noexcept
 
Planeget_stdplane () noexcept
 
Planeget_stdplane (unsigned *y, unsigned *x)
 
Planeget_stdplane (unsigned &y, unsigned &x) noexcept
 
Planeget_top () noexcept
 
Planeget_bottom () noexcept
 
- Public Member Functions inherited from Root
notcursesget_notcurses () const
 
NotCursesget_notcurses_cpp () const
 

Static Public Member Functions

static NotCursesget_instance ()
 
static bool is_notcurses_stopped (const NotCurses *ncinst=nullptr)
 
static const charncmetric (uintmax_t val, uintmax_t decimal, char *buf, int omitdec, unsigned mult, int uprefix) noexcept
 
static const charncqprefix (uintmax_t val, uintmax_t decimal, char *buf, int omitdec) noexcept
 
static const charnciprefix (uintmax_t val, uintmax_t decimal, char *buf, int omitdec) noexcept
 
static const charncbprefix (uintmax_t val, uintmax_t decimal, char *buf, int omitdec) noexcept
 
static const charversion () noexcept
 
static void version_components (int *major, int *minor, int *patch, int *tweak) noexcept
 
static const charstr_blitter (ncblitter_e blitter) noexcept
 
static const charstr_scalemode (ncscale_e scalemode) noexcept
 
static bool lex_margins (const char *op, notcurses_options *opts) NOEXCEPT_MAYBE
 
static bool lex_blitter (const char *op, ncblitter_e *blitter) NOEXCEPT_MAYBE
 
static bool lex_scalemode (const char *op, ncscale_e *scalemode) NOEXCEPT_MAYBE
 
static bool ucs32_to_utf8 (const uint32_t *ucs32, unsigned ucs32count, unsigned char *resultbuf, size_t buflen) NOEXCEPT_MAYBE
 

Static Public Attributes

static notcurses_options default_notcurses_options
 

Additional Inherited Members

- Protected Member Functions inherited from Root
 Root (NotCurses *ncinst)
 
bool is_notcurses_stopped () const noexcept
 
- Static Protected Member Functions inherited from Root
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 inherited from Root
static constexpr char ncpp_invalid_state_message [] = "notcurses++ is in an invalid state (already stopped?)"
 

Detailed Description

Definition at line 21 of file NotCurses.hh.

Constructor & Destructor Documentation

◆ NotCurses() [1/4]

NotCurses ( FILE fp = nullptr)
inlineexplicit

Definition at line 27 of file NotCurses.hh.

29 {}
static notcurses_options default_notcurses_options
Definition NotCurses.hh:24
NotCurses(FILE *fp=nullptr)
Definition NotCurses.hh:27
static TRet error_guard(TValue ret, TValue error_value)
Definition Root.hh:39

◆ NotCurses() [2/4]

NotCurses ( const notcurses_options nc_opts,
FILE fp = nullptr 
)
explicit

◆ NotCurses() [3/4]

NotCurses ( const NotCurses other)
delete

◆ NotCurses() [4/4]

NotCurses ( NotCurses &&  other)
delete

◆ ~NotCurses()

~NotCurses ( )

Member Function Documentation

◆ align()

bool align ( int  availcols,
ncalign_e  align,
int  cols 
) const
inline

Definition at line 281 of file NotCurses.hh.

282 {
283 return error_guard (notcurses_align (availcols, align, cols), -INT_MAX);
284 }
bool align(int availcols, ncalign_e align, int cols) const NOEXCEPT_MAYBE
Definition NotCurses.hh:281

◆ can_change_color()

bool can_change_color ( ) const
inlinenoexcept

Definition at line 154 of file NotCurses.hh.

155 {
156 return notcurses_canchangecolor (nc);
157 }

◆ can_fade()

bool can_fade ( ) const
inlinenoexcept

Definition at line 139 of file NotCurses.hh.

140 {
141 return notcurses_canfade (nc);
142 }

◆ can_octant()

bool can_octant ( ) const
inlinenoexcept

Definition at line 129 of file NotCurses.hh.

130 {
131 return notcurses_canoctant (nc);
132 }

◆ can_open_images()

bool can_open_images ( ) const
inlinenoexcept

Definition at line 144 of file NotCurses.hh.

145 {
146 return notcurses_canopen_images (nc);
147 }
bool notcurses_canopen_images(const notcurses *nc __attribute__((unused)))
Definition visual.c:1357
Here is the call graph for this function:

◆ can_open_videos()

bool can_open_videos ( ) const
inlinenoexcept

Definition at line 149 of file NotCurses.hh.

150 {
151 return notcurses_canopen_videos (nc);
152 }
bool notcurses_canopen_videos(const notcurses *nc __attribute__((unused)))
Definition visual.c:1364
Here is the call graph for this function:

◆ can_sextant()

bool can_sextant ( ) const
inlinenoexcept

Definition at line 124 of file NotCurses.hh.

125 {
126 return notcurses_cansextant (nc);
127 }

◆ can_truecolor()

bool can_truecolor ( ) const
inlinenoexcept

Definition at line 159 of file NotCurses.hh.

160 {
161 return notcurses_cantruecolor (nc);
162 }

◆ can_utf8()

bool can_utf8 ( ) const
inlinenoexcept

Definition at line 134 of file NotCurses.hh.

135 {
136 return notcurses_canutf8 (nc);
137 }

◆ cursor_disable()

int cursor_disable ( ) const
inline

Definition at line 169 of file NotCurses.hh.

170 {
171 return error_guard (notcurses_cursor_disable (nc), -1);
172 }
int notcurses_cursor_disable(notcurses *nc)
Definition render.c:1772
Here is the call graph for this function:

◆ cursor_enable()

int cursor_enable ( int  y,
int  x 
) const
inline

Definition at line 164 of file NotCurses.hh.

165 {
166 return error_guard (notcurses_cursor_enable (nc, y, x), -1);
167 }
int y
Definition notcurses.h:1905
int int x
Definition notcurses.h:1905
int notcurses_cursor_enable(notcurses *nc, int y, int x)
Definition render.c:1738
Here is the call graph for this function:

◆ debug()

void debug ( FILE debugfp) const
inlinenoexcept

Definition at line 276 of file NotCurses.hh.

277 {
279 }
void notcurses_debug(const notcurses *nc, FILE *debugfp)
Definition debug.c:5
Here is the call graph for this function:

◆ drop_planes()

void drop_planes ( ) const
inlinenoexcept

Definition at line 271 of file NotCurses.hh.

272 {
274 }
void notcurses_drop_planes(notcurses *nc)
Definition notcurses.c:1434
Here is the call graph for this function:

◆ get() [1/2]

uint32_t get ( bool  blocking = false,
ncinput ni = nullptr 
) const
inlinenoexcept

Definition at line 253 of file NotCurses.hh.

254 {
255 if (blocking)
256 return notcurses_get_blocking (nc, ni);
257
258 return notcurses_get_nblock (nc, ni);
259 }

◆ get() [2/2]

uint32_t get ( const timespec ts,
ncinput ni = nullptr 
) const
inlinenoexcept

Definition at line 248 of file NotCurses.hh.

249 {
250 return notcurses_get (nc, ts, ni);
251 }
uint32_t notcurses_get(notcurses *nc, const struct timespec *absdl, ncinput *ni)
Definition in.c:2751
Here is the call graph for this function:

◆ get_at()

char * get_at ( int  yoff,
int  xoff,
uint16_t attr,
uint64_t channels 
) const
inlinenoexcept

Definition at line 261 of file NotCurses.hh.

262 {
263 return notcurses_at_yx (nc, yoff, xoff, attr, channels);
264 }
char * notcurses_at_yx(notcurses *nc, unsigned yoff, unsigned xoff, uint16_t *stylemask, uint64_t *channels)
Definition render.c:1625
Here is the call graph for this function:

◆ get_bottom()

Plane * get_bottom ( )
noexcept

◆ get_inputready_fd()

int get_inputready_fd ( ) const
inlinenoexcept

Definition at line 266 of file NotCurses.hh.

267 {
268 return notcurses_inputready_fd (nc);
269 }
int notcurses_inputready_fd(notcurses *n)
Definition notcurses.c:3091
Here is the call graph for this function:

◆ get_instance()

static NotCurses & get_instance ( )
inlinestatic

Definition at line 49 of file NotCurses.hh.

50 {
51 if (_instance == nullptr)
52 throw invalid_state_error ("NotCurses instance not found.");
53 if (_instance->nc == nullptr)
54 throw invalid_state_error (ncpp_invalid_state_message);
55
56 return *_instance;
57 }
static constexpr char ncpp_invalid_state_message[]
Definition Root.hh:23

◆ get_media_defblitter()

ncblitter_e get_media_defblitter ( ncscale_e  scale)
inlinenoexcept

Definition at line 306 of file NotCurses.hh.

307 {
308 return ncvisual_media_defblitter (nc, scale);
309 }
ncblitter_e ncvisual_media_defblitter(const notcurses *nc, ncscale_e scale)
Definition blit.c:1475
Here is the call graph for this function:

◆ get_palette_size()

unsigned get_palette_size ( ) const
inlinenoexcept

Definition at line 228 of file NotCurses.hh.

229 {
230 return notcurses_palette_size (static_cast<const notcurses*> (nc));
231 }
unsigned notcurses_palette_size(const notcurses *nc)
Definition notcurses.c:2062
Here is the call graph for this function:

◆ get_stats()

void get_stats ( ncstats stats) const
inlinenoexcept

Definition at line 174 of file NotCurses.hh.

175 {
176 if (stats == nullptr)
177 return;
178
179 notcurses_stats (nc, stats);
180 }
void notcurses_stats(notcurses *nc, ncstats *stats)
Definition stats.c:86
Here is the call graph for this function:

◆ get_stdplane() [1/3]

Plane * get_stdplane ( )
inlinenoexcept

Definition at line 311 of file NotCurses.hh.

312 {
313 return new Plane (notcurses_stdplane (nc), true);
314 }
ncplane * notcurses_stdplane(notcurses *nc)
Definition notcurses.c:699
Here is the call graph for this function:

◆ get_stdplane() [2/3]

Plane * get_stdplane ( unsigned y,
unsigned x 
)
inlinenoexcept

Definition at line 326 of file NotCurses.hh.

327 {
328 return new Plane (notcurses_stddim_yx (nc, &y, &x));
329 }

◆ get_stdplane() [3/3]

Plane * get_stdplane ( unsigned y,
unsigned x 
)
inline

Definition at line 316 of file NotCurses.hh.

317 {
318 if (y == nullptr)
319 throw invalid_argument ("'y' must be a valid pointer");
320 if (x == nullptr)
321 throw invalid_argument ("'x' must be a valid pointer");
322
323 return get_stdplane (*y, *x);
324 }
Plane * get_stdplane() noexcept
Definition NotCurses.hh:311

◆ get_supported_styles()

CellStyle get_supported_styles ( ) const
inlinenoexcept

Definition at line 243 of file NotCurses.hh.

244 {
245 return static_cast<CellStyle>(notcurses_supported_styles (nc));
246 }
CellStyle
Definition CellStyle.hh:13
uint16_t notcurses_supported_styles(const notcurses *nc)
Definition notcurses.c:2058
Here is the call graph for this function:

◆ get_term_dim() [1/2]

void get_term_dim ( unsigned rows,
unsigned cols 
) const
inlinenoexcept

Definition at line 213 of file NotCurses.hh.

214 {
215 get_term_dim (&rows, &cols);
216 }
void get_term_dim(unsigned *rows, unsigned *cols) const noexcept
Definition NotCurses.hh:208

◆ get_term_dim() [2/2]

void get_term_dim ( unsigned rows,
unsigned cols 
) const
inlinenoexcept

Definition at line 208 of file NotCurses.hh.

209 {
210 notcurses_term_dim_yx (nc, rows, cols);
211 }

◆ get_top()

Plane * get_top ( )
noexcept

◆ is_notcurses_stopped()

static bool is_notcurses_stopped ( const NotCurses ncinst = nullptr)
inlinestatic

Definition at line 59 of file NotCurses.hh.

60 {
61 if (ncinst != nullptr)
62 return ncinst->nc == nullptr;
63
64 return *_instance == nullptr || _instance->nc == nullptr;
65 }

◆ lex_blitter()

static bool lex_blitter ( const char op,
ncblitter_e blitter 
)
inlinestatic

Definition at line 112 of file NotCurses.hh.

113 {
114 return error_guard (notcurses_lex_blitter (op, blitter), -1);
115 }
int notcurses_lex_blitter(const char *op, ncblitter_e *blitfxn)
Definition blit.c:1378
Here is the call graph for this function:

◆ lex_margins()

static bool lex_margins ( const char op,
notcurses_options opts 
)
inlinestatic

Definition at line 107 of file NotCurses.hh.

108 {
110 }
int notcurses_lex_margins(const char *op, notcurses_options *opts)
Definition notcurses.c:3067
const struct ncplane_options * opts
Definition notcurses.h:3483
Here is the call graph for this function:

◆ lex_scalemode()

static bool lex_scalemode ( const char op,
ncscale_e scalemode 
)
inlinestatic

Definition at line 117 of file NotCurses.hh.

118 {
120 }
int notcurses_lex_scalemode(const char *op, ncscale_e *scalemode)
Definition notcurses.c:3035
Here is the call graph for this function:

◆ linesigs_disable()

bool linesigs_disable ( ) const
inline

Definition at line 291 of file NotCurses.hh.

292 {
293 return error_guard (notcurses_linesigs_disable (nc), -1);
294 }
int notcurses_linesigs_disable(notcurses *nc)
Definition in.c:2850
Here is the call graph for this function:

◆ linesigs_enable()

bool linesigs_enable ( ) const
inline

Definition at line 286 of file NotCurses.hh.

287 {
288 return error_guard (notcurses_linesigs_enable (nc), -1);
289 }
int notcurses_linesigs_enable(notcurses *n)
Definition in.c:2892
Here is the call graph for this function:

◆ mouse_disable()

bool mouse_disable ( ) const
inline

Definition at line 238 of file NotCurses.hh.

239 {
240 return error_guard (notcurses_mice_disable (nc), -1);
241 }

◆ mouse_enable()

bool mouse_enable ( unsigned  eventmask) const
inline

Definition at line 233 of file NotCurses.hh.

234 {
236 }
int notcurses_mice_enable(notcurses *n, unsigned eventmask)
Definition notcurses.c:2556
Here is the call graph for this function:

◆ ncbprefix()

static const char * ncbprefix ( uintmax_t  val,
uintmax_t  decimal,
char buf,
int  omitdec 
)
inlinestaticnoexcept

Definition at line 82 of file NotCurses.hh.

83 {
84 return ::ncbprefix (val, decimal, buf, omitdec);
85 }

◆ nciprefix()

static const char * nciprefix ( uintmax_t  val,
uintmax_t  decimal,
char buf,
int  omitdec 
)
inlinestaticnoexcept

Definition at line 77 of file NotCurses.hh.

78 {
79 return ::nciprefix (val, decimal, buf, omitdec);
80 }

◆ ncmetric()

static const char * ncmetric ( uintmax_t  val,
uintmax_t  decimal,
char buf,
int  omitdec,
unsigned  mult,
int  uprefix 
)
inlinestaticnoexcept

Definition at line 67 of file NotCurses.hh.

68 {
69 return ::ncnmetric (val, INT_MAX, decimal, buf, omitdec, mult, uprefix);
70 }

◆ ncqprefix()

static const char * ncqprefix ( uintmax_t  val,
uintmax_t  decimal,
char buf,
int  omitdec 
)
inlinestaticnoexcept

Definition at line 72 of file NotCurses.hh.

73 {
74 return ::ncqprefix (val, decimal, buf, omitdec);
75 }

◆ operator notcurses *()

operator notcurses * ( )
inlinenoexcept

Definition at line 39 of file NotCurses.hh.

40 {
41 return nc;
42 }

◆ operator notcurses const *()

operator notcurses const * ( ) const
inlinenoexcept

Definition at line 44 of file NotCurses.hh.

45 {
46 return nc;
47 }

◆ refresh() [1/2]

bool refresh ( unsigned rows,
unsigned cols 
) const
inline

Definition at line 223 of file NotCurses.hh.

224 {
225 return refresh (&rows, &cols);
226 }
bool refresh(unsigned *rows, unsigned *cols) const NOEXCEPT_MAYBE
Definition NotCurses.hh:218

◆ refresh() [2/2]

bool refresh ( unsigned rows,
unsigned cols 
) const
inline

Definition at line 218 of file NotCurses.hh.

219 {
220 return error_guard (notcurses_refresh (nc, rows, cols), -1);
221 }
int notcurses_refresh(notcurses *nc, unsigned *restrict dimy, unsigned *restrict dimx)
Definition render.c:1417
Here is the call graph for this function:

◆ render()

bool render ( ) const
inline

Definition at line 203 of file NotCurses.hh.

204 {
205 return error_guard (notcurses_render (nc), -1);
206 }

◆ reset_stats()

void reset_stats ( ncstats stats) const
inline

Definition at line 182 of file NotCurses.hh.

183 {
184 if (stats == nullptr)
185 throw invalid_argument ("'stats' must be a valid pointer");
186
187 notcurses_stats_reset (nc, stats);
188 }
void notcurses_stats_reset(notcurses *nc, ncstats *stats)
Definition stats.c:100
Here is the call graph for this function:

◆ stats_alloc()

ncstats * stats_alloc ( ) const
inlinenoexcept

Definition at line 296 of file NotCurses.hh.

297 {
298 return notcurses_stats_alloc (nc);
299 }
ncstats * notcurses_stats_alloc(const notcurses *nc __attribute__((unused)))
Definition stats.c:92
Here is the call graph for this function:

◆ stop()

bool stop ( )

◆ str_blitter()

static const char * str_blitter ( ncblitter_e  blitter)
inlinestaticnoexcept

Definition at line 97 of file NotCurses.hh.

98 {
99 return notcurses_str_blitter (blitter);
100 }
const char * notcurses_str_blitter(ncblitter_e blitfxn)
Definition blit.c:1394
Here is the call graph for this function:

◆ str_scalemode()

static const char * str_scalemode ( ncscale_e  scalemode)
inlinestaticnoexcept

Definition at line 102 of file NotCurses.hh.

103 {
105 }
const char * notcurses_str_scalemode(ncscale_e scalemode)
Definition notcurses.c:3052
Here is the call graph for this function:

◆ ucs32_to_utf8()

static bool ucs32_to_utf8 ( const uint32_t ucs32,
unsigned  ucs32count,
unsigned char resultbuf,
size_t  buflen 
)
inlinestatic

Definition at line 301 of file NotCurses.hh.

302 {
304 }
int notcurses_ucs32_to_utf8(const uint32_t *ucs32, unsigned ucs32count, unsigned char *resultbuf, size_t buflen)
Definition notcurses.c:3301
Here is the call graph for this function:

◆ use() [1/2]

bool use ( const Palette p) const
inline

Definition at line 198 of file NotCurses.hh.

199 {
200 return error_guard (ncpalette_use (nc, reinterpret_cast<const ncpalette*>(&p)), -1);
201 }
int ncpalette_use(notcurses *nc, const ncpalette *p)
Definition notcurses.c:2571
Here is the call graph for this function:

◆ use() [2/2]

bool use ( const Palette p) const
inline

Definition at line 190 of file NotCurses.hh.

191 {
192 if (p == nullptr)
193 throw invalid_argument ("'p' must be a valid pointer");
194
195 return use (*p);
196 }
bool use(const Palette *p) const
Definition NotCurses.hh:190

◆ version()

static const char * version ( )
inlinestaticnoexcept

Definition at line 87 of file NotCurses.hh.

88 {
89 return notcurses_version ();
90 }
const char * notcurses_version(void)
Definition notcurses.c:182
Here is the call graph for this function:

◆ version_components()

static void version_components ( int major,
int minor,
int patch,
int tweak 
)
inlinestaticnoexcept

Definition at line 92 of file NotCurses.hh.

93 {
95 }
void notcurses_version_components(int *major, int *minor, int *patch, int *tweak)
Definition notcurses.c:24
Here is the call graph for this function:

Field Documentation

◆ default_notcurses_options

notcurses_options default_notcurses_options
static

Definition at line 24 of file NotCurses.hh.


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