A collection of useful C++ routines.
Go to file
2021-12-21 13:55:55 +10:00
algo search::balanced should be constexpr 2021-04-07 12:52:24 +10:00
alloc build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
array build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
buffer build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
concepts concepts: add initial clock concept 2020-09-30 15:14:26 +10:00
coord build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
cpuid cpuid/x86: correct libfmt specifier syntax 2021-05-18 06:54:20 +10:00
debug debug/warn: add forgotten 'do' 2021-12-21 13:55:55 +10:00
encode build: address clang-tidy errors 2021-04-20 12:10:53 +10:00
geom geom/ops: workaround ICE using requires for distance 2021-04-19 16:47:22 +10:00
hash build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
introspection introspection: correct the member name offset calculations 2021-04-08 13:15:57 +10:00
iterator remove use of std::iterator 2021-11-18 11:41:23 +10:00
job build: address clang-tidy errors 2021-04-20 12:10:53 +10:00
list list/sort: workaround for GCC nonnull comparison bug 2021-04-28 14:25:07 +10:00
log Fix some format string specifier type errors in recent compilers 2021-11-07 06:12:34 +10:00
map map/multi_fixed: add assignment operators 2021-03-09 12:14:17 +10:00
maths maths/fast: actually account for symmetries in sin 2021-05-13 17:01:30 +10:00
memory build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
parallel build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
parse parse/value: add from_string overload for std::string_view 2021-12-14 11:14:18 +10:00
posix build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
rand build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
roots build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
set set/dset: add insert for symmetry with the STL 2021-02-05 12:03:41 +10:00
test uri: add resolve and normalise operations 2021-12-17 10:46:59 +10:00
thread thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
time debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tools Fix some format string specifier type errors in recent compilers 2021-11-07 06:12:34 +10:00
tuple tuple/value: don't use forwarding constructor for map 2020-09-07 16:44:04 +10:00
types build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
win32 build;win32: add missing includes 2021-05-18 06:57:45 +10:00
.gitignore build; remove unnecessary gitignore entries 2018-08-06 14:36:23 +10:00
.gitlab-ci.yml build;gitlab: set CMAKE_MODULE_PATH to our local cmake modules 2019-06-29 09:13:26 +10:00
.gitmodules build: don't include cmake modules in this repository 2018-07-24 16:16:53 +10:00
abnf.rl uri: extract grammar into contained ragel file 2017-12-20 12:45:05 +11:00
adapter.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
adapter.hpp Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
annotation.hpp build: add doxygen comments for various headers 2019-01-03 11:15:00 +11:00
ascii.hpp build: use more explicit headers 2021-01-20 14:19:33 +10:00
backtrace_execinfo.cpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +10:00
backtrace_null.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
backtrace_stackwalk.cpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +10:00
backtrace_win32.cpp debug/crash: temporarily disable backtrace reporting 2019-10-21 16:33:51 +11:00
backtrace.hpp backtrace: give consistent outputs for backtrace 2019-07-02 16:39:40 +10:00
bezier1.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
bezier2.cpp assert: split CHECK_LIMIT into INCLUSIVE and INDEX 2020-09-24 08:03:41 +10:00
bezier3.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
bezier.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
bezier.hpp bezier: add convenience typedefs for various dimensions 2021-04-22 15:49:07 +10:00
bitwise.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
bitwise.hpp build: use more explicit headers 2021-01-20 14:19:33 +10:00
cast.hpp cast: allow cast::known for non-class types 2021-04-07 12:52:50 +10:00
CMakeLists.txt uri: move non-parsing routines out of ragel source 2021-12-14 11:13:50 +10:00
cmdopt.cpp cmdopt: add simple requires constraint callbacks 2020-01-17 07:58:23 +11:00
cmdopt.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
colour.cpp colour: add luminance scaling and XYZ/xyY/sRGB conversions 2021-05-12 13:26:52 +10:00
colour.hpp colour: add luminance scaling and XYZ/xyY/sRGB conversions 2021-05-12 13:26:52 +10:00
concepts.hpp concepts: add "supports_indexing" 2020-03-16 14:12:04 +11:00
container.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
coord.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
COPYING relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
cpp.cpp cpp: fix trailing tokens with new tokeniser 2021-12-17 12:07:08 +10:00
cpp.hpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
cpuid.cpp cpuid: add initial trivial CPUID queries 2018-03-18 17:29:44 +11:00
cpuid.hpp cpuid: defend against unknown architectures 2019-06-20 11:44:43 +10:00
debug_posix.cpp Fix some format string specifier type errors in recent compilers 2021-11-07 06:12:34 +10:00
debug_win32.cpp format: remove in favour of libfmt 2021-04-14 10:23:33 +10:00
Doxyfile.in Doxyfile: Use CMake variables in preference to autotools variables 2019-01-03 11:15:00 +11:00
endian.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
endian.hpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
except.cpp except: add custom base exception 2018-12-03 15:29:21 +11:00
except.hpp except: error::describe shouldn't be noexcept 2019-02-02 15:35:44 +11:00
exe_freebsd.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
exe_linux.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
exe_win32.cpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11:00
exe.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
expected.hpp build: address clang-tidy errors 2021-04-20 12:10:53 +10:00
extent.cpp extent: add rotate90 2020-08-21 11:34:29 +10:00
extent.hpp extent: add rotate90 2020-08-21 11:34:29 +10:00
fixed_string.hpp fixed_string: use pointers for copy to storage 2020-11-18 06:50:17 +10:00
fixed.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fixed.hpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
float.cpp types/sized: update bits types to follow a more current style 2020-10-22 11:27:25 +10:00
float.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
fourcc.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
fourcc.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
functor.hpp functor: style 2020-02-25 16:15:21 +11:00
gcc.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
hash.hpp hash: ensure all values passed to mix are of the same type 2020-10-27 15:31:43 +10:00
init.cpp init: workaround a double free in cookie allocation 2021-04-09 13:28:49 +10:00
init.hpp init: add runtime initialisation cookie 2020-04-23 08:06:14 +10:00
io_posix.cpp io: add an fallocate wrapper 2020-11-28 08:39:40 +10:00
io_posix.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
io_win32.cpp build;win32: add missing includes 2021-05-18 06:57:45 +10:00
io_win32.hpp io_win32: add move operators to mapped_file 2019-03-27 19:08:55 +11:00
io.cpp format: remove in favour of libfmt 2021-04-14 10:23:33 +10:00
io.hpp io: ensure override is used on overridden members 2021-06-03 12:56:44 +10:00
kmeans.hpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
libcruft.pc.in build: correctly install the pkg-config file 2019-06-18 11:26:59 +10:00
library_posix.cpp build: transition from experimental filesystem 2018-12-05 19:12:03 +11:00
library_posix.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
library_win32.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
library_win32.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
library.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
log.hpp log: prepare to expand headers 2019-10-10 15:10:41 +11:00
maths.cpp maths: document log2 and log2up 2020-03-16 14:11:23 +11:00
maths.hpp maths: allow different types for samesign 2021-05-10 11:39:39 +10:00
matrix2.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
matrix3.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
matrix4.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
matrix.cpp build: remove dead code 2021-04-14 14:17:18 +10:00
matrix.hpp matrix: remove iostream include from the header 2021-04-12 17:17:24 +10:00
meson_options.txt build: update the meson build configuration 2019-06-19 17:28:01 +10:00
meson.build meson: add a declared dependency 2019-06-22 08:19:42 +10:00
paths_posix.cpp paths: add a better error message for posix expansion 2020-04-21 11:40:30 +10:00
paths_win32.cpp paths: add expand query for paths 2020-04-21 11:01:03 +10:00
paths.hpp paths: add expand query for paths 2020-04-21 11:01:03 +10:00
platform.hpp build: many compilation fixes for win32 2019-01-04 17:13:21 +11:00
point.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
point.hpp Header cleanup using include-what-you-use 2020-07-01 17:02:44 +10:00
pointer.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
polynomial.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
polynomial.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
pool.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
pool.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
preprocessor.py preprocessor: add COUNT_MAP 2021-02-02 11:41:26 +10:00
quaternion.cpp debug/panic: use fmt for unhandled messages 2021-04-13 15:18:37 +10:00
quaternion.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
random.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
random.hpp random: use decltype for choose return type 2020-12-14 13:08:39 +10:00
range.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
range.hpp range: correct the ostream operator template variable refs 2020-11-23 12:01:01 +10:00
rational.cpp debug/assert: don't use iostream 2021-04-12 16:56:06 +10:00
rational.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
README.adoc thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
region.cpp region: constructors should be constexpr 2021-06-01 13:14:51 +10:00
region.hpp region: constructors should be constexpr 2021-06-01 13:14:51 +10:00
registrar.cpp registrar: add skeleton of plugin registry 2019-04-16 11:02:26 +10:00
registrar.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
rfc3986.rl uri: add resolve and normalise operations 2021-12-17 10:46:59 +10:00
scoped.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
signal.cpp signal: reduce templating complexity 2019-03-13 12:08:57 +11:00
signal.hpp signal: simplify the implementation of the cookie and signal 2020-07-23 15:16:15 +10:00
singleton.hpp singleton: add "maybe" pointer accessor 2020-09-11 13:35:51 +10:00
stats.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
stats.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
std.hpp std: clarify header guarantees 2020-01-16 11:58:03 +11:00
stream.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
stream.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
string.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
string.hpp string: add is_transparent to transforming less comparator 2021-12-17 14:53:25 +10:00
stringcache.cpp stringcache: add a simple bulk string cache 2020-04-23 05:53:40 +10:00
stringcache.hpp stringcache: add a simple bulk string cache 2020-04-23 05:53:40 +10:00
stringid.cpp stringid: use string_view for accessors 2018-09-18 16:36:03 +10:00
stringid.hpp stringid: add at method 2018-09-18 16:36:28 +10:00
strongdef.cpp strongdef: don't expose the raw data directly 2019-03-20 15:39:24 +11:00
strongdef.hpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
sysinfo_posix.cpp sysinfo;posix: ensure strings are quoted 2019-06-20 14:42:38 +10:00
sysinfo_win32.cpp sysinfo;win32: don't print the username null terminator 2019-06-28 15:14:34 +10:00
sysinfo.hpp sysinfo: add a trivial system stats dump function 2019-06-20 12:37:48 +10:00
tap.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
tap.hpp format: remove in favour of libfmt 2021-04-14 10:23:33 +10:00
term.cpp build: fix range-loop-analysis warnings 2020-02-17 17:40:03 +11:00
term.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
time_posix.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
time_win32.cpp thread: remove thread, mutex, and condition_variable wrappers 2020-08-03 11:21:29 +10:00
time.cpp format: remove in favour of libfmt 2021-04-14 10:23:33 +10:00
time.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
typeidx.cpp typeidx: add name registration 2021-01-19 12:17:23 +10:00
typeidx.hpp typeidx: ensure fundamental types have a constexpr index 2021-03-25 12:02:14 +10:00
types.hpp types: add the convert trait 2020-02-07 10:15:43 +11:00
uri.cpp uri: change clear into clear_fragment 2021-12-21 09:42:13 +10:00
uri.cpp.rl uri: add resolve and normalise operations 2021-12-17 10:46:59 +10:00
uri.hpp uri: change clear into clear_fragment 2021-12-21 09:42:13 +10:00
utf8.cpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
utf8.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
variadic.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
variadic.hpp rename root namespace from util to cruft 2018-08-05 14:42:02 +10:00
vector.cpp debug: split debug headers into components 2019-05-17 12:26:08 +10:00
vector.hpp coord: add to_radians for vector 2019-12-18 10:52:10 +11:00
version.cpp.rl debug/panic: use fmt for unhandled messages 2021-04-13 15:18:37 +10:00
version.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00
view.cpp relicense under MPL-2.0 2018-08-04 15:14:06 +10:00
view.hpp view: add increment and decrement operators 2021-12-16 13:48:23 +10:00
zlib.cpp build: clang-tidy fixes 2021-04-19 14:52:22 +10:00
zlib.hpp build: avoid double underscore header guards 2021-04-14 15:35:49 +10:00

