Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
db
dictionary
primitiveEntry
primitiveEntry.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
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
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::primitiveEntry
26
27
Description
28
A keyword and a list of tokens is a 'primitiveEntry'.
29
An primitiveEntry can be read, written and printed, and the types and
30
values of its tokens analysed.
31
32
A primitiveEntry is a high-level building block for data description. It
33
is a front-end for the token parser. A list of entries can be used as a
34
set of keyword syntax elements, for example.
35
36
SourceFiles
37
primitiveEntry.C
38
primitiveEntryIO.C
39
40
\*---------------------------------------------------------------------------*/
41
42
#ifndef primitiveEntry_H
43
#define primitiveEntry_H
44
45
#include <
OpenFOAM/IStringStream.H
>
46
#include <
OpenFOAM/OStringStream.H
>
47
48
#include <
OpenFOAM/entry.H
>
49
#include <
OpenFOAM/ITstream.H
>
50
#include <
OpenFOAM/InfoProxy.H
>
51
52
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54
namespace
Foam
55
{
56
57
class
dictionary;
58
59
/*---------------------------------------------------------------------------*\
60
Class primitiveEntry Declaration
61
\*---------------------------------------------------------------------------*/
62
63
class
primitiveEntry
64
:
65
public
entry
,
66
public
ITstream
67
{
68
// Private member functions
69
70
//- Append the given token to this entry
71
void
append
72
(
73
const
token
& currToken,
74
const
dictionary
&,
75
Istream
&
76
);
77
78
//- Append the given tokens starting at the current tokenIndex
79
void
append(
const
tokenList
&);
80
81
//- Expand the given variable (keyword starts with $)
82
bool
expandVariable(
const
word
&,
const
dictionary
&);
83
84
//- Expand the given function (keyword starts with #)
85
bool
expandFunction
86
(
87
const
word
&,
88
const
dictionary
&,
89
Istream
&
90
);
91
92
//- Read the complete entry from the given stream
93
void
readEntry(
const
dictionary
&,
Istream
&);
94
95
//- Insert the given tokens at token posI
96
void
insert(
const
tokenList
&,
const
label posI);
97
98
99
public
:
100
101
// Constructors
102
103
//- Construct from keyword and a Istream
104
primitiveEntry
(
const
keyType
&,
Istream
&);
105
106
//- Construct from keyword, parent dictionary and Istream
107
primitiveEntry
(
const
keyType
&,
const
dictionary
& parentDict,
Istream
&);
108
109
//- Construct from keyword and a ITstream
110
primitiveEntry
(
const
keyType
&,
const
ITstream
&);
111
112
//- Construct from keyword and a token
113
primitiveEntry
(
const
keyType
&,
const
token
&);
114
115
//- Construct from keyword and a tokenList
116
primitiveEntry
(
const
keyType
&,
const
tokenList
&);
117
118
//- Construct from keyword and a T
119
template
<
class
T>
120
primitiveEntry
(
const
keyType
&,
const
T
&);
121
122
autoPtr<entry>
clone
(
const
dictionary
&)
const
123
{
124
return
autoPtr<entry>
(
new
primitiveEntry
(*
this
));
125
}
126
127
128
// Member functions
129
130
//- Return the dictionary name
131
const
fileName
&
name
()
const
132
{
133
return
ITstream::name
();
134
}
135
136
//- Return the dictionary name
137
fileName
&
name
()
138
{
139
return
ITstream::name
();
140
}
141
142
//- Return line number of first token in dictionary
143
label
startLineNumber
()
const
;
144
145
//- Return line number of last token in dictionary
146
label
endLineNumber
()
const
;
147
148
//- Return true because this entry is a stream
149
bool
isStream
()
const
150
{
151
return
true
;
152
}
153
154
//- Return token stream if this entry is a primitive entry
155
ITstream
&
stream
()
const
;
156
157
//- This entry is not a dictionary,
158
// calling this function generates a FatalError
159
const
dictionary
&
dict
()
const
;
160
161
//- This entry is not a dictionary,
162
// calling this function generates a FatalError
163
dictionary
&
dict
();
164
165
//- Read tokens from the given stream
166
bool
read
(
const
dictionary
&,
Istream
&);
167
168
// Write
169
void
write
(
Ostream
&)
const
;
170
171
//- Return info proxy.
172
// Used to print token information to a stream
173
InfoProxy<primitiveEntry>
info
()
const
174
{
175
return
*
this
;
176
}
177
};
178
179
180
template
<>
181
Ostream& operator<<(Ostream&, const InfoProxy<primitiveEntry>&);
182
183
184
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186
}
// End namespace Foam
187
188
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190
#ifdef NoRepository
191
# include <
OpenFOAM/primitiveEntryTemplates.C
>
192
#endif
193
194
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196
#endif
197
198
// ************************ vim: set sw=4 sts=4 et: ************************ //