ENH: more consistent order of ITstream constructor parameters
This commit is contained in:
parent
097008544c
commit
500ec9dd12
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -104,7 +104,7 @@ void readList
|
|||||||
{
|
{
|
||||||
OTstream os;
|
OTstream os;
|
||||||
os << input;
|
os << input;
|
||||||
ITstream is("input", os.tokens());
|
ITstream is(os.tokens());
|
||||||
|
|
||||||
is >> output;
|
is >> output;
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ void readList
|
|||||||
{
|
{
|
||||||
OTstream os;
|
OTstream os;
|
||||||
os << input;
|
os << input;
|
||||||
ITstream is("input", os.tokens());
|
ITstream is(os.tokens());
|
||||||
|
|
||||||
is >> output;
|
is >> output;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
|||||||
OTstream os;
|
OTstream os;
|
||||||
os << poly;
|
os << poly;
|
||||||
|
|
||||||
ITstream is("input", std::move(os.tokens()));
|
ITstream is(std::move(os.tokens()));
|
||||||
is >> polyfunc;
|
is >> polyfunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,9 +210,9 @@ Foam::ITstream::ITstream
|
|||||||
|
|
||||||
Foam::ITstream::ITstream
|
Foam::ITstream::ITstream
|
||||||
(
|
(
|
||||||
const string& name,
|
|
||||||
const UList<token>& tokens,
|
const UList<token>& tokens,
|
||||||
IOstreamOption streamOpt
|
IOstreamOption streamOpt,
|
||||||
|
const string& name
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Istream(streamOpt.format(), streamOpt.version()),
|
Istream(streamOpt.format(), streamOpt.version()),
|
||||||
@ -227,9 +227,9 @@ Foam::ITstream::ITstream
|
|||||||
|
|
||||||
Foam::ITstream::ITstream
|
Foam::ITstream::ITstream
|
||||||
(
|
(
|
||||||
const string& name,
|
|
||||||
List<token>&& tokens,
|
List<token>&& tokens,
|
||||||
IOstreamOption streamOpt
|
IOstreamOption streamOpt,
|
||||||
|
const string& name
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Istream(streamOpt.format(), streamOpt.version()),
|
Istream(streamOpt.format(), streamOpt.version()),
|
||||||
|
@ -101,20 +101,20 @@ public:
|
|||||||
IOstreamOption streamOpt = IOstreamOption()
|
IOstreamOption streamOpt = IOstreamOption()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from tokens, with given name
|
//- Copy construct from tokens, optionally with given name
|
||||||
ITstream
|
explicit ITstream
|
||||||
(
|
(
|
||||||
const string& name,
|
|
||||||
const UList<token>& tokens,
|
const UList<token>& tokens,
|
||||||
IOstreamOption streamOpt = IOstreamOption()
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
|
const string& name = "input"
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Move construct from tokens, with given name
|
//- Move construct from tokens, optionally with given name
|
||||||
ITstream
|
explicit ITstream
|
||||||
(
|
(
|
||||||
const string& name,
|
|
||||||
List<token>&& tokens,
|
List<token>&& tokens,
|
||||||
IOstreamOption streamOpt = IOstreamOption()
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
|
const string& name = "input"
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct token list by parsing the input character sequence
|
//- 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
|
//- Destructor
|
||||||
virtual ~ITstream() = default;
|
virtual ~ITstream() = default;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void Foam::simpleObjectRegistry::setValues
|
|||||||
IStringStream is(os.str());
|
IStringStream is(os.str());
|
||||||
|
|
||||||
// Or alternatively?
|
// Or alternatively?
|
||||||
// ITstream is(name, dEntry.dict().tokens());
|
// ITstream is(dEntry.dict().tokens());
|
||||||
|
|
||||||
for (simpleRegIOobject* obj : objects)
|
for (simpleRegIOobject* obj : objects)
|
||||||
{
|
{
|
||||||
@ -129,11 +129,11 @@ void Foam::simpleObjectRegistry::setNamedValue
|
|||||||
|
|
||||||
if (objPtr)
|
if (objPtr)
|
||||||
{
|
{
|
||||||
// The generic interface requires an Istream.
|
|
||||||
ITstream is("", tokenList(Foam::one{}, tok));
|
|
||||||
|
|
||||||
Log << name.c_str() << '=' << tok << nl;
|
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;
|
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||||
|
|
||||||
for (simpleRegIOobject* obj : objects)
|
for (simpleRegIOobject* obj : objects)
|
||||||
|
Loading…
Reference in New Issue
Block a user