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 {
00031 class _SQLiteWrapperExport SQLiteException
00032 {
00033 public:
00035 SQLiteException(const std::string &filename, unsigned int line, std::string errDescription = ""):
00036 mErrorDescription(errDescription),
00037 mFilename(filename),
00038 mLine(line)
00039 {
00040 }
00041
00043 SQLiteException(const std::string &filename, unsigned int line, const char *errDescription = ""):
00044 mErrorDescription(std::string(errDescription)),
00045 mFilename(filename),
00046 mLine(line)
00047 {
00048 }
00049
00052 inline void Show() const {std::cerr << "file: " << mFilename << "\nline: " << mLine << "\nerror: " << mErrorDescription << std::endl;}
00054 std::string GetString() const
00055 {
00056 std::stringstream strStream;
00057 strStream << "file: " << mFilename << "\nline: " << mLine << "\nerror: " << std::string(mErrorDescription) << "\n";
00058 return strStream.str();
00059 }
00060
00061 private:
00063 std::string mErrorDescription;
00065 std::string mFilename;
00067 unsigned int mLine;
00068 };
00069 };
00070
00071 #endif // KompexSQLiteException_H
00072
00073 #ifndef KOMPEX_EXCEPT
00074 #define KOMPEX_EXCEPT(errorString) throw SQLiteException(__FILE__, __LINE__, errorString)
00075 #endif