add API to query stateful ID override mode
authorRobin Gareus <robin@gareus.org>
Thu, 17 Dec 2015 22:18:22 +0000 (23:18 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 17 Dec 2015 22:18:22 +0000 (23:18 +0100)
libs/pbd/pbd/stateful.h
libs/pbd/stateful.cc

index 0207cfcf0c72c6d33a827d789af2d31680cf3746..fe2df931479429c6f7ab57347bfddf4146834fe2 100644 (file)
@@ -131,9 +131,11 @@ class LIBPBD_API Stateful {
        */
        virtual void mid_thaw (const PropertyChange&) { }
 
+       bool regenerate_xml_or_string_ids () const;
+
   private:
        friend struct ForceIDRegeneration;
-       static Glib::Threads::Private<bool> regenerate_xml_or_string_ids;
+       static Glib::Threads::Private<bool> _regenerate_xml_or_string_ids;
        PBD::ID  _id;
        gint     _stateful_frozen;
 
index a5b583cc4d81111c154da95da2d4d5040c0e5884..3fb11a3a509359bf6878a0c63e9849c72b94e81f 100644 (file)
@@ -44,7 +44,7 @@ namespace PBD {
 int Stateful::current_state_version = 0;
 int Stateful::loading_state_version = 0;
 
-Glib::Threads::Private<bool> Stateful::regenerate_xml_or_string_ids;
+Glib::Threads::Private<bool> Stateful::_regenerate_xml_or_string_ids;
 
 Stateful::Stateful ()
        : _extra_xml (0)
@@ -383,7 +383,7 @@ bool
 Stateful::set_id (const XMLNode& node)
 {
        const XMLProperty* prop;
-       bool* regen = regenerate_xml_or_string_ids.get();
+       bool* regen = _regenerate_xml_or_string_ids.get();
 
        if (regen && *regen) {
                reset_id ();
@@ -407,7 +407,7 @@ Stateful::reset_id ()
 void
 Stateful::set_id (const string& str)
 {
-       bool* regen = regenerate_xml_or_string_ids.get();
+       bool* regen = _regenerate_xml_or_string_ids.get();
 
        if (regen && *regen) {
                reset_id ();
@@ -416,11 +416,22 @@ Stateful::set_id (const string& str)
        }
 }
 
+bool
+Stateful::regenerate_xml_or_string_ids () const
+{
+       bool* regen = _regenerate_xml_or_string_ids.get();
+       if (regen && *regen) {
+               return true;
+       } else {
+               return false;
+       }
+}
+
 void
 Stateful::set_regenerate_xml_and_string_ids_in_this_thread (bool yn)
 {
        bool* val = new bool (yn);
-       regenerate_xml_or_string_ids.set (val);
+       _regenerate_xml_or_string_ids.set (val);
 }
 
 } // namespace PBD