aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--args.hxx237
1 files changed, 184 insertions, 53 deletions
diff --git a/args.hxx b/args.hxx
index 7fd422f..731266d 100644
--- a/args.hxx
+++ b/args.hxx
@@ -1627,26 +1627,26 @@ namespace args
class ValueFlagList : public ValueFlagBase
{
private:
- using Container = List<T>;
- Container values;
+ using Container = List<T>;
+ Container values;
Reader reader;
-
+
public:
- typedef T value_type;
- typedef typename Container::allocator_type allocator_type;
- typedef typename Container::pointer pointer;
- typedef typename Container::const_pointer const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef typename Container::size_type size_type;
- typedef typename Container::difference_type difference_type;
- typedef typename Container::iterator iterator;
- typedef typename Container::const_iterator const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- ValueFlagList(Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const List<T> &defaultValues_ = List<T>()): ValueFlagBase(name_, help_, std::move(matcher_)), values(defaultValues_)
+ typedef T value_type;
+ typedef typename Container::allocator_type allocator_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ ValueFlagList(Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const Container &defaultValues_ = Container()): ValueFlagBase(name_, help_, std::move(matcher_)), values(defaultValues_)
{
group_.Add(*this);
}
@@ -1669,7 +1669,7 @@ namespace args
/** Get the values
*/
- List<T> &Get() noexcept
+ Container &Get() noexcept
{
return values;
}
@@ -1685,35 +1685,35 @@ namespace args
values.clear();
}
- iterator begin() noexcept
- {
- return values.begin();
- }
+ iterator begin() noexcept
+ {
+ return values.begin();
+ }
- const_iterator begin() const noexcept
- {
- return values.begin();
- }
+ const_iterator begin() const noexcept
+ {
+ return values.begin();
+ }
- const_iterator cbegin() const noexcept
- {
- return values.cbegin();
- }
+ const_iterator cbegin() const noexcept
+ {
+ return values.cbegin();
+ }
- iterator end() noexcept
- {
- return values.end();
- }
+ iterator end() noexcept
+ {
+ return values.end();
+ }
- const_iterator end() const noexcept
- {
- return values.end();
- }
+ const_iterator end() const noexcept
+ {
+ return values.end();
+ }
- const_iterator cend() const noexcept
- {
- return values.cend();
- }
+ const_iterator cend() const noexcept
+ {
+ return values.cend();
+ }
};
/** A mapping value flag class
@@ -1796,13 +1796,26 @@ namespace args
class MapFlagList : public ValueFlagBase
{
private:
+ using Container = List<T>;
const Map<K, T> map;
- List<T> values;
+ Container values;
Reader reader;
public:
-
- MapFlagList(Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const Map<K, T> &map_, const List<T> &defaultValues_ = List<T>()): ValueFlagBase(name_, help_, std::move(matcher_)), map(map_), values(defaultValues_)
+ typedef T value_type;
+ typedef typename Container::allocator_type allocator_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ MapFlagList(Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const Map<K, T> &map_, const Container &defaultValues_ = Container()): ValueFlagBase(name_, help_, std::move(matcher_)), map(map_), values(defaultValues_)
{
group_.Add(*this);
}
@@ -1838,7 +1851,7 @@ namespace args
/** Get the value
*/
- List<T> &Get() noexcept
+ Container &Get() noexcept
{
return values;
}
@@ -1853,6 +1866,36 @@ namespace args
ValueFlagBase::Reset();
values.clear();
}
+
+ iterator begin() noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator begin() const noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator cbegin() const noexcept
+ {
+ return values.cbegin();
+ }
+
+ iterator end() noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator end() const noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator cend() const noexcept
+ {
+ return values.cend();
+ }
};
/** A positional argument class
@@ -1911,11 +1954,25 @@ namespace args
class PositionalList : public PositionalBase
{
private:
- List<T> values;
+ using Container = List<T>;
+ Container values;
Reader reader;
public:
- PositionalList(Group &group_, const std::string &name_, const std::string &help_, const List<T> &defaultValues_ = List<T>()): PositionalBase(name_, help_), values(defaultValues_)
+ typedef T value_type;
+ typedef typename Container::allocator_type allocator_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ PositionalList(Group &group_, const std::string &name_, const std::string &help_, const Container &defaultValues_ = Container()): PositionalBase(name_, help_), values(defaultValues_)
{
group_.Add(*this);
}
@@ -1944,7 +2001,7 @@ namespace args
/** Get the values
*/
- List<T> &Get() noexcept
+ Container &Get() noexcept
{
return values;
}
@@ -1954,6 +2011,36 @@ namespace args
PositionalBase::Reset();
values.clear();
}
+
+ iterator begin() noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator begin() const noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator cbegin() const noexcept
+ {
+ return values.cbegin();
+ }
+
+ iterator end() noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator end() const noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator cend() const noexcept
+ {
+ return values.cend();
+ }
};
/** A positional argument mapping class
@@ -2038,13 +2125,27 @@ namespace args
class MapPositionalList : public PositionalBase
{
private:
+ using Container = List<T>;
+
const Map<K, T> map;
- List<T> values;
+ Container values;
Reader reader;
public:
-
- MapPositionalList(Group &group_, const std::string &name_, const std::string &help_, const Map<K, T> &map_, const List<T> &defaultValues_ = List<T>()): PositionalBase(name_, help_), map(map_), values(defaultValues_)
+ typedef T value_type;
+ typedef typename Container::allocator_type allocator_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::iterator iterator;
+ typedef typename Container::const_iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ MapPositionalList(Group &group_, const std::string &name_, const std::string &help_, const Map<K, T> &map_, const Container &defaultValues_ = Container()): PositionalBase(name_, help_), map(map_), values(defaultValues_)
{
group_.Add(*this);
}
@@ -2081,7 +2182,7 @@ namespace args
/** Get the value
*/
- List<T> &Get() noexcept
+ Container &Get() noexcept
{
return values;
}
@@ -2096,6 +2197,36 @@ namespace args
PositionalBase::Reset();
values.clear();
}
+
+ iterator begin() noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator begin() const noexcept
+ {
+ return values.begin();
+ }
+
+ const_iterator cbegin() const noexcept
+ {
+ return values.cbegin();
+ }
+
+ iterator end() noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator end() const noexcept
+ {
+ return values.end();
+ }
+
+ const_iterator cend() const noexcept
+ {
+ return values.cend();
+ }
};
}