GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
chaiscript_stdlib.hpp
Go to the documentation of this file.
1// This file is distributed under the BSD License.
2// See "license.txt" for details.
3// Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
4// and Jason Turner (jason@emptycrate.com)
5// http://www.chaiscript.com
6
7#ifndef CHAISCRIPT_STDLIB_HPP_
8#define CHAISCRIPT_STDLIB_HPP_
9
10#include <map>
11#include <memory>
12#include <string>
13#include <utility>
14#include <vector>
15
18
20
21//#include "dispatchkit/dispatchkit.hpp"
25//#include "dispatchkit/boxed_value.hpp"
28#include "utility/json_wrap.hpp"
29
30#ifndef CHAISCRIPT_NO_THREADS
31#include <future>
32#endif
33
34
38
39namespace chaiscript
40{
41 class Std_Lib
42 {
43 public:
44
46 {
47 auto lib = std::make_shared<Module>();
49
54
55#ifndef CHAISCRIPT_NO_THREADS
57 lib->add(chaiscript::fun([](const std::function<chaiscript::Boxed_Value ()> &t_func){ return std::async(std::launch::async, t_func);}), "async");
58#endif
59
61
62 lib->eval(ChaiScript_Prelude::chaiscript_prelude() /*, "standard prelude"*/ );
63
64 return lib;
65 }
66
67 };
68}
69
70#endif
71
A wrapper for holding any valid C++ type. All types in ChaiScript are Boxed_Value objects.
Definition boxed_value.hpp:28
Definition chaiscript_stdlib.hpp:42
static ModulePtr library()
Definition chaiscript_stdlib.hpp:45
static void bootstrap(Module &m)
perform all common bootstrap functions for std::string, void and POD types
Definition bootstrap.hpp:338
static Module & library(Module &m)
Definition json_wrap.hpp:12
void vector_type(const std::string &type, Module &m)
Definition bootstrap_stl.hpp:589
void map_type(const std::string &type, Module &m)
Definition bootstrap_stl.hpp:528
void future_type(const std::string &type, Module &m)
Definition bootstrap_stl.hpp:697
void string_type(const std::string &type, Module &m)
Definition bootstrap_stl.hpp:643
void pair_type(const std::string &type, Module &m)
Definition bootstrap_stl.hpp:457
Namespace chaiscript contains every API call that the average user will be concerned with.
Proxy_Function fun(const T &t)
Creates a new Proxy_Function object from a free function, member function or data member.
Definition register_function.hpp:43
std::shared_ptr< Module > ModulePtr
Convenience typedef for Module objects to be added to the ChaiScript runtime.
Definition dispatchkit.hpp:263
static std::string chaiscript_prelude()
Definition chaiscript_prelude.hpp:12