c6f884bd63acf5eb5faf459ba8f195626e173ae1
[platform/upstream/iotivity.git] / service / simulator / ramlparser / raml / RamlExceptions.h
1 /******************************************************************\r
2  *\r
3  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  ******************************************************************/\r
20 \r
21 #ifndef RAML_EXCEPTIONS_H_\r
22 #define RAML_EXCEPTIONS_H_\r
23 \r
24 #include <exception>\r
25 #include "RamlErrorCodes.h"\r
26 #include "yaml-cpp/exceptions.h"\r
27 \r
28 namespace RAML\r
29 {\r
30     class RamlException : public std::exception\r
31     {\r
32         public:\r
33             RamlException(const std::string &message) : m_message(message) {}\r
34             RamlException(const YAML::Mark &mark, const std::string &message): m_message(message),\r
35                 m_mark(mark) {}\r
36             virtual const char *what() const noexcept;\r
37             virtual ~RamlException() throw() {}\r
38 \r
39         private:\r
40             std::string m_message;\r
41             YAML::Mark m_mark;\r
42     };\r
43 \r
44     class RamlParserException : public RamlException\r
45     {\r
46         public:\r
47             RamlParserException(const std::string &message): RamlException(message) {}\r
48             RamlParserException(const YAML::Mark &mark, const std::string &message): RamlException(mark,\r
49                         message) {}\r
50     };\r
51 \r
52     class RamlRepresentationException : public RamlException\r
53     {\r
54         public:\r
55             RamlRepresentationException(const std::string &message): RamlException(message) {}\r
56             RamlRepresentationException(const YAML::Mark &mark, const std::string &message): RamlException(mark,\r
57                         message) {}\r
58     };\r
59 \r
60     class RamlBadFile : public RamlException\r
61     {\r
62         public:\r
63             RamlBadFile(const std::string &message) : RamlException(message) {}\r
64             RamlBadFile(const YAML::Mark &mark, const std::string &message): RamlException(mark, message) {}\r
65     };\r
66     class JsonException : public RamlException\r
67     {\r
68         public:\r
69             JsonException(const std::string &message) : RamlException(message) {}\r
70 \r
71     };\r
72 }\r
73 #endif\r