GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
chaiscript::ChaiScript Class Reference

#include <chaiscript.hpp>

Inheritance diagram for chaiscript::ChaiScript:
Collaboration diagram for chaiscript::ChaiScript:

Public Member Functions

 ChaiScript (std::vector< std::string > t_modulepaths={}, std::vector< std::string > t_usepaths={}, const std::vector< Options > &t_opts=chaiscript::default_options())
Public Member Functions inherited from chaiscript::ChaiScript_Basic
 ChaiScript_Basic (const ModulePtr &t_lib, std::unique_ptr< parser::ChaiScript_Parser_Base > &&parser, std::vector< std::string > t_module_paths={}, std::vector< std::string > t_use_paths={}, const std::vector< chaiscript::Options > &t_opts=chaiscript::default_options())
 Constructor for ChaiScript.
 ChaiScript_Basic (std::unique_ptr< parser::ChaiScript_Parser_Base > &&parser, std::vector< std::string > t_module_paths={}, std::vector< std::string > t_use_paths={}, const std::vector< chaiscript::Options > &t_opts=chaiscript::default_options())
 Constructor for ChaiScript.
parser::ChaiScript_Parser_Base & get_parser ()
const Boxed_Value eval (const AST_Node &t_ast)
AST_NodePtr parse (const std::string &t_input, const bool t_debug_print=false)
std::string get_type_name (const Type_Info &ti) const
template<typename T>
std::string get_type_name () const
Boxed_Value use (const std::string &t_filename)
 Loads and parses a file. If the file is already, it is not reloaded The use paths specified at ChaiScript construction time are searched for the requested file.
ChaiScript_Basic & add_global_const (const Boxed_Value &t_bv, const std::string &t_name)
 Adds a constant object that is available in all contexts and to all threads.
ChaiScript_Basic & add_global (const Boxed_Value &t_bv, const std::string &t_name)
 Adds a mutable object that is available in all contexts and to all threads.
ChaiScript_Basic & set_global (const Boxed_Value &t_bv, const std::string &t_name)
State get_state () const
 Returns a state object that represents the current state of the global system.
void set_state (const State &t_state)
 Sets the state of the system.
std::map< std::string, Boxed_Value > get_locals () const
void set_locals (const std::map< std::string, Boxed_Value > &t_locals)
 Sets all of the locals for the current thread state.
template<typename T>
ChaiScript_Basic & add (const T &t_t, const std::string &t_name)
 Adds a type, function or object to ChaiScript. Objects are added to the local thread state.
ChaiScript_Basic & add (const Type_Conversion &d)
 Add a new conversion for upcasting to a base class.
ChaiScript_Basic & add (const ModulePtr &t_p)
 Adds all elements of a module to ChaiScript runtime.
std::string load_module (const std::string &t_module_name)
 Load a binary module from a dynamic library. Works on platforms that support dynamic libraries.
void load_module (const std::string &t_module_name, const std::string &t_filename)
 Load a binary module from a dynamic library. Works on platforms that support dynamic libraries.
Boxed_Value operator() (const std::string &t_script, const Exception_Handler &t_handler=Exception_Handler())
 Evaluates a string. Equivalent to ChaiScript::eval.
template<typename T>
T eval (const std::string &t_input, const Exception_Handler &t_handler=Exception_Handler(), const std::string &t_filename="__EVAL__")
 Evaluates a string and returns a typesafe result.
template<typename Type>
decltype(auto) boxed_cast (const Boxed_Value &bv) const
 casts an object while applying any Dynamic_Conversion available
Boxed_Value eval (const std::string &t_input, const Exception_Handler &t_handler=Exception_Handler(), const std::string &t_filename="__EVAL__")
 Evaluates a string.
Boxed_Value eval_file (const std::string &t_filename, const Exception_Handler &t_handler=Exception_Handler())
 Loads the file specified by filename, evaluates it, and returns the result.
template<typename T>
T eval_file (const std::string &t_filename, const Exception_Handler &t_handler=Exception_Handler())
 Loads the file specified by filename, evaluates it, and returns the type safe result.
void import (const std::string &t_namespace_name)
 Imports a namespace object into the global scope of this ChaiScript instance.
void register_namespace (const std::function< void(Namespace &)> &t_namespace_generator, const std::string &t_namespace_name)
 Registers a namespace generator, which delays generation of the namespace until it is imported, saving memory if it is never used.

Constructor & Destructor Documentation

◆ ChaiScript()

chaiscript::ChaiScript::ChaiScript ( std::vector< std::string > t_modulepaths = {},
std::vector< std::string > t_usepaths = {},
const std::vector< Options > & t_opts = chaiscript::default_options() )
inline

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