OptionFile Class Reference

#include <optionfile.h>

Inheritance diagram for OptionFile:

GNSS::GNSS_OptionFile

Detailed Description

A class for handling option files. ';' delimits a comment to follow.
The general format is:
field, comment = value ; comment
.

Definition at line 54 of file optionfile.h.


Public Member Functions

virtual ~OptionFile ()
 OptionFile destructor.
 OptionFile ()
 The default constructor.
 OptionFile (OptionFile &rhs)
 The disabled copy constructor.
bool ReadOptionFile (const std::string OptionFilePath)
 Reads in the options.
bool GetValue (const std::string Field, std::string &Value)
 Get data from a field.
bool GetValue (const std::string Field, double &value)
 Get data from a field.
bool GetValue (const std::string Field, float &value)
 Get data from a field.
bool GetValue (const std::string Field, short &value)
 Get data from a field.
bool GetValue (const std::string Field, unsigned short &value)
 Get data from a field.
bool GetValue (const std::string Field, int &value)
 Get data from a field.
bool GetValue (const std::string Field, unsigned int &value)
 Get data from a field.
bool GetValue (const std::string Field, bool &value)
 Get data from a field.
bool GetValueArray (const std::string Field, int *intArray, const unsigned maxItems, unsigned &nrItems)
 Get an array of integers up to a maximum number of items.
bool GetValueArray (const std::string Field, double *dArray, const unsigned maxItems, unsigned &nrItems)
 Get an array of double up to a maximum number of items.
bool GetDMSValue (const std::string Field, double &dms)
 Get a double value in degress from a Degree Minutes Seconds value.
bool GetComment (const std::string Field, std::string &Comment)
 Get the comment for the field specified.
bool GetPostValueComment (const std::string Field, std::string &PostValueComment)
 Get the comment for the field specified present after the VALUE field. i.e. FIELD, COMMENT = VALUE ; POST-VALUE-COMMENT.
unsigned GetNumberOfOptions ()
 Get the number of options available.
const OptionFileoperator= (const OptionFile &src)
 Disabled operator= overload.

Protected Member Functions

bool DoesFileExist (const std::string &OptionFilePath)
 
Returns:
true if file exists

bool FindField (const std::string &Field, std::string &Comment, std::string &Value, std::string &PostValueComment)
 
Returns:
true if the find was successful, and the data was set


Protected Attributes

stOption * m_Options
 The array of options.
unsigned m_nrOptions
 The number of valid options.
std::string m_OptionFilePathUsed
 The path to the option file.

Constructor & Destructor Documentation

OptionFile::~OptionFile (  )  [virtual]

OptionFile destructor.

Definition at line 55 of file OptionFile.cpp.

OptionFile::OptionFile (  ) 

The default constructor.

Definition at line 64 of file OptionFile.cpp.

OptionFile::OptionFile ( OptionFile rhs  )  [inline]

The disabled copy constructor.

Definition at line 76 of file optionfile.h.


Member Function Documentation

bool OptionFile::ReadOptionFile ( const std::string  OptionFilePath  ) 

Reads in the options.

Returns:
true if successful, false otherwise

Definition at line 70 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
std::string &  Value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 268 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
double &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 282 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
float &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 300 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
short &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 318 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
unsigned short &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 342 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
int &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 367 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
unsigned int &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 389 of file OptionFile.cpp.

bool OptionFile::GetValue ( const std::string  Field,
bool &  value 
)

Get data from a field.

Returns:
true if successful, false otherwise.

Definition at line 412 of file OptionFile.cpp.

bool OptionFile::GetValueArray ( const std::string  Field,
int *  intArray,
const unsigned  maxItems,
unsigned &  nrItems 
)

Get an array of integers up to a maximum number of items.

Returns:
true if successful, false otherwise.
Parameters:
Field  The field identifier
intArray  The pointer to the integer array.
maxItems  The maximum number of elements in the array.
nrItems  The number of valid items read into the array.

Definition at line 477 of file OptionFile.cpp.

bool OptionFile::GetValueArray ( const std::string  Field,
double *  dArray,
const unsigned  maxItems,
unsigned &  nrItems 
)

Get an array of double up to a maximum number of items.

Returns:
true if successful, false otherwise.
Parameters:
Field  The field identifier
dArray  The pointer to the integer array.
maxItems  The maximum number of elements in the array.
nrItems  The number of valid items read into the array.

Definition at line 536 of file OptionFile.cpp.

bool OptionFile::GetDMSValue ( const std::string  Field,
double &  dms 
)

Get a double value in degress from a Degree Minutes Seconds value.

Definition at line 625 of file OptionFile.cpp.

bool OptionFile::GetComment ( const std::string  Field,
std::string &  Comment 
)

Get the comment for the field specified.

Returns:
true if successful, false otherwise.

Definition at line 596 of file OptionFile.cpp.

bool OptionFile::GetPostValueComment ( const std::string  Field,
std::string &  PostValueComment 
)

Get the comment for the field specified present after the VALUE field. i.e. FIELD, COMMENT = VALUE ; POST-VALUE-COMMENT.

Returns:
true if successful, false otherwise.

Definition at line 610 of file OptionFile.cpp.

unsigned OptionFile::GetNumberOfOptions (  )  [inline]

Get the number of options available.

Returns:
The number of options.

Definition at line 149 of file optionfile.h.

const OptionFile& OptionFile::operator= ( const OptionFile src  )  [inline]

Disabled operator= overload.

Definition at line 154 of file optionfile.h.

bool OptionFile::DoesFileExist ( const std::string &  OptionFilePath  )  [protected]

Returns:
true if file exists

Definition at line 246 of file OptionFile.cpp.

bool OptionFile::FindField ( const std::string &  Field,
std::string &  Comment,
std::string &  Value,
std::string &  PostValueComment 
) [protected]

Returns:
true if the find was successful, and the data was set

Definition at line 665 of file OptionFile.cpp.


Field Documentation

stOption* OptionFile::m_Options [protected]

The array of options.

Definition at line 172 of file optionfile.h.

unsigned OptionFile::m_nrOptions [protected]

The number of valid options.

Definition at line 175 of file optionfile.h.

std::string OptionFile::m_OptionFilePathUsed [protected]

The path to the option file.

Definition at line 178 of file optionfile.h.


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