X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fspl.h;h=f55a9fe1fd89c1405b2ff7887eec914f6d25d34d;hp=49eb93df236f7ab709080e41678e54b8a66db54a;hb=a733da8088152a2487691629753fe8a2addfa5a3;hpb=0c5f0e48080a28d3cfa9f8e2f4948bbc57bc0307 diff --git a/src/lib/spl.h b/src/lib/spl.h index 49eb93df2..f55a9fe1f 100644 --- a/src/lib/spl.h +++ b/src/lib/spl.h @@ -26,6 +26,8 @@ #include "spl_entry.h" #include #include +#include + class ContentStore; @@ -57,12 +59,12 @@ public: return _spl; } - SPLEntry & operator[] (std::size_t index) { + SPLEntry const & operator[] (std::size_t index) const { return _spl[index]; } - SPLEntry const & operator[] (std::size_t index) const { - return _spl[index]; + void swap(size_t a, size_t b) { + std::iter_swap(_spl.begin() + a, _spl.begin() + b); } void read (boost::filesystem::path path, ContentStore* store); @@ -112,6 +114,21 @@ public: Changed(Change::NAME); } + void add(SPLEntry e) { + SPL::add(e); + Changed(Change::CONTENT); + } + + void remove(std::size_t index) { + SPL::remove(index); + Changed(Change::CONTENT); + } + + void swap(size_t a, size_t b) { + SPL::swap(a, b); + Changed(Change::CONTENT); + } + boost::signals2::signal Changed; };