initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / primitives / strings / word / word.H
blob3e61275164b1fdc735ee9bd15c7cc73df84913db
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::word
28 Description
29     A class for handling words, derived from string.
31     A word is a string of characters containing no whitespace and may be
32     constructed from a string by removing whitespace. Words are delimited
33     by whitespace.
35 SourceFiles
36     word.C
37     wordIO.C
39 \*---------------------------------------------------------------------------*/
41 #ifndef word_H
42 #define word_H
44 #include "string.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // Forward declaration of friend functions and operators
52 class word;
53 inline word operator&(const word&, const word&);
54 Istream& operator>>(Istream&, word&);
55 Ostream& operator<<(Ostream&, const word&);
58 /*---------------------------------------------------------------------------*\
59                            Class word Declaration
60 \*---------------------------------------------------------------------------*/
62 class word
64     public string
66     // Private member functions
68         //- Strip invalid characters from this word
69         inline void stripInvalid();
72 public:
74     // Static data members
76         static const char* const typeName;
77         static int debug;
78         static const word null;
81     // Constructors
83         //- Construct null
84         inline word();
86         //- Construct as copy
87         inline word(const word&);
89         //- Construct as copy of character array
90         inline word(const char*);
92         //- Construct as copy with a maximum number of characters
93         inline word(const char*, const size_type);
95         //- Construct as copy of string
96         inline word(const string&);
98         //- Construct as copy of std::string
99         inline word(const std::string&);
101         //- Construct from Istream
102         word(Istream&);
105     // Member functions
107         //- Is this character valid for a word
108         inline static bool valid(char);
111     // Member operators
113         // Assignment
115             inline void operator=(const word&);
116             inline void operator=(const string&);
117             inline void operator=(const std::string&);
118             inline void operator=(const char*);
121     // Friend Operators
123         friend word operator&(const word&, const word&);
126     // IOstream operators
128         friend Istream& operator>>(Istream&, word&);
129         friend Ostream& operator<<(Ostream&, const word&);
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 } // End namespace Foam
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 #include "wordI.H"
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 #endif
145 // ************************************************************************* //