Skip to content

Core module


(unnamed) enum

enum : char32_t

Enum values representing special UTF codepoints for error handling.

UtfInvalid enumerator

Represents an invalid UTF codepoint.

UtfOverlong enumerator

Represents an overlong UTF codepoint.

UtfTruncated enumerator

Represents a truncated UTF codepoint.


<deduction guide for ReflectionField> function

template <size_t N, typename Class, typename FieldType>
ReflectionField(const char (&)[N], FieldType Class::*)
    ->ReflectionField<Class, FieldType>

Deduction guide for constructing ReflectionField without flags.
Template param N Size of the field name.
Template param Class The class type containing the field.
Template param FieldType The type of the field being reflected.


template <size_t N, typename Class, typename FieldType>
ReflectionField(const char (&)[N], FieldType Class::*,
                ReflectionFlag)
    ->ReflectionField<Class, FieldType>

Deduction guide for constructing ReflectionField with flags.
Template param N Size of the field name.
Template param Class The class type containing the field.
Template param FieldType The type of the field being reflected.


<deduction guide for ScopedValue> function

template <typename T> ScopedValue(T &, T)->ScopedValue<T>

Type deduction guide for ScopedValue.
Template param T The type of the value being managed.


AlignedAllocation class

AlignedAllocation

Provides custom new and delete operators for aligned memory allocation.

This struct defines custom new and delete operators that use aligned memory allocation. By inheriting from AlignedAllocation, a derived class will automatically use these aligned operators for dynamic memory allocation. This ensures that instances of the derived class are always allocated with the appropriate alignment.

operator new function

static void *operator new(size_t size) noexcept

Allocates memory with alignment using the new operator.

This function allocates memory with default alignment using the new operator.
Param size The size of the memory to allocate.
Returns Pointer to the allocated memory.

operator delete function

static void operator delete(void *ptr) noexcept

Frees memory using the delete operator.

This function frees memory that was previously allocated with the custom new operator.
Param ptr Pointer to the memory to be freed.

operator new function

static void *operator new(size_t size,
                          std::align_val_t al) noexcept

Allocates memory with specified alignment using the new operator.

This function allocates memory with the specified alignment using the new operator.
Param size The size of the memory to allocate.
Param al The alignment requirement.
Returns Pointer to the allocated memory.

operator delete function

static void operator delete(void *ptr,
                            std::align_val_t al) noexcept

Frees memory with specified alignment using the delete operator.

This function frees memory that was previously allocated with the custom new operator with alignment.
Param ptr Pointer to the memory to be freed.
Param al The alignment requirement.


AppMetadata class

AppMetadata

AppMetadataHolds metadata for an application.

This struct contains information about the application, such as its vendor, name, description, homepage URL, copyright information, and version.

vendor variable

std::string vendor

Vendor (manufacturer) name.

name variable

std::string name

Application name.

description variable

std::string description

Application description.

homepage variable

std::string homepage

URL of the application's homepage.

std::string copyright

Copyright information with the © symbol.

version variable

AppVersion version

Version information of the application.


AppVersion class

AppVersion

AppVersionRepresents the version of an application.

This struct holds information about an application's version, including major, minor, release, and patch numbers, as well as an optional suffix. It provides a method to convert the version information into a human-readable string.

major variable

unsigned int major = 0

Major version number

minor variable

unsigned int minor = 0

Minor version number

release variable

unsigned int release = 0

Release number

patch variable

unsigned int patch = 0

Patch number

suffix variable

std::string suffix

Optional suffix for the version

operator== function

constexpr bool
operator==(const AppVersion &) const noexcept = default

Compares this version to another for equality.
Param other The version to compare against.
Returns true if the versions are equal, false otherwise.

string function

std::string string() const

Converts the version to a string representation.
Returns A string representing the version in the format "major.minor.release.patch[suffix]".


AsciiChar typedef

AsciiChar = char

Type alias for ASCII characters.


AsciiString typedef

AsciiString = std::string

Type alias for ASCII strings.


AsciiStringView typedef

AsciiStringView = std::string_view

Type alias for ASCII string views.


AutoSingleton class

template <typename T> AutoSingleton

A utility structure to provide automatic singleton management.

This struct manages the creation of a singleton instance of type T using std::unique_ptr. The instance is lazily created upon the first access.
Template param T The type of the singleton instance to manage.

operator-> function

T *operator->()

Provides access to the singleton instance of type T.

This operator ensures the creation of the singleton instance (if not already created) and returns a pointer to it.
Returns T* Pointer to the singleton instance of type T.

operator type-parameter-0-0 * function

operator T *() noexcept

Implicit conversion to pointer of type T.

This conversion operator allows the AutoSingleton object to be used as a pointer to the singleton instance of type T. This simplifies the access to the singleton object without needing to call the operator-\>() explicitly.
Returns T* Pointer to the singleton instance of type T.


CC class

template <size_t Size> CC

Array of characters of fixed size


Cache class

template <typename T, typename... Args> Cache

A caching structure that stores a value and its associated parameters. Updates the value if the input parameters change.
Template param T The type of the cached value.
Template param Args The types of the parameters used to generate the cached value.

data variable

optional<T> data

The cached value.

parameters variable

std::tuple<Args...> parameters

The tuple storing the input parameters associated with the cached value.

update function

template <typename Fn>
void update(Fn &&fn, const Args &...args)

Updates the cached value by calling the provided function if the input parameters change.
Template param Fn The type of the function used to compute the value.
Param fn The function to compute the value.
Param args The input parameters for the function.

operator() function

template <typename Fn>
T &operator()(Fn &&fn, const Args &...args)

Calls the provided function and updates the cached value if necessary, then returns the cached value.
Template param Fn The type of the function used to compute the value.
Param fn The function to compute the value.
Param args The input parameters for the function.
Returns The updated cached value.

get function

T &get()

Returns a reference to the cached value.
Returns A reference to the cached value.

const T &get() const

Returns a constant reference to the cached value.
Returns A constant reference to the cached value.


CacheWithInvalidation class

template <typename CachedValue, equality_comparable Key,
          typename Class,
          CachedValue (Class::*Func)(const Key &)>
CacheWithInvalidation

A cache that stores a value based on a key and invalidates it when the key changes.
Template param CachedValue The type of the cached value.
Template param Key The type of the key.
Template param Class The class type containing the member function.
Template param Func The member function that returns the cached value.

self variable

Class *self

Pointer to the instance of the class that holds the member function.

m_key variable

Key m_key

The key associated with the cached value.

m_value variable

mutable std::optional<CachedValue> m_value

Optionally holds the cached value.

operator-> function

const CachedValue *operator->() const

Returns a pointer to the cached value, updating it if necessary.
Returns A pointer to the cached value.

key function

const Key &key() const

Returns the key associated with the cached value.
Returns The key associated with the cached value.

value function

const CachedValue &value() const

Returns the cached value, updating it if necessary.
Returns The cached value.

update function

void update() const

Updates the cached value if it is not already set.

invalidate function

bool invalidate(const Key &key, bool force = false)

Invalidates the cached value if the key has changed.
Param key The new key to check.
Returns True if the cache was invalidated, otherwise false.


CaseTransformation enum

enum class CaseTransformation

Enum representing case transformation modes.

Lower enumerator

Transform to lowercase.

Upper enumerator

Transform to uppercase.


CompressionLevel enum

enum class CompressionLevel

Represents different levels of compression. Each level corresponds to a trade-off between speed and compression ratio.

Lowest enumerator

Lowest compression, fastest speed.

Low enumerator

Low compression.

Normal enumerator

Standard compression level.

High enumerator

High compression, slower speed.

Highest enumerator

Highest compression, slowest speed.


CompressionMethod enum

enum class CompressionMethod

Represents different compression methods available.

None enumerator

No compression.

GZip enumerator

GZip compression.

ZLib enumerator

ZLib compression.

LZ4 enumerator

LZ4 compression.

Brotli enumerator

Brotli compression (enabled by BRISK_BROTLI cmake option).


CpuInfo class

CpuInfo

Structure representing CPU information.

model variable

std::string model

CPU model name.

speed variable

int speed

CPU speed in MHz.

Reflection variable

constexpr static std::tuple Reflection

Reflection data for the fields of CpuInfo.


DefaultFolder enum

enum class DefaultFolder

DefaultFolderEnum class representing default folder types.

This enum defines various types of default folders that can be accessed in the file system. These folders are commonly used for storing user-related data.

Documents enumerator

Represents the Documents folder.

Pictures enumerator

Represents the Pictures folder.

Music enumerator

Represents the Music folder.

UserData enumerator

Represents the User Data folder.

SystemData enumerator

Represents the System Data folder.

Home enumerator

Represents the Home folder.


DynamicFunc class

template <typename Func> DynamicFunc

DynamicFuncA wrapper for a function from a dynamically loaded library.
Template param Func The type of the function being wrapped.

DynamicFunc<Func> function

DynamicFunc(const RC<DynamicLibrary> &library,
            const std::string &name)

Constructs a DynamicFunc object.
Param library A smart pointer to the dynamic library.
Param name The name of the function in the library.

DynamicFunc(const RC<DynamicLibrary> &library,
            const std::string &name, bool &flag)
    : DynamicFunc(library, name)

Constructs a DynamicFunc object and sets a flag if the function is not found.
Param library A smart pointer to the dynamic library.
Param name The name of the function in the library.
Param flag A boolean flag that is set to false if the function is not found.

operator() function

template <typename... Args>
decltype(auto) operator()(Args &&...args) const noexcept

Calls the wrapped function with the provided arguments.
Template param Args Types of the arguments to be passed to the function.
Param args The arguments to pass to the function.
Returns The result of the function call.
Note This method is noexcept.


DynamicLibrary class

DynamicLibrary

DynamicLibraryProvides an interface to dynamically load and access functions from shared libraries.

func function

template <typename Func>
Func *func(const std::string &name) const noexcept
  requires std::is_function_v<Func>

Retrieves a pointer to a function from the dynamic library.
Template param Func The function type to retrieve.
Param name The name of the function in the library.
Returns A pointer to the function if found; otherwise, nullptr.

load function

static RC<DynamicLibrary>
load(const std::string &name) noexcept

Loads a dynamic library by its name.
Param name The name of the library to load.
Returns A smart pointer to the loaded dynamic library.

~DynamicLibrary function

~DynamicLibrary()

Destructor for the DynamicLibrary class.
Details Cleans up and closes the dynamic library.


EArgument class

EArgument

EArgumentException for invalid arguments.

This class represents an invalid argument error and extends std::invalid_argument.


ECrypto class

ECrypto

Exception class for cryptographic errors.


ELogic class

ELogic

ELogicException for logical errors.

This class represents a logic error and extends std::logic_error.


ENotImplemented class

ENotImplemented

ENotImplementedException for indicating unimplemented functionality.

This class represents a logic error and extends std::logic_error.


ERange class

ERange

ERangeException for range errors.

This class represents an out-of-range error and extends std::range_error.


ERuntime class

ERuntime

ERuntimeException for runtime errors.

This class represents a runtime error and extends std::runtime_error.


Encoding enum

enum class Encoding : uint8_t

EncodingEnum class representing different text encodings.

This enum class defines various text encodings that can be used to represent characters in a digital format.

Utf8 enumerator

*/

Utf16 enumerator

*/

Utf32 enumerator

*/


Exception class

template <typename Base> Exception

ExceptionA generic templated exception class that extends standard exceptions.

This class allows for creating exceptions with formatted error messages. It supports any base class derived from std::exception.
Template param Base The base exception type, which must derive from std::exception.

Exception<Base> function

Exception(std::string str) : Base(std::move(str))

Constructs an exception with a message string.
Param str The error message string.

Exception(const char *str) : Base(str)

Constructs an exception with a message as a C-string.
Param str The error message as a C-string.

template <typename... T>
Exception(fmt::format_string<T...> fmt, T &&...args)
    : Base(fmt::format(std::move(fmt),
                       std::forward<T>(args)...))

Constructs an exception with a formatted error message.
Param fmt The format string.
Param args Arguments to be formatted.


ExecuteImmediately enum

enum class ExecuteImmediately

ExecuteImmediatelyDefines when and how a scheduled function is dispatched in a task queue.

This enum specifies the conditions under which a scheduled function should be executed in relation to the task queue and its default thread.

IfOnThread enumerator

Executes the scheduled function immediately if the current thread is the queue's default thread.

In this mode, the function bypasses the task queue and is invoked directly if the current thread matches the queue's default thread. Otherwise, it will be added to the queue.

IfProcessing enumerator

Executes the scheduled function immediately only if the task queue is currently processing tasks.

In this mode, the function is executed directly on the queue's default thread only when the queue is actively processing tasks. Otherwise, the function will be added to the queue for later execution.

Never enumerator

The scheduled function is never executed immediately and is always added to the queue.

In this mode, the function is guaranteed to be dispatched to the task queue, ensuring it is invoked only when the queue processes its tasks.


FastHash class

FastHash

Functor for computing fast hashes.
Template param T Data type.
Param value The value to hash.
Returns The computed hash.


FixedBytes class

template <size_t Size> FixedBytes

Array of bytes of fixed size.

This array is used to store a fixed number of bytes. The size of the array is defined at compile time and cannot be changed at runtime.


Fraction class

template <typename T> Fraction

A template structure for representing and manipulating fractions.

This structure allows operations with fractions, including arithmetic operations, normalization, and conversions between fractions and other numeric types. The fraction is represented as a numerator and a denominator, with the denominator being non-negative and the fraction in its reduced form.
Template param T The type used for the numerator and denominator. It must support basic arithmetic operations and the std::abs function.

Fraction<T> function

Fraction(T num = 0, T den = 1)
    : numerator(num), denominator(den)

Constructs a Fraction with the given numerator and denominator.

The constructor normalizes the fraction such that the denominator is positive and the fraction is reduced to its simplest form.
Param num The numerator of the fraction. Default is 0.
Param den The denominator of the fraction. Default is 1.

Fraction(float) = delete

Deleted constructor for float types.

This constructor is disabled to prevent the creation of a Fraction with a float type.

Fraction(double) = delete

Deleted constructor for double types.

This constructor is disabled to prevent the creation of a Fraction with a double type.

normalize function

void normalize()

Normalizes the fraction.

Ensures that the denominator is positive and the fraction is reduced to its simplest form.

abs function

static T abs(T v)

Computes the absolute value of the given value.
Param v The value whose absolute value is to be computed.
Returns The absolute value of the given value.

numerator variable

T numerator

The numerator of the fraction.

denominator variable

T denominator

The denominator of the fraction.

Reflection variable

constexpr static std::tuple Reflection

Reflection data for the Fraction structure.

operator+ function

Fraction operator+() const

Unary plus operator.
Returns A copy of the fraction.

operator- function

Fraction operator-() const

Unary minus operator.
Returns A fraction with the same denominator but negated numerator.

operator bool function

explicit operator bool() const

Converts the fraction to a boolean.
Returns true if the numerator is non-zero, false otherwise.

operator double function

explicit operator double() const

Converts the fraction to a double.
Returns The floating-point representation of the fraction.

operator float function

explicit operator float() const

Converts the fraction to a float.
Returns The floating-point representation of the fraction.

operator type-parameter-0-0 function

explicit operator T() const

Converts the fraction to the template type T.
Returns The fractional value as type T.

operator+= function

Fraction &operator+=(const Fraction &y)

Adds another fraction to this fraction.
Param y The fraction to be added.
Returns A reference to this fraction after addition.

operator-= function

Fraction &operator-=(const Fraction &y)

Subtracts another fraction from this fraction.
Param y The fraction to be subtracted.
Returns A reference to this fraction after subtraction.

operator*= function

Fraction &operator*=(const Fraction &y)

Multiplies this fraction by another fraction.
Param y The fraction to multiply by.
Returns A reference to this fraction after multiplication.

operator/= function

Fraction &operator/=(const Fraction &y)

Divides this fraction by another fraction.
Param y The fraction to divide by.
Returns A reference to this fraction after division.

gcd function

static T gcd(T a, T b)

Computes the greatest common divisor of two values.
Param a The first value.
Param b The second value.
Returns The greatest common divisor of the two values.

lcm function

static T lcm(T a, T b)

Computes the least common multiple of two values.
Param a The first value.
Param b The second value.
Returns The least common multiple of the two values.


HashMethod enum

enum class HashMethod

Enum class representing various hash methods.

MD5 enumerator

MD5 hashing method

SHA1 enumerator

SHA-1 hashing method

SHA256 enumerator

SHA-256 hashing method

SHA512 enumerator

SHA-512 hashing method

SHA3_256 enumerator

SHA3-256 hashing method

SHA3_512 enumerator

