#include <PasswordReader.h>
Public Member Functions | |
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 |
Definition at line 6 of file PasswordReader.h.
void PasswordReader::readPassword | ( | const std::string & | fileName, |
const std::string & | user, | ||
std::string & | password | ||
) |
Read data password from a local file. File can contain password for several user. The format is one record by line. Line must start with the user login followed by the password. Login and password can be separated by space(s), tab(s), a colon or a slash.
fileName | file with password list |
login | of user to look for |
password | [out] password read from the file |
cms::Exception | if file cannot be read or if the password was not found |
Definition at line 11 of file PasswordReader.cc.
References Exception, f, runEdmFileComparison::found, geometryCSVtoXML::line, and edm::tokenize().
Referenced by EcalDccWeightBuilder::writeWeightToDB().
std::string PasswordReader::tokenize | ( | const std::string & | s, |
const std::string & | delim, | ||
size_t & | pos | ||
) | const |
Function to split a string into tokens. Usage:
int pos = 0; string tok; const string s = .....; //string to tokenize const string delim = " \t"; //list of token delimiters while((tok = tokenize(s, delim, pos))!=string::npos){ .... code using tok ... }
s | string to tokenize | |
list | of delimiters | |
[in,out] | pos | current scan position in the string |
Definition at line 56 of file PasswordReader.cc.
References spr::find().
std::string PasswordReader::trim | ( | const std::string & | s, |
const std::string & | chars | ||
) | const |
Trims unwanted characters (e.g. spaces) at start and end of a string.
s | [in,out] input string |
chars | set of characters to trim |
Definition at line 70 of file PasswordReader.cc.