47class RelativeExpression {
53 const std::map<std::string, Rect>& named = {})
const;
60 static float evaluate(
const std::string& source,
62 const std::map<std::string, Rect>& named = {});
67 static RelativeExpression
parse(
const std::string& source);
74 explicit RelativeExpression(std::shared_ptr<Node> root) : root_(
std::move(root)) {}
75 std::shared_ptr<Node> root_;
82 static RelativePoint
parse(
const std::string& source);
86 const std::map<std::string, Rect>& named = {})
const;
93 : x_(
std::move(
x)), y_(
std::move(
y)) {}
94 RelativeExpression x_;
95 RelativeExpression y_;
Definition relative_point.hpp:47
static RelativeExpression parse(const std::string &source)
Parse a single-axis expression (e.g.
float evaluate(const Rect &parent, const std::map< std::string, Rect > &named={}) const
Evaluate this expression against the given parent rectangle and optional environment of named rectang...
static float evaluate(const std::string &source, const Rect &parent, const std::map< std::string, Rect > &named={})
Convenience: parse + evaluate in one shot. Throws on parse error.
std::string to_string() const
Round-trip text form for diagnostics.
Definition relative_point.hpp:78
Point evaluate(const Rect &parent, const std::map< std::string, Rect > &named={}) const
Evaluate both axes against the given environment.
static RelativePoint parse(const std::string &source)
Parse a "x, y" expression.
const RelativeExpression & x() const noexcept
Definition relative_point.hpp:88
const RelativeExpression & y() const noexcept
Definition relative_point.hpp:89
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
Definition geometry.hpp:20
Axis-aligned rectangle in continuous (float) coordinates.
Definition geometry.hpp:52