OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::word
00027 
00028 Description
00029     A class for handling words, derived from string.
00030 
00031     A word is a string of characters containing no whitespace and may be
00032     constructed from a string by removing whitespace. Words are delimited
00033     by whitespace.
00034 
00035 SourceFiles
00036     word.C
00037     wordIO.C
00038 
00039 \*---------------------------------------------------------------------------*/
00040 
00041 #ifndef word_H
00042 #define word_H
00043 
00044 #include "string.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 // Forward declaration of friend functions and operators
00052 class word;
00053 inline word operator&(const word&, const word&);
00054 Istream& operator>>(Istream&, word&);
00055 Ostream& operator<<(Ostream&, const word&);
00056 
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class word Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class word
00063 :
00064     public string
00065 {
00066     // Private member functions
00067 
00068         //- Strip invalid characters from this word
00069         inline void stripInvalid();
00070 
00071 
00072 public:
00073 
00074     // Static data members
00075 
00076         static const char* const typeName;
00077         static int debug;
00078         static const word null;
00079 
00080 
00081     // Constructors
00082 
00083         //- Construct null
00084         inline word();
00085 
00086         //- Construct as copy
00087         inline word(const word&);
00088 
00089         //- Construct as copy of character array
00090         inline word(const char*, const bool doStripInvalid=true);
00091 
00092         //- Construct as copy with a maximum number of characters
00093         inline word
00094         (
00095             const char*,
00096             const size_type,
00097             const bool doStripInvalid
00098         );
00099 
00100         //- Construct as copy of string
00101         inline word(const string&, const bool doStripInvalid=true);
00102 
00103         //- Construct as copy of std::string
00104         inline word(const std::string&, const bool doStripInvalid=true);
00105 
00106         //- Construct from Istream
00107         word(Istream&);
00108 
00109 
00110     // Member functions
00111 
00112         //- Is this character valid for a word
00113         inline static bool valid(char);
00114 
00115 
00116     // Member operators
00117 
00118         // Assignment
00119 
00120             inline const word& operator=(const word&);
00121             inline const word& operator=(const string&);
00122             inline const word& operator=(const std::string&);
00123             inline const word& operator=(const char*);
00124 
00125 
00126     // Friend Operators
00127 
00128         friend word operator&(const word&, const word&);
00129 
00130 
00131     // IOstream operators
00132 
00133         friend Istream& operator>>(Istream&, word&);
00134         friend Ostream& operator<<(Ostream&, const word&);
00135 };
00136 
00137 
00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00139 
00140 } // End namespace Foam
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 #include "wordI.H"
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 #endif
00149 
00150 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd