[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5940] Add some configurable settings, and rename others
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5940] Add some configurable settings, and rename others |
Date: |
Mon, 15 Sep 2014 19:43:36 +0000 |
Revision: 5940
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5940
Author: chicares
Date: 2014-09-15 19:43:35 +0000 (Mon, 15 Sep 2014)
Log Message:
-----------
Add some configurable settings, and rename others
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/configurable_settings.cpp
lmi/trunk/configurable_settings.hpp
lmi/trunk/configurable_settings_test.cpp
lmi/trunk/custom_io_0.cpp
lmi/trunk/illustration_view.cpp
lmi/trunk/illustrator.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/ChangeLog 2014-09-15 19:43:35 UTC (rev 5940)
@@ -34083,3 +34083,13 @@
Note a couple of apparent defects. They aren't marked as defects, only
because this code is no longer used in production.
+20140915T1943Z <address@hidden> [533]
+
+ configurable_settings.cpp
+ configurable_settings.hpp
+ configurable_settings_test.cpp
+ custom_io_0.cpp
+ illustration_view.cpp
+ illustrator.cpp
+Add some configurable settings, and rename others.
+
Modified: lmi/trunk/configurable_settings.cpp
===================================================================
--- lmi/trunk/configurable_settings.cpp 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/configurable_settings.cpp 2014-09-15 19:43:35 UTC (rev 5940)
@@ -33,6 +33,7 @@
#include "contains.hpp"
#include "data_directory.hpp" // AddDataDir()
#include "handle_exceptions.hpp"
+#include "map_lookup.hpp"
#include "mc_enum.hpp" // all_strings<>()
#include "mc_enum_type_enums.hpp" // mcenum_report_column
#include "miscellany.hpp" // lmi_array_size()
@@ -139,8 +140,10 @@
configurable_settings::configurable_settings()
:calculation_summary_columns_
(default_calculation_summary_columns())
,cgi_bin_log_filename_ ("cgi_bin.log"
)
- ,custom_input_filename_ ("custom.ini"
)
- ,custom_output_filename_ ("custom.out"
)
+ ,custom_input_0_filename_ ("custom.ini"
)
+ ,custom_input_1_filename_ ("custom.inix"
)
+ ,custom_output_0_filename_ ("custom.out0"
)
+ ,custom_output_1_filename_ ("custom.out1"
)
,default_input_filename_ ("/etc/opt/lmi/default.ill"
)
,libraries_to_preload_ (""
)
,offer_hobsons_choice_ (false
)
@@ -197,8 +200,10 @@
{
ascribe("calculation_summary_columns"
,&configurable_settings::calculation_summary_columns_ );
ascribe("cgi_bin_log_filename"
,&configurable_settings::cgi_bin_log_filename_ );
- ascribe("custom_input_filename"
,&configurable_settings::custom_input_filename_ );
- ascribe("custom_output_filename"
,&configurable_settings::custom_output_filename_ );
+ ascribe("custom_input_0_filename"
,&configurable_settings::custom_input_0_filename_ );
+ ascribe("custom_input_1_filename"
,&configurable_settings::custom_input_1_filename_ );
+ ascribe("custom_output_0_filename"
,&configurable_settings::custom_output_0_filename_ );
+ ascribe("custom_output_1_filename"
,&configurable_settings::custom_output_1_filename_ );
ascribe("default_input_filename"
,&configurable_settings::default_input_filename_ );
ascribe("libraries_to_preload"
,&configurable_settings::libraries_to_preload_ );
ascribe("offer_hobsons_choice"
,&configurable_settings::offer_hobsons_choice_ );
@@ -224,10 +229,11 @@
///
/// version 0: [prior to the lmi epoch]
/// version 1: 20100612T0139Z
+/// version 2: 20140915T1943Z
int configurable_settings::class_version() const
{
- return 1;
+ return 2;
}
std::string const& configurable_settings::xml_root_name() const
@@ -247,7 +253,9 @@
bool configurable_settings::is_detritus(std::string const& s) const
{
static std::string const a[] =
- {"xml_schema_filename" // Withdrawn.
+ {"custom_input_filename" // Renamed to
'custom_input_0_filename'.
+ ,"custom_output_filename" // Renamed to
'custom_output_0_filename'.
+ ,"xml_schema_filename" // Withdrawn.
,"xsl_directory" // Withdrawn.
,"xslt_format_xml_filename" // Withdrawn.
,"xslt_html_filename" // Withdrawn.
@@ -291,8 +299,8 @@
void configurable_settings::redintegrate_ex_post
(int file_version
- ,std::map<std::string, std::string> const& // detritus_map
- ,std::list<std::string> const& // residuary_names
+ ,std::map<std::string, std::string> const& detritus_map
+ ,std::list<std::string> const& residuary_names
)
{
if(class_version() == file_version)
@@ -300,7 +308,14 @@
return;
}
- // Nothing to do for now.
+ if(file_version < 2)
+ {
+ // Version 2 renamed these elements.
+ LMI_ASSERT(contains(residuary_names, "custom_input_0_filename"));
+ LMI_ASSERT(contains(residuary_names, "custom_output_0_filename"));
+ custom_input_0_filename_ = map_lookup(detritus_map,
"custom_input_filename");
+ custom_output_0_filename_ = map_lookup(detritus_map,
"custom_output_filename");
+ }
}
// TODO ?? CALCULATION_SUMMARY Address the validation issue:
@@ -341,20 +356,34 @@
return cgi_bin_log_filename_;
}
-/// Static name of custom input file.
+/// Static name of custom "0" input file.
-std::string const& configurable_settings::custom_input_filename() const
+std::string const& configurable_settings::custom_input_0_filename() const
{
- return custom_input_filename_;
+ return custom_input_0_filename_;
}
-/// Static name of custom output file.
+/// Static name of custom "1" input file.
-std::string const& configurable_settings::custom_output_filename() const
+std::string const& configurable_settings::custom_input_1_filename() const
{
- return custom_output_filename_;
+ return custom_input_1_filename_;
}
+/// Static name of custom "0" output file.
+
+std::string const& configurable_settings::custom_output_0_filename() const
+{
+ return custom_output_0_filename_;
+}
+
+/// Static name of custom "1" output file.
+
+std::string const& configurable_settings::custom_output_1_filename() const
+{
+ return custom_output_1_filename_;
+}
+
/// Name of '.ill' file containing default input values for new '.ill'
/// and '.cns' files.
Modified: lmi/trunk/configurable_settings.hpp
===================================================================
--- lmi/trunk/configurable_settings.hpp 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/configurable_settings.hpp 2014-09-15 19:43:35 UTC (rev 5940)
@@ -61,8 +61,10 @@
std::string const& calculation_summary_columns () const;
std::string const& cgi_bin_log_filename () const;
- std::string const& custom_input_filename () const;
- std::string const& custom_output_filename () const;
+ std::string const& custom_input_0_filename () const;
+ std::string const& custom_input_1_filename () const;
+ std::string const& custom_output_0_filename () const;
+ std::string const& custom_output_1_filename () const;
std::string const& default_input_filename () const;
std::string const& libraries_to_preload () const;
bool offer_hobsons_choice () const;
@@ -99,8 +101,10 @@
std::string calculation_summary_columns_;
std::string cgi_bin_log_filename_;
- std::string custom_input_filename_;
- std::string custom_output_filename_;
+ std::string custom_input_0_filename_;
+ std::string custom_input_1_filename_;
+ std::string custom_output_0_filename_;
+ std::string custom_output_1_filename_;
std::string default_input_filename_;
std::string libraries_to_preload_;
bool offer_hobsons_choice_;
Modified: lmi/trunk/configurable_settings_test.cpp
===================================================================
--- lmi/trunk/configurable_settings_test.cpp 2014-09-15 17:44:25 UTC (rev
5939)
+++ lmi/trunk/configurable_settings_test.cpp 2014-09-15 19:43:35 UTC (rev
5940)
@@ -72,6 +72,7 @@
/// Test each aspect of backward compatibility:
/// - missing 'version' attribute
/// - missing elements
+/// - renamed elements
/// - a withdrawn element
/// - an obsolete skin name
@@ -82,6 +83,8 @@
ofs
<< "<?xml version=\"1.0\"?>\n"
<< "<configurable_settings>\n"
+ << "<custom_input_filename>[renamed]</custom_input_filename>\n"
+ << "<custom_output_filename>[renamed]</custom_output_filename>\n"
<< "<xml_schema_filename>[withdrawn]</xml_schema_filename>\n"
<<
"<skin_filename>xml_notebook_private_placement.xrc</skin_filename>\n"
<< "</configurable_settings>\n"
@@ -90,6 +93,10 @@
configurable_settings& c = configurable_settings::instance();
c.xml_serializable<configurable_settings>::load(filename);
+ BOOST_TEST_EQUAL("[renamed]" , c.custom_input_0_filename());
+ BOOST_TEST_EQUAL("custom.inix" , c.custom_input_1_filename());
+ BOOST_TEST_EQUAL("[renamed]" , c.custom_output_0_filename());
+ BOOST_TEST_EQUAL("custom.out1" , c.custom_output_1_filename());
BOOST_TEST_EQUAL("skin_reg_d.xrc", c.skin_filename());
}
Modified: lmi/trunk/custom_io_0.cpp
===================================================================
--- lmi/trunk/custom_io_0.cpp 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/custom_io_0.cpp 2014-09-15 19:43:35 UTC (rev 5940)
@@ -52,7 +52,7 @@
bool custom_io_0_file_exists()
{
return 0 == access
- (configurable_settings::instance().custom_input_filename().c_str()
+ (configurable_settings::instance().custom_input_0_filename().c_str()
,F_OK
);
}
@@ -204,7 +204,7 @@
std::string actual_filename =
!filename.empty()
? filename
- : configurable_settings::instance().custom_input_filename()
+ : configurable_settings::instance().custom_input_0_filename()
;
if(0 != access(actual_filename.c_str(), F_OK))
{
@@ -484,7 +484,7 @@
std::string actual_filename =
!filename.empty()
? filename
- : configurable_settings::instance().custom_output_filename()
+ : configurable_settings::instance().custom_output_0_filename()
;
// Don't specify 'binary' here: the file is to be read by another
// program that probably expects platform-specific behavior.
Modified: lmi/trunk/illustration_view.cpp
===================================================================
--- lmi/trunk/illustration_view.cpp 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/illustration_view.cpp 2014-09-15 19:43:35 UTC (rev 5940)
@@ -360,7 +360,7 @@
{
configurable_settings const& c = configurable_settings::instance();
illustrator z(mce_emit_custom_0);
- bool close_when_done = z(c.custom_input_filename());
+ bool close_when_done = z(c.custom_input_0_filename());
if(close_when_done)
{
return true;
@@ -370,7 +370,7 @@
LMI_ASSERT(0 != dm);
IllustrationView& illview = MakeNewIllustrationDocAndView
(dm
- ,(c.custom_output_filename() + ".ill").c_str()
+ ,(c.custom_output_0_filename() + ".ill").c_str()
);
illview.SetLedger(z.principal_ledger());
illview.DisplaySelectedValuesAsHtml();
Modified: lmi/trunk/illustrator.cpp
===================================================================
--- lmi/trunk/illustrator.cpp 2014-09-15 17:44:25 UTC (rev 5939)
+++ lmi/trunk/illustrator.cpp 2014-09-15 19:43:35 UTC (rev 5940)
@@ -92,8 +92,8 @@
principal_ledger_ = z.ledger();
seconds_for_calculations_ = timer.stop().elapsed_seconds();
fs::path out_file =
- file_path.string() == c.custom_input_filename()
- ? c.custom_output_filename()
+ file_path.string() == c.custom_input_0_filename()
+ ? c.custom_output_0_filename()
: fs::change_extension(file_path, ".test0")
;
seconds_for_output_ = emit_ledger
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5940] Add some configurable settings, and rename others,
Greg Chicares <=