本文整理汇总了C++中String::CompareNoCase方法的典型用法代码示例。如果您正苦于以下问题:C++ String::CompareNoCase方法的具体用法?C++ String::CompareNoCase怎么用?C++ String::CompareNoCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::CompareNoCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
MySQLConnection::LoadSupportsTransactions_(const String &database)
{
supports_transactions_ = false;
if (database.GetLength() == 0)
return;
MySQLRecordset rec;
if (!rec.Open(shared_from_this(), SQLCommand("SHOW TABLE STATUS in " + database)))
return;
int tableCount = 0;
while (!rec.IsEOF())
{
String sEngine = rec.GetStringValue("Engine");
if (sEngine.CompareNoCase(_T("InnoDB")) != 0)
{
return;
}
tableCount++;
rec.MoveNext();
}
if (tableCount > 0)
{
// Only InnoDB tables in this database. Enable transactions.
supports_transactions_ = true;
}
}
示例2: GetRawFieldValue
bool
MimeBody::IsAttachment() const
{
/*
Previously we looked at the ContentDisposition header and the Name header to determine
whether it's an attachment or not. This was not safe, since a lot of attachments did
not have these headers but just a Content-type header. The new strategy is:
1) If the ContentDisposition is of type attachment, we assume it's an attachment
2) If the main ContentType is text or multipart, we assume that it's not an attachment
3) In all other cases, we treat it as an attachment.
discrete-type := "text" / "image" / "audio" / "video" / "application" / extension-token
composite-type := "message" / "multipart" / extension-token
*/
// If the content-disposition is set to attachment, we always treats it as an attachment
// even if the main type is set to multipart or text.
AnsiString sDisposition = GetRawFieldValue(CMimeConst::ContentDisposition());
if (sDisposition.StartsWith(CMimeConst::Attachment()))
return true;
if (sDisposition.StartsWith(CMimeConst::Inline()))
{
AnsiString sFileName = GetParameter(CMimeConst::ContentDisposition(), "filename");
if (!sFileName.IsEmpty())
return true;
}
String sMainType = GetMainType();
if (sMainType.CompareNoCase(_T("multipart")) == 0)
{
// Multipart ...
return false;
}
if (sMainType.CompareNoCase(_T("text")) == 0)
{
// This is just a text part.
return false;
}
return true;
}
示例3: engine_init_gfx_filters
bool engine_init_gfx_filters(Size &game_size, Size &screen_size, const int color_depth)
{
Out::FPrint("Initializing gfx filters");
if (force_gfxfilter[0])
GfxFilterRequest = force_gfxfilter;
else
GfxFilterRequest = usetup.gfxFilterID;
Out::FPrint("Requested gfx filter: %s", GfxFilterRequest.GetCStr());
// Try to initialize gfx filter of requested name
if (GfxFilterRequest.CompareNoCase("max") != 0 &&
initialize_graphics_filter(GfxFilterRequest, color_depth))
{
// Filter found, but we must also try if the engine will be able to set
// screen resolution
if (!try_find_nearest_supported_mode(game_size, filter->GetScalingFactor(), screen_size, color_depth,
usetup.windowed, usetup.prefer_sideborders, usetup.prefer_letterbox))
{
delete filter;
filter = NULL;
}
}
// If the filter was not set for any reason, try to choose standard scaling filter
// of maximal possible scaling factor
if (!filter)
{
String filter_name;
int scaling_factor;
#if defined (WINDOWS_VERSION) || defined (LINUX_VERSION)
scaling_factor = try_find_max_supported_uniform_scaling(game_size, screen_size, color_depth,
usetup.windowed, usetup.prefer_sideborders, usetup.prefer_letterbox);
if (scaling_factor == 0)
#endif
{
screen_size = game_size;
scaling_factor = 1;
}
filter_name.Format(scaling_factor > 1 ? "StdScale%d" : "None", scaling_factor);
initialize_graphics_filter(filter_name, color_depth);
}
// If not suitable filter still found then return with error message
if (!filter)
{
set_allegro_error("Failed to find acceptable graphics filter");
return false;
}
// On success apply filter and define game frame
Out::FPrint("Applying graphics filter: %s", filter->GetFilterID());
gfxDriver->SetGraphicsFilter(filter);
game_size.Width = screen_size.Width / filter->GetScalingFactor();
game_size.Height = screen_size.Height / filter->GetScalingFactor();
Out::FPrint("Chosen gfx resolution: %d x %d (%d bit), game frame: %d x %d",
screen_size.Width, screen_size.Height, color_depth, game_size.Width, game_size.Height);
return true;
}
示例4: engine_init_gfx_filters
int engine_init_gfx_filters(Size &game_size, Size &screen_size, const int color_depth)
{
Out::FPrint("Initializing gfx filters");
if (force_gfxfilter[0])
GfxFilterRequest = force_gfxfilter;
else
GfxFilterRequest = usetup.gfxFilterID;
Out::FPrint("Requested gfx filter: %s", GfxFilterRequest.GetCStr());
String gfxfilter;
if (GfxFilterRequest.CompareNoCase("max") != 0)
gfxfilter = GfxFilterRequest;
const Size base_size = game_size;
const bool windowed = usetup.windowed != 0;
const bool enable_sideborders = usetup.enable_side_borders != 0;
const bool force_letterbox = game.options[OPT_LETTERBOX] != 0;
int scaling_factor = 0;
if (!gfxfilter.IsEmpty())
{
scaling_factor = get_scaling_from_filter_name(gfxfilter);
Size found_screen_size;
if (try_find_nearest_supported_mode(base_size, scaling_factor, found_screen_size, color_depth,
windowed, enable_sideborders, force_letterbox))
screen_size = found_screen_size;
}
#if defined (WINDOWS_VERSION) || defined (LINUX_VERSION)
if (screen_size.IsNull())
{
Size found_screen_size;
scaling_factor = try_find_max_supported_uniform_scaling(base_size, found_screen_size, color_depth,
windowed, enable_sideborders, force_letterbox);
if (scaling_factor > 0)
{
screen_size = found_screen_size;
gfxfilter.Format(scaling_factor > 1 ? "StdScale%d" : "None", scaling_factor);
}
}
#endif
if (gfxfilter.IsEmpty())
{
set_allegro_error("Failed to find acceptable graphics filter");
return EXIT_NORMAL;
}
game_size.Width = screen_size.Width / scaling_factor;
game_size.Height = screen_size.Height / scaling_factor;
Out::FPrint("Chosen gfx resolution: %d x %d (%d bit), game frame: %d x %d",
screen_size.Width, screen_size.Height, color_depth, game_size.Width, game_size.Height);
if (initialize_graphics_filter(gfxfilter, base_size.Width, base_size.Height, color_depth))
{
return EXIT_NORMAL;
}
return RETURN_CONTINUE;
}
示例5:
bool
MailerDaemonAddressDeterminer::IsMailerDaemonAddress(const String &sAddress)
{
String sAddressPart = StringParser::ExtractAddress(sAddress);
if (sAddressPart.CompareNoCase(_T("MAILER-DAEMON")) == 0)
return true;
else
return false;
}
示例6: Select
DocSet DocDir::Select(const DocQuery& query)
{
DocSet r;
CppBase base;
int i;
for(i = 0; i < doc_base.GetCount(); i++) {
String nameing = doc_base.GetKey(i);
CppNamespace& mm = doc_base[i];
for(int i = 0; i < mm.GetCount(); i++) {
String nesting = mm.GetKey(i);
CppNest& nn = mm[i];
for(int i = 0; i < nn.GetCount(); i++) {
CppItem& q = nn[i];
String item = nn.GetKey(i);
if((query.name.IsEmpty() || query.name == q.name) &&
(query.text.IsEmpty() || Contains(item, query.text)) &&
(query.package.IsEmpty() || q.package.CompareNoCase(query.package) == 0) &&
(query.header.IsEmpty() || q.file.CompareNoCase(query.header) == 0)) {
String pk;
const Entry *e = Find(DocKey(nameing, nesting, item, query.lang), pk);
int st = e ? e->type : UNDOCUMENTED;
if((query.undocumented || e) && (st != IGNORED || query.ignored)) {
DocItem& a = r.GetAdd(nameing).GetAdd(nesting).GetAdd(item);
a.cppitem = &q;
a.item = item;
a.status = st;
a.package = e ? pk : q.package;
}
}
}
}
}
for(i = 0; i < dir.GetCount(); i++) {
ArrayMap<DocKey, Entry>& pk = dir[i];
String package = dir.GetKey(i);
for(int j = 0; j < pk.GetCount(); j++) {
const DocKey& k = pk.GetKey(j);
if(k.lang == query.lang &&
query.name.IsEmpty() &&
(query.text.IsEmpty() || Contains(k.item, query.text)) &&
(query.package.IsEmpty() || package.CompareNoCase(query.package) == 0) &&
query.header.IsEmpty() &&
!Contains(r, k)) {
DocItem& a = r.GetAdd(k.nameing).GetAdd(k.nesting).GetAdd(k.item);
a.cppitem = NULL;
a.item = k.item;
int st = pk[j].type;
a.status = st == NORMAL ? OBSOLETE : st == LINK ? OBSOLETELINK : st;
a.package = package;
}
}
}
return r;
}
示例7:
bool
IMAPFolderContainer::IsPublicFolder(const std::vector<String> &vecFolderPath)
{
if (vecFolderPath.size() == 0)
return false;
String sPublicFolderName = Configuration::Instance()->GetIMAPConfiguration()->GetIMAPPublicFolderName();
if (sPublicFolderName.CompareNoCase(vecFolderPath[0]) == 0)
return true;
else
return false;
}
示例8:
bool
MessageAttachmentStripper::_IsGoodTextPart(shared_ptr<MimeBody> pBody)
{
if (!pBody)
return false;
String sContentType = pBody->GetContentType();
if (sContentType.CompareNoCase(_T("text")))
return true;
return false;
}
示例9: OnParse
//[-------------------------------------------------------]
//[ Protected virtual XmlTextElement functions ]
//[-------------------------------------------------------]
void XmlTextImage::OnParse(XmlNode &cXmlNode)
{
// Is this an XML element?
if (cXmlNode.GetType() == XmlNode::Element) {
// Destroy the previous image
if (m_pImage) {
delete m_pImage;
m_pImage = nullptr;
}
// Get XML element
XmlElement &cXmlElement = static_cast<XmlElement&>(cXmlNode);
// Parse attributes
XmlAttribute *pAttribute = cXmlElement.GetFirstAttribute();
while (pAttribute) {
// Get name and value
String sName = pAttribute->GetName();
String sValue = pAttribute->GetValue();
// Save attribute
if (sName.CompareNoCase("Src")) {
// Image filename
m_sFilename = sValue;
} else if (sName.CompareNoCase("Width")) {
// Image width
m_vSize.x = sValue.GetInt();
} if (sName.CompareNoCase("Height")) {
// Image height
m_vSize.y = sValue.GetInt();
}
// Next attribute
pAttribute = pAttribute->GetNext();
}
}
}
示例10: pre_create_gfx_driver
bool pre_create_gfx_driver(const String &gfx_driver_id)
{
#ifdef WINDOWS_VERSION
if (gfx_driver_id.CompareNoCase("D3D9") == 0 && (game.color_depth != 1))
{
gfxDriver = GetD3DGraphicsDriver(NULL);
if (!gfxDriver)
{
Out::FPrint("Failed to initialize D3D9 driver: %s", get_allegro_error());
}
}
else
#endif
#if defined (IOS_VERSION) || defined(ANDROID_VERSION) || defined(WINDOWS_VERSION)
if (gfx_driver_id.CompareNoCase("DX5") != 0 && (psp_gfx_renderer > 0) && (game.color_depth != 1))
{
gfxDriver = GetOGLGraphicsDriver(NULL);
if (!gfxDriver)
{
Out::FPrint("Failed to initialize OGL driver: %s", get_allegro_error());
}
}
#endif
if (!gfxDriver)
{
gfxDriver = GetSoftwareGraphicsDriver(NULL);
}
if (gfxDriver)
{
Out::FPrint("Created graphics driver: %s", gfxDriver->GetDriverName());
return true;
}
return false;
}
示例11:
void
MirrorMessage::Send()
{
String sMirrorAddress = Configuration::Instance()->GetMirrorAddress();
if (sMirrorAddress.IsEmpty())
return;
// Do not mirror messages sent from the mirror address
if (sMirrorAddress.CompareNoCase(_message->GetFromAddress()) == 0)
return;
// If message is sent from a mailer daemon address, don't mirror it.
if (MailerDaemonAddressDeterminer::IsMailerDaemonAddress(_message->GetFromAddress()))
return;
// Is the mirror address a local domain?
String sDomain = StringParser::ExtractDomain(sMirrorAddress);
shared_ptr<const Domain> pDomain = CacheContainer::Instance()->GetDomain(sDomain);
if (pDomain)
{
// The domain is local. See if the account exist.
shared_ptr<const Account> pAccount = CacheContainer::Instance()->GetAccount(sMirrorAddress);
if (!pDomain->GetIsActive() || !pAccount || !pAccount->GetActive())
{
// check if a route exists with the same name and account.
bool found = false;
vector<shared_ptr<Route> > vecRoutes = Configuration::Instance()->GetSMTPConfiguration()->GetRoutes()->GetItemsByName(sDomain);
boost_foreach(shared_ptr<Route> route, vecRoutes)
{
if (route->ToAllAddresses() || route->GetAddresses()->GetItemByName(sMirrorAddress))
{
found = true;
break;
}
}
if (!found)
{
// The account didn't exist, or it wasn't active. Report a failure.
ErrorManager::Instance()->ReportError(ErrorManager::Medium, 4402, "SMTPDeliverer::_SendMirrorMessage", "Mirroring failed. The specified mirror address is local but either the domain is not enabled, or the account does not exist or is disabled.");
return;
}
}
}
示例12: switch
bool
MySQLMacroExpander::ProcessMacro(std::shared_ptr<DALConnection> connection, const Macro ¯o, String &sErrorMessage)
{
switch (macro.GetType())
{
case Macro::DropColumnKeys:
// MySQL4 doesn't support WHERE clauses in SHOW INDEX so
// we must manually sort the result below.
String sql;
sql.Format(_T("SHOW INDEX IN %s"), macro.GetTableName().c_str());
MySQLRecordset rec;
if (!rec.Open(connection, SQLCommand(sql)))
{
sErrorMessage = "It was not possible to execute the below SQL statement. Please see hMailServer error log for details.\r\n" + sql;
return false;
}
while (!rec.IsEOF())
{
String columnName = rec.GetStringValue("Column_name");
if (columnName.CompareNoCase(macro.GetColumnName()) != 0)
{
// Wrong column
rec.MoveNext();
continue;
}
String constraintName = rec.GetStringValue("Key_name");
String sqlUpdate;
sqlUpdate.Format(_T("ALTER TABLE %s DROP INDEX %s"), macro.GetTableName().c_str(), constraintName.c_str());
DALConnection::ExecutionResult execResult = connection->TryExecute(SQLCommand(sqlUpdate), sErrorMessage, 0, 0);
if (execResult != DALConnection::DALSuccess)
return false;
rec.MoveNext();
}
break;
}
return true;
}
示例13: parse_scaling_option
void parse_scaling_option(const String &scaling_option, FrameScaleDefinition &scale_def, int &scale_factor)
{
const char *game_scale_options[kNumFrameScaleDef - 1] = { "max_round", "stretch", "proportional" };
scale_def = kFrame_IntScale;
for (int i = 0; i < kNumFrameScaleDef - 1; ++i)
{
if (scaling_option.CompareNoCase(game_scale_options[i]) == 0)
{
scale_def = (FrameScaleDefinition)(i + 1);
break;
}
}
if (scale_def == kFrame_IntScale)
scale_factor = StrUtil::StringToInt(scaling_option);
else
scale_factor = 0;
}
示例14:
bool
SignatureAdder::GetMessageIsLocal_(std::shared_ptr<Message> message)
{
String sFromAddressDomain = StringParser::ExtractDomain(message->GetFromAddress());
// Loop over the recipients and check if they are on the same domain.if
std::vector<std::shared_ptr<MessageRecipient> > &vecRecipients = message->GetRecipients()->GetVector();
auto iter = vecRecipients.begin();
auto iterEnd = vecRecipients.end();
for (; iter != iterEnd; iter++)
{
String sRecipientAddress = (*iter)->GetAddress();
String sRecipientDomain = StringParser::ExtractDomain(sRecipientAddress);
if (sFromAddressDomain.CompareNoCase(sRecipientDomain) != 0)
return false;
}
return true;
}
示例15: if
void
IniFileSettings::LoadSettings()
//---------------------------------------------------------------------------()
// DESCRIPTION:
// Load all settings from hMailServer.ini
//---------------------------------------------------------------------------()
{
m_AdministratorPassword = _ReadIniSettingString("Security", "AdministratorPassword", "");
m_DatabaseServer = _ReadIniSettingString("Database", "Server", "");
m_DatabaseName = _ReadIniSettingString("Database", "Database", "");
m_Username = _ReadIniSettingString("Database", "Username", "");
m_Password = _ReadIniSettingString("Database", "Password", "");
m_bIsInternalDatabase = _ReadIniSettingInteger("Database", "Internal", 0) == 1;
m_DatabaseServerFailoverPartner = _ReadIniSettingString("Database", "ServerFailoverPartner", "");
String sDatabaseType = _ReadIniSettingString("Database", "Type", "");
Crypt::EncryptionType iPWDEncryptionType = (Crypt::EncryptionType) _ReadIniSettingInteger("Database", "Passwordencryption", 0);
// Decrypt password read from hmailserver.ini
m_Password = Crypt::Instance()->DeCrypt(m_Password, iPWDEncryptionType);
if (sDatabaseType.CompareNoCase(_T("MSSQL")) == 0)
m_eSQLDBType = HM::DatabaseSettings::TypeMSSQLServer;
else if (sDatabaseType.CompareNoCase(_T("MYSQL")) == 0)
m_eSQLDBType = HM::DatabaseSettings::TypeMYSQLServer;
else if (sDatabaseType.CompareNoCase(_T("PostgreSQL")) == 0)
m_eSQLDBType = HM::DatabaseSettings::TypePGServer;
else if (sDatabaseType.CompareNoCase(_T("MSSQLCE")) == 0)
m_eSQLDBType = HM::DatabaseSettings::TypeMSSQLCompactEdition;
m_lDBPort = _ReadIniSettingInteger( "Database", "Port", 0);
m_AppDirectory = _ReadIniSettingString("Directories", "ProgramFolder", "");
if (m_AppDirectory.Right(1) != _T("\\"))
m_AppDirectory += "\\";
m_DataDirectory = _ReadIniSettingString("Directories", "DataFolder", "");
if (m_DataDirectory.Right(1) == _T("\\"))
m_DataDirectory = m_DataDirectory.Left(m_DataDirectory.GetLength() -1);
m_sTempDirectory = _ReadIniSettingString("Directories", "TempFolder", "");
if (m_sTempDirectory.Right(1) == _T("\\"))
m_sTempDirectory = m_sTempDirectory.Left(m_sTempDirectory.GetLength() -1);
m_sEventDirectory = _ReadIniSettingString("Directories", "EventFolder", "");
m_sDBScriptDirectory = _ReadIniSettingString("Directories", "ProgramFolder", "");
if (m_sDBScriptDirectory.Right(1) != _T("\\"))
m_sDBScriptDirectory += "\\";
m_sDBScriptDirectory += "DBScripts";
m_iNoOfDBConnections = _ReadIniSettingInteger("Database", "NumberOfConnections", 5);
m_iNoOfDBConnectionAttempts = _ReadIniSettingInteger("Database", "ConnectionAttempts", 6);
m_iNoOfDBConnectionAttemptsDelay = _ReadIniSettingInteger("Database", "ConnectionAttemptsDelay", 5);
if (m_eSQLDBType == HM::DatabaseSettings::TypeMSSQLCompactEdition)
{
// Always use one database connection when working with SQL CE. SQL CE is supposed
// to be ACID, robust and so on but isn't really.
// http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4141097&SiteID=1
m_iNoOfDBConnections = 1;
}
m_iMaxNoOfExternalFetchThreads = _ReadIniSettingInteger("Settings", "MaxNumberOfExternalFetchThreads", 15);
m_bAddXAuthUserHeader = _ReadIniSettingInteger("Settings", "AddXAuthUserHeader", 0) == 1;
m_bGreylistingEnabledDuringRecordExpiration = _ReadIniSettingInteger("Settings", "GreylistingEnabledDuringRecordExpiration", 1) == 1;
m_iGreylistingExpirationInterval = _ReadIniSettingInteger("Settings", "GreylistingRecordExpirationInterval", 240);
m_sDatabaseDirectory = _ReadIniSettingString("Directories", "DatabaseFolder", "");
if (m_sDatabaseDirectory.Right(1) == _T("\\"))
m_sDatabaseDirectory = m_sDatabaseDirectory.Left(m_sDatabaseDirectory.GetLength() -1);
String sValidLanguages = _ReadIniSettingString("GUILanguages", "ValidLanguages", "");
m_vecValidLanguages = StringParser::SplitString(sValidLanguages, ",");
_preferredHashAlgorithm = _ReadIniSettingInteger("Settings", "PreferredHashAlgorithm", 3);
m_bDNSBlChecksAfterMailFrom = _ReadIniSettingInteger("Settings", "DNSBLChecksAfterMailFrom", 1) == 1;
m_bSepSvcLogs = _ReadIniSettingInteger("Settings", "SepSvcLogs", 0) == 1;
m_iLogLevel = _ReadIniSettingInteger("Settings", "LogLevel", 9);
m_iMaxLogLineLen = _ReadIniSettingInteger("Settings", "MaxLogLineLen", 500);
if (m_iMaxLogLineLen < 100) m_iMaxLogLineLen = 100;
m_iQuickRetries = _ReadIniSettingInteger("Settings", "QuickRetries", 0);
m_iQuickRetriesMinutes = _ReadIniSettingInteger("Settings", "QuickRetriesMinutes", 6);
m_iQueueRandomnessMinutes = _ReadIniSettingInteger("Settings", "QueueRandomnessMinutes", 0);
// If m_iQueueRandomnessMinutes out of range use 0
if (m_iQueueRandomnessMinutes <= 0) m_iQueueRandomnessMinutes = 0;
m_iMXTriesFactor = _ReadIniSettingInteger("Settings", "MXTriesFactor", 0);
if (m_iMXTriesFactor <= 0) m_iMXTriesFactor = 0;
m_sArchiveDir = _ReadIniSettingString("Settings", "ArchiveDir", "");
if (m_sArchiveDir.Right(1) == _T("\\"))
m_sArchiveDir = m_sArchiveDir.Left(m_sArchiveDir.GetLength() -1);
m_bArchiveHardlinks = _ReadIniSettingInteger("Settings", "ArchiveHardLinks", 0) == 1;
m_iPOP3DMinTimeout = _ReadIniSettingInteger("Settings", "POP3DMinTimeout", 10);
m_iPOP3DMaxTimeout = _ReadIniSettingInteger("Settings", "POP3DMaxTimeout",600);
m_iPOP3CMinTimeout = _ReadIniSettingInteger("Settings", "POP3CMinTimeout", 30);
//.........这里部分代码省略.........