[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
pull/640/head
Marek Habersack 4 years ago committed by GitHub
parent e097723a63
commit e0462ed53a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2557,6 +2557,6 @@ struct ncvisual* ncvisual_from_plane(struct ncplane* n);
Marek Habersack has contributed (and maintains) C++ wrappers installed to
`include/ncpp/`, `libnotcurses++.so`, and `libnotcurses++.a`.
In their default mode, these wrappers never throw exceptions. If
`NCPP_EXCEPTIONS_PLEASE` is defined prior to including any NCPP headers,
they will throw exceptions.
In their default mode, these wrappers throw exceptions only from the type
constructors (RAII). If `NCPP_EXCEPTIONS_PLEASE` is defined prior to including
any NCPP headers, they will throw exceptions.

@ -83,6 +83,11 @@ namespace ncpp
bool stop ();
bool can_utf8 () const noexcept
{
return notcurses_canutf8 (nc);
}
bool can_fade () const noexcept
{
return notcurses_canfade (nc);
@ -205,6 +210,11 @@ namespace ncpp
notcurses_drop_planes (nc);
}
void debug (FILE *debugfp) const noexcept
{
notcurses_debug (nc, debugfp);
}
Plane* get_stdplane () noexcept
{
return new Plane (notcurses_stdplane (nc), true);

@ -115,6 +115,11 @@ namespace ncpp
return plane;
}
void center_abs (int *y, int *x) const noexcept
{
ncplane_center_abs (plane, y, x);
}
ncplane* to_ncplane () noexcept
{
return plane;
@ -652,6 +657,16 @@ namespace ncpp
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
{
return error_guard (ncplane_set_fg_alpha (plane, alpha), -1);
@ -1085,4 +1100,4 @@ namespace ncpp
friend class Tablet;
};
}
#endif
#endif

@ -44,6 +44,12 @@ namespace ncpp
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
{
return ncreader_contents(reader);

Loading…
Cancel
Save