ITstream.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef ITstream_H
00037 #define ITstream_H
00038
00039 #include "Istream.H"
00040 #include "tokenList.H"
00041
00042
00043
00044 namespace Foam
00045 {
00046
00047
00048
00049
00050
00051 class ITstream
00052 :
00053 public Istream,
00054 public tokenList
00055 {
00056
00057
00058
00059 fileName name_;
00060
00061
00062 label tokenIndex_;
00063
00064
00065 public:
00066
00067
00068
00069
00070 ITstream
00071 (
00072 const string& name,
00073 const tokenList& tokens,
00074 streamFormat format=ASCII,
00075 versionNumber version=currentVersion
00076 )
00077 :
00078 Istream(format, version),
00079 tokenList(tokens),
00080 name_(name),
00081 tokenIndex_(0)
00082 {
00083 setOpened();
00084 setGood();
00085 }
00086
00087
00088
00089 ITstream(const ITstream& its)
00090 :
00091 Istream(ASCII, currentVersion),
00092 tokenList(its),
00093 name_(its.name_),
00094 tokenIndex_(0)
00095 {
00096 setOpened();
00097 setGood();
00098 }
00099
00100
00101
00102
00103 virtual ~ITstream()
00104 {}
00105
00106
00107
00108
00109
00110
00111
00112 const fileName& name() const
00113 {
00114 return name_;
00115 }
00116
00117
00118 fileName& name()
00119 {
00120 return name_;
00121 }
00122
00123
00124 label tokenIndex() const
00125 {
00126 return tokenIndex_;
00127 }
00128
00129
00130 label& tokenIndex()
00131 {
00132 return tokenIndex_;
00133 }
00134
00135
00136 label nRemainingTokens() const
00137 {
00138 return size() - tokenIndex_;
00139 }
00140
00141
00142 ios_base::fmtflags flags() const
00143 {
00144 return ios_base::fmtflags(0);
00145 }
00146
00147
00148
00149
00150
00151 virtual Istream& read(token&);
00152
00153
00154 virtual Istream& read(char&);
00155
00156
00157 virtual Istream& read(word&);
00158
00159
00160 virtual Istream& read(string&);
00161
00162
00163 virtual Istream& read(label&);
00164
00165
00166 virtual Istream& read(floatScalar&);
00167
00168
00169 virtual Istream& read(doubleScalar&);
00170
00171
00172 virtual Istream& read(char*, std::streamsize);
00173
00174
00175 virtual Istream& rewind();
00176
00177
00178
00179
00180
00181 ios_base::fmtflags flags(const ios_base::fmtflags)
00182 {
00183 return ios_base::fmtflags(0);
00184 }
00185
00186
00187
00188
00189
00190 void print(Ostream&) const;
00191 };
00192
00193
00194
00195
00196 }
00197
00198
00199
00200 #endif
00201
00202
Copyright © 2000-2009 OpenCFD Ltd