SHA3-512 hashing method

Last enumerator

Sentinel value for the last hash method


Hasher class

Hasher

Provides a common interface for hashers, enabling generic hashing functionality.

Hasher() noexcept

Default constructor. Initializes the hasher with the default hashing method.

explicit Hasher(HashMethod method) noexcept

Constructs a hasher with the specified hashing method.
Param method The hashing method to use.

finish function

bool finish(bytes_mutable_view hashOutput)

Finalizes the hashing process and writes the result to the provided buffer.
Param hashOutput The buffer where the final hash result will be written.
Returns True if the finalization was successful, otherwise false.

write function

bool write(bytes_view data)

Writes a sequence of bytes to the hasher for hashing.
Param data The sequence of bytes to hash.
Returns True if the write operation was successful, otherwise false.

bool write(const uint8_t *data, size_t size)

Writes a sequence of bytes to the hasher for hashing.
Param data Pointer to the byte data.
Param size The number of bytes to write.
Returns True if the write operation was successful, otherwise false.

method variable

HashMethod method

The hashing method used by this hasher.

state variable

FixedBytes<416> state

Internal state of the hasher.


IfChanged class

template <typename... Args> IfChanged

A utility that checks if the given arguments have changed since the last call.
Template param Args The types of the arguments to track.

data variable

optional<std::tuple<Args...>> data

The last stored tuple of arguments.

operator() function

bool operator()(const Args &...args)

Checks if the given arguments have changed since the last call.
Param args The arguments to check for changes.
Returns True if the arguments have changed, otherwise false.

reset function

void reset()

Resets the internal state, clearing the stored arguments.


InplacePtr class

template <typename T> InplacePtr

A smart pointer-like structure that holds an object in-place.
Details This class provides pointer-like semantics while storing the object directly within the structure. It can be implicitly converted to a shared pointer (RC) without managing the memory of the contained object.
Template param T The type of object stored in the structure.

value variable

T value

The object stored in-place.

InplacePtr<T> function

template <typename... Args>
explicit InplacePtr(Args &&...args) : value

Constructs the object in-place with forwarded arguments.
Template param Args The types of arguments used for constructing the object.
Param args The arguments to construct the object.

operator-> function

constexpr const T *operator->() const noexcept

Const dereference operator to access the stored object.
Returns A const pointer to the stored object.

operator* function

constexpr const T &operator*() const noexcept

Const dereference operator to access the stored object.
Returns A const reference to the stored object.

operator-> function

constexpr T *operator->() noexcept

Dereference operator to access the stored object.
Returns A pointer to the stored object.

operator* function

constexpr T &operator*() noexcept

Dereference operator to access the stored object.
Returns A reference to the stored object.

operator shared_ptr<const type-parameter-0-0> function

operator RC<const T>() const noexcept

Implicit conversion to a const shared pointer (RC<const T\>).
Returns A shared pointer (RC<const T\>) that does not manage the object.

operator shared_ptr<const type-parameter-1-0> function

template <typename U>
operator RC<const U>() const noexcept
  requires std::is_convertible_v<const T *, const U *>

Implicit conversion to a const shared pointer of a convertible type.
Template param U The target type to convert to (must be convertible from T).
Returns A shared pointer (RC<const U\>) that does not manage the object.

operator shared_ptr<type-parameter-0-0> function

operator RC<T>() noexcept

Implicit conversion to a shared pointer (RC<T\>).
Returns A shared pointer (RC<T\>) that does not manage the object.

operator shared_ptr<type-parameter-1-0> function

template <typename U>
operator RC<U>() noexcept
  requires std::is_convertible_v<T *, U *>

Implicit conversion to a shared pointer of a convertible type.
Template param U The target type to convert to (must be convertible from T).
Returns A shared pointer (RC<U\>) that does not manage the object.


InstanceCache class

template <typename T> InstanceCache

A cache that stores an instance of a value and can be copied or moved.
Template param T The type of the cached value.

InstanceCache<T> function

template <typename... Args>
InstanceCache(Args &&...args) noexcept(
    std::is_nothrow_constructible_v<T, Args...>)
    : value

Constructs an InstanceCache object with the given arguments.
Template param Args The types of the arguments used to construct the value.
Param args The arguments used to construct the value.

InstanceCache(const InstanceCache &other) noexcept(
    std::is_nothrow_default_constructible_v<T>)
    : value

Copy constructor. Initializes the value with default construction instead of copying.

InstanceCache(InstanceCache &&other) noexcept(
    std::is_nothrow_default_constructible_v<T>)
    : value

Move constructor. Initializes the value with default construction instead of moving.

operator= function

InstanceCache &operator=(const InstanceCache &other)

Copy assignment operator. Does nothing and returns *this.

InstanceCache &operator=(InstanceCache &&other)

Move assignment operator. Does nothing and returns *this.

~InstanceCache<T> function

~InstanceCache() = default

Destructor.

value variable

T value

The cached value.


KeyValue typedef

template <typename Key, typename Value>
KeyValue = std::pair<Key, Value>

A type alias for a key-value pair.

This alias represents a standard pair containing a key of type Key and a value of type Value.
Template param Key The type of the key.
Template param Value The type of the value.


KeyValue = std::pair<Key, Value>

A type alias for a key-value pair.

This alias represents a standard pair containing a key of type Key and a value of type Value.
Template param Key The type of the key.
Template param Value The type of the value.


Locale class

Locale

LocaleAbstract base class for localization.

This class defines the interface for translating keys into localized strings.

translate function

virtual const std::string &
translate(std::string_view key) const noexcept = 0

Translates a given key into a localized string.
Param key The key to translate.
Returns A reference to the localized string.


LocaleFormatString class

template <Internal::FixedString key> LocaleFormatString


Template param key A fixed string representing a translation key.LocaleFormatStringA structure for formatting localized strings with arguments.

This structure provides functionality for formatting strings that may contain placeholders.

str function

static constexpr std::string_view str()

Returns the stripped translation key.
Returns A string view to the stripped key.

checkFormatArgs function

template <typename... Args>
static consteval void checkFormatArgs()

Checks the format arguments at compile-time.

This function checks if the provided arguments are compatible with the format string.
Template param Args The types of the arguments to check.

operator() function

template <typename... Args>
std::string operator()(Args &&...args) const

Formats a localized string with the provided arguments.
Template param Args The types of the arguments.
Param args The arguments to format into the string.
Returns The formatted localized string.


MemoryStream class

MemoryStream

MemoryStreamIn-memory stream with full read/write capabilities. Internally stores data as a std::vector<uint8_t\> and grows as new data is written to the stream.

Supports all stream operations, including read, write, seek, and size queries.

MemoryStream()

Default constructor for MemoryStream. Initializes an empty stream.

MemoryStream(std::vector<uint8_t> data)

Constructs a MemoryStream with the given initial data.
Param data A std::vector<uint8_t\> containing the initial data for the stream.

data function

const std::vector<uint8_t> &data() const

Returns a const reference to the internal data buffer.
Returns A constant reference to the std::vector<uint8_t\> holding the stream's data.

std::vector<uint8_t> &data()

Returns a non-const reference to the internal data buffer.
Returns A non-constant reference to the std::vector<uint8_t\> holding the stream's data.


NameValuePair typedef

template <typename T>
NameValuePair = std::pair<std::string_view, T>

Represents a name-value pair for an enum.
Template param T The type of the value.


NameValuePair = std::pair<std::string_view, T>

Represents a name-value pair for an enum.
Template param T The type of the value.


OSUname class

OSUname

Structure representing OS uname information.

sysname variable

std::string sysname

System name.

release variable

std::string release

Release name.

version variable

std::string version

Version of the system.

machine variable

std::string machine

Machine hardware name.

operator== function

constexpr bool
operator==(const OSUname &) const noexcept = default

Default comparison operator.

Reflection variable

constexpr static std::tuple Reflection

Reflection data for the fields of OSUname.


OSVersion class

OSVersion

Structure representing the operating system version.

major variable

uint16_t major = 0

Major version of the operating system.

minor variable

uint16_t minor = 0

Minor version of the operating system.

build variable

uint32_t build = 0

Build number of the operating system.

operator<=> function

constexpr auto
operator<=>(const OSVersion &) const noexcept = default

Default comparison operator.

Reflection variable

constexpr static std::tuple Reflection

Reflection data for the fields of OSVersion.


OpenFileMode enum

enum class OpenFileMode

OpenFileModeEnum class representing file opening modes.

ReadExisting enumerator

Opens a file for reading.

The file must exist; if it does not, the open fails.

ReadWriteExisting enumerator

Opens a file for reading and writing.

The file must exist.

RewriteOrCreate enumerator

Opens a file for writing.

If the file exists, it is truncated. If it does not exist, a new file is created.

ReadRewriteOrCreate enumerator

Opens a file for reading and writing.

If the file exists, it is truncated; if not, a new file is created.

AppendOrCreate enumerator

Opens a file for appending.

If the file exists, data is appended at the end. If it does not exist, a new file is created.

r enumerator

Alias for ReadExisting.

r_plus enumerator

Alias for ReadWriteExisting.

w enumerator

Alias for RewriteOrCreate.

w_plus enumerator

Alias for ReadRewriteOrCreate.

a enumerator

Alias for AppendOrCreate.


PeriodicTimer class

PeriodicTimer

Represents a periodic timer.

This structure provides functionality to manage a timer that triggers events at regular intervals.

PeriodicTimer(bool startNow = true)

Constructs a PeriodicTimer and optionally starts it immediately.
Param startNow If true, the timer starts immediately.

elapsed function

bool elapsed(double period)

Checks if the specified period has elapsed.
Param period The period to check.
Returns True if the period has elapsed; otherwise, false.

active function

bool active() const

Checks if the timer is currently active.
Returns True if the timer is active; otherwise, false.

start function

void start()

Starts the periodic timer.

stop function

void stop()

Stops the periodic timer.

time variable

double time

The time period for the timer.


PossiblyShared class

template <typename T> PossiblyShared

A structure that holds either a shared or unique value of type T.
Template param T The type of the held value.

PossiblyShared<T> function

PossiblyShared(const T &copy) : value(copy)

Constructs a PossiblyShared object with a copy of the given value.
Param copy The value to copy.

PossiblyShared(std::remove_const_t<T> &&copy)
    : value(std::move(copy))

Constructs a PossiblyShared object with a moved value.
Param copy The value to move.

PossiblyShared(T *ptr) : shared(ptr)

Constructs a PossiblyShared object with a shared pointer to the value.
Param ptr A pointer to the shared value.

operator* function

T &operator*() const

Dereferences the PossiblyShared object.
Returns A reference to the held value.

operator-> function

T *operator->() const

Accesses members of the held value.
Returns A pointer to the held value.

isShared function

bool isShared() const

Checks if the PossiblyShared object holds a shared value.
Returns True if the value is shared, otherwise false.

value variable

mutable optional<std::remove_const_t<T>> value

Optionally holds the unique value if it is not shared.

shared variable

T *shared = nullptr

Pointer to the shared value, if applicable.


PropertyLike concept

template <typename T>
concept PropertyLike =
    requires(T t, const T ct, typename T::Type v)

Concept that checks if a type behaves like a property.
Template param T The type to check.


RC typedef

template <typename T> RC = std::shared_ptr<T>

Alias for a shared pointer type using std::shared_ptr.
Template param T The type of object managed by the shared pointer.


RC = std::shared_ptr<T>

Alias for a shared pointer type using std::shared_ptr.
Template param T The type of object managed by the shared pointer.


RCNew class

RCNew

Utility for creating a shared pointer (RC) from a raw pointer. The operator * is overloaded to construct an RC object from a raw pointer.
Details This is used with the rcnew macro to allocate objects and automatically wrap them in an RC (std::shared_ptr).


Range class

template <typename T, bool inclusive = false> Range

A template class representing a range of values.

The Range class template defines a range with a minimum and maximum value of type T. It provides various methods to perform operations such as calculating distance, union, intersection, and checking if a value is contained within the range.
Template param T The type of the values in the range. It must support arithmetic operations.

min variable

T min

The minimum value of the range.

max variable

T max

The maximum value of the range.

distance function

constexpr T distance() const noexcept

Computes the distance between the minimum and maximum values of the range.
Returns The distance between max and min.

union_ function

constexpr Range union_(const Range &b) const noexcept

Computes the union of this range with another range.

The union of two ranges is a range that spans from the minimum of the two ranges to the maximum of the two ranges.
Param b The other range to compute the union with.
Returns A new Range representing the union of this range and b.

intersection function

constexpr Range intersection(const Range &b) const noexcept

Computes the intersection of this range with another range.

The intersection of two ranges is a range that spans from the maximum of the two ranges' minimums to the minimum of the two ranges' maximums. If the ranges do not overlap, the result will be an empty range.
Param b The other range to compute the intersection with.
Returns A new Range representing the intersection of this range and b.

contains function

constexpr bool contains(T value) const noexcept

Checks if a value is contained within the range.
Param value The value to check for containment.
Returns true if value is greater than or equal to min and less than max; otherwise, false.

empty function

constexpr bool empty() const noexcept

Checks if the range is empty.

A range is considered empty if max is less than or equal to min.
Returns true if max is less than or equal to min; otherwise, false.

intersects function

constexpr bool
intersects(const Range<T> &other) const noexcept

Checks if this range intersects with another range.

Two ranges intersect if their intersection is not empty.
Param other The other range to check for intersection.
Returns true if this range intersects with other; otherwise, false.

operator+ function

constexpr Range operator+(T b) const noexcept

Shifts the range by adding a value to both the minimum and maximum.
Param b The value to add to both min and max.
Returns A new Range that represents the shifted range.

operator- function

constexpr Range operator-(T b) const noexcept

Shifts the range by subtracting a value from both the minimum and maximum.
Param b The value to subtract from both min and max.
Returns A new Range that represents the shifted range.

operator+= function

constexpr Range &operator+=(T b) noexcept

Increments both the minimum and maximum values of the range.
Param b The value to add to both min and max.
Returns A reference to the modified Range.

operator-= function

constexpr Range &operator-=(T b) noexcept

Decrements both the minimum and maximum values of the range.
Param b The value to subtract from both min and max.
Returns A reference to the modified Range.

operator== function

constexpr bool
operator==(const Range &b) const noexcept = default

Checks for equality between this range and another range.
Param b The range to compare with.
Returns true if both min and max values are equal; otherwise, false.

RangeIterator class

RangeIterator

A nested iterator class for the Range.

begin function

RangeIterator begin() const noexcept
  requires(!inclusive)

Returns an iterator to the beginning of the range.
Returns An iterator pointing to the minimum value.

end function

RangeIterator end() const noexcept
  requires(!inclusive)

Returns an iterator to the end of the range.

The end iterator points just past the maximum value.
Returns An iterator pointing just past the maximum value.


Reader class

Reader

ReaderStream reader with additional seek capabilities.

Inherits from SequentialReader and supports seek operations.


ReflectionField class

template <typename Class_, typename FieldType_>
ReflectionField

Represents metadata for a reflected field in a class.
Template param Class_ The class type containing the field.
Template param FieldType_ The type of the field being reflected.

name variable

std::string_view name

*/

pointerToField variable

FieldType Class::*pointerToField

*/

flags variable

ReflectionFlag flags = ReflectionFlag::Default

*/


ReflectionFlag enum

enum class ReflectionFlag : int

Enum representing flags for reflection metadata.

Default enumerator

*/

SkipSerialization enumerator

*/

SkipPrinting enumerator

*/


SHA256Hasher class

SHA256Hasher

Provides a SHA-256 specific hasher with SHA-256 as the hashing method.

SHA256Hasher() noexcept : Hasher(HashMethod::SHA256)

Constructs a SHA256Hasher with SHA-256 as the hashing method.

finish function

bool finish(SHA256Hash &hash)

Finalizes the hashing process and writes the result to the provided SHA256Hash object.
Param hash The SHA256Hash object where the final hash result will be written.
Returns True if the finalization was successful, otherwise false.


SHA512Hasher class

SHA512Hasher

Provides a SHA-512 specific hasher with SHA-512 as the hashing method.

SHA512Hasher() noexcept : Hasher(HashMethod::SHA512)

Constructs a SHA512Hasher with SHA-512 as the hashing method.

finish function

bool finish(SHA512Hash &hashOutput)

Finalizes the hashing process and writes the result to the provided SHA512Hash object.
Param hashOutput The SHA512Hash object where the final hash result will be written.
Returns True if the finalization was successful, otherwise false.


Scheduler class

Scheduler

Abstract base class for scheduling tasks.

This class defines the interface for a scheduler that can dispatch functions asynchronously. Derived classes must implement the dispatch method.

~Scheduler function

