Commit f324ac98 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED throw std::exception is better

+ added some comments about why testapplications are in a separated directory
parent 97174740
......@@ -97,6 +97,12 @@ set(SHIBOKEN_CAMITK_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
camitk_parse_test_init()
# add all subprojects, in dependencies order
#
# Note: testapplications are easier to manage if they are in a separate directory
# As testapplications are required to test actions and components but depends on library core,
# it is easier to keep them in a separate (specific) folder.
# -> dependencies are satisfied (thanks to camitk_extension macros
# -> parallel build is not broken
camitk_add_subdirectory(libraries)
camitk_add_subdirectory(testapplications)
camitk_add_subdirectory(components)
......
......@@ -47,12 +47,11 @@
using namespace cepcoreschema;
ActionExtensionGenerator::ActionExtensionGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence) throw (QString)
ActionExtensionGenerator::ActionExtensionGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence)
: ExtensionGenerator(actionExtensionsDirectory, licence, "Action") {
QFileInfo xmlFile(xmlFileName);
if ((! xmlFile.exists()) || (! xmlFile.isFile())) {
QString msg = "Exception from ActionExtension generation: \n The file " + xmlFileName + " does not exist or is not a file...\n";
throw (msg);
throw std::invalid_argument("I/O exception during action extension file generation:\nFile " + xmlFileName.toStdString() + " does not exist or is not a file...\n");
}
try {
std::string xmlFileStr = xmlFileName.toStdString();
......@@ -60,8 +59,7 @@ ActionExtensionGenerator::ActionExtensionGenerator(QString xmlFileName, QString
createFromDom(*domActionExtension);
}
catch (...) {
QString msg = "Action extension XML file not valid.";
throw msg;
throw std::invalid_argument("I/O exception during action extension file generation:\nFile " + xmlFileName.toStdString() + " is not valid...\n");
}
}
......
......@@ -49,7 +49,7 @@ class ActionGenerator;
class ActionExtensionGenerator : public ExtensionGenerator {
public:
ActionExtensionGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence = "") throw (QString);
ActionExtensionGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence = "");
ActionExtensionGenerator(cepcoreschema::ActionExtension& domActionExtension, QString actionExtensionsDirectory, QString licence = "");
~ActionExtensionGenerator();
......
......@@ -58,7 +58,7 @@ public:
delayed
};
ActionGenerator(QString xmlFileName, QString licence) throw (QString);
ActionGenerator(QString xmlFileName, QString licence);
ActionGenerator(cepcoreschema::Action& domAction, QString licence);
~ActionGenerator();
......
......@@ -46,12 +46,11 @@
using namespace cepcoreschema;
ComponentExtensionGenerator::ComponentExtensionGenerator(QString xmlFileName, QString componentExtensionsDirectory, QString licence) throw (QString)
ComponentExtensionGenerator::ComponentExtensionGenerator(QString xmlFileName, QString componentExtensionsDirectory, QString licence)
: ExtensionGenerator(componentExtensionsDirectory, licence, "Component") {
QFileInfo xmlFile(xmlFileName);
if ((! xmlFile.exists()) || (! xmlFile.isFile())) {
QString msg = "Exception from ComponentExtension generation: \n The file " + xmlFileName + " does not exist or is not a file...\n";
throw (msg);
throw std::invalid_argument("I/O exception during component extension file generation:\nFile " + xmlFileName.toStdString() + " does not exist or is not a file...\n");
}
try {
std::string xmlFileStr = xmlFileName.toStdString();
......@@ -59,8 +58,7 @@ ComponentExtensionGenerator::ComponentExtensionGenerator(QString xmlFileName, QS
createFromDom(*domComponentExtension);
}
catch (...) {
QString msg = "Component extension XML file not valid.";
throw msg;
throw std::invalid_argument("I/O exception during component extension file generation:\nFile " + xmlFileName.toStdString() + " is not valid...\n");
}
}
......
......@@ -53,7 +53,7 @@ class ComponentGenerator;
class ComponentExtensionGenerator : public ExtensionGenerator {
public:
ComponentExtensionGenerator(QString xmlFileName, QString componentExtensionsDirectory, QString licence = "") throw (QString);
ComponentExtensionGenerator(QString xmlFileName, QString componentExtensionsDirectory, QString licence = "");
ComponentExtensionGenerator(cepcoreschema::ComponentExtension& domComponentExtension, QString componentExtensionsDirectory, QString licence = "");
~ComponentExtensionGenerator();
......
......@@ -45,13 +45,12 @@
using namespace cepcoreschema;
ComponentGenerator::ComponentGenerator(QString xmlFileName, QString licence) throw (QString) {
ComponentGenerator::ComponentGenerator(QString xmlFileName, QString licence) {
this->licence = licence;
QFileInfo xmlFile(xmlFileName);
if ((! xmlFile.exists()) || (! xmlFile.isFile())) {
QString msg = "Exception from Component generation: \n The file " + xmlFileName + " does not exist or is not a Component xml file file...\n";
throw (msg);
throw std::invalid_argument("I/O exception during component file generation:\nFile " + xmlFileName.toStdString() + " does not exist or is not a file...\n");
}
try {
std::string xmlFileStr = xmlFileName.toStdString();
......@@ -59,8 +58,7 @@ ComponentGenerator::ComponentGenerator(QString xmlFileName, QString licence) thr
createFromDom(*domComponent);
}
catch (...) {
QString msg = "Action XML file not valid.";
throw msg;
throw std::invalid_argument("I/O exception during component file generation:\nFile " + xmlFileName.toStdString() + " is not valid...\n");
}
}
......
......@@ -53,7 +53,7 @@ class ParameterGenerator;
class ComponentGenerator {
public:
ComponentGenerator(QString xmlFileName, QString licence) throw (QString);
ComponentGenerator(QString xmlFileName, QString licence);
ComponentGenerator(cepcoreschema::Component& domComponent, QString licence);
~ComponentGenerator();
......
......@@ -45,12 +45,11 @@
using namespace cepcoreschema;
LibraryGenerator::LibraryGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence) throw (QString)
LibraryGenerator::LibraryGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence)
: ExtensionGenerator(actionExtensionsDirectory, licence, "Library") {
QFileInfo xmlFile(xmlFileName);
if ((! xmlFile.exists()) || (! xmlFile.isFile())) {
QString msg = "Exception from LibraryGenerator generation: \n The file " + xmlFileName + " does not exist or is not a file...\n";
throw (msg);
throw std::invalid_argument("I/O exception during library file generation:\nFile " + xmlFileName.toStdString() + " does not exist or is not a file...\n");
}
try {
std::string xmlFileStr = xmlFileName.toStdString();
......@@ -58,12 +57,11 @@ LibraryGenerator::LibraryGenerator(QString xmlFileName, QString actionExtensions
createFromDom(*domLibrary);
}
catch (...) {
QString msg = "Action extension XML file not valid.";
throw msg;
throw std::invalid_argument("I/O exception during library file generation:\nFile " + xmlFileName.toStdString() + " is not valid...\n");
}
}
LibraryGenerator::LibraryGenerator( Library& domLibrary, QString LibraryDirectory, QString licence)
LibraryGenerator::LibraryGenerator(Library& domLibrary, QString LibraryDirectory, QString licence)
: ExtensionGenerator(LibraryDirectory, licence, "Library") {
createFromDom(domLibrary);
}
......
......@@ -50,7 +50,7 @@ class Library;
class LibraryGenerator : public ExtensionGenerator {
public:
LibraryGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence = "") throw (QString);
LibraryGenerator(QString xmlFileName, QString actionExtensionsDirectory, QString licence = "");
LibraryGenerator(cepcoreschema::Library& domLibrary, QString librariesDirectory, QString licence = "");
~LibraryGenerator();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment