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-2018 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 
42 inline Foam::keyType::keyType(const word& s)
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 
84 inline void Foam::keyType::operator=(const keyType& s)
85 {
86  // Bypass checking
88  isPattern_ = s.isPattern_;
89 }
90 
91 
92 inline void Foam::keyType::operator=(const word& s)
93 {
94  word::operator=(s);
95  isPattern_ = false;
96 }
97 
98 
99 inline void Foam::keyType::operator=(const string& s)
100 {
101  // Bypass checking
103  isPattern_ = true;
104 }
105 
106 
107 inline void Foam::keyType::operator=(const char* s)
108 {
109  // Bypass checking
111  isPattern_ = false;
112 }
113 
114 
115 // ************************************************************************* //
A class for handling keywords in dictionaries.
Definition: keyType.H:64
void operator=(const word &)
Definition: wordI.H:132
word()
Construct null.
Definition: wordI.H:59
A class for handling words, derived from string.
Definition: word.H:59
keyType()
Construct null.
Definition: keyTypeI.H:28
void operator=(const string &)
Definition: stringI.H:229
bool isPattern() const
Should be treated as a match rather than a literal string.
Definition: keyTypeI.H:76