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