summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/dimension/error.h2
-rw-r--r--libdimensionxx/Makefile.am2
-rw-r--r--libdimensionxx/dimensionxx/error.hpp8
-rw-r--r--libdimensionxx/error.cpp (renamed from libdimensionxx/geometry.cpp)15
-rw-r--r--tests/pngxx.cpp2
5 files changed, 25 insertions, 4 deletions
diff --git a/libdimension/dimension/error.h b/libdimension/dimension/error.h
index 9fdfdd8..2c00a4a 100644
--- a/libdimension/dimension/error.h
+++ b/libdimension/dimension/error.h
@@ -25,8 +25,6 @@
#ifndef DIMENSION_ERROR_H
#define DIMENSION_ERROR_H
-/* Debug and error handling stuff */
-
typedef enum {
DMNSN_SEVERITY_LOW, /* Only die on low resilience */
DMNSN_SEVERITY_MEDIUM, /* Die on low or medium resilience */
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/geometry.cpp b/libdimensionxx/error.cpp
index 8b90fe9..fce453e 100644
--- a/libdimensionxx/geometry.cpp
+++ b/libdimensionxx/error.cpp
@@ -19,3 +19,18 @@
*************************************************************************/
#include "dimensionxx.hpp"
+
+namespace Dimension
+{
+ Severity
+ resilience()
+ {
+ return static_cast<Severity>(dmnsn_get_resilience());
+ }
+
+ void
+ resilience(Severity resilience)
+ {
+ dmnsn_set_resilience(static_cast<dmnsn_severity>(resilience));
+ }
+}
diff --git a/tests/pngxx.cpp b/tests/pngxx.cpp
index ed7cffd..8dc79b2 100644
--- a/tests/pngxx.cpp
+++ b/tests/pngxx.cpp
@@ -24,7 +24,7 @@
int
main()
{
- dmnsn_set_resilience(DMNSN_SEVERITY_LOW);
+ Dimension::resilience(Dimension::SEVERITY_LOW);
const unsigned int width = 333, height = 300;