diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-09-05 20:44:55 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-09-05 20:44:55 +0000 |
commit | e5f2e1ce7faeb8fb4609f7291e77d5b682685057 (patch) | |
tree | c00b5d47966aef916f8a2f055aedadade5fa95d3 /src/stable/string.cpp | |
parent | 69d1606ac97547896a0ede8dee5e59fc4a5de7c2 (diff) | |
download | libbu++-e5f2e1ce7faeb8fb4609f7291e77d5b682685057.tar.gz libbu++-e5f2e1ce7faeb8fb4609f7291e77d5b682685057.tar.bz2 libbu++-e5f2e1ce7faeb8fb4609f7291e77d5b682685057.tar.xz libbu++-e5f2e1ce7faeb8fb4609f7291e77d5b682685057.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/stable/string.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
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 | |||
1228 | // Sub-class Bu::String::FormatProxy | 1228 | // Sub-class Bu::String::FormatProxy |
1229 | // | 1229 | // |
1230 | 1230 | ||
1231 | Bu::String::FormatProxy::FormatProxy( const String &rFmt ) : | 1231 | Bu::String::FormatProxy::FormatProxy( const String &rFmt, |
1232 | rFmt( rFmt ) | 1232 | String::FormatProxyEndAction *pAct ) : |
1233 | rFmt( rFmt ), | ||
1234 | pAct( pAct ), | ||
1235 | bOpen( true ) | ||
1233 | { | 1236 | { |
1234 | } | 1237 | } |
1235 | 1238 | ||
1236 | Bu::String::FormatProxy::~FormatProxy() | 1239 | Bu::String::FormatProxy::~FormatProxy() |
1237 | { | 1240 | { |
1241 | if( pAct && bOpen ) | ||
1242 | end(); | ||
1243 | |||
1244 | delete pAct; | ||
1238 | } | 1245 | } |
1239 | 1246 | ||
1240 | Bu::String::FormatProxy::operator Bu::String() const | 1247 | Bu::String Bu::String::FormatProxy::end() const |
1241 | { | 1248 | { |
1242 | int iCount = lArgs.getSize(); | 1249 | int iCount = lArgs.getSize(); |
1243 | ArgList::const_iterator *aArg = | 1250 | ArgList::const_iterator *aArg = |
@@ -1287,8 +1294,12 @@ Bu::String::FormatProxy::operator Bu::String() const | |||
1287 | } | 1294 | } |
1288 | s++; | 1295 | s++; |
1289 | } | 1296 | } |
1290 | 1297 | ||
1298 | bOpen = false; | ||
1291 | delete[] aArg; | 1299 | delete[] aArg; |
1300 | |||
1301 | if( pAct ) | ||
1302 | (*pAct)( mbOut.getString() ); | ||
1292 | return mbOut.getString(); | 1303 | return mbOut.getString(); |
1293 | } | 1304 | } |
1294 | 1305 | ||