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.
00047 : m_name(name), m_second_name(second_name), m_help_message(help_message), 00048 m_optional(optional), m_value_type(value_type) 00049 { 00050 00051 } // 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.
References m_help_message, m_name, and m_second_name.
00087 { 00088 std::string result(m_name); 00089 00090 if ( !m_second_name.empty() ) 00091 result += ", " + m_second_name; 00092 00093 return result + "\t" + m_help_message; 00094 } // 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.
00070 { 00071 std::string result(m_name); 00072 00073 if (!m_value_type.empty()) 00074 result += "=" + m_value_type; 00075 00076 if (m_optional) 00077 return "[" + result + "]"; 00078 else 00079 return result; 00080 } // 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.
References m_name.
00101 { 00102 return m_name; 00103 } // 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.
References m_second_name.
00111 { 00112 return m_second_name; 00113 } // 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.
References m_optional.
00120 { 00121 return m_optional; 00122 } // 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.
00060 { 00061 return m_name < that.m_name; 00062 } // 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.
Referenced by format_long_help().
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_long_help(), format_short_help(), and get_name().
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(), and is_optional().
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.
Referenced by format_long_help(), and get_second_name().
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().