00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */ 00002 00003 /* 00004 * Copyright (c) 2005, 2006, 2007 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_ERROR_HH 00021 #define PALUDIS_GUARD_ARGS_ARGS_ERROR_HH 1 00022 00023 #include <paludis/util/exception.hh> 00024 #include <string> 00025 00026 /** \file 00027 * Declarations for argument exception classes. 00028 * 00029 * \ingroup g_args 00030 * 00031 * \section Examples 00032 * 00033 * - None at this time. 00034 */ 00035 00036 namespace paludis 00037 { 00038 namespace args 00039 { 00040 /** 00041 * Thrown if an invalid command line argument is provided. 00042 * 00043 * \ingroup g_exceptions 00044 * \ingroup g_args 00045 */ 00046 class PALUDIS_VISIBLE ArgsError : 00047 public paludis::Exception 00048 { 00049 protected: 00050 /** 00051 * Constructor. 00052 */ 00053 ArgsError(const std::string & message) throw (); 00054 }; 00055 00056 /** 00057 * Thrown if an invalid parameter is passed to a valid command line argument. 00058 * 00059 * \ingroup g_args 00060 * \ingroup g_exceptions 00061 */ 00062 class PALUDIS_VISIBLE BadValue : 00063 public ArgsError 00064 { 00065 public: 00066 /** 00067 * Constructor 00068 */ 00069 BadValue(const std::string& option, const std::string& value) throw(); 00070 }; 00071 00072 /** 00073 * Thrown if an argument is specified that needs a parameter, 00074 * but no parameter is given. 00075 * 00076 * \ingroup g_args 00077 * \ingroup g_exceptions 00078 */ 00079 class PALUDIS_VISIBLE MissingValue : 00080 public ArgsError 00081 { 00082 public: 00083 /** 00084 * Constructor. 00085 */ 00086 MissingValue(const std::string & arg) throw (); 00087 }; 00088 } 00089 } 00090 00091 #endif