本文整理汇总了C++中CString::AsLower方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::AsLower方法的具体用法?C++ CString::AsLower怎么用?C++ CString::AsLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::AsLower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::vector<CChan*> CIRCNetwork::FindChans(const CString& sWild) const {
std::vector<CChan*> vChans;
vChans.reserve(m_vChans.size());
const CString sLower = sWild.AsLower();
for (CChan* pChan : m_vChans) {
if (pChan->GetName().AsLower().WildCmp(sLower)) vChans.push_back(pChan);
}
return vChans;
}
示例2: ChannelMatches
bool ChannelMatches(const CString& sChan) const {
for (set<CString>::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) {
if (sChan.AsLower().WildCmp(*it)) {
return true;
}
}
return false;
}
示例3: OnNick
virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) {
// Update the queue with nick changes
MCString::iterator it = m_msQueue.find(OldNick.GetNick().AsLower());
if (it != m_msQueue.end()) {
m_msQueue[sNewNick.AsLower()] = it->second;
m_msQueue.erase(it);
}
}
示例4:
std::vector<CQuery*> CIRCNetwork::FindQueries(const CString& sWild) const {
std::vector<CQuery*> vQueries;
vQueries.reserve(m_vQueries.size());
const CString sLower = sWild.AsLower();
for (CQuery* pQuery : m_vQueries) {
if (pQuery->GetName().AsLower().WildCmp(sLower))
vQueries.push_back(pQuery);
}
return vQueries;
}
示例5: AddKey
bool AddKey(CUser* pUser, const CString& sKey) {
const pair<SCString::const_iterator, bool> pair =
m_PubKeys[pUser->GetUserName()].insert(sKey.AsLower());
if (pair.second) {
Save();
}
return pair.second;
}
示例6: WildCmp
bool CString::WildCmp(const CString& sWild, const CString& sString, CaseSensitivity cs) {
// avoid a copy when cs == CaseSensitive (C++ deliberately specifies that binding
// a temporary object to a reference to const on the stack lengthens the lifetime
// of the temporary to the lifetime of the reference itself)
const CString& sWld = (cs == CaseSensitive ? sWild : sWild.AsLower());
const CString& sStr = (cs == CaseSensitive ? sString : sString.AsLower());
// Written by Jack Handy - [email protected]
const char *wild = sWld.c_str(), *CString = sStr.c_str();
const char *cp = nullptr, *mp = nullptr;
while ((*CString) && (*wild != '*')) {
if ((*wild != *CString) && (*wild != '?')) {
return false;
}
wild++;
CString++;
}
while (*CString) {
if (*wild == '*') {
if (!*++wild) {
return true;
}
mp = wild;
cp = CString+1;
} else if ((*wild == *CString) || (*wild == '?')) {
wild++;
CString++;
} else {
wild = mp;
CString = cp++;
}
}
while (*wild == '*') {
wild++;
}
return (*wild == 0);
}
示例7: SendIRCMsgToSkype
bool SendIRCMsgToSkype(const CString& a_nick, const CString& a_channel, const CString& a_message)
{
if(m_chanNameMap.find(a_channel.AsLower()) != m_chanNameMap.end() && !a_message.empty())
{
CString l_message = stripIRCColorCodes(a_message);
if(!IsStrValidUTF8(l_message))
{
l_message = AnsiToUtf8(l_message);
}
if(!a_nick.empty())
{
l_message = "<" + a_nick + "> " + l_message;
}
return SendSkypeCommand("CHATMESSAGE " + m_chanNameMap[a_channel.AsLower()] + " " + l_message);
}
return false;
}
示例8: DelUser
void DelUser(const CString& sUser) {
map<CString, CAutoVoiceUser*>::iterator it = m_msUsers.find(sUser.AsLower());
if (it == m_msUsers.end()) {
PutModule("That user does not exist");
return;
}
delete it->second;
m_msUsers.erase(it);
PutModule("User [" + sUser + "] removed");
}
示例9: OnDelKeyCommand
void OnDelKeyCommand(const CString& sCommand) {
CString sTarget = sCommand.Token(1);
if (!sTarget.empty()) {
if (DelNV(sTarget.AsLower())) {
PutModule("Target [" + sTarget + "] deleted");
} else {
PutModule("Target [" + sTarget + "] not found");
}
} else {
PutModule("Usage DelKey <#chan|Nick>");
}
}
示例10: OnSetKeyCommand
void OnSetKeyCommand(const CString& sCommand) {
CString sTarget = sCommand.Token(1);
CString sKey = sCommand.Token(2, true);
// Strip "cbc:" from beginning of string incase someone pastes directly from mircryption
sKey.TrimPrefix("cbc:");
if (!sKey.empty()) {
SetNV(sTarget.AsLower(), sKey);
PutModule("Set encryption key for [" + sTarget + "] to [" + sKey + "]");
} else {
PutModule("Usage: SetKey <#chan|Nick> <Key>");
}
}
示例11: FilterIncoming
void FilterIncoming(const CString& sTarget, CNick& Nick, CString& sMessage) {
if (sMessage.TrimPrefix("+OK *")) {
MCString::iterator it = FindNV(sTarget.AsLower());
if (it != EndNV()) {
sMessage.Base64Decode();
sMessage.Decrypt(it->second);
sMessage.LeftChomp(8);
sMessage = sMessage.c_str();
Nick.SetNick(NickPrefix() + Nick.GetNick());
}
}
}
示例12: GetKey
CString GetKey(Csock* pSock) {
CString sRes;
long int res = pSock->GetPeerFingerprint(sRes);
DEBUG("GetKey() returned status " << res << " with key " << sRes);
// This is 'inspired' by charybdis' libratbox
switch (res) {
case X509_V_OK:
case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
return sRes.AsLower();
default:
return "";
}
}
示例13: OnUserTopic
EModRet OnUserTopic(CString& sTarget, CString& sMessage) override {
sTarget.TrimPrefix(NickPrefix());
if (sMessage.TrimPrefix("``")) {
return CONTINUE;
}
MCString::iterator it = FindNV(sTarget.AsLower());
if (it != EndNV()) {
sMessage = MakeIvec() + sMessage;
sMessage.Encrypt(it->second);
sMessage.Base64Encode();
sMessage = "+OK *" + sMessage;
}
return CONTINUE;
}
示例14: SendNotification
bool SendNotification(CNick& Nick, CString& sMessage){
/*
* Being passed in the nick name and the message, return true if an
* email notification should be sent to the user or not. At the moment
* this is a simple test that checks for a case insenstive username
* match which is a bit flawed as 1d0ugal1 still matches d0ugal.
*/
// Don't send notifications if DebugMode is off and the ConnectedUser is not attached.
if (!DebugMode && ConnectedUser->IsUserAttached()){
return false;
}
CString UserNick = ConnectedUser->GetNick().AsLower();
size_t found = sMessage.AsLower().find(UserNick);
if (found!=string::npos){
return true;
} else {
return false;
}
}
示例15: Parse
// Config Parser. Might drop this.
bool CConfig::Parse(CFile& file, CString& sErrorMsg)
{
CString sLine;
unsigned int uLineNum = 0;
CConfig *pActiveConfig = this;
std::stack<ConfigStackEntry> ConfigStack;
bool bCommented = false; // support for /**/ style comments
if (!file.Seek(0)) {
sErrorMsg = "Could not seek to the beginning of the config.";
return false;
}
while (file.ReadLine(sLine)) {
uLineNum++;
#define ERROR(arg) do { \
std::stringstream stream; \
stream << "Error on line " << uLineNum << ": " << arg; \
sErrorMsg = stream.str(); \
m_SubConfigs.clear(); \
m_ConfigEntries.clear(); \
return false; \
} while (0)
// Remove all leading spaces and trailing line endings
sLine.TrimLeft();
sLine.TrimRight("\r\n");
if (bCommented || sLine.Left(2) == "/*") {
/* Does this comment end on the same line again? */
bCommented = (sLine.Right(2) != "*/");
continue;
}
if ((sLine.empty()) || (sLine[0] == '#') || (sLine.Left(2) == "//")) {
continue;
}
if ((sLine.Left(1) == "<") && (sLine.Right(1) == ">")) {
sLine.LeftChomp();
sLine.RightChomp();
sLine.Trim();
CString sTag = sLine.Token(0);
CString sValue = sLine.Token(1, true);
sTag.Trim();
sValue.Trim();
if (sTag.Left(1) == "/") {
sTag = sTag.substr(1);
if (!sValue.empty())
ERROR("Malformated closing tag. Expected \"</" << sTag << ">\".");
if (ConfigStack.empty())
ERROR("Closing tag \"" << sTag << "\" which is not open.");
const struct ConfigStackEntry& entry = ConfigStack.top();
CConfig myConfig(entry.Config);
CString sName(entry.sName);
if (!sTag.Equals(entry.sTag))
ERROR("Closing tag \"" << sTag << "\" which is not open.");
// This breaks entry
ConfigStack.pop();
if (ConfigStack.empty())
pActiveConfig = this;
else
pActiveConfig = &ConfigStack.top().Config;
SubConfig &conf = pActiveConfig->m_SubConfigs[sTag.AsLower()];
SubConfig::const_iterator it = conf.find(sName);
if (it != conf.end())
ERROR("Duplicate entry for tag \"" << sTag << "\" name \"" << sName << "\".");
conf[sName] = CConfigEntry(myConfig);
} else {
if (sValue.empty())
ERROR("Empty block name at begin of block.");
ConfigStack.push(ConfigStackEntry(sTag.AsLower(), sValue));
pActiveConfig = &ConfigStack.top().Config;
}
continue;
}
// If we have a regular line, figure out where it goes
CString sName = sLine.Token(0, false, "=");
CString sValue = sLine.Token(1, true, "=");
// Only remove the first space, people might want
// leading spaces (e.g. in the MOTD).
if (sValue.Left(1) == " ")
sValue.LeftChomp();
//.........这里部分代码省略.........