X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftimetable.cpp;h=9fd44df6d80a480b6d9eb95e9a3cec1cc82e6550;hb=66c2c7ca5a4bd369293959bc211b040834343381;hp=dcdbb00bbc66c5f78dd21fcd4cb426131d6b3171;hpb=942be2d4b6e5330101c2618f13b2693b9c71d56e;p=r2c2.git diff --git a/source/libr2c2/timetable.cpp b/source/libr2c2/timetable.cpp index dcdbb00..9fd44df 100644 --- a/source/libr2c2/timetable.cpp +++ b/source/libr2c2/timetable.cpp @@ -1,11 +1,4 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - -#include +#include #include #include "block.h" #include "catalogue.h" @@ -62,7 +55,7 @@ void Timetable::append(const Row &row) void Timetable::insert(unsigned i, const Row &row) { if(i>rows.size()) - throw InvalidParameterValue("Insert position out of range"); + throw out_of_range("Timetable::insert"); rows.insert(rows.begin()+i, row); if(i<=current_row) @@ -72,7 +65,7 @@ void Timetable::insert(unsigned i, const Row &row) const Timetable::Row &Timetable::get_row(unsigned i) const { if(i>=rows.size()) - throw InvalidParameterValue("Row index out of range"); + throw out_of_range("Timetable::get_row"); return rows[i]; } @@ -194,7 +187,7 @@ Zone &Timetable::get_zone(const string &name) { string::size_type space = name.rfind(' '); if(space==string::npos || space==0) - throw InvalidParameterValue("Invalid zone name"); + throw invalid_argument("Timetable::get_zone"); unsigned number = lexical_cast(name.substr(space+1)); return train.get_layout().get_zone(name.substr(0, space), number); } @@ -270,7 +263,7 @@ template const T &Timetable::Row::get_param(unsigned i) const { if(i>=params.size()) - throw InvalidParameterValue("Parameter index out of range"); + throw out_of_range("Timetable::Row::get_param"); return params[i].value(); } @@ -409,7 +402,7 @@ Timetable::Row Timetable::Row::parse(const string &s) return Row(ROUTE, s.substr(10)); } - throw InvalidParameterValue("Invalid row"); + throw invalid_argument("Timetable::Row::parse"); }