mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: added OStringStream reset method (closes #534)
- resets the output buffer completely - implementing what rewind was likely meant to have accomplished for many use cases. STYLE: OSHA1stream reset() for symmetry. Deprecate rewind().
This commit is contained in:
@ -52,9 +52,11 @@ int main(int argc, char *argv[])
|
||||
Info<< "overwrite with short string:" << nl
|
||||
<< os.str() << endl;
|
||||
|
||||
// os.reset();
|
||||
// Info<< "after reset:" << nl
|
||||
// << os.str() << endl;
|
||||
os.reset();
|
||||
os << "%%%% reset";
|
||||
|
||||
Info<< "after reset:" << nl
|
||||
<< os.str() << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
|
||||
@ -47,8 +47,24 @@ int main(int argc, char *argv[])
|
||||
|
||||
IOWarningInFunction(dict) << "warning 3" << endl;
|
||||
|
||||
FatalErrorInFunction << "error 1" << endl;
|
||||
FatalErrorInFunction << "error 2" << exit(FatalError);
|
||||
FatalErrorInFunction
|
||||
<< "This is an error from 1" << nl
|
||||
<< "Explanation to follow:" << endl;
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Error 2"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
catch (Foam::error& fErr)
|
||||
{
|
||||
Serr<< "Caught Foam error " << fErr << nl << endl;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Error# 3"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
catch (Foam::error& fErr)
|
||||
{
|
||||
|
||||
@ -96,7 +96,7 @@ int main(int argc, char * argv[])
|
||||
os << str;
|
||||
Info<< os.digest() << endl;
|
||||
|
||||
os.rewind();
|
||||
os.reset();
|
||||
os << "The quick brown fox jumps over the lazy dog";
|
||||
Info<< os.digest() << endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user