Change name of Stateful::apply_changes (PropertyBase) to the singular form.
Makes it slightly easier to read+parse what is happening. Yes, for a Sequence property, the call could apply several changes, but overwhelmingly it is used to apply a single change.
This commit is contained in:
parent
30a00c5e9f
commit
64db1367bb
@ -166,7 +166,7 @@ public:
|
||||
|
||||
/* VARIOUS */
|
||||
|
||||
void apply_changes (PropertyBase const * p) {
|
||||
void apply_change (PropertyBase const * p) {
|
||||
T v = dynamic_cast<const PropertyTemplate<T>* > (p)->val ();
|
||||
if (v != _current) {
|
||||
set (v);
|
||||
@ -444,7 +444,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void apply_changes (PropertyBase const * p) {
|
||||
void apply_change (PropertyBase const * p) {
|
||||
*_current = *(dynamic_cast<SharedStatefulProperty const *> (p))->val ();
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public:
|
||||
virtual PropertyBase* clone () const = 0;
|
||||
|
||||
/** Set this property's current state from another */
|
||||
virtual void apply_changes (PropertyBase const *) = 0;
|
||||
virtual void apply_change (PropertyBase const *) = 0;
|
||||
|
||||
const gchar* property_name () const { return g_quark_to_string (_property_id); }
|
||||
PropertyID property_id () const { return _property_id; }
|
||||
|
@ -139,7 +139,7 @@ class /*LIBPBD_API*/ SequenceProperty : public PropertyBase
|
||||
_changes.removed.clear ();
|
||||
}
|
||||
|
||||
void apply_changes (PropertyBase const * p) {
|
||||
void apply_change (PropertyBase const * p) {
|
||||
const ChangeRecord& change (dynamic_cast<const SequenceProperty*> (p)->changes ());
|
||||
update (change);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class LIBPBD_API Stateful {
|
||||
virtual XMLNode& get_state (void) = 0;
|
||||
virtual int set_state (const XMLNode&, int version) = 0;
|
||||
|
||||
virtual bool apply_changes (PropertyBase const &);
|
||||
virtual bool apply_change (PropertyBase const &);
|
||||
PropertyChange apply_changes (PropertyList const &);
|
||||
|
||||
const OwnedPropertyList& properties() const { return *_properties; }
|
||||
|
@ -248,9 +248,13 @@ Stateful::apply_changes (const PropertyList& property_list)
|
||||
string_compose ("actually setting property %1 using %2\n", p->second->property_name(), i->second->property_name())
|
||||
);
|
||||
|
||||
if (apply_changes (*i->second)) {
|
||||
if (apply_change (*i->second)) {
|
||||
DEBUG_TRACE (DEBUG::Stateful, string_compose ("applying change succeeded, add %1 to change list\n", p->second->property_name()));
|
||||
c.add (i->first);
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::Stateful, string_compose ("applying change failed for %1\n", p->second->property_name()));
|
||||
}
|
||||
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::Stateful, string_compose ("passed in property %1 not found in own property list\n",
|
||||
i->second->property_name()));
|
||||
@ -341,14 +345,14 @@ Stateful::changed() const
|
||||
}
|
||||
|
||||
bool
|
||||
Stateful::apply_changes (const PropertyBase& prop)
|
||||
Stateful::apply_change (const PropertyBase& prop)
|
||||
{
|
||||
OwnedPropertyList::iterator i = _properties->find (prop.property_id());
|
||||
if (i == _properties->end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i->second->apply_changes (&prop);
|
||||
i->second->apply_change (&prop);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user