word.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-2025 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 Class
25  Foam::word
26 
27 Description
28  A class for handling words, derived from string.
29 
30  A word is a string of characters without whitespace, quotes, slashes,
31  semicolons or brace brackets. Words are delimited by whitespace.
32 
33 SourceFiles
34  wordStatics.C
35  word.C
36  wordIO.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef word_H
41 #define word_H
42 
43 #include "string.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of friend functions and operators
51 class word;
52 inline word operator&(const word&, const word&);
53 Istream& operator>>(Istream&, word&);
54 Ostream& operator<<(Ostream&, const word&);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class word Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class word
62 :
63  public string
64 {
65  // Private Member Functions
66 
67  //- Strip invalid characters from this word
68  inline void stripInvalid();
69 
70 
71 public:
72 
73  // Static Data Members
74 
75  static const char* const typeName;
76  static int debug;
77 
78  //- An empty word
79  static const word null;
80 
81 
82  // Constructors
83 
84  //- Construct null
85  inline word();
86 
87  //- Copy constructor
88  inline word(const word&);
89 
90  //- Copy constructor of character array
91  inline word(const char*, const bool doStripInvalid=true);
92 
93  //- Copy constructor with a maximum number of characters
94  inline word
95  (
96  const char*,
97  const size_type,
98  const bool doStripInvalid
99  );
100 
101  //- Copy constructor of string
102  inline word(const string&, const bool doStripInvalid=true);
103 
104  //- Copy constructor of std::string
105  inline word(const std::string&, const bool doStripInvalid=true);
106 
107  //- Construct from Istream
108  word(Istream&);
109 
110 
111  // Member Functions
112 
113  //- Is this character valid for a word
114  inline static bool valid(char);
115 
116  //- Return the word with the first letter capitalised
117  inline word capitalise() const;
118 
119 
120  // Member Operators
121 
122  // Assignment
123 
124  inline void operator=(const word&);
125  inline void operator=(const string&);
126  inline void operator=(const std::string&);
127  inline void operator=(const char*);
128 
129 
130  // Friend Operators
131 
132  friend word operator&(const word&, const word&);
133 
134 
135  // IOstream Operators
136 
138  friend Ostream& operator<<(Ostream&, const word&);
139 };
140 
141 
142 void writeEntry(Ostream& os, const word& value);
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #include "wordI.H"
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A class for handling character strings derived from std::string.
Definition: string.H:79
A class for handling words, derived from string.
Definition: word.H:63
static bool valid(char)
Is this character valid for a word.
Definition: wordI.H:115
word capitalise() const
Return the word with the first letter capitalised.
Definition: wordI.H:131
friend word operator&(const word &, const word &)
friend Istream & operator>>(Istream &, word &)
word()
Construct null.
Definition: wordI.H:59
void operator=(const word &)
Definition: wordI.H:141
friend Ostream & operator<<(Ostream &, const word &)
static int debug
Definition: word.H:75
static const char *const typeName
Definition: word.H:74
Namespace for OpenFOAM.
Istream & operator>>(Istream &, pointEdgeDist &)
Definition: pointEdgeDist.C:41
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
tmp< DimensionedField< typename innerProduct< Type1, Type2 >::type, GeoMesh, Field > > operator&(const DimensionedField< Type1, GeoMesh, PrimitiveField1 > &df1, const DimensionedField< Type2, GeoMesh, PrimitiveField2 > &df2)