Main Page | Class List | File List | Class Members | File Members

ProgramOption Class Reference

Contains one program option and its value. More...

#include <ProgramOptions.h>

List of all members.

Protected Types

enum  OptionType { opt_boolean, opt_string, opt_long }

Protected Member Functions

 ProgramOption (char cShortOption, const char *pszLongOption, OptionType type, bool bHasParameter)
bool IsOption (char c) const
 Returns true if character is this option.
bool IsOption (const char *psz) const
 Returns true if string is this option.
bool IsDefined () const
char GetShortOption () const
const std::string & GetLongOption () const
bool HasParameter () const
bool HasShortOption () const
bool HasLongOption () const
bool IsCaseSensitive () const
 Return true if short option is case sensitive.
const std::string & GetHelpText () const
const std::string & GetParameterHint () const
OptionType GetType () const
bool GetBoolValue () const
void SetBoolValue ()
long GetLongValue () const
bool SetLongValue (long l)
 Sets long value if within limits and returns true.
const std::string & GetStringValue () const
void SetStringValue (const char *psz)
long GetLongValueMin () const
long GetLongValueMax () const

Protected Attributes

char m_cShortOption
std::string m_sLongOption
bool m_bDefined
bool m_bCaseSensitive
bool m_bHasParameter
std::string m_sParameterHint
std::string m_sHelpText
OptionType m_type
bool m_bValue
long m_lValue
long m_lMinValue
long m_lMaxValue
std::string m_sValue

Friends

class ProgramOptions
std::ostream & operator<< (std::ostream &, const ProgramOption &)


Detailed Description

Contains one program option and its value.

Constructor is protected and objects can only be created with ProgramOptions::AddBoolean, ProgramOptions::AddString or ProgramOptions::AddLong.

Definition at line 20 of file ProgramOptions.h.


Member Enumeration Documentation

enum ProgramOption::OptionType [protected]
 

Enumerator:
opt_boolean 
opt_string 
opt_long 

Definition at line 23 of file ProgramOptions.h.


Constructor & Destructor Documentation

ProgramOption::ProgramOption char  cShortOption,
const char *  pszLongOption,
OptionType  type,
bool  bHasParameter
[inline, protected]
 

Definition at line 25 of file ProgramOptions.h.

References m_bDefined, m_bHasParameter, m_bValue, m_cShortOption, m_lMaxValue, m_lMinValue, m_lValue, m_sLongOption, m_type, and safe_assign().

Here is the call graph for this function:


Member Function Documentation

bool ProgramOption::GetBoolValue  )  const [inline, protected]
 

Definition at line 64 of file ProgramOptions.h.

References m_bValue.

Referenced by ProgramOptions::GetBoolValue(), and operator<<().

const std::string& ProgramOption::GetHelpText  )  const [inline, protected]
 

Definition at line 60 of file ProgramOptions.h.

References m_sHelpText.

Referenced by ProgramOptions::PrintHelp().

const std::string& ProgramOption::GetLongOption  )  const [inline, protected]
 

Definition at line 54 of file ProgramOptions.h.

References m_sLongOption.

Referenced by IsOption(), operator<<(), and ProgramOptions::PrintHelp().

long ProgramOption::GetLongValue  )  const [inline, protected]
 

Definition at line 69 of file ProgramOptions.h.

References m_lValue.

Referenced by ProgramOptions::GetLongValue(), and operator<<().

long ProgramOption::GetLongValueMax  )  const [inline, protected]
 

Definition at line 88 of file ProgramOptions.h.

References m_lMaxValue.

Referenced by operator<<(), and SetLongValue().

long ProgramOption::GetLongValueMin  )  const [inline, protected]
 

Definition at line 87 of file ProgramOptions.h.

References m_lMinValue.

Referenced by operator<<(), and SetLongValue().

const std::string& ProgramOption::GetParameterHint  )  const [inline, protected]
 

Definition at line 61 of file ProgramOptions.h.

References m_sParameterHint.

Referenced by ProgramOptions::PrintHelp().

char ProgramOption::GetShortOption  )  const [inline, protected]
 

Definition at line 53 of file ProgramOptions.h.

References m_cShortOption.

Referenced by IsOption(), operator<<(), and ProgramOptions::PrintHelp().

const std::string& ProgramOption::GetStringValue  )  const [inline, protected]
 

Definition at line 80 of file ProgramOptions.h.

References m_sValue.

Referenced by ProgramOptions::GetStringValue(), and operator<<().

OptionType ProgramOption::GetType  )  const [inline, protected]
 

Definition at line 62 of file ProgramOptions.h.

References m_type.

Referenced by operator<<(), and ProgramOptions::Parse().

bool ProgramOption::HasLongOption  )  const [inline, protected]
 

Definition at line 57 of file ProgramOptions.h.

References m_sLongOption.

Referenced by ProgramOptions::PrintHelp().

bool ProgramOption::HasParameter  )  const [inline, protected]
 

Definition at line 55 of file ProgramOptions.h.

References m_bHasParameter.

