|
CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
This class manage the description of an argument. More...
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. | |
This class manage the description of an argument.
Definition at line 55 of file arguments_table.hpp.
| 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.
| name | The principal name of the argument. |
| second_name | The second name of the argument. |
| help_message | Message describing the role of the argument. |
| optional | Tell if this argument is optional. |
| value_type | The 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()
| 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<()
const std::string claw::arguments_table::argument_attributes::m_help_message [private] |
Message describing the argument.
Definition at line 81 of file arguments_table.hpp.
const std::string claw::arguments_table::argument_attributes::m_name [private] |
The principal name of the argument.
Definition at line 75 of file arguments_table.hpp.
Referenced by format_short_help().
const bool claw::arguments_table::argument_attributes::m_optional [private] |
Tell if the argument is optional.
Definition at line 84 of file arguments_table.hpp.
Referenced by format_short_help().
const std::string claw::arguments_table::argument_attributes::m_second_name [private] |
The second name of the argument.
Definition at line 78 of file arguments_table.hpp.
const std::string claw::arguments_table::argument_attributes::m_value_type [private] |
The type of the value needed by this argument.
Definition at line 87 of file arguments_table.hpp.
Referenced by format_short_help().
1.7.3