Nui
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Nui Namespace Reference

Namespaces

 Attributes
 
 Components
 
 ContainerWrapUtility
 
 Detail
 
 detail
 
 Dom
 
 Elements
 
 FileDialog
 
 Impl
 
 MacOs
 
 Materializers
 

Classes

class  RpcHub
 
class  SelectablesRegistry
 This container associates items with an id and allows for individual items to be "selected", which removes them from the container and stores them in a separate container. More...
 
struct  EventImpl
 
struct  TwoFunctorEventImpl
 
class  Event
 
class  EventEngine
 
class  DefaultEventEngine
 
class  EventContext
 This object can be copied with low cost. More...
 
class  EventRegistry
 
struct  CustomEventContextFlag_t
 
class  ObservedBase
 
class  ModifiableObserved
 
class  ObservedContainer
 
class  Observed
 
class  Observed< std::vector< Parameters... > >
 
class  Observed< std::deque< Parameters... > >
 
class  Observed< std::basic_string< Parameters... > >
 
class  Observed< std::set< Parameters... > >
 
class  Observed< std::list< Parameters... > >
 
class  Observed< void >
 
struct  UnpackObserved
 
struct  UnpackObserved< Observed< T > >
 
struct  UnpackObserved< std::weak_ptr< Observed< T > > >
 
struct  UnpackObserved< std::shared_ptr< Observed< T > > >
 
struct  UnpackObserved< std::weak_ptr< const Observed< T > > >
 
struct  UnpackObserved< std::shared_ptr< const Observed< T > > >
 
class  ObservedValueCombinatorBase
 
class  ObservedValueCombinator
 
class  ObservedValueCombinatorWithGenerator
 
class  ObservedValueCombinatorWithPropertyGenerator
 
class  ObservedRange
 
class  UnoptimizedRange
 
class  RangeEventContext
 
class  Console
 
class  JSON
 
class  ThrottledFunction
 
class  TimerHandle
 
class  Attribute
 
struct  ChildrenRenderer
 
struct  TrivialRenderer
 
class  HtmlElement
 
struct  HtmlElementBridge
 
struct  Renderer
 
class  AsyncFile
 Do note that the use of this class is inefficient. More...
 
class  RpcClient
 
class  Delocalized
 A delocalized element can switch positions in several slots. More...
 
struct  functor_t
 
class  StableElement
 
class  Display
 
class  Screen
 
struct  FetchOptions
 
struct  FetchResponse
 
class  OnDestroy
 
struct  FixToLowerFlag
 
class  FixedString
 Utilitarian class to store and modify strings in compile time. More...
 
class  IteratorAccessor
 
class  IteratorAccessor< std::weak_ptr< ContainerT > >
 
class  IteratorAccessor< std::shared_ptr< ContainerT > >
 
class  Lazy
 
struct  ExtractValueType
 
struct  FunctionArgumentTypes
 
struct  FunctionReturnType
 
struct  IsTuple
 
struct  IsTuple< std::tuple< Ts... > >
 
class  MoveDetector
 Utility class to detect if an object was moved. More...
 
struct  overloaded
 
class  reverse_view
 
class  ScopeExit
 
struct  WindowOptions
 
class  Window
 This class encapsulates the webview. More...
 
class  GObjectReference
 
struct  HostNameMappingInfo
 

Typedefs

using Url = Roar::Url
 
template<typename T >
using UnpackObserved_t = typename UnpackObserved< T >::type
 
using ElementRenderer = std::function< std::shared_ptr< Dom::Element >(Dom::Element &, Renderer const &)>
 
using val = emscripten::val
 
template<typename T >
using ExtractValueType_t = typename ExtractValueType< T >::type
 
template<typename T >
using FunctionArgumentTypes_t = typename FunctionArgumentTypes< T >::type
 
template<typename T >
using FunctionReturnType_t = typename FunctionReturnType< T >::type
 

Enumerations

enum  RangeOperationType { Keep = 0b0001 , Modify = 0b0010 , Insert = 0b0100 , Erase = 0b1000 }
 
enum class  RendererType {
  Append , Fragment , Insert , Replace ,
  Inplace , Emplace
}
 
enum class  ResizeableEdge { Right , Bottom , Top }
 
enum class  WebViewHint : int { WEBVIEW_HINT_NONE , WEBVIEW_HINT_MIN , WEBVIEW_HINT_MAX , WEBVIEW_HINT_FIXED }
 
enum class  HostResourceAccessKind { Deny , Allow , DenyCors }
 
enum class  NuiCoreWebView2WebResourceContext {
  All , Document , Stylesheet , Image ,
  Media , Font , Script , XmlHttpRequest ,
  Fetch , TextTrack , EventSource , WebSocket ,
  Manifest , SignedExchange , Ping , CspViolationReport ,
  Other
}
 

Functions

std::filesystem::path resolvePath (std::filesystem::path const &path)
 Will replace prefixes like "~" and "%appdata%" with actual directories on linux and windows. More...
 
void getEnvironmentVariables (std::function< void(std::unordered_map< std::string, std::string > &&)> callback)
 
template<typename ValueT >
void listen (EventContext &eventContext, Observed< ValueT > const &obs, std::function< bool(ValueT const &)> onEvent)
 
template<typename ValueT >
void listen (EventContext &eventContext, Observed< ValueT > const &obs, std::function< void(ValueT const &)> onEvent)
 
template<typename ValueT , typename FunctionT >
void listen (EventContext &eventContext, Observed< ValueT > const &obs, FunctionT onEvent)
 
template<typename ValueT >
void listen (EventContext &eventContext, std::shared_ptr< Observed< ValueT >> const &obs, std::function< bool(ValueT const &)> onEvent)
 
template<typename ValueT >
void listen (EventContext &eventContext, std::shared_ptr< Observed< ValueT >> const &obs, std::function< void(ValueT const &)> onEvent)
 
