OpenFOAM: API Guide
v2112
The open source CFD toolbox
functionEntryTemplates.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2017-2019 OpenCFD Ltd.
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
\*---------------------------------------------------------------------------*/
27
28
#include "
functionEntry.H
"
29
#include "
ISstream.H
"
30
31
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32
33
template
<
class
StringType>
34
Foam::List<StringType>
35
Foam::functionEntry::readStringList
(
Istream
& is)
36
{
37
List<StringType>
list;
38
39
ISstream
& iss =
dynamic_cast<
ISstream
&
>
(is);
40
token
firstToken(iss);
41
42
const
bool
isStringTok = firstToken.
isStringType
();
43
44
iss.
putBack
(firstToken);
45
46
if
(isStringTok)
47
{
48
// The first token appears viable as non-list
49
// - treated like list with a single entry
50
51
list.
resize
(1);
52
iss >> list.
first
();
53
}
54
else
55
{
56
iss >> list;
57
}
58
59
return
list;
60
}
61
62
63
// ************************************************************************* //
ISstream.H
Foam::ISstream
Generic input stream using a standard (STL) stream.
Definition:
ISstream.H:58
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition:
Istream.H:64
Foam::Istream::putBack
void putBack(const token &tok)
Put back a token. Only a single put back is permitted.
Definition:
Istream.C:70
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition:
List.H:77
Foam::List::resize
void resize(const label len)
Adjust allocated size of list.
Definition:
ListI.H:139
Foam::UList::first
T & first()
Return the first element of the list.
Definition:
UListI.H:202
Foam::functionEntry::readStringList
static List< StringType > readStringList(Istream &is)
Foam::token
A token holds an item read from Istream.
Definition:
token.H:69
Foam::token::isStringType
bool isStringType() const noexcept
Definition:
tokenI.H:683
functionEntry.H
src
OpenFOAM
db
dictionary
functionEntries
functionEntry
functionEntryTemplates.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.