1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A class for handling words, derived from string.
30 A word is a string of characters containing no whitespace and may be
31 constructed from a string by removing whitespace. Words are delimited
38 \*---------------------------------------------------------------------------*/
43 #include "foamString.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of friend functions and operators
52 inline word operator&(const word&, const word&);
53 Istream& operator>>(Istream&, word&);
54 Ostream& operator<<(Ostream&, const word&);
57 /*---------------------------------------------------------------------------*\
58 Class word Declaration
59 \*---------------------------------------------------------------------------*/
65 // Private member functions
67 //- Strip invalid characters from this word
68 inline void stripInvalid();
73 // Static data members
75 static const char* const typeName;
77 static const word null;
86 inline word(const word&);
88 //- Construct as copy of character array
89 inline word(const char*, const bool doStripInvalid = true);
91 //- Construct as copy with a maximum number of characters
96 const bool doStripInvalid
99 //- Construct as copy of string
100 inline word(const string&, const bool doStripInvalid = true);
102 //- Construct as copy of std::string
103 inline word(const std::string&, const bool doStripInvalid = true);
105 //- Construct from Istream
111 //- Is this character valid for a word
112 inline static bool valid(char);
119 inline const word& operator=(const word&);
120 inline const word& operator=(const string&);
121 inline const word& operator=(const std::string&);
122 inline const word& operator=(const char*);
127 friend word operator&(const word&, const word&);
130 // IOstream operators
132 friend Istream& operator>>(Istream&, word&);
133 friend Ostream& operator<<(Ostream&, const word&);
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 // ************************************************************************* //