template<typename ValueT , typename FunctionT >
void listen (EventContext &eventContext, std::shared_ptr< Observed< ValueT >> const &obs, FunctionT onEvent)
 
template<typename ValueT , typename FunctionT >
void listen (std::shared_ptr< Observed< ValueT >> const &obs, FunctionT onEvent)
 
template<typename ValueT , typename FunctionT >
void listen (Observed< ValueT > const &obs, FunctionT onEvent)
 
template<typename T >
requires Incrementable< T > ModifiableObserved< T > & operator++ (ModifiableObserved< T > &observedValue)
 
template<typename T >
requires Incrementable< T > T operator++ (ModifiableObserved< T > &observedValue, int)
 
template<typename T >
auto operator-- (ModifiableObserved< T > &observedValue) -> ModifiableObserved< Detail::PickFirst_t< T, decltype(--std::declval< T >())>> &
 
template<typename T >
auto operator-- (ModifiableObserved< T > &observedValue, int) -> Detail::PickFirst_t< T, decltype(std::declval< T >() --)>
 
template<typename... ObservedValues>
 ObservedValueCombinator (ObservedValues &&...) -> ObservedValueCombinator< std::decay_t< Detail::ObservedAddReference_t< ObservedValues >>... >
 
template<typename... ObservedValues>
 ObservedValueCombinator (std::tuple< Detail::ObservedAddReference_t< ObservedValues >... >) -> ObservedValueCombinator< std::decay_t< Detail::ObservedAddReference_t< ObservedValues >>... >
 
template<typename... ObservedValues>
 requires (IsObservedLike< ObservedValues > &&...) ObservedValueCombinator< std
 
template<typename ObservedValue >
 requires (IsObserved< ObservedValue >) ObservedRange< ObservedValue > range(ObservedValue &observedValues)
 
template<typename ContainerT , typename... Observed>
UnoptimizedRange< IteratorAccessor< ContainerT const >, std::decay_t< Detail::ObservedAddReference_t< Observed > >... > range (ContainerT const &container, Observed &&... observed)
 
template<typename ContainerT , typename... Observed>
UnoptimizedRange< IteratorAccessor< ContainerT >, std::decay_t< Detail::ObservedAddReference_t< Observed > >... > range (ContainerT &container, Observed &&... observed)
 
template<typename ContainerT >
UnoptimizedRange< IteratorAccessor< ContainerT > > range (ContainerT &container)
 
template<typename ContainerT >
UnoptimizedRange< IteratorAccessor< ContainerT const > > range (ContainerT const &container)
 
void fetch (std::string const &uri, FetchOptions const &options, std::function< void(std::optional< FetchResponse > const &)> callback)
 Simplified fetch, that uses curl in the backend to fetch data. More...
 
void fetch (std::string const &uri, std::function< void(std::optional< FetchResponse > const &)> callback)
 
void throttle (int milliseconds, std::function< void()> toWrap, std::function< void(ThrottledFunction &&)> callback, bool callWhenReady=false)
 Creates a function that can be used to call a function at most once during the specified interval. More...
 
void setInterval (int milliseconds, std::function< void()> toWrap, std::function< void(TimerHandle &&)> callback)
 Creates a new timer that calls "toWrap" every "milliseconds" milliseconds. More...
 
void setTimeout (int milliseconds, std::function< void()> toWrap, std::function< void(TimerHandle)> callback)
 Creates a new delayed function that calls "toWrap" after "milliseconds" milliseconds. More...
 
Attribute && operator! (Attribute &&attribute)
 
auto renderElement (Renderer const &gen, auto &element, auto const &htmlElement)
 
static auto nil ()
 
void makeResizeable (Nui::val const &element, ResizeableEdge edge=ResizeableEdge::Right)
 
