aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2010-06-23 21:57:58 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2010-06-23 21:57:58 +0100
commit2b3a39829fa423dc7a0b3209a52d66dfa29f6bbc (patch)
treecb25a76ccf293497a5d78ecc6420400612d709c3
parent8867502dc820313cc1c48d12f4403b8ff26bfb1b (diff)
downloadpaludis-2b3a39829fa423dc7a0b3209a52d66dfa29f6bbc.tar.gz
paludis-2b3a39829fa423dc7a0b3209a52d66dfa29f6bbc.tar.xz
Remove the ArgsGroup from its ArgsSection if empty
-rw-r--r--paludis/args/args_group.cc2
-rw-r--r--paludis/args/args_group.hh3
-rw-r--r--paludis/args/args_option.hh3
3 files changed, 6 insertions, 2 deletions
diff --git a/paludis/args/args_group.cc b/paludis/args/args_group.cc
index 98800bc..620d084 100644
--- a/paludis/args/args_group.cc
+++ b/paludis/args/args_group.cc
@@ -73,6 +73,8 @@ void
ArgsGroup::remove(ArgsOption * const value)
{
_imp->args_options.remove(value);
+ if (_imp->args_options.empty())
+ remove();
}
ArgsGroup::~ArgsGroup()
diff --git a/paludis/args/args_group.hh b/paludis/args/args_group.hh
index 786055d..bac968f 100644
--- a/paludis/args/args_group.hh
+++ b/paludis/args/args_group.hh
@@ -80,7 +80,8 @@ namespace paludis
/**
* Remove an ArgsOption instance (called by
- * ArgsOption::remove).
+ * ArgsOption::remove). Calls ArgsGroup::remove() if
+ * that would leave us with no ArgsOptions.
*/
void remove(ArgsOption * const value);
diff --git a/paludis/args/args_option.hh b/paludis/args/args_option.hh
index 95be506..d14f5be 100644
--- a/paludis/args/args_option.hh
+++ b/paludis/args/args_option.hh
@@ -96,7 +96,8 @@ namespace paludis
public:
/**
- * Remove this option.
+ * Remove this option. Removes our group from its
+ * section if the group would be left empty.
*/
void remove();