MayaFlux
1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
BoundsText.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
MayaFlux/Kinesis/Spatial/Bounds.hpp
"
4
#include "
MayaFlux/Transitive/Reflect/TextCodec.hpp
"
5
6
namespace
MayaFlux::Reflect
{
7
8
/**
9
* @brief A Kinesis::AABB2D as four finite numbers in the struct's own member order.
10
*
11
* Reads min.x min.y max.x max.y, so the text is the aggregate
12
* AABB2D { .min = { x0, y0 }, .max = { x1, y1 } } written flat. An origin and size
13
* is a different spelling and has its own named constructor, AABB2D::from_origin_size.
14
*/
15
template
<>
16
struct
TextCodec
<
Kinesis
::AABB2D> {
17
static
constexpr
size_t
extent
= 4;
18
19
static
bool
decode
(std::string_view source,
Kinesis::AABB2D
& value,
TextError
& error)
20
{
21
const
auto
decoded =
parse_tuple<float, 4>
(source, error);
22
if
(!decoded)
23
return
false
;
24
value.
min
= { (*decoded)[0], (*decoded)[1] };
25
value.
max
= { (*decoded)[2], (*decoded)[3] };
26
return
true
;
27
}
28
};
29
30
}
Bounds.hpp
TextCodec.hpp
MayaFlux::Kinesis
Definition
API/Random.hpp:5
MayaFlux::Reflect::parse_tuple
std::optional< std::array< T, N > > parse_tuple(std::string_view source, TextError &error)
Parse exactly N whitespace separated finite numbers.
Definition
TextCodec.hpp:55
MayaFlux::Reflect::TextError
TextError
Definition
TextCodec.hpp:9
MayaFlux::Reflect
Definition
Engine.describe.hpp:7
MayaFlux::Kinesis::AABB2D::min
glm::vec2 min
Definition
Bounds.hpp:64
MayaFlux::Kinesis::AABB2D::max
glm::vec2 max
Definition
Bounds.hpp:65
MayaFlux::Kinesis::AABB2D
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition
Bounds.hpp:63
MayaFlux::Reflect::TextCodec< Kinesis::AABB2D >::decode
static bool decode(std::string_view source, Kinesis::AABB2D &value, TextError &error)
Definition
BoundsText.hpp:19
MayaFlux::Reflect::TextCodec< Kinesis::AABB2D >::extent
static constexpr size_t extent
Definition
BoundsText.hpp:17
MayaFlux::Reflect::TextCodec
Conversion of authored text to one value type.
Definition
TextCodec.hpp:81
src
MayaFlux
Portal
Forma
Manifest
BoundsText.hpp
Generated by
1.15.0