Added STR() utility function
This commit is contained in:
parent
eac84f5e21
commit
8013e09129
3 changed files with 12 additions and 3 deletions
|
|
@ -35,6 +35,9 @@
|
||||||
|
|
||||||
namespace ledger {
|
namespace ledger {
|
||||||
|
|
||||||
|
straccstream _accum;
|
||||||
|
std::ostringstream _accum_buffer;
|
||||||
|
|
||||||
std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
||||||
{
|
{
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,14 @@ public:
|
||||||
|
|
||||||
#define ACCUM(obj) (static_cast<const straccstream&>(obj).str())
|
#define ACCUM(obj) (static_cast<const straccstream&>(obj).str())
|
||||||
|
|
||||||
|
extern straccstream _accum;
|
||||||
|
extern std::ostringstream _accum_buffer;
|
||||||
|
|
||||||
|
#define STR(msg) \
|
||||||
|
((_accum_buffer << ACCUM(_accum << msg)), \
|
||||||
|
_accum.clear(), \
|
||||||
|
_accum_buffer.str())
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
||||||
#endif // _ACCUM_H
|
#endif // _ACCUM_H
|
||||||
|
|
|
||||||
|
|
@ -67,10 +67,8 @@ void draft_t::xact_template_t::dump(std::ostream& out) const
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
foreach (const post_template_t& post, posts) {
|
foreach (const post_template_t& post, posts) {
|
||||||
straccstream accum;
|
|
||||||
out << std::endl
|
out << std::endl
|
||||||
<< ACCUM(accum << _("[Posting \"%1\"]")
|
<< STR(_("[Posting \"%1\"]") << (post.from ? _("from") : _("to")))
|
||||||
<< (post.from ? _("from") : _("to")))
|
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
if (post.account_mask)
|
if (post.account_mask)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue