#include <dataio.h>
Public Methods | |||
void | addcomment (string const &rem) | ||
add an comment item to comment list
| |||
void | clearcomment (bool includemember=false) | ||
clear comment list
| |||
vector<string>& | comment () | ||
return reference for comment list use carefully
| |||
bool | addcomment (string const &name, string const &rem) | ||
add an comment item to comment list of named item return false if not found
| |||
bool | additemcomment (void *item, string const &rem) | ||
add an comment item to comment list of item
| |||
void | clearcomment (string const &name, bool includemember=false) | ||
clear comment list of named item
| |||
void | clearitemcomment (void *item, bool includemember=false) | ||
clear comment list of item
| |||
void | clearitemcomment (bool includemember=false) | ||
clear comment list of all items
| |||
vector<string>& | comment (string const &name) | ||
return reference for comment list of named item use carefully
| |||
vector<string>& | itemcomment (void *item) | ||
return reference for comment list of item use carefully
| |||
string& | commentline () | ||
One line comment start marker. Ignore at end of current line. Default is _DATAIODEFAULTCOMMENTLINE
| |||
string& | commentline (string const &com) | ||
string& | linewrap () | ||
This marker is used in the end of line (possible followed by blank space or comment) The next line is appended in the end of line. Caution: it is in sperimental stage and name will change. Default is _DATAIODEFAULTLINEBREAK
| |||
string& | linewrap (string const &wrap) | ||
void | disablesection () | ||
disable section (empty sectionnameopen and sectionnameclose) to activate the section, use enablestdsection, or set manually the sectionnameopen and sectionnameclose
| |||
void | enablestdsection () | ||
set as standard section mode (set the sectionnameopen and sectionnameclose) for non-standard section mode, set sectionnameopen and sectionnameclose manually
| |||
bool | throwexception () | ||
if this flag is true, throw exception on error default value is _DATAIODEFAULTTHROWEXCEPTION
| |||
bool | throwexception (bool dec, bool includemember=true) | ||
bool | printerror () | ||
if this flag is true, coutput error message on error default value is _DATAIODEFAULTPRINTEROR
| |||
bool | printerror (bool dec, bool includemember=true) | ||
bool | emptyisvalid () | ||
if this flag is true, consider empty value as valid value inside of several stringtoitem() conversion Default is _DATAIODEFAULTEMPTYISVALID
| |||
bool | emptyisvalid (bool flag, bool includemember=true) | ||
bool | ignorecase () | ||
| |||
bool | ignorecase (bool status, bool includemember=true) | ||
Set ignore case flag. Default value of ignore case frag is _DATAIODEFAULTIGNORECASE
| |||
char | decimal () | ||
| |||
char | decimal (char dec, bool includemember=true) | ||
set decimal character used by floating number. Default is _DATAIODEFAULTDECIMAL
| |||
bool | validateall () | ||
| |||
bool | validateall (bool status, bool includemember=true) | ||
set flag to decide if unrefered variables will be validated. Default is _DATAIODEFAULTVALIDATEALL
| |||
string& | commentopen () | ||
string& | commentopen (string const &s) | ||
| |||
string& | commentclose () | ||
Comment block endding marker. End the comment started by commentopen. Default is _DATAIODEFAULTCOMMENTCLOSE
| |||
string& | commentclose (string const &s) | ||
< return comment block endding marker Comment block endding marker. End the comment started by commentopen. Default is _DATAIODEFAULTCOMMENTCLOSE
| |||
void | disablecommentblock () | ||
disable comment block features (empty commentopen and commentclose). More... | |||
void | enablestdcommentblock () | ||
enable standard comment block mode for non-standard comment block mode, set manually the commentopen and commentclose. More... | |||
bool | setted () | ||
| |||
bool | setted (string const &name) | ||
| |||
bool | itemsetted (void *item) | ||
| |||
bool | collectnames () | ||
bool | collectnames (bool flag, bool includemember=true) | ||
set the flag for the name collector on value setting stage. if true, the all dataio type class that the value is setted, collect the refered names, inclusive the dataio class added to this collect their own refered names. note that the first level (the class that operator>> is called, always collect their names). CAUTION: name of this methods will change!
| |||
bool | refered (string const &name) | ||
return true is name appeared in input data during operator>> data processing
| |||
bool | itemrefered (void *item) | ||
return true is item is tryed to set in the input stage, during operator>> data processing
| |||
vector<string>& | referednames () | ||
vector<string>& | unreferednames () | ||
< return (reference of) referenced name list. More... | |||
void | add (string const &name, dataio *item) | ||
add one data record (or data block) with names
| |||
void | add (dataio *item) | ||
add one data record (or data block) without names
| |||
template<class T> void | add (string const &name, T *item) | ||
add one variable with names
| |||
template<class T> void | add (T *item) | ||
add one item without names
| |||
template<class T> void | add (string const &name, vector< T > *item) | ||
add one vector of class with names
| |||
template<class T> void | add (vector< T > *item) | ||
add one vector of class without names
| |||
template<class T> void | add (string const &name, vector< vector< T > > *item) | ||
add one vector of vector of class with names
| |||
template<class T> void | add (vector< vector< T > > *item) | ||
2 dimensional add one vector of vector of class without names
| |||
template<class T> void | addnamed (string const &name, T *item, unsigned long &strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
template<class T> void | addunnamed (T *item, unsigned long &strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
template<class T> void | addnamed (string const &name, vector< T > *item, unsigned long &m=*(unsigned long *) 0, unsigned long &strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write vector size in binary i/o. itherwise, assume that is fixed size = m vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
template<class T> void | addunnamed (vector< T > *item, unsigned long &m=*(unsigned long *) 0, unsigned long &strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write vector size in binary i/o. itherwise, assume that is fixed size = m vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
template<class T> void | addnamed (string const &name, vector< vector< T > > *item, unsigned long &m=*(unsigned long *) 0, unsigned long &n=*(unsigned long *) 0, unsigned long &strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write row number in binary i/o. itherwise, assume that is fixed row number = m. if &n == 0, read/write vector size in binary i/o. otherwise, assume that is fixed size = n vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
template<class T> void | addunnamed (vector< vector< T > > *item, unsigned long &m=0, unsigned long &n=*(unsigned long *) 0, unsigned long strsize=*(unsigned long *) 0) | ||
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write row number in binary i/o. itherwise, assume that is fixed row number = m. if &n == 0, read/write vector size in binary i/o. otherwise, assume that is fixed size = n vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
| |||
void | setvalue (vector< vector< string > > &item) | ||
set values stored in vector<vector<string> >
| |||
vector<vector <string> >& | getvalue (bool includecomment=false) | ||
get values as vector<vector<string> > The global comment is not included in the list!
| |||
istream& | read (istream &is) | ||
In testing stage: This is to input cross platoform binary data from istream (for text stream input, use operator>>
| |||
ostream& | write (ostream &os) | ||
In testing stage: This is to output cross platoform binary data to ostream (for text stream output, use operator<<
| |||
virtual void | startinblock (unsigned i) | ||
method for input block preparator. The multi-block input, or table data input requires that extend dataio class and overwrite this so that this routine make block i-th preparation. (in this place, you need to set variables corresponding to i-th block.) See the samptable.cpp Note: The value of i increase in each call of startinblock() If pretend to auto validate the input, overwrite validate
| |||
virtual void | validate (unsigned n) | ||
The data validator To validate the data, overwrite this Note that, in the multi-block input, or table data, the information as setted, refered, etc, is only for i-th block) - value of i increase in each call of validate - called only once for each value setting - the member that not tried to set value is not validated. is not validated. Will use refered() to check if spcial member is tried to validated - the main class that call operator>> call their validate More... | |||
virtual bool | startoutblock (unsigned i) | ||
For multi-block output or table data output, need to overwrite this routine in way to to perform i-th data setting
| |||
dataio () | |||
default constructor. More... | |||
void | clearinputbuffer () | ||
clear the memory used by input/output transaction, After this, setted(), refered(), etc, will not work unless new input is performed. More... | |||
void | resetflags (bool maprecomendedflagsintomember=true) | ||
reset all status flags: istable, ignorecase(), commentline, commentopen, commentclose, columnoriented, decimal(), columnseparator, lineseparator. Note that the decimal, commentopen, commentclose, and emptyisvalid, are recursivelly applied into the member (dataio class element added in current class).
| |||
void | clear () | ||
clear all variables added by add(). The status of istable, ignorecase(), commentline, commentopen, commentclose, columnoriented, decimal(), columnseparator, lineseparator. are preserved. More... | |||
void | reset () | ||
reset status: Clear all variables and reset all status flags.
| |||
virtual | ~dataio () | ||
default destructor. More... | |||
Public Attributes | |||
unsigned | maxcolumnonline | ||
If number of column exceds this number and linewrap is non empty, the operator>> perform line wrapping. Default is _DATAIODEFAULTMAXCOLUMNONLINE
| |||
bool | istable | ||
table data flag (if true, data will be table). Default is _DATAIODEFAULTISTABLE Commonsly, the columnoriented is used together
| |||
char | sectionnameopen | ||
section name delimiter (used before section maem) for config file. '\0' is assumed inactive. Default is _DATAIODEFAULTSECTIONNAMEOPEN If both of sectionnameopen and sectionnameclose is disabled (iswhite), config file is assumed that was not section More... | |||
char | sectionnameclose | ||
section name delimiter (used after section name) for config file. Default is _DATAIODEFAULTSECTIONNAMECLOSE If both of sectionnameopen and sectionnameclose is disabled (iswhite), data is assumed that was not section More... | |||
bool | columnoriented | ||
Column oriented data flag. If true, the data is assumed as transpose of normal data. Default is _DATAIODEFAULTCOLUMNORIENTED. commonsly, used together istable
| |||
char | columnseparator | ||
The column separator of data field. Default is _DATAIODEFAULTCOLUMNSEPARATOR
| |||
char | lineseparator | ||
Line separator of data. Default is _DATAIODEFAULTLINESEPARATOR More... | |||
char | attribseparator | ||
config attrib separator for data, if it is non zero, is assumed to use attribseparator to indicate atribution for veriable. Caution: The attribseparator will be used only for - istable and columnoriented is disabled - not subfields (non shifted data field only). The attribseparator and columnseparator will toghether in the data file! os os ognored is istable or columnoriented floag is true. Default is _DATAIODEFAULTATTRIBSEPARATOR
| |||
bool | extendedmode | ||
if this flag is true, work in extended format support mode that permit input/output the non standard data type for example, section enabled data will contain non composed data default value is _DATAIODEFAULTEXTENDEDMODE
| |||
bool | clearemptytail | ||
if this flag is true, delete empty tail of each lines default value is _DATAIODEFAULTCLEAREMPTYTAIL
| |||
bool | parseallinputstring | ||
if this flag is true, all item is parsed (using parsestring) in the input stage to solve delimited string problem, independent of the candidate for name or not. default value is _DATAIODEFAULTPARSEALLITEMSTRING. This flag is speciall that applied into all of members, independent of the mapflagstomember, in way to evit the double parsing in the stringtoitem (the default one that use it is the string type)
| |||
char | stringdelimiter | ||
the string delimiter. Default is _DATAIODEFAULTSTRINGDELIMITER
| |||
char | scapechar | ||
the scape char (to specify special char) for delimited string Default is _DATAIODEFAULTSCAPECHAR
| |||
bool | reversebyteorder | ||
validate unreferenced variable?? if false, ignore validate calling for unreferenced members. if true, call validate for all members default value is _DATAIODEFAULTVALIDATEALL
| |||
friend | _dataiorec<T> | ||
Friends | |||
istream& | operator>> (istream &is, dataio &data) | ||
extractor: read data from istream (input from CSV text)
| |||
ostream& | operator<< (ostream &os, dataio &data) | ||
insertor for dataio: write data to ostream (output as CSV text)
|
See dataformat for detail. The cross platform user require special caution on the system diference of line breaking of text file. See see dataformat for detail
sampattrib.cpp, sampbinrec.cpp, samprec.cpp, sampreclist.cpp, sampsec.cpp, and samptable.cpp.
Definition at line 497 of file dataio.h.
|
default constructor.
|
|
default destructor.
|
|
2 dimensional add one vector of vector of class without names
|
|
add one vector of vector of class with names
|
|
add one vector of class without names
|
|
add one vector of class with names
|
|
add one item without names
|
|
add one variable with names
|
|
add one data record (or data block) without names
|
|
add one data record (or data block) with names
|
|
add an comment item to comment list of named item return false if not found
|
|
add an comment item to comment list
|
|
add an comment item to comment list of item
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write row number in binary i/o. itherwise, assume that is fixed row number = m. if &n == 0, read/write vector size in binary i/o. otherwise, assume that is fixed size = n vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write vector size in binary i/o. itherwise, assume that is fixed size = m vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write row number in binary i/o. itherwise, assume that is fixed row number = m. if &n == 0, read/write vector size in binary i/o. otherwise, assume that is fixed size = n vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. if &m == 0, read/write vector size in binary i/o. itherwise, assume that is fixed size = m vector. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
TEST Purpose of addnamed and addunnamed are to perform binary i/o with fixed size vector or string manipulation. It is in testing stage. same as add for text mode. same as add for text mode. strsize is only for binary mode fixed size string input/output if &strsize == 0 use ASC Z string mode. otherwise, use fixed lenght=strsize of char sequence
|
|
clear all variables added by add(). The status of istable, ignorecase(), commentline, commentopen, commentclose, columnoriented, decimal(), columnseparator, lineseparator. are preserved.
|
|
clear comment list of named item
|
|
clear comment list
|
|
clear the memory used by input/output transaction, After this, setted(), refered(), etc, will not work unless new input is performed.
|
|
clear comment list of all items
|
|
clear comment list of item
|
|
set the flag for the name collector on value setting stage. if true, the all dataio type class that the value is setted, collect the refered names, inclusive the dataio class added to this collect their own refered names. note that the first level (the class that operator>> is called, always collect their names). CAUTION: name of this methods will change!
|
|
Definition at line 816 of file dataio.h. Referenced by add().
|
|
return reference for comment list of named item use carefully
|
|
return reference for comment list use carefully
|
|
< return comment block endding marker Comment block endding marker. End the comment started by commentopen. Default is _DATAIODEFAULTCOMMENTCLOSE
|
|
Comment block endding marker. End the comment started by commentopen. Default is _DATAIODEFAULTCOMMENTCLOSE
|
|
|
|
One line comment start marker. Ignore at end of current line. Default is _DATAIODEFAULTCOMMENTLINE
|
|
|
|
|
|
set decimal character used by floating number. Default is _DATAIODEFAULTDECIMAL
|
|
Definition at line 739 of file dataio.h. Referenced by add().
|
|
disable comment block features (empty commentopen and commentclose).
|
|
disable section (empty sectionnameopen and sectionnameclose) to activate the section, use enablestdsection, or set manually the sectionnameopen and sectionnameclose
|
|
|
|
if this flag is true, consider empty value as valid value inside of several stringtoitem() conversion Default is _DATAIODEFAULTEMPTYISVALID
Definition at line 729 of file dataio.h. Referenced by add().
|
|
enable standard comment block mode for non-standard comment block mode, set manually the commentopen and commentclose.
|
|
set as standard section mode (set the sectionnameopen and sectionnameclose) for non-standard section mode, set sectionnameopen and sectionnameclose manually
|
|
get values as vector<vector<string> > The global comment is not included in the list!
|
|
Set ignore case flag. Default value of ignore case frag is _DATAIODEFAULTIGNORECASE
|
|
Definition at line 733 of file dataio.h. Referenced by add().
|
|
return reference for comment list of item use carefully
|
|
return true is item is tryed to set in the input stage, during operator>> data processing
|
|
|
|
|
|
This marker is used in the end of line (possible followed by blank space or comment) The next line is appended in the end of line. Caution: it is in sperimental stage and name will change. Default is _DATAIODEFAULTLINEBREAK
|
|
|
|
if this flag is true, coutput error message on error default value is _DATAIODEFAULTPRINTEROR
|
|
In testing stage: This is to input cross platoform binary data from istream (for text stream input, use operator>>
|
|
return true is name appeared in input data during operator>> data processing
|
|
|
|
reset status: Clear all variables and reset all status flags.
|
|
reset all status flags: istable, ignorecase(), commentline, commentopen, commentclose, columnoriented, decimal(), columnseparator, lineseparator. Note that the decimal, commentopen, commentclose, and emptyisvalid, are recursivelly applied into the member (dataio class element added in current class).
|
|
|
|
|
|
set values stored in vector<vector<string> >
|
|
method for input block preparator. The multi-block input, or table data input requires that extend dataio class and overwrite this so that this routine make block i-th preparation. (in this place, you need to set variables corresponding to i-th block.) See the samptable.cpp Note: The value of i increase in each call of startinblock() If pretend to auto validate the input, overwrite validate
|
|
For multi-block output or table data output, need to overwrite this routine in way to to perform i-th data setting
|
|
|
|
if this flag is true, throw exception on error default value is _DATAIODEFAULTTHROWEXCEPTION
|
|
< return (reference of) referenced name list.
|
|
The data validator To validate the data, overwrite this Note that, in the multi-block input, or table data, the information as setted, refered, etc, is only for i-th block) - value of i increase in each call of validate - called only once for each value setting - the member that not tried to set value is not validated. is not validated. Will use refered() to check if spcial member is tried to validated - the main class that call operator>> call their validate
|
|
set flag to decide if unrefered variables will be validated. Default is _DATAIODEFAULTVALIDATEALL
|
|
|
|
In testing stage: This is to output cross platoform binary data to ostream (for text stream output, use operator<<
|
|
insertor for dataio: write data to ostream (output as CSV text)
|
|
extractor: read data from istream (input from CSV text)
|
|
|
|
config attrib separator for data, if it is non zero, is assumed to use attribseparator to indicate atribution for veriable. Caution: The attribseparator will be used only for - istable and columnoriented is disabled - not subfields (non shifted data field only). The attribseparator and columnseparator will toghether in the data file! os os ognored is istable or columnoriented floag is true. Default is _DATAIODEFAULTATTRIBSEPARATOR
|
|
if this flag is true, delete empty tail of each lines default value is _DATAIODEFAULTCLEAREMPTYTAIL
|
|
Column oriented data flag. If true, the data is assumed as transpose of normal data. Default is _DATAIODEFAULTCOLUMNORIENTED. commonsly, used together istable
|
|
The column separator of data field. Default is _DATAIODEFAULTCOLUMNSEPARATOR
|
|
if this flag is true, work in extended format support mode that permit input/output the non standard data type for example, section enabled data will contain non composed data default value is _DATAIODEFAULTEXTENDEDMODE
|
|
table data flag (if true, data will be table). Default is _DATAIODEFAULTISTABLE Commonsly, the columnoriented is used together
|
|
Line separator of data. Default is _DATAIODEFAULTLINESEPARATOR
|
|
If number of column exceds this number and linewrap is non empty, the operator>> perform line wrapping. Default is _DATAIODEFAULTMAXCOLUMNONLINE
|
|
if this flag is true, all item is parsed (using parsestring) in the input stage to solve delimited string problem, independent of the candidate for name or not. default value is _DATAIODEFAULTPARSEALLITEMSTRING. This flag is speciall that applied into all of members, independent of the mapflagstomember, in way to evit the double parsing in the stringtoitem (the default one that use it is the string type)
|
|
validate unreferenced variable?? if false, ignore validate calling for unreferenced members. if true, call validate for all members default value is _DATAIODEFAULTVALIDATEALL
|
|
the scape char (to specify special char) for delimited string Default is _DATAIODEFAULTSCAPECHAR
|
|
section name delimiter (used after section name) for config file. Default is _DATAIODEFAULTSECTIONNAMECLOSE If both of sectionnameopen and sectionnameclose is disabled (iswhite), data is assumed that was not section
|
|
section name delimiter (used before section maem) for config file. '\0' is assumed inactive. Default is _DATAIODEFAULTSECTIONNAMEOPEN If both of sectionnameopen and sectionnameclose is disabled (iswhite), config file is assumed that was not section
|
|
the string delimiter. Default is _DATAIODEFAULTSTRINGDELIMITER
|