Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KompexSQLiteException_H
00020 #define KompexSQLiteException_H
00021
00022 #include <map>
00023 #include <string>
00024 #include <sstream>
00025 #include <iostream>
00026 #include "KompexSQLitePrerequisites.h"
00027
00028 namespace Kompex
00029 {
00030 class _SQLiteWrapperExport SQLiteException
00031 {
00032 public:
00034 SQLiteException(const std::string &filename, unsigned int line, std::string errDescription = ""):
00035 mErrorDescription(errDescription),
00036 mFilename(filename),
00037 mLine(line)
00038 {
00039 }
00040
00042 SQLiteException(const std::string &filename, unsigned int line, const char *errDescription = ""):
00043 mErrorDescription(std::string(errDescription)),
00044 mFilename(filename),
00045 mLine(line)
00046 {
00047 }
00048
00051 inline void Show() const {std::cerr << "file: " << mFilename << "\nline: " << mLine << "\nerror: " << mErrorDescription << std::endl;}
00053 std::string GetString() const
00054 {
00055 std::stringstream strStream;
00056 strStream << "file: " << mFilename << "\nline: " << mLine << "\nerror: " << std::string(mErrorDescription) << "\n";
00057 return strStream.str();
00058 }
00059
00060 private:
00062 std::string mErrorDescription;
00064 std::string mFilename;
00066 unsigned int mLine;
00067 };
00068 };
00069
00070 #endif // KompexSQLiteException_H
00071
00072 #ifndef KOMPEX_EXCEPT
00073 #define KOMPEX_EXCEPT(errorString) throw SQLiteException(__FILE__, __LINE__, errorString)
00074 #endif