Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
sdl_helpers.h File Reference

Low-level helpers for SDL. Helpers are in an additional sdl namespace. More...

#include "SDL/sdl_fwd.h"
#include "Math/math_fwd.h"
#include "Utility/traits.h"
#include "Utility/TSpan.h"
#include "SDL/ESdlTypeCategory.h"
#include "SDL/ESdlDataType.h"
#include <Common/primitive_type.h>
#include <cstddef>
#include <string>
#include <string_view>
#include <vector>
#include <utility>
#include <concepts>
#include "SDL/sdl_helpers.ipp"

Go to the source code of this file.

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::sdl
 

Functions

real ph::sdl::load_real (std::string_view sdlRealStr)
 
integer ph::sdl::load_integer (std::string_view sdlIntegerStr)
 
template<typename FloatType >
FloatType ph::sdl::load_float (std::string_view sdlFloatStr)
 Returns a floating-point number by processing its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename IntType >
IntType ph::sdl::load_int (std::string_view sdlIntStr)
 Returns a integer number by processing its SDL representation. Supports ph::integer and all signed and unsigned standard integer types.
 
template<typename NumberType >
NumberType ph::sdl::load_number (std::string_view sdlNumberStr)
 Returns a number by processing its SDL representation. Accepts all types supported by load_float() and load_int().
 
template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void ph::sdl::load_numbers (std::string_view sdlNumbersStr, TSpan< NumberType, EXTENT > out_numbers)
 
template<typename Element >
math::TVector2< Element > ph::sdl::load_vector2 (std::string_view sdlVec2Str)
 
template<typename Element >
math::TVector3< Element > ph::sdl::load_vector3 (std::string_view sdlVec3Str)
 
template<typename Element >
math::TVector4< Element > ph::sdl::load_vector4 (std::string_view sdlVec4Str)
 
template<typename Element >
math::TQuaternion< Element > ph::sdl::load_quaternion (std::string_view sdlQuatStr)
 
template<typename NumberType >
std::vector< NumberType > ph::sdl::load_number_array (std::string_view sdlNumberArrayStr)
 
template<typename Element >
std::vector< math::TVector3< Element > > ph::sdl::load_vector3_array (std::string_view sdlVec3ArrayStr)
 
void ph::sdl::save_real (real value, std::string &out_str)
 
void ph::sdl::save_integer (integer value, std::string &out_str)
 
template<typename FloatType >
void ph::sdl::save_float (FloatType value, std::string &out_str)
 Converts a floating-point number to its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename IntType >
void ph::sdl::save_int (IntType value, std::string &out_str)
 Converts a integer number to its SDL representation. Supports ph::real, float, double, and long double.
 
template<typename NumberType >
void ph::sdl::save_number (NumberType value, std::string &out_str)
 Converts a number to its SDL representation. Accepts all types supported by save_float() and save_int().
 
template<typename NumberType , std::size_t EXTENT = std::dynamic_extent>
void ph::sdl::save_numbers (TSpanView< NumberType, EXTENT > numbers, std::string &out_str)
 
template<typename Element >
void ph::sdl::save_vector2 (const math::TVector2< Element > &value, std::string &out_str)
 
template<typename Element >
void ph::sdl::save_vector3 (const math::TVector3< Element > &value, std::string &out_str)
 
template<typename Element >
void ph::sdl::save_vector4 (const math::TVector4< Element > &value, std::string &out_str)
 
template<typename Element >
void ph::sdl::save_quaternion (const math::TQuaternion< Element > &value, std::string &out_str)
 
template<typename NumberType >
void ph::sdl::save_number_array (TSpanView< NumberType > values, std::string &out_str)
 
template<typename Element >
void ph::sdl::save_vector3_array (TSpanView< math::TVector3< Element > > values, std::string &out_str)
 
void ph::sdl::save_field_id (const SdlField *sdlField, SdlOutputClause &clause)
 Save the identity of the field to output clause.
 
auto ph::sdl::get_all_callable_functions (const SdlClass *callableParentClass) -> std::vector< std::pair< const SdlFunction *, const SdlClass * > >
 Get a list of callable functions from the class.
 
template<typename T >
constexpr ESdlTypeCategory ph::sdl::category_of ()
 Statically gets the SDL category of T.
 
template<std::integral IntType>
constexpr ESdlDataType ph::sdl::int_type_of ()
 
template<std::floating_point FloatType>
constexpr ESdlDataType ph::sdl::float_type_of ()
 
template<CNumber NumberType>
constexpr ESdlDataType ph::sdl::number_type_of ()
 
template<typename T >
constexpr ESdlDataType ph::sdl::resource_type_of ()
 
template<typename DstType , typename SrcType >
DstType * ph::sdl::cast_to (SrcType *srcResource)
 Cast between SDL resource types. Cast the input SDL resource instance of SrcType to an instance of DstType. Each of the input types can possibly be const qualified. This is a stricter cast than standard dynamic_cast as both input and output pointer must not be null, and it will throw if the cast cannot be done.
 
std::string ph::sdl::gen_pretty_name (const SdlClass *clazz)
 Generate a human-readable name for the SDL types. These helpers allow input types to be null.
 
std::string ph::sdl::gen_pretty_name (const SdlStruct *const ztruct)
 
std::string ph::sdl::gen_pretty_name (const SdlField *const field)
 
std::string ph::sdl::gen_pretty_name (const SdlFunction *const func)
 
std::string ph::sdl::gen_pretty_name (const SdlClass *const clazz, const SdlField *const field)
 
std::string ph::sdl::name_to_title_case (std::string_view sdlName)
 Make a standard SDL name to canonical capitalized form. Make the SDL name capitalized and separated by spaces. Example: "some-sdl-name" will be "Some Sdl Name".
 
std::string ph::sdl::name_to_camel_case (std::string_view sdlName, bool capitalizedFront=false)
 Make a standard SDL name to camel case. Example: "some-sdl-name" will be "someSdlName" (if capitalizedFront is false).
 
std::string ph::sdl::name_to_snake_case (std::string_view sdlName)
 Make a standard SDL name to snake case. Example: "some-sdl-name" will be "some_sdl_name".
 

Detailed Description

Low-level helpers for SDL. Helpers are in an additional sdl namespace.