Convert a number of destructors to default synthesized functions. Try to inline a few instances into the header. It should be possible to inline all of them, however, gcc seems to emit a number of warnings. Furthermore, some of the destructors are pure-virtualed, but provide an implementation. Placing the definition into the header causes ODR violations.
98 lines
2.3 KiB
C++
98 lines
2.3 KiB
C++
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
|
|
|
|
/*
|
|
* 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
|
|
* 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 <paludis/args/args_group.hh>
|
|
#include <paludis/args/args_section.hh>
|
|
#include <paludis/util/pimp-impl.hh>
|
|
#include <paludis/util/wrapped_forward_iterator-impl.hh>
|
|
#include <list>
|
|
|
|
using namespace paludis;
|
|
using namespace paludis::args;
|
|
|
|
namespace paludis
|
|
{
|
|
/**
|
|
* Imp data for ArgsGroup.
|
|
*
|
|
* \ingroup grplibpaludisargs
|
|
*/
|
|
template<>
|
|
struct Imp<ArgsGroup>
|
|
{
|
|
std::list<ArgsOption *> args_options;
|
|
};
|
|
|
|
template <>
|
|
struct WrappedForwardIteratorTraits<ArgsGroup::ConstIteratorTag>
|
|
{
|
|
typedef std::list<ArgsOption *>::const_iterator UnderlyingIterator;
|
|
};
|
|
}
|
|
|
|
ArgsGroup::ArgsGroup(ArgsSection * s, const std::string & our_name,
|
|
const std::string & our_description) :
|
|
_imp(),
|
|
_name(our_name),
|
|
_description(our_description),
|
|
_section(s)
|
|
{
|
|
s->add(this);
|
|
}
|
|
|
|
void
|
|
ArgsGroup::remove()
|
|
{
|
|
_section->remove(this);
|
|
}
|
|
|
|
void
|
|
ArgsGroup::add(ArgsOption * const value)
|
|
{
|
|
/// \bug Should check for uniqueness of short and long names.
|
|
_imp->args_options.push_back(value);
|
|
}
|
|
|
|
void
|
|
ArgsGroup::remove(ArgsOption * const value)
|
|
{
|
|
_imp->args_options.remove(value);
|
|
if (_imp->args_options.empty())
|
|
remove();
|
|
}
|
|
|
|
ArgsGroup::~ArgsGroup() = default;
|
|
|
|
ArgsGroup::ConstIterator
|
|
ArgsGroup::begin() const
|
|
{
|
|
return ConstIterator(_imp->args_options.begin());
|
|
}
|
|
|
|
ArgsGroup::ConstIterator
|
|
ArgsGroup::end() const
|
|
{
|
|
return ConstIterator(_imp->args_options.end());
|
|
}
|
|
|
|
namespace paludis
|
|
{
|
|
template class WrappedForwardIterator<ArgsGroup::ConstIteratorTag, ArgsOption * const>;
|
|
}
|