Public Member Functions | |
WxProcessCmdLine () | |
void | Process (wxCmdLineParser &parser) |
Public Attributes | |
std::vector< std::string > | argv |
bool | console |
bool | debug |
bool | quiet |
bool | help |
bool | graphical_dialog |
bool | text_dialog |
bool | no_console |
bool | proceed |
std::map< std::string, std::string > | param_map |
std::vector< std::string > | input_file |
Definition at line 34 of file bbi.cxx.
void WxProcessCmdLine::Process | ( | wxCmdLineParser & | parser | ) |
Definition at line 56 of file bbi.cxx.
References _T, console, debug, bbtk::GetVersion(), graphical_dialog, help, input_file, no_console, param_map, bbtk::StaticInitTime::PrintObjectListInfo, proceed, quiet, bbtk::MessageManager::SetMessageLevel(), text_dialog, and bbtk::wx2std().
Referenced by main(), and wxBBIApp::OnCmdLineParsed().
00057 { 00058 proceed = true; 00059 if (parser.Found(_T("D"))) 00060 { 00061 bbtk::StaticInitTime::PrintObjectListInfo = true; 00062 } 00063 00064 debug = ( parser.Found(_T("d")) ); 00065 quiet = ( parser.Found(_T("q")) ); 00066 help = ( parser.Found(_T("h")) ); 00067 graphical_dialog = ( parser.Found(_T("g")) ); 00068 text_dialog = ( parser.Found(_T("t")) ); 00069 no_console = ( parser.Found(_T("N")) ); 00070 00071 if (quiet) bbtk::MessageManager::SetMessageLevel("max",0); 00072 if (debug) bbtk::MessageManager::SetMessageLevel("all",9); 00073 00074 // parse the arguments and consider those which contain a "=" 00075 // as set input commands, other as files 00076 int pargc = parser.GetParamCount(); 00077 for (int i=0; i<pargc; ++i) 00078 { 00079 std::string s = bbtk::wx2std(parser.GetParam(i)); 00080 std::string::size_type pos = s.find_first_of("="); 00081 if (std::string::npos != pos) 00082 { 00083 std::string left = s.substr(0,pos); 00084 std::string right = s.substr(pos+1,s.size()); 00085 param_map[left]=right; 00086 } 00087 else 00088 { 00089 input_file.push_back(s); 00090 } 00091 } 00092 00093 bool usage = (help && (input_file.size()==0)); 00094 if (usage) { 00095 std::cout << "BBI (The Black Box Interpreter) - bbtk " 00096 << bbtk::GetVersion() << " - (c) Creatis 2007-2008" 00097 << std::endl; 00098 parser.Usage(); 00099 proceed = false; 00100 } 00101 00102 console = ( parser.Found(_T("c")) || 00103 ((input_file.size() == 0) && 00104 (!no_console) && 00105 (!usage) ) ); 00106 00107 }
std::vector<std::string> WxProcessCmdLine::argv |
std::vector<std::string> WxProcessCmdLine::input_file |
std::map<std::string,std::string> WxProcessCmdLine::param_map |