OptionFile Class Reference

#include <OptionFile.h>

Inheritance diagram for OptionFile:

gpsppssync_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 303 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 317 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 335 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 353 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 377 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 402 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 424 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 447 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 512 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 571 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 660 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 631 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 645 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 281 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 700 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:
SourceForge.net Logo