ChaiScript
Classes | Functions
chaiscript::bootstrap Namespace Reference

Classes and functions useful for bootstrapping of ChaiScript and adding of new types. More...

Classes

class  Bootstrap
 Class consisting of only static functions. More...
 

Functions

template<typename T , typename = typename std::enable_if<std::is_array<T>::value>::type>
void array (const std::string &type, Module &m)
 
template<typename T >
void copy_constructor (const std::string &type, Module &m)
 Adds a copy constructor for the given type to the given Model. More...
 
template<typename T >
void opers_comparison (Module &m)
 Add all comparison operators for the templated type. More...
 
template<typename T >
void basic_constructors (const std::string &type, Module &m)
 Adds default and copy constructors for the given type. More...
 
template<typename T >
void construct_pod (const std::string &type, Module &m)
 Adds a constructor for a POD type. More...
 
template<typename Input >
Input parse_string (const std::string &i)
 Internal function for converting from a string to a value uses ostream operator >> to perform the conversion.
 
template<typename T >
void bootstrap_pod_type (const std::string &name, Module &m)
 Add all common functions for a POD type. More...
 
template<typename Type >
auto shared_ptr_clone (const std::shared_ptr< Type > &p)
 "clone" function for a shared_ptr type. More...
 
template<typename Type >
std::shared_ptr< std::remove_const_t< Type > > shared_ptr_unconst_clone (const std::shared_ptr< std::add_const_t< Type >> &p)
 Specific version of shared_ptr_clone just for Proxy_Functions.
 
template<typename Type >
Boxed_Value ptr_assign (Boxed_Value lhs, const std::shared_ptr< Type > &rhs)
 Assignment function for shared_ptr objects, does not perform a copy of the object pointed to, instead maintains the shared_ptr concept. More...
 

Detailed Description

Classes and functions useful for bootstrapping of ChaiScript and adding of new types.

Function Documentation

§ basic_constructors()

template<typename T >
void chaiscript::bootstrap::basic_constructors ( const std::string &  type,
Module m 
)

Adds default and copy constructors for the given type.

Parameters
[in]typeThe name of the type to add the constructors for.
[in,out]mThe Module to add the basic constructors to
Template Parameters
TType to generate basic constructors for
Returns
The passed in Module
See also
copy_constructor
constructor

§ bootstrap_pod_type()

template<typename T >
void chaiscript::bootstrap::bootstrap_pod_type ( const std::string &  name,
Module m 
)

Add all common functions for a POD type.

All operators, and common conversions

§ construct_pod()

template<typename T >
void chaiscript::bootstrap::construct_pod ( const std::string &  type,
Module m 
)

Adds a constructor for a POD type.

Template Parameters
TThe type to add the constructor for
Parameters
[in]typeThe name of the type
[in,out]mThe Module to add the constructor to

§ copy_constructor()

template<typename T >
void chaiscript::bootstrap::copy_constructor ( const std::string &  type,
Module m 
)

Adds a copy constructor for the given type to the given Model.

Parameters
[in]typeThe name of the type. The copy constructor will be named "type".
[in,out]mThe Module to add the copy constructor to
Template Parameters
TThe type to add a copy constructor for
Returns
The passed in Module

§ opers_comparison()

template<typename T >
void chaiscript::bootstrap::opers_comparison ( Module m)

Add all comparison operators for the templated type.

Used during bootstrap, also available to users.

Template Parameters
TType to create comparison operators for
Parameters
[in,out]mmodule to add comparison operators to
Returns
the passed in Module.

§ ptr_assign()

template<typename Type >
Boxed_Value chaiscript::bootstrap::ptr_assign ( Boxed_Value  lhs,
const std::shared_ptr< Type > &  rhs 
)

Assignment function for shared_ptr objects, does not perform a copy of the object pointed to, instead maintains the shared_ptr concept.

Similar to shared_ptr_clone. Used for Proxy_Function.

§ shared_ptr_clone()

template<typename Type >
auto chaiscript::bootstrap::shared_ptr_clone ( const std::shared_ptr< Type > &  p)

"clone" function for a shared_ptr type.

This is used in the case where you do not want to make a deep copy of an object during cloning but want to instead maintain the shared_ptr. It is needed internally for handling of Proxy_Function object (that is, function variables.