WORM 0.2
A C++ DAL/ORM code generation framework

src/sql/wsqlerror.cpp

Go to the documentation of this file.
00001 /*
00002  *    WORM - a DAL/ORM code generation framework
00003  *    Copyright (C) 2011  Erik Winn <erikwinnmail@yahoo.com>
00004  * 
00005  *    This program is free software: you can redistribute it and/or modify
00006  *    it under the terms of the GNU General Public License as published by
00007  *    the Free Software Foundation, either version 3 of the License, or
00008  *    (at your option) any later version.
00009  * 
00010  *    This program is distributed in the hope that it will be useful,
00011  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *    GNU General Public License for more details.
00014  * 
00015  *    You should have received a copy of the GNU General Public License
00016  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "wsqlerror.h"
00020 
00021 namespace WSql {
00022 
00066 WSqlError::WSqlError()
00067 {
00068     _errno = -1;
00069     _text = std::string();
00070     _type = UNKNOWN;
00071     _severity = NONE;
00072 }
00073 
00084 WSqlError::WSqlError(const std::string& text, WSqlError::ErrorType type)
00085 {
00086     _text = text;
00087     _type = type;
00088     _severity = MESSAGE;
00089     _errno = -1;
00090 }
00102 WSqlError::WSqlError(const std::string& text, int errno, WSqlError::ErrorType type, WSqlError::ErrorSeverity severity)
00103 {
00104     _text=text;
00105     _errno=errno;
00106     _type=type;
00107     _severity=severity;
00108 }
00112 WSqlError::WSqlError(const WSqlError& other)
00113 {
00114     _errno = other._errno;
00115     _text = other._text;
00116     _severity = other._severity;
00117     _type = other._type;
00118 }
00121 WSqlError& WSqlError::operator=(const WSqlError& other)
00122 {
00123     _errno = other._errno;
00124     _text = other._text;
00125     _severity = other._severity;
00126     _type = other._type;
00127     return *this;
00128 }
00131 bool WSqlError::operator==(const WSqlError& other)const
00132 {
00133     return _text.compare(other._text) == 0
00134                 && _errno == other._errno
00135                 && _type == other._type
00136                 && _severity == other._severity;
00137 }
00138 
00141 WSqlError::~WSqlError(){}
00142 
00194 } //namespace WSql
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines