当前位置: 首页>>代码示例>>C++>>正文


C++ CStdString::ToLower方法代码示例

本文整理汇总了C++中CStdString::ToLower方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::ToLower方法的具体用法?C++ CStdString::ToLower怎么用?C++ CStdString::ToLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStdString的用法示例。


在下文中一共展示了CStdString::ToLower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowAndVerifyPassword

// \brief Show keyboard and verify user input against strPassword.
// \param strPassword Value to compare against user input.
// \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer.
// \param iRetries If greater than 0, shows "Incorrect password, %d retries left" on dialog line 2, else line 2 is blank.
// \return 0 if successful display and user input. 1 if unsucessful input. -1 if no user input or canceled editing.
int CGUIDialogKeyboard::ShowAndVerifyPassword(CStdString& strPassword, const CStdString& strHeading, int iRetries)
{
  CStdString strHeadingTemp;
  if (1 > iRetries && strHeading.size())
    strHeadingTemp = strHeading;
  else
    strHeadingTemp.Format("%s - %i %s", g_localizeStrings.Get(12326).c_str(), g_guiSettings.GetInt("masterlock.maxretries") - iRetries, g_localizeStrings.Get(12343).c_str());

  CStdString strUserInput = "";
  if (!ShowAndGetInput(strUserInput, strHeadingTemp, false, true))  //bool hiddenInput = false/true ? TODO: GUI Setting to enable disable this feature y/n?
    return -1; // user canceled out

  if (!strPassword.IsEmpty())
  {
    if (strPassword == strUserInput)
      return 0;

    MD5_CTX md5state;
    unsigned char md5pword[16];
    char md5pword2[33];
    MD5Init(&md5state);
    MD5Update(&md5state, (unsigned char *)strUserInput.c_str(), (int)strUserInput.size());
    MD5Final(md5pword, &md5state);
    XKGeneral::BytesToHexStr(md5pword, 16, md5pword2);
    if (strPassword.Equals(md5pword2))
      return 0;     // user entered correct password
    else return 1;  // user must have entered an incorrect password
  }
  else
  {
    if (!strUserInput.IsEmpty())
    {
      MD5_CTX md5state;
      unsigned char md5pword[16];
      char md5pword2[33];
      MD5Init(&md5state);
      MD5Update(&md5state, (unsigned char *)strUserInput.c_str(), (int)strUserInput.size());
      MD5Final(md5pword, &md5state);
      XKGeneral::BytesToHexStr(md5pword, 16, md5pword2);

      strPassword = md5pword2;
      strPassword.ToLower();
      return 0; // user entered correct password
    }
    else return 1;
  }
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:52,代码来源:GUIDialogKeyboard.cpp

示例2: TranslateKeyboardButton

uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton)
{
  uint32_t button_id = 0;
  const char *szButton = pButton->Value();

  if (!szButton) 
    return 0;
  CStdString strKey = szButton;
  if (strKey.Equals("key"))
  {
    int id = 0;
    if (pButton->QueryIntAttribute("id", &id) == TIXML_SUCCESS)
      button_id = (uint32_t)id;
    else
      CLog::Log(LOGERROR, "Keyboard Translator: `key' button has no id");
  }
  else
    button_id = TranslateKeyboardString(szButton);

  // Process the ctrl/shift/alt modifiers
  CStdString strMod;
  if (pButton->QueryValueAttribute("mod", &strMod) == TIXML_SUCCESS)
  {
    strMod.ToLower();

    CStdStringArray modArray;
    StringUtils::SplitString(strMod, ",", modArray);
    for (unsigned int i = 0; i < modArray.size(); i++)
    {
      CStdString& substr = modArray[i];
      substr.Trim();

      if (substr == "ctrl" || substr == "control")
        button_id |= CKey::MODIFIER_CTRL;
      else if (substr == "shift")
        button_id |= CKey::MODIFIER_SHIFT;
      else if (substr == "alt")
        button_id |= CKey::MODIFIER_ALT;
      else if (substr == "super" || substr == "win")
        button_id |= CKey::MODIFIER_SUPER;
      else
        CLog::Log(LOGERROR, "Keyboard Translator: Unknown key modifier %s in %s", substr.c_str(), strMod.c_str());
     }
  }

  return button_id;
}
开发者ID:Sky-git,项目名称:xbmc,代码行数:47,代码来源:ButtonTranslator.cpp

示例3: FindLocalThumbnail