== libcruft

A simple cross-platform C++ utility library.

Supported compilers: >=clang-10.x, >=gcc10.x; specifically, we require cxx17 features such as structured bindings which aren't present in older compilers. No attempt has been made to compile under MSVC.

MinGW must be compiled with PThreads support so that the std threading API is available.

=== Environment Variables

The following variables can be defined at runtime to change the library behaviour.

DEBUG:: whether to initialise basic debugging features at load time. the value is irrelevant; the test is for whether the variable is defined.
DEBUG_WAIT:: whether to wait for a debugger to attach before executing `main`.

LOG_LEVEL:: minimum log level that will render to the logging stream. note that a given level may have been compiled out and may not be present, eg. DEBUG tends to only be present for debug builds.
BREAK_LEVEL:: minimum log level that will trigger a breakpoint

CRUFT_LOG_SINK:: The output driver for logging. One of 'CONSOLE', 'PATH'.
CRUFT_LOG_PATH:: The output path for the 'PATH' logging driver. This path is subject to path expansion and will be interpreted as relative to the current working directory if it is relative.

JOB_THREADS:: default number of threads to spin up for job queues.
JOB_DEPTH:: the default size of the pending work item queue for a job queue.

Ideally one would not resort to using these variables, but they may make debugging a little easier in some circumstances.