Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

OptionParams Class Reference

Inheritance diagram for OptionParams:

Inheritance graph
[legend]
Collaboration diagram for OptionParams:

Collaboration graph
[legend]

Detailed Description

Describe command line params.

Definition at line 14 of file OptionParams.h.

Public Types

enum  eType { TYPE_NUMBER, TYPE_BOOLEAN, TYPE_STRING, TYPE_PATH }

Public Member Functions

 OptionParams ()
void addParam (const std::string &name, eType type, const std::string &help)
std::string getHelp (const Environ *options) const
std::string getConfig (const Environ *options) const

Data Structures

struct  Param


Member Enumeration Documentation

enum OptionParams::eType
 

Enumeration values:
TYPE_NUMBER 
TYPE_BOOLEAN 
TYPE_STRING 
TYPE_PATH 

Definition at line 16 of file OptionParams.h.

00016                    {
00017             TYPE_NUMBER,
00018             TYPE_BOOLEAN,
00019             TYPE_STRING,
00020             TYPE_PATH
00021         };


Constructor & Destructor Documentation

OptionParams::OptionParams  )  [inline]
 

Definition at line 35 of file OptionParams.h.

00035 { m_maxSize = 0; }


Member Function Documentation

void OptionParams::addParam const std::string &  name,
eType  type,
const std::string &  help
 

Definition at line 16 of file OptionParams.cpp.

00018 {
00019     Param param(type, help);
00020     m_params.insert(
00021                 std::pair<std::string,Param>(name, param));
00022     int paramSize = name.size() + getType(type).size();
00023     if (paramSize > m_maxSize) {
00024         m_maxSize = paramSize;
00025     }
00026 }

std::string OptionParams::getConfig const Environ options  )  const
 

Definition at line 43 of file OptionParams.cpp.

00044 {
00045     std::string config;
00046     t_params::const_iterator end = m_params.end();
00047     for (t_params::const_iterator i = m_params.begin(); i != end; ++i) {
00048         config += i->first + "='" + options->getParam(i->first) + "'\n";
00049     }
00050     return config;
00051 }

std::string OptionParams::getHelp const Environ options  )  const
 

Definition at line 29 of file OptionParams.cpp.

00030 {
00031     std::string help;
00032     t_params::const_iterator end = m_params.end();
00033     for (t_params::const_iterator i = m_params.begin(); i != end; ++i) {
00034         int paramSize = i->first.size() + getType(i->second.type).size();
00035         std::string space = std::string(m_maxSize - paramSize, ' ');
00036         help += "  " + i->first + "=<" + getType(i->second.type) + ">";
00037         help += space + "    " + i->second.help + "\n";
00038     }
00039     return help;
00040 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:56:06 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2