47#include <boost/smart_ptr/scoped_ptr.hpp>
61#define ELEMENT_ALIGN_LEFT 0x01
63 enum kind_t { STRING, EXPR };
66 std::size_t min_width;
67 std::size_t max_width;
72 : supports_flags<>(), type(STRING), min_width(0), max_width(0) {
75 ~element_t()
throw() {
79 element_t& operator=(
const element_t&
elem) {
81 supports_flags<>::operator=(
elem);
83 min_width =
elem.min_width;
84 max_width =
elem.max_width;
90 friend inline void mark_red(std::ostream& out,
const element_t *
elem) {
91 out.setf(std::ios::left);
100 if (
elem->min_width > 0)
101 out.width(
static_cast<std::streamsize
>(
elem->min_width));
104 void dump(std::ostream& out)
const;
120 static element_t * parse_elements(
const string&
fmt,
139 elements.reset(parse_elements(
_format, tmpl));
145 if (
elem->type == element_t::EXPR) {
154 virtual void dump(std::ostream& out)
const {
155 for (
const element_t *
elem = elements.get();
162 const std::size_t width,
#define TRACE_CTOR(cls, args)
#define DECLARE_EXCEPTION(name, kind)
#define ELEMENT_ALIGN_LEFT
virtual void mark_uncompiled()
void set_text(const string &txt)
static enum ledger::format_t::elision_style_t default_style
virtual void dump(std::ostream &out) const
format_t(const string &_str, scope_t *context=NULL)
virtual void mark_uncompiled()
static string truncate(const unistring &str, const std::size_t width, const std::size_t account_abbrev_length=0)
void parse_format(const string &_format, const optional< format_t & > &tmpl=none)
virtual result_type real_calc(scope_t &scope)
static bool default_style_changed
Abstract working with UTF-32 encoded Unicode strings.