ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
diplomat_runtime.hpp File Reference
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
#include <variant>
#include <cstdint>
#include <functional>
#include <memory>
#include <limits>
#include <array>

Go to the source code of this file.

Classes

struct  diplomat::Ok< T >
 
struct  diplomat::Err< T >
 
class  diplomat::result< T, E >
 
class  diplomat::Utf8Error
 
class  diplomat::span< T, Extent >
 
struct  diplomat::as_ffi< T, typename >
 
struct  diplomat::fn_traits< std::function< Ret(Args...)> >
 
struct  diplomat::inner< T >
 
struct  diplomat::inner< std::unique_ptr< T > >
 
struct  diplomat::inner< std::optional< T > >
 
struct  diplomat::has_next< T, U >
 
struct  diplomat::has_next< T, std::void_t< decltype(std::declval< T >().next())> >
 
struct  diplomat::next_to_iter_helper< T >
 Helper template enabling native iteration over unique ptrs to objects which implement next() More...
 

Namespaces

namespace  diplomat
 

Macros

#define MAKE_SLICES(name, c_ty)
 
#define MAKE_SLICES_AND_OPTIONS(name, c_ty)
 

Typedefs

template<typename T>
using diplomat::as_ffi_t = typename as_ffi<T>::type
 
template<typename T>
using diplomat::replace_string_view_t = std::conditional_t<std::is_same_v<T, std::string_view>, capi::DiplomatStringView, T>
 
template<typename T>
using diplomat::replace_ref_with_ptr_t = std::conditional_t<std::is_reference_v<T>, std::add_pointer_t<std::remove_reference_t<T>>, T>
 
template<typename T>
using diplomat::replace_fn_t = replace_string_view_t<as_ffi_t<T>>
 Replace the argument types from the std::function with the argument types for th function pointer.
 

Functions

template<class T>
 diplomat::fn_traits (T) -> fn_traits< T >
 
template<typename T, typename U = typename inner<T>::type>
const U diplomat::get_inner_if_present (T v)
 

Variables

constexpr size_t diplomat::dynamic_extent = std::numeric_limits<std::size_t>::max()
 
template<typename T>
constexpr bool diplomat::has_next_v = has_next<T>::value
 

Macro Definition Documentation

◆ MAKE_SLICES

#define MAKE_SLICES ( name,
c_ty )
Value:
typedef struct Diplomat##name##View { \
const c_ty* data; \
size_t len; \
} Diplomat##name##View; \
typedef struct Diplomat##name##ViewMut { \
c_ty* data; \
size_t len; \
} Diplomat##name##ViewMut; \
typedef struct Diplomat##name##Array { \
const c_ty* data; \
size_t len; \
} Diplomat##name##Array;

◆ MAKE_SLICES_AND_OPTIONS

#define MAKE_SLICES_AND_OPTIONS ( name,
c_ty )
Value:
MAKE_SLICES(name, c_ty) \
typedef struct Option##name {union { c_ty ok; }; bool is_ok; } Option##name; \
typedef struct Option##name##View {union { Diplomat##name##View ok; }; bool is_ok; } Option##name##View; \
typedef struct Option##name##ViewMut {union { Diplomat##name##ViewMut ok; }; bool is_ok; } Option##name##ViewMut; \
typedef struct Option##name##Array {union { Diplomat##name##Array ok; }; bool is_ok; } Option##name##Array; \
#define MAKE_SLICES(name, c_ty)
Definition diplomat_runtime.hpp:42