mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
[C++] Sync API changes (#633)
Added: * NotCurses: can_utf8 (`notcurses_canutf8`) * NotCurses: debug (`notcurses_debug`) * Plane: center_abs (`ncplane_center_abs`) * Plane: set_channels (`ncplane_set_channels`) * Plane: set_attr (`ncplane_set_attr`) * Reader: clear (`ncreader_clear`) Changed: * USAGE.md: clarfied when C++ throws exceptions
This commit is contained in:
parent
e097723a63
commit
e0462ed53a
6
USAGE.md
6
USAGE.md
@ -2557,6 +2557,6 @@ struct ncvisual* ncvisual_from_plane(struct ncplane* n);
|
|||||||
Marek Habersack has contributed (and maintains) C++ wrappers installed to
|
Marek Habersack has contributed (and maintains) C++ wrappers installed to
|
||||||
`include/ncpp/`, `libnotcurses++.so`, and `libnotcurses++.a`.
|
`include/ncpp/`, `libnotcurses++.so`, and `libnotcurses++.a`.
|
||||||
|
|
||||||
In their default mode, these wrappers never throw exceptions. If
|
In their default mode, these wrappers throw exceptions only from the type
|
||||||
`NCPP_EXCEPTIONS_PLEASE` is defined prior to including any NCPP headers,
|
constructors (RAII). If `NCPP_EXCEPTIONS_PLEASE` is defined prior to including
|
||||||
they will throw exceptions.
|
any NCPP headers, they will throw exceptions.
|
||||||
|
@ -83,6 +83,11 @@ namespace ncpp
|
|||||||
|
|
||||||
bool stop ();
|
bool stop ();
|
||||||
|
|
||||||
|
bool can_utf8 () const noexcept
|
||||||
|
{
|
||||||
|
return notcurses_canutf8 (nc);
|
||||||
|
}
|
||||||
|
|
||||||
bool can_fade () const noexcept
|
bool can_fade () const noexcept
|
||||||
{
|
{
|
||||||
return notcurses_canfade (nc);
|
return notcurses_canfade (nc);
|
||||||
@ -205,6 +210,11 @@ namespace ncpp
|
|||||||
notcurses_drop_planes (nc);
|
notcurses_drop_planes (nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debug (FILE *debugfp) const noexcept
|
||||||
|
{
|
||||||
|
notcurses_debug (nc, debugfp);
|
||||||
|
}
|
||||||
|
|
||||||
Plane* get_stdplane () noexcept
|
Plane* get_stdplane () noexcept
|
||||||
{
|
{
|
||||||
return new Plane (notcurses_stdplane (nc), true);
|
return new Plane (notcurses_stdplane (nc), true);
|
||||||
|
@ -115,6 +115,11 @@ namespace ncpp
|
|||||||
return plane;
|
return plane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void center_abs (int *y, int *x) const noexcept
|
||||||
|
{
|
||||||
|
ncplane_center_abs (plane, y, x);
|
||||||
|
}
|
||||||
|
|
||||||
ncplane* to_ncplane () noexcept
|
ncplane* to_ncplane () noexcept
|
||||||
{
|
{
|
||||||
return plane;
|
return plane;
|
||||||
@ -652,6 +657,16 @@ namespace ncpp
|
|||||||
return ncplane_fg_alpha (plane);
|
return ncplane_fg_alpha (plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_channels (uint64_t channels) const noexcept
|
||||||
|
{
|
||||||
|
ncplane_set_channels (plane, channels);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_attr (uint32_t attrword) const noexcept
|
||||||
|
{
|
||||||
|
ncplane_set_attr (plane, attrword);
|
||||||
|
}
|
||||||
|
|
||||||
bool set_fg_alpha (int alpha) const NOEXCEPT_MAYBE
|
bool set_fg_alpha (int alpha) const NOEXCEPT_MAYBE
|
||||||
{
|
{
|
||||||
return error_guard (ncplane_set_fg_alpha (plane, alpha), -1);
|
return error_guard (ncplane_set_fg_alpha (plane, alpha), -1);
|
||||||
@ -1085,4 +1100,4 @@ namespace ncpp
|
|||||||
friend class Tablet;
|
friend class Tablet;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -44,6 +44,12 @@ namespace ncpp
|
|||||||
ncreader_destroy (reader, nullptr);
|
ncreader_destroy (reader, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool clear () const NOEXCEPT_MAYBE
|
||||||
|
{
|
||||||
|
bool ret = ncreader_clear (reader) != 0;
|
||||||
|
return error_guard_cond<bool, bool> (ret, ret);
|
||||||
|
}
|
||||||
|
|
||||||
char* get_contents () const noexcept
|
char* get_contents () const noexcept
|
||||||
{
|
{
|
||||||
return ncreader_contents(reader);
|
return ncreader_contents(reader);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user