SpikeStream Library
0.2
|
00001 #include "DBInfo.h" 00002 using namespace spikestream; 00003 00004 //Initialize static varaibles 00005 QString DBInfo::UNDEFINED = "undefined"; 00006 00007 00009 DBInfo::DBInfo(QString host, QString user, QString password, QString database){ 00010 this->host = host; 00011 this->database = database; 00012 this->password = password; 00013 this->user = user; 00014 } 00015 00016 00018 DBInfo::DBInfo(){ 00019 host = DBInfo::UNDEFINED; 00020 database = DBInfo::UNDEFINED; 00021 password = DBInfo::UNDEFINED; 00022 user = DBInfo::UNDEFINED; 00023 } 00024 00025 00027 DBInfo::DBInfo(const DBInfo& dbInfo){ 00028 this->host = dbInfo.host; 00029 this->database = dbInfo.database; 00030 this->password = dbInfo.password; 00031 this->user = dbInfo.user; 00032 } 00033 00034 00036 DBInfo::~DBInfo(){ 00037 } 00038 00039 00040 /*----------------------------------------------------------*/ 00041 /*----- PUBLIC METHODS -----*/ 00042 /*----------------------------------------------------------*/ 00043 00045 DBInfo& DBInfo::operator=(const DBInfo &rhs) { 00046 // Check for self-assignment! 00047 if (this == &rhs) // Same object? 00048 return *this; // Yes, so skip assignment, and just return *this. 00049 00050 this->host = rhs.host; 00051 this->database = rhs.database; 00052 this->password = rhs.password; 00053 this->user = rhs.user; 00054 00055 return *this; 00056 } 00057 00058 00060 QString DBInfo::toString() const{ 00061 QString tmpStr; 00062 tmpStr += "host=" + host + "; "; 00063 tmpStr += "user=" + user + "; "; 00064 tmpStr += "password=" + password + "; "; 00065 tmpStr += "database=" + database+ "; "; 00066 return tmpStr; 00067 }