$treeview $search $mathjax
StdAir Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

stdair/basic/BasDBParams.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 // StdAir
00008 #include <stdair/basic/BasDBParams.hpp>
00009 
00010 namespace stdair {  
00011 
00012   // //////////////////////////////////////////////////////////////////////
00013   BasDBParams::BasDBParams() {
00014   }
00015   
00016   // //////////////////////////////////////////////////////////////////////
00017   BasDBParams::BasDBParams (const BasDBParams& iDBParams)
00018     : _user (iDBParams._user), _passwd (iDBParams._passwd),
00019       _host (iDBParams._host), _port (iDBParams._port),
00020       _dbname (iDBParams._dbname) {
00021   }
00022   
00023   // //////////////////////////////////////////////////////////////////////
00024   BasDBParams::BasDBParams (const std::string& iDBUser,
00025                             const std::string& iDBPasswd,
00026                             const std::string& iDBHost,
00027                             const std::string& iDBPort,
00028                             const std::string& iDBName)
00029     : _user (iDBUser), _passwd (iDBPasswd), _host (iDBHost), _port (iDBPort),
00030       _dbname (iDBName) {
00031   }
00032   
00033   // //////////////////////////////////////////////////////////////////////
00034   BasDBParams::~BasDBParams() {
00035   }
00036   
00037   // //////////////////////////////////////////////////////////////////////
00038   const std::string BasDBParams::describe() const {
00039     return toString();
00040   }
00041   
00042   // //////////////////////////////////////////////////////////////////////
00043   std::string BasDBParams::toShortString() const {
00044     std::ostringstream oStr;
00045     oStr << _dbname << "." << _user << "@" << _host << ":" << _port;
00046     return oStr.str();
00047   }
00048     
00049   // //////////////////////////////////////////////////////////////////////
00050   std::string BasDBParams::toString() const {
00051     std::ostringstream oStr;
00052     oStr << _dbname << "." << _user << "@" << _host << ":" << _port;
00053     return oStr.str();
00054   }
00055   
00056   // //////////////////////////////////////////////////////////////////////
00057   bool BasDBParams::check() const {
00058     if (_user.empty() == true || _passwd.empty() == true
00059         || _host.empty() == true || _port.empty()
00060         || _dbname.empty() == true) {
00061       return false;
00062     }
00063     return true;
00064   }
00065   
00066 }