virtual ~Scheduler()

Virtual destructor.

dispatch function

virtual std::future<void>
dispatch(VoidFunc func,
         ExecuteImmediately mode =
             ExecuteImmediately::IfOnThread) noexcept = 0

Dispatches a function for execution.

This method schedules the specified function for execution. The function may be executed immediately or added to the task queue depending on the dispatch mode and the current thread context.
Param func The function to be executed.
Param mode The mode that determines when the function will be executed.
Returns A future that will be satisfied once the function has completed.

template <
    typename Callable,
    typename ReturnType = std::invoke_result_t<Callable>>
std::future<ReturnType>
dispatch(Callable &&func,
         ExecuteImmediately mode =
             ExecuteImmediately::IfOnThread)
  requires(!std::is_same_v<ReturnType, void>)

Dispatches a callable and returns a future for the result.

This method allows the dispatch of any callable (function, lambda, etc.) that returns a result, providing a future for the result.
Template param Callable The type of the callable (e.g., function, lambda) to dispatch.
Template param Args The types of the arguments to pass to the callable.
Param func The callable to be dispatched.
Param mode The mode that determines when the callable will be executed.
Param args The arguments to pass to the callable.
Returns A future that will contain the result of the callable when it completes.
Thread safety This method is thread-safe and can be called from any thread.

waitForCompletion function

void waitForCompletion()

Waits until all tasks in the queue are processed.

This method ensures that the task queue is completely processed before returning.
Thread safety This method is thread-safe and can be called from any thread.

completionFuture function

std::future<void> completionFuture()

Creates a future that will be satisfied when all tasks in the queue are processed.

This method returns a std::future<void\> that can be used to wait for the completion of all queued tasks.
Returns A future that will be satisfied once all tasks in the queue are processed.
Thread safety This method is thread-safe and can be called from any thread.


ScopeExit class

template <typename Fn> ScopeExit

A RAII-style helper class for executing a callable object upon scope exit.

The ScopeExit template class allows the user to specify a function or lambda that will be executed when the ScopeExit object goes out of scope.
Template param Fn The type of the callable object to be executed.

ScopeExit<Fn> function

template <typename Fn_>
ScopeExit(Fn_ &&fn) : fn(std::forward<Fn_>(fn))

Constructs a ScopeExit object with a callable function or lambda.
Template param Fn_ The type of the callable object.
Param fn The callable object to be executed upon scope exit.

~ScopeExit<Fn> function

~ScopeExit()

Executes the callable object when the ScopeExit object goes out of scope.

fn variable

Fn fn

The callable object to be executed upon scope exit.


ScopedValue class

template <typename T> ScopedValue

A RAII-style helper class for temporarily changing a value and restoring it upon scope exit.

The ScopedValue template class allows temporarily modifying a value within a given scope. When the object of ScopedValue goes out of scope, it automatically restores the original value.
Template param T The type of the value being managed.

ScopedValue<T> function

ScopedValue(T &target, T newValue)
    : target(target), saved(std::move(target))

Constructs a ScopedValue object that changes the target value to newValue and saves the original value.
Param target The reference to the value that will be modified.
Param newValue The new value to set for target.

~ScopedValue<T> function

~ScopedValue()

Restores the original value when the ScopedValue object goes out of scope.

target variable

T &target

The reference to the value being modified.

saved variable

T saved

The original value saved for restoration.


SeekOrigin enum

enum class SeekOrigin

SeekOriginSpecifies the reference point for a seek operation in a stream.

This enumeration is used to indicate the starting point from which a seek operation should be performed.

Beginning enumerator

*/

End enumerator

*/

Current enumerator

*/


SequentialReader class

SequentialReader

SequentialReaderStream reader with restricted capabilities.

Supports read operations only. Other operations throw ENotImplemented.


SequentialWriter class

SequentialWriter

SequentialWriterStream writer with restricted capabilities.

Supports write and flush operations only. Other operations throw ENotImplemented.


SerializableInterface class

SerializableInterface

Interface for serializable objects.


SerializableInterface

Interface for serializable objects.

serialize function

virtual void serialize(const Serialization &serialization)

Virtual method to be overridden by derived classes for custom serialization.
Param serialization The Serialization object used for the process.

serializeTo function

void serializeTo(Json &dest)

Serializes the object to the given Json object.
Param dest The destination JSON object where the serialized data will be stored.

deserializeFrom function

void deserializeFrom(const Json &src)

Deserializes the object from the given Json object.
Param src The source JSON object to load the data from.

SerializableInterface function

SerializableInterface() = default

Default constructor.


Serialization class

Serialization

Handles serialization and deserialization of data to and from JSON.

The Serialization struct provides functionality to perform both loading (deserialization) and saving (serialization) of object data. It interacts with a Json object to store and retrieve values.

action variable

SerializationAction action

The current serialization action (load or save).

data variable

mutable Json data

The JSON data being processed.

callback variable

function<void(Json &&)> callback

Optional callback invoked at destruction, useful for nested serialization contexts.

Serialization function

Serialization() = default

Default constructor.

Serialization(const Serialization &) = default

Copy constructor.

Serialization(Serialization &&) = default

Move constructor.

~Serialization function

~Serialization()

Destructor, invokes the callback with the processed JSON data.

serializationError function

void serializationError() const

Logs an error during serialization.

deserializationError function

void deserializationError() const

Logs an error during deserialization.

operator() function

template <typename Type>
void operator()(const Value<Type> &prop,
                std::string_view name) const

Processes a property of a specific type for serialization or deserialization.

If the current action is loading, it tries to retrieve the value from the JSON. If saving, it stores the value into the JSON.
Template param Type The type of the property.
Param prop The property to process.
Param name The JSON key associated with the property.

template <typename Value, typename Setter>
void operator()(Value &value, Setter &&setter,
                std::string_view name) const

Processes a value with a setter function for serialization or deserialization.

Useful when custom setting logic is required during loading.
Template param Value The type of the value being processed.
Template param Setter The setter function to apply when loading data.
Param value The value to process.
Param setter The setter function for the value.
Param name The JSON key associated with the value.

template <typename Value>
void operator()(Value &value, std::string_view name) const

Processes a value for serialization or deserialization.

Handles simple types without the need for a property wrapper.
Template param Value The type of the value being processed.
Param value The value to process.
Param name The JSON key associated with the value.

void operator()(SerializableInterface &value,
                std::string_view name) const

Processes a serializable object.

Calls the serialize method on the object, allowing it to handle its own serialization.
Param value The serializable object to process.
Param name The JSON key associated with the object.

key function

Serialization key(std::string_view name) const

Returns a new Serialization context for a nested JSON object under a specific key.

Allows handling of nested serialization for objects contained within another object.
Param name The key for the nested object in the JSON data.
Returns A new Serialization object for the nested context.

index function

Serialization index(int idx) const

Returns a new Serialization context for a specific index in a JSON array.

Allows handling of nested serialization for arrays.
Param idx The index of the array to process.
Returns A new Serialization object for the nested array context.


SerializationAction enum

enum class SerializationAction

Enum representing the action performed during serialization.

Load enumerator

Load data during deserialization.

Save enumerator

Save data during serialization.


SimpleCache class

template <typename CachedValue, equality_comparable Key,
          typename Class,
          CachedValue (Class::*Func)(const Key &)>
SimpleCache

A simple cache that stores a value based on a key and a member function of a class.
Template param CachedValue The type of the cached value.
Template param Key The type of the key.
Template param Class The class type containing the member function.
Template param Func The member function that returns the cached value.

self variable

Class *self

Pointer to the instance of the class that holds the member function.

key function

const Key &key() const

Returns the key associated with the cached value.
Returns The key associated with the cached value.

get function

const CachedValue &get() const

Returns the cached value.
Returns The cached value.

update function

bool update(const Key &key)

Updates the cache if the key has changed by invoking the member function.
Param key The key to check and update.
Returns True if the cache was updated, otherwise false.

m_cache variable

std::optional<std::pair<Key, CachedValue>> m_cache

Optionally holds the cached key-value pair.


SimpleLocale class

SimpleLocale

SimpleLocaleA concrete implementation of the Locale class.

This class provides methods to manage translations in a simple way, including adding, removing, and clearing translations.

translate function

const std::string &
translate(std::string_view key) const noexcept final

Translates a given key into a localized string.
Param key The key to translate.
Returns A reference to the localized string.

removeTranslation function

void removeTranslation(std::string_view key)

Removes a translation entry.
Param key The key for the translation to remove.

clear function

void clear()

Clears all translations.

addTranslation function

void addTranslation(std::string_view key, std::string value)

Adds a new translation entry.
Param key The key for the translation.
Param value The localized string corresponding to the key.


SingleTimerThread class

SingleTimerThread

Represents a thread that handles a single timer.

This class provides a mechanism to run a timer in a separate thread. The timer will call a tick method periodically.

explicit SingleTimerThread()

Constructs a SingleTimerThread instance and starts the thread.

This constructor initializes the thread and starts it, allowing it to handle timer events.

~SingleTimerThread function

~SingleTimerThread()

Destructor for the SingleTimerThread.

This destructor waits for the thread to finish execution before cleaning up resources.

terminate function

void terminate()

Terminates the timer thread.

This method signals the thread to stop but doesn't wait for it to terminate.

tick function

virtual void tick(Clock::time_point &time)

Virtual function called in a cycle.

This method must be overridden to handle periodic events. It sets the time parameter to the next desired call time.
Param time The time point to be set for the next call.


SpanStream class

template <typename T> SpanStream

SpanStreamStream based on a span of data with read/write capabilities.

Supports read/write operations depending on whether the T is const-qualified.

SpanStream<T> function

SpanStream(std::span<T> data) : m_data(std::move(data))

Constructs a SpanStream with the given data span.
Param data A std::span<T\> representing the initial data for the stream.

data function

std::span<T> data() const

Returns a std::span<T\> representing the data in the stream.
Returns A std::span<T\> containing the current data in the stream.


Stream class

Stream

StreamAbstract base class representing a stream with read, write, seek, and other operations.

This class provides a common interface for stream operations such as reading, writing, seeking, and querying stream properties. Concrete implementations should override the pure virtual functions to provide specific behavior for different types of streams.

~Stream function

virtual ~Stream()

Virtual destructor for the Stream class.

caps function

virtual StreamCapabilities caps() const noexcept = 0

Retrieves the capabilities of the stream.
Returns StreamCapabilities A bitmask representing the capabilities of the stream.

read function

virtual Transferred read(uint8_t *data, size_t size) = 0

Reads up to size bytes from the stream into the provided buffer.

The read function attempts to read size bytes of data from the stream and stores it in the buffer pointed to by data.

If the stream reaches the end of the file (EOF) before the requested number of bytes are read, the function will return the number of bytes successfully read.
Param data Pointer to the buffer where the read data will be stored.
Param size Number of bytes to attempt to read from the stream.
Returns Transferred - The total number of bytes read if successful. - Transferred::Eof if EOF is encountered before any data is read. - Transferred::Error if an error occurs during the read operation.
Details - If EOF is reached, the function returns the number of bytes read before EOF. - If EOF is reached before any bytes are read, Transferred::Eof is returned.

write function

virtual Transferred write(const uint8_t *data,
                          size_t size) = 0

Writes up to size bytes from the provided buffer to the stream.

The write function attempts to write size bytes of data from the buffer pointed to by data into the stream.
Param data Pointer to the buffer containing the data to be written.
Param size Number of bytes to attempt to write to the stream.
Returns Transferred - The total number of bytes written if successful. - Transferred::Error if an error occurs during the write operation.
Details - If any error occurs during the WriteFile call or no bytes are written, the function returns Transferred::Error.

flush function

virtual bool flush() = 0

Flushes the stream, ensuring that all buffered data is written to the underlying storage.
Returns True if the flush operation was successful, false otherwise.

seek function

virtual bool
seek(intmax_t position,
     SeekOrigin origin = SeekOrigin::Beginning) = 0

Seeks to a specific position in the stream.
Param position The position to seek to.
Param origin The reference point for the seek operation.
Returns True if the seek operation was successful, false otherwise.

tell function

virtual uintmax_t tell() const = 0

Retrieves the current position of the stream.
Returns The current position of the stream or invalidPosition if an error occurs.

size function

virtual uintmax_t size() const = 0

Retrieves the size of the stream.
Returns The size of the stream or invalidSize if an error occurs.

truncate function

virtual bool truncate() = 0

Truncates the stream to the current position.
Returns True if the truncate operation was successful, false otherwise.

canRead function

bool canRead() const noexcept

Checks if the stream supports read operations.
Returns True if the stream supports reading, false otherwise.

canWrite function

bool canWrite() const noexcept

Checks if the stream supports write operations.
Returns True if the stream supports writing, false otherwise.

canSeek function

bool canSeek() const noexcept

Checks if the stream supports seek operations.
Returns True if the stream supports seeking, false otherwise.

canFlush function

bool canFlush() const noexcept

Checks if the stream supports flush operations.
Returns True if the stream supports flushing, false otherwise.

canTruncate function

bool canTruncate() const noexcept

Checks if the stream supports truncation operations.
Returns True if the stream supports truncating, false otherwise.

hasSize function

bool hasSize() const noexcept

Checks if the stream has a size property.
Returns True if the stream has a size property, false otherwise.

read function

Transferred read(std::span<uint8_t> data)

Reads data into a std::span<uint8_t\> buffer.
Param data A std::span<uint8_t\> representing the buffer to read into.
Returns Transferred The result of the read operation.

readUntilEnd function

optional<std::vector<uint8_t>>
readUntilEnd(bool incompleteOk = false)

Reads data from the stream until the end is reached or an error occurs.

The readUntilEnd function reads data in chunks into a std::vector<uint8_t\> from the stream. It continues reading until EOF is encountered or an error occurs. If an error occurs before all requested data is read and incompleteOk is set to false, the function returns std::nullopt to indicate that the read operation failed.
Param incompleteOk If set to true, allows returning partial data if error occurs before the buffer is completely filled.
Returns std::optional<std::vector<uint8_t>> - A std::vector<uint8_t\> containing the data read from the stream if successful. - std::nullopt if an error occurs and incompleteOk is false.

writeAll function

bool writeAll(std::span<const uint8_t> data)

Writes all data from the given span to the stream.

The writeAll function attempts to write the entire range of data specified by data to the stream. It ensures that the number of bytes written matches the size of the data span.
Param data A std::span<const uint8_t\> containing the data to be written.
Returns bool True if the entire data was written successfully; otherwise, false.

write function

Transferred write(string_view data)

Writes the contents of a string_view to the stream.

The write function writes the data pointed to by data, interpreted as a sequence of bytes, to the stream.
Param data A string_view representing the data to be written.
Returns Transferred The result of the write operation, indicating the number of bytes written or an error.


StreamCapabilities enum

enum class StreamCapabilities

StreamCapabilitiesDescribes the capabilities of a stream.

This enumeration specifies various capabilities that a stream may support, allowing for querying and conditional operations based on the stream's features.

CanRead enumerator

*/

CanWrite enumerator

*/

CanSeek enumerator

*/

CanFlush enumerator

*/

CanTruncate enumerator

*/

HasSize enumerator

*/


StringHash class

StringHash

Functor for computing hashes of strings. Supports transparent comparisons for heterogenous lookups.


TaskQueue class

TaskQueue

Class that manages a queue of tasks to be executed.

The TaskQueue class allows functions to be dispatched for immediate execution or queued for later execution, depending on the dispatch mode and the current thread context.

TaskQueue()

Constructs a TaskQueue object.
Note The thread that executes this constructor becomes the queue's default thread.

dispatch function

std::future<void> dispatch(
    VoidFunc func,
    ExecuteImmediately mode =
        ExecuteImmediately::IfOnThread) noexcept override

Dispatches a function for execution.

This method schedules the specified function for execution. If the current thread is the same as the queue's default thread and the dispatch mode permits immediate execution, the function is executed immediately. Otherwise, it is added to the queue.
Param func The function to be executed.
Param mode The mode that determines when the function will be executed.
Returns A future that will be satisfied once the function has completed.
Thread safety This method is thread-safe and can be called from any thread.

isOnThread function

bool isOnThread() const noexcept

Checks if the current thread is the queue's default thread.
Returns true if the current thread is the queue's default thread, false otherwise.
Thread safety This method is thread-safe and can be called from any thread.

ensureOnThread function

void ensureOnThread() const noexcept

Asserts that the current thread is the queue's default thread.

This method checks if the calling thread is the same as the queue's default thread. If the check fails, an assertion is triggered. This ensures certain operations are performed on the correct thread.

isProcessing function

bool isProcessing() const noexcept

