lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5497] Provide for backward compatibility, exposing a late


From: Greg Chicares
Subject: [lmi-commits] [5497] Provide for backward compatibility, exposing a latent defect
Date: Sat, 16 Jun 2012 12:10:24 +0000

Revision: 5497
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5497
Author:   chicares
Date:     2012-06-16 12:10:18 +0000 (Sat, 16 Jun 2012)
Log Message:
-----------
Provide for backward compatibility, exposing a latent defect

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/antediluvian_stubs.cpp
    lmi/trunk/product_data.cpp
    lmi/trunk/product_data.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2012-06-12 22:02:21 UTC (rev 5496)
+++ lmi/trunk/ChangeLog 2012-06-16 12:10:18 UTC (rev 5497)
@@ -30293,3 +30293,12 @@
   product_data.hpp
 Rename certain variables.
 
+20120616T1209Z <address@hidden> [578]
+
+  antediluvian_stubs.cpp
+  product_data.cpp
+  product_data.hpp
+Provide for backward compatibility, exposing a latent defect: the
+intended redintegration does not take place, because detritus_map
+holds a std::string rather than a glossed_string.
+

Modified: lmi/trunk/antediluvian_stubs.cpp
===================================================================
--- lmi/trunk/antediluvian_stubs.cpp    2012-06-12 22:02:21 UTC (rev 5496)
+++ lmi/trunk/antediluvian_stubs.cpp    2012-06-16 12:10:18 UTC (rev 5497)
@@ -132,6 +132,20 @@
     return false;
 }
 
+void product_data::redintegrate_ex_ante
+    (int
+    ,std::string const&
+    ,std::string      &
+    ) const
+{}
+
+void product_data::redintegrate_ex_post
+    (int
+    ,std::map<std::string, std::string> const&
+    ,std::list<std::string>             const&
+    )
+{}
+
 std::string const& product_data::datum(std::string const&) const
 {
     return empty_string;

Modified: lmi/trunk/product_data.cpp
===================================================================
--- lmi/trunk/product_data.cpp  2012-06-12 22:02:21 UTC (rev 5496)
+++ lmi/trunk/product_data.cpp  2012-06-16 12:10:18 UTC (rev 5497)
@@ -33,6 +33,7 @@
 #include "assert_lmi.hpp"
 #include "contains.hpp"
 #include "data_directory.hpp"           // AddDataDir()
+#include "map_lookup.hpp"
 #include "miscellany.hpp"               // lmi_array_size()
 #include "my_proem.hpp"                 // ::write_proem()
 #include "xml_serialize.hpp"
@@ -286,10 +287,11 @@
 /// Backward-compatibility serial number of this class's xml version.
 ///
 /// version 0: 20100402T1123Z
+/// version 1: 20120616T1209Z
 
 int product_data::class_version() const
 {
-    return 0;
+    return 1;
 }
 
 std::string const& product_data::xml_root_name() const
@@ -332,12 +334,57 @@
 bool product_data::is_detritus(std::string const& s) const
 {
     static std::string const a[] =
-        {"Remove this string when adding the first removed entity."
+        {"PresaleTrackingNumber"          // renamed to ImprimaturPresale
+        ,"CompositeTrackingNumber"        // renamed to 
ImprimaturPresaleComposite
+        ,"InforceTrackingNumber"          // renamed to ImprimaturInforce
+        ,"InforceCompositeTrackingNumber" // renamed to 
ImprimaturInforceComposite
         };
     static std::vector<std::string> const v(a, a + lmi_array_size(a));
     return contains(v, s);
 }
 
+void product_data::redintegrate_ex_ante
+    (int                file_version
+    ,std::string const& // name
+    ,std::string      & // value
+    ) const
+{
+    if(class_version() == file_version)
+        {
+        return;
+        }
+
+    if(file_version < 2)
+        {
+        return;
+        }
+}
+
+void product_data::redintegrate_ex_post
+    (int                                       file_version
+    ,std::map<std::string, std::string> const& detritus_map
+    ,std::list<std::string>             const& residuary_names
+    )
+{
+    if(class_version() == file_version)
+        {
+        return;
+        }
+
+    if(file_version < 1)
+        {
+        // Version 1 renamed these members:
+        LMI_ASSERT(contains(residuary_names, "ImprimaturPresale"));
+        LMI_ASSERT(contains(residuary_names, "ImprimaturPresaleComposite"));
+        LMI_ASSERT(contains(residuary_names, "ImprimaturInforce"));
+        LMI_ASSERT(contains(residuary_names, "ImprimaturInforceComposite"));
+        ImprimaturPresale          = map_lookup(detritus_map, 
"PresaleTrackingNumber");
+        ImprimaturPresaleComposite = map_lookup(detritus_map, 
"CompositeTrackingNumber");
+        ImprimaturInforce          = map_lookup(detritus_map, 
"InforceTrackingNumber");
+        ImprimaturInforceComposite = map_lookup(detritus_map, 
"InforceCompositeTrackingNumber");
+        }
+}
+
 /// Create a product file for the 'sample' product.
 ///
 /// Only the most crucial members are explicitly initialized. For the

Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp  2012-06-12 22:02:21 UTC (rev 5496)
+++ lmi/trunk/product_data.hpp  2012-06-16 12:10:18 UTC (rev 5497)
@@ -117,6 +117,16 @@
         ,std::string const&     file_leaf_name
         ) const;
     virtual bool is_detritus(std::string const&) const;
+    virtual void redintegrate_ex_ante
+        (int                file_version
+        ,std::string const& name
+        ,std::string      & value
+        ) const;
+    virtual void redintegrate_ex_post
+        (int                                       file_version
+        ,std::map<std::string, std::string> const& detritus_map
+        ,std::list<std::string>             const& residuary_names
+        );
 
     // Names of files that contain other product data.
     glossed_string DatabaseFilename;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]