Google

Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

LeoArg Class Reference

#include <LeoArg.hh>

List of all members.

Public Types

typedef list<std::string> ArgList
 arg list type.

typedef list<std::string>::iterator ArgListIt
 arg list type iterator.

typedef std::list<OptionOptionList
 Option list type.

typedef OptionList::iterator OptionListIt
 Option list iterator.


Public Methods

 LeoArg ( int argc, char **argv, std::string long_option_switch = "--", std::string short_option_switch = "-" )
 LeoArg ( Setting& setting )
 initialize with a filled setting structure.

void short_option_string ( bool short_os )
 enable/disable the short option string.

bool short_option_string () const
 returns true if short option string parsing is enabled.

Setting get_setting () const
 returns the current setting.

bool has_parameters () const
 true if any optin or parameter is set.

bool get_option ( Option& option )
 returns a specific option.

bool get_first ( std::string& ret_value ) const
 eg.: "./cmd hello --file a_file another_file" the function will return "hello".

bool get_first ( ArgList& arglist ) const
 eg.: "./cmd hello world --file a_file another_file" the function will fill the ArgList with "hello" and "world".

bool get_last ( std::string & ret_value ) const
 eg.: "./cmd --file a_file another_file" the function will return "another_file".

bool get_last ( ArgList& arglist ) const
 eg.: "./cmd --file a_file another_file" the function will fill the ArgList with "a_file" and "another_file".

std::string get_prog_name () const
void clear_cache ()
 clear the cache.


Private Methods

bool parse_option ( Option& option ) const
void correct_option ( Option& option ) const
void correct_setting ()
bool find_option ( Option& option ) const
 function searches in cache for the specific option.

bool is_in_sos ( const Option& option ) const
 checks if an option is in the short option string.

int has_sos () const
 finds a short option string. More...


Private Attributes

Setting setting
 the setting.


Detailed Description

Examples:

leoargmain.cpp.


Member Typedef Documentation

typedef list<std::string> LeoArg::ArgList
 

arg list type.

typedef list<std::string>::iterator LeoArg::ArgListIt
 

arg list type iterator.

typedef std::list<Option> LeoArg::OptionList
 

Option list type.

typedef OptionList::iterator LeoArg::OptionListIt
 

Option list iterator.


Constructor & Destructor Documentation

LeoArg::LeoArg ( int argc,
char ** argv,
std::string long_option_switch = "--",
std::string short_option_switch = "-" )
 

LeoArg::LeoArg ( Setting & setting )
 

initialize with a filled setting structure.


Member Function Documentation

void LeoArg::clear_cache ( ) [inline]
 

clear the cache.

void LeoArg::correct_option ( Option & option ) const [private]
 

void LeoArg::correct_setting ( ) [private]
 

bool LeoArg::find_option ( Option & option ) const [private]
 

function searches in cache for the specific option.

bool LeoArg::get_first ( ArgList & arglist ) const
 

eg.: "./cmd hello world --file a_file another_file" the function will fill the ArgList with "hello" and "world".

bool LeoArg::get_first ( std::string & ret_value ) const
 

eg.: "./cmd hello --file a_file another_file" the function will return "hello".

Examples:
leoargmain.cpp.

bool LeoArg::get_last ( ArgList & arglist ) const
 

eg.: "./cmd --file a_file another_file" the function will fill the ArgList with "a_file" and "another_file".

bool LeoArg::get_last ( std::string & ret_value ) const
 

eg.: "./cmd --file a_file another_file" the function will return "another_file".

Examples:
leoargmain.cpp.

bool LeoArg::get_option ( Option & option )
 

returns a specific option.

Examples:
leoargmain.cpp.

std::string LeoArg::get_prog_name ( ) const [inline]
 

Setting LeoArg::get_setting ( ) const [inline]
 

returns the current setting.

bool LeoArg::has_parameters ( ) const [inline]
 

true if any optin or parameter is set.

Examples:
leoargmain.cpp.

int LeoArg::has_sos ( ) const [private]
 

finds a short option string.

If no sos was found it returns zero

bool LeoArg::is_in_sos ( const Option & option ) const [private]
 

checks if an option is in the short option string.

bool LeoArg::parse_option ( Option & option ) const [private]
 

bool LeoArg::short_option_string ( ) const [inline]
 

returns true if short option string parsing is enabled.

Examples:
leoargmain.cpp.

void LeoArg::short_option_string ( bool short_os ) [inline]
 

enable/disable the short option string.


Member Data Documentation

Setting LeoArg::setting [private]
 

the setting.


The documentation for this class was generated from the following files:
LeoArg (C) under the terms of the GPL by King Leo (Martin Oberzalek)
Documentation created by Doxygen 1.2.2