VoiceMan
Public Member Functions
DelimitedFile Class Reference

The class to parse file with colon-delimited lines. More...

List of all members.

Public Member Functions

std::string getItem (size_t lineIndex, size_t itemIndex) const
 Returns the required delimited item in required line.
size_t getItemCountInLine (size_t index) const
 Returns the number of delimited items in specified line.
size_t getLineCount () const
 The number of non-empty and non-commented lines read from source file.
std::string getRawLine (size_t index) const
 Returns text file line without any translations.
void read (const std::string &fileName)
 Reads and stores data from file.

Detailed Description

VoiceMan daemon uses set of data tables stored in colon-delimited files. Each line in these files contains some items, delimited by ":" character. This class parses colon-delimited files and extracts stored data.


Member Function Documentation

std::string DelimitedFile::getItem ( size_t  lineIndex,
size_t  itemIndex 
) const

Use this method to get colon-delimited item in line.

Parameters:
[in]lineIndexThe desired index of line
[in]itemIndexThe number of desired item in specified line
Returns:
The requested colon-delimited item
size_t DelimitedFile::getItemCountInLine ( size_t  index) const

Use this method to get number of items in specified line.

Parameters:
[in]indexThe number of a line to count items in
Returns:
Number of items in specified line
size_t DelimitedFile::getLineCount ( ) const

Use this method to get number of accessible lines.

Returns:
Number of parsed lines
std::string DelimitedFile::getRawLine ( size_t  index) const

Use this method to get line as it is stored in lines vector.

Parameters:
[in]indexThe index of a line to return
Returns:
Requested line without any processing (but without comments)
void DelimitedFile::read ( const std::string &  fileName)

This method can be called multiple times to read sequentially more than one file. Results of previous operation are silently cleaned.

Parameters:
[in]fileNameThe name of a file to read data from