OptionFile Class Reference

#include <OptionFile.h>

Inheritance diagram for OptionFile:

namespace_Plot2D::Plot2D_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.

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 58 of file OptionFile.cpp.

OptionFile::OptionFile (  ) 

The default constructor.

Definition at line 67 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 73 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 273 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 287 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 305 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 323 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 347 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 372 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 394 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 417 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 482 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 541 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 630 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 601 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 615 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.

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

Returns:
true if file exists

Definition at line 250 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 670 of file OptionFile.cpp.


Field Documentation

stOption* OptionFile::m_Options [protected]

The array of options.

Definition at line 171 of file OptionFile.h.

unsigned OptionFile::m_nrOptions [protected]

The number of valid options.

Definition at line 174 of file OptionFile.h.

std::string OptionFile::m_OptionFilePathUsed [protected]

The path to the option file.

Definition at line 177 of file OptionFile.h.


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