General-purpose utilities, error handling, and diagnostics. More...
Files | |
| file | namespace.h |
| file | platform.h |
| file | util.h |
Classes | |
| struct | BuildInfo |
| Holds compile-time build information for the library. More... | |
| class | CmdLineParser |
| Command-line argument parser with callback-driven option handling. More... | |
| class | Color |
| General-purpose RGBA color. More... | |
| class | Env |
| Provides access to process environment variables. More... | |
| class | Error |
| Lightweight error code wrapper for the promeki library. More... | |
| class | FourCC |
| A four-character code (FourCC) identifier. More... | |
| class | JsonObject |
| JSON object container wrapping nlohmann::json. More... | |
| class | KeyEvent |
| Event delivered when a key is pressed or released. More... | |
| class | Logger |
| Asynchronous thread-safe logging facility. More... | |
| class | MemPool |
| Thread-safe memory pool allocator with external metadata. More... | |
| class | MemSpace |
| Abstraction for memory allocation in different address spaces. More... | |
| class | Metadata |
| Key-value metadata container using typed Variant values. More... | |
| class | MouseEvent |
| Event delivered for mouse input. More... | |
| class | NumName |
| Deconstructs a numbered name into its prefix, number, and suffix components. More... | |
| class | NumNameSeq |
| Describes a NumName sequence with a head and tail range. More... | |
| class | ObfuscatedString< N, Seed > |
| Compile-time string obfuscation. More... | |
| class | Pair< A, B > |
| Typed pair container wrapping std::pair. More... | |
| class | Random |
| Pseudo-random number generator wrapping std::mt19937_64. More... | |
| class | StructDatabase< KeyType, StructType > |
| A database that maps keys to struct entries, initialized from an initializer list. More... | |
| class | System |
| Provides system-level utility functions. More... | |
| class | Terminal |
| Low-level terminal I/O abstraction. More... | |
| class | UUID |
| Universally Unique Identifier (UUID). More... | |
Macros | |
| #define | PROMEKI_SHARED(BASE) |
| Macro to simplify making a base object into a native shared object. | |
| #define | PROMEKI_VARIANT_TYPES |
| X-macro that defines all supported Variant types. | |
Typedefs | |
| template<typename T > | |
| using | Result = Pair< T, Error > |
| Convenience alias for fallible return types. | |
Functions | |
| template<typename Container > | |
| PROMEKI_NAMESPACE_BEGIN Container | sorted (Container c) |
| Returns a sorted copy of the container. | |
| PROMEKI_NAMESPACE_BEGIN constexpr uint64_t | fnv1a (const char *s, uint64_t seed=0xcbf29ce484222325ULL) |
| Computes the FNV-1a hash of a null-terminated string at compile time. | |
| PROMEKI_NAMESPACE_BEGIN void | secureZero (void *ptr, size_t size) |
| Securely zeros a memory region, guaranteed not to be optimized away. | |
General-purpose utilities, error handling, and diagnostics.
Variant type, Error reporting, UUID generation, FourCC codes, Metadata key-value store, environment access, command-line parsing, logging, memory pools, platform detection, terminal I/O, and more.
Macro to simplify making a base object into a native shared object.
You may use this in your class definition to quickly implement the functionality required to make an object into a native shared object. Note, this macro assumes you'll be using polymorphism and so will create a virtual _promeki_clone() function. You'll need to ensure you make your destructor virtual.
Example:
It does the following:
| #define PROMEKI_VARIANT_TYPES |
X-macro that defines all supported Variant types.
Each entry has the form X(EnumName, CppType). The macro is expanded in several contexts inside VariantImpl:
typeName() lookup table.std::variant template parameter list.The order of entries determines the numeric value of each Type enumerator and must match the order of template arguments passed to std::variant.
| Enumerator | C++ type |
|---|---|
| TypeInvalid | std::monostate |
| TypeBool | bool |
| TypeU8 | uint8_t |
| TypeS8 | int8_t |
| TypeU16 | uint16_t |
| TypeS16 | int16_t |
| TypeU32 | uint32_t |
| TypeS32 | int32_t |
| TypeU64 | uint64_t |
| TypeS64 | int64_t |
| TypeFloat | float |
| TypeDouble | double |
| TypeString | String |
| TypeDateTime | DateTime |
| TypeTimeStamp | TimeStamp |
| TypeSize2D | Size2Du32 |
| TypeUUID | UUID |
| TypeTimecode | Timecode |
| TypeRational | Rational<int> |
|
constexpr |
Computes the FNV-1a hash of a null-terminated string at compile time.
Uses the 64-bit FNV-1a algorithm to produce a hash from a C string. The function is constexpr, so it can be evaluated at compile time when given a constant expression argument.
| s | Pointer to the null-terminated input string. |
| seed | Initial hash value (defaults to the FNV offset basis). |
|
inline |
Securely zeros a memory region, guaranteed not to be optimized away.
Uses platform-specific secure zeroing primitives when available:
This function cannot fail. If ptr is nullptr or size is 0, it is a no-op.
| ptr | Pointer to the memory region to zero. |
| size | Number of bytes to zero. |
| PROMEKI_NAMESPACE_BEGIN Container sorted | ( | Container | c | ) |
Returns a sorted copy of the container.
| Container | A container with begin()/end() and a copy constructor. |
| c | The source container. |