void openFile (char const *filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 
void openFile (std::string const &filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 
void openFile (std::filesystem::path const &filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 
template<typename U >
 requires (IsObserved< std::decay_t< U >>) Detail
 
template<typename U >
 requires (IsWeakObserved< std::decay_t< U >>) Detail
 
template<typename U >
 requires (IsSharedObserved< std::decay_t< U >>) Detail
 
template<typename U >
 requires (std::invocable< U, Nui::val >) Detail
 
template<typename U >
 requires (std::invocable< U >) Detail
 
template<typename U >
 requires (!IsObservedLike< std::decay_t< U >> &&!std::invocable< U > &&!std::invocable< U, Nui::val >) Detail
 
template<typename RendererType , typename... ObservedValues>
ObservedValueCombinatorWithPropertyGenerator< RendererType, ObservedValues... > property (ObservedValueCombinatorWithGenerator< RendererType, ObservedValues... > combinator)
 
template<typename SlotId >
ElementRenderer delocalizedSlot (SlotId slot, Delocalized< SlotId > &delocalizedElement, std::vector< Attribute > wrapperAttributes={}, ElementRenderer alternative=Elements::div{Attributes::style="display: none"}())
 
ElementRenderer delocalizedSlot (char const *slot, Delocalized< std::string > &delocalizedElement, std::vector< Attribute > wrapperAttributes={}, ElementRenderer alternative=Elements::div{Attributes::style="display: none"}())
 
void listenToFragmentChanges (Observed< std::string > &fragment)
 Listens to fragment changes and changes the attached observed. More...
 
template<class F , class... Args>
emscripten::val bind (F &&f, Args &&... args)
 Equivalent of std::bind returning a javascript functor. More...
 
 JS_BIND_FUNCTION_TYPES ()
 
ElementRenderer stabilize (StableElement &stableElement, ElementRenderer const &encapsulatedRenderer)
 Stabilizes an element, so that it is not re-rendered on every render. More...
 
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<T>::value>>
void convertToVal (Nui::val &val, T const &obj)
 
template<typename T >
Nui::val convertToVal (std::optional< T > const &option)
 
template<typename T >
requires Fundamental< T > Nui::val convertToVal (T const &value)
 
Nui::val convertToVal (std::string const &value)
 
Nui::val convertToVal (std::filesystem::path const &value)
 
Nui::val convertToVal (Nui::val value)
 
Nui::val convertToVal (char const *value)
 
template<typename T >
Nui::val convertToVal (std::vector< T > const &vector)
 
template<typename T >
Nui::val convertToVal (Observed< T > const &observed)
 
template<typename T >
Nui::val convertToVal (std::unordered_map< std::string, T > const &map)
 
template<typename T >
Nui::val convertToVal (std::map< std::string, T > const &map)
 
template<typename T >
Nui::val convertToVal (std::unique_ptr< T > const &map)
 
template<typename T >
Nui::val convertToVal (std::shared_ptr< T > const &map)
 
Nui::val convertToVal (long long)
 
Nui::val convertToVal (std::monostate)
 
template<typename... Ts>
Nui::val convertToVal (std::variant< Ts... > const &variant)
 
template<typename T >
requires(!std::is_union_v< T >) void convertFromValObjImpl(Nui requires(!std::is_union_v< T >) void convertFromVal(Nui requires(!std::is_union_v< T > &&!boost::describe::has_describe_bases< T >::value) void convertFromVal(Nui requires Fundamental< T > void convertFromVal (Nui::val const &val, T &value)
 
void convertFromVal (Nui::val const &val, std::string &str)
 
template<typename T >
void convertFromVal (Nui::val const &val, std::optional< T > &option)
 
void convertFromVal (Nui::val const &val, std::filesystem::path &value)
 
void convertFromVal (Nui::val const &val, Nui::val &value)
 
template<typename T >
void convertFromVal (Nui::val const &val, std::vector< T > &vector)
 
template<typename T >
requires Fundamental< T > void convertFromVal (Nui::val const &val, std::vector< T > &vector)
 
template<typename T >
void convertFromVal (Nui::val const &val, Observed< T > &observed)
 
template<typename T >
void convertFromVal (Nui::val const &val, std::unordered_map< std::string, T > &map)
 
void convertFromVal (Nui::val const &, long long)
 
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<T>::value>>
Nui::val convertToVal (T const &obj)
 
template<typename T , 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 convertFromVal(Nui
 
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 convertFromVal(Nui
 
template<typename T , class Members = boost::describe::describe_members<T, boost::describe::mod_any_access>>
 requires (!std::is_union_v< T >) void convertFromValObjImpl(Nui
 
template<typename T >
requires Fundamental< T > void convertFromVal (Nui::val const &val, T &value)
 
 BOOST_DESCRIBE_STRUCT (FetchOptions,(),(method, headers, body, verbose, followRedirects, maxRedirects, autoReferer, dontDecodeBody, verifyPeer, verifyHost))
 
 BOOST_DESCRIBE_STRUCT (FetchResponse,(),(curlCode, status, proxyStatus, downloadSize, redirectUrl, body, headers))
 
void assertImpl (bool condition, const char *message)
 
template<unsigned N>
 FixedString (char const (&)[N]) -> FixedString< N - 1 >
 
template<unsigned... Length>
constexpr auto fixConcat (const char(&... strings)[Length])
 Allows for compile-time string concatenation. More...
 
template<unsigned N>
constexpr auto fixToLower (FixedString< N > base)
 
template<unsigned N>
constexpr auto fixToLower (char const (&str)[N])
 
template<typename ContainerT >
 IteratorAccessor (ContainerT const &) -> IteratorAccessor< const ContainerT >
 
template<typename ContainerT >
 IteratorAccessor (ContainerT &) -> IteratorAccessor< ContainerT >
 
template<typename... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
template<typename T >
 ScopeExit (T) -> ScopeExit< T >
 
template<typename FuncT , typename... Types>
void tupleForEach (std::tuple< Types... > &t, FuncT &&func)
 
template<typename FuncT , typename... Types>
void tupleForEach (std::tuple< Types... > const &t, FuncT &&func)
 
template<typename... VariantTypes, typename... VisitFunctionTypes>
auto visitOverloaded (std::variant< VariantTypes... > const &variant, VisitFunctionTypes &&... visitFunctions)
 
template<typename... VariantTypes, typename... VisitFunctionTypes>
auto visitOverloaded (std::variant< VariantTypes... > &&variant, VisitFunctionTypes &&... visitFunctions)
 
std::wstring widenString (std::string const &str)
 
std::string shortenString (std::wstring const &str)
 
Microsoft::WRL::ComPtr< ICoreWebView2EnvironmentOptions > webView2EnvironmentOptionsFromOptions (WindowOptions const &options)
 
std::unordered_map< std::string, std::string > getEnvironmentVariables ()
 
template<typename T >
void swap (GObjectReference< T > &lhs, GObjectReference< T > &rhs)
 
template<typename T , typename U >
bool operator== (GObjectReference< T > const &lhs, GObjectReference< U > const &rhs)
 
template<typename T , typename U >
bool operator== (GObjectReference< T > const &lhs, T *rhs)
 
template<typename T , typename U >
bool operator== (T *lhs, GObjectReference< U > const &rhs)
 
template<typename T , typename U >
bool operator!= (GObjectReference< T > const &lhs, GObjectReference< U > const &rhs)
 
template<typename T , typename U >
bool operator!= (GObjectReference< T > const &lhs, T *rhs)
 
template<typename T , typename U >
bool operator!= (T *lhs, GObjectReference< U > const &rhs)
 
template<typename T , typename U >
GObjectReference< T > static_pointer_cast (GObjectReference< U > const &ptr)
 
template<typename T , typename U >
GObjectReference< T > dynamic_pointer_cast (GObjectReference< U > const &ptr)
 
void registerEnvironmentVariables (Nui::RpcHub const &hub)
 
 NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (FetchOptions, method, headers, body, verbose, followRedirects, maxRedirects, autoReferer, dontDecodeBody, verifyPeer, verifyHost)
 
 NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (FetchResponse, curlCode, status, proxyStatus, downloadSize, redirectUrl, body, headers) void registerFetch(Nui
 
void registerFetch (Nui::RpcHub const &hub)
 
void registerFile (Nui::RpcHub &hub)
 
void registerScreen (Nui::RpcHub const &hub)
 
void registerThrottle (Nui::RpcHub &hub)
 
void registerTimer (Nui::RpcHub &hub)
 
CustomSchemeResponse folderMappingResponseFromRequest (CustomSchemeRequest const &req, HostNameMappingInfo const &hostNameMappingInfo)
 

Variables

template<typename T >
concept Numerical = std::integral<T> || std::floating_point<T>
 
template<typename T >
concept Fundamental = Numerical<T> || std::same_as<T, bool>
 
template<typename T >
concept Incrementable
 
template<typename T >
concept Decrementable
 
template<typename T , typename U >
concept PlusAssignable = requires(T t, U u) { t += u; }
 
template<typename T , typename U >
concept MinusAssignable = requires(T t, U u) { t += u; }
 
template<typename T , typename U >
concept InvocableReturns
 
template<typename T >
concept Range
 
thread_local EventContext globalEventContext
 
constexpr CustomEventContextFlag_t CustomEventContextFlag {}
 
template<typename T >
concept IsObserved = Detail::IsObserved<std::decay_t<T>>::value
 
template<typename T >
concept IsSharedObserved = Detail::IsSharedObserved<std::decay_t<T>>::value
 
template<typename T >
concept IsWeakObserved = Detail::IsWeakObserved<std::decay_t<T>>::value
 
template<typename T >
concept IsObservedLike = Detail::IsObservedLike<std::decay_t<T>>::value
 
constexpr auto RegularHtmlElementBridge
 
constexpr auto SvgElementBridge
 
constexpr auto TextElementBridge
 
constexpr auto CommentElementBridge
 
template<typename T >
constexpr bool IsTuple_v = IsTuple<std::decay_t<T>>::value
 

Typedef Documentation

◆ ElementRenderer

using Nui::ElementRenderer = typedef std::function<std::shared_ptr<Dom::Element>(Dom::Element&, Renderer const&)>

◆ ExtractValueType_t

template<typename T >
using Nui::ExtractValueType_t = typedef typename ExtractValueType<T>::type

◆ FunctionArgumentTypes_t

template<typename T >
using Nui::FunctionArgumentTypes_t = typedef typename FunctionArgumentTypes<T>::type

◆ FunctionReturnType_t

template<typename T >
using Nui::FunctionReturnType_t = typedef typename FunctionReturnType<T>::type

◆ UnpackObserved_t

template<typename T >
using Nui::UnpackObserved_t = typedef typename UnpackObserved<T>::type

◆ Url

using Nui::Url = typedef Roar::Url

◆ val

using Nui::val = typedef emscripten::val

Enumeration Type Documentation

◆ HostResourceAccessKind

Enumerator
Deny 
Allow 
DenyCors 

◆ NuiCoreWebView2WebResourceContext

Enumerator
All 
Document 
Stylesheet 
Image 
Media 
Font 
Script 
XmlHttpRequest 
Fetch 
TextTrack 
EventSource 
WebSocket 
Manifest 
SignedExchange 
Ping 
CspViolationReport 
Other 

◆ RangeOperationType

Enumerator
Keep 
Modify 
Insert 
Erase 

◆ RendererType

enum Nui::RendererType
strong
Enumerator
Append 
Fragment 
Insert 
Replace 
Inplace 
Emplace 

◆ ResizeableEdge

enum Nui::ResizeableEdge
strong
Enumerator
Right 
Bottom 
Top 

◆ WebViewHint

enum Nui::WebViewHint : int
strong
Enumerator
WEBVIEW_HINT_NONE 
WEBVIEW_HINT_MIN 
WEBVIEW_HINT_MAX 
WEBVIEW_HINT_FIXED 

Function Documentation

◆ assertImpl()

void Nui::assertImpl ( bool  condition,
const char *  message 
)
inline

◆ bind()

template<class F , class... Args>
emscripten::val Nui::bind ( F &&  f,
Args &&...  args 
)

Equivalent of std::bind returning a javascript functor.

Parameters
fThe lambda, function, member function to bind
args
Returns
An emscripten::val representing a javascript functor with it's this-scope bound correctly. It can be called from js or c++ with the call operator ( i.e. operator() ).

◆ BOOST_DESCRIBE_STRUCT() [1/2]

Nui::BOOST_DESCRIBE_STRUCT ( FetchOptions  ,
()  ,
(method, headers, body, verbose, followRedirects, maxRedirects, autoReferer, dontDecodeBody, verifyPeer, verifyHost)   
)

◆ BOOST_DESCRIBE_STRUCT() [2/2]

Nui::BOOST_DESCRIBE_STRUCT ( FetchResponse  ,
()  ,
(curlCode, status, proxyStatus, downloadSize, redirectUrl, body, headers)   
)

◆ convertFromVal() [1/11]

void Nui::convertFromVal ( Nui::val const &  ,
long long   
)
inline

◆ convertFromVal() [2/11]

void Nui::convertFromVal ( Nui::val const &  val,
Nui::val value 
)
inline

◆ convertFromVal() [3/11]

template<typename T >
void Nui::convertFromVal ( Nui::val const &  val,
Observed< T > &  observed 
)

◆ convertFromVal() [4/11]

void Nui::convertFromVal ( Nui::val const &  val,
std::filesystem::path &  value 
)
inline

◆ convertFromVal() [5/11]

template<typename T >
void Nui::convertFromVal ( Nui::val const &  val,
std::optional< T > &  option 
)

◆ convertFromVal() [6/11]

void Nui::convertFromVal ( Nui::val const &  val,
std::string &  str 
)
inline

◆ convertFromVal() [7/11]

template<typename T >
void Nui::convertFromVal ( Nui::val const &  val,
std::unordered_map< std::string, T > &  map 
)

◆ convertFromVal() [8/11]

template<typename T >
void Nui::convertFromVal ( Nui::val const &  val,
std::vector< T > &  vector 
)

◆ convertFromVal() [9/11]

template<typename T >
requires Fundamental< T > void Nui::convertFromVal ( Nui::val const &  val,
std::vector< T > &  vector 
)

◆ convertFromVal() [10/11]

template<typename T >
requires (!std::is_union_v<T>) void convertFromValObjImpl(Nui requires (!std::is_union_v<T>) void convertFromVal(Nui requires (!std::is_union_v<T> && !boost::describe::has_describe_bases<T>::value) void convertFromVal(Nui requires Fundamental<T> void Nui::convertFromVal ( Nui::val const &  val,
T &  value 
)

◆ convertFromVal() [11/11]

template<typename T >
requires Fundamental<T> void Nui::convertFromVal ( Nui::val const &  val,
T &  value 
)

◆ convertToVal() [1/17]

Nui::val Nui::convertToVal ( char const *  value)
inline

◆ convertToVal() [2/17]

Nui::val Nui::convertToVal ( long long  )
inline

◆ convertToVal() [3/17]

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<T>::value>>
void Nui::convertToVal ( Nui::val val,
T const &  obj 
)

◆ convertToVal() [4/17]

Nui::val Nui::convertToVal ( Nui::val  value)
inline

◆ convertToVal() [5/17]

template<typename T >
Nui::val Nui::convertToVal ( Observed< T > const &  observed)

◆ convertToVal() [6/17]

Nui::val Nui::convertToVal ( std::filesystem::path const &  value)
inline

◆ convertToVal() [7/17]

template<typename T >
Nui::val Nui::convertToVal ( std::map< std::string, T > const &  map)

◆ convertToVal() [8/17]

Nui::val Nui::convertToVal ( std::monostate  )
inline

◆ convertToVal() [9/17]

template<typename T >
Nui::val Nui::convertToVal ( std::optional< T > const &  option)

◆ convertToVal() [10/17]

template<typename T >
Nui::val Nui::convertToVal ( std::shared_ptr< T > const &  map)

◆ convertToVal() [11/17]

Nui::val Nui::convertToVal ( std::string const &  value)
inline

◆ convertToVal() [12/17]

template<typename T >
Nui::val Nui::convertToVal ( std::unique_ptr< T > const &  map)

◆ convertToVal() [13/17]

template<typename T >
Nui::val Nui::convertToVal ( std::unordered_map< std::string, T > const &  map)

◆ convertToVal() [14/17]

template<typename... Ts>
Nui::val Nui::convertToVal ( std::variant< Ts... > const &  variant)

◆ convertToVal() [15/17]

template<typename T >
Nui::val Nui::convertToVal ( std::vector< T > const &  vector)

◆ convertToVal() [16/17]

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<T>::value>>
Nui::val Nui::convertToVal ( T const &  obj)

◆ convertToVal() [17/17]

template<typename T >
requires Fundamental< T > Nui::val Nui::convertToVal ( T const &  value)

◆ delocalizedSlot() [1/2]

ElementRenderer Nui::delocalizedSlot ( char const *  slot,
Delocalized< std::string > &  delocalizedElement,
std::vector< Attribute wrapperAttributes = {},
ElementRenderer  alternative = Elements::div{Attributes::style = "display: none"}() 
)
inline

◆ delocalizedSlot() [2/2]

template<typename SlotId >
ElementRenderer Nui::delocalizedSlot ( SlotId  slot,
Delocalized< SlotId > &  delocalizedElement,
std::vector< Attribute wrapperAttributes = {},
ElementRenderer  alternative = Elements::div{Attributes::style = "display: none"}() 
)

◆ dynamic_pointer_cast()

template<typename T , typename U >
GObjectReference<T> Nui::dynamic_pointer_cast ( GObjectReference< U > const &  ptr)

◆ fetch() [1/2]

void Nui::fetch ( std::string const &  uri,
FetchOptions const &  options,
std::function< void(std::optional< FetchResponse > const &)>  callback 
)

Simplified fetch, that uses curl in the backend to fetch data.

This circumvents the need for ASYNCIFY. Downloading big amounts of data with this is not optimal.

Parameters
uriURI to fetch.
optionsOptions for the fetch.
callbackCallback that is called when the fetch is done.

◆ fetch() [2/2]

void Nui::fetch ( std::string const &  uri,
std::function< void(std::optional< FetchResponse > const &)>  callback 
)

◆ fixConcat()

template<unsigned... Length>
constexpr auto Nui::fixConcat ( const   char(&... strings)[Length])
constexpr

Allows for compile-time string concatenation.

Use very sparingly.

◆ FixedString()

template<unsigned N>
Nui::FixedString ( char   const(&)[N]) -> FixedString< N - 1 >

◆ fixToLower() [1/2]

template<unsigned N>
constexpr auto Nui::fixToLower ( char const (&)  str[N])
constexpr

◆ fixToLower() [2/2]

template<unsigned N>
constexpr auto Nui::fixToLower ( FixedString< N >  base)
constexpr

◆ folderMappingResponseFromRequest()

CustomSchemeResponse Nui::folderMappingResponseFromRequest ( CustomSchemeRequest const &  req,
HostNameMappingInfo const &  hostNameMappingInfo 
)

◆ getEnvironmentVariables() [1/2]

std::unordered_map< std::string, std::string > Nui::getEnvironmentVariables ( )

◆ getEnvironmentVariables() [2/2]

void Nui::getEnvironmentVariables ( std::function< void(std::unordered_map< std::string, std::string > &&)>  callback)

◆ IteratorAccessor() [1/2]

template<typename ContainerT >
Nui::IteratorAccessor ( ContainerT &  ) -> IteratorAccessor< ContainerT >

◆ IteratorAccessor() [2/2]

template<typename ContainerT >
Nui::IteratorAccessor ( ContainerT const &  ) -> IteratorAccessor< const ContainerT >

◆ JS_BIND_FUNCTION_TYPES()

Nui::JS_BIND_FUNCTION_TYPES ( )

◆ listen() [1/8]

template<typename ValueT , typename FunctionT >
void Nui::listen ( EventContext eventContext,
Observed< ValueT > const &  obs,
FunctionT  onEvent 
)

◆ listen() [2/8]

template<typename ValueT >
void Nui::listen ( EventContext eventContext,
Observed< ValueT > const &  obs,
std::function< bool(ValueT const &)>  onEvent 
)

◆ listen() [3/8]

template<typename ValueT >
void Nui::listen ( EventContext eventContext,
Observed< ValueT > const &  obs,
std::function< void(ValueT const &)>  onEvent 
)

◆ listen() [4/8]

template<typename ValueT , typename FunctionT >
void Nui::listen ( EventContext eventContext,
std::shared_ptr< Observed< ValueT >> const &  obs,
FunctionT  onEvent 
)

◆ listen() [5/8]

template<typename ValueT >
void Nui::listen ( EventContext eventContext,
std::shared_ptr< Observed< ValueT >> const &  obs,
std::function< bool(ValueT const &)>  onEvent 
)

◆ listen() [6/8]

template<typename ValueT >
void Nui::listen ( EventContext eventContext,
std::shared_ptr< Observed< ValueT >> const &  obs,
std::function< void(ValueT const &)>  onEvent 
)

◆ listen() [7/8]

template<typename ValueT , typename FunctionT >
void Nui::listen ( Observed< ValueT > const &  obs,
FunctionT  onEvent 
)

◆ listen() [8/8]

template<typename ValueT , typename FunctionT >
void Nui::listen ( std::shared_ptr< Observed< ValueT >> const &  obs,
FunctionT  onEvent 
)

◆ listenToFragmentChanges()

void Nui::listenToFragmentChanges ( Observed< std::string > &  fragment)

Listens to fragment changes and changes the attached observed.

◆ makeResizeable()

void Nui::makeResizeable ( Nui::val const &  element,
ResizeableEdge  edge = ResizeableEdge::Right 
)

◆ nil()

static auto Nui::nil ( )
static

◆ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE() [1/2]

Nui::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE ( FetchOptions  ,
method  ,
headers  ,
body  ,
verbose  ,
followRedirects  ,
maxRedirects  ,
autoReferer  ,
dontDecodeBody  ,
verifyPeer  ,
verifyHost   
)

◆ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE() [2/2]

Nui::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE ( FetchResponse  ,
curlCode  ,
status  ,
proxyStatus  ,
downloadSize  ,
redirectUrl  ,
body  ,
headers   
)

◆ ObservedValueCombinator() [1/2]

template<typename... ObservedValues>
Nui::ObservedValueCombinator ( ObservedValues &&  ...) -> ObservedValueCombinator< std::decay_t< Detail::ObservedAddReference_t< ObservedValues >>... >

◆ ObservedValueCombinator() [2/2]

template<typename... ObservedValues>
Nui::ObservedValueCombinator ( std::tuple< Detail::ObservedAddReference_t< ObservedValues >... >  ) -> ObservedValueCombinator< std::decay_t< Detail::ObservedAddReference_t< ObservedValues >>... >

◆ openFile() [1/3]

void Nui::openFile ( char const *  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)

◆ openFile() [2/3]

void Nui::openFile ( std::filesystem::path const &  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)

◆ openFile() [3/3]

void Nui::openFile ( std::string const &  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)

◆ operator!()

Attribute&& Nui::operator! ( Attribute &&  attribute)
inline

◆ operator!=() [1/3]

template<typename T , typename U >
bool Nui::operator!= ( GObjectReference< T > const &  lhs,
GObjectReference< U > const &  rhs 
)

◆ operator!=() [2/3]

template<typename T , typename U >
bool Nui::operator!= ( GObjectReference< T > const &  lhs,
T *  rhs 
)

◆ operator!=() [3/3]

template<typename T , typename U >
bool Nui::operator!= ( T *  lhs,
GObjectReference< U > const &  rhs 
)

◆ operator++() [1/2]

template<typename T >
requires Incrementable<T> ModifiableObserved<T>& Nui::operator++ ( ModifiableObserved< T > &  observedValue)
inline

◆ operator++() [2/2]

template<typename T >
requires Incrementable<T> T Nui::operator++ ( ModifiableObserved< T > &  observedValue,
int   
)
inline

◆ operator--() [1/2]

template<typename T >
auto Nui::operator-- ( ModifiableObserved< T > &  observedValue) -> ModifiableObserved<Detail::PickFirst_t<T, decltype(--std::declval<T>())>>&
inline

◆ operator--() [2/2]

template<typename T >
auto Nui::operator-- ( ModifiableObserved< T > &  observedValue,
int   
) -> Detail::PickFirst_t<T, decltype(std::declval<T>()--)>
inline

◆ operator==() [1/3]

template<typename T , typename U >
bool Nui::operator== ( GObjectReference< T > const &  lhs,
GObjectReference< U > const &  rhs 
)

◆ operator==() [2/3]

template<typename T , typename U >
bool Nui::operator== ( GObjectReference< T > const &  lhs,
T *  rhs 
)

◆ operator==() [3/3]

template<typename T , typename U >
bool Nui::operator== ( T *  lhs,
GObjectReference< U > const &  rhs 
)

◆ overloaded()

template<typename... Ts>
Nui::overloaded ( Ts...  ) -> overloaded< Ts... >

◆ property()

template<typename RendererType , typename... ObservedValues>
ObservedValueCombinatorWithPropertyGenerator<RendererType, ObservedValues...> Nui::property ( ObservedValueCombinatorWithGenerator< RendererType, ObservedValues... >  combinator)

◆ range() [1/4]

template<typename ContainerT >
UnoptimizedRange<IteratorAccessor<ContainerT> > Nui::range ( ContainerT &  container)

◆ range() [2/4]

template<typename ContainerT , typename... Observed>
UnoptimizedRange<IteratorAccessor<ContainerT>, std::decay_t<Detail::ObservedAddReference_t<Observed> >...> Nui::range ( ContainerT &  container,
Observed &&...  observed 
)

◆ range() [3/4]

template<typename ContainerT >
UnoptimizedRange<IteratorAccessor<ContainerT const> > Nui::range ( ContainerT const &  container)

◆ range() [4/4]

template<typename ContainerT , typename... Observed>
UnoptimizedRange<IteratorAccessor<ContainerT const>, std::decay_t<Detail::ObservedAddReference_t<Observed> >...> Nui::range ( ContainerT const &  container,
Observed &&...  observed 
)

◆ registerEnvironmentVariables()

void Nui::registerEnvironmentVariables ( Nui::RpcHub const &  hub)

◆ registerFetch()

void Nui::registerFetch ( Nui::RpcHub const &  hub)

◆ registerFile()

void Nui::registerFile ( Nui::RpcHub hub)

◆ registerScreen()

void Nui::registerScreen ( Nui::RpcHub const &  hub)

◆ registerThrottle()

void Nui::registerThrottle ( Nui::RpcHub hub)

◆ registerTimer()

void Nui::registerTimer ( Nui::RpcHub hub)

◆ renderElement()

auto Nui::renderElement ( Renderer const &  gen,
auto &  element,
auto const &  htmlElement 
)

◆ requires() [1/11]

template<typename U >
Nui::requires ( !IsObservedLike< std::decay_t< U >> &&!std::invocable< U > &&!std::invocable< U, Nui::val )

◆ requires() [2/11]

template<typename T , class Members = boost::describe::describe_members<T, boost::describe::mod_any_access>>
Nui::requires ( !std::is_union_v< T > &&!boost::describe::has_describe_bases< T >::value  )

◆ requires() [3/11]

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>>
Nui::requires ( !std::is_union_v< T > &&boost::describe::has_describe_bases< T >::value  )

◆ requires() [4/11]

template<typename T , class Members = boost::describe::describe_members<T, boost::describe::mod_any_access>>
Nui::requires ( !std::is_union_v< T >  )

◆ requires() [5/11]

template<typename ObservedValue >
Nui::requires ( IsObserved< ObservedValue >  ) &

◆ requires() [6/11]

template<typename U >
Nui::requires ( IsObserved< std::decay_t< U >>  )

◆ requires() [7/11]

template<typename... ObservedValues>
Nui::requires ( IsObservedLike< ObservedValues > &&  ...)

◆ requires() [8/11]

template<typename U >
Nui::requires ( IsSharedObserved< std::decay_t< U >>  )

◆ requires() [9/11]

template<typename U >
Nui::requires ( IsWeakObserved< std::decay_t< U >>  )

◆ requires() [10/11]

template<typename U >
Nui::requires ( std::invocable< U >  )

◆ requires() [11/11]

template<typename U >
Nui::requires ( std::invocable< U, Nui::val )

◆ resolvePath()

std::filesystem::path Nui::resolvePath ( std::filesystem::path const &  path)

Will replace prefixes like "~" and "%appdata%" with actual directories on linux and windows.

The percent values are case insensitive. ~ Linux: home. Windows: home userprofile% Linux: home. Windows: home appdata% Linux: home. Windows: CSIDL_APPDATA localappdata% Linux: home. Windows: CSIDL_APPDATA_LOCAL temp% Linux: /tmp. Windows: ${USER}\AppData\Local\Temp config_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA config_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS config_home3% Linux: $XDG_CONFIG_HOME. Windows: home state_home% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_APPDATA state_home2% Linux: $XDG_CONFIG_HOME. Windows: CSIDL_MYDOCUMENTS state_home3% Linux: $XDG_CONFIG_HOME. Windows: home data_home% Linux: $XDG_DATA_HOME. Windows: CSIDL_APPDATA data_home2% Linux: $XDG_DATA_HOME. Windows: CSIDL_MYDOCUMENTS data_home3% Linux: $XDG_DATA_HOME. Windows: home

Parameters
path
Returns
std::filesystem::path

◆ ScopeExit()

template<typename T >
Nui::ScopeExit ( ) -> ScopeExit< T >

◆ setInterval()

void Nui::setInterval ( int  milliseconds,
std::function< void()>  toWrap,
std::function< void(TimerHandle &&)>  callback 
)

Creates a new timer that calls "toWrap" every "milliseconds" milliseconds.

This function is less accurate than the browser setInterval, because it has to traverse from backend to frontend. This is an alternative if you have trouble with ASYNCIFY and code running from setInterval. You should avoid using this function for small time intervals to avoid performance issues.

Parameters
millisecondsThe time between each call of the function.
toWrapThe function to call periodically.
callbackThis callback receives the interval handle. The timer can be stopped using this handle.

◆ setTimeout()

void Nui::setTimeout ( int  milliseconds,
std::function< void()>  toWrap,
std::function< void(TimerHandle)>  callback 
)

Creates a new delayed function that calls "toWrap" after "milliseconds" milliseconds.

This function is less accurate than the browser setTimeout, because it has to traverse from backend to frontend. This is an alternative if you have trouble with ASYNCIFY and code running from setTimeout. You should avoid using this function for small timeouts to avoid performance issues.

Parameters
millisecondsThe time to wait before calling the function.
toWrapThe function to call after the timeout.
callbackThis callback receives the timeout handle. The timeout can be stopped using this handle.

◆ shortenString()

std::string Nui::shortenString ( std::wstring const &  str)
inline

◆ stabilize()

ElementRenderer Nui::stabilize ( StableElement stableElement,
ElementRenderer const &  encapsulatedRenderer 
)

Stabilizes an element, so that it is not re-rendered on every render.

Parameters
stableElementA stable element handle held by the caller. Must not be destroyed before the associated ui.
encapsulatedRendererThe renderer that should be rendered once and then stabilized.
Returns
ElementRenderer A renderer that renders the encapsulated renderer once and then stabilizes it.

◆ static_pointer_cast()

template<typename T , typename U >
GObjectReference<T> Nui::static_pointer_cast ( GObjectReference< U > const &  ptr)

◆ swap()

template<typename T >
void Nui::swap ( GObjectReference< T > &  lhs,
GObjectReference< T > &  rhs 
)

◆ throttle()

void Nui::throttle ( int  milliseconds,
std::function< void()>  toWrap,
std::function< void(ThrottledFunction &&)>  callback,
bool  callWhenReady = false 
)

Creates a function that can be used to call a function at most once during the specified interval.

You can imagine it as a std::call_once that is reset after the given time. This function is not very accurate, because of the back and forth travel time.

Parameters
millisecondsThe minimum time between each call of the function.
funcThe function to call throttled.
callbackThis callback receives the throttled function.
callWhenReadycall the function when ready if it was not during the wait interval.

◆ tupleForEach() [1/2]

template<typename FuncT , typename... Types>
void Nui::tupleForEach ( std::tuple< Types... > &  t,
FuncT &&  func 
)

◆ tupleForEach() [2/2]

template<typename FuncT , typename... Types>
void Nui::tupleForEach ( std::tuple< Types... > const &  t,
FuncT &&  func 
)

◆ visitOverloaded() [1/2]

template<typename... VariantTypes, typename... VisitFunctionTypes>
auto Nui::visitOverloaded ( std::variant< VariantTypes... > &&  variant,
VisitFunctionTypes &&...  visitFunctions 
)

◆ visitOverloaded() [2/2]

template<typename... VariantTypes, typename... VisitFunctionTypes>
auto Nui::visitOverloaded ( std::variant< VariantTypes... > const &  variant,
VisitFunctionTypes &&...  visitFunctions 
)

◆ webView2EnvironmentOptionsFromOptions()

Microsoft::WRL::ComPtr<ICoreWebView2EnvironmentOptions> Nui::webView2EnvironmentOptionsFromOptions ( WindowOptions const &  options)

◆ widenString()

std::wstring Nui::widenString ( std::string const &  str)
inline

Variable Documentation

◆ CommentElementBridge

constexpr auto Nui::CommentElementBridge
constexpr
Initial value:
= HtmlElementBridge{
.createElement =
+[](HtmlElement const& element) {
return Nui::val::global("document")
.call<Nui::val>("createComment", Nui::val{element.attributes()[0].stringData()});
},
}
emscripten::val val
Definition: val.hpp:5

◆ CustomEventContextFlag

constexpr CustomEventContextFlag_t Nui::CustomEventContextFlag {}
inlineconstexpr

◆ Decrementable

template<typename T >
concept Nui::Decrementable
Initial value:
= requires(T t) {
--t;
t--;
}
requires(IsObservedLike< ObservedValues > &&...) ObservedValueCombinator< std
Definition: observed_value_combinator.hpp:191

◆ Fundamental

template<typename T >
concept Nui::Fundamental = Numerical<T> || std::same_as<T, bool>

◆ globalEventContext

thread_local EventContext Nui::globalEventContext

◆ Incrementable

template<typename T >
concept Nui::Incrementable
Initial value:
= requires(T t) {
++t;
t++;
}

◆ InvocableReturns

template<typename T , typename U >
concept Nui::InvocableReturns
Initial value:
= requires(T func) {
{
func()
} -> std::same_as<U>;
}

◆ IsObserved

template<typename T >
concept Nui::IsObserved = Detail::IsObserved<std::decay_t<T>>::value

◆ IsObservedLike

template<typename T >
concept Nui::IsObservedLike = Detail::IsObservedLike<std::decay_t<T>>::value

◆ IsSharedObserved

template<typename T >
concept Nui::IsSharedObserved = Detail::IsSharedObserved<std::decay_t<T>>::value

◆ IsTuple_v

template<typename T >
constexpr bool Nui::IsTuple_v = IsTuple<std::decay_t<T>>::value
constexpr

◆ IsWeakObserved

template<typename T >
concept Nui::IsWeakObserved = Detail::IsWeakObserved<std::decay_t<T>>::value

◆ MinusAssignable

template<typename T , typename U >
concept Nui::MinusAssignable = requires(T t, U u) { t += u; }

◆ Numerical

template<typename T >
concept Nui::Numerical = std::integral<T> || std::floating_point<T>

◆ PlusAssignable

template<typename T , typename U >
concept Nui::PlusAssignable = requires(T t, U u) { t += u; }

◆ Range

template<typename T >
concept Nui::Range
Initial value:
= requires(T t) {
t.begin();
t.end();
t.cbegin();
t.cend();
}

◆ RegularHtmlElementBridge

constexpr auto Nui::RegularHtmlElementBridge
constexpr
Initial value:
= HtmlElementBridge{
.createElement =
+[](HtmlElement const& element) {
return Nui::val::global("document").call<Nui::val>("createElement", Nui::val{element.name()});
},
}

◆ SvgElementBridge

constexpr auto Nui::SvgElementBridge
constexpr
Initial value:
= HtmlElementBridge{
.createElement =
+[](HtmlElement const& element) {
return Nui::val::global("document")
.call<Nui::val>(
"createElementNS",
Nui::val{std::string{"http://www.w3.org/2000/svg"}},
Nui::val{element.name()});
},
}

◆ TextElementBridge

constexpr auto Nui::TextElementBridge
constexpr
Initial value:
= HtmlElementBridge{
.createElement =
+[](HtmlElement const& element) {
return Nui::val::global("document")
.call<Nui::val>("createTextNode", Nui::val{element.attributes()[0].stringData()});
},
}