lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 0336095 3/5: Make WriteSampleDBFile() and Wri


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0336095 3/5: Make WriteSampleDBFile() and WriteProprietaryDBFiles() static
Date: Thu, 4 Aug 2016 13:10:37 +0000 (UTC)

branch: master
commit 0336095f951cc91c2fcf4f609a68141db673ce6f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Make WriteSampleDBFile() and WriteProprietaryDBFiles() static
    
    These member functions should be static, as their analogues for other
    product files are. Those analogues generally call non-static member
    functions on a dummy object, as WriteProprietaryDBFiles()'s default
    implementation now does. Five thousand lines of proprietary legacy code
    for this class happen not to do that, so, as a temporary expedient,
    in that code:
     - rename WriteProprietaryDBFiles() to Nyarlathotep()
     - copy and paste these two lines:
         void DBDictionary::WriteProprietaryDBFiles()
         {DBDictionary z; z.Nyarlathotep();}
---
 dbdict.hpp |    7 +++++--
 my_db.cpp  |    5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dbdict.hpp b/dbdict.hpp
index b3d3a3e..70a283f 100644
--- a/dbdict.hpp
+++ b/dbdict.hpp
@@ -56,8 +56,8 @@ class LMI_SO DBDictionary
 
     database_entity const& datum(std::string const&) const;
 
-    void WriteSampleDBFile();
-    void WriteProprietaryDBFiles();
+    static void WriteSampleDBFile();
+    static void WriteProprietaryDBFiles();
 
     void InitAntediluvian();
 
@@ -72,6 +72,9 @@ class LMI_SO DBDictionary
     void Add(database_entity const&);
     void InitDB();
 
+    // A temporary expedient.
+    void Nyarlathotep();
+
     // xml_serializable required implementation.
     virtual int                class_version() const;
     virtual std::string const& xml_root_name() const;
diff --git a/my_db.cpp b/my_db.cpp
index 7e21080..303afff 100644
--- a/my_db.cpp
+++ b/my_db.cpp
@@ -44,8 +44,9 @@ void DBDictionary::WriteProprietaryDBFiles()
 {
   // Sample policy form.
   {
-    InitDB();
-    Add(database_entity(DB_GuarMonthlyPolFee, 10.00));
+    DBDictionary z;
+    z.InitDB();
+    z.Add(database_entity(DB_GuarMonthlyPolFee, 10.00));
     // etc.
 // Not necessary for 'sample' product only, because it's built in.
 //  WriteDB(AddDataDir("sample.database"));



reply via email to

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