StdAir Logo  1.00.21
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
BasDBParams.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7// StdAir
9
10namespace stdair {
11
12 // //////////////////////////////////////////////////////////////////////
15
16 // //////////////////////////////////////////////////////////////////////
18 : _user (iDBParams._user), _passwd (iDBParams._passwd),
19 _host (iDBParams._host), _port (iDBParams._port),
20 _dbname (iDBParams._dbname) {
21 }
22
23 // //////////////////////////////////////////////////////////////////////
24 BasDBParams::BasDBParams (const std::string& iDBUser,
25 const std::string& iDBPasswd,
26 const std::string& iDBHost,
27 const std::string& iDBPort,
28 const std::string& iDBName)
29 : _user (iDBUser), _passwd (iDBPasswd), _host (iDBHost), _port (iDBPort),
30 _dbname (iDBName) {
31 }
32
33 // //////////////////////////////////////////////////////////////////////
36
37 // //////////////////////////////////////////////////////////////////////
38 const std::string BasDBParams::describe() const {
39 return toString();
40 }
41
42 // //////////////////////////////////////////////////////////////////////
43 std::string BasDBParams::toShortString() const {
44 std::ostringstream oStr;
45 oStr << _dbname << "." << _user << "@" << _host << ":" << _port;
46 return oStr.str();
47 }
48
49 // //////////////////////////////////////////////////////////////////////
50 std::string BasDBParams::toString() const {
51 std::ostringstream oStr;
52 oStr << _dbname << "." << _user << "@" << _host << ":" << _port;
53 return oStr.str();
54 }
55
56 // //////////////////////////////////////////////////////////////////////
57 bool BasDBParams::check() const {
58 if (_user.empty() == true || _passwd.empty() == true
59 || _host.empty() == true || _port.empty()
60 || _dbname.empty() == true) {
61 return false;
62 }
63 return true;
64 }
65
66}
Handle on the StdAir library context.
BasDBParams(const std::string &iDBUser, const std::string &iDBPasswd, const std::string &iDBHost, const std::string &iDBPort, const std::string &iDBName)
std::string toShortString() const
std::string toString() const
const std::string describe() const