lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 20297761 05/27: Add a new ledger emission opt


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 20297761 05/27: Add a new ledger emission option
Date: Mon, 25 Apr 2022 12:56:13 -0400 (EDT)

branch: master
commit 20297761eaa31239a34a480c04e5daafc2228245
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Add a new ledger emission option
    
    As a general default, class ledger_emitter writes output files to the
    configurable print directory. Added an option to write them to the
    present working directory instead: soon that will become useful for
    testing.
    
    Added the new option early in the list, whose first few enumerators
    answer general "how?" questions, whereas later enumerators answer
    particular "what?" questions. Changing the power-of-two enumerators
    is safe because the underlying values are used only by name, never by
    explicit numeric value.
---
 emit_ledger.cpp        |  3 ++-
 mc_enum_type_enums.hpp | 23 ++++++++++++-----------
 mc_enum_types.cpp      |  4 +++-
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/emit_ledger.cpp b/emit_ledger.cpp
index 33e12838..d3e5d986 100644
--- a/emit_ledger.cpp
+++ b/emit_ledger.cpp
@@ -54,9 +54,10 @@ ledger_emitter::ledger_emitter
 {
     LMI_ASSERT(!case_filepath_.empty());
 
+    bool const emit_to_pwd = emission_ & mce_emit_to_pwd;
     configurable_settings const& c = configurable_settings::instance();
     std::string const& tsv_ext   = c.spreadsheet_file_extension();
-    std::string const& print_dir = c.print_directory();
+    std::string const& print_dir = emit_to_pwd ? "" : c.print_directory();
     fs::path const f(modify_directory(case_filepath_, print_dir));
 
     if(emission_ & mce_emit_spreadsheet)
diff --git a/mc_enum_type_enums.hpp b/mc_enum_type_enums.hpp
index e5e8ddcd..ca71e49d 100644
--- a/mc_enum_type_enums.hpp
+++ b/mc_enum_type_enums.hpp
@@ -42,17 +42,18 @@ enum mcenum_emission
     {mce_emit_nothing        =    0
     ,mce_emit_composite_only =    1
     ,mce_emit_quietly        =    2
-    ,mce_emit_timings        =    4
-    ,mce_emit_pdf_file       =    8
-    ,mce_emit_pdf_to_printer =   16 // GUI only.
-    ,mce_emit_pdf_to_viewer  =   32 // GUI only.
-    ,mce_emit_test_data      =   64
-    ,mce_emit_spreadsheet    =  128
-    ,mce_emit_group_roster   =  256
-    ,mce_emit_text_stream    =  512
-    ,mce_emit_custom_0       = 1024
-    ,mce_emit_custom_1       = 2048
-    ,mce_emit_group_quote    = 4096
+    ,mce_emit_to_pwd         =    4
+    ,mce_emit_timings        =    8
+    ,mce_emit_pdf_file       =   16
+    ,mce_emit_pdf_to_printer =   32 // GUI only.
+    ,mce_emit_pdf_to_viewer  =   64 // GUI only.
+    ,mce_emit_test_data      =  128
+    ,mce_emit_spreadsheet    =  256
+    ,mce_emit_group_roster   =  512
+    ,mce_emit_text_stream    = 1024
+    ,mce_emit_custom_0       = 2048
+    ,mce_emit_custom_1       = 4096
+    ,mce_emit_group_quote    = 8192
     };
 
 /// Rounding styles.
diff --git a/mc_enum_types.cpp b/mc_enum_types.cpp
index c53b100e..ded2be53 100644
--- a/mc_enum_types.cpp
+++ b/mc_enum_types.cpp
@@ -56,6 +56,7 @@ extern mcenum_emission const emission_enums[] =
     {mce_emit_nothing
     ,mce_emit_composite_only
     ,mce_emit_quietly
+    ,mce_emit_to_pwd
     ,mce_emit_timings
     ,mce_emit_pdf_file
     ,mce_emit_pdf_to_printer
@@ -72,6 +73,7 @@ extern char const*const emission_strings[] =
     {"emit_nothing"
     ,"emit_composite_only"
     ,"emit_quietly"
+    ,"emit_to_pwd"
     ,"emit_timings"
     ,"emit_pdf_file"
     ,"emit_pdf_to_printer"
@@ -85,7 +87,7 @@ extern char const*const emission_strings[] =
     ,"emit_group_quote"
     };
 template<> struct mc_enum_key<mcenum_emission>
-  :public mc_enum_data<mcenum_emission, 14, emission_enums, emission_strings> 
{};
+  :public mc_enum_data<mcenum_emission, 15, emission_enums, emission_strings> 
{};
 template class mc_enum<mcenum_emission>;
 
 extern rounding_style const rounding_style_enums[] =



reply via email to

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