Nui
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Functions
val_conversion.hpp File Reference
#include <nui/concepts.hpp>
#include <nui/frontend/event_system/observed_value.hpp>
#include <boost/describe.hpp>
#include <boost/mp11/algorithm.hpp>
#include <nui/frontend/val.hpp>
#include <optional>
#include <vector>
#include <filesystem>
#include <utility>
#include <unordered_map>
#include <string_view>
#include <memory>
#include <map>
#include <variant>
Include dependency graph for val_conversion.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Nui::Detail::IsOptional< T >
 
struct  Nui::Detail::IsOptional< std::optional< T > >
 

Namespaces

namespace  Nui
 
namespace  Nui::Detail
 

Concepts

concept  Nui::Detail::HasToVal
 Concept detecting if a to_val function is provided for a type.
 
concept  Nui::Detail::HasFromVal
 Concept detecting if a from_val function is provided for a type.
 

Functions

template<typename T , class Bases = boost::describe::describe_bases<T, boost::describe::mod_any_access>, class Members = boost::describe::describe_members<T, boost::describe::mod_any_access>, class Enable = std::enable_if_t<!std::is_union_v<T>>>
Nui::val Nui::convertToVal (T const &obj)
 Converts a boost described class/struct to a Nui::val object.
 
template<typename T >
Nui::val Nui::convertToVal (std::optional< T > const &option)
 Converts an optional<T> to a Nui::val.
 
template<typename T >
requires Fundamental<T>
Nui::val Nui::convertToVal (T const &value)
 Converts fundamental types to Nui::val.
 
Nui::val Nui::convertToVal (std::string const &value)
 Converts string to Nui::val.
 
Nui::val Nui::convertToVal (std::filesystem::path const &value)
 Converts a filesystem path to Nui::val.
 
Nui::val Nui::convertToVal (Nui::val value)
 Copy for val.
 
Nui::val Nui::convertToVal (char const *value)
 Converts a C-style string to Nui::val.
 
Nui::val Nui::convertToVal (std::string_view value)
 Converts a string_view to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (std::vector< T > const &vector)
 Converts a vector to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (Observed< T > const &observed)
 Converts an Observed<T> to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (std::unordered_map< std::string, T > const &map)
 Converts an unordered_map to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (std::map< std::string, T > const &map)
 Converts a map to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (std::unique_ptr< T > const &ptr)
 Converts a unique pointer to Nui::val.
 
template<typename T >
Nui::val Nui::convertToVal (std::shared_ptr< T > const &ptr)
 Converts a shared pointer to Nui::val.
 
template<typename T >
requires Detail::HasToVal<T>
Nui::val Nui::convertToVal (T const &value)
 Converts anything that a "to_val" function is provided for found by ADL.
 
Nui::val Nui::convertToVal (long long)
 
Nui::val Nui::convertToVal (unsigned long long)
 
Nui::val Nui::convertToVal (std::monostate)
 Converts a monostate to Nui::val (interpreted as undefined)
 
template<typename... Ts>
Nui::val Nui::convertToVal (std::variant< Ts... > const &variant)
 Converts a variant to Nui::val by converting the currently held type.
 
template<typename T , class Members >
requires (!std::is_union_v<T>)
void Nui::Detail::convertFromValObjImpl (Nui::val const &val, T &obj)
 
template<typename T , class Bases , class Members >
requires (!std::is_union_v<T>)
void Nui::convertFromVal (Nui::val const &val, T &obj)
 Converts a Nui::val to a class/struct object.
 
template<typename T , class Members >
requires (!std::is_union_v<T> && !boost::describe::has_describe_bases<T>::value)
void Nui::convertFromVal (Nui::val const &val, T &obj)
 Converts a Nui::val to a class/struct object.
 
template<typename T >
requires Fundamental<T>
void Nui::convertFromVal (Nui::val const &val, T &value)
 Converts a Nui::val to a fundamental type.
 
void Nui::convertFromVal (Nui::val const &val, std::string &str)
 Converts a Nui::val to a std::string.
 
template<typename T >
void Nui::convertFromVal (Nui::val const &val, std::optional< T > &option)
 Converts a Nui::val to a std::optional.
 
void Nui::convertFromVal (Nui::val const &val, std::filesystem::path &value)
 Converts a Nui::val to a std::filesystem::path.
 
void Nui::convertFromVal (Nui::val const &val, Nui::val &value)
 Converts a Nui::val to a Nui::val (copy).
 
template<typename T >
void Nui::convertFromVal (Nui::val const &val, std::vector< T > &vector)
 Converts a Nui::val to a std::vector.
 
template<typename T >
requires Fundamental<T>
void Nui::convertFromVal (Nui::val const &val, std::vector< T > &vector)
 Converts a Nui::val to a std::vector of fundamentals.
 
template<typename T >
void Nui::convertFromVal (Nui::val const &val, Observed< T > &observed)
 Converts a Nui::val to an Observed<T>.
 
template<typename T >
void Nui::convertFromVal (Nui::val const &val, std::unordered_map< std::string, T > &map)
 Converts a Nui::val to a std::unordered_map.
 
template<typename T >
requires Detail::HasFromVal<T>
void Nui::convertFromVal (Nui::val const &val, T &value)
 Converts a Nui::val to a type that has a "from_val" function provided found by ADL.
 
void Nui::convertFromVal (Nui::val const &, long long)
 
void Nui::convertFromVal (Nui::val const &val, unsigned long long &value)
 
template<typename T , class Bases = boost::describe::describe_bases<T, boost::describe::mod_any_access>, class Members = boost::describe::describe_members<T, boost::describe::mod_any_access>>
requires (!std::is_union_v<T> && boost::describe::has_describe_bases<T>::value)
void Nui::convertFromVal (Nui::val const &val, T &obj)
 Converts a Nui::val to a class/struct object.