liblloyal 1.0.0
Composable primitives for llama.cpp inference
Loading...
Searching...
No Matches
minja::Value Class Reference

#include <minja.hpp>

Inheritance diagram for minja::Value:

Public Types

using CallableType = std::function< Value(const std::shared_ptr< Context > &, ArgumentsValue &)>
 
using FilterType = std::function< Value(const std::shared_ptr< Context > &, ArgumentsValue &)>
 

Public Member Functions

 Value ()
 
 Value (const bool &v)
 
 Value (const int64_t &v)
 
 Value (const double &v)
 
 Value (const std::nullptr_t &)
 
 Value (const std::string &v)
 
 Value (const char *v)
 
 Value (const json &v)
 
std::vector< Valuekeys ()
 
size_t size () const
 
void insert (size_t index, const Value &v)
 
void push_back (const Value &v)
 
Value pop (const Value &index)
 
Value get (const Value &key)
 
void set (const Value &key, const Value &value)
 
Value call (const std::shared_ptr< Context > &context, ArgumentsValue &args) const
 
bool is_object () const
 
bool is_array () const
 
bool is_callable () const
 
bool is_null () const
 
bool is_boolean () const
 
bool is_number_integer () const
 
bool is_number_float () const
 
bool is_number () const
 
bool is_string () const
 
bool is_iterable () const
 
bool is_primitive () const
 
bool is_hashable () const
 
bool empty () const
 
void for_each (const std::function< void(Value &)> &callback) const
 
bool to_bool () const
 
int64_t to_int () const
 
bool operator< (const Value &other) const
 
bool operator>= (const Value &other) const
 
bool operator> (const Value &other) const
 
bool operator<= (const Value &other) const
 
bool operator== (const Value &other) const
 
bool operator!= (const Value &other) const
 
bool contains (const char *key) const
 
bool contains (const std::string &key) const
 
bool contains (const Value &value) const
 
void erase (size_t index)
 
void erase (const std::string &key)
 
const Valueat (const Value &index) const
 
Valueat (const Value &index)
 
const Valueat (size_t index) const
 
Valueat (size_t index)
 
template<typename T >
get (const std::string &key, T default_value) const
 
template<typename T >
get () const
 
std::string dump (int indent=-1, bool to_json=false) const
 
Value operator- () const
 
std::string to_str () const
 
Value operator+ (const Value &rhs) const
 
Value operator- (const Value &rhs) const
 
Value operator* (const Value &rhs) const
 
Value operator/ (const Value &rhs) const
 
Value operator% (const Value &rhs) const
 
template<>
json get () const
 

Static Public Member Functions

static Value array (const std::vector< Value > values={})
 
static Value object (const std::shared_ptr< ObjectType > object=std::make_shared< ObjectType >())
 
static Value callable (const CallableType &callable)
 

Detailed Description

Definition at line 58 of file minja.hpp.

Member Typedef Documentation

◆ CallableType

using minja::Value::CallableType = std::function<Value(const std::shared_ptr<Context> &, ArgumentsValue &)>

Definition at line 60 of file minja.hpp.

◆ FilterType

using minja::Value::FilterType = std::function<Value(const std::shared_ptr<Context> &, ArgumentsValue &)>

Definition at line 61 of file minja.hpp.

Constructor & Destructor Documentation

◆ Value() [1/8]

minja::Value::Value ( )
inline

Definition at line 150 of file minja.hpp.

◆ Value() [2/8]

minja::Value::Value ( const bool v)
inline

Definition at line 151 of file minja.hpp.

◆ Value() [3/8]

minja::Value::Value ( const int64_t v)
inline

Definition at line 152 of file minja.hpp.

◆ Value() [4/8]

minja::Value::Value ( const double v)
inline

Definition at line 153 of file minja.hpp.

◆ Value() [5/8]

minja::Value::Value ( const std::nullptr_t &  )
inline

Definition at line 154 of file minja.hpp.

◆ Value() [6/8]

minja::Value::Value ( const std::string &  v)
inline

Definition at line 155 of file minja.hpp.

◆ Value() [7/8]

minja::Value::Value ( const char v)
inline

Definition at line 156 of file minja.hpp.

◆ Value() [8/8]

minja::Value::Value ( const json v)
inline

Definition at line 158 of file minja.hpp.

Member Function Documentation

◆ array()

static Value minja::Value::array ( const std::vector< Value values = {})
inlinestatic

Definition at line 192 of file minja.hpp.

◆ at() [1/4]

Value & minja::Value::at ( const Value index)
inline

Definition at line 419 of file minja.hpp.

◆ at() [2/4]

const Value & minja::Value::at ( const Value index) const
inline

Definition at line 416 of file minja.hpp.

◆ at() [3/4]

Value & minja::Value::at ( size_t  index)
inline

Definition at line 428 of file minja.hpp.

◆ at() [4/4]

const Value & minja::Value::at ( size_t  index) const
inline

Definition at line 425 of file minja.hpp.

◆ call()

Value minja::Value::call ( const std::shared_ptr< Context > &  context,
ArgumentsValue args 
) const
inline

Definition at line 268 of file minja.hpp.

◆ callable()

static Value minja::Value::callable ( const CallableType callable)
inlinestatic

Definition at line 202 of file minja.hpp.

◆ contains() [1/3]

bool minja::Value::contains ( const char key) const
inline

Definition at line 383 of file minja.hpp.

◆ contains() [2/3]

bool minja::Value::contains ( const std::string &  key) const
inline

Definition at line 384 of file minja.hpp.

◆ contains() [3/3]

bool minja::Value::contains ( const Value value) const
inline

