本文整理汇总了C++中AString::PosNoCase方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::PosNoCase方法的具体用法?C++ AString::PosNoCase怎么用?C++ AString::PosNoCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::PosNoCase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateDatabase
/*--------------------------------------------------------------------------------*/
bool PostgresDatabase::CreateDatabase(const AString& name)
{
bool success = false;
if ((success = RunSQL(AString::Formatify("create database %s", name.str()))) == false) {
AString errmsg = GetErrorMessage();
if (errmsg.PosNoCase("already exists") < 0) {
debug("Failed to create database '%s': %s\n", name.str(), errmsg.str());
}
else success = true;
}
return success;
}
示例2: AddUser
/*--------------------------------------------------------------------------------*/
bool PostgresDatabase::AddUser(const AString& username, const AString& password)
{
bool success = false;
if ((success = RunSQL(AString::Formatify("create user %s with password '%s'", username.str(), password.str()))) == false) {
AString errmsg = GetErrorMessage();
if (errmsg.PosNoCase("already exists") < 0) {
debug("Failed to create user '%s': %s\n", username.str(), errmsg.str());
}
else success = true;
}
return success;
}
示例3: ListUsers
void ADVBConfig::ListUsers(AList& list) const
{
AHash users(10);
AList userpatterns;
AString filepattern = GetUserPatternsPattern();
AString filepattern_parsed = ParseRegex(filepattern);
AString _users = GetConfigItem("users");
AStdFile fp;
uint_t i, n = _users.CountColumns();
//debug("Reading users from config %s\n", config.GetFilename().str());
for (i = 0; i < n; i++) {
AString user = _users.Column(i).Words(0);
if (!users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
if (fp.open(GetPatternsFile())) {
AString line;
while (line.ReadLn(fp) >= 0) {
AString user;
int p;
if ((p = line.PosNoCase(" user:=")) >= 0) user = line.Mid(p + 7).Word(0).DeQuotify();
else if (line.PosNoCase("user:=") == 0) user = line.Mid(6).Word(0).DeQuotify();
if (user.Valid() && !users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
fp.close();
}
::CollectFiles(filepattern.PathPart(), filepattern.FilePart(), 0, userpatterns);
const AString *file = AString::Cast(userpatterns.First());
while (file) {
AString user;
ADataList regions;
if (MatchRegex(*file, filepattern_parsed, regions)) {
const REGEXREGION *region = (const REGEXREGION *)regions[0];
if (region) {
user = file->Mid(region->pos, region->len);
if (!users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
}
file = file->Next();
}
list.Sort(&AString::AlphaCompareCase);
}