ENH: more consistent order of ITstream constructor parameters

This commit is contained in:
Mark Olesen
2022-09-06 09:30:27 +02:00
parent 097008544c
commit 500ec9dd12
5 changed files with 46 additions and 21 deletions

View File

@ -210,9 +210,9 @@ Foam::ITstream::ITstream
Foam::ITstream::ITstream
(
const string& name,
const UList<token>& tokens,
IOstreamOption streamOpt
IOstreamOption streamOpt,
const string& name
)
:
Istream(streamOpt.format(), streamOpt.version()),
@ -227,9 +227,9 @@ Foam::ITstream::ITstream
Foam::ITstream::ITstream
(
const string& name,
List<token>&& tokens,
IOstreamOption streamOpt
IOstreamOption streamOpt,
const string& name
)
:
Istream(streamOpt.format(), streamOpt.version()),

View File

@ -101,20 +101,20 @@ public:
IOstreamOption streamOpt = IOstreamOption()
);
//- Copy construct from tokens, with given name
ITstream
//- Copy construct from tokens, optionally with given name
explicit ITstream
(
const string& name,
const UList<token>& tokens,
IOstreamOption streamOpt = IOstreamOption()
IOstreamOption streamOpt = IOstreamOption(),
const string& name = "input"
);
//- Move construct from tokens, with given name
ITstream
//- Move construct from tokens, optionally with given name
explicit ITstream
(
const string& name,
List<token>&& tokens,
IOstreamOption streamOpt = IOstreamOption()
IOstreamOption streamOpt = IOstreamOption(),
const string& name = "input"
);
//- Construct token list by parsing the input character sequence
@ -145,6 +145,31 @@ public:
);
// Additional constructors
//- Copy construct from tokens, with given name
ITstream
(
const string& name,
const UList<token>& tokens,
IOstreamOption streamOpt = IOstreamOption()
)
:
ITstream(tokens, streamOpt, name)
{}
//- Move construct from tokens, with given name
ITstream
(
const string& name,
List<token>&& tokens,
IOstreamOption streamOpt = IOstreamOption()
)
:
ITstream(std::move(tokens), streamOpt, name)
{}
//- Destructor
virtual ~ITstream() = default;

View File

@ -64,7 +64,7 @@ void Foam::simpleObjectRegistry::setValues
IStringStream is(os.str());
// Or alternatively?
// ITstream is(name, dEntry.dict().tokens());
// ITstream is(dEntry.dict().tokens());
for (simpleRegIOobject* obj : objects)
{
@ -129,11 +129,11 @@ void Foam::simpleObjectRegistry::setNamedValue
if (objPtr)
{
// The generic interface requires an Istream.
ITstream is("", tokenList(Foam::one{}, tok));
Log << name.c_str() << '=' << tok << nl;
// The generic interface requires an Istream.
ITstream is(tokenList(Foam::one{}, std::move(tok)));
const List<simpleRegIOobject*>& objects = *objPtr;
for (simpleRegIOobject* obj : objects)