aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/args_option.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/args/args_option.cc')
-rw-r--r--paludis/args/args_option.cc49
1 files changed, 48 insertions, 1 deletions
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index e3718a9..f373b41 100644
--- a/paludis/args/args_option.cc
+++ b/paludis/args/args_option.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
*
* 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
@@ -25,6 +25,7 @@
#include <set>
#include <vector>
#include <algorithm>
+#include <list>
using namespace paludis;
using namespace paludis::args;
@@ -34,6 +35,7 @@ template class WrappedForwardIterator<StringSetArg::AllowedArgConstIteratorTag,
const std::pair<std::string, std::string> >;
template class WrappedForwardIterator<EnumArg::AllowedArgConstIteratorTag,
const std::pair<std::string, std::string> >;
+template class WrappedForwardIterator<StringSequenceArg::ConstIteratorTag, const std::string>;
namespace
{
@@ -185,6 +187,45 @@ StringSetArg::add_argument(const std::string & arg)
_imp->args.insert(arg);
}
+namespace paludis
+{
+ template<>
+ struct Implementation<StringSequenceArg>
+ {
+ std::list<std::string> args;
+ };
+}
+
+StringSequenceArg::StringSequenceArg(ArgsGroup * const g, const std::string & our_long_name,
+ const char our_short_name, const std::string & our_description) :
+ ArgsOption(g, our_long_name, our_short_name, our_description),
+ PrivateImplementationPattern<StringSequenceArg>(new Implementation<StringSequenceArg>)
+{
+}
+
+StringSequenceArg::~StringSequenceArg()
+{
+}
+
+StringSequenceArg::ConstIterator
+StringSequenceArg::begin_args() const
+{
+ return ConstIterator(_imp->args.begin());
+}
+
+StringSequenceArg::ConstIterator
+StringSequenceArg::end_args() const
+{
+ return ConstIterator(_imp->args.end());
+}
+
+void
+StringSequenceArg::add_argument(const std::string & arg)
+{
+ Context context("When handling argument '" + arg + "' for '--" + long_name() + "':");
+ _imp->args.push_back(arg);
+}
+
IntegerArg::IntegerArg(ArgsGroup * const our_group, const std::string & our_long_name,
char our_short_name, const std::string & our_description) :
ArgsOption(our_group, our_long_name, our_short_name, our_description)
@@ -355,6 +396,12 @@ StringSetArg::can_be_negated() const
}
bool
+StringSequenceArg::can_be_negated() const
+{
+ return false;
+}
+
+bool
SwitchArg::can_be_negated() const
{
return _can_be_negated;