X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Fcore%2Futil%2FCommandLine.cpp;fp=source%2Fcore%2Futil%2FCommandLine.cpp;h=42dfd176b3e71b8ec7490eeb0fbfd64553ced883;hp=85d171d7d93784b28bfa2ec580ca5e49ec9ba065;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/source/core/util/CommandLine.cpp b/source/core/util/CommandLine.cpp index 85d171d..42dfd17 100644 --- a/source/core/util/CommandLine.cpp +++ b/source/core/util/CommandLine.cpp @@ -24,7 +24,7 @@ using namespace anna; // (1) Verifica que la opcion no haya sido registrada previamente. //-------------------------------------------------------------------------------- void CommandLine::add(const char* argumentExpression, Argument::Type type, const char* comment, const bool needValue) -throw() { +{ Guard guard(a_mutex, "CommandLine::add"); std::string arg1 = "", arg2 = ""; @@ -62,7 +62,7 @@ throw() { } void CommandLine::initialize(const char** argv, const int argc, int positionalArguments) -throw(RuntimeException) { +noexcept(false) { 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); @@ -77,7 +77,7 @@ throw(RuntimeException) { // linea de comandos. //-------------------------------------------------------------------------------- void CommandLine::verify() -throw(RuntimeException) { +noexcept(false) { if(a_argv == NULL) throw RuntimeException("CommandLine was not initialized", ANNA_FILE_LOCATION); @@ -103,7 +103,7 @@ throw(RuntimeException) { // Si el arguemento solicitado no esta en la LC y es opcional devolvera NULL. //-------------------------------------------------------------------------------- const char* CommandLine::getValue(const char* argumentExpression, const bool exitOnFault) -throw() { +{ const char* result = NULL; const Variable* argument = NULL; bool error = true; @@ -142,7 +142,7 @@ throw() { // Auxiliary function: // Returns first no-leading hyphen position -int removeLeadingHyphens(std::string &argv) throw() { +int removeLeadingHyphens(std::string &argv) { int startPos = -1; // Move until no hyphen: for (int i=0; i < argv.size(); i++) @@ -169,7 +169,7 @@ int removeLeadingHyphens(std::string &argv) throw() { // Analize command line to store the arguments //-------------------------------------------------------------------------------- bool CommandLine::analize() -throw() { +{ Variable* variable; bool result = true; int i = a_positionalArguments + 1; @@ -212,7 +212,7 @@ throw() { } const CommandLine::Variable* CommandLine::search(const char *argumentExpression) const -throw() { +{ if (!argumentExpression) return NULL; std::string name1, name2, arg; @@ -238,7 +238,7 @@ throw() { } string CommandLine::Variable::getHelpExpression() const -throw() { +{ std::string long_name, short_name, result = ""; int s1 = a_name1.size(); @@ -266,7 +266,7 @@ throw() { } void CommandLine::printUsage() const -throw() { +{ int i, maxi(a_arguments.size()); cout << "Usage: " << a_argv [0] << " "; @@ -282,7 +282,7 @@ throw() { } string CommandLine::Variable::asString() const -throw() { +{ string result; result = ((a_type == Argument::Optional) ? "[ " : ""); result += getHelpExpression(); @@ -293,7 +293,7 @@ throw() { } string CommandLine::asString() const -throw() { +{ string result = "Provided command-line parameters:\n\n"; vector ::const_iterator ii, maxii; const char *value; @@ -315,7 +315,7 @@ throw() { return result; } -xml::Node* CommandLine::asXML(xml::Node* parent) const throw() { +xml::Node* CommandLine::asXML(xml::Node* parent) const { xml::Node* result = parent->createChild("CommandLine"); vector ::const_iterator ii, maxii; const char *value;