12 ifstream
f(fileName.c_str());
15 <<
" for reading condition "
16 "database password\n";
21 while (
f.good() && !
found) {
25 if (line[0] ==
'#' || line.empty()) {
29 string u =
tokenize(line,
":/ \t", pos);
31 password =
tokenize(line,
":/ \t", pos);
35 if (!found && nstatements == 1) {
41 if (line.find_first_of(
": \t") == string::npos) {
48 throw cms::Exception(
"Database") <<
" Password for condition database user '" << user <<
"' not found in"
49 <<
" password file " << fileName <<
"\n";
55 size_t len = s.size();
57 while (pos0 < s.size() &&
find(delim.begin(), delim.end(), s[pos0]) != delim.end()) {
60 if (pos0 >= len || pos0 == string::npos)
62 pos = s.find_first_of(delim, pos0);
63 return s.substr(pos0, (pos > 0 ? pos : s.size()) - pos0);
68 if (pos0 == std::string::npos) {
72 if (pos1 == std::string::npos) {
75 return s.substr(pos0, pos1 - pos0);
std::vector< std::string > tokenize(std::string line, char delimiter)
static void trim(std::string &s)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void readPassword(const std::string &fileName, const std::string &user, std::string &password)
std::string tokenize(const std::string &s, const std::string &delim, size_t &pos) const
std::string trim(const std::string &s, const std::string &chars) const