cgv
Loading...
Searching...
No Matches
io_reflection_handler.cxx
1#include "io_reflection_handler.h"
2#include <cgv/utils/scan.h>
3
4using namespace cgv::reflect;
5
6namespace cgv {
7 namespace data {
8
9enum_reflection_traits<IOReflectionError> get_reflection_traits(const IOReflectionError&) {
10 return enum_reflection_traits<IOReflectionError>("RE_NO_ERROR, RE_FILE_OPEN_ERROR, RE_FILE_READ_ERROR, RE_FILE_WRITE_ERROR, RE_CONTENT_MISMATCH, RE_VERSION_MISMATCH");
11}
12
13io_reflection_handler::io_reflection_handler(const std::string& _content, unsigned _ver)
14{
15 file_content = _content;
16 version = _ver;
17 in_header = false;
18 last_error = RE_NO_ERROR;
19}
20
22bool io_reflection_handler::failed() const
23{
24 return last_error != RE_NO_ERROR;
25}
27IOReflectionError io_reflection_handler::get_error_code() const
28{
29 return last_error;
30}
32std::string io_reflection_handler::get_error_message(IOReflectionError re)
33{
34 static const char* error_messages[] =
35 {
36 "success",
37 "file open error",
38 "file read error",
39 "file write error",
40 "content mismatch",
41 "version mismatch"
42 };
43 return error_messages[re];
44}
45
47bool io_reflection_handler::reflect_method_void(const std::string& method_name, method_interface* mi_ptr,
48 abst_reflection_traits* return_traits, const std::vector<abst_reflection_traits*>& param_value_traits)
49{
50 return true;
51}
52
53
54
55 }
56}
57
bool reflect_method_void(const std::string &method_name, cgv::reflect::method_interface *mi_ptr, cgv::reflect::abst_reflection_traits *return_traits, const std::vector< cgv::reflect::abst_reflection_traits * > &param_value_traits)
abstract interface to reflect a method, where return and parameter types are specified as strings.
namespace for data management components
IOReflectionError
different error codes
in this namespace reflection of types is implemented
this header is dependency free
Definition print.h:11
Helper functions to process strings.
abstract interface for type reflection with basic type management and optional string conversion
abstract interface to call a method of a given instance.