Definition at line 393 of file minja.hpp.

◆ dump()

std::string minja::Value::dump ( int  indent = -1,
bool  to_json = false 
) const
inline

Definition at line 448 of file minja.hpp.

◆ empty()

bool minja::Value::empty ( ) const
inline

Definition at line 287 of file minja.hpp.

◆ erase() [1/2]

void minja::Value::erase ( const std::string &  key)
inline

Definition at line 412 of file minja.hpp.

◆ erase() [2/2]

void minja::Value::erase ( size_t  index)
inline

Definition at line 408 of file minja.hpp.

◆ for_each()

void minja::Value::for_each ( const std::function< void(Value &)> &  callback) const
inline

Definition at line 296 of file minja.hpp.

◆ get() [1/4]

template<typename T >
T minja::Value::get ( ) const
inline

Definition at line 443 of file minja.hpp.

◆ get() [2/4]

template<>
json minja::Value::get ( ) const
inline

Definition at line 544 of file minja.hpp.

◆ get() [3/4]

template<typename T >
T minja::Value::get ( const std::string &  key,
default_value 
) const
inline

Definition at line 437 of file minja.hpp.

◆ get() [4/4]

Value minja::Value::get ( const Value key)
inline

Definition at line 248 of file minja.hpp.

◆ insert()

void minja::Value::insert ( size_t  index,
const Value v 
)
inline

Definition at line 206 of file minja.hpp.

◆ is_array()

bool minja::Value::is_array ( ) const
inline

Definition at line 274 of file minja.hpp.

◆ is_boolean()

bool minja::Value::is_boolean ( ) const
inline

Definition at line 277 of file minja.hpp.

◆ is_callable()

bool minja::Value::is_callable ( ) const
inline

Definition at line 275 of file minja.hpp.

◆ is_hashable()

bool minja::Value::is_hashable ( ) const
inline

Definition at line 285 of file minja.hpp.

◆ is_iterable()

bool minja::Value::is_iterable ( ) const
inline

Definition at line 282 of file minja.hpp.

◆ is_null()

bool minja::Value::is_null ( ) const
inline

Definition at line 276 of file minja.hpp.

◆ is_number()

bool minja::Value::is_number ( ) const
inline

Definition at line 280 of file minja.hpp.

◆ is_number_float()

bool minja::Value::is_number_float ( ) const
inline

Definition at line 279 of file minja.hpp.

◆ is_number_integer()

bool minja::Value::is_number_integer ( ) const
inline

Definition at line 278 of file minja.hpp.

◆ is_object()

bool minja::Value::is_object ( ) const
inline

Definition at line 273 of file minja.hpp.

◆ is_primitive()

bool minja::Value::is_primitive ( ) const
inline

Definition at line 284 of file minja.hpp.

◆ is_string()

bool minja::Value::is_string ( ) const
inline

Definition at line 281 of file minja.hpp.

◆ keys()

std::vector< Value > minja::Value::keys ( )
inline

Definition at line 176 of file minja.hpp.

◆ object()

static Value minja::Value::object ( const std::shared_ptr< ObjectType >  object = std::make_shared<ObjectType>())
inlinestatic

Definition at line 199 of file minja.hpp.

◆ operator!=()

bool minja::Value::operator!= ( const Value other) const
inline

Definition at line 381 of file minja.hpp.

◆ operator%()

Value minja::Value::operator% ( const Value rhs) const
inline

Definition at line 507 of file minja.hpp.

◆ operator*()

Value minja::Value::operator* ( const Value rhs) const
inline

Definition at line 488 of file minja.hpp.

◆ operator+()

Value minja::Value::operator+ ( const Value rhs) const
inline

Definition at line 468 of file minja.hpp.

◆ operator-() [1/2]

Value minja::Value::operator- ( ) const
inline

Definition at line 454 of file minja.hpp.

◆ operator-() [2/2]

Value minja::Value::operator- ( const Value rhs) const
inline

Definition at line 482 of file minja.hpp.

◆ operator/()

Value minja::Value::operator/ ( const Value rhs) const
inline

Definition at line 501 of file minja.hpp.

◆ operator<()

bool minja::Value::operator< ( const Value other) const
inline

Definition at line 341 of file minja.hpp.

◆ operator<=()

bool minja::Value::operator<= ( const Value other) const
inline

Definition at line 357 of file minja.hpp.

◆ operator==()

bool minja::Value::operator== ( const Value other) const
inline

Definition at line 359 of file minja.hpp.

◆ operator>()

bool minja::Value::operator> ( const Value other) const
inline

Definition at line 350 of file minja.hpp.

◆ operator>=()

bool minja::Value::operator>= ( const Value other) const
inline

Definition at line 348 of file minja.hpp.

◆ pop()

Value minja::Value::pop ( const Value index)
inline

Definition at line 216 of file minja.hpp.

◆ push_back()

void minja::Value::push_back ( const Value v)
inline

Definition at line 211 of file minja.hpp.

◆ set()

void minja::Value::set ( const Value key,
const Value value 
)
inline

Definition at line 263 of file minja.hpp.

◆ size()

size_t minja::Value::size ( ) const
inline

Definition at line 185 of file minja.hpp.

◆ to_bool()

bool minja::Value::to_bool ( ) const
inline

Definition at line 318 of file minja.hpp.

◆ to_int()

int64_t minja::Value::to_int ( ) const
inline

Definition at line 327 of file minja.hpp.

◆ to_str()

std::string minja::Value::to_str ( ) const
inline

Definition at line 460 of file minja.hpp.


The documentation for this class was generated from the following file: