WG14 result
Loading...
Searching...
No Matches
status_code_domain.h File Reference
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
Include dependency graph for status_code_domain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  status_code_domain_string_ref_thunk_args_s
 Type of the arguments to a string ref thunk function. More...
 
struct  status_code_domain_string_ref_s
 Type of a string ref of a domain. More...
 
struct  status_code_domain_payload_info
 Type of a payload info of a domain. More...
 
struct  status_code_untyped
 Type of an untyped status code. More...
 
struct  status_code_domain_vtable_name_args
 The arguments for status_code_domain_vtable.name More...
 
struct  status_code_domain_vtable_payload_info_args
 The arguments for status_code_domain_vtable.payload_info More...
 
struct  status_code_domain_vtable_message_args
 The arguments for status_code_domain_vtable.message More...
 
struct  status_code_domain_vtable_s
 The functions defined by a status code domain, kept ABI compatible with a C++ vtable. More...
 
struct  status_code_domain_s
 The functions defined by a status code domain, kept ABI compatible with a C++ vtable. More...
 

Macros

#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS(T)
 
#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT(T)    {STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS(T)}
 A default initialiser for a status_code_domain_payload_info_t for.
 
#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_MAKE(T)
 Make a default status_code_domain_payload_info_t for most types.
 
#define WG14_RESULT_VTABLE_API_GLUE2(x, y)   x##y
 The implementation specific markup for a C++ vtable function, if any.
 
#define WG14_RESULT_VTABLE_API_GLUE(x, y)   WG14_RESULT_VTABLE_API_GLUE2(x, y)
 
#define WG14_RESULT_VTABLE_API_UNIQUE_NAME
 
#define WG14_RESULT_VTABLE_API(name, ...)
 
#define WG14_RESULT_VTABLE_DECL(name, ...)
 
#define WG14_RESULT_VTABLE_INVOKE_API(domain, name, ...)    (domain)->vptr->name((domain), __VA_ARGS__)
 
#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_ABORT(msg)   (0)
 
#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_PARSE_HEX_BYTE(c)
 
#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID(uuid)
 Generate a constexpr expression which yields a status code domain unique id.
 

Typedefs

typedef unsigned long long status_code_domain_unique_id_type
 Type of a unique id of a domain.
 
typedef struct status_code_domain_string_ref_s status_code_domain_string_ref
 Type of a string ref of a domain.
 
typedef struct status_code_domain_string_ref_thunk_args_s status_code_domain_string_ref_thunk_args
 Type of the arguments to a string ref thunk function.
 
typedef int(* status_code_domain_string_ref_thunk_spec) (const status_code_domain_string_ref_thunk_args *args)
 Type of a string ref thunk function. Returns an errno value. Copies can fail. Nothing else can.
 
typedef const struct status_code_domain_s status_code_domain
 The functions defined by a status code domain, kept ABI compatible with a C++ vtable.
 
typedef struct status_code_domain_payload_info status_code_domain_payload_info_t
 Type of a payload info of a domain.
 
typedef struct status_code_untyped status_code_untyped
 Type of an untyped status code.
 
typedef struct status_code_generic_s status_code_generic
 Type of a generic status code.
 
typedef const struct status_code_domain_vtable_s status_code_domain_vtable
 The functions defined by a status code domain, kept ABI compatible with a C++ vtable.
 

Enumerations

enum  status_code_domain_string_ref_thunk_op { status_code_domain_string_ref_thunk_op_copy , status_code_domain_string_ref_thunk_op_move , status_code_domain_string_ref_thunk_op_destruct }
 Type of a string ref thunk op. More...
 

Functions

status_code_domain_string_ref status_code_domain_string_ref_atomic_refcounted_from_buffer (const char *s, size_t len)
 Make an atomic refcounted string ref which tracks living copies using an atomic reference count, freeing the internally stored buffer on final destroy. The input range is copied and does not need to be null terminated. Failure to malloc causes a static string ref to be returned with a string like "failed to get message from system".
 
status_code_domain_unique_id_type status_code_domain_unique_id_from_uuid (const char *uuid)
 Parse a uuid input string to yield a status code domain unique id.
 

Macro Definition Documentation

◆ STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT

#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT (   T)     {STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS(T)}

A default initialiser for a status_code_domain_payload_info_t for.

most types

Definition at line 224 of file status_code_domain.h.

◆ STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS

#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS (   T)
Value:
sizeof(T), sizeof(WG14_RESULT_PREFIX(status_code_domain) *) + sizeof(T), \
(__alignof(T) > __alignof(WG14_RESULT_PREFIX(status_code_domain) *)) ? \
__alignof(T) : \
__alignof(WG14_RESULT_PREFIX(status_code_domain) *)
The functions defined by a status code domain, kept ABI compatible with a C++ vtable.

Definition at line 216 of file status_code_domain.h.

◆ STATUS_CODE_DOMAIN_PAYLOAD_INFO_MAKE

#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_MAKE (   T)
Value:
WG14_RESULT_PREFIX(status_code_domain_payload_info_make) \
#define STATUS_CODE_DOMAIN_PAYLOAD_INFO_INIT_INNARDS(T)

