Public Member Functions | Private Attributes

claw::arguments_table::argument_attributes Class Reference

This class manage the description of an argument. More...

List of all members.

Public Member Functions

 argument_attributes (const std::string &name, const std::string &second_name, const std::string &help_message, bool optional, const std::string &value_type)
 Constructor.
bool operator< (const argument_attributes &that) const
 Tell if the principal name of this argument is alphabetically less than the name of an other argument.
std::string format_short_help () const
 Get a short description of the arguement.
std::string format_long_help () const
 Get a long description of the argument.
const std::string & get_name () const
 Get the principal name of the argument.
const std::string & get_second_name () const
 Get the second name of the argument.
bool is_optional () const
 Tell if the argument is optional.

Private Attributes

const std::string m_name
 The principal name of the argument.
const std::string m_second_name
 The second name of the argument.
const std::string m_help_message
 Message describing the argument.
const bool m_optional
 Tell if the argument is optional.
const std::string m_value_type
 The type of the value needed by this argument.

Detailed Description

This class manage the description of an argument.

Author:
Julien Jorge.

Definition at line 55 of file arguments_table.hpp.


Constructor & Destructor Documentation

claw::arguments_table::argument_attributes::argument_attributes ( const std::string &  name,
const std::string &  second_name,
const std::string &  help_message,
bool  optional,
const std::string &  value_type 
)

Constructor.

Parameters:
nameThe principal name of the argument.
second_nameThe second name of the argument.
help_messageMessage describing the role of the argument.
optionalTell if this argument is optional.
value_typeThe kind of value needed for this argument.

Definition at line 44 of file arguments_table.cpp.

  : m_name(name), m_second_name(second_name), m_help_message(help_message),
    m_optional(optional), m_value_type(value_type)
{

} // arguments_table::argument_attributes::argument_attributes()

Member Function Documentation

std::string claw::arguments_table::argument_attributes::format_long_help (  ) const

Get a long description of the argument.

Definition at line 86 of file arguments_table.cpp.

{
  std::string result(m_name);

  if ( !m_second_name.empty() )
    result += ", " + m_second_name;

  return result + "\t" + m_help_message;
} // arguments_table::argument_attributes::format_long_help()
std::string claw::arguments_table::argument_attributes::format_short_help (  ) const

Get a short description of the arguement.

Definition at line 69 of file arguments_table.cpp.

References m_name, m_optional, and m_value_type.

{
  std::string result(m_name);

  if (!m_value_type.empty())
    result += "=" + m_value_type;

  if (m_optional)
    return "[" + result + "]";
  else
    return result;
} // arguments_table::argument_attributes::format_short_help()
const std::string & claw::arguments_table::argument_attributes::get_name (  ) const

Get the principal name of the argument.

Definition at line 100 of file arguments_table.cpp.

{
  return m_name;
} // arguments_table::argument_attributes::get_name()
const std::string & claw::arguments_table::argument_attributes::get_second_name (  ) const

Get the second name of the argument.

Definition at line 110 of file arguments_table.cpp.

{
  return m_second_name;
} // arguments_table::argument_attributes::get_second_name()
bool claw::arguments_table::argument_attributes::is_optional (  ) const

Tell if the argument is optional.

Definition at line 119 of file arguments_table.cpp.

{
  return m_optional;
} // arguments_table::argument_attributes::is_optional()
bool claw::arguments_table::argument_attributes::operator< ( const argument_attributes that ) const

Tell if the principal name of this argument is alphabetically less than the name of an other argument.

Definition at line 59 of file arguments_table.cpp.

{
  return m_name < that.m_name;
} // arguments_table::argument_attributes::operator<()

Member Data Documentation

Message describing the argument.

Definition at line 81 of file arguments_table.hpp.

The principal name of the argument.

Definition at line 75 of file arguments_table.hpp.

Referenced by format_short_help().

Tell if the argument is optional.

Definition at line 84 of file arguments_table.hpp.

Referenced by format_short_help().

The second name of the argument.

Definition at line 78 of file arguments_table.hpp.

The type of the value needed by this argument.

Definition at line 87 of file arguments_table.hpp.

Referenced by format_short_help().


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