@tool : handle_args |
Handle the arguments list from the command line. The arguments are in the form of "name=value" pairs which are used to replace values inside the "tool" object declarations for each run.
Any other method of any other object can call this method. This is called 'public' access.
All other objects can call this method without having an instance of this object. This is called 'global' scope. In Some languages, this would be a "static" method.
The data-type returned is "booltype"; Returns true if the function is successful.
This method is contained in the object "@tool".
The method takes the following arguments:
argc : inttype
The argument count.
argv : chararrayptrtype
The argument vector.
params : stringmapptrtype
The parameters.
The files "iostream" are included.
Handle arguments passed frm the command line.
if (argc < 2) { std::cout << "usage: " << argv[0] << " tool_input.xml [member=value]" << std::endl; std::cout << std::endl; return false; } // for all other arguments, set the member values for the tool. if (argc > 2) { for (int i=2; i<argc; i++) { std::string s(argv[i]); int equal = s.find('='); if (equal >= 0) { std::string member(s.substr(0, equal)); std::string value(s.substr(equal+1)); (*params)[member] = value; } else { std::cout << "usage: " << argv[0] << " tool_input.xml [member=value]" << std::endl; std::cout << std::endl; return false; } } } return true;