ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::Value Struct Reference

8-byte tagged length expression: More...

#include <Unit.hpp>

Classes

struct  Term

Public Member Functions

 Value (float pixels) noexcept
 Value (float amount, Unit u) noexcept
 Value (const Value &o) noexcept
 Value (Value &&o) noexcept
Value & operator= (const Value &o) noexcept
Value & operator= (Value &&o) noexcept
bool isAuto () const noexcept
bool isComplex () const noexcept
bool isSimple () const noexcept
bool isNumber () const noexcept
float asNumber () const noexcept
float scalar () const noexcept
Unit unit () const noexcept
ValueOp getOp () const noexcept
const std::vector< Value > * astArgs () const noexcept
size_t termCount () const noexcept
Term termAt (size_t idx) const noexcept
float resolveH (float parentW, float parentH, Vec2 viewport, float autoValue=0.0f) const
float resolveV (float parentW, float parentH, Vec2 viewport, float autoValue=0.0f) const
float resolveSelfH (float selfW, float selfH, Vec2 viewport) const
float resolveSelfV (float selfW, float selfH, Vec2 viewport) const
Value operator+ (const Value &o) const
Value operator- (const Value &o) const
Value operator- () const
Value operator* (float k) const
Value operator/ (float k) const
Value mulWith (const Value &o) const
Value divWith (const Value &o) const
bool operator== (const Value &o) const noexcept
bool operator!= (const Value &o) const noexcept
void normalize ()

Static Public Member Functions

static Value autoSize () noexcept
static Value number (float n) noexcept
static Value px (float p) noexcept
static Value percent (float p) noexcept
static Value vw (float p) noexcept
static Value vh (float p) noexcept
static Value pw (float p) noexcept
static Value ph (float p) noexcept
static Value makeOp (ValueOp op, std::vector< Value > args)
static Value fromLinearTerms (const Term *data, size_t count)

Detailed Description

8-byte tagged length expression:

  • bits_ == 1: CSS auto
  • (bits_ & 1) == 1: inline single term (float in high 32 bits, Unit in bits 1..7)
  • (bits_ & 1) == 0: non-null pointer to ref-counted ComplexData (linear sums / AST)
Examples
00_demo/main.cpp, and 11_animations/main.cpp.

The documentation for this struct was generated from the following file: