summaryrefslogtreecommitdiff
path: root/src/format.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-27 19:01:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-27 19:01:55 -0400
commitaae134f69275e4f71ec70d893cdfd0b5839fef8e (patch)
tree57413e98e1adafe38315a7397b24ca350690c853 /src/format.h
parentcbf8f355d16224bc119e2d41a22a1d0b9d7bf0ff (diff)
downloadfork-ledger-aae134f69275e4f71ec70d893cdfd0b5839fef8e.tar.gz
fork-ledger-aae134f69275e4f71ec70d893cdfd0b5839fef8e.tar.bz2
fork-ledger-aae134f69275e4f71ec70d893cdfd0b5839fef8e.zip
Fixed a display issue with the balance report
Diffstat (limited to 'src/format.h')
-rw-r--r--src/format.h24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/format.h b/src/format.h
index bc513f71..8b2a7965 100644
--- a/src/format.h
+++ b/src/format.h
@@ -61,7 +61,7 @@ DECLARE_EXCEPTION(format_error, std::runtime_error);
*/
class format_t : public noncopyable
{
- struct element_t : public supports_flags<>, public noncopyable
+ struct element_t : public supports_flags<>
{
#define ELEMENT_ALIGN_LEFT 0x01
@@ -82,6 +82,21 @@ class format_t : public noncopyable
~element_t() throw() {
TRACE_DTOR(element_t);
}
+ element_t(const element_t& elem) : supports_flags<>() {
+ *this = elem;
+ }
+
+ element_t& operator=(const element_t& elem) {
+ if (this != &elem) {
+ supports_flags<>::operator=(elem);
+ type = elem.type;
+ min_width = elem.min_width;
+ max_width = elem.max_width;
+ chars = elem.chars;
+ expr = elem.expr;
+ }
+ return *this;
+ }
friend inline void mark_red(std::ostream& out, const element_t * elem) {
out.setf(std::ios::left);
@@ -114,7 +129,8 @@ public:
static bool default_style_changed;
private:
- static element_t * parse_elements(const string& fmt);
+ static element_t * parse_elements(const string& fmt,
+ const optional<format_t&>& tmpl);
public:
format_t() {
@@ -128,8 +144,8 @@ public:
TRACE_DTOR(format_t);
}
- void parse(const string& _format) {
- elements.reset(parse_elements(_format));
+ void parse(const string& _format, const optional<format_t&>& tmpl = none) {
+ elements.reset(parse_elements(_format, tmpl));
format_string = _format;
}