bool CMetadataResolverMusic::FindLocalThumbnail(CResolvedAlbum& album, const CResolvingFolder& folder)
{
  // Go over all files in the folder that could be an album thumb (basically, picture files)
  for (int i = 0; i < (int)folder.vecThumbs.size(); i++)
  {
    CStdString strThumbFileName = CUtil::GetFileName(folder.vecThumbs[i]);

    // Get all possible thumbnail file names from the settings
    CStdStringArray thumbs;
    StringUtils::SplitString(g_advancedSettings.m_musicThumbs, "|", thumbs);
    for (unsigned int j = 0; j < thumbs.size(); ++j)
    {

      if (strThumbFileName.CompareNoCase(thumbs[j]) == 0)
      {
        album.strCover = folder.vecThumbs[i];
        return true;
      }
    }

    CUtil::RemoveExtension(strThumbFileName);

    // Handle the case that folder name is the same as the jpeg name
    if (strThumbFileName == folder.strEffectiveFolderName) 
    {
      album.strCover = folder.vecThumbs[i];
      return true;
    }

    if (strThumbFileName == album.strName)
    {
      album.strCover = folder.vecThumbs[i];
      return true;
    }

    if (strThumbFileName.ToLower() == "folder")
    {
      album.strCover = folder.vecThumbs[i];
      return true;
    }

    // TODO: Add more cases
  }

  return false;
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:46,代码来源:MetadataResolverMusic.cpp

示例4: RemoveSelectedItem

void CDirectoryHistory::RemoveSelectedItem(const CStdString& strDirectory)
{
  CStdString strDir = strDirectory;
  strDir.ToLower();
  while (CUtil::HasSlashAtEnd(strDir) )
    strDir = strDir.Left(strDir.size() - 1);

  vector<CHistoryItem>::iterator Iter;
  for (Iter = m_vecHistory.begin();Iter != m_vecHistory.end(); Iter++)
  {
    if ( strDir == Iter->m_strDirectory)
    {
      m_vecHistory.erase(Iter);
      return ;
    }
  }
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:17,代码来源:DirectoryHistory.cpp

示例5: IsPathToThumbnail

static bool IsPathToThumbnail(const CStdString& strPath )
{
  // Currently just check if this is an image, maybe we will add some
  // other checks later
  CStdString extension;
  URIUtils::GetExtension(strPath, extension);

  if (extension.IsEmpty())
    return false;

  extension.ToLower();

  if (g_settings.m_pictureExtensions.Find(extension) != -1)
    return true;

  return false;
}
开发者ID:2BReality,项目名称:xbmc,代码行数:17,代码来源:RSSDirectory.cpp

示例6: SearchAndSetChannelIcons

void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
  if (g_guiSettings.GetString("pvrmenu.iconpath").IsEmpty())
    return;

  CPVRDatabase *database = GetPVRDatabase();
  if (!database)
    return;

  CSingleLock lock(m_critSection);

  for (unsigned int ptr = 0; ptr < m_members.size(); ptr++)
  {
    PVRChannelGroupMember groupMember = m_members.at(ptr);

    /* skip if an icon is already set */
    if (!groupMember.channel->IconPath().IsEmpty())
      continue;

    CStdString strBasePath = g_guiSettings.GetString("pvrmenu.iconpath");
    CStdString strSanitizedChannelName = CUtil::MakeLegalFileName(groupMember.channel->ClientChannelName());

    CStdString strIconPath = strBasePath + strSanitizedChannelName;
    CStdString strIconPathLower = strBasePath + strSanitizedChannelName.ToLower();
    CStdString strIconPathUid;
    strIconPathUid.Format("%08d", groupMember.channel->UniqueID());
    strIconPathUid = URIUtils::AddFileToFolder(strBasePath, strIconPathUid);

    SetChannelIconPath(groupMember.channel, strIconPath      + ".tbn") ||
    SetChannelIconPath(groupMember.channel, strIconPath      + ".jpg") ||
    SetChannelIconPath(groupMember.channel, strIconPath      + ".png") ||

    SetChannelIconPath(groupMember.channel, strIconPathLower + ".tbn") ||
    SetChannelIconPath(groupMember.channel, strIconPathLower + ".jpg") ||
    SetChannelIconPath(groupMember.channel, strIconPathLower + ".png") ||

    SetChannelIconPath(groupMember.channel, strIconPathUid   + ".tbn") ||
    SetChannelIconPath(groupMember.channel, strIconPathUid   + ".jpg") ||
    SetChannelIconPath(groupMember.channel, strIconPathUid   + ".png");

    if (bUpdateDb)
      groupMember.channel->Persist();

    /* TODO: start channel icon scraper here if nothing was found */
  }
}
开发者ID:gaiyangjun,项目名称:xbmc,代码行数:46,代码来源:PVRChannelGroup.cpp

示例7: TranslateSingleString

bool CGUIDialogPluginSettings::TranslateSingleString(const CStdString &strCondition, vector<CStdString> &condVec)
{
  CStdString strTest = strCondition;
  strTest.ToLower();
  strTest.TrimLeft(" ");
  strTest.TrimRight(" ");

  int pos1 = strTest.Find("(");
  int pos2 = strTest.Find(",");
  int pos3 = strTest.Find(")");
  if (pos1 >= 0 && pos2 > pos1 && pos3 > pos2)
  {
    condVec.push_back(strTest.Left(pos1));
    condVec.push_back(strTest.Mid(pos1 + 1, pos2 - pos1 - 1));
    condVec.push_back(strTest.Mid(pos2 + 1, pos3 - pos2 - 1));
    return true;
  }
  return false;
}
开发者ID:Castlecard,项目名称:plex,代码行数:19,代码来源:GUIDialogPluginSettings.cpp

示例8: ExtractThumb

bool CVideoThumbLoader::ExtractThumb(const CStdString &strPath, const CStdString &strTarget, CStreamDetails *pStreamDetails)
{
  if (!g_guiSettings.GetBool("myvideos.autothumb"))
    return false;

  CStdString strExt;
  CUtil::GetExtension(strPath, strExt);

  if (CUtil::IsLiveTV(strPath)
#ifndef HAS_UPNP_AV
  ||  CUtil::IsUPnP(strPath)
#endif
  ||  CUtil::IsDAAP(strPath)
    || strExt.ToLower() == ".swf")
    return false;

  CLog::Log(LOGDEBUG,"%s - trying to extract thumb from video file %s", __FUNCTION__, strPath.c_str());
  return CDVDFileInfo::ExtractThumb(strPath, strTarget, pStreamDetails);
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:19,代码来源:ThumbLoader.cpp

示例9: IsPlaylist

bool CPlayListFactory::IsPlaylist(const CFileItem& item, bool bAllowQuery)
{
  CStdString extension = CUtil::GetExtension(item.m_strPath);
  extension.ToLower();

  if (extension == ".m3u") return true;
  if (extension == ".m3u8") return true;
  if (extension == ".b4s") return true;
  if (extension == ".pls") return true;
  if (extension == ".strm") return true;
  if (extension == ".wpl") return true;
  if (extension == ".asx") return true;
  if (extension == ".ram") return true;
  
  if (item.IsLastFM())
    return false;

  if (extension == ".url") return true;
  if (extension == ".pxml") return true;

  if (item.IsShoutCast())
    return false;

  if( item.IsInternetStream() )
  {
    CStdString strContentType = item.GetContentType(bAllowQuery);
    strContentType.MakeLower();

    if (strContentType == "video/x-ms-asf"
    || strContentType == "video/x-ms-asx"
    || strContentType == "video/x-ms-wfs"
    || strContentType == "video/x-ms-wvx"
    || strContentType == "video/x-ms-wax"
    || strContentType == "audio/x-pn-realaudio"
    || strContentType == "audio/x-scpls"
    || strContentType == "playlist"
    || strContentType == "audio/x-mpegurl"
    || strContentType == "application/vnd.ms-wpl")
      return true;
  }
  
  return false;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:43,代码来源:PlayListFactory.cpp

示例10: Log

JSON_STATUS CXBMCOperations::Log(const CStdString &method, ITransportLayer *transport, IClient *client, const Value &parameterObject, Value &result)
{
  if (parameterObject.isString())
    CLog::Log(LOGDEBUG, "%s", parameterObject.asString().c_str());
  else if (parameterObject.isObject() && parameterObject.isMember("message") && parameterObject["message"].isString())
  {
    if (parameterObject.isMember("level") && !parameterObject["level"].isString())
      return InvalidParams;

    CStdString strlevel = parameterObject.get("level", "debug").asString();
    int level = ParseLogLevel(strlevel.ToLower().c_str());

    CLog::Log(level, "%s", parameterObject["message"].asString().c_str());
  }
  else
    return InvalidParams;

  return ACK;
}
开发者ID:mbolhuis,项目名称:xbmc,代码行数:19,代码来源:XBMCOperations.cpp

示例11: while

const CStdString& CDirectoryHistory::GetSelectedItem(const CStdString& strDirectory) const
{
  CStdString strDir = strDirectory;
  strDir.ToLower();
  while (CUtil::HasSlashAtEnd(strDir) )
  {
    strDir = strDir.Left(strDir.size() - 1);
  }
  for (int i = 0; i < (int)m_vecHistory.size(); ++i)
  {
    const CHistoryItem& item = m_vecHistory[i];
    if ( strDir == item.m_strDirectory)
    {

      return item.m_strItem;
    }
  }
  return m_strNull;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:19,代码来源:DirectoryHistory.cpp

示例12: GetGenres

JSONRPC_STATUS CVideoLibrary::GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
  CStdString media = parameterObject["type"].asString();
  media = media.ToLower();
  int idContent = -1;

  CStdString strPath = "videodb://";
  /* select which video content to get genres from*/
  if (media.Equals("movie"))
  {
    idContent = VIDEODB_CONTENT_MOVIES;
    strPath += "1";
  }
  else if (media.Equals("tvshow"))
  {
    idContent = VIDEODB_CONTENT_TVSHOWS;
    strPath += "2";
  }
  else if (media.Equals("musicvideo"))
  {
    idContent = VIDEODB_CONTENT_MUSICVIDEOS;
    strPath += "3";
  }
  strPath += "/1/";
 
  CVideoDatabase videodatabase;
  if (!videodatabase.Open())
    return InternalError;

  CFileItemList items;
  if (videodatabase.GetGenresNav(strPath, items, idContent))
  {
    /* need to set strTitle in each item*/
    for (unsigned int i = 0; i < (unsigned int)items.Size(); i++)
      items[i]->GetVideoInfoTag()->m_strTitle = items[i]->GetLabel();
 
    HandleFileItemList("genreid", false, "genres", items, parameterObject, result);
  }

  videodatabase.Close();
  return OK;
}
开发者ID:snikhil0,项目名称:xbmc,代码行数:42,代码来源:VideoLibrary.cpp

示例13: SearchAndSetChannelIcons

void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
  if (g_guiSettings.GetString("pvrmenu.iconpath").IsEmpty())
    return;

  CPVRDatabase *database = GetPVRDatabase();
  if (!database)
    return;

  CSingleLock lock(m_critSection);

  for (unsigned int ptr = 0; ptr < size(); ptr++)
  {
    PVRChannelGroupMember groupMember = at(ptr);

    /* skip if an icon is already set */
    if (!groupMember.channel->IconPath().IsEmpty())
      continue;

    CStdString strBasePath = g_guiSettings.GetString("pvrmenu.iconpath");
    CStdString strChannelName = groupMember.channel->ClientChannelName();

    CStdString strIconPath = strBasePath + groupMember.channel->ClientChannelName();
    CStdString strIconPathLower = strBasePath + strChannelName.ToLower();
    CStdString strIconPathUid;
    strIconPathUid.Format("%s/%08d", strBasePath, groupMember.channel->UniqueID());

    groupMember.channel->SetIconPath(strIconPath      + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPath      + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPath      + ".png", bUpdateDb) ||

    groupMember.channel->SetIconPath(strIconPathLower + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathLower + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathLower + ".png", bUpdateDb) ||

    groupMember.channel->SetIconPath(strIconPathUid   + ".tbn", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathUid   + ".jpg", bUpdateDb) ||
    groupMember.channel->SetIconPath(strIconPathUid   + ".png", bUpdateDb);

    /* TODO: start channel icon scraper here if nothing was found */
  }
}
开发者ID:Omel,项目名称:xbmc,代码行数:42,代码来源:PVRChannelGroup.cpp

示例14: CleanupGLX

void CVideoReferenceClock::CleanupGLX()
{
  CLog::Log(LOGDEBUG, "CVideoReferenceClock: Cleaning up GLX");

  bool AtiWorkaround = false;
  const char* VendorPtr = (const char*)glGetString(GL_VENDOR);
  if (VendorPtr)
  {
    CStdString Vendor = VendorPtr;
    Vendor.ToLower();
    if (Vendor.compare(0, 3, "ati") == 0)
    {
      CLog::Log(LOGDEBUG, "CVideoReferenceClock: GL_VENDOR: %s, using ati dpy workaround", VendorPtr);
      AtiWorkaround = true;
    }
  }

  if (m_vInfo)
  {
    XFree(m_vInfo);
    m_vInfo = NULL;
  }
  if (m_Context)
  {
    glXMakeCurrent(m_Dpy, None, NULL);
    glXDestroyContext(m_Dpy, m_Context);
    m_Context = NULL;
  }
  if (m_Window)
  {
    XDestroyWindow(m_Dpy, m_Window);
    m_Window = 0;
  }

  //ati saves the Display* in their libGL, if we close it here, we crash
  if (m_Dpy && !AtiWorkaround)
  {
    XCloseDisplay(m_Dpy);
    m_Dpy = NULL;
  }
}
开发者ID:AWilco,项目名称:xbmc,代码行数:41,代码来源:VideoReferenceClock.cpp

示例15: IsPathToMedia

static bool IsPathToMedia(const CStdString& strPath )
{
  CStdString extension;
  URIUtils::GetExtension(strPath, extension);

  if (extension.IsEmpty())
    return false;

  extension.ToLower();

  if (g_settings.m_videoExtensions.Find(extension) != -1)
    return true;

  if (g_settings.m_musicExtensions.Find(extension) != -1)
    return true;

  if (g_settings.m_pictureExtensions.Find(extension) != -1)
    return true;

  return false;
}
开发者ID:2BReality,项目名称:xbmc,代码行数:21,代码来源:RSSDirectory.cpp


注:本文中的CStdString::ToLower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。