00001
00002
00003
00004
00005
00006
00007
00008 #ifndef incREFLECT_JSCRIPT_OBJECT_NAVIGATOR
00009 #define incREFLECT_JSCRIPT_OBJECT_NAVIGATOR
00010
00011
00012 #include "object_navigator.hpp"
00013
00014 namespace ph {
00015 namespace common {
00016 class object_base;
00017 };
00018 namespace reflect {
00019
00020 class REFLECT_DECL jscript_object_navigator : public object_navigator
00021
00022
00023
00024 {
00025 public:
00026 jscript_object_navigator(const ph::common::object_base *root, std::ostream *console, bool silent=false, bool debug=false) :
00027 object_navigator(root, console), _silent(silent), _debug(debug)
00028 {};
00029
00030
00031 virtual ph::common::object_base *navigate(const ph::common::object_base *obj, const std::string &path);
00032
00033 private:
00034 bool _silent;
00035 bool _debug;
00036
00037 const ph::common::object_base *get_sub_object(const ph::common::object_base *parent, const std::string &path);
00038 int find_span_quotes(const std::string &s, char c);
00039 void error(const std::string &msg, const std::string &name);
00040 const ph::common::object_base *skip_composite(const ph::common::object_base *obj);
00041 const ph::common::object_base *go_parent(const ph::common::object_base *obj);
00042 const ph::common::object_base *get_composite(const ph::common::object_base *obj, const std::string &name);
00043 const ph::common::object_base *get_obj(const ph::common::object_base *obj, const std::string &name);
00044 const ph::common::object_base *get_nth_obj(const ph::common::object_base *obj, int n);
00045 };
00046
00047 class REFLECT_DECL jscript_object_navigator_factory : public object_navigator_factory
00048 {
00049 public:
00050 jscript_object_navigator_factory(std::ostream *console, bool silent=false, bool debug=false) :
00051 object_navigator_factory(console), _silent(silent), _debug(debug)
00052 {};
00053
00054
00055 virtual object_navigator *create(const ph::common::object_base *root);
00056
00057 private:
00058 bool _silent;
00059 bool _debug;
00060 };
00061
00062 };
00063 };
00064
00065 #endif // incREFLECT_JSCRIPT_OBJECT_NAVIGATOR