aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-01-21 18:28:37 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-01-21 18:28:37 +0000
commitc34b2651b6ad541b6084f627f3ed48104cfc20c5 (patch)
tree75a82ac51c743636ca4ed0f0a32e071b937948a9
parent5710bbe9feb9f0d998cee3cdf64ab9293f4842f7 (diff)
downloadpaludis-c34b2651b6ad541b6084f627f3ed48104cfc20c5.tar.gz
paludis-c34b2651b6ad541b6084f627f3ed48104cfc20c5.tar.xz
Merged alias_arg and switch_arg into args_option. Seperate files are overkill here, especially for two of the smallest args classes.
-rw-r--r--paludis/args/Makefile.am2
-rw-r--r--paludis/args/alias_arg.cc38
-rw-r--r--paludis/args/alias_arg.hh66
-rw-r--r--paludis/args/args.hh2
-rw-r--r--paludis/args/args_dumper.cc2
-rw-r--r--paludis/args/args_option.cc17
-rw-r--r--paludis/args/args_option.hh45
-rw-r--r--paludis/args/args_visitor.cc2
-rw-r--r--paludis/args/switch_arg.cc39
-rw-r--r--paludis/args/switch_arg.hh57
10 files changed, 62 insertions, 208 deletions
diff --git a/paludis/args/Makefile.am b/paludis/args/Makefile.am
index 4ff3818..e6ebf37 100644
--- a/paludis/args/Makefile.am
+++ b/paludis/args/Makefile.am
@@ -6,14 +6,12 @@ TESTS = \
args_TEST
libpaludisargs_a_SOURCES = \
- alias_arg.hh alias_arg.cc \
args.hh args.cc \
args_error.hh args_error.cc \
args_group.hh args_group.cc \
args_handler.hh args_handler.cc \
args_option.hh args_option.cc \
bad_argument.hh bad_argument.cc \
- switch_arg.hh switch_arg.cc \
args_visitor.hh args_visitor.cc \
bad_value.hh bad_value.cc \
args_dumper.hh args_dumper.cc
diff --git a/paludis/args/alias_arg.cc b/paludis/args/alias_arg.cc
deleted file mode 100644
index 8c930c5..0000000
--- a/paludis/args/alias_arg.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "alias_arg.hh"
-#include "args_group.hh"
-#include "args_handler.hh"
-
-/** \file
- * Implementation for AliasArg.
- *
- * \ingroup Args
- */
-
-using namespace paludis::args;
-
-AliasArg::AliasArg(ArgsOption * const other, const std::string & long_name) :
- ArgsOption(other->group(), long_name, '\0', "Alias for --" + other->long_name()),
- _other(other)
-{
- other->group()->handler()->add_option(other, long_name);
-}
-
diff --git a/paludis/args/alias_arg.hh b/paludis/args/alias_arg.hh
deleted file mode 100644
index 59b9839..0000000
--- a/paludis/args/alias_arg.hh
+++ /dev/null
@@ -1,66 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_ARGS_ALIAS_ARG_HH
-#define PALUDIS_GUARD_PALUDIS_ARGS_ALIAS_ARG_HH 1
-
-#include <paludis/args/args_option.hh>
-#include <string>
-
-/** \file
- * Declaration for AliasArg.
- *
- * \ingroup Args
- */
-
-namespace paludis
-{
- namespace args
- {
- /**
- * An AliasArg is an alias for another argument.
- *
- * \ingroup Args
- */
- class AliasArg : public ArgsOption, public Visitable<AliasArg, ArgsVisitorTypes>
- {
- private:
- ArgsOption * const _other;
-
- public:
- /**
- * Constructor.
- */
- AliasArg(ArgsOption * const other, const std::string & new_long_name);
-
- virtual bool specified() const
- {
- return _other->specified();
- }
-
- virtual void set_specified(const bool value)
- {
- _other->set_specified(value);
- }
- };
- }
-}
-
-#endif
diff --git a/paludis/args/args.hh b/paludis/args/args.hh
index f9c8b2f..2a8e0b7 100644
--- a/paludis/args/args.hh
+++ b/paludis/args/args.hh
@@ -26,12 +26,10 @@
* \ingroup Args
*/
-#include <paludis/args/alias_arg.hh>
#include <paludis/args/args_error.hh>
#include <paludis/args/args_group.hh>
#include <paludis/args/args_handler.hh>
#include <paludis/args/args_option.hh>
#include <paludis/args/bad_argument.hh>
-#include <paludis/args/switch_arg.hh>
#endif
diff --git a/paludis/args/args_dumper.cc b/paludis/args/args_dumper.cc
index 67f68ec..02a22ec 100644
--- a/paludis/args/args_dumper.cc
+++ b/paludis/args/args_dumper.cc
@@ -20,8 +20,6 @@
#include <paludis/args/args_dumper.hh>
#include <paludis/args/args_option.hh>
-#include <paludis/args/switch_arg.hh>
-#include <paludis/args/alias_arg.hh>
#include <sstream>
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index a1222c3..eefc57b 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -44,6 +44,23 @@ ArgsOption::~ArgsOption()
{
}
+SwitchArg::SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
+ std::string description) :
+ ArgsOption(group, long_name, short_name, description)
+{
+}
+
+SwitchArg::~SwitchArg()
+{
+}
+
+AliasArg::AliasArg(ArgsOption * const other, const std::string & long_name) :
+ ArgsOption(other->group(), long_name, '\0', "Alias for --" + other->long_name()),
+ _other(other)
+{
+ other->group()->handler()->add_option(other, long_name);
+}
+
StringArg::StringArg(ArgsGroup * const g, const std::string & long_name,
const char short_name, const std::string & description) :
ArgsOption(g, long_name, short_name, description)
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 20cdd26..9a484b9 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -121,7 +121,25 @@ namespace paludis
return _group;
}
};
+
+ /**
+ * A SwitchArg is an option that can either be specified or not
+ * specified, and that takes no value (for example, --help).
+ *
+ * \ingroup Args
+ */
+ class SwitchArg : public ArgsOption, public Visitable<SwitchArg, ArgsVisitorTypes>
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
+ std::string description);
+ ~SwitchArg();
+ };
+
/**
* An option that takes a string argument.
*
@@ -152,6 +170,33 @@ namespace paludis
};
/**
+ * An AliasArg is an alias for another argument.
+ *
+ * \ingroup Args
+ */
+ class AliasArg : public ArgsOption, public Visitable<AliasArg, ArgsVisitorTypes>
+ {
+ private:
+ ArgsOption * const _other;
+
+ public:
+ /**
+ * Constructor.
+ */
+ AliasArg(ArgsOption * const other, const std::string & new_long_name);
+
+ virtual bool specified() const
+ {
+ return _other->specified();
+ }
+
+ virtual void set_specified(const bool value)
+ {
+ _other->set_specified(value);
+ }
+ };
+
+ /**
* An option that takes an integer argument.
*
* \ingroup Args
diff --git a/paludis/args/args_visitor.cc b/paludis/args/args_visitor.cc
index cfc02b6..b66b457 100644
--- a/paludis/args/args_visitor.cc
+++ b/paludis/args/args_visitor.cc
@@ -1,7 +1,5 @@
#include "args_visitor.hh"
#include "args_option.hh"
-#include "alias_arg.hh"
-#include "switch_arg.hh"
/*
* Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
diff --git a/paludis/args/switch_arg.cc b/paludis/args/switch_arg.cc
deleted file mode 100644
index 2d4dc78..0000000
--- a/paludis/args/switch_arg.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "switch_arg.hh"
-
-/** \file
- * Implementation for SwitchArg.
- *
- * \ingroup Args
- */
-
-using namespace paludis::args;
-
-SwitchArg::SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
- std::string description) :
- ArgsOption(group, long_name, short_name, description)
-{
-}
-
-SwitchArg::~SwitchArg()
-{
-}
-
diff --git a/paludis/args/switch_arg.hh b/paludis/args/switch_arg.hh
deleted file mode 100644
index 8e0f7bb..0000000
--- a/paludis/args/switch_arg.hh
+++ /dev/null
@@ -1,57 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- * Copyright (c) 2006 Stephen Bennett <spb@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_ARGS_SWITCH_ARG_HH
-#define PALUDIS_GUARD_ARGS_SWITCH_ARG_HH 1
-
-#include <paludis/args/args_option.hh>
-#include <string>
-
-/** \file
- * Declaration for SwitchArg.
- *
- * \ingroup Args
- */
-
-namespace paludis
-{
- namespace args
- {
- /**
- * A SwitchArg is an option that can either be specified or not
- * specified, and that takes no value (for example, --help).
- *
- * \ingroup Args
- */
- class SwitchArg : public ArgsOption, public Visitable<SwitchArg, ArgsVisitorTypes>
- {
- public:
- /**
- * Constructor.
- */
- SwitchArg(ArgsGroup * const group, std::string long_name, char short_name,
- std::string description);
-
- ~SwitchArg();
- };
- }
-}
-
-#endif