** KageKirin Header only Utils**
Lead Developer, Maintainer: KageKirin
This is a collection C++14 (mostly) functions, classes, structures targeted to be re-used in several projects.
Add <repo-path>/include
to your includes, then #include "khutils/<whatever>.hpp
in your source.
The files are self-contained, i.e. don't require any linking.
However, in some cases you need to #define KHUTIL_<SOMETHING>_IMPL
in one .cpp
file to include the implementation source as well.
Please refer to each separate header to fetch the correct define.
Furthermore, some of the header files have INCLUDE DEPENDENCIES, which in turn might result in LINKER DEPENCIES. Among those dependencies, there are:
-
Bandit and Snowhouse -- used for unit testing and assertions. Dependency lies in
assertion.hpp
. -
Boost 1.62 at the time of writing this (Sorry!)
-
spiritual_cast and spiritual_compare
rely on Boost.Spirit.X3 for parsing
-
-
Boost.Nowide and iconv for
khutils/utf
-
glm for everything inside
khutils/glm
. - FlatBuffers
Also, the code tends to rely heavily on C++14 features, such as lambdas.
Some standard STL algorithms which provide the current element's index along with the element itself.
Pythonic is required for the functions marked as _pythonic
.
Pythonic is header only as well.
Logging functionality
STL
khutil::logger::info() << "some information";
khutil::logger::warn() << "a warning indicating that something might be off";
khutil::logger::error() << "an error message indicating that something is off";
khutil::logger::debug() << "debug information";
struct tag;
khutil::logger::debug_t<tag>() << "debug information that requires debug_t<> to be explicitly implemented for provided struct";
Implementation of some (base class) runtime exceptions. Namely, ImportExpection and ExportException.
STL
Implements endian-dependent read and write functionality for binary data.
Boost.Endian (header only as well)
code here
A lexical_cast<>(std::string) implementation based on Boost.Spirit.X3's fast parsers. "Casts" or rather converts the provided string into the template type parameter.
- Boost.Spirit.X3 is supposed to be the fastest parser around. link
-
istringstream >> val
is slow as hell. - Need more control than std::stoi et al. can provide.
STL, Boost.Spirit.X3
int i = spiritual_cast<int>("42");
float f = spiritual_cast<float>("3.14");
double d = spiritual_cast<double>("3.14");
Overloading spiritual_cast<> to fit a specific target type might be required.