lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 75ce7bd 2/5: Replace operator() with value()


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 75ce7bd 2/5: Replace operator() with value() for clarity
Date: Fri, 5 Oct 2018 20:32:46 -0400 (EDT)

branch: master
commit 75ce7bdbf5d6fa15fd240aa251e9d5a774d046dd
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Replace operator() with value() for clarity
---
 ledger_evaluator.cpp        | 14 +++++++-------
 ledger_evaluator.hpp        |  4 ++--
 ledger_pdf_generator_wx.cpp |  8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index ce30262..4213e91 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -986,17 +986,17 @@ ledger_evaluator Ledger::make_evaluator() const
     return ledger_evaluator(std::move(stringscalars), 
std::move(stringvectors));
 }
 
-std::string ledger_evaluator::operator()(std::string const& scalar) const
+std::string ledger_evaluator::value(std::string const& scalar_name) const
 {
-    return map_lookup(scalars_, scalar);
+    return map_lookup(scalars_, scalar_name);
 }
 
-std::string ledger_evaluator::operator()
-    (std::string const& vector
+std::string ledger_evaluator::value
+    (std::string const& vector_name
     ,int                index
     ) const
 {
-    return map_lookup(vectors_, vector).at(index);
+    return map_lookup(vectors_, vector_name).at(index);
 }
 
 /// Write values to a TSV file as a side effect of writing a PDF.
@@ -1008,7 +1008,7 @@ std::string ledger_evaluator::operator()
 
 void ledger_evaluator::write_tsv(fs::path const& pdf_out_file) const
 {
-    if("1" != operator()("WriteTsvFile")) return;
+    if("1" != value("WriteTsvFile")) return;
 
     configurable_settings const& c = configurable_settings::instance();
     std::string const& z = c.spreadsheet_file_extension();
@@ -1024,7 +1024,7 @@ void ledger_evaluator::write_tsv(fs::path const& 
pdf_out_file) const
         }
     ofs << '\n';
 
-    int const length = value_cast<int>(operator()("GreatestLapseDuration"));
+    int const length = value_cast<int>(value("GreatestLapseDuration"));
     for(int i = 0; i < length; ++i)
         {
         for(auto const& j : sorted_vectors)
diff --git a/ledger_evaluator.hpp b/ledger_evaluator.hpp
index e7ef979..1a2230b 100644
--- a/ledger_evaluator.hpp
+++ b/ledger_evaluator.hpp
@@ -44,8 +44,8 @@ class LMI_SO ledger_evaluator
     using vector_map_t = umap<std::string,std::vector<std::string>>;
 
   public:
-    std::string operator()(std::string const& scalar) const;
-    std::string operator()(std::string const& vector, int index) const;
+    std::string value(std::string const& scalar_name) const;
+    std::string value(std::string const& vector_name, int index) const;
 
     void write_tsv(fs::path const&) const;
 
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index efa66a1..9d35269 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -222,13 +222,13 @@ class html_interpolator
     // Return the value of a single scalar variable.
     std::string evaluate(std::string const& name) const
     {
-        return evaluator_(name);
+        return evaluator_.value(name);
     }
 
     // Return a single value of a vector variable.
     std::string evaluate(std::string const& name, int index) const
     {
-        return evaluator_(name, index);
+        return evaluator_.value(name, index);
     }
 
     // Interpolate the contents of the given external template.
@@ -284,14 +284,14 @@ class html_interpolator
 
             // Cast below is valid because of the check for overflow above.
             return html::text::from
-                (evaluator_
+                (evaluator_.value
                     (s.substr(0, open_pos)
                     ,bourn_cast<int>(index)
                     )
                 );
             }
 
-        return html::text::from(evaluator_(s));
+        return html::text::from(evaluator_.value(s));
     }
 
     std::string load_partial_from_file(std::string const& file) const



reply via email to

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