From 6cfdbf44cce0b0881d1811e7ec06c4e79e637c96 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 12 Apr 2009 17:06:48 +0000 Subject: Write C++ error handling wrapper. --- libdimensionxx/Makefile.am | 2 +- libdimensionxx/dimensionxx/error.hpp | 8 ++++++++ libdimensionxx/error.cpp | 36 ++++++++++++++++++++++++++++++++++++ libdimensionxx/geometry.cpp | 21 --------------------- 4 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 libdimensionxx/error.cpp delete mode 100644 libdimensionxx/geometry.cpp (limited to 'libdimensionxx') diff --git a/libdimensionxx/Makefile.am b/libdimensionxx/Makefile.am index da8f544..143ab83 100644 --- a/libdimensionxx/Makefile.am +++ b/libdimensionxx/Makefile.am @@ -23,6 +23,6 @@ INCLUDES = -I../libdimension -I../libdimension-png lib_LTLIBRARIES = libdimensionxx.la -libdimensionxx_la_SOURCES = $(nobase_include_HEADERS) canvas.cpp color.cpp cookie.cpp geometry.cpp png.cpp +libdimensionxx_la_SOURCES = $(nobase_include_HEADERS) canvas.cpp color.cpp cookie.cpp error.cpp png.cpp libdimensionxx_la_LDFLAGS = -version-info 0:0:0 libdimensionxx_la_LIBADD = ../libdimension/libdimension.la ../libdimension-png/libdimension-png.la diff --git a/libdimensionxx/dimensionxx/error.hpp b/libdimensionxx/dimensionxx/error.hpp index a6a4ca6..072949f 100644 --- a/libdimensionxx/dimensionxx/error.hpp +++ b/libdimensionxx/dimensionxx/error.hpp @@ -25,6 +25,14 @@ namespace Dimension { + enum Severity { + SEVERITY_LOW = DMNSN_SEVERITY_LOW, + SEVERITY_MEDIUM = DMNSN_SEVERITY_MEDIUM, + SEVERITY_HIGH = DMNSN_SEVERITY_HIGH + }; + + Severity resilience(); + void resilience(Severity resilience); } #endif /* DIMENSIONXX_ERROR_HPP */ diff --git a/libdimensionxx/error.cpp b/libdimensionxx/error.cpp new file mode 100644 index 0000000..fce453e --- /dev/null +++ b/libdimensionxx/error.cpp @@ -0,0 +1,36 @@ +/************************************************************************* + * Copyright (C) 2008 Tavian Barnes * + * * + * This file is part of The Dimension Library. * + * * + * The Dimension Library is free software; you can redistribute it and/ * + * or modify it under the terms of the GNU Lesser General Public License * + * as published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * The Dimension Library is distributed in the hope that it will be * + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this program. If not, see * + * . * + *************************************************************************/ + +#include "dimensionxx.hpp" + +namespace Dimension +{ + Severity + resilience() + { + return static_cast(dmnsn_get_resilience()); + } + + void + resilience(Severity resilience) + { + dmnsn_set_resilience(static_cast(resilience)); + } +} diff --git a/libdimensionxx/geometry.cpp b/libdimensionxx/geometry.cpp deleted file mode 100644 index 8b90fe9..0000000 --- a/libdimensionxx/geometry.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/************************************************************************* - * Copyright (C) 2008 Tavian Barnes * - * * - * This file is part of The Dimension Library. * - * * - * The Dimension Library is free software; you can redistribute it and/ * - * or modify it under the terms of the GNU Lesser General Public License * - * as published by the Free Software Foundation; either version 3 of the * - * License, or (at your option) any later version. * - * * - * The Dimension Library is distributed in the hope that it will be * - * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this program. If not, see * - * . * - *************************************************************************/ - -#include "dimensionxx.hpp" -- cgit v1.2.3