a_arguments.push_back(new Variable(arg1, arg2, type, comment, needValue));
}
+void CommandLine::initialize(const char** argv, const int argc, int positionalArguments)
+throw(RuntimeException) {
+ if (argc < 1) throw RuntimeException("Provided argc < 1 as command-line argv size !", ANNA_FILE_LOCATION);
+ if (positionalArguments < 0) throw RuntimeException("Provided negative number of positional arguments as command-line initializer", ANNA_FILE_LOCATION);
+ if (positionalArguments > (argc-1)) throw RuntimeException("Provided positional arguments > (argc - 1) as command-line initializer", ANNA_FILE_LOCATION);
+ a_positionalArguments = positionalArguments;
+ a_argv = argv;
+ a_argc = argc;
+ a_wasParsed = false;
+}
+
//--------------------------------------------------------------------------------
// Verifica que todos los argumentos declarados como obligatorios estan en la
// linea de comandos.
throw() {
Variable* variable;
bool result = true;
- int i = 1;
+ int i = a_positionalArguments + 1;
string aux;
if(a_wasParsed == true) // already analyzed
vector <Variable*>::const_iterator ii, maxii;
const char *value;
+ for(int pos = 1; pos <= a_positionalArguments; pos++)
+ result += anna::functions::asString("Positional argument [%d]: %s\n", pos, getPositional(pos));
+
for(ii = a_arguments.begin(), maxii = a_arguments.end(); ii != maxii; ii ++) {
value = (*ii)->getValue();
vector <Variable*>::const_iterator ii, maxii;
const char *value;
+ for(int pos = 1; pos <= a_positionalArguments; pos++)
+ result->createAttribute(anna::functions::asString("PositionalArgument_%d", pos).c_str(), getPositional(pos));
+
for(ii = a_arguments.begin(), maxii = a_arguments.end(); ii != maxii; ii ++) {
value = (*ii)->getValue();