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