ENH: failsafe version of Istream peek()

- return undefinedToken on error

STYLE: fix slicing of ITstream from dictionary lookup
This commit is contained in:
Mark Olesen
2021-04-16 16:49:45 +02:00
parent b62437081e
commit eb01cab052
18 changed files with 110 additions and 85 deletions

View File

@ -52,7 +52,7 @@ Foam::Function1Types::Constant<Type>::Constant
Function1<Type>(entryName, dict),
value_(Zero)
{
Istream& is = dict.lookup(entryName);
ITstream& is = dict.lookup(entryName);
word entryType(is);
is >> value_;
}

View File

@ -65,7 +65,7 @@ Foam::Function1<Type>::New
// - non-word : value for constant function
// - word : the modelType
Istream& is = eptr->stream();
ITstream& is = eptr->stream();
token firstToken(is);

View File

@ -41,7 +41,7 @@ Foam::Function1Types::Polynomial<Type>::Polynomial
coeffs_(),
canIntegrate_(true)
{
Istream& is = dict.lookup(entryName);
ITstream& is = dict.lookup(entryName);
const word entryType(is);
is >> coeffs_;

View File

@ -39,7 +39,7 @@ Foam::Function1Types::Table<Type>::Table
:
TableBase<Type>(entryName, dict)
{
Istream& is = dict.lookup(entryName);
ITstream& is = dict.lookup(entryName);
const word entryType(is);
is >> this->table_;
TableBase<Type>::check();