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

keyType.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::keyType
00026 
00027 Description
00028     A class for handling keywords in dictionaries.
00029 
00030     A keyType is the keyword of a dictionary.
00031     It differs from word in that it accepts patterns (regular expressions).
00032 
00033 SourceFiles
00034     keyType.C
00035     keyTypeIO.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef keyType_H
00040 #define keyType_H
00041 
00042 #include <OpenFOAM/word.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 // Forward declaration of classes
00050 class Istream;
00051 class Ostream;
00052 
00053 
00054 /*---------------------------------------------------------------------------*\
00055                           Class keyType Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class keyType
00059 :
00060     public word
00061 {
00062     // Private member data
00063 
00064         //- Is the keyType a pattern (regular expression)
00065         bool isPattern_;
00066 
00067     // Private Member Functions
00068 
00069         //- Disallow assignments where we cannot determine string/word type
00070         void operator=(const std::string&);
00071 
00072 public:
00073 
00074 
00075     // Constructors
00076 
00077         //- Construct null
00078         inline keyType();
00079 
00080         //- Construct as copy
00081         inline keyType(const keyType&);
00082 
00083         //- Construct as copy of word
00084         inline keyType(const word&);
00085 
00086         //- Construct as copy of string. Expect it to be regular expression.
00087         inline keyType(const string&);
00088 
00089         //- Construct as copy of character array
00090         inline keyType(const char*);
00091 
00092         //- Construct as copy of std::string
00093         inline keyType(const std::string&, const bool isPattern);
00094 
00095         //- Construct from Istream
00096         keyType(Istream&);
00097 
00098 
00099     // Member functions
00100 
00101         //- Should be treated as a match rather than a literal string
00102         inline bool isPattern() const;
00103 
00104     // Member operators
00105 
00106         // Assignment
00107 
00108             inline const keyType& operator=(const keyType&);
00109             inline const keyType& operator=(const word&);
00110 
00111             //- Assign from regular expression.
00112             inline const keyType& operator=(const string&);
00113             inline const keyType& operator=(const char*);
00114 
00115 
00116     // IOstream operators
00117 
00118         friend Istream& operator>>(Istream&, keyType&);
00119         friend Ostream& operator<<(Ostream&, const keyType&);
00120 };
00121 
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 } // End namespace Foam
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 #include "keyTypeI.H"
00130 
00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00132 
00133 #endif
00134 
00135 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines