lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5090] Fix defect introduced 20100704T1645Z


From: Greg Chicares
Subject: [lmi-commits] [5090] Fix defect introduced 20100704T1645Z
Date: Sun, 01 Aug 2010 22:09:44 +0000

Revision: 5090
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5090
Author:   chicares
Date:     2010-08-01 22:09:43 +0000 (Sun, 01 Aug 2010)
Log Message:
-----------
Fix defect introduced 20100704T1645Z

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/datum_sequence.cpp
    lmi/trunk/datum_sequence.hpp
    lmi/trunk/input_realization.cpp
    lmi/trunk/input_sequence_entry.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-08-01 15:15:42 UTC (rev 5089)
+++ lmi/trunk/ChangeLog 2010-08-01 22:09:43 UTC (rev 5090)
@@ -26710,3 +26710,12 @@
   mec_server.cpp
 Query product database with nondefault index pro re nata.
 
+20100801T2209Z <address@hidden> [656]
+
+  datum_sequence.cpp
+  datum_sequence.hpp
+  input_realization.cpp
+  input_sequence_entry.cpp
+Fix defect introduced 20100704T1645Z. See:
+  http://lists.nongnu.org/archive/html/lmi/2010-08/msg00000.html
+

Modified: lmi/trunk/datum_sequence.cpp
===================================================================
--- lmi/trunk/datum_sequence.cpp        2010-08-01 15:15:42 UTC (rev 5089)
+++ lmi/trunk/datum_sequence.cpp        2010-08-01 22:09:43 UTC (rev 5090)
@@ -89,6 +89,15 @@
     return false;
 }
 
+/// Return default keyword in current context.
+///
+/// Return empty string if there's no default keyword.
+
+std::string const datum_sequence::default_keyword() const
+{
+    return std::string();
+}
+
 /// Ascertain which keywords are allowed in the current context.
 ///
 /// The return value is a map: keyword --> mc_enum string. Rationale:
@@ -206,6 +215,11 @@
     return *this;
 }
 
+std::string const mode_sequence::default_keyword() const
+{
+    return "annual";
+}
+
 std::map<std::string,std::string> const mode_sequence::allowed_keywords() const
 {
     LMI_ASSERT(!keyword_values_are_blocked());

Modified: lmi/trunk/datum_sequence.hpp
===================================================================
--- lmi/trunk/datum_sequence.hpp        2010-08-01 15:15:42 UTC (rev 5089)
+++ lmi/trunk/datum_sequence.hpp        2010-08-01 22:09:43 UTC (rev 5090)
@@ -80,6 +80,7 @@
     //
     virtual bool numeric_values_are_allowable() const;
     virtual bool keyword_values_are_allowable() const;
+    virtual std::string const default_keyword() const;
     virtual std::map<std::string,std::string> const allowed_keywords() const;
 
     bool equals(datum_sequence const&) const;
@@ -148,6 +149,7 @@
 
     virtual bool numeric_values_are_allowable() const {return false;}
     virtual bool keyword_values_are_allowable() const {return true;}
+    virtual std::string const default_keyword() const;
     virtual std::map<std::string,std::string> const allowed_keywords() const;
 };
 

Modified: lmi/trunk/input_realization.cpp
===================================================================
--- lmi/trunk/input_realization.cpp     2010-08-01 15:15:42 UTC (rev 5089)
+++ lmi/trunk/input_realization.cpp     2010-08-01 22:09:43 UTC (rev 5090)
@@ -607,7 +607,7 @@
         ,PaymentModeRealized_
         ,PaymentMode
         ,PaymentMode.allowed_keywords()
-        ,std::string("annual")
+        ,PaymentMode.default_keyword()
         );
 }
 
@@ -636,7 +636,7 @@
         ,CorporationPaymentModeRealized_
         ,CorporationPaymentMode
         ,CorporationPaymentMode.allowed_keywords()
-        ,std::string("annual")
+        ,CorporationPaymentMode.default_keyword()
         );
 }
 

Modified: lmi/trunk/input_sequence_entry.cpp
===================================================================
--- lmi/trunk/input_sequence_entry.cpp  2010-08-01 15:15:42 UTC (rev 5089)
+++ lmi/trunk/input_sequence_entry.cpp  2010-08-01 22:09:43 UTC (rev 5090)
@@ -179,10 +179,15 @@
   public:
     InputSequenceEditor(wxWindow* parent, wxString const& title, Input const& 
input);
 
-    void set_keywords(std::vector<std::string> const& keywords, bool only)
+    void set_keywords
+        (std::vector<std::string> const& keywords
+        ,bool                            keywords_only
+        ,std::string const&              default_keyword
+        )
     {
-        keywords_ = keywords;
-        keywords_only_ = only;
+        keywords_        = keywords;
+        keywords_only_   = keywords_only;
+        default_keyword_ = default_keyword;
     }
 
     void sequence(InputSequence const& s);
@@ -264,6 +269,7 @@
     Input const& input_;
     std::vector<std::string> keywords_;
     bool keywords_only_;
+    std::string default_keyword_;
 
     int rows_count_;
     wxFlexGridSizer* sizer_;
@@ -500,6 +506,12 @@
         std::copy(keywords_.begin(), keywords_.end(), std::back_inserter(kw));
         combo->Append(kw);
 
+        if(keywords_only_)
+            {
+            LMI_ASSERT(!default_keyword_.empty());
+            combo->SetValue(default_keyword_.c_str());
+            }
+
         if(!keywords_only_)
             {
             combo->AutoComplete(kw);
@@ -1075,7 +1087,7 @@
             && !ds.numeric_values_are_allowable()
             ;
         LMI_ASSERT(!(keywords_only && keywords.empty()));
-        editor.set_keywords(keywords, keywords_only);
+        editor.set_keywords(keywords, keywords_only, ds.default_keyword());
 
         InputSequence sequence
             (sequence_string




reply via email to

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