Classes | |
class | file_not_found_exception |
class | syntax_error |
class | execution_failure |
class | ambiguous_overload_exception |
class | no_matching_function_exception |
class | unknown_type_exception |
class | undefined_global_exception |
class | redefined_global_exception |
class | bad_extended_val_cast |
class | execution_context |
Stores methods/constructors/functions, types and global variables for an eval program. More... | |
class | null_ptr_exception |
class | arity_mismatch_exception |
Exception can be prevent by checking fwrap.arity(). More... | |
class | arg_info |
class | fwrap |
A generic class for wrapping functions, methods and constructors. More... | |
class | bad_val_cast |
class | non_numeric_exception |
class | overflow_exception |
class | non_ostreamable_exception |
class | empty_exception |
Namespaces | |
namespace | detail |
Typedefs | |
typedef std::vector< val > | fwrap_args |
typedef boost::intmax_t | large_int |
Used as a return value, when trying to convert an eval::val to int. | |
typedef long double | large_double |
Used as a return value when trying to convert an eval::val to double. | |
typedef detail::val | val |
Enumerations | |
enum | fwrap_fn_type { FWRAP_CONST_METHOD = 1, FWRAP_METHOD, FWRAP_CONSTRUCTOR, FWRAP_FUNCTION } |
enum | ownership_type_nocopy { UNMANAGED_PTR = 1, TRANSFER_OWNERSHIP, TRANSFER_OWNERSHIP_ARRAY } |
enum | ownership_type_shared_ptr { SHARED_PTR = 100 } |
enum | ownership_type_shared_array { SHARED_ARRAY = 200 } |
enum | ownership_type_copy { COPY_VALUE = 300 } |
Functions | |
void | eval (execution_context &e, const char *code) |
Evaluates the text within the given execution context. | |
void | eval_file (execution_context &e, const char *filename) |
Calls eval() with the contents of the file. | |
template<typename DesiredT> | |
const DesiredT * | val_cast_ptr (const val &v) |
template<typename DesiredT> | |
DesiredT * | val_cast_ptr (val &v) |
typedef std::vector<val> eval::fwrap_args |
We may define a fwrap_args class at some stage. (To maintain constness of vals. The caller could use this to ensure some vals are not modified, even if they refer to non-const underlying objects.)
typedef long double eval::large_double |
Used as a return value when trying to convert an eval::val to double.
typedef boost::intmax_t eval::large_int |
Used as a return value, when trying to convert an eval::val to int.
typedef detail::val eval::val |
The val class is declared in namespace eval::detail, since this makes it easier to declare its friend functions in the eval::detail namespace, which otherwise does not seem possible.
enum eval::fwrap_fn_type |
void eval::eval | ( | execution_context & | e, | |
const char * | code | |||
) | [inline] |
Evaluates the text within the given execution context.
That is, parses the text as eval code and calls appropriate methods on e
. Note that eval code is essentially just a very small subset of C++; method, function and constructor calls, as well as << and >> operators are currently supported. Furthermore, new variables of type val may be created, which will be accessible in the execution context when the method returns. (Note that variable declarations currently must be on a line by themselves.) Assignment/access to globals in e
is possible.
eval::syntax_error | ||
eval::unknown_type_exception | when calling a method on an unknown type | |
eval::no_matching_function_exception | ||
eval::ambiguous_overload_exception | ||
eval::undefined_global_exception | ||
eval::redefined_global_exception |
void eval::eval_file | ( | execution_context & | e, | |
const char * | filename | |||
) | [inline] |
Calls eval() with the contents of the file.
file_not_found_exception | if any IO error occurs. |
DesiredT* eval::val_cast_ptr | ( | val & | v | ) | [inline] |
Attempts to return a pointer of type DesiredT
, to the value stored in v
.
DesiredT
should not be a reference. bad_val_cast | if DesiredT does not exactly match the actual type. |
const DesiredT* eval::val_cast_ptr | ( | const val & | v | ) | [inline] |
Attempts to return a const pointer of type DesiredT
, to the value stored in v
.
DesiredT
should not be a reference. bad_val_cast | if DesiredT does not exactly match the actual type. |