lcpex rewrite - alpha
This commit is contained in:
1 parent
bb85754dc0
commit
7ed6e13fa5
82 files changed
+4510
-2592
No files matched your search
@@ -0,0 +1,64 @@
|
||||
#include "shells.h"
|
||||
|
||||
class ShellException: public std::exception
|
||||
{
|
||||
public:
|
||||
explicit ShellException(const char* message):
|
||||
msg_(message)
|
||||
{}
|
||||
|
||||
explicit ShellException(const std::string& message):
|
||||
msg_(message)
|
||||
{}
|
||||
|
||||
virtual ~ShellException() throw (){}
|
||||
|
||||
virtual const char* what() const throw (){
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string msg_;
|
||||
};
|
||||
|
||||
|
||||
Shell::Shell(int LOG_LEVEL): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "_shell" )
|
||||
{
|
||||
this->LOG_LEVEL = LOG_LEVEL;
|
||||
}
|
||||
|
||||
|
||||
int Shell::load_root( Json::Value loader_root )
|
||||
{
|
||||
// TODO this needs reworked to have errmsg actually end up as a null return from json::value.get()
|
||||
std::string errmsg = "SOMETHING WENT TERRIBLY WRONG IN PARSING";
|
||||
|
||||
if ( loader_root.isMember("name") )
|
||||
{
|
||||
this->name = loader_root.get( "name", errmsg ).asString();
|
||||
} else {
|
||||
throw ShellException("No name attribute specified when loading a shell definition.");
|
||||
}
|
||||
|
||||
if ( loader_root.isMember("path") )
|
||||
{
|
||||
this->path = loader_root.get( "path", errmsg ).asString();
|
||||
} else {
|
||||
throw ShellException("No path attribute specified when loading a shell definition.");
|
||||
}
|
||||
|
||||
if ( loader_root.isMember("execution_arg") )
|
||||
{
|
||||
this->execution_arg = loader_root.get( "execution_arg", errmsg ).asString();
|
||||
} else {
|
||||
throw ShellException("No execution_arg attribute specified when loading a shell definition.");
|
||||
}
|
||||
|
||||
if ( loader_root.isMember("execution_arg") )
|
||||
{
|
||||
this->execution_arg = loader_root.get( "execution_arg", errmsg ).asString();
|
||||
} else {
|
||||
throw ShellException("No execution_arg attribute specified when loading a shell definition.");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef REX_SHELLS_H
|
||||
#define REX_SHELLS_H
|
||||
|
||||
#include "../json_support/JSON.h"
|
||||
#include <string>
|
||||
|
||||
class Shell: public JSON_Loader {
|
||||
public:
|
||||
Shell( int LOG_LEVEL );
|
||||
int load_root( Json::Value loader_root );
|
||||
|
||||
std::string name;
|
||||
std::string path;
|
||||
std::string execution_arg;
|
||||
std::string source_cmd;
|
||||
|
||||
private:
|
||||
std::string shell_definitions_path;
|
||||
|
||||
int LOG_LEVEL;
|
||||
Logger slog;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //REX_SHELLS_H
|
||||
Reference in new issue
Block a user