X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftimetable.cpp;h=9fd44df6d80a480b6d9eb95e9a3cec1cc82e6550;hb=3e3675f8d86b06cdea7df197dfe8866ffb285aec;hp=a6c624c9658f8ec6dc4eb5a59a04e62e5b7dcea1;hpb=d15ac13f2e170f155b4bbd124df48400c339b644;p=r2c2.git diff --git a/source/libr2c2/timetable.cpp b/source/libr2c2/timetable.cpp index a6c624c..9fd44df 100644 --- a/source/libr2c2/timetable.cpp +++ b/source/libr2c2/timetable.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "block.h" #include "catalogue.h" @@ -55,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) @@ -65,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]; } @@ -187,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); } @@ -263,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(); } @@ -402,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"); }