All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
keyTypeI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
29 :
30  variable(),
31  type_(UNDEFINED)
32 {}
33 
34 
36 :
37  variable(k),
38  type_(k.type_)
39 {}
40 
41 
42 inline Foam::keyType::keyType(const word& w)
43 :
44  variable(w),
45  type_(WORD)
46 {}
47 
48 
50 :
51  variable(fn),
52  type_(FUNCTIONNAME)
53 {}
54 
55 
57 :
58  variable(v),
59  type_(VARIABLE)
60 {}
61 
62 
63 inline Foam::keyType::keyType(const string& s)
64 :
65  variable(s, false),
66  type_(PATTERN)
67 {}
68 
69 
70 inline Foam::keyType::keyType(const char* s)
71 :
72  variable(s, true),
73  type_(WORD)
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
79 inline bool Foam::keyType::isUndefined() const
80 {
81  return type_ == UNDEFINED;
82 }
83 
84 
85 inline bool Foam::keyType::isFunctionName() const
86 {
87  return type_ == FUNCTIONNAME;
88 }
89 
90 
91 inline bool Foam::keyType::isVariable() const
92 {
93  return type_ == VARIABLE;
94 }
95 
96 
97 inline bool Foam::keyType::isPattern() const
98 {
99  return type_ == PATTERN;
100 }
101 
102 
103 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
104 
105 inline void Foam::keyType::operator=(const keyType& k)
106 {
108  type_ = k.type_;
109 }
110 
111 
112 inline void Foam::keyType::operator=(const word& w)
113 {
115  type_ = WORD;
116 }
117 
118 
120 {
121  word::operator=(fn);
122  type_ = FUNCTIONNAME;
123 }
124 
125 
126 inline void Foam::keyType::operator=(const variable& v)
127 {
129  type_ = VARIABLE;
130 }
131 
132 
133 inline void Foam::keyType::operator=(const string& s)
134 {
136  type_ = PATTERN;
137 }
138 
139 
140 inline void Foam::keyType::operator=(const char* s)
141 {
142  word::operator=(s);
143  type_ = WORD;
144 }
145 
146 
147 // ************************************************************************* //
A class for handling keywords in dictionaries.
Definition: keyType.H:66
void operator=(const word &)
Definition: wordI.H:141
bool isFunctionName() const
Return true if the keyword is a functionName.
Definition: keyTypeI.H:85
label k
Boltzmann constant.
bool isVariable() const
Return true if the keyword is a variable.
Definition: keyTypeI.H:91
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A functionName is a word starting with &#39;#&#39;.
Definition: functionName.H:57
A class for handling words, derived from string.
Definition: word.H:59
bool isUndefined() const
Return true if the type has not been defined.
Definition: keyTypeI.H:79
keyType()
Construct null.
Definition: keyTypeI.H:28
void operator=(const variable &)
Definition: variableI.H:122
void operator=(const keyType &)
Assignment operator.
Definition: keyTypeI.H:105
void operator=(const string &)
Definition: stringI.H:229
A variable is a word with support for additional characters, in particular &#39;$&#39; and &#39;/&#39;...
Definition: variable.H:58
bool isPattern() const
Should be treated as a match rather than a literal string.
Definition: keyTypeI.H:97