Checks if tasks are currently being processed.
Returns true if tasks are being processed, false otherwise.
Thread safety This method is thread-safe and can be called from any thread.

process function

void process() noexcept

Processes tasks in the queue.

This method dequeues and executes tasks on the current thread. It ensures that no other processing occurs during this operation. The method will continue executing tasks until the queue is empty.

getThreadId function

std::thread::id getThreadId() const noexcept

Gets the thread ID of the queue's default thread.
Returns The thread ID of the queue's default thread.
Thread safety This method is thread-safe and can be called from any thread.

enqueue function

void enqueue(VoidFunc func) noexcept

Enqueues a function to be processed later.
Param func The function to be enqueued.
Thread safety This method is thread-safe and can be called from any thread.

tryDequeue function

bool tryDequeue(VoidFunc &func) noexcept

Attempts to dequeue a function for processing.
Param func Reference to store the dequeued function.
Returns true if a function was dequeued, false otherwise.


ThreadPriority enum

enum class ThreadPriority

Defines thread priority levels.

This enumeration represents the various levels of thread priority, which can be used to influence the scheduling of threads. Higher priorities may result in the thread receiving more CPU time or being scheduled sooner.

Lowest enumerator

The lowest possible thread priority.

Low enumerator

A low thread priority.

Normal enumerator

The default thread priority.

High enumerator

A higher-than-normal thread priority.

Highest enumerator

The highest possible thread priority.


Transferred class

Transferred

TransferredRepresents the result of a read or write operation, indicating success, failure, or end-of-file (EOF), along with the number of bytes transferred.

This struct is used to encapsulate the result of I/O operations in a way that clearly distinguishes between successful data transfers, errors, and EOF conditions.

constexpr Transferred() noexcept = default

Default constructor.

constexpr Transferred(const Transferred &) noexcept =
    default

Copy constructor.
Param other Another Transferred object to copy from.

constexpr Transferred(size_t bytes) noexcept
    : m_bytes(bytes)

Constructs a Transferred object with a specified number of bytes.
Param bytes Number of bytes transferred.

(unnamed) enum

enum : size_t

Special values for indicating EOF and error conditions.

SpecialValues enumerator

*/

Eof enumerator

*/

Error enumerator

*/

isEOF function

bool isEOF() const noexcept

Checks if the result indicates an EOF condition.
Returns True if the result is EOF, false otherwise.

isError function

bool isError() const noexcept

Checks if the result indicates an error.
Returns True if the result is an error, false otherwise.

bytes function

size_t bytes() const noexcept

Retrieves the number of bytes successfully transferred.
Returns Number of bytes transferred. If the result indicates EOF or error, the returned value is 0.

operator bool function

explicit operator bool() const noexcept

Converts the Transferred object to a boolean value indicating whether at least one byte was transferred.
Returns True if at least one byte was transferred, false otherwise.

operator+= function

Transferred &operator+=(Transferred other) noexcept

Adds the number of bytes from another Transferred object to this one. If either Transferred object represents an error or EOF, the result will be the error or EOF accordingly.
Param other Another Transferred object to add.
Returns Reference to this Transferred object with the updated byte count.

operator== function

bool operator==(const Transferred &t) const noexcept =
    default

Compares this Transferred object with another for equality.
Param t Another Transferred object to compare with.
Returns True if both Transferred objects represent the same result (bytes count), false otherwise.


U16String typedef

U16String = std::u16string

Type alias for UTF-16 strings.


U16StringView typedef

U16StringView = std::u16string_view

Type alias for UTF-16 string views.


U32String typedef

U32String = std::u32string

Type alias for UTF-32 strings.


U32StringView typedef

U32StringView = std::u32string_view

Type alias for UTF-32 string views.


U8Char typedef

U8Char = char

Type alias for UTF-8 characters (fallback to ASCII character type).


U8String typedef

U8String = std::string

Type alias for UTF-8 strings (fallback to ASCII string type).


U8StringView typedef

U8StringView = std::string_view

Type alias for UTF-8 string views (fallback to ASCII string view type).


UChar16 typedef

UChar16 = char16_t

Type alias for UTF-16 characters.


UChar32 typedef

UChar32 = char32_t

Type alias for UTF-32 characters.


UTFNormalization enum

enum class UTFNormalization

UTFNormalizationEnum class representing the types of UTF normalization.

Compose enumerator

Compose normalization.

Decompose enumerator

Decompose normalization.

Compat enumerator

Compatibility normalization.

NFC enumerator

Compose normalization (alias for Compose).

NFD enumerator

Decompose normalization (alias for Decompose).

NFKC enumerator

Compatibility and Compose normalization (alias for NFKC).

NFKD enumerator

Compatibility and Decompose normalization (alias for NFKD).


UTFPolicy enum

enum class UTFPolicy

UTFPolicyEnum class representing policies for handling invalid UTF characters.

SkipInvalid enumerator

Skip invalid characters.

ReplaceInvalid enumerator

Replace invalid characters with a replacement character.

Default enumerator

Default policy for handling invalid characters.


UTFValidation enum

enum class UTFValidation

UTFValidationEnum class representing the types of UTF validation results.

Valid enumerator

The UTF sequence is valid.

Invalid enumerator

The UTF sequence is invalid.

Overlong enumerator

The UTF sequence is overlong.

Truncated enumerator

The UTF sequence is truncated.


UtfIterator class

template <typename InChar> UtfIterator

Struct representing a UTF iterator for iterating over UTF text.
Template param InChar The character type of the input text.


Value class

template <typename T> Value

Generic Value structure for property management.

The Value class allows for both read and write access to properties, enabling a more dynamic approach to property handling.
Template param T The type of the value contained within the Value.


template <typename T> Value

Generic Value structure for property management.

The Value class allows for both read and write access to properties, enabling a more dynamic approach to property handling.
Template param T The type of the value contained within the Value.


template <typename T> Value

Generic Value structure for property management.

The Value class allows for both read and write access to properties, enabling a more dynamic approach to property handling.
Template param T The type of the value contained within the Value.

Value<T> function

constexpr Value() noexcept : m_get

Default constructor.

template <PropertyLike U>
[[nodiscard]] explicit Value(U *property)
    : Value(Internal::asValue(*property))

Constructs a Value from a PropertyLike type.
Template param U The property type.
Param property Pointer to the property.

empty function

bool empty() const noexcept

Checks whether the value is empty

constant function

static Value constant(T constant)

Creates a Value that holds a constant value.
Param constant The constant value to hold.
Returns A Value representing the constant.

readOnly function

Value readOnly() &&

Returns a read-only version of this Value.
Returns A read-only Value instance.

Value readOnly() const &

Returns read-only version of Value

mutableValue function

static Value mutableValue(T initialValue)

Returns mutable Value that initially holds the given value.
Param initialValue value


WChar typedef

WChar = wchar_t

Type alias for wide characters.


WString typedef

WString = std::wstring

Type alias for wide strings.


WStringView typedef

WStringView = std::wstring_view

Type alias for wide string views.


WeakRC typedef

template <typename T> WeakRC = std::weak_ptr<T>

Alias for a weak pointer type using std::weak_ptr.
Template param T The type of object managed by the weak pointer.


WeakRC = std::weak_ptr<T>

Alias for a weak pointer type using std::weak_ptr.
Template param T The type of object managed by the weak pointer.


Writer class

Writer

WriterStream writer with additional seek capabilities.

Inherits from SequentialWriter and supports seek operations.


alignUp function

template <typename T>
constexpr T alignUp(T value,
                    std::type_identity_t<T> alignment)

Aligns a value up to the nearest multiple of the specified alignment.
Template param T Type of the value to be aligned.
Param value The value to be aligned.
Param alignment The alignment requirement.
Returns The aligned value.


alignedAlloc function

template <typename T = void>
[[nodiscard]] inline T *
alignedAlloc(size_t size,
             size_t alignment = defaultMemoryAlignment)

Allocates memory with specified alignment.

This function allocates memory with the given size and alignment. If alignment is not specified, the default memory alignment is used.
Template param T Type of the allocated memory. Defaults to void.
Param size The number of elements of type T to allocate.
Param alignment The alignment requirement (default is defaultMemoryAlignment).
Returns Pointer to the allocated memory.


alignedFree function

template <typename T = void> inline void alignedFree(T *ptr)

Frees memory allocated with alignedAlloc.

This function frees memory that was previously allocated with alignedAlloc.
Template param T Type of the pointer to be freed. Defaults to void.
Param ptr Pointer to the memory to be freed.


appMetadata variable

extern AppMetadata appMetadata

Global variable holding application metadata.

This variable is used to store metadata about the application, including version and other relevant details.


appStartTime variable

extern Clock::time_point appStartTime

The start time of the application.


applog function

spdlog::logger &applog()

Retrieves the application logger instance.

This function provides access to the application's logger, which is configured to handle logging throughout the Brisk namespace.
Returns A reference to the application logger (an instance of spdlog::logger).


asBytesView function

template <typename Type>
inline bytes_view asBytesView(const Type &value)
  requires simpleMemoryRepresentation<Type>

Converts an object of type T to a non-modifiable view of bytes.

This function requires that the type T has a simple memory representation.
Param value The object to convert.
Returns A bytes_view representing the object as a sequence of bytes.


asciiTransform function

string
asciiTransform(AsciiStringView text,
               const function<char32_t(char32_t)> &fn)

Transforms ASCII text using a provided function.
Param text An ASCII string view.
Param fn A function to transform each UTF codepoint.
Returns A transformed ASCII string.


async function

void async(function<void()> fn)

Schedules the function for execution in the thread pool
Param fn function to call in the thread pool


brotliDecode function

bytes brotliDecode(bytes_view data)

Decompresses Brotli-compressed data.
Param data The Brotli-compressed input data.
Returns A vector of bytes containing the decompressed data.
Note Available only if compiled with BRISK_BROTLI option enabled.


brotliDecoder function

RC<Stream> brotliDecoder(RC<Stream> reader)

Creates a Stream that reads Brotli-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.
Note Available only if compiled with BRISK_BROTLI option enabled.


brotliEncode function

bytes brotliEncode(bytes_view data, CompressionLevel level)

Compresses data using Brotli.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.
Note Available only if compiled with BRISK_BROTLI option enabled.


brotliEncoder function

RC<Stream> brotliEncoder(RC<Stream> writer,
                         CompressionLevel level)

Creates a Stream that writes Brotli-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.
Note Available only if compiled with BRISK_BROTLI option enabled.


buildInfo variable

extern const std::string_view buildInfo

A constant containing detailed build information of the Brisk library.

This string includes various pieces of build metadata, such as the operating system, compiler version, standard library version, and specific flags used during the build.

The buildInfo string is composed dynamically, depending on the system and compiler used for building. It may contain details like: - OS name - Compiler version (Clang, MSVC, GCC) - C++ standard library version - Platform-specific versions (Windows, Android) - Debugging and exception flags - Date of build

Example output:

OS=Linux; Clang=10.0.0; GNUC=9.3.0; GLIBC=2.31; FLAGS=[D]; BUILT_ON=Sep 23 2024


byte typedef

byte = uint8_t

Type alias for a single byte (8-bit unsigned integer).


cacheAlignment variable

constexpr inline size_t cacheAlignment = 64

Cache line alignment size.

This constant defines the alignment size for cache lines, which is typically 64 bytes.


charIsUtf8 variable

constexpr inline bool charIsUtf8 = true

A constant indicating that the character type is UTF-8.


compressionDecode function

bytes compressionDecode(CompressionMethod method,
                        bytes_view data)

Decompresses data using the specified compression method.
Param method The compression method to use for decompression.
Param data The compressed input data.
Returns A vector of bytes containing the decompressed data.
Note If CompressionMethod::None is used, no decompression is applied.


compressionDecoder function

RC<Stream> compressionDecoder(CompressionMethod method,
                              RC<Stream> reader)

Creates a Stream that reads data compressed with a specified compression method.
Param method The compression method to use for decompression.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data.
Note If CompressionMethod::None is used, no decompression is applied.


compressionEncode function

bytes compressionEncode(CompressionMethod method,
                        bytes_view data,
                        CompressionLevel level)

Compresses data using the specified compression method.
Param method The compression method to apply.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.
Note If CompressionMethod::None is used, no compression is applied.


compressionEncoder function

RC<Stream> compressionEncoder(CompressionMethod method,
                              RC<Stream> writer,
                              CompressionLevel level)

Creates a Stream that writes data using a specified compression method.
Param method The compression method to use for compression.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data.
Note If CompressionMethod::None is used, no compression is applied.


contains function

template <typename Char>
inline bool
contains(const std::basic_string<Char> &str,
         const std::basic_string<std::type_identity_t<Char>>
             &substr)

Checks if a string contains a specific substring.
Template param Char The character type of the string.
Param str The string to search in.
Param substr The substring to search for.
Returns true if the substring is found, false otherwise.


cpuInfo function

CpuInfo cpuInfo()

Retrieves the CPU information.
Returns The CpuInfo structure containing CPU model and speed.


crc32 function

uint32_t crc32(bytes_view data, uint32_t crc = 0)

Computes the CRC-32 checksum.
Param data The data to calculate the checksum for.
Param crc The initial CRC value (default is 0).
Returns The CRC-32 checksum.


inline uint32_t crc32(std::string_view data,
                      uint32_t crc = 0)

Computes the CRC-32 checksum for a string.
Param data The string to calculate the checksum for.
Param crc The initial CRC value (default is 0).
Returns The CRC-32 checksum.


cryptoRandom function

bytes cryptoRandom(size_t size)

Retrieves cryptographically secure random bytes.
Param size The number of bytes to return.
Returns The random bytes as a bytes object.


cryptoRandomFixed function

