X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Froute.h;h=5ea86be167781d3f4ca4b400b5f20bb3207c5a3c;hb=a20b8421d002629a9f4d97c0c378e9f9cb29e292;hp=86a0f61780e1423ec68a1644f160f77bb9e55bb2;hpb=1ff06c5bc46a677fa389ef86c6b26664368f1653;p=r2c2.git diff --git a/source/libr2c2/route.h b/source/libr2c2/route.h index 86a0f61..5ea86be 100644 --- a/source/libr2c2/route.h +++ b/source/libr2c2/route.h @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2007-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_ROUTE_H_ #define LIBR2C2_ROUTE_H_ @@ -19,6 +12,27 @@ namespace R2C2 { class Layout; class Track; class TrackIter; +class Zone; + +enum RouteValidityMask +{ + ROUTE_INVALID = 0, + ROUTE_LINKED = 1, + ROUTE_LINEAR = 2, + ROUTE_SMOOTH = 4, + ROUTE_VALID = 7 +}; + +class bad_route: public std::logic_error +{ +public: + bad_route(RouteValidityMask m): std::logic_error(get_message(m)) { } + virtual ~bad_route() throw() { } + +private: + static std::string get_message(RouteValidityMask); +}; + class Route: public sigc::trackable { @@ -66,12 +80,13 @@ public: bool has_track(Track &) const; void save(std::list &) const; private: - unsigned check_validity(Track &) const; + RouteValidityMask check_validity(Track &) const; void track_removed(Track &); public: static Route *find(const TrackIter &, Track &); static Route *find(const TrackIter &, const Route &); + static Route *find(const TrackIter &, const Zone &); static Route *find(const TrackIter &, const std::set &); };