Confdump Agent  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Confdump::System::FixedTable Class Reference

Parses a fixed-width text table into a Result. More...

#include <FixedTable.hpp>

List of all members.

Classes

class  Specification
 Helper class to configure the parsing. More...

Public Types

enum  ParsingMode { DetectWidthsFromHeader, UseSpecifiedHeaders }
enum  Platform { Windows, Linux }

Public Member Functions

 FixedTable ()
 ~FixedTable ()
template<class ElementT >
void readAllInto (QByteArray byteArray, std::vector< boost::shared_ptr< ElementT > > &elements)
 Parse data from a stream.
void setFieldTranslations (const std::map< std::string, std::string > &translations)
 Rename fields on the fly.
void setSpecification (const Specification &spec)
 Provide important configuration options to the parser.

Private Member Functions

void readHeaderFrom (const QString Headers)
bool readLineFrom (const QString line, boost::shared_ptr< ManagedElement > element)
void detectColumnPositionsFromLine (const std::string &line)
void checkColumnPositionsFromSpecification (const std::string &line)
void splitLineOnColumnPositions (const std::string &line, std::vector< std::string > &columns)

Private Attributes

std::vector< std::string > header_
std::vector
< std::string::size_type > 
columnPositions_
Specification specification_
std::map< std::string,
std::string > 
fieldTranslations_

Detailed Description

Parses a fixed-width text table into a Result.

A FixedTable is filled from an input stream containing fixed-width fields and returns this data as a Result. The fields' widths is determined automatically based on the first line of input, which is expected to contain the name of the fields, like this:

 Field1  OtherField2  AnotherField3
 data    data         data
 data    data         data

Definition at line 52 of file FixedTable.hpp.


Member Enumeration Documentation

Enumerator:
DetectWidthsFromHeader 
UseSpecifiedHeaders 

Definition at line 55 of file FixedTable.hpp.

Enumerator:
Windows 
Linux 

Definition at line 61 of file FixedTable.hpp.


Constructor & Destructor Documentation

Definition at line 45 of file FixedTable.cpp.

Definition at line 49 of file FixedTable.cpp.


Member Function Documentation

void Confdump::System::FixedTable::checkColumnPositionsFromSpecification ( const std::string &  line) [private]
void Confdump::System::FixedTable::detectColumnPositionsFromLine ( const std::string &  line) [private]

Definition at line 91 of file FixedTable.cpp.

References columnPositions_.

Referenced by readHeaderFrom().

template<class ElementT >
void Confdump::System::FixedTable::readAllInto ( QByteArray  byteArray,
std::vector< boost::shared_ptr< ElementT > > &  elements 
)
void Confdump::System::FixedTable::readHeaderFrom ( const QString  Headers) [private]
bool Confdump::System::FixedTable::readLineFrom ( const QString  line,
boost::shared_ptr< ManagedElement element 
) [private]

Definition at line 70 of file FixedTable.cpp.

References fieldTranslations_, header_, and splitLineOnColumnPositions().

Referenced by readAllInto().

void Confdump::System::FixedTable::setFieldTranslations ( const std::map< std::string, std::string > &  translations)

Rename fields on the fly.

Definition at line 177 of file FixedTable.cpp.

References fieldTranslations_.

Provide important configuration options to the parser.

Definition at line 172 of file FixedTable.cpp.

References specification_.

void Confdump::System::FixedTable::splitLineOnColumnPositions ( const std::string &  line,
std::vector< std::string > &  columns 
) [private]

Definition at line 156 of file FixedTable.cpp.

References columnPositions_.

Referenced by readHeaderFrom(), and readLineFrom().


Member Data Documentation

std::vector<std::string::size_type> Confdump::System::FixedTable::columnPositions_ [private]
std::map<std::string, std::string> Confdump::System::FixedTable::fieldTranslations_ [private]

Definition at line 122 of file FixedTable.hpp.

Referenced by readLineFrom(), and setFieldTranslations().

std::vector<std::string> Confdump::System::FixedTable::header_ [private]

Definition at line 119 of file FixedTable.hpp.

Referenced by readHeaderFrom(), and readLineFrom().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends