X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrack.cpp;h=26fb59e0fa7e756b619ad718d090dec6b6f05314;hb=f730acd5fa2b4f0d0185770ff7950ab814aec47c;hp=43bacc3d8bc10f6a4653716064cbffb331e2ed0c;hpb=f23c8d8cbc4e72b45e3a719b2cf974ce35d054e9;p=r2c2.git diff --git a/source/libr2c2/track.cpp b/source/libr2c2/track.cpp index 43bacc3..26fb59e 100644 --- a/source/libr2c2/track.cpp +++ b/source/libr2c2/track.cpp @@ -1,4 +1,5 @@ #include +#include #include "block.h" #include "catalogue.h" #include "driver.h" @@ -331,6 +332,21 @@ bool Track::break_link(unsigned i) return true; } +void Track::add_attachment(TrackAttachment &a) +{ + if(find(attachments.begin(), attachments.end(), &a)!=attachments.end()) + throw key_error(&a); + attachments.push_back(&a); +} + +void Track::remove_attachment(TrackAttachment &a) +{ + AttachmentList::iterator i = find(attachments.begin(), attachments.end(), &a); + if(i==attachments.end()) + throw key_error(&a); + attachments.erase(i); +} + void Track::save(list &st) const { st.push_back((DataFile::Statement("position"), position.x, position.y, position.z));