46 template<
typename Container>
55 void add (
typename Container::value_type
const & r) {
56 typename ChangeContainer::iterator i =
removed.find (r);
67 void remove (
typename Container::value_type
const & r) {
68 typename ChangeContainer::iterator i =
added.find (r);
69 if (i !=
added.end()) {
127 for (
typename Container::const_iterator i =
_val.begin(); i !=
_val.end(); ++i) {
187 XMLNodeList::const_iterator i = children.begin();
188 while (i != children.end() && (*i)->name() != c) {
192 if (i == children.end()) {
200 XMLNodeList const & grandchildren = (*i)->children ();
201 for (XMLNodeList::const_iterator j = grandchildren.begin(); j != grandchildren.end(); ++j) {
206 warning <<
"undo transaction references an unknown object" <<
endmsg;
207 }
else if ((*j)->name() ==
"Add") {
209 }
else if ((*j)->name() ==
"Remove") {
221 for (
typename Container::iterator i =
begin(); i !=
end(); ++i) {
222 (*i)->clear_changes ();
226 void rdiff (std::vector<PBD::Command*>& cmds)
const {
227 for (
typename Container::const_iterator i =
begin(); i !=
end(); ++i) {
228 if ((*i)->changed ()) {
230 cmds.push_back (sdc);
240 typename Container::iterator
begin() {
return _val.begin(); }
241 typename Container::iterator
end() {
return _val.end(); }
242 typename Container::const_iterator
begin()
const {
return _val.begin(); }
243 typename Container::const_iterator
end()
const {
return _val.end(); }
245 typename Container::reverse_iterator
rbegin() {
return _val.rbegin(); }
246 typename Container::reverse_iterator
rend() {
return _val.rend(); }
247 typename Container::const_reverse_iterator
rbegin()
const {
return _val.rbegin(); }
248 typename Container::const_reverse_iterator
rend()
const {
return _val.rend(); }
250 typename Container::iterator
insert (
typename Container::iterator i,
const typename Container::value_type& v) {
252 return _val.insert (i, v);
255 typename Container::iterator
erase (
typename Container::iterator i) {
256 if (i !=
_val.end()) {
259 return _val.erase (i);
262 typename Container::iterator
erase (
typename Container::iterator f,
typename Container::iterator l) {
263 for (
typename Container::const_iterator i = f; i != l; ++i) {
266 return _val.erase (f, l);
269 void remove (
const typename Container::value_type& v) {
274 void push_back (
const typename Container::value_type& v) {
299 for (
typename Container::iterator i =
_val.begin(); i !=
_val.end(); ++i) {
305 typename Container::size_type
size()
const {
314 for (
typename Container::const_iterator i =
_val.begin(); i !=
_val.end(); ++i) {
317 for (
typename Container::const_iterator i = other.begin(); i != other.end(); ++i) {
323 typename Container::reference
front() {
324 return _val.front ();
327 typename Container::const_reference
front()
const {
328 return _val.front ();
331 typename Container::reference
back() {
335 typename Container::const_reference
back()
const {
343 template<
class BinaryPredicate>
void sort(BinaryPredicate comp) {
virtual void drop_references()
const gchar * property_name() const
void get_changes_as_xml(XMLNode *history_node) const
void apply_change(PropertyBase const *p)
Container::const_iterator end() const
Container::size_type size() const
Container::reverse_iterator rbegin()
Container::iterator erase(typename Container::iterator i)
void get_value(XMLNode &node) const
Container::const_reference back() const
Container::reference back()
Container::iterator end()
void remove(const typename Container::value_type &v)
Container::reference front()
SequenceProperty(PropertyID id, const std::function< void(const ChangeRecord &)> &update)
std::set< typename Container::value_type > ChangeContainer
void push_back(const typename Container::value_type &v)
Container::iterator insert(typename Container::iterator i, const typename Container::value_type &v)
Container & operator=(const Container &other)
virtual Container::value_type get_content_from_xml(XMLNode const &node) const =0
Container::const_iterator begin() const
SequenceProperty< Container > * clone_from_xml(XMLNode const &node) const
Container::const_reverse_iterator rend() const
void push_front(const typename Container::value_type &v)
Container::const_reference front() const
void sort(BinaryPredicate comp)
Container::reverse_iterator rend()
void rdiff(std::vector< PBD::Command * > &cmds) const
void update(const ChangeRecord &cr)
void get_changes_as_properties(PBD::PropertyList &changes, Command *cmd) const
virtual void get_content_as_xml(typename ChangeContainer::value_type, XMLNode &) const =0
virtual SequenceProperty< Container > * create() const =0
void clear_owned_changes()
Container _val
our actual container of things
Container::const_reverse_iterator rbegin() const
Container::iterator erase(typename Container::iterator f, typename Container::iterator l)
SequenceProperty(SequenceProperty< Container > const &p)
std::function< void(const ChangeRecord &)> _update_callback
bool set_value(XMLNode const &)
Container::iterator begin()
ChangeRecord _changes
changes to the container (adds/removes) that have happened since clear_changes() was last called
const ChangeRecord & changes() const
const XMLNodeList & children(const std::string &str=std::string()) const
void add_child_nocopy(XMLNode &)
std::string capitalize(const std::string &)
void remove(typename Container::value_type const &r)
void add(typename Container::value_type const &r)
std::ostream & endmsg(std::ostream &ostr)
std::vector< XMLNode * > XMLNodeList