ase/utils.hh file


Namespaces

namespace Ase
The Anklang C++ API namespace.
namespace Ase::Aux
Auxillary algorithms brodly useful.

Classes

class Ase::EventFd
Wakeup facility for IPC.
template <typename T>
class Ase::CustomDataKey
CustomDataKey objects are used to identify and manage custom data members of CustomDataContainer objects.
class Ase::CustomDataContainer

Functions

template <typename Value>
static auto compare_greater(const Value& v1, const Value& v2) →  int
Comparison function useful to sort greater items first.
template <typename Value>
static auto compare_lesser(const Value& v1, const Value& v2) →  int
Comparison function useful to sort lesser items first.
template <std::size_t LAST, typename MkFun>
static auto make_case_table(const MkFun& mkjump) →  auto
template <typename MkFun, size_t ... INDICES>
static auto make_indexed_table(const MkFun& mkjump, std::index_sequence<INDICES...>) →  auto
Create a std::array<Fun,N>, where Fun is returned from mkjump (INDICES…).
auto KwIcon(const String& keywords) →  IconString
Create an IconString consisting of keywords.
auto SvgIcon(const String& svgdata) →  IconString
Create an IconString consisting of an SVG string.
auto UcIcon(const String& unicode) →  IconString
Create an IconString consisting of a single/double unicode character.
template <class A0, class... Ar>
auto ase_gettext(const char* format, const A0& a0, const Ar&... restargs) →  const char*
Translate a string, using the ASE locale.
template <typename RandIter, class Cmp, typename Arg>
auto binary_lookup(RandIter begin, RandIter end, Cmp cmp_elements, const Arg& arg) →  RandIter
template <typename RandIter, class Cmp, typename Arg>
auto binary_lookup_insertion_pos(RandIter begin, RandIter end, Cmp cmp_elements, const Arg& arg) →  std::pair<RandIter, bool>
template <typename RandIter, class Cmp, typename Arg>
auto binary_lookup_sibling(RandIter begin, RandIter end, Cmp cmp_elements, const Arg& arg) →  RandIter
template <class Container, class Iteratable>
auto container_copy(const Iteratable& source) →  Container
Create a Container with copies of the elements of source.
template <typename C>
auto contains(const C& container, const std::function<bool(typename C::value_type const&value)>& pred) →  bool
Returns true if container element for which pred() is true.
template <class ... Args>
auto debug(const char* cond, const char* format, const Args&... args) →  void ASE_ALWAYS_INLINE
Issue a printf-like debugging message if cond is enabled by $ASE_DEBUG.
auto debug_enabled() →  bool
Check if any kind of debugging is enabled by $ASE_DEBUG.
auto debug_key_enabled(const char* conditional) →  bool
Check if conditional is enabled by $ASE_DEBUG.
auto debug_key_value(const char* conditional) →  ::std::string
Retrieve the value assigned to debug key conditional in $ASE_DEBUG.
void debug_message(const char* cond, const std::string& message)
Print a debug message, called from Ase::debug().
void diag_flush(uint8 code, const String& txt)
Handle stdout and stderr printing with flushing.
auto diag_prefix(uint8 code) →  String
Create prefix for warnings and errors.
template <class C>
auto erase_all(C& container, const std::function<bool(typename C::value_type const&value)>& pred) →  size_t
Erase all elements for which pred() is true in vector or list.
template <class C>
auto erase_first(C& container, const std::function<bool(typename C::value_type const&value)>& pred) →  size_t
Erase first element for which pred() is true in vector or list.
template <class ... Args>
auto fatal_error(const char* format, const Args&... args) →  void ASE_NORETURN
template <class T, class Compare>
auto insert_sorted(std::vector<T>& vec, const T& value, Compare compare) →  std::vector<T>::iterator
Insert value into sorted vec using binary_lookup_insertion_pos() with compare.
auto operator""_icon(const char* key, size_t) →  IconString
Create an IconString consisting of keywords.
auto operator""_uc(const char* key, size_t) →  IconString
Create an IconString consisting of a single/double unicode character.
template <class... Args>
void printerr(const char* format, const Args&... args)
Print a message on stderr (and flush stderr) ala printf(), using the POSIX/C locale.
template <class... Args>
void printout(const char* format, const Args&... args)
Print a message on stdout (and flush stdout) ala printf(), using the POSIX/C locale.
auto uint16_swap_le_be(uint16_t v) →  uint16_t constexpr
Swap 16-Bit integers between __BIG_ENDIAN and __LITTLE_ENDIAN systems.
auto uint32_swap_le_be(uint32_t v) →  uint32_t constexpr
Swap 32-Bit integers between __BIG_ENDIAN and __LITTLE_ENDIAN systems.
auto uint64_swap_le_be(uint64_t v) →  uint64_t constexpr
Swap 64-Bit integers between __BIG_ENDIAN and __LITTLE_ENDIAN systems.
template <class ... Args>
void warning(const char* format, const Args&... args)
Issue a printf-like warning message.