Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/CommandLineUI/Query/ElementCommandLineQuery.cpp

    rf130d4 r2f429e  
    3636#include "CodePatterns/MemDebug.hpp"
    3737
     38#include <string>
     39
    3840#include "CommandLineUI/Query/CommandLineQuery.hpp"
    3941#include "CommandLineUI/CommandLineParser.hpp"
     
    5456  // TODO: vector of ints and removing first is not correctly implemented yet. How to remove from a vector?
    5557  periodentafel *periode = World::getInstance().getPeriode();
    56   int Z = -1;
    5758  if (CommandLineParser::getInstance().vm.count(getTitle())) {
     59    std::string argument("none");
    5860    try {
    59       Z = CommandLineParser::getInstance().vm[getTitle()].as< int >();
     61      argument = CommandLineParser::getInstance().vm[getTitle()].as< std::string >();
     62      try {
     63        int Z = -1;
     64        Z = boost::lexical_cast<int>(argument);
     65        temp = periode->FindElement(Z);
     66      } catch(boost::bad_lexical_cast &e) {
     67        temp = periode->FindElement(argument);
     68      }
    6069    } catch(boost::bad_any_cast &e) {
    61       Z = -1;
    6270      return false;
    6371    }
    64     temp = periode->FindElement(Z);
    6572    ASSERT(temp != NULL, "Invalid element specified in ElementCommandLineQuery");
    6673    return true;
Note: See TracChangeset for help on using the changeset viewer.