aboutsummaryrefslogtreecommitdiff
path: root/paludis/args
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-09 10:23:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-09 10:23:12 +0000
commit7a2c9e974666881f44406c88189ae546a67ff0b7 (patch)
treef6846da02bf779a262f58e5042f3fa1bbf7415d3 /paludis/args
parent7f7c79fcc67df4fae498ca943e36592d3f7a3ad2 (diff)
downloadpaludis-7a2c9e974666881f44406c88189ae546a67ff0b7.tar.gz
paludis-7a2c9e974666881f44406c88189ae546a67ff0b7.tar.xz
Rework Pimp to avoid ImpPtr ickiness
Fixes: ticket:1070
Diffstat (limited to 'paludis/args')
-rw-r--r--paludis/args/args_group.cc4
-rw-r--r--paludis/args/args_group.hh7
-rw-r--r--paludis/args/args_handler.cc4
-rw-r--r--paludis/args/args_handler.hh8
-rw-r--r--paludis/args/args_option.cc20
-rw-r--r--paludis/args/args_option.hh30
-rw-r--r--paludis/args/args_section.cc4
-rw-r--r--paludis/args/args_section.hh8
-rw-r--r--paludis/args/args_visitor.cc4
-rw-r--r--paludis/args/args_visitor.hh7
10 files changed, 55 insertions, 41 deletions
diff --git a/paludis/args/args_group.cc b/paludis/args/args_group.cc
index 7ac4d83fa..a227d3edb 100644
--- a/paludis/args/args_group.cc
+++ b/paludis/args/args_group.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2009, 2010, 2011 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
@@ -48,7 +48,7 @@ namespace paludis
ArgsGroup::ArgsGroup(ArgsSection * s, const std::string & our_name,
const std::string & our_description) :
- Pimp<ArgsGroup>(),
+ _imp(),
_name(our_name),
_description(our_description),
_section(s)
diff --git a/paludis/args/args_group.hh b/paludis/args/args_group.hh
index 289a934e6..d1f56e59a 100644
--- a/paludis/args/args_group.hh
+++ b/paludis/args/args_group.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2009, 2010, 2011 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
@@ -47,10 +47,11 @@ namespace paludis
* \ingroup g_args
* \nosubgrouping
*/
- class PALUDIS_VISIBLE ArgsGroup :
- private Pimp<ArgsGroup>
+ class PALUDIS_VISIBLE ArgsGroup
{
private:
+ Pimp<ArgsGroup> _imp;
+
const std::string _name;
const std::string _description;
diff --git a/paludis/args/args_handler.cc b/paludis/args/args_handler.cc
index 0e8bff5a7..a1e9939d2 100644
--- a/paludis/args/args_handler.cc
+++ b/paludis/args/args_handler.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -128,7 +128,7 @@ namespace paludis
}
ArgsHandler::ArgsHandler() :
- Pimp<ArgsHandler>()
+ _imp()
{
}
diff --git a/paludis/args/args_handler.hh b/paludis/args/args_handler.hh
index e1f032d6c..4d338179e 100644
--- a/paludis/args/args_handler.hh
+++ b/paludis/args/args_handler.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -55,12 +55,14 @@ namespace paludis
* \ingroup g_args
* \nosubgrouping
*/
- class PALUDIS_VISIBLE ArgsHandler :
- private Pimp<ArgsHandler>
+ class PALUDIS_VISIBLE ArgsHandler
{
friend class ArgsSection;
friend std::ostream & operator<< (std::ostream &, const ArgsHandler &);
+ private:
+ Pimp<ArgsHandler> _imp;
+
protected:
/**
* Add a new usage line.
diff --git a/paludis/args/args_option.cc b/paludis/args/args_option.cc
index e9df5c670..821669daa 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, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -197,7 +197,7 @@ StringSetArg::StringSetArg(ArgsGroup * const g, const std::string & our_long_nam
const char our_short_name, const std::string & our_description,
const StringSetArgOptions & opts) :
ArgsOption(g, our_long_name, our_short_name, our_description),
- Pimp<StringSetArg>(),
+ _imp(),
_validator(0)
{
std::copy(opts._imp->options.begin(), opts._imp->options.end(),
@@ -208,7 +208,7 @@ StringSetArg::StringSetArg(ArgsGroup * const g, const std::string & our_long_nam
const char our_short_name, const std::string & our_description,
const StringSetArgOptions & opts, void (* v) (const std::string &)) :
ArgsOption(g, our_long_name, our_short_name, our_description),
- Pimp<StringSetArg>(),
+ _imp(),
_validator(v)
{
std::copy(opts._imp->options.begin(), opts._imp->options.end(),
@@ -287,7 +287,7 @@ namespace paludis
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),
- Pimp<StringSequenceArg>()
+ _imp()
{
}
@@ -389,7 +389,7 @@ namespace paludis
}
StringSetArg::StringSetArgOptions::StringSetArgOptions(const std::string & opt, const std::string & desc) :
- Pimp<StringSetArgOptions>()
+ _imp()
{
_imp->options.push_back(std::make_pair(opt, desc));
}
@@ -402,7 +402,7 @@ StringSetArg::StringSetArgOptions::operator() (const std::string & opt, const st
}
StringSetArg::StringSetArgOptions::StringSetArgOptions(const StringSetArg::StringSetArgOptions & o) :
- Pimp<StringSetArgOptions>()
+ _imp()
{
std::copy(o._imp->options.begin(), o._imp->options.end(),
std::back_inserter(_imp->options));
@@ -413,7 +413,7 @@ StringSetArg::StringSetArgOptions::~StringSetArgOptions()
}
StringSetArg::StringSetArgOptions::StringSetArgOptions() :
- Pimp<StringSetArgOptions>()
+ _imp()
{
}
@@ -446,7 +446,7 @@ EnumArg::~EnumArg()
}
EnumArg::EnumArgOptions::EnumArgOptions(const std::string & opt, const std::string & desc) :
- Pimp<EnumArgOptions>()
+ _imp()
{
_imp->options.push_back(make_named_values<AllowedEnumArg>(
n::description() = desc,
@@ -456,7 +456,7 @@ EnumArg::EnumArgOptions::EnumArgOptions(const std::string & opt, const std::stri
}
EnumArg::EnumArgOptions::EnumArgOptions(const std::string & opt, const char s, const std::string & desc) :
- Pimp<EnumArgOptions>()
+ _imp()
{
_imp->options.push_back(make_named_values<AllowedEnumArg>(
n::description() = desc,
@@ -495,7 +495,7 @@ EnumArg::EnumArg(ArgsGroup * const our_group, const std::string & our_long_name,
const char our_short_name, const std::string & our_description,
const EnumArgOptions & opts, const std::string & our_default_arg) :
ArgsOption(our_group, our_long_name, our_short_name, our_description),
- Pimp<EnumArg>(),
+ _imp(),
_argument(our_default_arg),
_default_arg(our_default_arg)
{
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 3c392927f..6511f07ca 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
* Copyright (c) 2006 Stephen Bennett
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -259,10 +259,11 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringSetArg :
public ArgsOption,
- public ImplementAcceptMethods<ArgsOption, StringSetArg>,
- private Pimp<StringSetArg>
+ public ImplementAcceptMethods<ArgsOption, StringSetArg>
{
private:
+ Pimp<StringSetArg> _imp;
+
void (* _validator) (const std::string &);
public:
@@ -272,11 +273,13 @@ namespace paludis
*
* \ingroup grplibpaludisargs
*/
- class PALUDIS_VISIBLE StringSetArgOptions :
- private Pimp<StringSetArgOptions>
+ class PALUDIS_VISIBLE StringSetArgOptions
{
friend class StringSetArg;
+ private:
+ Pimp<StringSetArgOptions> _imp;
+
public:
/**
* Constructor
@@ -365,9 +368,11 @@ namespace paludis
*/
class PALUDIS_VISIBLE StringSequenceArg :
public ArgsOption,
- public ImplementAcceptMethods<ArgsOption, StringSequenceArg>,
- private Pimp<StringSequenceArg>
+ public ImplementAcceptMethods<ArgsOption, StringSequenceArg>
{
+ private:
+ Pimp<StringSequenceArg> _imp;
+
public:
///\name Basic operations
///\{
@@ -513,10 +518,11 @@ namespace paludis
*/
class PALUDIS_VISIBLE EnumArg :
public ArgsOption,
- public ImplementAcceptMethods<ArgsOption, EnumArg>,
- private Pimp<EnumArg>
+ public ImplementAcceptMethods<ArgsOption, EnumArg>
{
private:
+ Pimp<EnumArg> _imp;
+
std::string _argument;
std::string _default_arg;
@@ -527,11 +533,13 @@ namespace paludis
*
* \ingroup grplibpaludisargs
*/
- class PALUDIS_VISIBLE EnumArgOptions :
- private Pimp<EnumArgOptions>
+ class PALUDIS_VISIBLE EnumArgOptions
{
friend class EnumArg;
+ private:
+ Pimp<EnumArgOptions> _imp;
+
public:
/**
* Constructor
diff --git a/paludis/args/args_section.cc b/paludis/args/args_section.cc
index bda59ad46..20d168f9c 100644
--- a/paludis/args/args_section.cc
+++ b/paludis/args/args_section.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 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
@@ -51,7 +51,7 @@ namespace paludis
}
ArgsSection::ArgsSection(ArgsHandler * const h, const std::string & s) :
- Pimp<ArgsSection>(h, s)
+ _imp(h, s)
{
h->add(this);
}
diff --git a/paludis/args/args_section.hh b/paludis/args/args_section.hh
index 412e538da..6d20608d6 100644
--- a/paludis/args/args_section.hh
+++ b/paludis/args/args_section.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 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
@@ -38,9 +38,11 @@ namespace paludis
* \since 0.40
* \ingroup g_args
*/
- class PALUDIS_VISIBLE ArgsSection :
- private Pimp<ArgsSection>
+ class PALUDIS_VISIBLE ArgsSection
{
+ private:
+ Pimp<ArgsSection> _imp;
+
public:
ArgsSection(ArgsHandler * const, const std::string &);
~ArgsSection();
diff --git a/paludis/args/args_visitor.cc b/paludis/args/args_visitor.cc
index e55497ded..700f047d3 100644
--- a/paludis/args/args_visitor.cc
+++ b/paludis/args/args_visitor.cc
@@ -1,6 +1,6 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -64,7 +64,7 @@ namespace paludis
ArgsVisitor::ArgsVisitor(ArgsHandler::ArgsIterator * ai, ArgsHandler::ArgsIterator ae,
const std::string & env_prefix, std::string & s, bool n) :
- Pimp<ArgsVisitor>(ai, ae, env_prefix, s, n)
+ _imp(ai, ae, env_prefix, s, n)
{
}
diff --git a/paludis/args/args_visitor.hh b/paludis/args/args_visitor.hh
index b0d04e1c1..8eb7cfe23 100644
--- a/paludis/args/args_visitor.hh
+++ b/paludis/args/args_visitor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
* Copyright (c) 2006 Stephen Bennett
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -56,10 +56,11 @@ namespace paludis
*
* \ingroup g_args
*/
- class PALUDIS_VISIBLE ArgsVisitor :
- private Pimp<ArgsVisitor>
+ class PALUDIS_VISIBLE ArgsVisitor
{
private:
+ Pimp<ArgsVisitor> _imp;
+
const std::string & get_param(const ArgsOption &);
std::string env_name(const std::string & long_name) const;