Referenced by ProgramOptions::Parse(), and ProgramOptions::PrintHelp().

bool ProgramOption::HasShortOption  )  const [inline, protected]
 

Definition at line 56 of file ProgramOptions.h.

References m_cShortOption.

Referenced by ProgramOptions::PrintHelp().

bool ProgramOption::IsCaseSensitive  )  const [inline, protected]
 

Return true if short option is case sensitive.

Definition at line 59 of file ProgramOptions.h.

References m_bCaseSensitive.

Referenced by IsOption(), and operator<<().

bool ProgramOption::IsDefined  )  const [inline, protected]
 

Definition at line 52 of file ProgramOptions.h.

References m_bDefined.

Referenced by operator<<().

bool ProgramOption::IsOption const char *  psz  )  const [inline, protected]
 

Returns true if string is this option.

Definition at line 47 of file ProgramOptions.h.

References GetLongOption().

Here is the call graph for this function:

bool ProgramOption::IsOption char  c  )  const [inline, protected]
 

Returns true if character is this option.

Definition at line 39 of file ProgramOptions.h.

References GetShortOption(), and IsCaseSensitive().

Referenced by ProgramOptions::GetOption().

Here is the call graph for this function:

void ProgramOption::SetBoolValue  )  [inline, protected]
 

Definition at line 65 of file ProgramOptions.h.

References m_bDefined, and m_bValue.

Referenced by ProgramOptions::Parse().

bool ProgramOption::SetLongValue long  l  )  [inline, protected]
 

Sets long value if within limits and returns true.

Otherwize false is returned

Definition at line 71 of file ProgramOptions.h.

References GetLongValueMax(), GetLongValueMin(), m_bDefined, and m_lValue.

Referenced by ProgramOptions::Parse().

Here is the call graph for this function:

void ProgramOption::SetStringValue const char *  psz  )  [inline, protected]
 

Definition at line 81 of file ProgramOptions.h.

References m_bDefined, m_sValue, and safe_assign().

Referenced by ProgramOptions::Parse().

Here is the call graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const ProgramOption po
[friend]
 

Definition at line 8 of file ProgramOptions.cpp.

friend class ProgramOptions [friend]
 

Definition at line 105 of file ProgramOptions.h.


Member Data Documentation

bool ProgramOption::m_bCaseSensitive [protected]
 

Definition at line 93 of file ProgramOptions.h.

Referenced by ProgramOptions::AddBoolean(), ProgramOptions::AddLong(), ProgramOptions::AddString(), and IsCaseSensitive().

bool ProgramOption::m_bDefined [protected]
 

Definition at line 92 of file ProgramOptions.h.

Referenced by IsDefined(), ProgramOption(), SetBoolValue(), SetLongValue(), and SetStringValue().

bool ProgramOption::m_bHasParameter [protected]
 

Definition at line 94 of file ProgramOptions.h.

Referenced by HasParameter(), and ProgramOption().

bool ProgramOption::m_bValue [protected]
 

Definition at line 99 of file ProgramOptions.h.

Referenced by ProgramOptions::AddBoolean(), GetBoolValue(), ProgramOption(), and SetBoolValue().

char ProgramOption::m_cShortOption [protected]
 

Definition at line 90 of file ProgramOptions.h.

Referenced by GetShortOption(), HasShortOption(), and ProgramOption().

long ProgramOption::m_lMaxValue [protected]
 

Definition at line 102 of file ProgramOptions.h.

Referenced by ProgramOptions::AddLong(), GetLongValueMax(), and ProgramOption().

long ProgramOption::m_lMinValue [protected]
 

Definition at line 101 of file ProgramOptions.h.

Referenced by ProgramOptions::AddLong(), GetLongValueMin(), and ProgramOption().

long ProgramOption::m_lValue [protected]
 

Definition at line 100 of file ProgramOptions.h.

Referenced by ProgramOptions::AddLong(), GetLongValue(), ProgramOption(), and SetLongValue().

std::string ProgramOption::m_sHelpText [protected]
 

Definition at line 96 of file ProgramOptions.h.

Referenced by ProgramOptions::AddBoolean(), ProgramOptions::AddLong(), ProgramOptions::AddString(), and GetHelpText().

std::string ProgramOption::m_sLongOption [protected]
 

Definition at line 91 of file ProgramOptions.h.

Referenced by GetLongOption(), HasLongOption(), and ProgramOption().

std::string ProgramOption::m_sParameterHint [protected]
 

Definition at line 95 of file ProgramOptions.h.

Referenced by ProgramOptions::AddLong(), ProgramOptions::AddString(), and GetParameterHint().

std::string ProgramOption::m_sValue [protected]
 

Definition at line 103 of file ProgramOptions.h.

Referenced by ProgramOptions::AddString(), GetStringValue(), and SetStringValue().

OptionType ProgramOption::m_type [protected]
 

Definition at line 97 of file ProgramOptions.h.

Referenced by GetType(), and ProgramOption().


The documentation for this class was generated from the following file:
Generated on Sun Jun 26 13:44:08 2005 for pingem by  doxygen 1.4.3