Blame cairomm/exception.cc

Packit 908522
/* Copyright (C) 2005 The cairomm Development Team
Packit 908522
 *
Packit 908522
 * This library is free software; you can redistribute it and/or
Packit 908522
 * modify it under the terms of the GNU Library General Public
Packit 908522
 * License as published by the Free Software Foundation; either
Packit 908522
 * version 2 of the License, or (at your option) any later version.
Packit 908522
 *
Packit 908522
 * This library is distributed in the hope that it will be useful,
Packit 908522
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 908522
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 908522
 * Library General Public License for more details.
Packit 908522
 *
Packit 908522
 * You should have received a copy of the GNU Library General Public
Packit 908522
 * License along with this library; if not, write to the Free Software
Packit 908522
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit 908522
 * 02110-1301, USA.
Packit 908522
 */
Packit 908522
Packit 908522
#include <string>
Packit 908522
#include <cairomm/exception.h>
Packit 908522
Packit 908522
namespace Cairo
Packit 908522
{
Packit 908522
Packit 908522
inline static const char* string_or_empty(const char* text)
Packit 908522
{
Packit 908522
  return (text ? text : "");
Packit 908522
}
Packit 908522
Packit 908522
//TODO: Is it wise to assume that the string is ASCII, as expected by std::logic_error?
Packit 908522
logic_error::logic_error(ErrorStatus status)
Packit 908522
: std::logic_error( string_or_empty(cairo_status_to_string((cairo_status_t)status)) ),
Packit 908522
  m_status(status)
Packit 908522
{
Packit 908522
}
Packit 908522
Packit 908522
logic_error::~logic_error() noexcept
Packit 908522
{}
Packit 908522
Packit 908522
ErrorStatus logic_error::get_status_code() const
Packit 908522
{
Packit 908522
  return m_status;
Packit 908522
}
Packit 908522
Packit 908522
/*
Packit 908522
const char* logic_error::what() const noexcept
Packit 908522
{
Packit 908522
  //Hopefully this is a const char* to a static string.
Packit 908522
  return cairo_status_to_string((cairo_status_t)m_status);
Packit 908522
}
Packit 908522
*/
Packit 908522
Packit 908522
} //namespace Cairo
Packit 908522
Packit 908522
// vim: ts=2 sw=2 et