sbuild-parse-error.h

Go to the documentation of this file.
00001 /* Copyright © 2005-2006  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software; you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00016  * MA  02111-1307  USA
00017  *
00018  *********************************************************************/
00019 
00020 #ifndef SBUILD_PARSE_ERROR_H
00021 #define SBUILD_PARSE_ERROR_H
00022 
00023 #include <sbuild/sbuild-custom-error.h>
00024 #include <sbuild/sbuild-null.h>
00025 
00026 #include <map>
00027 #include <string>
00028 
00029 namespace sbuild
00030 {
00031 
00035   template<typename T>
00036   class parse_error : public error<T>
00037   {
00038   public:
00039     typedef typename error<T>::error_type error_type;
00040 
00047     template<typename A>
00048     parse_error (A const&   context,
00049                  error_type error):
00050       sbuild::error<T>(format_error(context, null(), null(), error, null(), null()))
00051     {
00052     }
00053 
00060     template<typename A>
00061     parse_error (error_type error,
00062                  A const&   detail):
00063       sbuild::error<T>(format_error(null(), null(), null(), error, detail, null()))
00064     {
00065     }
00066 
00074     parse_error (size_t             line,
00075                  error_type         error,
00076                  std::string const& detail):
00077       sbuild::error<T>(format_error(line, null(), null(), error, detail, null()))
00078     {
00079     }
00080 
00089     parse_error (size_t             line,
00090                  std::string const& group,
00091                  error_type         error,
00092                  std::string const& detail):
00093       sbuild::error<T>(format_error(line, group, null(), error, detail, null()))
00094     {
00095     }
00096 
00106     parse_error (size_t             line,
00107                  std::string const& group,
00108                  std::string const& key,
00109                  error_type         error,
00110                  std::string const& detail):
00111       sbuild::error<T>(format_error(line, group, key, error, detail, null()))
00112     {
00113     }
00114 
00122     parse_error (std::string const& group,
00123                  error_type         error,
00124                  std::string const& detail):
00125       sbuild::error<T>(format_error(group, null(), null(), error, detail, null()))
00126     {
00127     }
00128 
00137     parse_error (std::string const& group,
00138                  std::string const& key,
00139                  error_type         error,
00140                  std::string const& detail):
00141       sbuild::error<T>(format_error(group, key, null(), error, detail, null()))
00142     {
00143     }
00144 
00151     template<typename A>
00152     parse_error (A const&                  context,
00153                  std::runtime_error const& error):
00154       sbuild::error<T>(sbuild::error<T>::format_error(context, null(), null(), error, null(), null()))
00155     {
00156     }
00157 
00164     parse_error (size_t                    line,
00165                  std::runtime_error const& error):
00166       sbuild::error<T>(sbuild::error<T>::format_error(line, null(), null(), error, null(), null()))
00167     {
00168     }
00169 
00177     parse_error (size_t                    line,
00178                  std::string const&        group,
00179                  std::runtime_error const& error):
00180       sbuild::error<T>(sbuild::error<T>::format_error(line, group, null(), error, null(), null()))
00181     {
00182     }
00183 
00192     parse_error (size_t                    line,
00193                  std::string const&        group,
00194                  std::string const&        key,
00195                  std::runtime_error const& error):
00196       sbuild::error<T>(sbuild::error<T>::format_error(line, group, key, error, null(), null()))
00197     {
00198     }
00199 
00206     parse_error (std::string const&        group,
00207                  std::runtime_error const& error):
00208       sbuild::error<T>(sbuild::error<T>::format_error(group, null(), null(), error, null(), null()))
00209     {
00210     }
00211 
00219     parse_error (std::string const&        group,
00220                  std::string const&        key,
00221                  std::runtime_error const& error):
00222       sbuild::error<T>(sbuild::error<T>::format_error(group, key, null(), error, null(), null()))
00223     {
00224     }
00225 
00226   };
00227 
00228 }
00229 
00230 #endif /* SBUILD_PARSE_ERROR_H */
00231 
00232 /*
00233  * Local Variables:
00234  * mode:C++
00235  * End:
00236  */

Generated on Fri Jul 14 19:52:17 2006 for schroot by  doxygen 1.4.7