IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.CsvData Class Reference

Memory representation of CSV data. More...

+ Inheritance diagram for IG.Lib.CsvData:
+ Collaboration diagram for IG.Lib.CsvData:

Public Member Functions

 CsvData (bool readOnly)
 Constructs a new string table, a data structure compatible with CSV file format. More...
 
 CsvData ()
 Constructs a new string table, a data structure compatible with CSV file format. More...
 
- Public Member Functions inherited from IG.Lib.StringTable
 StringTable (bool readOnly)
 Constructs a new string table, a data structure compatible with CSV file format. More...
 
 StringTable ()
 Constructs a new string table, a data structure compatible with CSV file format. More...
 
void SetElement (int rowNumber, int columnNumber, string element)
 Sets element at the specified position to the specified value. More...
 
void SetElement< ElementType > (int rowNumber, int columnNumber, ElementType elementValue)
 Sets element at the specified position to the string representation of the specified value. More...
 
ElementType GetElement< ElementType > (int rowNumber, int columnNumber)
 Returns the element of the specified type at the specified position. More...
 
bool TryGetElement< ElementType > (int rowNumber, int columnNumber, ref ElementType elementValue)
 Tries to obtain a value of the specified type at the specified position, and returns a flag indicating whether parsing the value from a string was successful (and the element existed). More...
 
bool IsDefined< ElementType > (int rowNumber, int columnNumber)
 Returns a flag indicating whether the specified position contains a valid string representation of a element of the specified type. More...
 
bool IsDefined (int rowNumber, int columnNumber)
 Returns a flag telling whether the specified element is defined (it exists in the data table) or not. More...
 
bool IsNotNullOrEmpty (int rowNumber, int columnNumber)
 Returns a flag telling whether the specified element is defined (it exists in the data table) and is at the same time not null or empty string. More...
 
string GetElementOrNull (int rowNumber, int columnNumber, out bool isDefined)
 Returns the specified element on the data table or null if that element is not defined, and notifies the caller through isDefined whether the element is defined or not. More...
 
string GetElementOrNull (int rowNumber, int columnNumber)
 Returns the specified element on the data table or null if that element is not defined. More...
 
int FirstNonemptyRow (int startRow)
 Returns index of the first non-empty row from the specified row on (inclusively), or -1 if there is no such row. More...
 
int FirstNonemptyRow ()
 Returns index of the first non-empty row of the table, or -1 if there is no such row. More...
 
int FirstNonemptyColumn (int rowNum, int startColumn)
 Returns number of the first non-empty cell in the specified row, from the specified starting column on (inclusively), or -1 if there is no suuch column. More...
 
int FirstNonemptyColumn (int rowNum)
 Returns number of the first non-empty cell in the specified row. More...
 
void Clear ()
 Clears the data table. More...
 
void AddRow ()
 Adds a new row at the end of the data table. More...
 
void AddRow (params string[] elements)
 Adds a new row at the end of the data table. More...
 
void AddRow< ElementType > (params ElementType[] elements)
 Adds (appends) a new row with the specified elements at the end of the table. More...
 
void AddElement (int rowNum, string value)
 Adds a new element at the end of the specified row of te data table. More...
 
void AddElement (string value)
 Adds (appends) the speecified element at the end of the table, i.e. at the end of the last row. More...
 
void AddElement< ElementType > (int rowNum, ElementType value)
 Adds string representation of a new element of the specified type at the end of the specified row of te data table. More...
 
void AddElement< ElementType > (ElementType value)
 Adds (appends) string representatin of the speecified element at the end of the table, i.e. at the end of the last row. More...
 
void AddElements (int rowNum, params string[] values)
 Adds the specified elements at the end of the specified row of te data table. More...
 
void AddElements< ElementType > (int rowNum, params ElementType[] values)
 Adds string representations of the specified elements of the specified type at the end of the specified row of te data table. More...
 
void AddElements (params string[] values)
 Adds (appends ) the specified elements at the end of the table, i.e. at the end of the last row. More...
 
void AddElements< ElementType > (params ElementType[] values)
 Adds (appends ) string representations of the specified elements of the specified type at the end of the table, i.e. at the end of the last row. More...
 
void SetNumRows (int numRows)
 Change the number of rows in the data table to the specified number. More...
 
void SetNumColumns (int rowNum, int numColumns)
 Changes the number of columns of the specified row to the specified number. More...
 
void ClearRow (int rowNum)
 Clears the specified row in the data table. More...
 
int NumColumns (int rowNum)
 Returns the number of elements (columns) of the specified row. More...
 
bool IsInt (int rowNumber, int columnNumber)
 Returns a flag specified whether the specified element of the data table exists and represents an integer. More...
 
