![]() |
MySQL 9.3.0
Source Code Documentation
|
Pointer to a function that may be implemented in any language. More...
#include <jit_executor_value.h>
Classes | |
struct | binary_string |
class | Map_type |
struct | null_value |
Public Types | |
typedef std::vector< Value > | Array_type |
typedef std::shared_ptr< Array_type > | Array_type_ref |
typedef std::shared_ptr< Map_type > | Map_type_ref |
Public Member Functions | |
Value ()=default | |
Value (const Value &)=default | |
Value (Value &&) noexcept=default | |
Value & | operator= (const Value &)=default |
Value & | operator= (Value &&) noexcept=default |
~Value () noexcept=default | |
Value (const std::string &s, bool binary=false) | |
Value (std::string &&s, bool binary=false) | |
Value (const char *) | |
Value (const char *, size_t n, bool binary=false) | |
Value (std::string_view s, bool binary=false) | |
Value (std::wstring_view s) | |
Value (std::nullptr_t) | |
Value (int i) | |
Value (unsigned int ui) | |
Value (int64_t i) | |
Value (uint64_t ui) | |
Value (float f) | |
Value (double d) | |
Value (bool b) | |
Value (const std::shared_ptr< polyglot::Polyglot_object > &o) | |
Value (const std::shared_ptr< polyglot::Object_bridge > &o) | |
Value (const Map_type_ref &n) | |
Value (Map_type_ref &&n) | |
Value (const Array_type_ref &n) | |
Value (Array_type_ref &&n) | |
bool | operator== (const Value &other) const |
bool | operator!= (const Value &other) const |
bool | operator< (const Value &) const =delete |
bool | operator> (const Value &) const =delete |
bool | operator<= (const Value &) const =delete |
bool | operator>= (const Value &) const =delete |
operator bool () const noexcept | |
bool | is_null () const noexcept |
std::string | descr (bool pprint=false) const |
returns a human-readable description text for the value. More... | |
std::string | repr () const |
returns a string representation of the serialized object, suitable to be passed to parse() More... | |
std::string | json (bool pprint=false) const |
returns a JSON representation of the object More... | |
std::string & | append_descr (std::string &s_out, int indent=-1, char quote_strings='\0') const |
returns a YAML representation of the Value More... | |
std::string & | append_repr (std::string &s_out) const |
void | check_type (Value_type t) const |
Value_type | get_type () const noexcept |
bool | as_bool () const |
int64_t | as_int () const |
uint64_t | as_uint () const |
double | as_double () const |
std::string | as_string () const |
std::wstring | as_wstring () const |
const std::string & | get_string () const |
template<class C > | |
std::shared_ptr< C > | as_object_bridge () const |
std::shared_ptr< polyglot::Object_bridge > | as_object_bridge () const |
std::shared_ptr< polyglot::Polyglot_object > | as_object () const |
std::shared_ptr< Map_type > | as_map () const |
std::shared_ptr< Array_type > | as_array () const |
Static Public Member Functions | |
static Value | new_array () |
static Value | new_map () |
static Value | Null () |
static Value | True () |
static Value | False () |
static Value | parse (std::string_view s) |
parse a string returned by repr() back into a Value More... | |
Private Attributes | |
std::variant< std::monostate, null_value, bool, std::string, binary_string, int64_t, uint64_t, double, std::shared_ptr< polyglot::Polyglot_object >, std::shared_ptr< polyglot::Object_bridge >, std::shared_ptr< Array_type >, std::shared_ptr< Map_type > > | m_value |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Value &v) |
Pointer to a function that may be implemented in any language.
A generic value that can be used from any language we support.
Anything that can be represented using this can be passed as a parameter to scripting functions or stored in the internal registry or anywhere. If serializable types are used, then they may also be stored as a JSON document.
Values are exposed to scripting languages according to the following rules:
Example: JS Date object is converted to a C++ Date object and vice-versa, but Mysql_connection is wrapped generically
Null Bool String Integer UInteger Float Object Array Map
Null OK - - - - - OK OK OK Bool - OK - OK OK OK - - - String - OK OK OK OK OK - - - Integer - OK - OK OK OK - - - UInteger - OK - OK OK OK - - - Float - OK - OK OK OK - - - Object - - - - - - OK - - Array - - - - - - - OK - Map - - - - - - - - OK
Integer <-> UInteger conversions are only possible if the range allows it Null can be cast to Object/Array/Map, but a valid Object/Array/Map pointer is not NULL, so it can't be cast to it.
typedef std::vector<Value> shcore::Value::Array_type |
typedef std::shared_ptr<Array_type> shcore::Value::Array_type_ref |
typedef std::shared_ptr<Map_type> shcore::Value::Map_type_ref |
|
default |
|
default |
|
defaultnoexcept |
|
defaultnoexcept |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
std::string & shcore::Value::append_descr | ( | std::string & | s_out, |
int | indent = -1 , |
||
char | quote_strings = '\0' |
||
) | const |
returns a YAML representation of the Value
std::string & shcore::Value::append_repr | ( | std::string & | s_out | ) | const |
|
inline |
bool shcore::Value::as_bool | ( | ) | const |
double shcore::Value::as_double | ( | ) | const |
int64_t shcore::Value::as_int | ( | ) | const |
|
inline |
std::shared_ptr< polyglot::Polyglot_object > shcore::Value::as_object | ( | ) | const |
|
inline |
std::shared_ptr< polyglot::Object_bridge > shcore::Value::as_object_bridge | ( | ) | const |
std::string shcore::Value::as_string | ( | ) | const |
uint64_t shcore::Value::as_uint | ( | ) | const |
std::wstring shcore::Value::as_wstring | ( | ) | const |
void shcore::Value::check_type | ( | Value_type | t | ) | const |
std::string shcore::Value::descr | ( | bool | pprint = false | ) | const |
returns a human-readable description text for the value.
|
inlinestatic |
|
inline |
|
noexcept |
|
inlinenoexcept |
std::string shcore::Value::json | ( | bool | pprint = false | ) | const |
returns a JSON representation of the object
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlineexplicitnoexcept |
|
inline |
|
delete |
|
delete |
bool shcore::Value::operator== | ( | const Value & | other | ) | const |
|
delete |
|
delete |
|
static |
parse a string returned by repr() back into a Value
std::string shcore::Value::repr | ( | ) | const |
returns a string representation of the serialized object, suitable to be passed to parse()
|
inlinestatic |
|
friend |
|
private |