TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Utilities

Base types, results, hashing, JSON and number parsing. More...

Namespaces

namespace  tachyon::Hash

Classes

struct  tachyon::int2
 Integer 2D vector. More...
struct  tachyon::int3
struct  tachyon::int4
struct  tachyon::uint2
struct  tachyon::uint3
struct  tachyon::uint4
struct  tachyon::float2
struct  tachyon::float3
struct  tachyon::float4
struct  tachyon::float2x2
struct  tachyon::float3x2
 2D affine transform matrix (2 rows x 3 columns): x' = r0.x*x + r0.y*y + r0.z y' = r1.x*x + r1.y*y + r1.z More...
struct  tachyon::float4x4
struct  tachyon::byte2
struct  tachyon::byte3
struct  tachyon::byte4
struct  tachyon::short2
struct  tachyon::short3
struct  tachyon::short4
struct  tachyon::ushort2
struct  tachyon::ushort3
struct  tachyon::ushort4
struct  tachyon::color4b
struct  tachyon::color4f
struct  tachyon::IntRect
union  tachyon::IntRect::[union].__unnamed0__
struct  tachyon::IntRect::[struct].__unnamed0__.__unnamed0__
struct  tachyon::IntRect::[struct].__unnamed0__.__unnamed1__
struct  tachyon::Error
 A failure: its category and a human-readable message. More...
class  tachyon::Result< void >
 Success, or the Error saying why not. More...
class  tachyon::JsonValue
 A JSON value (RFC 8259): null, bool, number, string, array or object. More...
class  tachyon::Result< T >
 A value, or the Error saying why there is none. More...

Typedefs

using tachyon::OnGuiFunc = std::function<void()>
using tachyon::byte = unsigned char
using tachyon::ushort = unsigned short

Enumerations

enum class  tachyon::ErrorCode : uint8_t {
  tachyon::ErrorCode::Failed , tachyon::ErrorCode::InvalidArgument , tachyon::ErrorCode::NotFound , tachyon::ErrorCode::ParseFailed ,
  tachyon::ErrorCode::Unsupported , tachyon::ErrorCode::OutOfMemory , tachyon::ErrorCode::DeviceLost
}
 Why a call failed. More...

Functions

uint16_t tachyon::FloatToHalf (float value)
float tachyon::HalfToFloat (uint16_t value)
int64_t tachyon::SteadyClockNowNanos ()
 Monotonic steady_clock time in nanoseconds; a plain int64_t keeps <chrono> out of widely-included headers.
template<typename T>
std::from_chars_result tachyon::FromCharsStream (const char *first, const char *last, T &value)
 std::from_chars for a decimal number, through a classic-locale stream.
