dictionaryEntry.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) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2017-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "dictionaryEntry.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::dictionaryEntry::dictionaryEntry
34 (
35  const keyType& key,
36  const dictionary& parentDict,
37  const dictionary& dict
38 )
39 :
40  entry(key),
41  dictionary(parentDict, dict)
42 {}
43 
44 
45 Foam::dictionaryEntry::dictionaryEntry
46 (
47  const dictionary& parentDict,
48  const dictionaryEntry& dictEnt
49 )
50 :
51  entry(dictEnt),
52  dictionary(parentDict, dictEnt)
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
59 {
60  if (size())
61  {
62  return first()->startLineNumber();
63  }
64 
65  return -1;
66 }
67 
68 
70 {
71  if (size())
72  {
73  return last()->endLineNumber();
74  }
75 
76  return -1;
77 }
78 
79 
81 {
83  << "Attempt to return dictionary entry as a primitive"
84  << abort(FatalIOError);
85 
86  return lookup("");
87 }
88 
89 
91 {
92  return this;
93 }
94 
95 
97 {
98  return this;
99 }
100 
101 
103 {
104  return *this;
105 }
106 
107 
109 {
110  return *this;
111 }
112 
113 
114 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:65
Foam::dictionaryEntry::dict
virtual const dictionary & dict() const noexcept
Return dictionary (ie, this)
Definition: dictionaryEntry.C:102
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
Foam::FatalIOError
IOerror FatalIOError
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:68
Foam::dictionaryEntry::stream
virtual ITstream & stream() const
Definition: dictionaryEntry.C:80
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:52
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.H:63
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
dictionaryEntry.H
Foam::dictionaryEntry::endLineNumber
virtual label endLineNumber() const
Return line number of last token in dictionary.
Definition: dictionaryEntry.C:69
Foam::dictionaryEntry::dictPtr
virtual const dictionary * dictPtr() const noexcept
Return pointer to this dictionary.
Definition: dictionaryEntry.C:90
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Foam::dictionaryEntry::startLineNumber
virtual label startLineNumber() const
Return line number of first token in dictionary.
Definition: dictionaryEntry.C:58