libfly icon indicating copy to clipboard operation
libfly copied to clipboard

C++ utility library

libfly

Azure DevOps Codecov Codacy

libfly is a C++20 utility library for Linux, macOS, and Windows. It primarily serves as a playground for learning new C++ standards and exploring interests.

Features

  • A string library for all std::basic_string specializations, including:
    • A compile-time-validated string formatter based on std::format
    • A type-safe lexical type converter
    • UTF-8, UTF-16, and UTF-32 support
  • A JSON type as a first-class container
    • Designed to feel like a Python dictionary
  • Instrumentation and logging
    • Provides synchronous and asynchronous loggers
    • Supports logging to the console (with color), a file, or any user-defined sink
  • Networking
    • TCP and UDP sockets with IPv4 and IPv6 support
    • An asynchronous socket IO service
  • Coders
    • Base64 encoder and decoder
    • Huffman encoder and decoder
      • Includes a bitwise IO stream for reading and writing content bit-by-bit
  • Path change monitoring
    • Monitors any number of files or directories for creation, deletion, or change
  • Configuration management
    • Built around the path monitor to detect changes to a configuration file and automatically update configuration objects
  • Task system for policy-based asynchronous execution of tasks
  • INI and JSON file parsers
  • System resource monitor
  • Thread-safe queue and stack
  • Concepts to extend the STL's <concepts>
  • Type-safe, fixed-width integer literal suffixes

Building

After cloning libfly, external dependencies should be fetched as well.

git submodule update --init

Of those dependencies, only flymake is required (on Linux and macOS) to compile the libfly library. Catch2 is required only for building unit tests. All other dependencies are for benchmarking purposes, and not used by libfly itself.

Linux and macOS

On Linux and macOS, libfly is compiled using the flymake build system, which is a GNU Makefile system. To build all libfly targets with the default configuration, just run make.

The following individual Make targets are defined:

  • libfly - Compiles the libfly library to static and shared library files.
  • libfly_unit_tests - Compiles libfly unit tests.
  • libfly_benchmarks - Compiles libfly performance benchmarks.

See the flymake README for other make goals and build configurations.

Windows

On Windows, libfly is compiled with Visual Studio. A solution file is provided with the following projects:

  • libfly - Compiles libfly library to static library files.
  • libfly_unit_tests - Compiles libfly unit tests.
  • libfly_benchmarks - Compiles libfly performance benchmarks.

Directory structure

  • fly - Contains the primary source and header files for libfly.
  • build - Contains build output, platform-specific build files, and the CI configuration.
  • test - Contains the libfly unit tests.
  • docs - Contains generated source code documentation.
  • bench - Contains performance benchmarks of various libfly components.
  • extern - Contains all third-party projects used by libfly.