All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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  word.C
35  wordIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef word_H
40 #define word_H
41 
42 #include "string.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 class word;
51 inline word operator&(const word&, const word&);
52 Istream& operator>>(Istream&, word&);
53 Ostream& operator<<(Ostream&, const word&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class word Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class word
61 :
62  public string
63 {
64  // Private Member Functions
65 
66  //- Strip invalid characters from this word
67  inline void stripInvalid();
68 
69 
70 public:
71 
72  // Static Data Members
73 
74  static const char* const typeName;
75  static int debug;
76 
77  //- An empty word
78  static const word null;
79 
80 
81  // Constructors
82 
83  //- Construct null
84  inline word();
85 
86  //- Copy constructor
87  inline word(const word&);
88 
89  //- Copy constructor of character array
90  inline word(const char*, const bool doStripInvalid=true);
91 
92  //- Copy constructor with a maximum number of characters
93  inline word
94  (
95  const char*,
96  const size_type,
97  const bool doStripInvalid
98  );
99 
100  //- Copy constructor of string
101  inline word(const string&, const bool doStripInvalid=true);
102 
103  //- Copy constructor of std::string
104  inline word(const std::string&, const bool doStripInvalid=true);
105 
106  //- Construct from Istream
107  word(Istream&);
108 
109 
110  // Member Functions
111 
112  //- Is this character valid for a word
113  inline static bool valid(char);
114 
115  //- Return the word with the first letter capitalised
116  inline word capitalise() const;
117 
118 
119  // Member Operators
120 
121  // Assignment
122 
123  inline void operator=(const word&);
124  inline void operator=(const string&);
125  inline void operator=(const std::string&);
126  inline void operator=(const char*);
127 
128 
129  // Friend Operators
130 
131  friend word operator&(const word&, const word&);
132 
133 
134  // IOstream Operators
135 
137  friend Ostream& operator<<(Ostream&, const word&);
138 };
139 
140 
141 void writeEntry(Ostream& os, const word& value);
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #include "wordI.H"
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
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:62
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:74
static const char *const typeName
Definition: word.H:73
Namespace for OpenFOAM.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
Istream & operator>>(Istream &, pistonPointEdgeData &)
tmp< VolField< Type > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)