STK++ 0.9.13
|
the TReadWriteCsv class : allow to write and/or to read a csv file. More...
#include <STK_ReadWriteCsv.h>
Public Types | |
typedef Variable< Type > | Var |
Public Member Functions | |
TReadWriteCsv () | |
The default constructor. | |
TReadWriteCsv (std::string const &file_name, bool read_names=Csv::DEFAULT_READNAMES, String const &delimiters=Csv::DEFAULT_DELIMITER) | |
Constructor with a specified file name. | |
TReadWriteCsv (TReadWriteCsv const &rw) | |
Copy constructor. | |
~TReadWriteCsv () | |
destructor. | |
void | clear () |
reset all fields to default value and reclaims any allocated memory. | |
int | begin () const |
int | end () const |
int | size () const |
Range | cols () const |
int | beginCols () const |
int | endCols () const |
int | sizeCols () const |
int | firstRow (int icol) const |
int | endRow (int icol) const |
int | lastRow (int icol) const |
int | sizeRow (int icol) const |
int | beginRows () const |
int | endRows () const |
int | sizeRows () const |
int | lastIdxRows () const |
Range | rows () const |
int | lastIdx () const |
int | lastIdxCols () const |
String const & | error () const |
String const & | delimiters () const |
bool | withNames () const |
void | setDelimiters (String const &delimiters) const |
Sets the delimiters to use for parsing data (delimiters_ is mutable). | |
void | setWithNames (bool with_names) const |
Sets the with_names_ value for reading/writing variables names. | |
void | setWithMapping (bool with_mapping) const |
Sets the with_mapping_ value for reading/writing variables names. | |
void | setLast_nl (bool with_last_nl) const |
Sets the with_last_nl_ value for writing a new line after the last line. | |
void | setReserve (int const &reserve) const |
Sets the reserve value for data storage (reserve_ is mutable). | |
void | setInMapping (std::map< String, Type > const &imapping) |
Set mapping to used when reading. | |
void | setOutMapping (std::map< String, Type > const &omapping) |
Set mapping to used when writting. | |
bool | setName (int const &icol, String const &name) |
Set the variable name name at the specified index. | |
Type & | operator() (int const &iRow, int const &iCol) |
Type const | operator() (int const &iRow, int const &iCol) const |
Var * | clone (int icol) const |
Var & | var (int j) |
Var const & | var (int icol) const |
Var & | at (int icol) |
Var const & | at (int icol) const |
Var & | operator[] (int const &icol) |
Var const | operator[] (int const &icol) const |
@ return a const reference to the value at the specified location. | |
Var & | front () |
Var const & | front () const |
Var & | back () |
Var const & | back () const |
bool | push_back (Var const &data=Var()) |
Attempts to add a column with the values contained in data. | |
bool | push_front (Var const &data=Var()) |
Attempts to add a column with the values contained in data. | |
void | resize (int sizeRows, int sizeCols) |
resize the container str_data_. | |
bool | appendData (int const &icol, Type const &value) |
Attempts to append a data to the variable specified by icol. | |
bool | eraseColumn (int const &icol) |
Deletes the variable whose index is icol from a TReadWriteCsv. | |
TReadWriteCsv & | operator= (TReadWriteCsv const &rw) |
Assigns a TReadWriteCsv equal to another TReadWriteCsv. | |
TReadWriteCsv & | operator+= (TReadWriteCsv const &rw) |
Appends a TReadWriteCsv to another TReadWriteCsv. | |
TReadWriteCsv | operator+ (TReadWriteCsv const &rw) const |
Combines TReadWriteCsv(s) | |
template<class Array > | |
void | exporter (ArrayBase< Array > &array) const |
export to an array of the same Type | |
bool | read () |
Reads the default file with the specified read flags. | |
bool | read (std::map< String, Type > const &mapping) |
Reads the default file with the specified read flags using a map. | |
bool | read (std::string const &file_name) |
Reads the specified file with the specified read flags. | |
bool | read (istream &inBuffer) |
Reads the specified input stream with the specified read flags. | |
bool | write () |
write to the default file with the specified write flags. | |
bool | write (std::string const &file_name) const |
Attempts to write the TReadWriteCsv to the location specified by file_name using the delimiters specified by delimiters_. | |
void | write (ostream &os) const |
Write the csv to an output stream. | |
void | writeSelection (ostream &os, int top, int bottom, int left, int right) const |
Write to output stream a selection based on the coordinates passed (Think of it as highlighting cells in Excel). | |
Protected Member Functions | |
int | countFields (String const &line, Array1D< Char > &listDelimiters) |
Counts the number of columns in a line stored in a String and return the position of the delimiters and its types. | |
int | readCurrentLine (istream &inBuffer, String ¤tLine, Array1D< Char > &listDelimiters) |
Read the current line from the buffer. | |
void | readNames (istream &inBuffer) |
Read the names of rhe Csv file. | |
void | initRead (istream &inBuffer) |
Initial read. | |
void | fastSetData (int const &icol, int const &irow, Type const &value) |
Set without check the specified value to the element (icol, irow). | |
void | resizeRows (Range const &rows) |
resize the TReadWriteCsv to the given range of rows. | |
void | resizeCols (Range const &cols) |
resize the TReadWriteCsv to the given range of columns. | |
Protected Attributes | |
std::string | file_name_ |
Name of the Current file read. | |
bool | with_names_ |
Read or Write names of the variables. | |
bool | with_mapping_ |
map the values stored | |
bool | with_last_nl_ |
write a new line character at the end of the output | |
String | delimiters_ |
Delimiter(s) | |
int | reserve_ |
Size of the buffer. | |
String | msg_error_ |
Contain the last error message. | |
Array1D< Var > | str_data_ |
Array of array for the data. | |
std::map< String, Type > | imapping_ |
mapping String -> Type for (input) | |
std::map< Type, String > | omapping_ |
mapping Type -> String (output) | |
int | nbVars_ |
The number of variables we manage. | |
int | nbRows_ |
The number of rows we manage. | |
Friends | |
istream & | operator>> (istream &in, TReadWriteCsv &rw) |
overload operator >> for rw | |
ostream & | operator<< (ostream &os, TReadWriteCsv const &rw) |
overload operator << for rw | |
the TReadWriteCsv class : allow to write and/or to read a csv file.
It is possible to merge two csv files and to extract sub-region of the file too. All data are stored in a Type format. if there exists mixed types in the file you want to read/write, used the String format and use the import/export utilities classes
It is possible to use a mapping in order to write/read the data using an other encoding.
Definition at line 107 of file STK_ReadWriteCsv.h.
typedef Variable<Type> STK::TReadWriteCsv< Type >::Var |
Definition at line 110 of file STK_ReadWriteCsv.h.
|
inline |
The default constructor.
Instantiates an instance of TReadWriteCsv and initialize data members to default values.
Definition at line 114 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::operator+().
|
inline |
Constructor with a specified file name.
Instantiates an instance of TReadWriteCsv with the specified read flags.
file_name | name of the file to read/write |
read_names | true if we want read/write the names of the variables at the first line of the file |
delimiters | The delimiters used in the fileo(if read) or the delimiter to use (if write) |
Definition at line 133 of file STK_ReadWriteCsv.h.
|
inline |
Copy constructor.
Instantiates an instance of TReadWriteCsv with the contents of another TReadWriteCsv.
rw | the TReadWriteCsv to copy |
Definition at line 151 of file STK_ReadWriteCsv.h.
|
inline |
|
inline |
Attempts to append a data to the variable specified by icol.
icol | index of the col |
value | value to set |
true
if successful, false
if an error is encountered. Definition at line 383 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
icol | index of the col |
Definition at line 317 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
icol | index of the col |
Definition at line 321 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 335 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::lastIdx(), and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 337 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::lastIdx(), and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 166 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::beginRows(), STK::TReadWriteCsv< Type >::endRows(), STK::TReadWriteCsv< Type >::front(), STK::TReadWriteCsv< Type >::front(), STK::TReadWriteCsv< Type >::lastIdxRows(), STK::TReadWriteCsv< Type >::resizeRows(), STK::TReadWriteCsv< Type >::sizeRows(), STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
inline |
Definition at line 175 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::exporter().
|
inline |
Definition at line 198 of file STK_ReadWriteCsv.h.
References STK::baseIdx, STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::firstRow(), STK::TReadWriteCsv< Type >::lastIdx(), and STK::TReadWriteCsv< Type >::size().
Referenced by STK::TReadWriteCsv< Type >::exporter(), STK::TReadWriteCsv< Type >::rows(), STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
inline |
reset all fields to default value and reclaims any allocated memory.
Definition at line 155 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::delimiters_, STK::TReadWriteCsv< Type >::msg_error_, STK::TReadWriteCsv< Type >::reserve_, STK::TReadWriteCsv< Type >::str_data_, STK::TReadWriteCsv< Type >::with_last_nl_, STK::TReadWriteCsv< Type >::with_mapping_, and STK::TReadWriteCsv< Type >::with_names_.
|
inline |
icol | index of the col |
Definition at line 305 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 173 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::resizeCols().
|
inlineprotected |
Counts the number of columns in a line stored in a String and return the position of the delimiters and its types.
line | The String to parse |
listDelimiters | array with the delimiters found in the line |
Definition at line 588 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::delimiters_, and STK::TReadWriteCsv< Type >::nbVars_.
Referenced by STK::TReadWriteCsv< Type >::readCurrentLine().
|
inline |
Definition at line 244 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::delimiters_.
Referenced by STK::TReadWriteCsv< Type >::setDelimiters().
|
inline |
Definition at line 168 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::endRows(), STK::TReadWriteCsv< Type >::lastIdxRows(), and STK::TReadWriteCsv< Type >::sizeRows().
|
inline |
Definition at line 177 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::exporter().
|
inline |
icol | index of the column |
icol
Definition at line 188 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::endRows().
|
inline |
Definition at line 207 of file STK_ReadWriteCsv.h.
References STK::baseIdx, STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::end(), STK::TReadWriteCsv< Type >::endRow(), STK::TReadWriteCsv< Type >::lastRow(), and STK::TReadWriteCsv< Type >::size().
Referenced by STK::TReadWriteCsv< Type >::exporter().
|
inline |
Deletes the variable whose index is icol from a TReadWriteCsv.
icol | index of the column to erase |
true
if successful, false
if an error is encountered. Definition at line 401 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 242 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::msg_error_.
|
inline |
export to an array of the same Type
Definition at line 443 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::beginCols(), STK::TReadWriteCsv< Type >::beginRows(), STK::TReadWriteCsv< Type >::endCols(), STK::TReadWriteCsv< Type >::endRows(), STK::TReadWriteCsv< Type >::sizeCols(), STK::TReadWriteCsv< Type >::sizeRows(), and STK::TReadWriteCsv< Type >::var().
|
inlineprotected |
Set without check the specified value to the element (icol, irow).
icol | index of the column |
irow | index of the row |
value | the value to set |
Definition at line 689 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
icol | index of the variable |
icol
Definition at line 184 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::beginRows().
|
inline |
Definition at line 331 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 333 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), and STK::TReadWriteCsv< Type >::str_data_.
|
inlineprotected |
Initial read.
Will compute an initial value for nbRows_ and nbVars_ and eventually read the name of the variables in the first line of the file.
inBuffer | the input stream to start to read |
Definition at line 660 of file STK_ReadWriteCsv.h.
References STK::DManager::nbEndOfLine(), STK::TReadWriteCsv< Type >::nbRows_, STK::TReadWriteCsv< Type >::nbVars_, STK::TReadWriteCsv< Type >::readCurrentLine(), STK::TReadWriteCsv< Type >::readNames(), STK::TReadWriteCsv< Type >::setReserve(), STK::TReadWriteCsv< Type >::str_data_, and STK::TReadWriteCsv< Type >::with_names_.
|
inline |
Definition at line 237 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::back(), STK::TReadWriteCsv< Type >::back(), STK::TReadWriteCsv< Type >::beginRows(), STK::TReadWriteCsv< Type >::resizeRows(), STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
inline |
Definition at line 239 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Definition at line 225 of file STK_ReadWriteCsv.h.
References STK::baseIdx, STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::end(), STK::TReadWriteCsv< Type >::lastRow(), and STK::TReadWriteCsv< Type >::size().
Referenced by STK::TReadWriteCsv< Type >::rows(), STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
inline |
icol | index of the column |
icol
Definition at line 192 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::endRows(), and STK::TReadWriteCsv< Type >::lastIdxRows().
|
inline |
iCol | index of the column |
iRow | index of the row |
Definition at line 294 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
iCol | index of the column |
iRow | index of the row |
Definition at line 300 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Combines TReadWriteCsv(s)
rw | the TReadWriteCsv to add |
Definition at line 439 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::TReadWriteCsv().
|
inline |
Appends a TReadWriteCsv to another TReadWriteCsv.
rw | the TReadWriteCsv to append |
Definition at line 430 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Assigns a TReadWriteCsv equal to another TReadWriteCsv.
rw | the TReadWriteCsv to copy |
Definition at line 415 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::delimiters_, STK::TReadWriteCsv< Type >::file_name_, STK::TReadWriteCsv< Type >::msg_error_, STK::IRunnerBase::msg_error_, STK::TReadWriteCsv< Type >::nbRows_, STK::TReadWriteCsv< Type >::nbVars_, STK::TReadWriteCsv< Type >::reserve_, STK::TReadWriteCsv< Type >::str_data_, and STK::TReadWriteCsv< Type >::with_names_.
|
inline |
icol | index of the col |
Definition at line 325 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
@ return a const reference to the value at the specified location.
icol | index of the col |
Definition at line 329 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Attempts to add a column with the values contained in data.
data | the column to push back |
true
if successful, false
if an error is encountered. Definition at line 342 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::readNames().
|
inline |
Attempts to add a column with the values contained in data.
data | the column to push front |
true
if successful, false
if an error is encountered. Definition at line 358 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Reads the default file with the specified read flags.
true
if successful, false
if an error is encountered. Definition at line 458 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::file_name_, and STK::TReadWriteCsv< Type >::read().
Referenced by STK::TReadWriteCsv< Type >::read(), STK::TReadWriteCsv< Type >::read(), and STK::TReadWriteCsv< Type >::read().
bool STK::TReadWriteCsv< Type >::read | ( | istream & | inBuffer | ) |
Reads the specified input stream with the specified read flags.
inBuffer | name of the stream to read |
true
if successful, false
if an error is encountered. Definition at line 711 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::DManager::getField(), STK::IRunnerBase::msg_error_, STK::Arithmetic< Type >::NA(), and STK::stringNa.
|
inline |
Reads the default file with the specified read flags using a map.
true
if successful, false
if an error is encountered. Definition at line 462 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::file_name_, and STK::TReadWriteCsv< Type >::read().
|
inline |
Reads the specified file with the specified read flags.
file_name | name of the file to read |
true
if successful, false
if an error is encountered. Definition at line 468 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::file_name_, STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::read().
|
inlineprotected |
Read the current line from the buffer.
inBuffer | the input stream to read |
currentLine | the line to read |
listDelimiters | the delimiters between the fields in the current line |
Definition at line 615 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::countFields(), and STK::DManager::removeCharBeforeAndAfter().
Referenced by STK::TReadWriteCsv< Type >::initRead(), and STK::TReadWriteCsv< Type >::readNames().
|
inlineprotected |
Read the names of rhe Csv file.
They are stored in the first line of the file.
inBuffer | the input stream to read |
Definition at line 637 of file STK_ReadWriteCsv.h.
References STK::DManager::getField(), STK::TReadWriteCsv< Type >::nbRows_, STK::TReadWriteCsv< Type >::nbVars_, STK::TReadWriteCsv< Type >::push_back(), and STK::TReadWriteCsv< Type >::readCurrentLine().
Referenced by STK::TReadWriteCsv< Type >::initRead().
|
inline |
resize the container str_data_.
sizeCols | number of columns |
sizeRows | number of rows |
Definition at line 373 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::resizeCols(), STK::TReadWriteCsv< Type >::resizeRows(), STK::TReadWriteCsv< Type >::sizeCols(), and STK::TReadWriteCsv< Type >::sizeRows().
|
inlineprotected |
resize the TReadWriteCsv
to the given range of columns.
cols | the range of columns to set |
Definition at line 702 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::cols(), and STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::resize().
|
inlineprotected |
resize the TReadWriteCsv
to the given range of rows.
rows | the range of the rows |
Definition at line 694 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::lastIdx(), STK::TReadWriteCsv< Type >::rows(), and STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::resize().
|
inline |
Definition at line 234 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::beginRows(), and STK::TReadWriteCsv< Type >::lastIdxRows().
Referenced by STK::TReadWriteCsv< Type >::resizeRows().
|
inline |
Sets the delimiters to use for parsing data (delimiters_ is mutable).
delimiters | delimiters to use |
Definition at line 250 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::delimiters(), and STK::TReadWriteCsv< Type >::delimiters_.
|
inline |
Set mapping to used when reading.
Definition at line 268 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::imapping_.
|
inline |
Sets the with_last_nl_ value for writing a new line after the last line.
with_last_nl | true if we want to write a new line after the last line |
Definition at line 262 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::with_last_nl_.
|
inline |
Set the variable name name
at the specified index.
icol | index of the variable |
name | name of the variable to set |
true
if successful, false
if an error is encountered. Definition at line 278 of file STK_ReadWriteCsv.h.
References STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::str_data_.
|
inline |
Set mapping to used when writting.
Definition at line 271 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::omapping_.
|
inline |
Sets the reserve value for data storage (reserve_ is mutable).
reserve | number of place to reserve |
Definition at line 266 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::reserve_.
Referenced by STK::TReadWriteCsv< Type >::initRead().
|
inline |
Sets the with_mapping_ value for reading/writing variables names.
with_mapping | true if we want to read the data using a map |
Definition at line 258 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::with_mapping_.
|
inline |
Sets the with_names_ value for reading/writing variables names.
with_names | true if we want to read the names of the variables |
Definition at line 254 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::with_names_.
|
inline |
Definition at line 170 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::beginRows(), STK::TReadWriteCsv< Type >::endRows(), STK::TReadWriteCsv< Type >::lastIdxRows(), and STK::TReadWriteCsv< Type >::sizeRows().
|
inline |
Definition at line 179 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::exporter(), and STK::TReadWriteCsv< Type >::resize().
|
inline |
icol | index of the column |
icol
Definition at line 196 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::sizeRows().
|
inline |
Definition at line 216 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::end(), STK::TReadWriteCsv< Type >::size(), and STK::TReadWriteCsv< Type >::sizeRow().
Referenced by STK::TReadWriteCsv< Type >::exporter(), and STK::TReadWriteCsv< Type >::resize().
|
inline |
icol | index of the col |
Definition at line 313 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
|
inline |
j | index of the column |
Definition at line 309 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::str_data_.
Referenced by STK::TReadWriteCsv< Type >::exporter().
|
inline |
Definition at line 246 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::with_names_.
|
inline |
write to the default file with the specified write flags.
true
if successful, false
if an error is encountered. Definition at line 505 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::file_name_, and STK::TReadWriteCsv< Type >::write().
Referenced by STK::TReadWriteCsv< Type >::write().
|
inline |
Write the csv to an output stream.
os | the output stream |
Definition at line 528 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::beginRows(), STK::TReadWriteCsv< Type >::lastIdx(), STK::TReadWriteCsv< Type >::lastIdxRows(), and STK::TReadWriteCsv< Type >::writeSelection().
|
inline |
Attempts to write the TReadWriteCsv to the location specified by file_name using the delimiters specified by delimiters_.
file_name | name of the file to write |
true
if successful, false
if an error is encountered. Definition at line 511 of file STK_ReadWriteCsv.h.
References STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::beginRows(), STK::IRunnerBase::error(), STK::TReadWriteCsv< Type >::file_name_, STK::TReadWriteCsv< Type >::lastIdx(), STK::TReadWriteCsv< Type >::lastIdxRows(), STK::TReadWriteCsv< Type >::msg_error_, and STK::TReadWriteCsv< Type >::writeSelection().
void STK::TReadWriteCsv< Type >::writeSelection | ( | ostream & | os, |
int | top, | ||
int | bottom, | ||
int | left, | ||
int | right | ||
) | const |
Write to output stream a selection based on the coordinates passed (Think of it as highlighting cells in Excel).
os | the output stream |
top | the top index |
bottom | th bottom index |
left | the left index |
right | the right index |
Definition at line 757 of file STK_ReadWriteCsv.h.
References _T, and STK::stringNa.
Referenced by STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
friend |
overload operator << for rw
Definition at line 547 of file STK_ReadWriteCsv.h.
|
friend |
overload operator >> for rw
Definition at line 541 of file STK_ReadWriteCsv.h.
|
mutableprotected |
Delimiter(s)
Definition at line 567 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::clear(), STK::TReadWriteCsv< Type >::countFields(), STK::TReadWriteCsv< Type >::delimiters(), STK::TReadWriteCsv< Type >::operator=(), and STK::TReadWriteCsv< Type >::setDelimiters().
|
mutableprotected |
Name of the Current file read.
Definition at line 559 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::operator=(), STK::TReadWriteCsv< Type >::read(), STK::TReadWriteCsv< Type >::read(), STK::TReadWriteCsv< Type >::read(), STK::TReadWriteCsv< Type >::write(), and STK::TReadWriteCsv< Type >::write().
|
protected |
mapping String -> Type for (input)
Definition at line 575 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::setInMapping().
|
mutableprotected |
Contain the last error message.
Definition at line 571 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::appendData(), STK::TReadWriteCsv< Type >::clear(), STK::TReadWriteCsv< Type >::eraseColumn(), STK::TReadWriteCsv< Type >::error(), STK::TReadWriteCsv< Type >::operator=(), STK::TReadWriteCsv< Type >::push_back(), STK::TReadWriteCsv< Type >::push_front(), STK::TReadWriteCsv< Type >::read(), STK::TReadWriteCsv< Type >::setName(), and STK::TReadWriteCsv< Type >::write().
|
protected |
The number of rows we manage.
Definition at line 581 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::initRead(), STK::TReadWriteCsv< Type >::operator=(), and STK::TReadWriteCsv< Type >::readNames().
|
protected |
The number of variables we manage.
Definition at line 579 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::countFields(), STK::TReadWriteCsv< Type >::initRead(), STK::TReadWriteCsv< Type >::operator=(), and STK::TReadWriteCsv< Type >::readNames().
|
protected |
mapping Type -> String (output)
Definition at line 577 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::setOutMapping().
|
mutableprotected |
Size of the buffer.
Definition at line 569 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::clear(), STK::TReadWriteCsv< Type >::operator=(), and STK::TReadWriteCsv< Type >::setReserve().
|
protected |
Array of array for the data.
Definition at line 573 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::appendData(), STK::TReadWriteCsv< Type >::at(), STK::TReadWriteCsv< Type >::at(), STK::TReadWriteCsv< Type >::back(), STK::TReadWriteCsv< Type >::back(), STK::TReadWriteCsv< Type >::begin(), STK::TReadWriteCsv< Type >::beginCols(), STK::TReadWriteCsv< Type >::clear(), STK::TReadWriteCsv< Type >::clone(), STK::TReadWriteCsv< Type >::cols(), STK::TReadWriteCsv< Type >::end(), STK::TReadWriteCsv< Type >::endCols(), STK::TReadWriteCsv< Type >::endRow(), STK::TReadWriteCsv< Type >::eraseColumn(), STK::TReadWriteCsv< Type >::fastSetData(), STK::TReadWriteCsv< Type >::firstRow(), STK::TReadWriteCsv< Type >::front(), STK::TReadWriteCsv< Type >::front(), STK::TReadWriteCsv< Type >::initRead(), STK::TReadWriteCsv< Type >::lastIdx(), STK::TReadWriteCsv< Type >::lastIdxCols(), STK::TReadWriteCsv< Type >::lastRow(), STK::TReadWriteCsv< Type >::operator()(), STK::TReadWriteCsv< Type >::operator()(), STK::TReadWriteCsv< Type >::operator+=(), STK::TReadWriteCsv< Type >::operator=(), STK::TReadWriteCsv< Type >::operator[](), STK::TReadWriteCsv< Type >::operator[](), STK::TReadWriteCsv< Type >::push_back(), STK::TReadWriteCsv< Type >::push_front(), STK::TReadWriteCsv< Type >::resizeCols(), STK::TReadWriteCsv< Type >::resizeRows(), STK::TReadWriteCsv< Type >::setName(), STK::TReadWriteCsv< Type >::size(), STK::TReadWriteCsv< Type >::sizeCols(), STK::TReadWriteCsv< Type >::sizeRow(), STK::TReadWriteCsv< Type >::var(), and STK::TReadWriteCsv< Type >::var().
|
mutableprotected |
write a new line character at the end of the output
Definition at line 565 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::clear(), and STK::TReadWriteCsv< Type >::setLast_nl().
|
mutableprotected |
map the values stored
Definition at line 563 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::clear(), and STK::TReadWriteCsv< Type >::setWithMapping().
|
mutableprotected |
Read or Write names of the variables.
Definition at line 561 of file STK_ReadWriteCsv.h.
Referenced by STK::TReadWriteCsv< Type >::clear(), STK::TReadWriteCsv< Type >::initRead(), STK::TReadWriteCsv< Type >::operator=(), STK::TReadWriteCsv< Type >::setWithNames(), and STK::TReadWriteCsv< Type >::withNames().