int GetInt (int rowNumber, int columnNumber)
 Returns an integer value of the element at the specified position of the data table, if it is defined, or throws an exception. More...
 
bool TryGetInt (int rowNumber, int columnNumber, out int value)
 Safely gets the integer value at the specified position of the data table, if it is defined, and notifies the caller whether it is defined. More...
 
void GetIntSafe (int rowNumber, int columnNumber, out int value, out bool isElementDefined, out bool isElementNotNullOrEmpty, out bool isInt)
 Safely gets the integer value at the specified position of the data table, if it is defined, and notifies the caller on the status. More...
 
bool IsDouble (int rowNumber, int columnNumber)
 Returns a flag specified whether the specified element of the data table exists and represents a number (of type double). More...
 
double GetDouble (int rowNumber, int columnNumber)
 Returns a double value of the element at the specified position of the data table, if such element is defined and represents a number, or throws an exception otherwise. More...
 
bool TryGetDouble (int rowNumber, int columnNumber, out double value)
 Safely gets the double value at the specified position of the data table, if it is defined, and notifies the caller whether it is defined. More...
 
void GetDoubleSafe (int rowNumber, int columnNumber, out double value, out bool isElementDefined, out bool isElementNotNullOrEmpty, out bool isDouble)
 Safely gets the numerical value (of type double) at the specified position of the data table, if it is defined, and notifies the caller about the status. More...
 
void LoadCsv (string filePath, string separator)
 Loads the specified CSV file. Reads contents of the file into the data table of the current object. More...
 
void LoadCsv (string filePath)
 Loads the specified CSV file. Reads contents of the file into the data table of the current object. More...
 
override string ToString ()
 Converts the current string table to a string in CSV form and returns the string. More...
 
void SaveCsv (string filePath, string separator, bool append)
 Saves the data of the current object to the specified CSV file. More...
 
void SaveCsv (string filePath, string separator)
 Saves the data of the current object into a CSV file. If the file already exists then its contents are overwritten. More...
 
void SaveCsv (string filePath, bool append)
 Saves the data of the current object into a CSV file. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More...
 
void SaveCsv (string filePath)
 Saves the data of the current object values into a CSV file. If the file already exists then its contents are overwritten. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IG.Lib.StringTable
static void ExampleWriteCsv (string filePath)
 Creates a simple string table and saves it to a CSV file. More...
 
- Public Attributes inherited from IG.Lib.StringTable
const string DefaultCsvSeparator = ","
 The default separator in the CSV files - comma (","). More...
 
- Static Public Attributes inherited from IG.Lib.StringTable
static int DefaultOutputLevel = 0
 Dafault output level for object of the StringTable and derived classes. More...
 
- Protected Attributes inherited from IG.Lib.StringTable
readonly object _lock = new object()
 
int _outputLevel = DefaultOutputLevel
 
List< List< string > > _data = new List<List<string>>()
 
bool _isReadOnly = false
 
bool _isAutoExtend = true
 
string _csvSeparator = UtilCsv.CsvSeparator
 
- Properties inherited from IG.Lib.StringTable
object Lock [get]
 Object used for thread locking. More...
 
int OutputLevel [get, set]
 Output level, specifies the level of descriptive output on console during the operation. More...
 
List< List< string > > Data [get]
 Data behind the table - list of lists of strings. More...
 
bool IsReadOnly [get, set]
 Whether or not data table is read only. More...
 
bool IsAutoExtend [get, set]
 Whether or not data storage automatically extends when a value is set on the position that is out of range. More...
 
string this[int rowNumber, int columnNumber] [get, set]
 Index operator, gets or sets the specific element of the data table specified by row and column number. More...
 
string[][] Table [get, set]
 Gets or sets copy of the data table in form of 2D jagged array. More...
 
int NumRows [get]
 Gets number of rows in the data table. More...
 
int MaxNumColumns [get]
 Returns the maximal number of columns in any row. More...
 
bool IsRectangular [get]
 Returns true if data table is rectangular (i.e. all rows have equal number of elements) or not. More...
 
string CsvSeparator [get, set]
 Separator used in CSV files that this class loads data from or writes data to. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Detailed Description

Memory representation of CSV data.

Currently, this is just an exact copy of the StringTable class (it just inherits it=.

Data access operations are thread safe.

$A Igor xx;

Constructor & Destructor Documentation

IG.Lib.CsvData.CsvData ( bool  readOnly)
inline

Constructs a new string table, a data structure compatible with CSV file format.

Parameters
readOnlyWhether the created object is read only or not.
IG.Lib.CsvData.CsvData ( )
inline

Constructs a new string table, a data structure compatible with CSV file format.


The documentation for this class was generated from the following file: