summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-09-22 20:44:13 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-09-22 20:44:13 +0100
commitfa12399b1be92e3645b12787419518a53cb97dae (patch)
treea45962cb789c93ee743aceabba8706ba22f8c556
parentAllow overriding the default slicer/ header prefix (diff)
downloadslicer-fa12399b1be92e3645b12787419518a53cb97dae.tar.bz2
slicer-fa12399b1be92e3645b12787419518a53cb97dae.tar.xz
slicer-fa12399b1be92e3645b12787419518a53cb97dae.zip
Define all exceptions as ICE exceptions
-rw-r--r--slicer/db/Jamfile.jam11
-rw-r--r--slicer/db/exceptions.cpp6
-rw-r--r--slicer/db/exceptions.h14
-rw-r--r--slicer/db/sqlExceptions.ice17
-rw-r--r--slicer/db/sqlInsertSerializer.cpp5
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp7
-rw-r--r--slicer/db/sqlSelectDeserializer.h10
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp5
-rw-r--r--slicer/db/sqlUpdateSerializer.h5
-rw-r--r--slicer/db/testInsert.cpp2
-rw-r--r--slicer/db/testSelect.cpp3
-rw-r--r--slicer/db/testUpdate.cpp3
-rw-r--r--slicer/slicer/Jamfile.jam8
-rw-r--r--slicer/slicer/common.ice32
-rw-r--r--slicer/slicer/modelParts.cpp18
-rw-r--r--slicer/slicer/modelParts.h21
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h3
-rw-r--r--slicer/test/Jamfile.jam2
-rw-r--r--slicer/test/preprocessor.cpp8
-rw-r--r--slicer/test/serializers.cpp9
-rw-r--r--slicer/tool/Jamfile.jam3
-rw-r--r--slicer/tool/parser.cpp20
-rw-r--r--slicer/xml/Jamfile.jam7
-rw-r--r--slicer/xml/serializer.cpp6
-rw-r--r--slicer/xml/serializer.h5
-rw-r--r--slicer/xml/testSpecifics.cpp1
-rw-r--r--slicer/xml/xmlExceptions.ice13
27 files changed, 129 insertions, 115 deletions
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam
index 664b6b1..f73d3f8 100644
--- a/slicer/db/Jamfile.jam
+++ b/slicer/db/Jamfile.jam
@@ -6,17 +6,23 @@ lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
+lib pthread ;
+lib Ice ;
lib IceUtil ;
lib slicer-db :
[ glob *.cpp : test*.cpp ]
+ [ glob *.ice ]
:
<include>..
+ <library>pthread
+ <library>Ice
<library>IceUtil
<library>dbppcore
<library>../..//glibmm
<library>adhocutil
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
: :
<library>dbppcore
;
@@ -28,6 +34,7 @@ run testSelect.cpp
<define>ROOT=\"$(me)\"
<define>BOOST_TEST_DYN_LINK
<library>slicer-db
+ <implicit-dependency>slicer-db
<library>dbpp-postgresql
<library>boost_system
<library>boost_filesystem
@@ -35,6 +42,7 @@ run testSelect.cpp
<library>../test//slicer-test
<library>../test//common
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
<include>..
<dependency>slicer.sql
<dependency>../test//compilation
@@ -54,6 +62,7 @@ run testInsert.cpp
<library>../test//slicer-test
<library>../test//common
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
<include>..
<dependency>slicer.sql
<dependency>../test//compilation
@@ -66,6 +75,7 @@ run testUpdate.cpp
<define>ROOT=\"$(me)\"
<define>BOOST_TEST_DYN_LINK
<library>slicer-db
+ <implicit-dependency>slicer-db
<library>dbpp-postgresql
<library>boost_system
<library>boost_filesystem
@@ -73,6 +83,7 @@ run testUpdate.cpp
<library>../test//slicer-test
<library>../test//common
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
<include>..
<dependency>slicer.sql
<dependency>../test//compilation
diff --git a/slicer/db/exceptions.cpp b/slicer/db/exceptions.cpp
deleted file mode 100644
index 50099bd..0000000
--- a/slicer/db/exceptions.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "exceptions.h"
-
-namespace Slicer {
- UnsupportedModelType::UnsupportedModelType() : std::invalid_argument("Unspported model type") { }
-}
-
diff --git a/slicer/db/exceptions.h b/slicer/db/exceptions.h
deleted file mode 100644
index 8673627..0000000
--- a/slicer/db/exceptions.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SLICER_DB_EXCEPTIONS_H
-#define SLICER_DB_EXCEPTIONS_H
-
-#include <stdexcept>
-
-namespace Slicer {
- class UnsupportedModelType : public std::invalid_argument {
- public:
- UnsupportedModelType();
- };
-}
-
-#endif
-
diff --git a/slicer/db/sqlExceptions.ice b/slicer/db/sqlExceptions.ice
new file mode 100644
index 0000000..a392876
--- /dev/null
+++ b/slicer/db/sqlExceptions.ice
@@ -0,0 +1,17 @@
+#ifndef SLICER_XML
+#define SLICER_XML
+
+#include <common.ice>
+
+module Slicer {
+ exception TooManyRowsReturned extends DeserializerError {};
+ exception NoRowsReturned extends DeserializerError {};
+ exception NoRowsFound extends SerializerError {};
+ exception UnsuitableIdFieldType extends SerializerError {
+ string type;
+ };
+};
+
+#endif
+
+
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index 0ff0038..f5c4c4f 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -1,5 +1,6 @@
#include "sqlInsertSerializer.h"
-#include "exceptions.h"
+#include <common.h>
+#include <sqlExceptions.h>
#include "sqlBinder.h"
#include <buffer.h>
#include <modifycommand.h>
@@ -65,7 +66,7 @@ namespace Slicer {
}
#define NonNumType(T) \
- void set(T &) const override { throw std::runtime_error("Can't store Id in " #T " type field"); }
+ void set(T &) const override { throw UnsuitableIdFieldType(#T); }
#define NumType(T) \
void set(T & v) const override { v = boost::numeric_cast<T>(connection->insertId()); }
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index 7836c63..5e32f75 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -1,13 +1,10 @@
#include "sqlSelectDeserializer.h"
#include "sqlSource.h"
-#include "exceptions.h"
+#include <sqlExceptions.h>
+#include <common.h>
#include <boost/algorithm/string/predicate.hpp>
namespace Slicer {
- NoRowsReturned::NoRowsReturned() : std::runtime_error("No rows returned") { }
-
- TooManyRowsReturned::TooManyRowsReturned() : std::runtime_error("Too many rows returned") { }
-
SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand & c, IceUtil::Optional<std::string> tc) :
cmd(c),
typeIdColName(tc)
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index 3d73c94..c520090 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -6,16 +6,6 @@
#include <visibility.h>
namespace Slicer {
- class NoRowsReturned : public std::runtime_error {
- public:
- NoRowsReturned();
- };
-
- class TooManyRowsReturned : public std::runtime_error {
- public:
- TooManyRowsReturned();
- };
-
class DLL_PUBLIC SqlSelectDeserializer : public Slicer::Deserializer {
public:
SqlSelectDeserializer(DB::SelectCommand &, IceUtil::Optional<std::string> typeIdCol = IceUtil::Optional<std::string>());
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index 65889ab..867b9fb 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -1,13 +1,12 @@
#include "sqlUpdateSerializer.h"
-#include "exceptions.h"
+#include <sqlExceptions.h>
+#include <common.h>
#include "sqlBinder.h"
#include <buffer.h>
#include <modifycommand.h>
#include <slicer/metadata.h>
namespace Slicer {
- NoRowsFound::NoRowsFound() : std::runtime_error("No rows found") { }
-
const std::string md_pkey = "db:pkey";
SqlUpdateSerializer::SqlUpdateSerializer(DB::Connection * const c, const std::string & t) :
diff --git a/slicer/db/sqlUpdateSerializer.h b/slicer/db/sqlUpdateSerializer.h
index cbd8d65..83a5e04 100644
--- a/slicer/db/sqlUpdateSerializer.h
+++ b/slicer/db/sqlUpdateSerializer.h
@@ -6,11 +6,6 @@
#include <visibility.h>
namespace Slicer {
- class NoRowsFound : public std::runtime_error {
- public:
- NoRowsFound();
- };
-
class DLL_PUBLIC SqlUpdateSerializer : public Slicer::Serializer {
public:
typedef boost::shared_ptr<DB::ModifyCommand> ModifyPtr;
diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp
index e2118b8..ef37e66 100644
--- a/slicer/db/testInsert.cpp
+++ b/slicer/db/testInsert.cpp
@@ -7,7 +7,7 @@
#include "sqlInsertSerializer.h"
#include "sqlSelectDeserializer.h"
#include <types.h>
-#include "exceptions.h"
+#include <common.h>
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime);
diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp
index 6cade1d..c1e2121 100644
--- a/slicer/db/testSelect.cpp
+++ b/slicer/db/testSelect.cpp
@@ -6,7 +6,8 @@
#include <definedDirs.h>
#include "sqlSelectDeserializer.h"
#include <types.h>
-#include "exceptions.h"
+#include <common.h>
+#include <sqlExceptions.h>
class StandardMockDatabase : public PQ::Mock {
public:
diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp
index 159cb5e..1bf917e 100644
--- a/slicer/db/testUpdate.cpp
+++ b/slicer/db/testUpdate.cpp
@@ -8,7 +8,8 @@
#include "sqlSelectDeserializer.h"
#include "sqlUpdateSerializer.h"
#include <types.h>
-#include "exceptions.h"
+#include <common.h>
+#include <sqlExceptions.h>
class StandardMockDatabase : public PQ::Mock {
public:
diff --git a/slicer/slicer/Jamfile.jam b/slicer/slicer/Jamfile.jam
index 7def868..d6fc70f 100644
--- a/slicer/slicer/Jamfile.jam
+++ b/slicer/slicer/Jamfile.jam
@@ -1,15 +1,23 @@
+lib pthread ;
+lib Ice ;
lib IceUtil ;
lib boost_system ;
+lib boost_filesystem ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer :
[ glob *.cpp ]
+ [ glob *.ice ]
:
+ <library>pthread
+ <library>Ice
<library>IceUtil
<library>boost_system
<library>adhocutil
<include>..
: :
<include>..
+ <include>.
<library>boost_system
+ <library>boost_filesystem
;
diff --git a/slicer/slicer/common.ice b/slicer/slicer/common.ice
new file mode 100644
index 0000000..5d87d0a
--- /dev/null
+++ b/slicer/slicer/common.ice
@@ -0,0 +1,32 @@
+#ifndef SLICER
+#define SLICER
+
+module Slicer {
+ exception CompilerError {
+ string what;
+ };
+ exception RuntimeError { };
+ exception SerializerError extends RuntimeError { };
+ exception DeserializerError extends RuntimeError { };
+ exception IncorrectElementName extends DeserializerError {
+ string name;
+ };
+ exception UnsupportedModelType extends RuntimeError { };
+ exception NoConversionFound extends RuntimeError {
+ string type;
+ };
+ exception UnknownType extends DeserializerError {
+ string type;
+ };
+ exception InvalidEnumerationValue extends SerializerError {
+ int value;
+ string type;
+ };
+ exception InvalidEnumerationSymbol extends DeserializerError {
+ string symbol;
+ string type;
+ };
+};
+
+#endif
+
diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp
index 2e144fa..b53997e 100644
--- a/slicer/slicer/modelParts.cpp
+++ b/slicer/slicer/modelParts.cpp
@@ -4,24 +4,6 @@
namespace Slicer {
const Metadata emptyMetadata;
- IncorrectElementName::IncorrectElementName(const std::string & n) :
- std::invalid_argument(n)
- {
- }
-
- UnknownType::UnknownType(const std::string & n) :
- std::invalid_argument(n)
- {
- }
- InvalidEnumerationValue::InvalidEnumerationValue(const std::string & n, const std::string & e) :
- std::invalid_argument("No such value '" + n + "' in " + e) { }
-
- InvalidEnumerationValue::InvalidEnumerationValue(::Ice::Int n, const std::string & e) :
- std::invalid_argument("Invalid value " + boost::lexical_cast<std::string>(n) + " in " + e) { }
-
- NoConversionFound::NoConversionFound(const std::string & n) :
- std::runtime_error("Could not convert to/from model for type " + n) { }
-
ClassNameMap * &
classNameMap()
{
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 3533cc7..c9a0995 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -22,27 +22,6 @@ namespace Slicer {
return p.get();
}
- class DLL_PUBLIC IncorrectElementName : public std::invalid_argument {
- public:
- IncorrectElementName(const std::string & n);
- };
-
- class DLL_PUBLIC UnknownType : public std::invalid_argument {
- public:
- UnknownType(const std::string & n);
- };
-
- class DLL_PUBLIC InvalidEnumerationValue : public std::invalid_argument {
- public:
- InvalidEnumerationValue(const std::string & n, const std::string & e);
- InvalidEnumerationValue(::Ice::Int n, const std::string & e);
- };
-
- class DLL_PUBLIC NoConversionFound : public std::runtime_error {
- public:
- NoConversionFound(const std::string & n);
- };
-
template <typename T>
class TValueTarget {
public:
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index d598bbf..2c9e20f 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -2,6 +2,7 @@
#define SLICER_MODELPARTSTYPES_IMPL_H
#include "modelPartsTypes.h"
+#include <common.h>
#define MODELPARTFOR(Type, ModelPartType) \
template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return new ModelPartType<Type>(s); } \
@@ -325,7 +326,7 @@ namespace Slicer {
{
auto i = enumerations.right.find(val);
if (i == enumerations.right.end()) {
- throw InvalidEnumerationValue(val, typeid(T).name());
+ throw InvalidEnumerationSymbol(val, typeid(T).name());
}
return i->second;
}
diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam
index b6e2834..253ab2b 100644
--- a/slicer/test/Jamfile.jam
+++ b/slicer/test/Jamfile.jam
@@ -84,8 +84,8 @@ run serializers.cpp
<dependency>preprocess
<library>slicer-test
<library>common
- <include>..
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
<library>../xml//slicer-xml
<library>../json//slicer-json
:
diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp
index 3eb50f6..b715d50 100644
--- a/slicer/test/preprocessor.cpp
+++ b/slicer/test/preprocessor.cpp
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE( slicer_test_ice )
BOOST_TEST_CHECKPOINT("cpp: " << cpp);
fs::remove(cpp);
const std::string doslice = stringbf(
- "%s -I%s %s %s",
+ "%s -I%s --headerPrefix='\"\"' %s %s",
root.parent_path() / "tool" / bjamout / "slicer",
included,
slice, cpp);
@@ -78,11 +78,13 @@ BOOST_AUTO_TEST_CASE( slicer_test_ice )
const fs::path obj = fs::change_extension(tmp / base, ".o");
const std::string compile = stringbf(
- "g++ -Os -fPIC -c -std=c++1y -fvisibility=hidden -I tmp -I /usr/include/adhocutil -I /usr/include/Ice -I /usr/include/IceUtil -I %s -I %s -I %s -I %s %s -o %s",
+ "g++ -Os -fPIC -c -std=c++1y -fvisibility=hidden -I%s -I tmp -I /usr/include/adhocutil -I /usr/include/Ice -I /usr/include/IceUtil -I %s -I %s -I %s -I %s -I %s %s -o %s",
+ root.parent_path() / "slicer",
root / bjamout,
root,
included / bjamout,
- root / "..",
+ root.parent_path(),
+ root.parent_path() / "slicer" / bjamout,
cpp, obj);
BOOST_TEST_CHECKPOINT("compile: " << compile);
system(compile);
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 8f569d8..9c4b406 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -2,8 +2,9 @@
#include <boost/test/unit_test.hpp>
#include <tool/parser.h>
-#include <slicer/slicer.h>
-#include <slicer/modelParts.h>
+#include <common.h>
+#include <slicer.h>
+#include <modelParts.h>
#include <xml/serializer.h>
#include <libxml2/libxml/parser.h>
#include <json/serializer.h>
@@ -493,10 +494,10 @@ BOOST_AUTO_TEST_CASE( xml_streams )
BOOST_AUTO_TEST_CASE( invalid_enum )
{
Slicer::DeserializerPtr jdeserializer = new Slicer::JsonFileDeserializer(root / "initial" / "invalidEnum.json");
- BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(jdeserializer), Slicer::InvalidEnumerationValue);
+ BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(jdeserializer), Slicer::InvalidEnumerationSymbol);
Slicer::DeserializerPtr xdeserializer = new Slicer::XmlFileDeserializer(root / "initial" / "invalidEnum.xml");
- BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(xdeserializer), Slicer::InvalidEnumerationValue);
+ BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(xdeserializer), Slicer::InvalidEnumerationSymbol);
}
BOOST_AUTO_TEST_SUITE_END();
diff --git a/slicer/tool/Jamfile.jam b/slicer/tool/Jamfile.jam
index d34828c..5362382 100644
--- a/slicer/tool/Jamfile.jam
+++ b/slicer/tool/Jamfile.jam
@@ -1,4 +1,5 @@
lib Slice ;
+lib Ice ;
lib IceUtil ;
lib po : : <name>boost_program_options ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
@@ -9,11 +10,13 @@ lib slicer-compiler :
parser.cpp
:
<library>Slice
+ <library>Ice
<library>IceUtil
<library>boost_system
<library>boost_filesystem
<library>adhocutil
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
<include>..
: :
<include>..
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index d6cb6c0..1144391 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -1,5 +1,6 @@
#include "parser.h"
-#include <slicer/metadata.h>
+#include <metadata.h>
+#include <common.h>
#include <Slice/Parser.h>
#include <Slice/Preprocessor.h>
#include <boost/algorithm/string/predicate.hpp>
@@ -118,7 +119,8 @@ namespace Slicer {
fprintbf(cpp, "// Begin Slicer code\n\n");
fprintbf(cpp, "#include <%s>\n\n", fs::change_extension(topLevelFile.filename(), ".h").string());
- fprintbf(cpp, "#include <%s>\n\n", (headerPrefix / "modelPartsTypes.impl.h").string());
+ fprintbf(cpp, "#include <%s>\n", (headerPrefix / "modelPartsTypes.impl.h").string());
+ fprintbf(cpp, "#include <%s>\n\n", (headerPrefix / "common.h").string());
fprintbf(cpp, "namespace Slicer {\n");
return true;
}
@@ -391,7 +393,7 @@ namespace Slicer {
s->scoped());
auto iname = metaDataValue("slicer:item:", s->getMetaData());
if (iname) {
- fprintbf(cpp, "\tif (!name.empty() && name != \"%s\") { throw IncorrectElementName(); }\n",
+ fprintbf(cpp, "\tif (!name.empty() && name != \"%s\") { throw IncorrectElementName(name); }\n",
*iname);
}
else {
@@ -562,7 +564,7 @@ namespace Slicer {
for (const auto & conversion : conversions) {
auto split = metaDataSplit(conversion);
if (split.size() < 3) {
- throw std::runtime_error("conversion needs at least 3 parts type:toModelFunc:toExchangeFunc[:options]");
+ throw CompilerError("conversion needs at least 3 parts type:toModelFunc:toExchangeFunc[:options]");
}
for (auto & pi : {0, 1, 2}) {
boost::algorithm::replace_all(split[pi], ".", "::");
@@ -582,13 +584,13 @@ namespace Slicer {
Slicer::Execute()
{
if (cpp != NULL && !cppPath.empty()) {
- throw std::runtime_error("Both file handle and path provided.");
+ throw CompilerError("Both file handle and path provided.");
}
FilePtr cppfile(
cpp || cppPath.empty() ? cpp : fopen(cppPath.string(), "a"),
cppPath.empty() ? fflush : fclose);
if (!cppfile && !cppPath.empty()) {
- throw std::runtime_error("Failed to open output file");
+ throw CompilerError("Failed to open output file");
}
cpp = cppfile.get();
Slicer::Slicer::Args args;
@@ -601,7 +603,7 @@ namespace Slicer {
FILE * cppHandle = icecpp->preprocess(false);
if (cppHandle == NULL) {
- throw std::runtime_error("preprocess failed");
+ throw CompilerError("preprocess failed");
}
Slice::UnitPtr u = Slice::Unit::createUnit(false, false, allowIcePrefix, false);
@@ -609,11 +611,11 @@ namespace Slicer {
int parseStatus = u->parse(slicePath.string(), cppHandle, false);
if (!icecpp->close()) {
- throw std::runtime_error("preprocess close failed");
+ throw CompilerError("preprocess close failed");
}
if (parseStatus == EXIT_FAILURE) {
- throw std::runtime_error("unit parse failed");
+ throw CompilerError("unit parse failed");
}
u->visit(this, false);
diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam
index 76b97af..28e8aab 100644
--- a/slicer/xml/Jamfile.jam
+++ b/slicer/xml/Jamfile.jam
@@ -1,4 +1,6 @@
import testing ;
+lib pthread ;
+lib Ice ;
lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
@@ -7,14 +9,18 @@ lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer-xml :
[ glob *.cpp : test*.cpp ]
+ [ glob *.ice ]
:
<include>..
<library>boost_system
<library>boost_filesystem
+ <library>pthread
+ <library>Ice
<library>IceUtil
<library>../..//libxmlpp
<library>adhocutil
<library>../slicer//slicer
+ <implicit-dependency>../slicer//slicer
: :
<library>../..//libxmlpp
;
@@ -23,6 +29,7 @@ run testSpecifics.cpp
: : :
<define>BOOST_TEST_DYN_LINK
<library>slicer-xml
+ <implicit-dependency>slicer-xml
<library>boost_utf
<library>../test//slicer-test
<library>../test//common
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index c6c6c5f..c1e4023 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -1,4 +1,5 @@
#include "serializer.h"
+#include <xmlExceptions.h>
#include <slicer/metadata.h>
#include <libxml++/document.h>
#include <libxml++/parsers/domparser.h>
@@ -19,11 +20,6 @@ namespace Slicer {
const std::string md_bare = "xml:bare";
const auto defaultElementCreator = boost::bind(&xmlpp::Element::add_child, _1, _2, Glib::ustring());
- BadBooleanValue::BadBooleanValue(const Glib::ustring &) :
- std::invalid_argument("Bad boolean value")
- {
- }
-
static const Glib::ustring TrueText("true");
static const Glib::ustring FalseText("false");
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index 054b308..cdb20f5 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -6,11 +6,6 @@
#include <visibility.h>
namespace Slicer {
- class BadBooleanValue : public std::invalid_argument {
- public:
- BadBooleanValue(const Glib::ustring &);
- };
-
class DLL_PUBLIC XmlSerializer : public Serializer {
protected:
typedef boost::function<xmlpp::Element *(xmlpp::Element *, const Glib::ustring &)> ElementCreator;
diff --git a/slicer/xml/testSpecifics.cpp b/slicer/xml/testSpecifics.cpp
index 001cfb0..d20ea09 100644
--- a/slicer/xml/testSpecifics.cpp
+++ b/slicer/xml/testSpecifics.cpp
@@ -4,6 +4,7 @@
#include "serializer.h"
#include <libxml++/parsers/domparser.h>
#include <types.h>
+#include <xmlExceptions.h>
template <typename T, typename ... P>
T
diff --git a/slicer/xml/xmlExceptions.ice b/slicer/xml/xmlExceptions.ice
new file mode 100644
index 0000000..e03fbe7
--- /dev/null
+++ b/slicer/xml/xmlExceptions.ice
@@ -0,0 +1,13 @@
+#ifndef SLICER_XML
+#define SLICER_XML
+
+#include <common.ice>
+
+module Slicer {
+ exception BadBooleanValue extends DeserializerError {
+ string text;
+ };
+};
+
+#endif
+