template <size_t Size>
[[nodiscard]] inline FixedBytes<Size> cryptoRandomFixed(size_constant<Size> =

Retrieves cryptographically secure random bytes as a fixed-size array.
Template param Size The size of the fixed byte array.
Param size_constant The size of the fixed byte array (unused).
Returns The random bytes as a FixedBytes<Size\> object.


cryptoRandomInplace function

void cryptoRandomInplace(bytes_mutable_view data)

Retrieves cryptographically secure random bytes.
Param data The buffer to store the random bytes.
Exceptions Thrown if there are not enough random bytes.


cryptoRandomInplaceSafe function

size_t cryptoRandomInplaceSafe(bytes_mutable_view data)

Retrieves cryptographically secure random bytes.
Param data The buffer to store the random bytes.
Returns The number of bytes received.


cryptoRandomReader function

RC<Stream> cryptoRandomReader()

Creates a RC<Stream> for cryptographically secure random bytes.
Returns A RC<Stream> for random bytes.


currentTime function

inline double currentTime() noexcept

Returns the duration since the application started in seconds.
Returns The duration in seconds.


defaultFolder function

fs::path defaultFolder(DefaultFolder folder)

Returns the path to a specified default folder.

This function takes a DefaultFolder enumeration value and returns the corresponding file system path to that folder.
Param folder The default folder to retrieve.
Returns A fs::path representing the path to the specified default folder.


defaultMemoryAlignment variable

constexpr inline size_t defaultMemoryAlignment =
    maximumSIMDAlignment

Default memory alignment.

This constant sets the default alignment for memory allocations, which is the same as the maximum SIMD alignment.


defaultNames variable

template <typename T>
inline constexpr std::nullptr_t defaultNames

Placeholder for default names of an enum type.
Template param T The enum type.


template <>
inline constexpr std::initializer_list<
    NameValuePair<CompressionMethod>>
    defaultNames<CompressionMethod>

Default mapping between compression method names and their enum values.


template <>
inline constexpr std::initializer_list<
    NameValuePair<HashMethod>>
    defaultNames<HashMethod>

Provides names for hash methods.


template <>
inline constexpr std::initializer_list<
    NameValuePair<Encoding>>
    defaultNames<Encoding>

Names for the Encoding enum values.


defaultToString function

template <typename T,
          std::enable_if_t<hasDefaultNames<T>> * = nullptr>
constexpr std::string_view defaultToString(T value)

Converts an enum value to its string representation using default names.
Template param T The enum type.
Param value The enum value to convert.
Returns The corresponding string name of the enum value, or "(unknown)" if not found.


deg2rad variable

template <typename T>
constexpr inline T deg2rad = std::numbers::pi_v<T> / T(180)

Converts degrees to radians.
Template param T The numeric type.


enumSize variable

template <typename T, T Last = T::Last>
inline constexpr size_t enumSize =
    static_cast<size_t>(
        static_cast<std::underlying_type_t<T>>(Last)) +
    1

Returns the number of enum values based on the last enum value.
Template param T The enum type.
Template param Last The last enum value (default to T::Last).


executableOrBundlePath function

fs::path executableOrBundlePath()

Retrieves the path to the executable or bundle.

This function returns the file system path of the current executable or its associated bundle, if applicable. This is useful for obtaining the location of the application package on certain platforms.
Returns A fs::path representing the path to the executable or bundle.


executablePath function

fs::path executablePath()

Retrieves the path to the executable file.

This function returns the file system path of the currently running executable.
Returns A fs::path representing the path to the executable file.


fastHash function

uint64_t fastHash(bytes_view data, uint64_t seed = 0)

Computes a fast hash for strings and byte arrays.
Param data The data to hash.
Param seed The initial hash seed (default is 0).
Returns The computed hash.


template <typename C, typename Tr>
inline uint64_t fastHash(std::basic_string_view<C, Tr> data,
                         uint64_t seed = 0)

Computes a fast hash for basic string views.
Param data The string view to hash.
Param seed The initial hash seed (default is 0).
Returns The computed hash.


template <typename C, typename Tr, typename Al>
inline uint64_t
fastHash(const std::basic_string<C, Tr, Al> &data,
         uint64_t seed = 0)

Computes a fast hash for basic strings.
Param data The string to hash.
Param seed The initial hash seed (default is 0).
Returns The computed hash.


template <typename T>
inline uint64_t fastHash(const T &data, uint64_t seed = 0)
  requires(simpleMemoryRepresentation<T>)

Computes a fast hash for data types with a simple memory representation.
Template param T Data type.
Param data The data to hash.
Param seed The initial hash seed (default is 0).
Returns The computed hash.


template <typename... T>
inline uint64_t fastHash(const std::tuple<T...> &data,
                         uint64_t seed = 0)
  requires(!simpleMemoryRepresentation<std::tuple<T...>>)

Computes a fast hash for tuples.
Param data The tuple to hash.
Param seed The initial hash seed (default is 0).
Returns The computed hash.


template <HasReflection T>
uint64_t fastHash(const T &val, uint64_t seed = 0)
  requires(!simpleMemoryRepresentation<T>)

Computes a fast hash for an object using reflection metadata.

This function calculates a hash for an object by hashing each of its fields, as defined by its reflection metadata. The function is only enabled for types that do not have a simple memory representation.
Template param T The type of the object being hashed.
Param val The object to hash.
Param seed The initial seed for the hash (default is 0).
Returns The hash value of the object.


fastHashAccum function

template <typename T>
inline void fastHashAccum(uint64_t &seed, const T &data)

Updates the seed with the hash of a given data element.
Template param T Data type.
Param seed The current hash seed.
Param data The data to hash and accumulate.


fastHashTuple function

template <size_t... I, typename... T>
inline uint64_t fastHashTuple(size_constants<I...>,
                              const std::tuple<T...> &data,
                              uint64_t seed)

Computes a fast hash for a tuple.
Param data The tuple to hash.
Param seed The initial hash seed.
Returns The computed hash.


findDirNextToExe function

optional<fs::path>
findDirNextToExe(std::string_view dirName)

Finds a directory next to the executable.

This function searches for a directory specified by dirName adjacent to the current executable's path. It traverses up the directory hierarchy until it finds the specified directory or reaches the root of the file system.
Param dirName A string view representing the name of the directory to find.
Returns An optional containing the path to the found directory if it exists; otherwise, std::nullopt is returned if the directory is not found.


findKey function

template <typename K, typename V>
inline optional<size_t>
findKey(const KeyValueOrderedList<K, V> &list,
        const K &name)

Finds the index of a specified key in a key-value ordered list.

Searches for the given key in a KeyValueOrderedList. Returns the index of the key if found, otherwise returns nullopt.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to search through.
Param name The key to find.
Returns optional<size_t> The index of the found key, or nullopt if not found.


template <typename V, typename K>
inline optional<size_t> findKey(const std::vector<V> &list,
                                K(V::*field),
                                const K &fieldValue)

Finds the index of a value in a vector by a specified field.

Searches for the given value in a vector of objects of type V by accessing the specified field.
Template param V The type of the objects in the list.
Template param K The type of the field used for searching.
Param list The list to search through.
Param field Pointer to the field to compare.
Param fieldValue The value to find.
Returns optional<size_t> The index of the found key, or nullopt if not found.


findKeyIt function

template <typename K, typename V>
inline auto findKeyIt(const KeyValueOrderedList<K, V> &list,
                      const K &name)

Finds an iterator to a specified key in a key-value ordered list.

Searches for the given key in a KeyValueOrderedList and returns an iterator to the found element.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to search through.
Param name The key to find.
Returns Iterator to the found key or list.end() if not found.


findValue function

template <typename V, typename T>
inline optional<size_t>
findValue(const std::vector<V> &list, const T &value)

Finds the index of a specified value in a list.

Searches for the given value in a vector of type V. Returns the index of the value if found, otherwise returns nullopt.
Template param V The type of the values in the list.
Template param T The type of the value to find.
Param list The list to search through.
Param value The value to find.
Returns optional<size_t> The index of the found value, or nullopt if not found.


template <typename K, typename V>
inline optional<size_t>
findValue(const KeyValueOrderedList<K, V> &list,
          const V &value)

Finds the index of a specified value in a key-value ordered list.

Searches for the given value in a KeyValueOrderedList. Returns the index of the value if found, otherwise returns nullopt.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to search through.
Param value The value to find.
Returns optional<size_t> The index of the found value, or nullopt if not found.


fontFolders function

std::vector<fs::path> fontFolders()

Retrieves the paths of available font folders.

This function returns a vector containing the paths of directories where fonts are stored. It can be used to locate font files on the system.
Returns A vector of fs::path objects representing the font folder paths.


fopen_native function

expected<std::FILE *, IOError>
fopen_native(const fs::path &file_name, OpenFileMode mode)

Opens a file using the fopen function. This function handles file name encoding across all platforms.

This function wraps the fopen call and returns an expected object containing either a file pointer or an I/O error.
Param file_name The path to the file to be opened.
Param mode The mode in which to open the file.
Returns An expected object containing a file pointer or an I/O error.


forEachField function

template <HasReflection T, typename Fn>
constexpr void forEachField(Fn &&fn)

Iterates over each reflected field of a type T and applies a function to each field.
Template param T The type with reflection metadata.
Template param Fn The function type to apply to each field.
Param fn The function to apply to each reflected field.


formatter class

template <Brisk::HasReflection T, typename Char> formatter

Provides a custom formatter for types that have reflection metadata, for use with fmt::format.
Template param T The type of the object being reflected.
Template param Char The character type for the output format.


fract function

template <std::floating_point T> constexpr T fract(T x)

Computes the fractional part of a floating-point value.
Template param T A floating-point type.
Param x The value to be processed.
Returns The fractional part of the given value.


fromBase64 function

size_t fromBase64(bytes_mutable_view data,
                  std::string_view encoded,
                  bool urlSafe = false, bool strict = false)

Converts string in Base64 format to span of bytes
Returns number of bytes written or SIZE_MAX in case of error


fromHex function

size_t fromHex(bytes_mutable_view data,
               std::string_view encoded)

Converts string in Hex format to span of bytes
Returns number of bytes written or SIZE_MAX in case of error


fromJson function

bool fromJson(const Brisk::Json &j, std::u32string &s)

Deserializes a UTF-32 string from JSON.
Param j The JSON object to deserialize from.
Param s The UTF-32 string to deserialize into.
Returns True if deserialization was successful, otherwise false.


bool fromJson(const Brisk::Json &j, std::u16string &s)

Deserializes a UTF-16 string from JSON.
Param j The JSON object to deserialize from.
Param s The UTF-16 string to deserialize into.
Returns True if deserialization was successful, otherwise false.


bool fromJson(const Brisk::Json &j, std::wstring &s)

Deserializes a wide string from JSON.
Param j The JSON object to deserialize from.
Param s The wide string to deserialize into.
Returns True if deserialization was successful, otherwise false.


template <typename Rep, typename Period>
inline bool fromJson(const Brisk::Json &j,
                     duration<Rep, Period> &dur)

Converts a JSON value to a chrono duration.
Param j The JSON value to convert.
Param dur The resulting chrono duration.
Returns True if conversion is successful; otherwise, false.


template <typename Clock, typename Duration>
inline bool fromJson(const Brisk::Json &j,
                     time_point<Clock, Duration> &time)

Converts a JSON value to a chrono time point.
Param j The JSON value to convert.
Param time The resulting chrono time point.
Returns True if conversion is successful; otherwise, false.


generate function

static uint64_t generate()

Starts generation from 1


gzipDecode function

bytes gzipDecode(bytes_view data)

Decompresses GZip-compressed data.
Param data The GZip-compressed input data.
Returns A vector of bytes containing the decompressed data.


gzipDecoder function

RC<Stream> gzipDecoder(RC<Stream> reader)

Creates a Stream that reads GZip-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


gzipEncode function

bytes gzipEncode(bytes_view data, CompressionLevel level)

Compresses data using GZip.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


gzipEncoder function

RC<Stream> gzipEncoder(RC<Stream> writer,
                       CompressionLevel level)

Creates a Stream that writes GZip-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


hasDefaultNames variable

template <typename T, typename = void>
inline constexpr bool hasDefaultNames = false

Checks if a type T has default names defined.
Template param T The enum type.


hash function

Bytes hash(HashMethod method, bytes_view data)

Hashes a sequence of bytes using the specified hashing method.
Param method The hashing method to use.
Param data The sequence of bytes to hash.
Returns The resulting hash as a Bytes object.


Bytes hash(HashMethod method, string_view data)

Hashes a string using the specified hashing method.
Param method The hashing method to use.
Param data The string to hash.
Returns The resulting hash as a Bytes object.


hashBitSize function

constexpr size_t hashBitSize(HashMethod method)

Returns the output bit size of the specified hash method.
Param method The hash method for which to retrieve the bit size.
Returns The bit size of the hash output for the given method. Returns 0 if the method is unrecognized.


hashStream function

RC<Stream> hashStream(HashMethod method,
                      bytes_mutable_view hashOutput)

Creates a RC<Stream> for hashing using the specified hash method.
Param method The hashing method to use.
Param hashOutput The buffer where the final hash result will be written.
Returns A RC<Stream> for hashing.


initializeLogs function

void initializeLogs()

Initializes the logging system.

This function sets up the logging system and prints Brisk version to the log.


invalidPosition variable

constexpr inline uintmax_t invalidPosition = UINTMAX_MAX

Constant representing an invalid position in a stream.

This value is used to indicate an invalid or undefined position when working with stream operations.


invalidSize variable

constexpr inline uintmax_t invalidSize = UINTMAX_MAX

Constant representing an invalid size for a stream.

This value is used to indicate an invalid or undefined size when working with stream operations.


isAscii function

bool isAscii(U8StringView text)

Checks if the text contains only ASCII characters.
Param text A UTF-8 encoded string view.
Returns True if the text is ASCII, otherwise false.


isOSWindows function

constexpr bool isOSWindows()

Checks if the current OS is Windows.
Returns Always false for non-Windows systems.


constexpr bool isOSWindows(unsigned int major,
                           unsigned int minor,
                           unsigned int build)

Dummy function for non-Windows systems.
Param major Major version number (unused).
Param minor Minor version number (unused).
Param build Build number (unused).
Returns Always false for non-Windows systems.


join function

template <typename Char>
std::basic_string<Char>
join(const std::vector<std::basic_string<Char>> &list,
     std::basic_string_view<std::type_identity_t<Char>>
         delimiter)

Joins a list of strings into a single string with a specified delimiter.
Template param Char The character type of the strings.
Param list The list of strings to join.
Param delimiter The delimiter used to join the strings.
Returns A single string with the elements joined by the delimiter.


template <typename Char>
std::basic_string<Char>
join(const std::vector<std::basic_string<Char>> &list,
     std::type_identity_t<Char> delimiter)

Joins a list of basic strings into a single string with a character delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param list A vector of basic strings to join.
Param delimiter The character used to separate the joined strings.
Returns A single string with the individual strings joined by the delimiter.


template <typename Char>
std::basic_string<Char>
join(const std::vector<std::basic_string_view<Char>> &list,
     std::basic_string_view<std::type_identity_t<Char>>
         delimiter)

Joins a list of basic string views into a single string with a string delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param list A vector of basic string views to join.
Param delimiter The string delimiter used to separate the joined string views.
Returns A single string with the individual string views joined by the delimiter.


template <typename Char>
std::basic_string<Char>
join(const std::vector<std::basic_string_view<Char>> &list,
     std::type_identity_t<Char> delimiter)

Joins a list of basic string views into a single string with a character delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param list A vector of basic string views to join.
Param delimiter The character used to separate the joined string views.
Returns A single string with the individual string views joined by the delimiter.


keyToValue function

template <typename K, typename V>
inline optional<V>
keyToValue(const KeyValueOrderedList<K, V> &list,
           const K &name)

Converts a key to its corresponding value in a key-value ordered list.

Searches for the given key and returns the associated value if found, otherwise returns nullopt.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to search through.
Param name The key to find.
Returns optional<V> The associated value, or nullopt if not found.


template <typename V, typename K>
inline optional<V> keyToValue(const std::vector<V> &list,
                              K(V::*field),
                              const K &fieldValue)

Finds a value in a vector by a specified field.

Searches for the given name in a vector of objects of type V by accessing the specified field.
Template param V The type of the objects in the list.
Template param K The type of the field used for searching.
Param list The list to search through.
Param field Pointer to the field to compare.
Param fieldValue The value to find.
Returns optional<V> The found value, or nullopt if not found.


locale variable

extern RC<const Locale> locale

External reference to the current locale.


logFlush function

inline void logFlush()

Flushes the logger.

Forces the logger to flush its internal buffer, ensuring that all log messages are written to the output.


lookupByEnum function

template <typename T, size_t N, typename E>
inline T lookupByEnum(T (&array)[N], E value, T fallback = T

Looks up a value in an array by its corresponding enum value.
Template param T The type of the array elements.
Template param N The size of the array.
Template param E The enum type.
Param array The array to search.
Param value The enum value to look up.
Param fallback The fallback value if the enum value is out of range.
Returns The corresponding value from the array or the fallback value if not found.


lowerCase function

inline U8String lowerCase(U8StringView str)

Converts a UTF-8 string to lowercase.
Param str The input UTF-8 string to convert.
Returns The converted lowercase string.


inline U16String lowerCase(U16StringView str)

Converts a UTF-16 string to lowercase.
Param str The input UTF-16 string to convert.
Returns The converted lowercase string.


inline U32String lowerCase(U32StringView str)

Converts a UTF-32 string to lowercase.
Param str The input UTF-32 string to convert.
Returns The converted lowercase string.


ltrim function

std::string ltrim(std::string s)

Trims whitespace from the left side of a string.
Param s The string to trim.
Returns The left-trimmed string.


lz4Decode function

bytes lz4Decode(bytes_view data)

Decompresses LZ4-compressed data.
Param data The LZ4-compressed input data.
Returns A vector of bytes containing the decompressed data.


lz4Decoder function

RC<Stream> lz4Decoder(RC<Stream> reader)

Creates a Stream that reads LZ4-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


lz4Encode function

bytes lz4Encode(bytes_view data, CompressionLevel level)

Compresses data using LZ4.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


lz4Encoder function

RC<Stream> lz4Encoder(RC<Stream> writer,
                      CompressionLevel level)

Creates a Stream that writes LZ4-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


mainScheduler variable

extern RC<TaskQueue> mainScheduler

Represents the task queue and scheduler for the main thread.


makeValue function

template <typename T>
[[nodiscard]] Value<T>
makeValue(typename Value<T>::GetFn get,
          typename Value<T>::SetFn set,
          BindingAddress address)

Creates a Value instance with the specified getter and setter functions.
Template param T The type of the value.
Param get The function to retrieve the value.
Param set The function to set the value.
Param address The BindingAddress for the value.
Returns A Value instance representing the property.


md5 function

MD5Hash md5(bytes_view data)

Computes the MD5 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting MD5 hash as an MD5Hash object.


MD5Hash md5(string_view data)

Computes the MD5 hash of a string.
Param data The string to hash.
Returns The resulting MD5 hash as an MD5Hash object.


md5HashStream function

RC<Stream> md5HashStream(MD5Hash &hashOutput)

Creates a RC<Stream> for MD5 hashing.
Param hashOutput The MD5Hash object where the final hash result will be written.
Returns A RC<Stream> for MD5 hashing.


mix function

template <typename T> constexpr T mix(float t, T x, T y)

Performs linear interpolation between two values.
Template param T The type of the values.
Param t The interpolation factor, ranging from 0 to 1.
Param x The starting value.
Param y The ending value.
Returns The interpolated value between x and y.


mutableValue function

template <typename T>
[[nodiscard]] inline Value<T>
Value<T>::mutableValue(T initialValue)

Returns mutable Value that initially holds the given value.
Param initialValue value


notManaged function

template <typename T>
std::shared_ptr<T> notManaged(T *pointer)

Wraps a raw pointer in a shared pointer (RC) without taking ownership.
Template param T The type of the object being pointed to.
Param pointer A raw pointer to the object. The pointer is not managed or deleted.
Returns A shared pointer (RC) that does not manage the lifetime of the object.


notify function

template <typename T> int notify(T *variable)

Notify that the variable has changed. This triggers update of all dependant values.
Returns int Number of handlers called


notifyRange function

int notifyRange(BindingAddress range)

Notify that the variable has changed This triggers update of all dependant values.
Param range address range
Returns int Number of handlers called


now function

inline Clock::time_point now() noexcept

Returns the current time.

This function retrieves the current time according to the steady clock.
Returns The current time point.


one function

template <typename T> std::span<T> one(T &value) noexcept

Creates a std::span representing a view over a single mutable element.

This function template constructs a std::span<T\> from a reference to a single element of type T. The span provides read and write access to the element.
Template param T The type of the element.
Param value A reference to the element of type T. This element will be used to create the span.
Returns A std::span<T\> representing a view over the single element value. The span has a size of 1 and points to the memory address of value.


template <typename T>
std::span<const T> one(const T &value) noexcept

Creates a std::span representing a view over a single immutable element.

This function template constructs a std::span<const T\> from a reference to a single constant element of type T. The span provides read-only access to the element.
Template param T The type of the element.
Param value A reference to the constant element of type T. This element will be used to create the span.
Returns A std::span<const T\> representing a view over the single element value. The span has a size of 1 and points to the memory address of value.


openFile function

expected<RC<Stream>, IOError> openFile(
    const fs::path &filePath,
    OpenFileMode mode = OpenFileMode::ReadWriteExisting)

Opens a file with the specified path and mode.

This function attempts to open a file using the provided path and file mode. It returns an expected object containing either a reference-counted stream on success or an I/O error on failure.
Param filePath The path to the file to be opened.
Param mode The mode in which to open the file (default is OpenFileMode::ReadWriteExisting).
Returns An expected object containing a reference-counted stream or an I/O error.


RC<Stream> openFile(std::FILE *file, bool owns = false)

Opens a file using a native file pointer.

This function opens a file given a native FILE* pointer. It allows specifying whether the function should take ownership of the file pointer. It returns a reference-counted stream.
Param file A pointer to the native file to be opened.
Param owns A flag indicating whether to take ownership of the file pointer (default is false).
Returns A reference-counted stream.


openFileForAppending function

inline expected<RC<Stream>, IOError>
openFileForAppending(const fs::path &filePath)

Opens a file for appending.

This function is a convenience wrapper that opens the specified file for writing in append mode. It returns an expected object containing either a reference-counted stream on success or an I/O error on failure.
Param filePath The path to the file to be opened for appending.
Returns An expected object containing a reference-counted stream or an I/O error.


openFileForReading function

expected<RC<Stream>, IOError>
openFileForReading(const fs::path &filePath)

Opens a file for reading.

This function opens the specified file for reading. It returns an expected object containing either a reference-counted stream on success or an I/O error on failure.
Param filePath The path to the file to be opened for reading.
Returns An expected object containing a reference-counted stream or an I/O error.


openFileForWriting function

expected<RC<Stream>, IOError>
openFileForWriting(const fs::path &filePath,
                   bool appending = false)

Opens a file for writing.

This function opens the specified file for writing. If the appending parameter is set to true, data will be appended to the end of the file. It returns an expected object containing either a reference-counted stream on success or an I/O error on failure.
Param filePath The path to the file to be opened for writing.
Param appending A flag indicating whether to append data to the end of the file (default is false).
Returns An expected object containing a reference-counted stream or an I/O error.


operator""_tr function

template <Internal::FixedString s>
inline std::string operator""_tr() noexcept

User-defined literal for translating a fixed string.

This operator allows using the _tr literal to easily translate fixed strings.
Template param s The fixed string to translate.
Returns The translated string.

std::string greeting = "hello"_tr;  // Translates the key "hello" to the localized string.
std::cout << greeting;  // Output: "Hola" if the locale is Spanish.


operator""_trfmt function

template <Internal::FixedString s>
constexpr LocaleFormatString<s> operator""_trfmt() noexcept

User-defined literal for formatting a localized string.

This operator allows using the _trfmt literal to create a LocaleFormatString for fixed strings.
Template param s The fixed string for formatting.
Returns A LocaleFormatString object.

constexpr auto welcomeMessage = "welcome_msg"_trfmt;  // Creates a LocaleFormatString for "welcome_msg".
std::string formattedMessage = welcomeMessage("John");  // Formats the message with the name "John".
std::cout << formattedMessage;  // Output: "Welcome, John!" if the translation is "Welcome, {0}!".


operator& function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator&& function

constexpr bool operator&&(ReflectionFlag flags,
                          ReflectionFlag flag)

Checks if a flag is set in a combination of ReflectionFlag values.
Param flags The combination of flags.
Param flag The flag to check.
Returns true if the flag is set, false otherwise.


BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator&= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator() function

inline void
Serialization::operator()(SerializableInterface &value,
                          std::string_view name) const

Processes a serializable object.

Calls the serialize method on the object, allowing it to handle its own serialization.
Param value The serializable object to process.
Param name The JSON key associated with the object.


operator+ function

constexpr std::underlying_type_t<ReflectionFlag>
operator+(ReflectionFlag x)

Converts a ReflectionFlag to its underlying integer type.
Param x The ReflectionFlag to convert.
Returns The underlying integer value of the flag.


BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator+= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator<< function

template <Brisk::HasReflection T>
std::ostream &operator<<(std::ostream &os, const T &val)

Overloads the << operator to output an object's fields using reflection.
Template param T The type of the object being reflected.
Param os The output stream.
Param val The object to output.
Returns The output stream with the reflected object.


operator<<= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator>> function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator>>= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator^ function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator^= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator| function

constexpr ReflectionFlag operator|(ReflectionFlag x,
                                   ReflectionFlag y)

Combines two ReflectionFlag values using bitwise OR.
Param x The first flag.
Param y The second flag.
Returns The combined flag result.


BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator|= function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


operator~ function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


osName function

std::string osName()

Retrieves the operating system name.
Returns The name of the operating system as a string.


osUname function

OSUname osUname()

Retrieves the system uname information.
Returns The OSUname structure containing the uname information.


osVersion function

OSVersion osVersion()

Retrieves the operating system version.
Returns The OSVersion structure containing the operating system version.


rad2deg variable

template <typename T>
constexpr inline T rad2deg = T(180) / std::numbers::pi_v<T>

Converts radians to degrees.
Template param T The numeric type.


rcNew variable

constexpr inline RCNew rcNew

Instance of RCNew used for creating reference-counted pointers.
Note (UNKNOWN ID: ('ref', 'RCNew'))


readBytes function

expected<bytes, IOError>
readBytes(const fs::path &file_name)

Reads the entire file as a vector of bytes.

This function reads all the contents of the specified file and returns them as a vector of bytes. It handles any I/O errors that may occur during the read operation, returning an expected object that contains either the byte vector or an I/O error.
Param file_name The path to the file to be read.
Returns An expected object containing a vector of bytes if the read operation is successful, or an I/O error if it fails.


readJson function

expected<Json, IOError> readJson(const fs::path &file_name)

Reads a JSON object from a file.

This function reads a JSON object from the specified file and returns an expected object containing either the JSON object or an I/O error.
Param file_name The path to the file to be read.
Returns An expected object containing the JSON object or an I/O error.


readLines function

expected<u8strings, IOError>
readLines(const fs::path &file_name)

Reads the entire file as a vector of UTF8-encoded strings.

This function reads lines from the specified file and returns an expected object containing either a vector of strings (each representing a line) or an I/O error.
Param file_name The path to the file to be read.
Returns An expected object containing a vector of lines or an I/O error.


readMsgpack function

expected<Json, IOError>
readMsgpack(const fs::path &file_name)

Reads a JSON object in MessagePack format from a file.

This function reads a JSON object in MessagePack format from the specified file and returns an expected object containing either the JSON object or an I/O error.
Param file_name The path to the file to be read.
Returns An expected object containing the MessagePack object or an I/O error.


readUtf8 function

expected<string, IOError>
readUtf8(const fs::path &file_name, bool removeBOM = true)

Reads the entire file as a UTF-8 encoded string.

This function reads a UTF-8 encoded string from the specified file. It can optionally remove the Byte Order Mark (BOM). It returns an expected object containing either the string or an I/O error.
Param file_name The path to the file to be read.
Param removeBOM A flag indicating whether to remove the BOM (default is true).
Returns An expected object containing the UTF-8 string or an I/O error.


reflectFormat function

template <typename Char = char, typename T>
std::basic_string<Char> reflectFormat(const T &val)

Formats an object's fields using reflection and returns a formatted string.
Template param Char The character type for the output string (default is char).
Template param T The type of the object being reflected.
Param val The object to format.
Returns A formatted string representing the object's fields.


reflectHash function

template <size_t... indices, typename T, typename Class,
          typename... FieldType>
uint64_t reflectHash(
    uint64_t seed, size_constants<indices...>, const T &val,
    const std::tuple<ReflectionField<Class, FieldType>...>
        &fields)

Computes a hash for an object using its reflected fields.

This function iterates over the fields of an object (as defined by its reflection metadata) and accumulates a hash for each field.
Template param indices The indices of the fields in the reflection tuple.
Template param T The type of the object being hashed.
Template param Class The class type containing the fields.
Template param FieldType The types of the fields being reflected.
Param seed The initial seed for the hash.
Param val The object whose fields are being hashed.
Param fields The tuple of ReflectionField objects representing the fields.
Returns The accumulated hash value.


reflectionOf function

template <HasReflection T>
constexpr decltype(auto) reflectionOf()

Retrieves the reflection metadata of a type T.
Template param T The type with reflection metadata.
Returns The reflection metadata tuple.


template <HasReflection T>
constexpr decltype(auto) reflectionOf

Retrieves the reflection metadata of an object of type T.
Template param T The type with reflection metadata.
Param obj The object whose reflection metadata is retrieved.
Returns The reflection metadata tuple.


removeValueByKey function

template <typename K, typename V>
inline void
removeValueByKey(KeyValueOrderedList<K, V> &list,
                 const K &key)

Removes a value by its corresponding key in a key-value ordered list.

Searches for the specified key and removes the associated key-value pair if found.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list from which to remove the key-value pair.
Param key The key to remove.


replaceAll function

template <typename Char>
std::basic_string<Char> replaceAll(
    std::basic_string<Char> str,
    std::basic_string_view<std::type_identity_t<Char>> from,
    std::basic_string_view<std::type_identity_t<Char>> to)

Replaces all occurrences of a substring in a string with another substring.
Template param Char The character type of the string.
Param str The string in which to perform replacements.
Param from The substring to be replaced.
Param to The substring to replace with.
Returns The string with all replacements applied.


template <typename Char>
std::basic_string<Char>
replaceAll(std::basic_string<Char> str,
           std::type_identity_t<Char> from,
           const std::type_identity_t<Char> &to)

Replaces all occurrences of a character in a basic string with another character.
Template param Char The character type (e.g., char, wchar_t).
Param str The input string where replacements are made.
Param from The character to replace.
Param to The character to replace with.
Returns A new string with all occurrences of the 'from' character replaced by the 'to' character.


template <typename Char>
std::basic_string<Char> replaceAll(
    std::basic_string_view<Char> text,
    std::basic_string_view<std::type_identity_t<Char>> from,
    std::basic_string_view<std::type_identity_t<Char>> to)

Replaces all occurrences of a substring in a basic string view with another substring.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string view where replacements are made.
Param from The substring to replace.
Param to The substring to replace with.
Returns A new string with all occurrences of the 'from' substring replaced by the 'to' substring.


template <typename Char>
std::basic_string<Char>
replaceAll(std::basic_string_view<Char> text,
           std::type_identity_t<Char> from,
           std::type_identity_t<Char> to)

Replaces all occurrences of a character in a basic string view with another character.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string view where replacements are made.
Param from The character to replace.
Param to The character to replace with.
Returns A new string with all occurrences of the 'from' character replaced by the 'to' character.


template <typename Char>
std::basic_string<Char> replaceAll(
    const Char *text,
    std::basic_string_view<std::type_identity_t<Char>> from,
    std::basic_string_view<std::type_identity_t<Char>> to)

Replaces all occurrences of a substring in a C-string with another substring.
Template param Char The character type (e.g., char, wchar_t).
Param text The input C-string where replacements are made.
Param from The substring to replace.
Param to The substring to replace with.
Returns A new string with all occurrences of the 'from' substring replaced by the 'to' substring.


template <typename Char>
std::basic_string<Char>
replaceAll(Char *text, std::type_identity_t<Char> from,
           std::type_identity_t<Char> to)

Replaces all occurrences of a character in a C-string with another character.
Template param Char The character type (e.g., char, wchar_t).
Param text The input C-string where replacements are made.
Param from The character to replace.
Param to The character to replace with.
Returns A new string with all occurrences of the 'from' character replaced by the 'to' character.


replacementChar variable

constexpr inline char32_t replacementChar = U'\U0000FFFD'

The replacement character used for invalid UTF characters.


rtrim function

std::string rtrim(std::string s)

Trims whitespace from the right side of a string.
Param s The string to trim.
Returns The right-trimmed string.


safeCharPtr function

inline std::string_view safeCharPtr(const char *s)

Converts a const char* to a std::string_view, handling nullptr gracefully.

This function takes a pointer to a null-terminated C-string. If the pointer is non-null, it returns a std::string_view that references the string. If the pointer is nullptr, it returns a std::string_view with the value "(null)" to represent the absence of a string.
Param s A pointer to a null-terminated C-string. Can be nullptr.
Returns A std::string_view that either references the input C-string or is set to "(null)" if the input pointer is nullptr.


setThreadName function

void setThreadName(std::string_view name)

Sets the name of the current thread.

This function sets the name of the calling thread. The name is useful for debugging and profiling tools that display thread names in their interfaces. Thread names are typically limited to a small number of characters, depending on the platform.
Param name A string view representing the desired name of the thread.


setThreadPriority function

void setThreadPriority(ThreadPriority priority)

Sets the priority of the current thread.

This function sets the scheduling priority of the calling thread. The effect of this may vary depending on the operating system and platform. Higher priority threads may receive more CPU time than lower priority ones.
Param priority The desired thread priority level, from the ThreadPriority enumeration.


setValueByKey function

template <typename K, typename V>
inline void setValueByKey(KeyValueOrderedList<K, V> &list,
                          const K &key, V value)

Sets a value by its corresponding key in a key-value ordered list.

Updates the value associated with the given key if it exists, otherwise adds a new key-value pair to the list.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to update.
Param key The key for which to set the value.
Param value The value to set.


sha1 function

SHA1Hash sha1(bytes_view data)

Computes the SHA-1 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting SHA-1 hash as a SHA1Hash object.


SHA1Hash sha1(string_view data)

Computes the SHA-1 hash of a string.
Param data The string to hash.
Returns The resulting SHA-1 hash as a SHA1Hash object.


sha1HashStream function

RC<Stream> sha1HashStream(SHA1Hash &hashOutput)

Creates a RC<Stream> for SHA-1 hashing.
Param hashOutput The SHA1Hash object where the final hash result will be written.
Returns A RC<Stream> for SHA-1 hashing.


sha256 function

SHA256Hash sha256(bytes_view data)

Computes the SHA-256 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting SHA-256 hash as a SHA256Hash object.


SHA256Hash sha256(string_view data)

Computes the SHA-256 hash of a string.
Param data The string to hash.
Returns The resulting SHA-256 hash as a SHA256Hash object.


sha256HashStream function

RC<Stream> sha256HashStream(SHA256Hash &hashOutput)

Creates a RC<Stream> for SHA-256 hashing.
Param hashOutput The SHA256Hash object where the final hash result will be written.
Returns A RC<Stream> for SHA-256 hashing.


sha3_256 function

SHA3_256Hash sha3_256(bytes_view data)

Computes the SHA3-256 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting SHA3-256 hash as a SHA3_256Hash object.


SHA3_256Hash sha3_256(string_view data)

Computes the SHA3-256 hash of a string.
Param data The string to hash.
Returns The resulting SHA3-256 hash as a SHA3_256Hash object.


sha3_256HashStream function

RC<Stream> sha3_256HashStream(SHA3_256Hash &hashOutput)

Creates a RC<Stream> for SHA3-256 hashing.
Param hashOutput The SHA3_256Hash object where the final hash result will be written.
Returns A RC<Stream> for SHA3-256 hashing.


sha3_512 function

SHA3_512Hash sha3_512(bytes_view data)

Computes the SHA3-512 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting SHA3-512 hash as a SHA3_512Hash object.


SHA3_512Hash sha3_512(string_view data)

Computes the SHA3-512 hash of a string.
Param data The string to hash.
Returns The resulting SHA3-512 hash as a SHA3_512Hash object.


sha3_512HashStream function

RC<Stream> sha3_512HashStream(SHA3_512Hash &hashOutput)

Creates a RC<Stream> for SHA3-512 hashing.
Param hashOutput The SHA3_512Hash object where the final hash result will be written.
Returns A RC<Stream> for SHA3-512 hashing.


sha512 function

SHA512Hash sha512(bytes_view data)

Computes the SHA-512 hash of a sequence of bytes.
Param data The sequence of bytes to hash.
Returns The resulting SHA-512 hash as a SHA512Hash object.


SHA512Hash sha512(string_view data)

Computes the SHA-512 hash of a string.
Param data The string to hash.
Returns The resulting SHA-512 hash as a SHA512Hash object.


sha512HashStream function

RC<Stream> sha512HashStream(SHA512Hash &hashOutput)

Creates a RC<Stream> for SHA-512 hashing.
Param hashOutput The SHA512Hash object where the final hash result will be written.
Returns A RC<Stream> for SHA-512 hashing.


shorten function

std::u32string shorten(std::u32string str, size_t maxLength,
                       float position,
                       std::u32string_view ellipsis = U"…")

Shortens a string to a specified maximum length.
Param str The string to shorten.
Param maxLength The maximum length of the output string in unicode codepoints.
Param position Where to cut the string: left (0), right (1), or middle (0.5).
Param ellipsis The ellipsis string to append if shortening occurs.
Returns The shortened string.


inline std::string
shorten(const std::string &str, size_t maxLength,
        float position, std::u32string_view ellipsis = U"…")

Shortens a UTF-8 string to a specified maximum length.
Param str The UTF-8 string to shorten.
Param maxLength The maximum length of the output string in unicode codepoints.
Param position Where to cut the string: left (0), right (1), or middle (0.5).
Param ellipsis The ellipsis string to append if shortening occurs.
Returns The shortened UTF-8 string.


simpleMemoryRepresentation variable

template <typename T>
constexpr inline bool simpleMemoryRepresentation =
    (std::has_unique_object_representations_v<T> ||
     std::is_floating_point_v<T> ||
     std::is_same_v<T, bool>) &&
    (alignof(T) <= sizeof(T))

A compile-time constant determining if a type has a simple memory representation.

A type is considered to have a simple memory representation if it has unique object representations, is a floating-point type, or is a boolean type, and its alignment is less than or equal to its size.


split function

template <typename Char>
std::vector<std::basic_string_view<Char>>
split(std::basic_string_view<Char> text,
      std::basic_string_view<std::type_identity_t<Char>>
          delimiter)

Splits a string into a list of substrings using a delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string to split.
Param delimiter The delimiter used to split the string.
Returns A vector of string views representing the split substrings.


template <typename Char>
std::vector<std::basic_string_view<Char>>
split(std::basic_string_view<Char> text,
      std::type_identity_t<Char> delimiter)

Splits a string into a list of substrings using a single character as a delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string to split.
Param delimiter The delimiter character used to split the string.
Returns A vector of string views representing the split substrings.


template <typename Char>
std::vector<std::basic_string_view<Char>>
split(const std::basic_string<Char> &text,
      std::basic_string_view<std::type_identity_t<Char>>
          delimiter)

Splits a basic string into a list of substrings using a delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string to split.
Param delimiter The string delimiter used to split the text.
Returns A vector of string views representing the split substrings.


template <typename Char>
std::vector<std::basic_string_view<Char>>
split(const std::basic_string<Char> &text,
      std::type_identity_t<Char> delimiter)

Splits a basic string into a list of substrings using a single character as a delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input string to split.
Param delimiter The delimiter character used to split the text.
Returns A vector of string views representing the split substrings.


template <typename Char>
std::vector<std::basic_string_view<Char>>
split(const Char *text,
      std::basic_string_view<std::type_identity_t<Char>>
          delimiter)

Splits a character array (C-string) into a list of substrings using a string delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input C-string to split.
Param delimiter The string delimiter used to split the text.
Returns A vector of string views representing the split substrings.


template <typename Char>
std::vector<std::basic_string_view<Char>>
split(Char *text, std::type_identity_t<Char> delimiter)

Splits a character array (C-string) into a list of substrings using a single character as a delimiter.
Template param Char The character type (e.g., char, wchar_t).
Param text The input C-string to split.
Param delimiter The delimiter character used to split the text.
Returns A vector of string views representing the split substrings.


void split(std::string_view text,
           std::string_view delimiter, std::string_view &s1,
           std::string_view &s2)

Splits a string view into two substrings using a delimiter.
Param text The input string to split.
Param delimiter The delimiter used to split the string.
Param s1 Output string view for the first part.
Param s2 Output string view for the second part.


sqr function

template <typename T> constexpr T sqr(T x) noexcept

Computes the square of a value.
Template param T The type of the value. Must support multiplication.
Param x The value to be squared.
Returns The square of the given value.


staticBinding variable

inline Empty staticBinding

A special object for static binding.


staticBindingAddress variable

inline BindingAddress staticBindingAddress =
    toBindingAddress(&staticBinding)

The BindingAddress for the static binding object.


staticMap function

template <typename Tout, typename Tin, typename... Args>
constexpr Tout staticMap(Tin value, Tout fallback) noexcept

A compile-time function for mapping values.

Always returns the fallback value.
Template param Tout The type of the fallback value.
Template param Tin The type of the input value.
Template param Args Additional argument types (unused).
Param value The value to compare.
Param fallback The fallback value to return.
Returns Tout The fallback value.


template <typename Tout, typename Tin, typename... Args>
constexpr Tout staticMap(Tin value,
                         std::type_identity_t<Tin> in,
                         Tout out, Args... args) noexcept

A compile-time function for mapping values.

Compares the input value with the specified type and returns the corresponding output if found.
Template param Tout The type of the output value.
Template param Tin The type of the input value.
Template param Args Additional argument types for comparison.
Param value The value to compare.
Param in The input type to match.
Param out The output value to return if a match is found.
Param args Additional arguments for further comparisons.
Returns Tout The corresponding output value.


stderrStream function

RC<Stream> stderrStream()

Retrieves the standard error stream.

This function returns a reference-counted stream that points to the standard error output.
Returns A reference-counted stream for standard error.


stdinStream function

RC<Stream> stdinStream()

Retrieves the standard input stream.

This function returns a reference-counted stream that points to the standard input.
Returns A reference-counted stream for standard input.


stdoutStream function

RC<Stream> stdoutStream()

Retrieves the standard output stream.

This function returns a reference-counted stream that points to the standard output.
Returns A reference-counted stream for standard output.


string function

using std::string

@fileType alias definitions and utility functions for working with various string and byte types.


stripLocaleContext function

constexpr std::string_view
stripLocaleContext(std::string_view key)

Strips the locale context from a translation key.

This function removes any context information from a translation key that is separated by "||".
Param key The translation key potentially containing context.
Returns A string view to the stripped key.


tempFilePath function

fs::path tempFilePath(std::string pattern)

Generates a temporary file path based on a specified pattern.

This function creates a path for a temporary file by replacing placeholders in the given pattern. It replaces ? with a random character from the set of lowercase letters and digits, and * with 16 random characters from the same set.

The function is thread-safe, using a mutex to ensure that the random number generator is accessed in a synchronized manner.
Param pattern A string representing the desired pattern for the temporary file name. The pattern can include ? and * as placeholders for random characters.
Returns A fs::path representing the full path to the generated temporary file.


threadScheduler variable

extern thread_local Scheduler *threadScheduler

Pointer to the scheduler associated with the current thread. If no scheduler has been assigned, this pointer may be nullptr.


timeSinceStart function

inline Clock::duration timeSinceStart() noexcept

Returns the duration since the application started.
Returns The duration since the application start.


toBase64 function

size_t toBase64(std::span<char> encoded, bytes_view data,
                bool urlSafe = false, bool pad = true)

Converts span of bytes to string in Base64 format
Returns number of characters written or SIZE_MAX in case of error


toBindingAddress function

template <typename T>
constexpr BindingAddress toBindingAddress(T *value) noexcept

Converts a pointer of type T to a BindingAddress.

This function creates a BindingAddress that encompasses the memory range of the specified pointer, allowing for easier management of variable bindings in a property-like system.
Template param T The type of the value being pointed to.
Param value A pointer to the value.
Returns A BindingAddress representing the memory range of the value.


toBytes function

template <typename T> inline bytes toBytes(T &&value)

Converts an object to a vector of bytes.

This function first converts the object to a bytes_view, then creates a bytes vector from it.
Param value The object to convert.
Returns A bytes vector representing the object as a sequence of bytes.


toBytesMutableView function

template <typename Container,
          typename T =
              typename std::decay_t<Container>::value_type,
          std::enable_if_t<std::is_constructible_v<
              std::span<T>, Container &>> * = nullptr>
inline bytes_mutable_view
toBytesMutableView(Container &&cont)

Converts a container to a modifiable view of bytes.

This function works for containers that may be converted to a std::span<T\>.
Param cont The container to convert.
Returns A bytes_mutable_view representing the container's elements as a sequence of bytes.


toBytesView function

template <typename Container,
          typename T =
              typename std::decay_t<Container>::value_type>
inline bytes_view toBytesView(Container &&cont)
  requires std::is_constructible_v<std::span<const T>,
                                   Container &>

Converts a container to a non-modifiable view of bytes.

This function works for containers that may be converted to a std::span<const T\>.
Param cont The container to convert.
Returns A bytes_view representing the container's elements as a sequence of bytes.


template <size_t N>
inline bytes_view toBytesView(const char (&str)[N])

Converts a null-terminated C-string to a non-modifiable view of bytes.
Param str The null-terminated C-string to convert.
Returns A bytes_view representing the C-string as a sequence of bytes, excluding null byte.


template <size_t N>
inline bytes_view toBytesView(const char8_t (&str)[N])

Converts a null-terminated UTF-8 C-string to a non-modifiable view of bytes.
Param str The null-terminated UTF-8 C-string to convert.
Returns A bytes_view representing the UTF-8 C-string as a sequence of bytes, excluding null byte.


template <size_t N>
inline bytes_view toBytesView(const char16_t (&str)[N])

Converts a null-terminated UTF-16 C-string to a non-modifiable view of bytes.
Param str The null-terminated UTF-16 C-string to convert.
Returns A bytes_view representing the UTF-16 C-string as a sequence of bytes, excluding null.


template <size_t N>
inline bytes_view toBytesView(const char32_t (&str)[N])

Converts a null-terminated UTF-32 C-string to a non-modifiable view of bytes.
Param str The null-terminated UTF-32 C-string to convert.
Returns A bytes_view representing the UTF-32 C-string as a sequence of bytes, excluding null.


template <size_t N>
inline bytes_view toBytesView(const wchar_t (&str)[N])

Converts a null-terminated wide C-string to a non-modifiable view of bytes.
Param str The null-terminated wide C-string to convert.
Returns A bytes_view representing the wide C-string as a sequence of bytes, excluding null.


toHerzs function

template <typename Rep, typename Period>
inline double
toHerzs(std::chrono::duration<Rep, Period> duration)

Converts a duration to Hertz.

This function converts a given duration to a double value representing the frequency in Hertz.
Param duration The duration to convert.
Returns The frequency in Hertz.


toHex function

size_t toHex(std::span<char> encoded, bytes_view data,
             bool upperCase = true)

Converts span of bytes to string in Hex format
Returns number of characters written or SIZE_MAX in case of error


toJson function

bool toJson(Brisk::Json &j, const std::u32string &s)

Serializes a UTF-32 string to JSON.
Param j The JSON object to serialize to.
Param s The UTF-32 string to serialize.
Returns True if serialization was successful, otherwise false.


bool toJson(Brisk::Json &j, const std::u16string &s)

Serializes a UTF-16 string to JSON.
Param j The JSON object to serialize to.
Param s The UTF-16 string to serialize.
Returns True if serialization was successful, otherwise false.


bool toJson(Brisk::Json &j, const std::wstring &s)

Serializes a wide string to JSON.
Param j The JSON object to serialize to.
Param s The wide string to serialize.
Returns True if serialization was successful, otherwise false.


template <typename Rep, typename Period>
inline bool toJson(Brisk::Json &j,
                   const duration<Rep, Period> &dur)

Converts a chrono duration to a JSON value.
Param j The resulting JSON value.
Param dur The chrono duration to convert.
Returns True if conversion is successful; otherwise, false.


template <typename Clock, typename Duration>
inline bool toJson(Brisk::Json &j,
                   const time_point<Clock, Duration> &time)

Converts a chrono time point to a JSON value.
Param j The resulting JSON value.
Param time The chrono time point to convert.
Returns True if conversion is successful; otherwise, false.


toSeconds function

template <typename Rep, typename Period>
inline double
toSeconds(std::chrono::duration<Rep, Period> duration)

Converts a duration to seconds.

This function converts a given duration to a double value representing the number of seconds.
Param duration The duration to convert.
Returns The duration in seconds.


toStringView function

template <typename T>
inline std::string_view toStringView(T &&value)

Converts an object to a std::string_view.

This function first converts the object to a bytes_view, then creates a std::string_view from it.
Param value The object to convert.
Returns A std::string_view representing the object as a sequence of characters.


toStrings function

template <typename Char = char, typename T>
std::vector<std::basic_string<Char>> toStrings(T &&value)

Converts a container of elements to a vector of basic strings.
Template param Char The character type for the output strings.
Template param T The container type.
Param value The container with elements to convert.
Returns A vector of basic strings converted from the container elements.


toUtf16 function

template <typename InChar>
inline U16String
toUtf16(std::basic_string_view<InChar> text,
        UTFPolicy policy = UTFPolicy::Default)

Converts text from any encoding to UTF-16.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A UTF-16 encoded string.


toUtf32 function

template <typename InChar>
inline U32String
toUtf32(std::basic_string_view<InChar> text,
        UTFPolicy policy = UTFPolicy::Default)

Converts text from any encoding to UTF-32.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A UTF-32 encoded string.


toUtf8 function

template <typename InChar>
inline U8String
toUtf8(std::basic_string_view<InChar> text,
       UTFPolicy policy = UTFPolicy::Default)

Converts text from any encoding to UTF-8.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A UTF-8 encoded string.


toggle function

BRISK_FLAGS(StreamCapabilities)

Macro to enable bitwise operations for StreamCapabilities.

This macro allows for the use of bitwise operations on the StreamCapabilities enumeration, such as bitwise OR, AND, and NOT operations.


transformCase function

U8String transformCase(U8StringView str,
                       CaseTransformation mode)

Transforms the case of a UTF-8 string based on the specified mode.
Param str The input UTF-8 string to transform.
Param mode The case transformation mode (lower or upper).
Returns Transformed string in the specified case.


U16String transformCase(U16StringView str,
                        CaseTransformation mode)

Transforms the case of a UTF-16 string based on the specified mode.
Param str The input UTF-16 string to transform.
Param mode The case transformation mode (lower or upper).
Returns Transformed string in the specified case.


U32String transformCase(U32StringView str,
                        CaseTransformation mode)

Transforms the case of a UTF-32 string based on the specified mode.
Param str The input UTF-32 string to transform.
Param mode The case transformation mode (lower or upper).
Returns Transformed string in the specified case.


trim function

std::string trim(std::string s)

Trims whitespace from both sides of a string.
Param s The string to trim.
Returns The trimmed string.


uniqueFileName function

fs::path uniqueFileName(std::string_view base,
                        std::string_view numbered,
                        int i = 1)

Generates a unique file name based on a base name and a numbering pattern.

This function checks if a file with the specified base name exists. If it does, it appends an incrementing number to the numbered pattern until a unique file name is found that does not already exist.

The numbered pattern is formatted using the given integer i to create the file name. The function ensures that the resulting file name is unique by incrementing i until a non-existing name is generated.
Param base The base name of the file to check for existence ("screenshot.png").
Param numbered A format string representing the naming pattern, which can include placeholders for the incrementing number ("screenshot ({}).png").
Param i The starting number to be used in the naming pattern.
Returns A fs::path representing a unique file name based on the input parameters.


upperCase function

inline U8String upperCase(U8StringView str)

Converts a UTF-8 string to uppercase.
Param str The input UTF-8 string to convert.
Returns The converted uppercase string.


inline U16String upperCase(U16StringView str)

Converts a UTF-16 string to uppercase.
Param str The input UTF-16 string to convert.
Returns The converted uppercase string.


inline U32String upperCase(U32StringView str)

Converts a UTF-32 string to uppercase.
Param str The input UTF-32 string to convert.
Returns The converted uppercase string.


utf16Cleanup function

inline u16string
utf16Cleanup(U16StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Cleans up invalid UTF-16 characters in the text.
Param text A UTF-16 encoded string view.
Param policy The policy to handle invalid characters.
Returns A cleaned up UTF-16 encoded string.


utf16Codepoints function

inline size_t
utf16Codepoints(U16StringView text,
                UTFPolicy policy = UTFPolicy::Default)

Counts the number of UTF-16 codepoints in the text.
Param text A UTF-16 encoded string view.
Param policy The policy to handle invalid characters.
Returns The number of UTF-16 codepoints in the text.


utf16Iterate function

inline UtfIterator<char16_t>
utf16Iterate(U16StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Creates a UTF-16 iterator for iterating over UTF-16 text.
Param text A UTF-16 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-16 iterator for the given text.


utf16Normalize function

inline U16String
utf16Normalize(U16StringView text,
               UTFNormalization normalization,
               UTFPolicy policy = UTFPolicy::Default)

Normalizes UTF-16 text according to the specified normalization type.
Param text A UTF-16 encoded string view.
Param normalization The normalization type to apply.
Param policy The policy to handle invalid characters.
Returns A normalized UTF-16 encoded string.


utf16SkipBom function

inline U16StringView utf16SkipBom(U16StringView text)

Skips BOM in UTF-16 encoded text.
Param text A string view of the input text.
Returns A string view of the text without BOM.


utf16ToUtf32 function

inline std::u32string
utf16ToUtf32(U16StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Converts UTF-16 text to UTF-32.
Param text A UTF-16 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-32 encoded string.


utf16ToUtf8 function

inline std::string
utf16ToUtf8(U16StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Converts UTF-16 text to UTF-8.
Param text A UTF-16 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-8 encoded string.


utf16Transform function

inline u16string
utf16Transform(U16StringView text,
               const function<char32_t(char32_t)> &fn,
               UTFPolicy policy = UTFPolicy::Default)

Transforms UTF-16 text using a provided function.
Param text A UTF-16 encoded string view.
Param fn A function to transform each UTF codepoint.
Param policy The policy to handle invalid characters.
Returns A transformed UTF-16 encoded string.


utf16Validate function

inline UTFValidation utf16Validate(U16StringView text)

Validates UTF-16 encoded text.
Param text A UTF-16 encoded string view.
Returns The validation result of the UTF-16 text.


utf16_bom variable

extern U16StringView utf16_bom

UTF-16 Byte Order Mark (BOM) as a string view.


utf32Cleanup function

inline u32string
utf32Cleanup(U32StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Cleans up invalid UTF-32 characters in the text.
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns A cleaned up UTF-32 encoded string.


utf32Codepoints function

inline size_t
utf32Codepoints(U32StringView text,
                UTFPolicy policy = UTFPolicy::Default)

Counts the number of UTF-32 codepoints in the text.
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns The number of UTF-32 codepoints in the text.


utf32Iterate function

inline UtfIterator<char32_t>
utf32Iterate(U32StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Creates a UTF-32 iterator for iterating over UTF-32 text.
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-32 iterator for the given text.


utf32Normalize function

inline U32String
utf32Normalize(U32StringView text,
               UTFNormalization normalization,
               UTFPolicy policy = UTFPolicy::Default)

Normalizes UTF-32 text according to the specified normalization type.
Param text A UTF-32 encoded string view.
Param normalization The normalization type to apply.
Param policy The policy to handle invalid characters.
Returns A normalized UTF-32 encoded string.


utf32SkipBom function

inline U32StringView utf32SkipBom(U32StringView text)

Skips BOM in UTF-32 encoded text.
Param text A string view of the input text.
Returns A string view of the text without BOM.


utf32ToUtf16 function

inline std::u16string
utf32ToUtf16(U32StringView text,
             UTFPolicy policy = UTFPolicy::Default)

Converts UTF-32 text to UTF-16.
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-16 encoded string.


utf32ToUtf8 function

inline std::string
utf32ToUtf8(U32StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Converts UTF-32 text to UTF-8.
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-8 encoded string.


utf32ToWcs function

inline wstring
utf32ToWcs(U32StringView text,
           UTFPolicy policy = UTFPolicy::Default)

Converts UTF-32 text to wide character string (wchar_t).
Param text A UTF-32 encoded string view.
Param policy The policy to handle invalid characters.
Returns A wide character string.


utf32Transform function

inline u32string
utf32Transform(U32StringView text,
               const function<char32_t(char32_t)> &fn,
               UTFPolicy policy = UTFPolicy::Default)

Transforms UTF-32 text using a provided function.
Param text A UTF-32 encoded string view.
Param fn A function to transform each UTF codepoint.
Param policy The policy to handle invalid characters.
Returns A transformed UTF-32 encoded string.


utf32Validate function

inline UTFValidation utf32Validate(U32StringView text)

Validates UTF-32 encoded text.
Param text A UTF-32 encoded string view.
Returns The validation result of the UTF-32 text.


utf32_bom variable

extern U32StringView utf32_bom

UTF-32 Byte Order Mark (BOM) as a string view.


utf8Cleanup function

inline string
utf8Cleanup(U8StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Cleans up invalid UTF-8 characters in the text.
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns A cleaned up UTF-8 encoded string.


utf8Codepoints function

inline size_t
utf8Codepoints(U8StringView text,
               UTFPolicy policy = UTFPolicy::Default)

Counts the number of UTF-8 codepoints in the text.
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns The number of UTF-8 codepoints in the text.


utf8Iterate function

inline UtfIterator<U8Char>
utf8Iterate(U8StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Creates a UTF-8 iterator for iterating over UTF-8 text.
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-8 iterator for the given text.


utf8Normalize function

inline U8String
utf8Normalize(U8StringView text,
              UTFNormalization normalization,
              UTFPolicy policy = UTFPolicy::Default)

Normalizes UTF-8 text according to the specified normalization type.
Param text A UTF-8 encoded string view.
Param normalization The normalization type to apply.
Param policy The policy to handle invalid characters.
Returns A normalized UTF-8 encoded string.


utf8SkipBom function

inline U8StringView utf8SkipBom(U8StringView text)

Skips BOM in UTF-8 encoded text.
Param text A string view of the input text.
Returns A string view of the text without BOM.


utf8ToUtf16 function

inline std::u16string
utf8ToUtf16(U8StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Converts UTF-8 text to UTF-16.
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-16 encoded string.


utf8ToUtf32 function

inline std::u32string
utf8ToUtf32(U8StringView text,
            UTFPolicy policy = UTFPolicy::Default)

Converts UTF-8 text to UTF-32.
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns A UTF-32 encoded string.


utf8ToWcs function

inline wstring
utf8ToWcs(U8StringView text,
          UTFPolicy policy = UTFPolicy::Default)

Converts UTF-8 text to wide character string (wchar_t).
Param text A UTF-8 encoded string view.
Param policy The policy to handle invalid characters.
Returns A wide character string.


utf8Transform function

inline string
utf8Transform(U8StringView text,
              const function<char32_t(char32_t)> &fn,
              UTFPolicy policy = UTFPolicy::Default)

Transforms UTF-8 text using a provided function.
Param text A UTF-8 encoded string view.
Param fn A function to transform each UTF codepoint.
Param policy The policy to handle invalid characters.
Returns A transformed UTF-8 encoded string.


utf8Validate function

inline UTFValidation utf8Validate(U8StringView text)

Validates UTF-8 encoded text.
Param text A UTF-8 encoded string view.
Returns The validation result of the UTF-8 text.


utf8_bom variable

extern U8StringView utf8_bom

UTF-8 Byte Order Mark (BOM) as a string view.


utfCleanup function

template <typename Char>
std::basic_string<Char>
utfCleanup(std::basic_string_view<Char> text,
           UTFPolicy policy = UTFPolicy::Default)

Cleans up invalid UTF characters in the text.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A cleaned up string with invalid UTF characters handled according to the policy.


utfCodepoints function

template <typename Char>
size_t utfCodepoints(std::basic_string_view<Char> text,
                     UTFPolicy policy = UTFPolicy::Default)

Counts the number of UTF codepoints in the text.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns The number of UTF codepoints in the text.


utfIterate function

template <typename InChar>
UtfIterator<InChar>
utfIterate(std::basic_string_view<InChar> text,
           UTFPolicy policy = UTFPolicy::Default)

Creates a UTF iterator for iterating over UTF text.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A UTF iterator for the given text.


utfNormalize function

template <typename Char>
std::basic_string<Char>
utfNormalize(std::basic_string_view<Char> text,
             UTFNormalization normalization,
             UTFPolicy policy = UTFPolicy::Default)

Normalizes UTF text according to the specified normalization type.
Param text A string view of the input text.
Param normalization The normalization type to apply.
Param policy The policy to handle invalid characters.
Returns A normalized string.


utfRead function

char32_t utfRead(const char *&text, const char *end)

Reads a UTF codepoint from a text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Returns The UTF codepoint read from the text.


char32_t utfRead(const char16_t *&text, const char16_t *end)

Reads a UTF codepoint from a UTF-16 text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Returns The UTF codepoint read from the text.


char32_t utfRead(const char32_t *&text, const char32_t *end)

Reads a UTF codepoint from a UTF-32 text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Returns The UTF codepoint read from the text.


char32_t utfRead(const wchar_t *&text, const wchar_t *end)

Reads a UTF codepoint from a wide character text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Returns The UTF codepoint read from the text.


utfSkipBom function

template <typename OutChar, typename InChar>
std::basic_string_view<OutChar>
utfSkipBom(std::basic_string_view<InChar> text)

Skips BOM in a UTF encoded text.
Param text A string view of the input text.
Returns A string view of the text without BOM.


utfToUtf function

template <typename OutChar, typename InChar>
std::basic_string<OutChar>
utfToUtf(std::basic_string_view<InChar> text,
         UTFPolicy policy)

Converts text from one UTF encoding to another.
Param text A string view of the input text.
Param policy The policy to handle invalid characters.
Returns A string of the text in the target UTF encoding.


utfTransform function

template <typename Char>
std::basic_string<Char>
utfTransform(std::basic_string_view<Char> text,
             const function<char32_t(char32_t)> &fn,
             UTFPolicy policy = UTFPolicy::Default)

Transforms UTF text using a provided function.
Param text A string view of the input text.
Param fn A function to transform each UTF codepoint.
Param policy The policy to handle invalid characters.
Returns A transformed string.


utfValidate function

template <typename Char>
UTFValidation utfValidate(std::basic_string_view<Char> text)

Validates a UTF encoded text.
Param text A string view of the input text.
Returns The validation result of the UTF text.


utfWrite function

void utfWrite(char *&text, char *end, char32_t ch)

Writes a UTF codepoint to a text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Param ch The UTF codepoint to write.


void utfWrite(char16_t *&text, char16_t *end, char32_t ch)

Writes a UTF codepoint to a UTF-16 text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Param ch The UTF codepoint to write.


void utfWrite(char32_t *&text, char32_t *end, char32_t ch)

Writes a UTF codepoint to a UTF-32 text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Param ch The UTF codepoint to write.


void utfWrite(wchar_t *&text, wchar_t *end, char32_t ch)

Writes a UTF codepoint to a wide character text range.
Param text Pointer to the current position in the text.
Param end Pointer to the end of the text.
Param ch The UTF codepoint to write.


valueToKey function

template <typename K, typename V>
inline optional<K>
valueToKey(const KeyValueOrderedList<K, V> &list,
           const V &value)

Converts a value to its corresponding key in a key-value ordered list.

Searches for the given value and returns the associated key if found, otherwise returns nullopt.
Template param K The type of the keys.
Template param V The type of the values.
Param list The list to search through.
Param value The value to find.
Returns optional<K> The associated key, or nullopt if not found.


version variable

extern const std::string_view version

A constant representing the version of the Brisk library.

This constant holds the version of the Brisk library as a string view in the format "major.minor.patch-metadata". For example, "0.9.1-alpha".


wakeUpMainThread variable

extern VoidFunc wakeUpMainThread

Forces the main thread to wake up and process its task queue.

This function is particularly useful when the main thread is sleeping in the event loop. The function should interrupts the event loop by posting an empty message, ensuring that the main thread resumes execution and processes its pending tasks.

Set in window/WindowApplication.cpp


wcsToUtf32 function

inline u32string
wcsToUtf32(WStringView text,
           UTFPolicy policy = UTFPolicy::Default)

Converts wide character string (wchar_t) to UTF-32.
Param text A wide character string view.
Param policy The policy to handle invalid characters.
Returns A UTF-32 encoded string.


wcsToUtf8 function

inline string
wcsToUtf8(WStringView text,
          UTFPolicy policy = UTFPolicy::Default)

Converts wide character string (wchar_t) to UTF-8.
Param text A wide character string view.
Param policy The policy to handle invalid characters.
Returns A UTF-8 encoded string.


wordWrap function

string wordWrap(string text, size_t columns)

Word-wraps a string to the specified number of columns.
Param text The input string to wrap.
Param columns The number of columns for wrapping.
Returns The word-wrapped string.


writeBytes function

status<IOError> writeBytes(const fs::path &file_name,
                           const bytes_view &b)

Writes a byte span to a file.

This function writes bytes to the specified file and returns a status indicating success or an I/O error.
Param file_name The path to the file to be written.
Param b The bytes to write to the file.
Returns A status indicating success or an I/O error.


writeFromReader function

optional<uintmax_t> writeFromReader(RC<Stream> dest,
                                    RC<Stream> src,
                                    size_t bufSize = 65536)

Writes data from a reader stream to a destination stream.

This function reads data from the source stream and writes it to the destination stream, returning the number of bytes written or the nullopt value if an error occurs.
Param dest The destination stream to write to.
Param src The source stream to read from.
Param bufSize The buffer size to use for reading (default is 65536 bytes).
Returns An optional indicating the number of bytes written, or an empty optional if an error occurs.


writeJson function

status<IOError> writeJson(const fs::path &file_name,
                          const Json &j, int indent = 0)

Writes a JSON object to a file.

This function writes a JSON object to the specified file, optionally formatting it with the specified indentation level. If the indentation level is negative, tabs will be used instead of spaces for formatting.
Param file_name The path to the file to be written.
Param j The JSON object to write to the file.
Param indent The number of spaces to use for indentation (default is 0).
Returns A status indicating success or an I/O error.


writeMsgpack function

status<IOError> writeMsgpack(const fs::path &file_name,
                             const Json &j)

Writes a MessagePack object to a file.

This function writes a MessagePack object to the specified file.
Param file_name The path to the file to be written.
Param j The JSON object to write as MessagePack to the file.
Returns A status indicating success or an I/O error.


writeUtf8 function

status<IOError> writeUtf8(const fs::path &file_name,
                          string_view str,
                          bool useBOM = false)

Writes a UTF-8 encoded string to a file.

This function writes a UTF-8 encoded string to the specified file. It can optionally include a Byte Order Mark (BOM) at the beginning of the file.
Param file_name The path to the file to be written.
Param str The UTF-8 string to write to the file.
Param useBOM A flag indicating whether to include a BOM (default is false).
Returns A status indicating success or an I/O error.


zlibDecode function

bytes zlibDecode(bytes_view data)

Decompresses ZLib-compressed data.
Param data The ZLib-compressed input data.
Returns A vector of bytes containing the decompressed data.


zlibDecoder function

RC<Stream> zlibDecoder(RC<Stream> reader)

Creates a Stream that reads ZLib-compressed data from a source Stream.
Param reader The source Stream containing compressed data.
Returns A Stream for reading the decompressed data, which can be processed on-the-fly in a streaming manner.


zlibEncode function

bytes zlibEncode(bytes_view data, CompressionLevel level)

Compresses data using ZLib.
Param data The input data to compress.
Param level The level of compression to apply.
Returns A vector of bytes containing the compressed data.


zlibEncoder function

RC<Stream> zlibEncoder(RC<Stream> writer,
                       CompressionLevel level)

Creates a Stream that writes ZLib-compressed data to a target Stream.
Param writer The target Stream for writing compressed data.
Param level The level of compression to apply.
Returns A Stream for writing the compressed data, which can be processed on-the-fly in a streaming manner.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/