DEFEATURE: remove OStringStream::count() method (issue #3281)

- as seen in #3201, using count() based on the ostringstream tellp
  is not reliable since it is not updated with reset or copying.

STYLE: minor changes to string/char/span streams

- update docs to only mention string_view
- use auto return, without extra trailing 'decltype'

ENH: add IOstream size check helper methods

  * checkNativeSizes() : test only
  * fatalCheckNativeSizes() : an assert with FatalIOError
This commit is contained in:
Mark Olesen
2025-08-04 15:08:28 +02:00
parent fcc8e62e47
commit 6a72b0e607
14 changed files with 71 additions and 58 deletions

View File

@ -5,7 +5,7 @@
\ / A nd | www.openfoam.com
\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 OpenCFD Ltd.
Copyright (C) 2024-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ bool Foam::substitutionModels::dictionaryValue::processDict
{
const string& lookup = entries_[key];
OStringStream oss;
OCharStream oss;
if (lookup.empty())
{
// Add complete dictionary
@ -216,4 +216,4 @@ Foam::wordList Foam::substitutionModels::dictionaryValue::keys() const
}
// ************************************************************************* //
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\ / A nd | www.openfoam.com
\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 OpenCFD Ltd.
Copyright (C) 2024-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -124,15 +124,15 @@ bool Foam::substitutionModels::fileRegEx::apply
Info<< "Cached " << lines.size() << " lines" << endl;
OStringStream oss;
regExp re(entries_[key].c_str());
OCharStream oss;
const regExp re(entries_[key].c_str());
for (const string& data : lines)
{
regExp::results_type match;
if (re.match(data, match))
{
oss.reset();
oss.rewind();
for (size_t i = 1; i < match.size(); ++i)
{
@ -160,4 +160,4 @@ Foam::wordList Foam::substitutionModels::fileRegEx::keys() const
}
// ************************************************************************* //
// ************************************************************************* //