From e5f2e1ce7faeb8fb4609f7291e77d5b682685057 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 5 Sep 2012 20:44:55 +0000 Subject: This'll make *everything* rebuild. String formatters now support the end() call, which will force substitution and return a string. They now also support ending actions, which let us do great stuff like printing stuff out after formatting finished...and other stuff. --- src/stable/string.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/stable/string.cpp') diff --git a/src/stable/string.cpp b/src/stable/string.cpp index 4cef6b1..d1f76aa 100644 --- a/src/stable/string.cpp +++ b/src/stable/string.cpp @@ -1228,16 +1228,23 @@ bool Bu::String::isFlat() const // Sub-class Bu::String::FormatProxy // -Bu::String::FormatProxy::FormatProxy( const String &rFmt ) : - rFmt( rFmt ) +Bu::String::FormatProxy::FormatProxy( const String &rFmt, + String::FormatProxyEndAction *pAct ) : + rFmt( rFmt ), + pAct( pAct ), + bOpen( true ) { } Bu::String::FormatProxy::~FormatProxy() { + if( pAct && bOpen ) + end(); + + delete pAct; } -Bu::String::FormatProxy::operator Bu::String() const +Bu::String Bu::String::FormatProxy::end() const { int iCount = lArgs.getSize(); ArgList::const_iterator *aArg = @@ -1287,8 +1294,12 @@ Bu::String::FormatProxy::operator Bu::String() const } s++; } - + + bOpen = false; delete[] aArg; + + if( pAct ) + (*pAct)( mbOut.getString() ); return mbOut.getString(); } -- cgit v1.2.3