Kaydet (Commit) c8989e15 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Cleanup/remove CommandLine-related methods in lngconvex.

üst 57cf0267
...@@ -40,10 +40,9 @@ ...@@ -40,10 +40,9 @@
// Creation // Creation
CommandLine::CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix) : CommandLine::CommandLine(size_t argc, char* argv[]) :
m_argc(argc), m_argc(argc),
m_argv(argv), m_argv(argv)
m_argprefix(ArgPrefix)
{ {
} }
...@@ -51,57 +50,6 @@ CommandLine::CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix ...@@ -51,57 +50,6 @@ CommandLine::CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix
// Query // Query
/** Return the argument count
*/
size_t CommandLine::get_arg_count() const
{
return m_argc;
}
/** Return an argument by index
This method doesn't skip argument
names if any, so if the second
argument is an argument name the
function nevertheless returns it.
@precond 0 <= Index < GetArgumentCount
@throws std::out_of_range exception
if the given index is to high
*/
std::string CommandLine::get_arg(size_t Index) const
{
OSL_PRECOND(Index < m_argc, "Index out of range");
if (Index > (m_argc - 1))
throw std::out_of_range("Invalid index");
return m_argv[Index];
}
/** Returns all argument name found in the
command line. An argument will be identified
by a specified prefix. The standard prefix
is '-'.
If the are no argument names the returned
container is empty.
*/
StringListPtr_t CommandLine::get_arg_names() const
{
StringListPtr_t arg_cont(new StringList_t());
for (size_t i = 0; i < m_argc; i++)
{
std::string argn = m_argv[i];
if (is_arg_name(argn))
arg_cont->push_back(argn);
}
return arg_cont;
}
/** Returns an argument by name. If there are /** Returns an argument by name. If there are
duplicate argument names in the command line, duplicate argument names in the command line,
the first one wins. the first one wins.
...@@ -143,30 +91,11 @@ std::string CommandLine::get_arg(const std::string& ArgumentName) const ...@@ -143,30 +91,11 @@ std::string CommandLine::get_arg(const std::string& ArgumentName) const
// Command // Command
/** Set the prefix used to identify arguments in
the command line.
@precond prefix is not empty
@throws std::invalid_argument exception if
the prefix is empty
*/
void CommandLine::set_arg_prefix(const std::string& Prefix)
{
OSL_PRECOND(Prefix.length(), "Empty argument prefix!");
if (0 == Prefix.length())
throw std::invalid_argument("Empty argument prefix not allowed");
m_argprefix = Prefix;
}
/** Returns whether a given argument is an argument name /** Returns whether a given argument is an argument name
*/ */
bool CommandLine::is_arg_name(const std::string& Argument) const bool CommandLine::is_arg_name(const std::string& Argument) const
{ {
return (0 == Argument.compare(0, m_argprefix.length(), m_argprefix)); return (Argument.length() > 0 && Argument[0] == '-');
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -15,38 +15,12 @@ public: ...@@ -15,38 +15,12 @@ public:
// Creation // Creation
CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix = std::string("-")); CommandLine(size_t argc, char* argv[]);
// Query // Query
/** Return the argument count
*/
size_t get_arg_count() const;
/** Return an argument by index
This method doesn't skip argument
names if any, so if the second
argument is an argument name the
function nevertheless returns it.
@precond 0 <= Index < GetArgumentCount
@throws std::out_of_range exception
if the given index is to high
*/
std::string get_arg(size_t Index) const;
/** Returns all argument name found in the
command line. An argument will be identified
by a specified prefix. The standard prefix
is '-'.
If there are no argument names the returned
container is empty.
*/
StringListPtr_t get_arg_names() const;
/** Returns an argument by name. If there are /** Returns an argument by name. If there are
duplicate argument names in the command line, duplicate argument names in the command line,
the first one wins. the first one wins.
...@@ -66,19 +40,6 @@ public: ...@@ -66,19 +40,6 @@ public:
std::string get_arg(const std::string& ArgumentName) const; std::string get_arg(const std::string& ArgumentName) const;
// Command
/** Set the prefix used to identify arguments in
the command line.
@precond prefix is not empty
@throws std::invalid_argument exception if
the prefix is empty
*/
void set_arg_prefix(const std::string& Prefix);
private: private:
/** Returns whether a given argument is an argument name /** Returns whether a given argument is an argument name
...@@ -88,7 +49,6 @@ private: ...@@ -88,7 +49,6 @@ private:
private: private:
size_t m_argc; size_t m_argc;
char** m_argv; char** m_argv;
std::string m_argprefix;
// prevent copy and assignment // prevent copy and assignment
private: private:
......
...@@ -138,10 +138,6 @@ ComboBox::IsDDAutoWidthEnabled() const ...@@ -138,10 +138,6 @@ ComboBox::IsDDAutoWidthEnabled() const
ComboBox::IsUserDrawEnabled() const ComboBox::IsUserDrawEnabled() const
ComboBox::ShowProminentEntry(unsigned short) ComboBox::ShowProminentEntry(unsigned short)
CommandExtTextInputData::CommandExtTextInputData() CommandExtTextInputData::CommandExtTextInputData()
CommandLine::get_arg(unsigned long) const
CommandLine::get_arg_count() const
CommandLine::get_arg_names() const
CommandLine::set_arg_prefix(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
CommunicationLinkList::DeleteAndDestroy(unsigned short, unsigned short) CommunicationLinkList::DeleteAndDestroy(unsigned short, unsigned short)
CommunicationLinkList::Insert(CommunicationLink const*&, unsigned short&) CommunicationLinkList::Insert(CommunicationLink const*&, unsigned short&)
CommunicationLinkList::Insert(CommunicationLink const**, unsigned short) CommunicationLinkList::Insert(CommunicationLink const**, unsigned short)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment