Ticket #580: implement-error-clone.patch
File implement-error-clone.patch, 2.0 KB (added by , 13 years ago) |
---|
-
generate-exceptions
139 139 */ 140 140 const char * get_error_string() const; 141 141 142 /** Allocate and return a copy of this object. */ 143 Xapian::Error * clone() const; 144 142 145 /// Return a string describing this object. 143 146 std::string get_description() const; 144 147 }; … … 153 156 154 157 // DOXYGEN gets confused by this header-with-code. 155 158 #ifndef DOXYGEN 159 160 // You must define XAPIAN_DISPATCH_ERROR(CLASS) before including this file. 161 156 162 EOF 157 163 158 164 for (@baseclasses) { … … 183 189 my ($class, $parent, $comment) = split /\t/, $_, 3; 184 190 my $code = sprintf('\%03o', $classcode{$class}); 185 191 186 print DISPATCH "case '$code': throw Xapian::$class(msg, context, error_string);\n";192 print DISPATCH "case '$code': XAPIAN_DISPATCH_ERROR($class)\n"; 187 193 188 194 print HDR <<EOF; 189 195 -
net/serialise.cc
109 109 } 110 110 111 111 switch (type) { 112 #define XAPIAN_DISPATCH_ERROR(CLASS) throw Xapian::CLASS(msg, context, error_string); 112 113 #include "xapian/errordispatch.h" 113 114 } 114 115 } -
api/error.cc
32 32 #include <cstdio> // For sprintf(). 33 33 #include <cstring> // For strerror(). 34 34 35 #include "omassert.h" 35 36 #include "str.h" 36 37 37 38 using namespace std; … … 103 104 #endif 104 105 } 105 106 107 Xapian::Error * 108 Xapian::Error::clone() const 109 { 110 switch (*type) { 111 #define XAPIAN_DISPATCH_ERROR(CLASS) \ 112 return new Xapian::CLASS(static_cast<const Xapian::CLASS &>(*this)); 113 #include "xapian/errordispatch.h" 114 } 115 Assert(false); 116 return NULL; // FIXME: Shouldn't get here! 117 } 118 106 119 string 107 120 Xapian::Error::get_description() const 108 121 {