std::string suPHP::CommandLine::getArgument(int pos) const
throw (OutOfRangeException) {
+ if (pos >= this->arguments.size() || pos < 0) {
+ throw OutOfRangeException("Index out of range", __FILE__, __LINE__);
+ }
try {
- return this->arguments.at(pos);
+ return this->arguments[pos];
} catch (std::out_of_range& e) {
throw OutOfRangeException("Index out of range", __FILE__, __LINE__);
}
this->arguments.push_back(std::string(""));
}
}
- this->arguments.at(pos) = arg;
+ this->arguments[pos] = arg;
}
void suPHP::CommandLine::putArgument(std::string arg) {
std::string& suPHP::CommandLine::operator[](int index)
throw (OutOfRangeException) {
+ if (index >= this->arguments.size() || index < 0) {
+ throw OutOfRangeException("Index out of range", __FILE__, __LINE__);
+ }
try {
- return this->arguments.at(index);
+ return this->arguments[index];
} catch (std::out_of_range& ex) {
throw OutOfRangeException("Index out of range", __FILE__, __LINE__);
}