|
|
|
dictionaryEntry.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::dictionaryEntry 00027 00028 Description 00029 A keyword and a list of tokens is a 'dictionaryEntry'. 00030 00031 An dictionaryEntry can be read, written and printed, and the types and 00032 values of its tokens analysed. A dictionaryEntry is a high-level building 00033 block for data description. It is a front-end for the token parser. 00034 A list of entries can be used as a set of keyword syntax elements, 00035 for example. 00036 00037 SourceFiles 00038 dictionaryEntry.C 00039 dictionaryEntryIO.C 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef dictionaryEntry_H 00044 #define dictionaryEntry_H 00045 00046 #include "entry.H" 00047 #include "dictionary.H" 00048 #include "InfoProxy.H" 00049 00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00051 00052 namespace Foam 00053 { 00054 00055 /*---------------------------------------------------------------------------*\ 00056 Class dictionaryEntry Declaration 00057 \*---------------------------------------------------------------------------*/ 00058 00059 class dictionaryEntry 00060 : 00061 public entry, 00062 public dictionary 00063 { 00064 // Private member functions 00065 00066 void readData(Istream&); 00067 00068 //- Dissallow bitwise copy 00069 dictionaryEntry(const dictionary&); 00070 00071 00072 public: 00073 00074 // Constructors 00075 00076 //- Construct from the parent dictionary and Istream 00077 dictionaryEntry(const dictionary& parentDict, Istream&); 00078 00079 //- Construct from the keyword, parent dictionary and a Istream 00080 dictionaryEntry 00081 ( 00082 const keyType&, 00083 const dictionary& parentDict, 00084 Istream& 00085 ); 00086 00087 //- Construct from the keyword, parent dictionary and a dictionary 00088 dictionaryEntry 00089 ( 00090 const keyType&, 00091 const dictionary& parentDict, 00092 const dictionary& dict 00093 ); 00094 00095 //- Construct as copy for the given parentDict 00096 dictionaryEntry 00097 ( 00098 const dictionary& parentDict, 00099 const dictionaryEntry& 00100 ); 00101 00102 autoPtr<entry> clone(const dictionary& parentDict) const 00103 { 00104 return autoPtr<entry>(new dictionaryEntry(parentDict, *this)); 00105 } 00106 00107 00108 // Member functions 00109 00110 //- Return the dictionary name 00111 const fileName& name() const 00112 { 00113 return dictionary::name(); 00114 } 00115 00116 //- Return the dictionary name 00117 fileName& name() 00118 { 00119 return dictionary::name(); 00120 } 00121 00122 //- Return line number of first token in dictionary 00123 label startLineNumber() const; 00124 00125 //- Return line number of last token in dictionary 00126 label endLineNumber() const; 00127 00128 //- This entry is not a primitive, 00129 // calling this function generates a FatalError 00130 ITstream& stream() const; 00131 00132 //- Return true because this entry is a dictionary 00133 bool isDict() const 00134 { 00135 return true; 00136 } 00137 00138 //- Return dictionary 00139 const dictionary& dict() const; 00140 00141 //- Return non-const access to dictionary 00142 dictionary& dict(); 00143 00144 // Write 00145 void write(Ostream&) const; 00146 00147 //- Return info proxy. 00148 // Used to print token information to a stream 00149 InfoProxy<dictionaryEntry> info() const 00150 { 00151 return *this; 00152 } 00153 00154 00155 // Ostream operator 00156 00157 friend Ostream& operator<<(Ostream&, const dictionaryEntry&); 00158 }; 00159 00160 00161 template<> 00162 Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&); 00163 00164 00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00166 00167 } // End namespace Foam 00168 00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00170 00171 #endif 00172 00173 // ************************************************************************* // |