keyTypeI.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) 2011 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  word(),
31  isPattern_(false)
32 {}
33 
34 
36 :
37  word(s, false),
38  isPattern_(s.isPattern())
39 {}
40 
41 
43 :
44  word(s, false),
45  isPattern_(false)
46 {}
47 
48 
49 inline Foam::keyType::keyType(const string& s)
50 :
51  word(s, false),
52  isPattern_(true)
53 {}
54 
55 
56 inline Foam::keyType::keyType(const char* s)
57 :
58  word(s, false),
59  isPattern_(false)
60 {}
61 
62 
64 (
65  const std::string& s,
66  const bool isPattern
67 )
68 :
69  word(s, false),
70  isPattern_(isPattern)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 inline bool Foam::keyType::isPattern() const
77 {
78  return isPattern_;
79 }
80 
81 
82 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
83 
85 {
86  // Bypass checking
87  string::operator=(s);
88  isPattern_ = s.isPattern_;
89  return *this;
90 }
91 
92 
94 {
96  isPattern_ = false;
97  return *this;
98 }
99 
100 
101 inline const Foam::keyType& Foam::keyType::operator=(const string& s)
102 {
103  // Bypass checking
104  string::operator=(s);
105  isPattern_ = true;
106  return *this;
107 }
108 
109 
110 inline const Foam::keyType& Foam::keyType::operator=(const char* s)
111 {
112  // Bypass checking
113  string::operator=(s);
114  isPattern_ = false;
115  return *this;
116 }
117 
118 
119 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::keyType::keyType
keyType()
Construct null.
Definition: keyTypeI.H:28
Foam::keyType::isPattern
bool isPattern() const
Should be treated as a match rather than a literal string.
Definition: keyTypeI.H:76
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:56
Foam::keyType::operator=
void operator=(const std::string &)
Disallow assignments where we cannot determine string/word type.
s
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))
Foam::word::operator=
const word & operator=(const word &)
Definition: wordI.H:134