c++ - How to correctly implement a script parsers exception handling -
i'm having little bit of design problem scripting language i'm creating c++ game engine. i'm trying have object named sscript call method load necessary files, , check script file's suffix. have base class called smessage class named serrormessage derives from. here's example code illustrate want do:
sscript::sscript(const std::string& filepath) { if (load(filepath) == serror(serror::error_codes::error_custom)) { } } smessage& sscript::load(const std::string& filepath) { }
here's header file serror:
class serror : public smessage { public: enum class error_codes { error_custom = 1, error_loading_script = 2, error_script_incorrect_suffix = 3, }; serror(error_codes errorcode); serror(error_codes errorcode, const std::string& contents); virtual void message(const std::string& contents); inline bool operator=(const error_codes errorcode) { } private: serror() {}; error_codes m_error_code; void organizestring(const std::string& contents); };
in sscript::sscript() want call load , compare various smessages or serrormessages. tried implementing operator overload, don't think solve problem. i've sort of hit brick wall, , need serious design rethinking. welcomed , thank much!
Comments
Post a Comment