From 7ead2277e8980e6aa34f18ccc13eb3a3195fcef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 17 Jun 2017 22:06:18 +0200 Subject: [PATCH] Prepared exceptions to have different types. --- .../{ParserException.h => Exception.h} | 38 +++++++++++-------- .../pddlparse/detail/parsing/Expressions.h | 2 +- .../src/pddlparse/detail/parsing/Action.cpp | 2 +- .../src/pddlparse/detail/parsing/Constant.cpp | 2 +- .../detail/parsing/ConstantDeclaration.cpp | 2 +- .../pddlparse/detail/parsing/Description.cpp | 2 +- .../src/pddlparse/detail/parsing/Domain.cpp | 2 +- .../pddlparse/detail/parsing/InitialState.cpp | 2 +- .../detail/parsing/PredicateDeclaration.cpp | 2 +- .../detail/parsing/PrimitiveType.cpp | 2 +- .../parsing/PrimitiveTypeDeclaration.cpp | 2 +- .../src/pddlparse/detail/parsing/Problem.cpp | 2 +- .../pddlparse/detail/parsing/Requirement.cpp | 2 +- .../src/pddlparse/detail/parsing/Type.cpp | 2 +- .../src/pddlparse/detail/parsing/Variable.cpp | 2 +- .../detail/parsing/VariableDeclaration.cpp | 2 +- 16 files changed, 38 insertions(+), 30 deletions(-) rename lib/pddlparse/include/pddlparse/{ParserException.h => Exception.h} (54%) diff --git a/lib/pddlparse/include/pddlparse/ParserException.h b/lib/pddlparse/include/pddlparse/Exception.h similarity index 54% rename from lib/pddlparse/include/pddlparse/ParserException.h rename to lib/pddlparse/include/pddlparse/Exception.h index b0630bb..e8a04df 100644 --- a/lib/pddlparse/include/pddlparse/ParserException.h +++ b/lib/pddlparse/include/pddlparse/Exception.h @@ -1,5 +1,5 @@ -#ifndef __PDDL_PARSE__PARSER_EXCEPTION_H -#define __PDDL_PARSE__PARSER_EXCEPTION_H +#ifndef __PDDL_PARSE__EXCEPTION_H +#define __PDDL_PARSE__EXCEPTION_H #include #include @@ -11,39 +11,39 @@ namespace pddl //////////////////////////////////////////////////////////////////////////////////////////////////// // -// ParserException +// Exception // //////////////////////////////////////////////////////////////////////////////////////////////////// -class ParserException: public std::exception +class Exception: public std::exception { public: - explicit ParserException() - : ParserException("unspecified parser error") + explicit Exception() + : Exception("unspecified parser error") { } - explicit ParserException(const char *message) - : ParserException(static_cast(message)) + explicit Exception(const char *message) + : Exception(static_cast(message)) { } - explicit ParserException(const std::string &message) + explicit Exception(const std::string &message) : m_message{message} { } - explicit ParserException(const tokenize::Location &location) - : ParserException(location, "unspecified parser error") + explicit Exception(const tokenize::Location &location) + : Exception(location, "unspecified parser error") { } - explicit ParserException(const tokenize::Location &location, const char *message) - : ParserException(location, static_cast(message)) + explicit Exception(const tokenize::Location &location, const char *message) + : Exception(location, static_cast(message)) { } - explicit ParserException(const tokenize::Location &location, const std::string &message) + explicit Exception(const tokenize::Location &location, const std::string &message) : m_location{location}, m_message{message}, // TODO: refactor @@ -52,7 +52,7 @@ class ParserException: public std::exception { } - ~ParserException() noexcept = default; + ~Exception() noexcept = default; const char *what() const throw() { @@ -77,6 +77,14 @@ class ParserException: public std::exception //////////////////////////////////////////////////////////////////////////////////////////////////// +class ParserException : public Exception +{ + public: + using Exception::Exception; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + } #endif diff --git a/lib/pddlparse/include/pddlparse/detail/parsing/Expressions.h b/lib/pddlparse/include/pddlparse/detail/parsing/Expressions.h index eb95854..efbfb5a 100644 --- a/lib/pddlparse/include/pddlparse/detail/parsing/Expressions.h +++ b/lib/pddlparse/include/pddlparse/detail/parsing/Expressions.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Action.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Action.cpp index 774024e..d377070 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Action.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Action.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp index 5fa3230..76e30c0 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include namespace pddl { diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/ConstantDeclaration.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/ConstantDeclaration.cpp index a1c3196..38a9d2f 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/ConstantDeclaration.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/ConstantDeclaration.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Description.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Description.cpp index f760d1c..7931bb4 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Description.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Description.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Domain.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Domain.cpp index e508efa..0f83876 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Domain.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Domain.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/InitialState.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/InitialState.cpp index fdfa7c3..9f3d495 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/InitialState.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/InitialState.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include namespace pddl diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/PredicateDeclaration.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/PredicateDeclaration.cpp index b5291b2..470861c 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/PredicateDeclaration.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/PredicateDeclaration.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveType.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveType.cpp index 669ab08..11344e3 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveType.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveType.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include namespace pddl diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveTypeDeclaration.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveTypeDeclaration.cpp index ae22764..19564d5 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveTypeDeclaration.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/PrimitiveTypeDeclaration.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Problem.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Problem.cpp index 4f9bef6..ba48558 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Problem.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Problem.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Requirement.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Requirement.cpp index d980087..04acb3d 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Requirement.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Requirement.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include namespace pddl { diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Type.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Type.cpp index 5b74b3d..16f6998 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Type.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Type.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Variable.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Variable.cpp index 1da68be..857a507 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Variable.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Variable.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include namespace pddl { diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/VariableDeclaration.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/VariableDeclaration.cpp index ff66267..0dcd90b 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/VariableDeclaration.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/VariableDeclaration.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include