10 #include <boost/lexical_cast.hpp>
43 std::string line_info;
45 line_info = _file +
":" + boost::lexical_cast<std::string>( _line ) +
":" + _fcn;
47 catch (
const boost::bad_lexical_cast& ) {
48 line_info = _file +
":<unknown line number>:" + _fcn;
52 if ( std::string::npos != pos ) {
53 line_info = line_info.substr( pos );
58 char* errno_str =
NULL;
92 if ( !_msg.empty() ) {
105 error::
error( _status, _code, _msg.str(), _file, _line, _fcn ) {}
116 const error& _rhs ) :
118 code_( _rhs.code() ),
137 const error& _rhs ) :
208 std::string tabs =
"";
242 std::string msg = *rit;
245 size_t pos = msg.find( tok );
246 if ( std::string::npos != pos ) {
247 msg = msg.substr( pos+tok.size() );
272 const std::string& file_,
273 const std::string& function_,
274 const std::string& format_,
280 va_start( ap, line_ );
281 const int buffer_size = 4096;
283 vsnprintf(
buffer, buffer_size, format_.c_str(), ap );
285 std::stringstream msg;
287 result =
error(
false, code_, msg.str(), file_, line_, function_ );
293 const error& _prev_error,
294 const std::string& _file,
295 const std::string& _function,
296 const std::string& _format,
299 std::stringstream msg;
300 if ( !_prev_error.
ok() ) {
302 va_start( ap, _line );
303 const int buffer_size = 4096;
305 vsnprintf(
buffer, buffer_size, _format.c_str(), ap );
309 return error( msg.str(), _file, _line, _function, _prev_error );