FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

word.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::word
00026 
00027 Description
00028     A class for handling words, derived from string.
00029 
00030     A word is a string of characters containing no whitespace and may be
00031     constructed from a string by removing whitespace. Words are delimited
00032     by whitespace.
00033 
00034 SourceFiles
00035     word.C
00036     wordIO.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef word_H
00041 #define word_H
00042 
00043 #include <OpenFOAM/string.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Forward declaration of friend functions and operators
00051 class word;
00052 inline word operator&(const word&, const word&);
00053 Istream& operator>>(Istream&, word&);
00054 Ostream& operator<<(Ostream&, const word&);
00055 
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class word Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 class word
00062 :
00063     public string
00064 {
00065     // Private member functions
00066 
00067         //- Strip invalid characters from this word
00068         inline void stripInvalid();
00069 
00070 
00071 public:
00072 
00073     // Static data members
00074 
00075         static const char* const typeName;
00076         static int debug;
00077         static const word null;
00078 
00079 
00080     // Constructors
00081 
00082         //- Construct null
00083         inline word();
00084 
00085         //- Construct as copy
00086         inline word(const word&);
00087 
00088         //- Construct as copy of character array
00089         inline word(const char*, const bool doStripInvalid=true);
00090 
00091         //- Construct as copy with a maximum number of characters
00092         inline word
00093         (
00094             const char*,
00095             const size_type,
00096             const bool doStripInvalid
00097         );
00098 
00099         //- Construct as copy of string
00100         inline word(const string&, const bool doStripInvalid=true);
00101 
00102         //- Construct as copy of std::string
00103         inline word(const std::string&, const bool doStripInvalid=true);
00104 
00105         //- Construct from Istream
00106         word(Istream&);
00107 
00108 
00109     // Member functions
00110 
00111         //- Is this character valid for a word
00112         inline static bool valid(char);
00113 
00114 
00115     // Member operators
00116 
00117         // Assignment
00118 
00119             inline const word& operator=(const word&);
00120             inline const word& operator=(const string&);
00121             inline const word& operator=(const std::string&);
00122             inline const word& operator=(const char*);
00123 
00124 
00125     // Friend Operators
00126 
00127         friend word operator&(const word&, const word&);
00128 
00129 
00130     // IOstream operators
00131 
00132         friend Istream& operator>>(Istream&, word&);
00133         friend Ostream& operator<<(Ostream&, const word&);
00134 };
00135 
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 } // End namespace Foam
00140 
00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00142 
00143 #include <OpenFOAM/wordI.H>
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 #endif
00148 
00149 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines