paludis Version 3.0.2
The one true package mangler
args_group.hh
Go to the documentation of this file.
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2005, 2006, 2007, 2009, 2010, 2011 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_ARGS_ARGS_GROUP_HH
21#define PALUDIS_GUARD_ARGS_ARGS_GROUP_HH 1
22
24#include <paludis/util/pimp.hh>
25#include <string>
26
27/** \file
28 * Declarations for ArgsGroup.
29 *
30 * \ingroup g_args
31 *
32 * \section Examples
33 *
34 * - None at this time.
35 */
36
37namespace paludis
38{
39
40 namespace args
41 {
42 class ArgsSection;
43
44 /**
45 * Contains a related group of command line arguments.
46 *
47 * \ingroup g_args
48 * \nosubgrouping
49 */
50 class PALUDIS_VISIBLE ArgsGroup
51 {
52 private:
53 Pimp<ArgsGroup> _imp;
54
55 const std::string _name;
56 const std::string _description;
57
58 ArgsSection * _section;
59
60 public:
61 /**
62 * Remove this group from our section.
63 */
64 void remove();
65
66 /**
67 * Fetch our section.
68 */
70 {
71 return _section;
72 }
73
74 /**
75 * Add an ArgsOption instance (called by the ArgsOption
76 * constructor).
77 */
78 void add(ArgsOption * const value);
79
80 /**
81 * Remove an ArgsOption instance (called by
82 * ArgsOption::remove). Calls ArgsGroup::remove() if
83 * that would leave us with no ArgsOptions.
84 */
85 void remove(ArgsOption * const value);
86
87 ///\name Iterate over our ArgsOptions.
88 ///\{
89
90 struct ConstIteratorTag;
92
93 ConstIterator begin() const;
94 ConstIterator end() const;
95
96 ///\}
97
98 ///\name Basic operations
99 ///\{
100
101 ArgsGroup(ArgsSection * s, const std::string & name,
102 const std::string & description);
103
104 ~ArgsGroup();
105
106 ArgsGroup(const ArgsGroup &) = delete;
107 ArgsGroup & operator= (const ArgsGroup &) = delete;
108
109 ///\}
110
111 /**
112 * Fetch our name.
113 */
114 const std::string & name() const
115 {
116 return _name;
117 }
118
119 /**
120 * Fetch our description.
121 */
122 const std::string & description() const
123 {
124 return _description;
125 }
126 };
127 }
128
129 extern template class PALUDIS_VISIBLE WrappedForwardIterator<args::ArgsGroup::ConstIteratorTag, args::ArgsOption * const>;
130}
131
132#endif
Definition pimp.hh:52
Definition wrapped_forward_iterator.hh:42
const std::string & name() const
Definition args_group.hh:114
ArgsSection * section() const
Definition args_group.hh:69
const std::string & description() const
Definition args_group.hh:122
void add(ArgsOption *const value)
void remove(ArgsOption *const value)
Definition args_option.hh:79
Definition args_section.hh:42
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition args_dumper.hh:39
Definition about_metadata-fwd.hh:24