Make a default status_code_domain_payload_info_t for most types.

Definition at line 237 of file status_code_domain.h.

◆ STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID

#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID (   uuid)

Generate a constexpr expression which yields a status code domain unique id.

Definition at line 598 of file status_code_domain.h.

◆ STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_ABORT

#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_ABORT (   msg)    (0)

Definition at line 586 of file status_code_domain.h.

◆ STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_PARSE_HEX_BYTE

#define STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_PARSE_HEX_BYTE (   c)
Value:
(('0' <= (c) && (c) <= '9') ? (unsigned long long) ((c) - '0') : \
('a' <= (c) && (c) <= 'f') ? (unsigned long long) (10 + (c) - 'a') : \
('A' <= (c) && (c) <= 'F') ? (unsigned long long) (10 + (c) - 'A') : \
STATUS_CODE_DOMAIN_UNIQUE_ID_FROM_UUID_ABORT( \
"Invalid character in UUID"))

Definition at line 589 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_API

#define WG14_RESULT_VTABLE_API (   name,
  ... 
)
Value:
name(__attribute__((unused)) \
const void *WG14_RESULT_VTABLE_API_UNIQUE_NAME /*discard this*/, \
__VA_ARGS__)
#define WG14_RESULT_VTABLE_API_UNIQUE_NAME

Definition at line 437 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_API_GLUE

#define WG14_RESULT_VTABLE_API_GLUE (   x,
 
)    WG14_RESULT_VTABLE_API_GLUE2(x, y)

Definition at line 285 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_API_GLUE2

#define WG14_RESULT_VTABLE_API_GLUE2 (   x,
 
)    x##y

The implementation specific markup for a C++ vtable function, if any.

Definition at line 284 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_API_UNIQUE_NAME

#define WG14_RESULT_VTABLE_API_UNIQUE_NAME
Value:
WG14_RESULT_VTABLE_API_GLUE(_wg14_result_vtable_api_unique_name_temporary, \
__COUNTER__)
#define WG14_RESULT_VTABLE_API_GLUE(x, y)

Definition at line 286 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_DECL

#define WG14_RESULT_VTABLE_DECL (   name,
  ... 
)
Value:
(name)(__attribute__((unused)) \
const void *WG14_RESULT_VTABLE_API_UNIQUE_NAME /*discard this*/, \
__VA_ARGS__)

Definition at line 441 of file status_code_domain.h.

◆ WG14_RESULT_VTABLE_INVOKE_API

#define WG14_RESULT_VTABLE_INVOKE_API (   domain,
  name,
  ... 
)     (domain)->vptr->name((domain), __VA_ARGS__)

Definition at line 445 of file status_code_domain.h.

Typedef Documentation

◆ status_code_domain

The functions defined by a status code domain, kept ABI compatible with a C++ vtable.

Definition at line 205 of file status_code_domain.h.

◆ status_code_domain_payload_info_t

Type of a payload info of a domain.

◆ status_code_domain_string_ref

Type of a string ref of a domain.

Definition at line 49 of file status_code_domain.h.

◆ status_code_domain_string_ref_thunk_args

Type of the arguments to a string ref thunk function.

◆ status_code_domain_string_ref_thunk_spec

typedef int(* status_code_domain_string_ref_thunk_spec) (const status_code_domain_string_ref_thunk_args *args)

Type of a string ref thunk function. Returns an errno value. Copies can fail. Nothing else can.

Definition at line 69 of file status_code_domain.h.

◆ status_code_domain_unique_id_type

typedef unsigned long long status_code_domain_unique_id_type

Type of a unique id of a domain.

Definition at line 45 of file status_code_domain.h.

◆ status_code_domain_vtable

The functions defined by a status code domain, kept ABI compatible with a C++ vtable.

◆ status_code_generic

Type of a generic status code.

Definition at line 249 of file status_code_domain.h.

◆ status_code_untyped

Type of an untyped status code.

Enumeration Type Documentation

◆ status_code_domain_string_ref_thunk_op

Type of a string ref thunk op.

Enumerator
status_code_domain_string_ref_thunk_op_copy 
status_code_domain_string_ref_thunk_op_move 
status_code_domain_string_ref_thunk_op_destruct 

Definition at line 52 of file status_code_domain.h.

Function Documentation

◆ status_code_domain_string_ref_atomic_refcounted_from_buffer()

status_code_domain_string_ref status_code_domain_string_ref_atomic_refcounted_from_buffer ( const char *  s,
size_t  len 
)
extern

Make an atomic refcounted string ref which tracks living copies using an atomic reference count, freeing the internally stored buffer on final destroy. The input range is copied and does not need to be null terminated. Failure to malloc causes a static string ref to be returned with a string like "failed to get message from system".

◆ status_code_domain_unique_id_from_uuid()

status_code_domain_unique_id_type status_code_domain_unique_id_from_uuid ( const char *  uuid)
extern

Parse a uuid input string to yield a status code domain unique id.