|
FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
|
Named constants replacing magic numbers throughout the FDL core library. More...
#include <cstddef>#include <cstdint>Go to the source code of this file.
Variables | |
| constexpr double | fdl::constants::kCenterDivisor = 2.0 |
| Divisor for centering content (span / 2 = center offset). | |
| constexpr int | fdl::constants::kDefaultJsonIndent = 2 |
| Default JSON serialization indent (spaces per level). | |
| constexpr char | fdl::constants::kCustomAttrPrefix = '_' |
| Custom attribute key prefix character. | |
Alignment factors | |
Used by template application to position content within canvases. 0.0 = left/top, 0.5 = center, 1.0 = right/bottom. | |
| constexpr double | fdl::constants::kAlignStart = 0.0 |
| Left or top alignment factor. | |
| constexpr double | fdl::constants::kAlignCenter = 0.5 |
| Center alignment factor. | |
| constexpr double | fdl::constants::kAlignEnd = 1.0 |
| Right or bottom alignment factor. | |
Identity / default values | |
| constexpr double | fdl::constants::kIdentitySqueeze = 1.0 |
| No anamorphic distortion (1:1 squeeze). | |
Banker's rounding constants | |
Used by fdl_round() for half-to-even rounding per the FDL spec. | |
| constexpr double | fdl::constants::kHalfway = 0.5 |
| Halfway value for rounding decisions. | |
| constexpr double | fdl::constants::kFpHalfwayTolerance = 1e-15 |
| FP tolerance for detecting exact halfway values. | |
| constexpr int | fdl::constants::kEvenDivisor = 2 |
| Divisor for even/odd detection (v % 2). | |
| constexpr int64_t | fdl::constants::kPositiveSign = 1 |
| Positive sign multiplier. | |
| constexpr int64_t | fdl::constants::kNegativeSign = -1 |
| Negative sign multiplier. | |
| constexpr int64_t | fdl::constants::kEvenRoundingAdjustment = 1 |
| Step for adjusting even-rounding results (v +/- 1). | |
Protection factor | |
Protection dimensions = framing_dims * (kProtectionBase - protection_fraction). | |
| constexpr double | fdl::constants::kProtectionBase = 1.0 |
| Base factor for protection calculation (100%). | |
Bit-packing shifts for handle deduplication keys | |
| constexpr unsigned | fdl::constants::kPackKey2Shift = 32 |
| Shift for packing two 32-bit indices into a 64-bit key. | |
| constexpr unsigned | fdl::constants::kPackKey3HighShift = 40 |
| High-index shift in three-value pack (bits [40..59]). | |
| constexpr unsigned | fdl::constants::kPackKey3MidShift = 20 |
| Mid-index shift in three-value pack (bits [20..39]). | |
FDL spec version defaults | |
| constexpr int | fdl::constants::kDefaultVersionMajor = 2 |
| Default FDL specification version major. | |
| constexpr int | fdl::constants::kDefaultVersionMinor = 0 |
| Default FDL specification version minor. | |
Buffer sizes | |
| constexpr size_t | fdl::constants::kErrorBufferSize = 256 |
| Size of snprintf error message buffers. | |
Geometry path return codes | |
Used by geometry_get_dims_anchor_from_path and fdl_resolve_geometry_layer. | |
| constexpr int | fdl::constants::kGeometryNotFound = 1 |
| Requested geometry layer is not present. | |
| constexpr int | fdl::constants::kGeometryInvalidPath = -1 |
| Invalid geometry path enum value. | |
Hash combination | |
| constexpr size_t | fdl::constants::kHashCombineShift = 1 |
| Bit shift for XOR-based hash combination. | |
Default framing intent aspect ratio (1:1) | |
| constexpr int64_t | fdl::constants::kDefaultAspectRatio = 1 |
| 1:1 aspect ratio for generated framing intents. | |
Custom attribute return codes and type values | |
| constexpr int | fdl::constants::kCustomAttrSuccess = 0 |
| Operation succeeded. | |
| constexpr int | fdl::constants::kCustomAttrError = -1 |
| Operation failed (type mismatch, not found, etc.). | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeNone = 0 |
| Attribute not found. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeString = 1 |
| String attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeInt = 2 |
| Integer attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeFloat = 3 |
| Floating-point attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeBool = 4 |
| Boolean attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypePointF64 = 5 |
| Point (x, y) attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeDimsF64 = 6 |
| Dimensions (width, height) float attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeDimsI64 = 7 |
| Dimensions (width, height) integer attribute. | |
| constexpr uint32_t | fdl::constants::kCustomAttrTypeOther = 8 |
| Unsupported JSON type. | |
Floating-point comparison tolerances | |
Match Python math.isclose() defaults used for FDL value comparisons. | |
| constexpr double | fdl::constants::kRelTol = 1e-9 |
| Relative tolerance for fp comparison. | |
| constexpr double | fdl::constants::kAbsTol = 1e-6 |
| Absolute tolerance for fp comparison. | |
Thread-local cache limits | |
| constexpr size_t | fdl::constants::kTlCacheMaxEntries = 256 |
| Max entries before a thread-local string cache auto-clears. | |
First-class custom attribute name constants | |
Well-known attribute names set by template application. | |
| constexpr const char * | fdl::constants::kAttrScaleFactor = "scale_factor" |
| Template scale factor (float). | |
| constexpr const char * | fdl::constants::kAttrContentTranslation = "content_translation" |
| Template content translation (point_f64). | |
| constexpr const char * | fdl::constants::kAttrScaledBoundingBox = "scaled_bounding_box" |
| Template scaled bounding box (dims_f64). | |
Named constants replacing magic numbers throughout the FDL core library.
Every numeric literal in the codebase (except 0 and 0.0) must be a named constant defined here or in the public header (fdl_core.h). This ensures readability-magic-numbers and cppcoreguidelines-avoid-magic-numbers pass with no whitelist.