initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / primitives / strings / word / word.H
blob5c910b7891bb52a1c205bfbf94dfb9a1c66ce6c3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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*, const bool doStripInvalid=true);
92         //- Construct as copy with a maximum number of characters
93         inline word
94         (
95             const char*,
96             const size_type,
97             const bool doStripInvalid
98         );
100         //- Construct as copy of string
101         inline word(const string&, const bool doStripInvalid=true);
103         //- Construct as copy of std::string
104         inline word(const std::string&, const bool doStripInvalid=true);
106         //- Construct from Istream
107         word(Istream&);
110     // Member functions
112         //- Is this character valid for a word
113         inline static bool valid(char);
116     // Member operators
118         // Assignment
120             inline const word& operator=(const word&);
121             inline const word& operator=(const string&);
122             inline const word& operator=(const std::string&);
123             inline const word& operator=(const char*);
126     // Friend Operators
128         friend word operator&(const word&, const word&);
131     // IOstream operators
133         friend Istream& operator>>(Istream&, word&);
134         friend Ostream& operator<<(Ostream&, const word&);
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 #include "wordI.H"
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 #endif
150 // ************************************************************************* //