1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A keyword and a list of tokens is a 'dictionaryEntry'.
31 An dictionaryEntry can be read, written and printed, and the types and
32 values of its tokens analysed. A dictionaryEntry is a high-level building
33 block for data description. It is a front-end for the token parser.
34 A list of entries can be used as a set of keyword syntax elements,
41 \*---------------------------------------------------------------------------*/
43 #ifndef dictionaryEntry_H
44 #define dictionaryEntry_H
47 #include "dictionary.H"
48 #include "InfoProxy.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class dictionaryEntry Declaration
57 \*---------------------------------------------------------------------------*/
64 // Private member functions
66 void readData(Istream&);
68 //- Dissallow bitwise copy
69 dictionaryEntry(const dictionary&);
76 //- Construct from the parent dictionary and Istream
77 dictionaryEntry(const dictionary& parentDict, Istream& is);
79 //- Construct from the keyword, parent dictionary and a Istream
83 const dictionary& parentDict,
87 //- Construct from the keyword, parent dictionary and a dictionary
91 const dictionary& parentDict,
92 const dictionary& dict
95 //- Construct as copy for the given parentDict
98 const dictionary& parentDict,
99 const dictionaryEntry& dictEnt
102 autoPtr<entry> clone(const dictionary& parentDict) const
104 return autoPtr<entry>(new dictionaryEntry(parentDict, *this));
110 //- Return the dictionary name
111 const fileName& name() const
113 return dictionary::name();
116 //- Return the dictionary name
119 return dictionary::name();
122 //- Return line number of first token in dictionary
123 label startLineNumber() const;
125 //- Return line number of last token in dictionary
126 label endLineNumber() const;
128 //- This entry is not a primitive,
129 // calling this function generates a FatalError
130 ITstream& stream() const;
132 //- Return true because this entry is a dictionary
138 //- Return dictionary
139 const dictionary& dict() const;
141 //- Return non-const access to dictionary
145 void write(Ostream&) const;
147 //- Return info proxy.
148 // Used to print token information to a stream
149 InfoProxy<dictionaryEntry> info() const
157 friend Ostream& operator<<(Ostream&, const dictionaryEntry&);
161 #if defined (__GNUC__)
164 Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 } // End namespace Foam
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 // ************************************************************************* //