assert: simplify header

This commit is contained in:
Maxime Coste 2012-10-17 17:01:08 +02:00
parent 4aa3a36102
commit c1387dc592
2 changed files with 12 additions and 21 deletions

View File

@ -1,21 +1,23 @@
#include "assert.hh" #include "assert.hh"
#include "exception.hh"
namespace Kakoune namespace Kakoune
{ {
assert_failed::assert_failed(const String& message) struct assert_failed : logic_error
{ {
m_message = message; assert_failed(const String& message)
} : m_message(message) {}
String assert_failed::description() const String description() const override { return m_message; }
{ private:
return m_message; String m_message;
} };
void on_assert_failed(const String& message) void on_assert_failed(const char* message)
{ {
int res = system(("xmessage -buttons 'quit:0,ignore:1' '" + message + "'").c_str()); int res = system(("xmessage -buttons 'quit:0,ignore:1' '"_str + message + "'").c_str());
switch (res) switch (res)
{ {
case 0: case 0:

View File

@ -1,21 +1,10 @@
#ifndef assert_hh_INCLUDED #ifndef assert_hh_INCLUDED
#define assert_hh_INCLUDED #define assert_hh_INCLUDED
#include "exception.hh"
namespace Kakoune namespace Kakoune
{ {
struct assert_failed : logic_error void on_assert_failed(const char* message);
{
assert_failed(const String& message);
String description() const override;
private:
String m_message;
};
void on_assert_failed(const String& message);
} }