summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-25 17:32:08 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-25 17:32:08 +0000
commitf30402d073aeae5d24462416407e73d1e0314e71 (patch)
tree62e89b0549125dc8d0d5ee91fe2cc689990b7f08 /libs/pbd
parent21855b71d2eb8006fda96aefacfa60140ae747d3 (diff)
clear_history -> clear_changes and some comments.
git-svn-id: svn://localhost/ardour2/branches/3.0@7685 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/pbd/properties.h6
-rw-r--r--libs/pbd/pbd/property_basics.h22
-rw-r--r--libs/pbd/pbd/sequence_property.h8
-rw-r--r--libs/pbd/pbd/stateful.h4
-rw-r--r--libs/pbd/stateful.cc12
-rw-r--r--libs/pbd/stateful_diff_command.cc2
-rw-r--r--libs/pbd/test/scalar_properties.cc2
7 files changed, 30 insertions, 26 deletions
diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h
index 41a5f74881..aeb0c3e069 100644
--- a/libs/pbd/pbd/properties.h
+++ b/libs/pbd/pbd/properties.h
@@ -88,7 +88,7 @@ public:
return _current;
}
- void clear_history () {
+ void clear_changes () {
_have_old = false;
}
@@ -153,7 +153,7 @@ protected:
if (v == _old) {
/* value has been reset to the value
at the start of a history transaction,
- before clear_history() is called.
+ before clear_changes() is called.
thus there is effectively no apparent
history for this property.
*/
@@ -204,7 +204,7 @@ public:
}
}
- Property<T>* maybe_clone_self_if_found_in_history_node (const XMLNode& node) const {
+ Property<T>* clone_from_xml (const XMLNode& node) const {
XMLNodeList const & children = node.children ();
XMLNodeList::const_iterator i = children.begin();
while (i != children.end() && (*i)->name() != this->property_name()) {
diff --git a/libs/pbd/pbd/property_basics.h b/libs/pbd/pbd/property_basics.h
index f329916284..cfae36df20 100644
--- a/libs/pbd/pbd/property_basics.h
+++ b/libs/pbd/pbd/property_basics.h
@@ -90,21 +90,25 @@ public:
virtual PropertyBase* clone () const = 0;
- /** Forget about any old value for this state */
- virtual void clear_history () = 0;
+ /** Forget about any old changes to this property's value */
+ virtual void clear_changes () = 0;
/** Tell any things we own to forget about their old values */
- virtual void clear_owned_history () {}
+ virtual void clear_owned_changes () {}
- /** Get any changes in this property as XML and add it to a node */
+ /** Get any changes in this property as XML and add them to a node */
virtual void get_changes_as_xml (XMLNode *) const = 0;
+ /** Get any changes in this property as Properties and add them to a list */
virtual void get_changes_as_properties (PropertyList& changes, Command *) const = 0;
/** Collect StatefulDiffCommands for changes to anything that we own */
virtual void rdiff (std::vector<StatefulDiffCommand*> &) const {}
-
- virtual PropertyBase* maybe_clone_self_if_found_in_history_node (const XMLNode&) const { return 0; }
+
+ /** Look in an XML node written by get_changes_as_xml and, if XML from this property
+ * is found, create a property with the changes from the XML.
+ */
+ virtual PropertyBase* clone_from_xml (const XMLNode &) const { return 0; }
/** Set our value from an XML node.
* @return true if the value was set.
@@ -115,7 +119,7 @@ public:
virtual void get_value (XMLNode& node) const = 0;
/** @return true if this property has changed in value since construction or since
- * the last call to clear_history(), whichever was more recent.
+ * the last call to clear_changes (), whichever was more recent.
*/
virtual bool changed() const = 0;
@@ -125,8 +129,8 @@ public:
/** Invert the changes in this property */
virtual void invert () = 0;
- const gchar*property_name () const { return g_quark_to_string (_property_id); }
- PropertyID property_id () const { return _property_id; }
+ const gchar* property_name () const { return g_quark_to_string (_property_id); }
+ PropertyID property_id () const { return _property_id; }
bool operator==(PropertyID pid) const {
return _property_id == pid;
diff --git a/libs/pbd/pbd/sequence_property.h b/libs/pbd/pbd/sequence_property.h
index 573bb4b539..7fdc964397 100644
--- a/libs/pbd/pbd/sequence_property.h
+++ b/libs/pbd/pbd/sequence_property.h
@@ -125,7 +125,7 @@ class SequenceProperty : public PropertyBase
return !_changes.added.empty() || !_changes.removed.empty();
}
- void clear_history () {
+ void clear_changes () {
_changes.added.clear ();
_changes.removed.clear ();
}
@@ -165,7 +165,7 @@ class SequenceProperty : public PropertyBase
}
}
- SequenceProperty<Container>* maybe_clone_self_if_found_in_history_node (XMLNode const & node) const {
+ SequenceProperty<Container>* clone_from_xml (XMLNode const & node) const {
XMLNodeList const children = node.children ();
@@ -186,9 +186,9 @@ class SequenceProperty : public PropertyBase
return 0;
}
- void clear_owned_history () {
+ void clear_owned_changes () {
for (typename Container::iterator i = begin(); i != end(); ++i) {
- (*i)->clear_history ();
+ (*i)->clear_changes ();
}
}
diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h
index 050540dcd1..5c1f079bc6 100644
--- a/libs/pbd/pbd/stateful.h
+++ b/libs/pbd/pbd/stateful.h
@@ -67,8 +67,8 @@ class Stateful {
/* history management */
- void clear_history ();
- virtual void clear_owned_history ();
+ void clear_changes ();
+ virtual void clear_owned_changes ();
PropertyList* get_changes_as_properties (Command *) const;
virtual void rdiff (std::vector<StatefulDiffCommand*> &) const;
bool changed() const;
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index 204e62685e..8411dc4e60 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -157,12 +157,12 @@ Stateful::instant_xml (const string& str, const sys::path& directory_path)
return 0;
}
-/** Forget about any old state for this object */
+/** Forget about any changes to this object's properties */
void
-Stateful::clear_history ()
+Stateful::clear_changes ()
{
for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) {
- i->second->clear_history ();
+ i->second->clear_changes ();
}
}
@@ -329,7 +329,7 @@ Stateful::property_factory (const XMLNode& history_node) const
PropertyList* prop_list = new PropertyList;
for (OwnedPropertyList::const_iterator i = _properties->begin(); i != _properties->end(); ++i) {
- PropertyBase* prop = i->second->maybe_clone_self_if_found_in_history_node (history_node);
+ PropertyBase* prop = i->second->clone_from_xml (history_node);
if (prop) {
prop_list->add (prop);
@@ -348,10 +348,10 @@ Stateful::rdiff (vector<StatefulDiffCommand*>& cmds) const
}
void
-Stateful::clear_owned_history ()
+Stateful::clear_owned_changes ()
{
for (OwnedPropertyList::iterator i = _properties->begin(); i != _properties->end(); ++i) {
- i->second->clear_owned_history ();
+ i->second->clear_owned_changes ();
}
}
diff --git a/libs/pbd/stateful_diff_command.cc b/libs/pbd/stateful_diff_command.cc
index ffd56c8fb1..93a215ad8a 100644
--- a/libs/pbd/stateful_diff_command.cc
+++ b/libs/pbd/stateful_diff_command.cc
@@ -28,7 +28,7 @@ using namespace std;
using namespace PBD;
/** Create a new StatefulDiffCommand by examining the changes made to a Stateful
- * since the last time that clear_history was called on it.
+ * since the last time that clear_changes was called on it.
* @param s Stateful object.
*/
diff --git a/libs/pbd/test/scalar_properties.cc b/libs/pbd/test/scalar_properties.cc
index b637076cc6..cd736b14d3 100644
--- a/libs/pbd/test/scalar_properties.cc
+++ b/libs/pbd/test/scalar_properties.cc
@@ -29,7 +29,7 @@ ScalarPropertiesTest::testBasic ()
CPPUNIT_ASSERT (_fred == 4);
CPPUNIT_ASSERT (_fred.changed() == true);
- _fred.clear_history ();
+ _fred.clear_changes ();
CPPUNIT_ASSERT (_fred.changed() == false);
_fred = 5;