[Libreoffice-commits] .: shell/source unusedcode.easy

Jan Holesovsky kendy at kemper.freedesktop.org
Sun Aug 7 16:06:30 PDT 2011


 shell/source/tools/lngconvex/cmdline.cxx |   77 +------------------------------
 shell/source/tools/lngconvex/cmdline.hxx |   42 ----------------
 unusedcode.easy                          |    4 -
 3 files changed, 4 insertions(+), 119 deletions(-)

New commits:
commit c8989e1529b74831e9aad14e5c7307113a272180
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Aug 8 01:04:17 2011 +0200

    Cleanup/remove CommandLine-related methods in lngconvex.

diff --git a/shell/source/tools/lngconvex/cmdline.cxx b/shell/source/tools/lngconvex/cmdline.cxx
index 350bb79..1bd18b6 100644
--- a/shell/source/tools/lngconvex/cmdline.cxx
+++ b/shell/source/tools/lngconvex/cmdline.cxx
@@ -40,10 +40,9 @@
 // Creation
 
 
-CommandLine::CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix) :
+CommandLine::CommandLine(size_t argc, char* argv[]) :
     m_argc(argc),
-    m_argv(argv),
-    m_argprefix(ArgPrefix)
+    m_argv(argv)
 {
 }
 
@@ -51,57 +50,6 @@ CommandLine::CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix
 // 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
     duplicate argument names in the command line,
     the first one wins.
@@ -143,30 +91,11 @@ std::string CommandLine::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 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
 */
 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: */
diff --git a/shell/source/tools/lngconvex/cmdline.hxx b/shell/source/tools/lngconvex/cmdline.hxx
index efee314..29c16c6 100644
--- a/shell/source/tools/lngconvex/cmdline.hxx
+++ b/shell/source/tools/lngconvex/cmdline.hxx
@@ -15,38 +15,12 @@ public:
     // Creation
 
 
-    CommandLine(size_t argc, char* argv[], const std::string& ArgPrefix = std::string("-"));
+    CommandLine(size_t argc, char* argv[]);
 
 
     // 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
         duplicate argument names in the command line,
         the first one wins.
@@ -66,19 +40,6 @@ public:
     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:
 
     /** Returns whether a given argument is an argument name
@@ -88,7 +49,6 @@ private:
 private:
     size_t      m_argc;
     char**      m_argv;
-    std::string m_argprefix;
 
 // prevent copy and assignment
 private:
diff --git a/unusedcode.easy b/unusedcode.easy
index 7c3f2d5..a7d56c2 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -138,10 +138,6 @@ ComboBox::IsDDAutoWidthEnabled() const
 ComboBox::IsUserDrawEnabled() const
 ComboBox::ShowProminentEntry(unsigned short)
 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::Insert(CommunicationLink const*&, unsigned short&)
 CommunicationLinkList::Insert(CommunicationLink const**, unsigned short)


More information about the Libreoffice-commits mailing list