[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0c85a7a 154/156: Avoid using directive for th
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0c85a7a 154/156: Avoid using directive for the "html" namespace |
Date: |
Tue, 30 Jan 2018 17:22:35 -0500 (EST) |
branch: master
commit 0c85a7a99aa83f0f104c2431a80b6a76c07fc250
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Avoid using directive for the "html" namespace
It is unnecessarily broad and could be replaced by a using declaration
for html::text or even just spelling out the type name fully in
relatively few places where it is used, as this commit does, to make the
code more clear.
No real changes.
---
ledger_pdf_generator_wx.cpp | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index a3e0c57..ae6d649 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -60,8 +60,6 @@
LMI_FORCE_LINKING_IN_SITU(ledger_pdf_generator_wx)
-using namespace html;
-
namespace
{
@@ -154,9 +152,9 @@ class html_interpolator
// The variable names recognized by this function are either those defined
// by ledger_evaluator, i.e. scalar and vector fields of the ledger, or any
// variables explicitly defined by add_variable() calls.
- text operator()(char const* s) const
+ html::text operator()(char const* s) const
{
- return text::from_html
+ return html::text::from_html
(interpolate_string
(s
,[this]
@@ -170,7 +168,7 @@ class html_interpolator
);
}
- text operator()(std::string const& s) const
+ html::text operator()(std::string const& s) const
{
return (*this)(s.c_str());
}
@@ -178,14 +176,14 @@ class html_interpolator
// Add a variable, providing either its raw text or already escaped HTML
// representation. Boolean values are converted to strings "0" or "1" as
// expected.
- void add_variable(std::string const& name, text const& value)
+ void add_variable(std::string const& name, html::text const& value)
{
vars_[name] = value;
}
void add_variable(std::string const& name, std::string const& value)
{
- add_variable(name, text::from(value));
+ add_variable(name, html::text::from(value));
}
void add_variable(std::string const& name, int value)
@@ -235,14 +233,14 @@ class html_interpolator
//
// This is exactly the same as interpolating "{{>template_name}}" string
// but a bit more convenient to use and simpler to read.
- text expand_template(std::string const& template_name) const
+ html::text expand_template(std::string const& template_name) const
{
return (*this)("{{>" + template_name + "}}");
}
private:
// The expansion function used with interpolate_string().
- text expand_html(std::string const& s) const
+ html::text expand_html(std::string const& s) const
{
// Check our own variables first:
auto const it = vars_.find(s);
@@ -278,7 +276,7 @@ class html_interpolator
}
// Cast below is valid because of the check for overflow above.
- return text::from
+ return html::text::from
(evaluator_
(s.substr(0, open_pos)
,static_cast<std::size_t>(index)
@@ -286,7 +284,7 @@ class html_interpolator
);
}
- return text::from(evaluator_(s));
+ return html::text::from(evaluator_(s));
}
std::string load_partial_from_file(std::string const& file) const
@@ -310,7 +308,7 @@ class html_interpolator
ledger_evaluator const evaluator_;
// Variables defined for all pages of this illustration.
- std::map<std::string, text> vars_;
+ std::map<std::string, html::text> vars_;
};
// A slightly specialized table generator for the tables used in the
@@ -831,14 +829,14 @@ class pdf_illustration : protected html_interpolator
add_variable
("date_prepared"
- , text::from(evaluate("PrepMonth"))
- + text::nbsp()
- + text::from(evaluate("PrepDay"))
- + text::from(", ")
- + text::from(evaluate("PrepYear"))
+ , html::text::from(evaluate("PrepMonth"))
+ + html::text::nbsp()
+ + html::text::from(evaluate("PrepDay"))
+ + html::text::from(", ")
+ + html::text::from(evaluate("PrepYear"))
);
- auto indent = text::nbsp();
+ auto indent = html::text::nbsp();
add_variable("Space1", indent);
indent += indent;
@@ -1106,7 +1104,7 @@ class page_with_footer : public page
// This method uses get_page_number() and returns the HTML wrapping it
// and other fixed information appearing in the lower part of the footer.
- text get_footer_lower_html(html_interpolator const& interpolate_html) const
+ html::text get_footer_lower_html(html_interpolator const&
interpolate_html) const
{
auto const page_number_str = get_page_number();
@@ -1115,7 +1113,7 @@ class page_with_footer : public page
// Use our own interpolation function to handle the special
// "page_number" variable that is replaced with the actual
// (possibly dynamic) page number.
- return text::from_html
+ return html::text::from_html
(interpolate_string
(("{{>" + templ + "}}").c_str()
,[page_number_str, interpolate_html]
- [lmi-commits] [lmi] master d77620f 100/156: Factor out dollar_units template from the existing ones, (continued)
- [lmi-commits] [lmi] master d77620f 100/156: Factor out dollar_units template from the existing ones, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 833eef5 086/156: Use std::make_unique<> instead of raw "new", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 34c088c 073/156: Move footer contents into an external template too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0ba1c32 146/156: Consistently use "curr" as abbreviation of "current", Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 29865fc 133/156: Add supplemental report to NASD illustrations too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 919d796 001/156: Remove old XSL-FO-based PDF generation code, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master cc7fc05 143/156: Change template file extension from .mustache to .mst, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 08984bb 148/156: Recognize Mustache files in the coding rules test, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master de5a5c7 151/156: Fix interpolate_string_test build, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb5693e 136/156: Harmonize spacing in header in reg_d_group illustrations too, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 0c85a7a 154/156: Avoid using directive for the "html" namespace,
Greg Chicares <=
- [lmi-commits] [lmi] master 463e8ca 138/156: Fix bug with page numbers in subsequent illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 830e1fd 130/156: Manually break column titles into lines, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 43859a6 053/156: Add support for "measure only" output mode to wx_table_generator, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 772f4a4 139/156: Refactor: use get_fixed_page_contents_template_name(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 81ccdc8 129/156: Remove the never used elements of the columns title map, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2478fbc 010/156: Start implementing PDF illustrations directly, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 9d24cd9 024/156: Compilation fix for C++11 but not C++14 compilers, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1229745 020/156: Make add_body_paragraph() even more convenient to use, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 14aca9e 142/156: Replace underscores in title map with explicit line breaks, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 5241f0f 045/156: Fix some typos in wx_table_generator::add_column() comment, Greg Chicares, 2018/01/30