template<typename T>
std::from_chars_result tachyon::FromChars (const char *first, const char *last, T &value)
 std::from_chars, falling back to FromCharsStream on standard libraries without the floating-point overloads (libc++ before LLVM 20, Apple's included).
 tachyon::JsonValue::JsonValue ()=default
 Default is null.
 tachyon::JsonValue::JsonValue (std::nullptr_t)
 tachyon::JsonValue::JsonValue (bool value)
 tachyon::JsonValue::JsonValue (int value)
 tachyon::JsonValue::JsonValue (double value)
 tachyon::JsonValue::JsonValue (std::string value)
 tachyon::JsonValue::JsonValue (std::string_view value)
 tachyon::JsonValue::JsonValue (const char *value)
 tachyon::JsonValue::JsonValue (Array value)
 tachyon::JsonValue::JsonValue (Object value)
std::span< const std::byte > tachyon::FindBuiltInResource (std::string_view path)
 The copy of a resource compiled into the library: the default themes (dark.css, light.css, styles.css) and fonts (Inter, JetBrains Mono), unless the library was built with TACHYON_EMBED_RESOURCES off.
Result< std::string > tachyon::ReadResource (std::string_view path)
 A resource's contents: the file at path when it exists, else its built-in copy (which is logged, so a theme file that went missing shows up).
 tachyon::Result< T >::Result (T value)
 Implicit from a value or an Error, so functions can return either.
 tachyon::Result< T >::Result (Error error)

Detailed Description

Base types, results, hashing, JSON and number parsing.

Typedef Documentation

◆ OnGuiFunc

using tachyon::OnGuiFunc = std::function<void()>

◆ byte

using tachyon::byte = unsigned char

◆ ushort

using tachyon::ushort = unsigned short

Enumeration Type Documentation

◆ ErrorCode

enum class tachyon::ErrorCode : uint8_t
strong

#include <gui_core/gui_result.h>

Why a call failed.

Enumerator
Failed 

anything else; see the message

InvalidArgument 
NotFound 

a file, a device, an element

ParseFailed 

a theme, a layout

Unsupported 

the device or backend lacks a feature

OutOfMemory 
DeviceLost 

the GPU device was lost (the library recreates it)

Function Documentation

◆ FloatToHalf()

uint16_t tachyon::FloatToHalf ( float value)

◆ HalfToFloat()

float tachyon::HalfToFloat ( uint16_t value)

◆ SteadyClockNowNanos()

int64_t tachyon::SteadyClockNowNanos ( )

#include <gui_core/gui_base_types.h>

Monotonic steady_clock time in nanoseconds; a plain int64_t keeps <chrono> out of widely-included headers.

◆ FromCharsStream()

template<typename T>
std::from_chars_result tachyon::FromCharsStream ( const char * first,
const char * last,
T & value )

#include <gui_core/gui_from_chars.h>

std::from_chars for a decimal number, through a classic-locale stream.

For standard libraries without floating-point from_chars. The number is scanned first, as from_chars does ([-]digits[.digits][e[+-]digits], no '+' or whitespace before it): libc++'s stream would also take the letters of a hex float, so "0.25px" fails there.

◆ FromChars()

template<typename T>
std::from_chars_result tachyon::FromChars ( const char * first,
const char * last,
T & value )

#include <gui_core/gui_from_chars.h>

std::from_chars, falling back to FromCharsStream on standard libraries without the floating-point overloads (libc++ before LLVM 20, Apple's included).

◆ JsonValue() [1/10]

tachyon::JsonValue::JsonValue ( )
default

#include <gui_core/gui_json.h>

Default is null.

Converts from the matching C++ types; all numbers are stored as double.

◆ JsonValue() [2/10]

tachyon::JsonValue::JsonValue ( std::nullptr_t )
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [3/10]

tachyon::JsonValue::JsonValue ( bool value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [4/10]

tachyon::JsonValue::JsonValue ( int value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [5/10]

tachyon::JsonValue::JsonValue ( double value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [6/10]

tachyon::JsonValue::JsonValue ( std::string value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [7/10]

tachyon::JsonValue::JsonValue ( std::string_view value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [8/10]

tachyon::JsonValue::JsonValue ( const char * value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [9/10]

tachyon::JsonValue::JsonValue ( Array value)
inline

#include <gui_core/gui_json.h>

◆ JsonValue() [10/10]

tachyon::JsonValue::JsonValue ( Object value)
inline

#include <gui_core/gui_json.h>

◆ FindBuiltInResource()

std::span< const std::byte > tachyon::FindBuiltInResource ( std::string_view path)

#include <gui_core/gui_resources.h>

The copy of a resource compiled into the library: the default themes (dark.css, light.css, styles.css) and fonts (Inter, JetBrains Mono), unless the library was built with TACHYON_EMBED_RESOURCES off.

Found by the end of the path, so "themes/styles.css" and "C:/app/resources/themes/styles.css" both find it. Empty when there is none.

◆ ReadResource()

Result< std::string > tachyon::ReadResource ( std::string_view path)

#include <gui_core/gui_resources.h>

A resource's contents: the file at path when it exists, else its built-in copy (which is logged, so a theme file that went missing shows up).

The library reads its themes this way, so an app needs no resource files, and a file of the same name under the resource root replaces the built-in one.

◆ Result() [1/2]

template<class T>
tachyon::Result< T >::Result ( T value)
inline

#include <gui_core/gui_result.h>

Implicit from a value or an Error, so functions can return either.

◆ Result() [2/2]

template<class T>
tachyon::Result< T >::Result ( Error error)
inline