|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
|
Compile-time Base64 and Base64URL codec for the jh::meta subsystem.
More...
#include <cstdint>#include "jh/pods/array.h"#include "jh/metax/t_str.h"#include "jh/detail/base64_common.h"Go to the source code of this file.
Namespaces | |
| namespace | jh::meta |
| Aggregated entry point for compile-time metaprogramming utilities. | |
Functions | |
| template<TStr S> | |
| constexpr auto | jh::meta::decode_base64 () |
Decode a Base64-encoded TStr literal at compile time. | |
| template<TStr S> | |
| constexpr auto | jh::meta::decode_base64url () |
Decode a Base64URL-encoded TStr literal at compile time. | |
| template<std::uint16_t N> | |
| constexpr auto | jh::meta::encode_base64 (const jh::pod::array< std::uint8_t, N > &raw) |
| Encode a byte buffer into a Base64 literal at compile time. | |
| template<std::uint16_t N, class PadT = std::false_type> | |
| constexpr auto | jh::meta::encode_base64url (const jh::pod::array< std::uint8_t, N > &raw, PadT={}) |
| Encode a byte buffer into a Base64URL literal at compile time. | |
Compile-time Base64 and Base64URL codec for the jh::meta subsystem.
This header provides a fully constexpr-capable Base64 and Base64URL codec that operates entirely at compile time. Encoded text is supplied as a non-type template parameter (NTTP) through the TStr compile-time string type.
The jh::meta subsystem focuses on compile-time reflection, static string manipulation, and deterministic constexpr evaluation. Its Base64 facilities allow encoded data to be decoded or generated during compilation, enabling static asset embedding, protocol constant generation, and zero-runtime preprocessing.
is_base64, is_base64url) are validated at compile time. jh::pod::array<std::uint8_t, N>. t_str<M> with a built-in null terminator. t_str and byte buffers. Compile-time decoding using a literal NTTP:
Compile-time decoding using a macro-defined literal:
Full round-trip example using t_str and byte buffers:
Within the jh::meta subsystem, this file provides the compile-time counterpart to the runtime Base64 codec used in the serialization module. While the runtime interface focuses on interoperability and safety, the compile-time interface focuses on deterministic evaluation, static transformation of encoded resources, and NTTP-based metaprogramming.
1.4.x
2025