00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00014
00015
00016
00018
00020
00021
00022
00023
00024
00025
00027
00028 #ifndef _DATAIO_H_
00029
00030 #define _DATAIO_H_
00031
00032
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS // doxygen skip this...
00034
00035
00036
00037 #ifdef _DEBUG_ // _DEBUG_ activate debugging mod for this...
00038 #define _DATAIODEBUG_
00039 #endif
00040
00041
00042
00043
00044
00045
00046
00047
00048 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS // doxygen skip this...
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00060
00064
00065 #define _DATAIODEFAULTCOLUMNSEPARATOR '\t'
00070 #define _DATAIODEFAULTAUTOLINESEPARATOR '\0'
00071
00072 #define _DATAIODEFAULTLINESEPARATOR _DATAIODEFAULTAUTOLINESEPARATOR
00078 #define _DATAIODEFAULTATTRIBSEPARATOR '\0'
00079
00080 #define _DATAIODEFAULTDECIMAL '.'
00081
00082 #define _DATAIODEFAULTIGNORECASE false
00083
00084 #define _DATAIODEFAULTCOMMENTLINE "//"
00085
00086 #define _DATAIODEFAULTCOMMENTOPEN "
00088 "
00089
00091 #define _DATAIODEFAULTSTDCOMMENTOPEN "
00093 "
00094
00096 #define _DATAIODEFAULTLINEWRAP ""
00100 #define _DATAIODEFAULTMAXCOLUMNONLINE (~0U)
00101
00102 #define _DATAIODEFAULTCOLUMNORIENTED false
00103
00104 #define _DATAIODEFAULTISTABLE false
00105
00106 #define _DATAIODEFAULTEMPTYISVALID true
00107
00108 #define _DATAIODEFAULTEXTENDEDMODE true
00109
00110
00111
00112
00113
00115
00116
00118 #define _DATAIODEFAULTCLEAREMPTYTAIL true
00119
00120 #define _DATAIODEFAULTSTRINGDELIMITER '\"'
00121
00122 #define _DATAIODEFAULTSCAPECHAR '\0'
00123
00125 #define _DATAIODEFAULTTHROWEXCEPTION false
00126
00127 #define _DATAIODEFAULTPRINTERROR true
00128
00129
00132 #define _DATAIODEFAULTCOLLECTNAMES true
00133
00134 #define _DATAIODEFAULTPARSEALLINPUTSTRING false
00135
00137 #define _DATAIODEFAULTSECTIONNAMEOPEN '\0'
00138
00139 #define _DATAIODEFAULTSECTIONNAMECLOSE '\0'
00140
00142 #define _DATAIODEFAULTSTDSECTIONNAMEOPEN '['
00143
00144 #define _DATAIODEFAULTSTDSECTIONNAMECLOSE ']'
00145
00148 #define _DATAIODEFAULTREVERSEBYTEORDER false
00149
00150
00153
00156
00158
00160
00161
00162
00164
00165
00166
00167
00168
00169
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00182
00183
00184
00185 #include <string>
00186 #include <iostream>
00187 #include <strstream>
00188 #include <vector>
00189 #include <errno.h>
00190
00191
00192
00193 #include "stringutil.h"
00194
00195
00197
00199
00200 class dataio;
00201
00204 class _dataiorecbase {
00205
00206
00207
00208 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00209 protected:
00210 void *var;
00211 unsigned dim;
00212 unsigned long *size1, *size2, *strsize;
00213 vector <vector <string> > datalist;
00214 vector <string> commentlist;
00215 bool valuesetted;
00216
00217
00218
00219 dataio *base;
00220
00221
00222
00223 string name;
00224
00225
00226
00227
00228
00229
00230 bool isdataio;
00231
00232 static bool readsize(istream &is, unsigned long int &n, bool reverseorder);
00233 static void writesize(ostream &os, unsigned long int n, bool reverseorder);
00234
00235 virtual void clearitemvalue(){}
00236 virtual void addrowtoitemvalue(){}
00237
00238 virtual bool addtoitemvalue(string &s){return false;}
00239
00240 virtual bool readtoitemvalue(istream &is){return false;}
00241
00242 virtual unsigned long getitemrownumber(){return 1;}
00243 virtual unsigned long getitemlistsize(unsigned long i) {return 1;}
00244
00245 virtual void getstringvalue(string &s, unsigned long i, unsigned long j){}
00246
00247 virtual void writeitemvalue(ostream &os, unsigned long i, unsigned long j){}
00248 public:
00249 void setvalue(vector <vector <string> > &valuelist);
00250
00251 vector <vector <string> > &getvalue(bool includecomment);
00252
00253
00254 istream &read(istream &is);
00255 ostream &write(ostream &os);
00256 unsigned blockcount;
00257
00258
00259
00260 virtual void startinblock(unsigned i);
00261
00262
00263
00264 void validate();
00265
00266
00267
00268
00269 virtual bool startoutblock(unsigned i);
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279 _dataiorecbase(){
00280 dim = 0; base = 0; var = 0; size1 = size2 = strsize = 0;
00281 valuesetted = isdataio = false; blockcount = 0;
00282 }
00283
00284
00285 _dataiorecbase(dataio *_base, string const &_name, dataio *_var){
00286 dim = 0; base = _base; name = _name; var = _var;
00287 size1 = size2 = strsize = 0; blockcount = 0;
00288 valuesetted = false;
00289 isdataio = true;
00290 }
00291
00292
00293 _dataiorecbase(dataio *_base, string const &_name, void * _var, unsigned long *_strsize){
00294 dim = 0; base = _base; name = _name; var = _var;
00295 size1 = size2 = 0; strsize = _strsize;
00296 valuesetted = isdataio = false; blockcount = 0;
00297 }
00298
00299
00300 _dataiorecbase(dataio *_base, string const &_name, void * _var, unsigned long *_size1, unsigned long *_strsize){
00301 dim = 1; base = _base; name = _name; var = _var;
00302 size1 = _size1;
00303 size2 = 0; strsize = _strsize;
00304 valuesetted = isdataio = false; blockcount = 0;
00305 }
00306
00307
00308 _dataiorecbase(dataio *_base, string const &_name, void * _var, unsigned long *_size1,
00309 unsigned long *_size2, unsigned long *_strsize){
00310 dim = 2; base = _base; name = _name; var = _var;
00311 size1 = _size1;
00312 size2 = _size2; strsize = _strsize;
00313 valuesetted = isdataio = false; blockcount = 0;
00314 }
00315
00316
00317 virtual ~_dataiorecbase(){
00318 }
00319
00320 friend dataio;
00321
00322 friend istream &operator>>(istream &is, dataio &data);
00323 friend ostream &operator<<(ostream &os, dataio &data);
00324
00325
00326 #endif //#ifndef DOXYGEN_SHOULD_SKIP_THIS
00327 };
00328
00337 template <class T>
00338 class _dataiorec : public _dataiorecbase {
00339
00340
00341 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00342
00343 void clearitemvalue()
00344 {if(dim == 1) ((vector <T> *)var)->clear();
00345 else if(dim == 2) ((vector <vector <T> > *)var)->clear(); }
00346 void addrowtoitemvalue()
00347 { if(dim == 2) ((vector <vector <T> >*)var)->push_back(vector <T>());}
00348 bool addtoitemvalue(string &s)
00349 { bool status;
00350 T itemvalue;
00351 if(dim ==0) {
00352 #ifdef _DATAIODEBUG_
00353 cout << "addtoitemvalue:value = ";
00354 cout << *(T *)var << endl;
00355 #endif
00356 status = stringtoitem(s, *((T *)var));
00357 }
00358 else if(dim == 1) {
00359 status = stringtoitem(s, itemvalue);
00360 ((vector <T>*)var)->push_back(itemvalue);
00361 }
00362 else {
00363 status = stringtoitem(s, itemvalue);
00364 (*(vector <vector <T> >*)var)[((vector <vector <T> >*)var)->size()-1].push_back(itemvalue);
00365 }
00366 return status;
00367 }
00368
00369
00370 bool readtoitemvalue(istream &is)
00371 { bool status;
00372 T itemvalue;
00373 if(dim ==0)
00374 status = readitem(is, *(T *)var);
00375 else if(dim == 1) {
00376 status = readitem(is, itemvalue);
00377 ((vector <T>*)var)->push_back(itemvalue);
00378 }
00379 else {
00380 status = readitem(is, itemvalue);
00381 (*(vector <vector <T> >*)var)[((vector <vector <T> >*)var)->size()-1].push_back(itemvalue);
00382 }
00383 return status;
00384 }
00385
00386
00387 unsigned long getitemrownumber()
00388 {
00389
00390
00391 if(dim == 2)
00392 return ((vector <vector <T> >*)var)->size();
00393 return 1;
00394 }
00395 unsigned long getitemlistsize(unsigned long i)
00396 {
00397 if(dim == 1)
00398 return ((vector <T> *)var)->size();
00399 else if((dim == 2) && (i < (*(vector <vector <T> >*)var).size()))
00400 return (*(vector <vector <T> >*)var)[i].size();
00401 return 1;
00402 }
00403
00404 void getstringvalue(string &s, unsigned long i, unsigned long j)
00405 {
00406 if(dim == 0) itemtostring(*(T *)var, s);
00407 else if((dim == 1) && (i < (*(vector <T> *)var).size()))
00408 itemtostring((*(vector <T> *)var)[i], s);
00409 else if((dim == 2) && (i < (*(vector <vector <T> >*)var).size())
00410 && (j < (*(vector <vector <T> >*)var)[i].size()))
00411 itemtostring((*(vector <vector <T> >*)var)[i][j], s);
00412 else s.erase();
00413 }
00414
00415 void writeitemvalue(ostream &os, unsigned long i, unsigned long j)
00416 {
00417 if(dim == 0) writeitem(os, *(T *)var);
00418 else if((dim == 1) && (i < (*(vector <T> *)var).size()))
00419 writeitem(os, (*(vector <T> *)var)[i]);
00420 else if((dim == 2) && (i < (*(vector <vector <T> >*)var).size())
00421 && (j < (*(vector <vector <T> >*)var)[i].size()))
00422 writeitem(os, (*(vector <vector <T> >*)var)[i][j]);
00423 }
00424
00425
00426
00427
00428
00429 public:
00430
00431
00432
00433
00434 _dataiorec(dataio *_base, string const &_name, dataio *item) :
00435 _dataiorecbase(_base, _name, item){}
00436 _dataiorec(dataio *_base, string const &_name, T *item, unsigned long *_strsize) :
00437 _dataiorecbase(_base, _name, item, _strsize){}
00438 _dataiorec(dataio *_base, string const &_name, vector <T> *item,
00439 unsigned long *m, unsigned long *_strsize) :
00440 _dataiorecbase(_base, _name, item, m, _strsize){}
00441 _dataiorec(dataio *_base, string const &_name, vector <vector <T> > *item,
00442 unsigned long *m, unsigned long *n, unsigned long *_strsize) :
00443 _dataiorecbase(_base, _name, item, m, n, _strsize){}
00444
00445
00446
00447
00448
00449
00450
00451
00452 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00453
00454 public:
00455
00456
00457
00458
00463
00468
00474
00480
00481
00482
00483 };
00484
00497 class dataio {
00498 private:
00499 vector <vector <string> > datalist;
00500 vector <string>commentlist;
00501
00502 vector <_dataiorecbase *> unnamed;
00503 vector <_dataiorecbase *> named;
00504 vector <bool> isnamedvar;
00505
00506
00507 vector <string> referednameslist;
00508
00509
00510 vector <string> unreferednameslist;
00511
00512
00513 bool casesensive;
00514 char decimalchar;
00516
00517
00518
00519 bool valuesetted;
00520
00521
00522 string commentlinemark;
00523
00524
00525
00526 string commentopenmark;
00527
00528
00529
00530 string commentclosemark;
00531
00532 string linewrapmark;
00533
00534
00535
00536 bool emptyisvaliddata;
00537
00538
00539
00540
00541
00542
00543 bool collectreferednames;
00544
00545 bool validateunreferedmember;
00546
00547
00548
00549
00550 bool throwonerror;
00551
00552
00553
00554 bool printerrormessage;
00555
00556
00557
00558 void maprecomendedflagsto(dataio &dest);
00559
00560 void maprequiredflagsto(dataio &dest);
00561
00562
00563
00564
00565
00566
00567 void maprecomendedflagstomember();
00568 void maprequiredflagstomember();
00569
00570
00571 dataio * unnamedmember(unsigned i) {return (dataio *)(unnamed[i]->var);}
00572 dataio * namedmember(unsigned i) {return (dataio *)(named[i]->var);}
00573 public:
00576 void addcomment(string const &rem) {addcommenttolist(rem, commentlist);}
00579 void clearcomment(bool includemember=false);
00583 vector <string> &comment() {return commentlist;}
00584
00585
00589 bool addcomment(string const &name, string const &rem);
00592 bool additemcomment(void *item, string const &rem);
00595 void clearcomment(string const &name, bool includemember=false);
00598 void clearitemcomment(void *item, bool includemember=false);
00601 void clearitemcomment(bool includemember=false);
00605 vector <string> &comment(string const &name);
00609 vector <string> &itemcomment(void *item);
00610
00611
00615
00616 string &commentline(string const &com)
00617 {return parsestring(commentlinemark = com, stringdelimiter, scapechar);}
00624 string &linewrap() { return linewrapmark;};
00625 string &linewrap(string const &wrap)
00626 {return parsestring(linewrapmark=wrap, stringdelimiter, scapechar);}
00630 unsigned maxcolumnonline;
00634 bool istable;
00635
00643 char sectionnameopen;
00651 char sectionnameclose;
00656 void disablesection()
00657 { sectionnameopen = '\0';
00658 sectionnameclose = '\0';
00659 }
00663 void enablestdsection()
00664 { sectionnameopen = _DATAIODEFAULTSTDSECTIONNAMEOPEN;
00665 sectionnameclose = _DATAIODEFAULTSTDSECTIONNAMECLOSE;
00666 }
00667
00671 bool columnoriented;
00675 char columnseparator;
00679 char lineseparator;
00692 char attribseparator;
00698 bool extendedmode;
00702 bool clearemptytail;
00710 bool parseallinputstring;
00711
00715 bool throwexception() {
00716 return throwonerror; }
00717 bool throwexception(bool dec, bool includemember=true);
00721 bool printerror() {
00722 return printerrormessage; }
00723 bool printerror(bool dec, bool includemember=true);
00724
00729 bool emptyisvalid(){
00730 return emptyisvaliddata;}
00731 bool emptyisvalid(bool flag, bool includemember=true);
00732
00733 bool ignorecase() {
00734 return !casesensive;}
00735
00736
00737
00738 bool ignorecase(bool status, bool includemember=true);
00739 char decimal() {
00740 return decimalchar;}
00741
00742
00743
00744 char decimal(char dec, bool includemember=true);
00745
00749 char stringdelimiter;
00750
00754 char scapechar;
00760
00764 bool reversebyteorder;
00765
00766 bool validateall() {
00767 return validateunreferedmember;}
00768
00769
00770
00771 bool validateall(bool status, bool includemember=true);
00772
00773 string &commentopen() {
00774 return commentopenmark;}
00775
00776
00777
00779
00780 return parsestring(commentopenmark = s, stringdelimiter, scapechar);}
00784
00785 string &commentclose() {
00786 return commentclosemark;}
00787
00788
00789
00790 string &commentclose(string const &s) {
00791 return parsestring(commentclosemark = s, stringdelimiter, scapechar);}
00792
00793
00795 void disablecommentblock()
00796 { commentopen("");
00797 commentclose("");
00798 }
00802 void enablestdcommentblock()
00803 { commentopen(_DATAIODEFAULTSTDCOMMENTOPEN);
00804 commentclose(_DATAIODEFAULTSTDCOMMENTCLOSE);
00805 }
00806
00807 bool setted() {
00808 return valuesetted;}
00809 bool setted(string const &name);
00810
00811 bool itemsetted(void *item);
00812
00813
00814
00815
00816 bool collectnames() {
00817 return collectreferednames;}
00826 bool collectnames(bool flag, bool includemember=true);
00830 bool refered(string const &name){
00831 string key = name;
00832 return keysearch(key, referednameslist) != referednameslist.size();}
00836 bool itemrefered(void *item) {
00837 return (finditem(item, unnamed) != unnamed.size()) || (finditem(item, named) != named.size()); }
00838
00839 vector <string> &referednames(){
00840 return referednameslist;}
00841 vector <string> &unreferednames();
00842
00846 void add(string const &name, dataio *item)
00847 { named.push_back(new _dataiorec <dataio>(this, name, item));
00848
00849 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
00850 #ifdef _DATAIODEBUG_
00851 cerr << "dataio::add(): adding named dataio item: "
00852 << named[named.size()-1]->name << endl;
00853 #endif
00854
00855 item->ignorecase(!casesensive);
00856 item->decimal(decimalchar);
00857 item->emptyisvalid(emptyisvaliddata);
00858 item->collectnames(collectreferednames);
00859 isnamedvar.push_back(true);
00860 }
00863 void add(dataio *item)
00864 { unnamed.push_back(new _dataiorec <dataio>(this, "", item));
00865
00866
00867 #ifdef _DATAIODEBUG_
00868 cerr << "dataio:add(): adding unnamed dataio item\n";
00869 #endif
00870 item->ignorecase(!casesensive);
00871 item->decimal(decimalchar);
00872 item->emptyisvalid(emptyisvaliddata);
00873 item->collectnames(collectreferednames);
00874 isnamedvar.push_back(false);
00875 }
00876
00880 template <class T>
00881 void add(string const &name, T *item)
00882 { named.push_back(new _dataiorec<T>(this, name, item, (unsigned long *)0));
00883
00884 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
00885 #ifdef _DATAIODEBUG_
00886 cerr << "dataio::add(): adding named template item:"
00887 << named[named.size()-1]->name << endl;
00888 #endif
00889
00890 isnamedvar.push_back(true);
00891 }
00895 template <class T>
00896 void add(T *item)
00897 { unnamed.push_back(new _dataiorec <T>(this, "", item, (unsigned long *)0));
00898 #ifdef _DATAIODEBUG_
00899 cerr << "dataio::add(): adding unnamed template item\n";
00900 #endif // unnamed[unnamed.size()-1]->base = this;
00901 isnamedvar.push_back(false);
00902 }
00903
00907
00908 void add(string const &name, vector <T> *item)
00909 { named.push_back(new _dataiorec <T>(this, name, item, (unsigned long *)0, (unsigned long *)0));
00910
00911 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
00912 isnamedvar.push_back(true);
00913 }
00917 template <class T>
00918 void add(vector <T> *item)
00919 { unnamed.push_back(new _dataiorec <T>(this, "", item, (unsigned long *)0, (unsigned long *)0));
00920
00921 isnamedvar.push_back(false);
00922 }
00923
00927
00928 void add(string const &name, vector <vector <T> > *item)
00929 { named.push_back(new _dataiorec <T>(this, name, item, (unsigned long *)0, (unsigned long *)0, (unsigned long *)0));
00930
00931 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
00932 isnamedvar.push_back(true);
00933 }
00938 template <class T>
00939 void add(vector < vector <T> > *item)
00940 { unnamed.push_back(new _dataiorec <T>(this, "", item, (unsigned long *)0, (unsigned long *)0, (unsigned long *)0));
00941
00942 isnamedvar.push_back(false);
00943 }
00944
00946
00948
00949
00962
00963 void addnamed(string const &name, T *item, unsigned long &strsize=*(unsigned long *)0)
00964 { named.push_back(new _dataiorec<T>(this, name, item, &strsize));
00965
00966 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
00967 isnamedvar.push_back(true);
00968 }
00981 template <class T>
00982 void addunnamed(T *item, unsigned long &strsize=*(unsigned long *)0)
00983 { unnamed.push_back(new _dataiorec <T>(this, "", item, &strsize));
00984
00985 isnamedvar.push_back(false);
00986 }
01001
01002 template <class T>
01003 void addnamed(string const &name, vector <T> *item, unsigned long &m = *(unsigned long *)0,
01004 unsigned long &strsize=*(unsigned long *)0)
01005 { named.push_back(new _dataiorec <T>(this, name, item, &m, &strsize));
01006
01007 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
01008 isnamedvar.push_back(true);
01009 }
01024
01025 template <class T>
01026 void addunnamed(vector <T> *item, unsigned long &m=*(unsigned long *)0,
01027 unsigned long &strsize=*(unsigned long *)0)
01028 { unnamed.push_back(new _dataiorec <T>(this, "", item, &m, &strsize));
01029
01030 isnamedvar.push_back(false);
01031 }
01048 template <class T>
01049 void addnamed(string const &name, vector <vector <T> > *item, unsigned long &m=*(unsigned long *)0,
01050 unsigned long &n=*(unsigned long *)0, unsigned long &strsize=*(unsigned long *)0)
01051 { named.push_back(new _dataiorec <T>(this, name, item, &m, &n, &strsize));
01052
01053 parsestring(named[named.size()-1]->name, stringdelimiter, scapechar);
01054 isnamedvar.push_back(true);
01055 }
01072 template <class T>
01073 void addunnamed(vector < vector <T> > *item, unsigned long &m=0, unsigned long &n=*(unsigned long *)0,
01074 unsigned long strsize=*(unsigned long *)0)
01075 { unnamed.push_back(new _dataiorec <T>(this, "", item, &m, &n, &strsize));
01076
01077 isnamedvar.push_back(false);
01078 }
01079
01080
01081 private:
01082
01083 unsigned finditem(void const *item, vector<_dataiorecbase *> &list);
01084
01085 unsigned findname(string const &key);
01086
01087 unsigned keysearch(string const &key, vector<string> &list);
01088
01089 unsigned findrefername(string const &key);
01090 bool unnamedsetted();
01091 bool namedsetted();
01092
01093
01094 void addcommenttolist(string const &rem, vector <string> &remlist);
01095
01096
01097 vector <string> &dataio::commentlisttoblockmode(vector <string> &rem, vector<string> &remlist);
01098
01099
01100 istream &getlinewithcomment(istream &f, string &datalinelist);
01101
01102
01103
01104 bool deletelinewrapmarker(string &line);
01105
01106
01107
01108 bool deletesectionnamemarker(string &s);
01109
01110
01111
01112 bool sectionnamelike(string const &s);
01113
01114
01115
01116 istream &getdataline(istream &f, vector <string> &datalinelist);
01117
01118
01119
01120
01121 istream &readtableorcolumnoriented(istream &is);
01122
01123
01124 bool delimiterrecomended(string const &s);
01125
01126
01127
01128 ostream &writetableorcolumnoriented(ostream &os);
01129
01130 ostream &writecomment(ostream &os, vector <string> const &rem);
01131
01132 ostream &writelineseparator(ostream &os);
01133
01134 vector <vector <string> > &gettablevalue(bool includecomment);
01135
01136
01137
01138
01139
01140 unsigned long dataio::readbuffer(istream &is, unsigned char *buff, unsigned long n);
01141
01142 void dataio::writebuffer(ostream &os, unsigned char *buff, unsigned long n);
01143
01144
01145
01146 void clearmemberinputstatus();
01147
01148
01149 void clearinputstatus(bool includemember=true);
01150
01151
01152 void validatethis(unsigned n);
01153 public:
01154
01155
01158
01162
01165
01168
01169
01173 istream &read(istream &is);
01177 ostream &write(ostream &os);
01178
01190 virtual void startinblock(unsigned i){
01191 }
01192
01207 virtual void validate(unsigned n){
01208 }
01209
01214 virtual bool startoutblock(unsigned i){
01215 return (i == 0);}
01216
01218 dataio()
01219 { resetflags();
01220 valuesetted=false;
01221 }
01225 void clearinputbuffer();
01226
01236 void resetflags(bool maprecomendedflagsintomember=true);
01242 void clear();
01246 void reset()
01247 {
01248 clear();
01249 resetflags();
01250 valuesetted = false;
01251 }
01253
01254 { unsigned i;
01255 for(i=0; i< unnamed.size(); i++) delete unnamed[i];
01256 for(i=0; i< named.size(); i++) delete named[i];
01257 }
01258
01259 template <class T>
01260 friend _dataiorec<T>;
01261 };
01262
01263
01264 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01265
01266
01268
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287 template <class T>
01288
01289 bool _dataiorec<T>::stringtoitem(string &s, T &item)
01290 {
01291 cerr << "_dataiorec<T>::stringtoitem() not implemented" << endl;
01292 return false;
01293 }
01294
01295 template <class T>
01296 void _dataiorec<T>::itemtostring(T const &item, string &s)
01297 {
01298 cerr << "_dataiorec<T>::itemtostring not implemented" << endl;
01299 s = "_dataiorec<T>::itemtostring not implemented";
01300 }
01301
01302
01303 template <class T>
01304 bool _dataiorec<T>::readitem(istream &is, T &item)
01305 {
01306 cerr << "_dataiorec<T>::readitem() not implemented" << endl;
01307 return false;
01308 }
01309
01310 template <class T>
01311 void _dataiorec<T>::writeitem(ostream &os, T const &item)
01312 {
01313 cerr << "_dataiorec<T>::itemtostring not implemented" << endl;
01314 os << "_dataiorec<T>::itemtostring not implemented";
01315 }
01316
01318
01319
01321
01322
01324
01326
01328
01331
01333
01334
01335 bool _dataiorec<string>::stringtoitem(string &s, string &item);
01336 void _dataiorec<string>::itemtostring(string const &item, string &s);
01337
01338 bool _dataiorec<string>::readitem(istream &is, string &item);
01339 void _dataiorec<string>::writeitem(ostream &os, string const &item);
01340
01342
01344
01345 bool _dataiorec<char>::stringtoitem(string &s, char &item);
01346 void _dataiorec<char>::itemtostring(char const &item, string &s);
01347
01348 bool _dataiorec<char>::readitem(istream &is, char &item);
01349 void _dataiorec<char>::writeitem(ostream &os, char const &item);
01350
01351
01352
01353 bool _dataiorec<unsigned char>::stringtoitem(string &s, unsigned char &item);
01354 void _dataiorec<unsigned char>::itemtostring(unsigned char const &item, string &s);
01355
01356 bool _dataiorec<unsigned char>::readitem(istream &is, unsigned char &item);
01357 void _dataiorec<unsigned char>::writeitem(ostream &os, unsigned char const &item);
01358
01359
01360
01361 bool _dataiorec<wchar_t>::stringtoitem(string &s, wchar_t &item);
01362 void _dataiorec<wchar_t>::itemtostring(wchar_t const &item, string &s);
01363
01364 bool _dataiorec<wchar_t>::readitem(istream &is, wchar_t &item);
01365 void _dataiorec<wchar_t>::writeitem(ostream &os, wchar_t const &item);
01366
01368
01370
01371
01372 bool _dataiorec<int>::stringtoitem(string &s, int &item);
01373 void _dataiorec<int>::itemtostring(int const &item, string &s);
01374
01375 bool _dataiorec<int>::readitem(istream &is, int &item);
01376 void _dataiorec<int>::writeitem(ostream &os, int const &item);
01377
01378
01379 bool _dataiorec<unsigned>::stringtoitem(string &s, unsigned &item);
01380 void _dataiorec<unsigned>::itemtostring(unsigned const &item, string &s);
01381
01382 bool _dataiorec<unsigned>::readitem(istream &is, unsigned &item);
01383 void _dataiorec<unsigned>::writeitem(ostream &os, unsigned const &item);
01384
01385
01386 bool _dataiorec<long>::stringtoitem(string &s, long &item);
01387 void _dataiorec<long>::itemtostring(long const &item, string &s);
01388
01389 bool _dataiorec<long>::readitem(istream &is, long &item);
01390 void _dataiorec<long>::writeitem(ostream &os, long const &item);
01391
01392
01393 bool _dataiorec<unsigned long>::stringtoitem(string &s, unsigned long &item);
01394 void _dataiorec<unsigned long>::itemtostring(unsigned long const &item, string &s);
01395
01396 bool _dataiorec<unsigned long>::readitem(istream &is, unsigned long &item);
01397 void _dataiorec<unsigned long>::writeitem(ostream &os, unsigned long const &item);
01398
01399
01400
01401 bool _dataiorec<long long>::stringtoitem(string &s, long long &item);
01402 void _dataiorec<long long>::itemtostring(long long const &item, string &s);
01403
01404 bool _dataiorec<long long>::readitem(istream &is, long long &item);
01405 void _dataiorec<long long>::writeitem(ostream &os, long long const &item);
01406
01407
01408 bool _dataiorec<unsigned long long>::stringtoitem(string &s, unsigned long long &item);
01409 void _dataiorec<unsigned long long>::itemtostring(unsigned long long const &item, string &s);
01410
01411 bool _dataiorec<unsigned long long>::readitem(istream &is, unsigned long long &item);
01412 void _dataiorec<unsigned long long>::writeitem(ostream &os, unsigned long long const &item);
01413
01415
01417
01418
01419 bool _dataiorec<float>::stringtoitem(string &s, float &item);
01420
01421 void _dataiorec<float>::itemtostring(float const &item, string &s);
01422
01423 bool _dataiorec<float>::readitem(istream &is, float &item);
01424 void _dataiorec<float>::writeitem(ostream &os, float const &item);
01425
01426
01427 bool _dataiorec<double>::stringtoitem(string &s, double &item);
01428 void _dataiorec<double>::itemtostring(double const &item, string &s);
01429
01430 bool _dataiorec<double>::readitem(istream &is, double &item);
01431 void _dataiorec<double>::writeitem(ostream &os, double const &item);
01432
01433
01434
01435
01436
01437 bool _dataiorec<long double>::stringtoitem(string &s, long double &item);
01438 void _dataiorec<long double>::itemtostring(long double const &item, string &s);
01439
01440 bool _dataiorec<long double>::readitem(istream &is, long double &item);
01441 void _dataiorec<long double>::writeitem(ostream &os, long double const &item);
01442
01444
01446
01447
01448
01449 bool _dataiorec<bool>::stringtoitem(string &s, bool &item);
01450 void _dataiorec<bool>::itemtostring(bool const &item, string &s);
01451
01452 bool _dataiorec<bool>::readitem(istream &is, bool &item);
01453 void _dataiorec<bool>::writeitem(ostream &os, bool const &item);
01454
01455
01456 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01457
01458
01462 #endif // #define _DATAIO_H_
01463