args_group.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2005, 2006, 2007, 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_ARGS_ARGS_GROUP_HH
00021 #define PALUDIS_GUARD_ARGS_ARGS_GROUP_HH 1
00022 
00023 #include <paludis/args/args_option.hh>
00024 #include <paludis/util/instantiation_policy.hh>
00025 #include <paludis/util/private_implementation_pattern.hh>
00026 #include <string>
00027 
00028 /** \file
00029  * Declarations for ArgsGroup.
00030  *
00031  * \ingroup g_args
00032  *
00033  * \section Examples
00034  *
00035  * - None at this time.
00036  */
00037 
00038 namespace paludis
00039 {
00040 
00041     namespace args
00042     {
00043         class ArgsSection;
00044 
00045         /**
00046          * Contains a related group of command line arguments.
00047          *
00048          * \ingroup g_args
00049          * \nosubgrouping
00050          */
00051         class PALUDIS_VISIBLE ArgsGroup :
00052             private PrivateImplementationPattern<ArgsGroup>,
00053             private InstantiationPolicy<ArgsGroup, instantiation_method::NonCopyableTag>
00054         {
00055             private:
00056                 const std::string _name;
00057                 const std::string _description;
00058 
00059                 ArgsSection * _section;
00060 
00061             public:
00062                 /**
00063                  * Fetch our section.
00064                  */
00065                 ArgsSection * section() const
00066                 {
00067                     return _section;
00068                 }
00069 
00070                 /**
00071                  * Add an ArgsOption instance (called by the ArgsOption
00072                  * constructor).
00073                  */
00074                 void add(ArgsOption * const value);
00075 
00076                 /**
00077                  * Remove an ArgsOption instance (called by
00078                  * ArgsOption::remove).
00079                  */
00080                 void remove(ArgsOption * const value);
00081 
00082                 ///\name Iterate over our ArgsOptions.
00083                 ///\{
00084 
00085                 struct ConstIteratorTag;
00086                 typedef WrappedForwardIterator<ConstIteratorTag, ArgsOption * const> ConstIterator;
00087 
00088                 ConstIterator begin() const;
00089                 ConstIterator end() const;
00090 
00091                 ///\}
00092 
00093                 ///\name Basic operations
00094                 ///\{
00095 
00096                 ArgsGroup(ArgsSection * s, const std::string & name,
00097                         const std::string & description);
00098 
00099                 ~ArgsGroup();
00100 
00101                 ///\}
00102 
00103                 /**
00104                  * Fetch our name.
00105                  */
00106                 const std::string & name() const
00107                 {
00108                     return _name;
00109                 }
00110 
00111                 /**
00112                  * Fetch our description.
00113                  */
00114                 const std::string & description() const
00115                 {
00116                     return _description;
00117                 }
00118         };
00119     }
00120 }
00121 
00122 #endif

Generated on Mon Sep 21 10:36:07 2009 for paludis by  doxygen 1.5.4