Dataquay 0.8
ObjectMapperExceptions.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3/*
4 Dataquay
5
6 A C++/Qt library for simple RDF datastore management.
7 Copyright 2009-2012 Chris Cannam.
8
9 Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation
11 files (the "Software"), to deal in the Software without
12 restriction, including without limitation the rights to use, copy,
13 modify, merge, publish, distribute, sublicense, and/or sell copies
14 of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 Except as contained in this notice, the name of Chris Cannam
29 shall not be used in advertising or otherwise to promote the sale,
30 use or other dealings in this Software without prior written
31 authorization.
32*/
33
34#ifndef DATAQUAY_OBJECT_MAPPER_EXCEPTIONS_H
35#define DATAQUAY_OBJECT_MAPPER_EXCEPTIONS_H
36
37#include <exception>
38#include <QString>
39
40namespace Dataquay
41{
42
50class UnknownTypeException : virtual public std::exception {
51public:
52 UnknownTypeException(QString type) throw() : m_type(type) { }
53 virtual ~UnknownTypeException() throw() { }
54 virtual const char *what() const throw() {
55 return QString("Unknown type: %1").arg(m_type).toLocal8Bit().data();
56 }
57protected:
58 QString m_type;
59};
60
68class ConstructionFailedException : virtual public std::exception {
69public:
70 ConstructionFailedException(QString type) throw() : m_type(type) { }
71 virtual ~ConstructionFailedException() throw() { }
72 virtual const char *what() const throw() {
73 return QString("Failed to construct type: %1")
74 .arg(m_type).toLocal8Bit().data();
75 }
76protected:
77 QString m_type;
78};
79
87class NoUriException : virtual public std::exception {
88public:
89 NoUriException(QString oname, QString cname) throw() : m_oname(oname), m_cname(cname) { }
90 virtual ~NoUriException() throw() { }
91 virtual const char *what() const throw() {
92 return QString("Object of name \"%1\" and class %2 lacks URI")
93 .arg(m_oname).arg(m_cname).toLocal8Bit().data();
94 }
95protected:
96 QString m_oname;
97 QString m_cname;
98};
99
100}
101
102#endif
ConstructionFailedException is an exception that may be thrown by ObjectMapper classes if a class map...
NoUriException is an exception thrown by ObjectMapper classes when asked to store a class that is exp...
NoUriException(QString oname, QString cname)
virtual const char * what() const
UnknownTypeException is an exception thrown by ObjectMapper classes when asked to load an object from...
virtual const char * what() const