lemon/error.h
changeset 209 765619b7cbb2
parent 108 889d0c289d19
child 212 1ae84dea7d09
     1.1 --- a/lemon/error.h	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/lemon/error.h	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -45,39 +45,39 @@
    1.13  
    1.14      ExceptionMember() throw() {
    1.15        try {
    1.16 -	ptr.reset(new Type());
    1.17 +        ptr.reset(new Type());
    1.18        } catch (...) {}
    1.19      }
    1.20  
    1.21      ExceptionMember(const Type& type) throw() {
    1.22        try {
    1.23 -	ptr.reset(new Type());
    1.24 -	if (ptr.get() == 0) return;
    1.25 -	*ptr = type;
    1.26 +        ptr.reset(new Type());
    1.27 +        if (ptr.get() == 0) return;
    1.28 +        *ptr = type;
    1.29        } catch (...) {}
    1.30      }
    1.31  
    1.32      ExceptionMember(const ExceptionMember& copy) throw() {
    1.33        try {
    1.34 -	if (!copy.valid()) return;
    1.35 -	ptr.reset(new Type());
    1.36 -	if (ptr.get() == 0) return;
    1.37 -	*ptr = copy.get();
    1.38 +        if (!copy.valid()) return;
    1.39 +        ptr.reset(new Type());
    1.40 +        if (ptr.get() == 0) return;
    1.41 +        *ptr = copy.get();
    1.42        } catch (...) {}
    1.43      }
    1.44  
    1.45      ExceptionMember& operator=(const ExceptionMember& copy) throw() {
    1.46        if (ptr.get() == 0) return;
    1.47        try {
    1.48 -	if (!copy.valid()) return;
    1.49 - 	*ptr = copy.get();
    1.50 +        if (!copy.valid()) return;
    1.51 +         *ptr = copy.get();
    1.52        } catch (...) {}
    1.53      }
    1.54  
    1.55      void set(const Type& type) throw() {
    1.56        if (ptr.get() == 0) return;
    1.57        try {
    1.58 -	*ptr = type;
    1.59 +        *ptr = type;
    1.60        } catch (...) {}
    1.61      }
    1.62  
    1.63 @@ -109,10 +109,10 @@
    1.64      ///\e
    1.65      bool init() throw() {
    1.66        try {
    1.67 -	buf.reset(new std::ostringstream);
    1.68 +        buf.reset(new std::ostringstream);
    1.69        }
    1.70        catch(...) {
    1.71 -	buf.reset();
    1.72 +        buf.reset();
    1.73        }
    1.74        return buf.get();
    1.75      }
    1.76 @@ -142,10 +142,10 @@
    1.77        if( ! buf.get() ) return *this;
    1.78  
    1.79        try {
    1.80 -	*buf << t;
    1.81 +        *buf << t;
    1.82        }
    1.83        catch(...) {
    1.84 -	buf.reset();
    1.85 +        buf.reset();
    1.86        }
    1.87        return *this;
    1.88      }
    1.89 @@ -156,7 +156,7 @@
    1.90  
    1.91        const char* mes = 0;
    1.92        try {
    1.93 -	mes = buf->str().c_str();
    1.94 +        mes = buf->str().c_str();
    1.95        }
    1.96        catch(...) {}
    1.97        return mes;
    1.98 @@ -254,7 +254,7 @@
    1.99  
   1.100      ///\e
   1.101      DataFormatError(const std::string &file_name, int line_num,
   1.102 -		    const char *the_message)
   1.103 +                    const char *the_message)
   1.104        : _message(the_message), _line(line_num) { file(file_name); }
   1.105  
   1.106      ///\e
   1.107 @@ -269,9 +269,9 @@
   1.108      ///\e
   1.109      const char* message() const {
   1.110        if (_message.valid() && !_message.get().empty()) {
   1.111 -	return _message.get().c_str();
   1.112 +        return _message.get().c_str();
   1.113        } else {
   1.114 -	return 0;
   1.115 +        return 0;
   1.116        }
   1.117      }
   1.118  
   1.119 @@ -280,26 +280,26 @@
   1.120      /// Returns \e null if the filename was not specified.
   1.121      const char* file() const {
   1.122        if (_file.valid() && !_file.get().empty()) {
   1.123 -	return _file.get().c_str();
   1.124 +        return _file.get().c_str();
   1.125        } else {
   1.126 -	return 0;
   1.127 +        return 0;
   1.128        }
   1.129      }
   1.130  
   1.131      ///\e
   1.132      virtual const char* what() const throw() {
   1.133        try {
   1.134 -	std::ostringstream ostr;
   1.135 -	ostr << "lemon:DataFormatError" << ": ";
   1.136 -	if (message()) ostr << message();
   1.137 -	if( file() || line() != 0 ) {
   1.138 -	  ostr << " (";
   1.139 -	  if( file() ) ostr << "in file '" << file() << "'";
   1.140 -	  if( file() && line() != 0 ) ostr << " ";
   1.141 -	  if( line() != 0 ) ostr << "at line " << line();
   1.142 -	  ostr << ")";
   1.143 -	}
   1.144 -	_message_holder.set(ostr.str());
   1.145 +        std::ostringstream ostr;
   1.146 +        ostr << "lemon:DataFormatError" << ": ";
   1.147 +        if (message()) ostr << message();
   1.148 +        if( file() || line() != 0 ) {
   1.149 +          ostr << " (";
   1.150 +          if( file() ) ostr << "in file '" << file() << "'";
   1.151 +          if( file() && line() != 0 ) ostr << " ";
   1.152 +          if( line() != 0 ) ostr << "at line " << line();
   1.153 +          ostr << ")";
   1.154 +        }
   1.155 +        _message_holder.set(ostr.str());
   1.156        }
   1.157        catch (...) {}
   1.158        if( _message_holder.valid()) return _message_holder.get().c_str();
   1.159 @@ -333,19 +333,19 @@
   1.160      /// Returns \e null if the filename was not specified.
   1.161      const char* file() const {
   1.162        if (_file.valid() && !_file.get().empty()) {
   1.163 -	return _file.get().c_str();
   1.164 +        return _file.get().c_str();
   1.165        } else {
   1.166 -	return 0;
   1.167 +        return 0;
   1.168        }
   1.169      }
   1.170  
   1.171      ///\e
   1.172      virtual const char* what() const throw() {
   1.173        try {
   1.174 -	std::ostringstream ostr;
   1.175 -	ostr << "lemon::FileOpenError" << ": ";
   1.176 -	ostr << "Cannot open file - " << file();
   1.177 -	_message_holder.set(ostr.str());
   1.178 +        std::ostringstream ostr;
   1.179 +        ostr << "lemon::FileOpenError" << ": ";
   1.180 +        ostr << "Cannot open file - " << file();
   1.181 +        _message_holder.set(ostr.str());
   1.182        }
   1.183        catch (...) {}
   1.184        if( _message_holder.valid()) return _message_holder.get().c_str();
   1.185 @@ -381,9 +381,9 @@
   1.186       ///\e
   1.187      const char* message() const {
   1.188        if (_message.valid()) {
   1.189 -	return _message.get().c_str();
   1.190 +        return _message.get().c_str();
   1.191        } else {
   1.192 -	return 0;
   1.193 +        return 0;
   1.194        }
   1.195      }
   1.196  
   1.197 @@ -392,19 +392,19 @@
   1.198      /// Returns \c 0 if the filename was not specified.
   1.199      const char* file() const {
   1.200        if (_file.valid()) {
   1.201 -	return _file.get().c_str();
   1.202 +        return _file.get().c_str();
   1.203        } else {
   1.204 -	return 0;
   1.205 +        return 0;
   1.206        }
   1.207      }
   1.208  
   1.209      ///\e
   1.210      virtual const char* what() const throw() {
   1.211        try {
   1.212 -	std::ostringstream ostr;
   1.213 -	if (message()) ostr << message();
   1.214 -	if (file()) ostr << "(when reading file '" << file() << "')";
   1.215 -	_message_holder.set(ostr.str());
   1.216 +        std::ostringstream ostr;
   1.217 +        if (message()) ostr << message();
   1.218 +        if (file()) ostr << "(when reading file '" << file() << "')";
   1.219 +        _message_holder.set(ostr.str());
   1.220        }
   1.221        catch (...) {}
   1.222        if( _message_holder.valid() ) return _message_holder.get().c_str();