FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
DatabaseName::DatabaseName
(
const std::string &
database
)
inline
Definition at line
17
of file
Database.h
.
18
{
19
static
const
boost::regex expr(
"(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))"
);
20
21
boost::smatch what;
22
if
(!boost::regex_match(database, what, expr, boost::match_extra))
23
throw
std::runtime_error(
"Couldn't parse database URI '"
+database+
"'."
);
24
25
if
(what.size()!=10)
26
throw
std::runtime_error(
"Error parsing database URI '"
+database+
"'."
);
27
28
user
= what[2];
29
passwd
= what[4];
30
server
= what[5];
31
db
= what[9];
32
33
try
34
{
35
port
= stoi(std::string(what[7]));
36
}
37
catch
(...)
38
{
39
port
= 0;
40
}
41
}
DatabaseName::port
int port
Definition:
Database.h:15
DatabaseName::user
std::string user
Definition:
Database.h:11
DatabaseName::db
std::string db
Definition:
Database.h:14
DatabaseName::passwd
std::string passwd
Definition:
Database.h:12
DatabaseName::server
std::string server
Definition:
Database.h:13
DatabaseName
Generated on Sun Sep 18 2016 20:50:46 for FACT++ by
1.8.11