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


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

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


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

示例1: ConvertLine


//.........这里部分代码省略.........
      tempColorTag += tagOptionValue.substr(4,2);
      tempColorTag += tagOptionValue.substr(2,2);
      tempColorTag += tagOptionValue.substr(0,2);
      tempColorTag += "]";
      strUTF8.insert(pos, tempColorTag);
      pos += tempColorTag.length();
    }
    else if (StringUtils::StartsWith(fullTag, "<font"))
    {
      int pos2 = 5;
      while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0)
      {
        CStdString tagOptionName = m_tagOptions->GetMatch(1);
        CStdString tagOptionValue = m_tagOptions->GetMatch(2);
        pos2 += tagOptionName.length() + tagOptionValue.length();
        if (tagOptionName == "color")
        {
          m_flag[FLAG_COLOR] = true;
          CStdString tempColorTag = "[COLOR ";
          if (tagOptionValue[0] == '#')
          {
            tagOptionValue.erase(0, 1);
            tempColorTag += "FF";
          }
          else if( tagOptionValue.size() == 6 )
          {
            bool bHex = true;
            for( int i=0 ; i<6 ; i++ )
            {
              char temp = tagOptionValue[i];
              if( !(('0' <= temp && temp <= '9') ||
                ('a' <= temp && temp <= 'f') ||
                ('A' <= temp && temp <= 'F') ))
              {
                bHex = false;
                break;
              }
            }
            if( bHex ) tempColorTag += "FF";
          }
          tempColorTag += tagOptionValue;
          tempColorTag += "]";
          strUTF8.insert(pos, tempColorTag);
          pos += tempColorTag.length();
        }
      }
    }
    else if (lang && (StringUtils::StartsWith(fullTag, "<p ")))
    {
      int pos2 = 3;
      while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0)
      {
        CStdString tagOptionName = m_tagOptions->GetMatch(1);
        CStdString tagOptionValue = m_tagOptions->GetMatch(2);
        pos2 += tagOptionName.length() + tagOptionValue.length();
        if (tagOptionName == "class")
        {
          if (m_flag[FLAG_LANGUAGE])
          {
            strUTF8.erase(del_start, pos - del_start);
            pos = del_start;
          }
          if (!tagOptionValue.compare(lang))
          {
            m_flag[FLAG_LANGUAGE] = false;
          }
          else
          {
            m_flag[FLAG_LANGUAGE] = true;
            del_start = pos;
          }
          break;
        }
      }
    }
    else if (fullTag == "</p>" && m_flag[FLAG_LANGUAGE])
    {
      strUTF8.erase(del_start, pos - del_start);
      pos = del_start;
      m_flag[FLAG_LANGUAGE] = false;
    }
    else if (fullTag == "<br>" && !strUTF8.empty())
    {
      strUTF8.insert(pos, "\n");
      pos += 1;
    }
  }

  if(m_flag[FLAG_LANGUAGE])
    strUTF8.erase(del_start);

  if (strUTF8.empty())
    return;

  if( strUTF8[strUTF8.size()-1] == '\n' )
    strUTF8.erase(strUTF8.size()-1);

  // add a new text element to our container
  pOverlay->AddElement(new CDVDOverlayText::CElementText(strUTF8.c_str()));
}
开发者ID:Anankin,项目名称:xbmc,代码行数:101,代码来源:DVDSubtitleTagSami.cpp

示例2: LoadItem

/**
 * Look for a thumbnail for pItem.  If one does not exist, look for an autogenerated
 * thumbnail.  If that does not exist, attempt to autogenerate one.  Finally, check
 * for the existance of fanart and set properties accordingly.
 * @return: true if pItem has been modified
 */
bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
{
  if (pItem->m_bIsShareOrDrive
  ||  pItem->IsParentFolder())
    return false;

  m_database->Open();

  if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->HasStreamDetails() &&
     (pItem->GetVideoInfoTag()->m_type == "movie" || pItem->GetVideoInfoTag()->m_type == "episode" || pItem->GetVideoInfoTag()->m_type == "musicvideo"))
  {
    if (m_database->GetStreamDetails(*pItem->GetVideoInfoTag()))
      pItem->SetInvalid();
  }

  // video db items normally have info in the database
  if (pItem->HasVideoInfoTag() && !pItem->HasArt("thumb"))
  {
    FillLibraryArt(*pItem);

    if (!pItem->GetVideoInfoTag()->m_type.empty()         &&
         pItem->GetVideoInfoTag()->m_type != "movie"      &&
         pItem->GetVideoInfoTag()->m_type != "tvshow"     &&
         pItem->GetVideoInfoTag()->m_type != "episode"    &&
         pItem->GetVideoInfoTag()->m_type != "musicvideo")
    {
      m_database->Close();
      return true; // nothing else to be done
    }
  }

  // if we have no art, look for it all
  map<string, string> artwork = pItem->GetArt();
  if (artwork.empty())
  {
    vector<string> artTypes = GetArtTypes(pItem->HasVideoInfoTag() ? pItem->GetVideoInfoTag()->m_type : "");
    if (find(artTypes.begin(), artTypes.end(), "thumb") == artTypes.end())
      artTypes.push_back("thumb"); // always look for "thumb" art for files
    for (vector<string>::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i)
    {
      std::string type = *i;
      std::string art = GetCachedImage(*pItem, type);
      if (art.empty())
      {
        art = GetLocalArt(*pItem, type, type=="fanart");
        if (!art.empty()) // cache it
          SetCachedImage(*pItem, type, art);
      }
      if (!art.empty())
      {
        CTextureCache::Get().BackgroundCacheImage(art);
        artwork.insert(make_pair(type, art));
      }
    }
    SetArt(*pItem, artwork);
  }

  // thumbnails are special-cased due to auto-generation
  if (!pItem->m_bIsFolder && pItem->IsVideo())
  {
    // An auto-generated thumb may have been cached on a different device - check we have it here 
    CStdString url = pItem->GetArt("thumb");
    if (url.compare(0, 14, "image://[email protected]") == 0 && !CTextureCache::Get().HasCachedImage(url))
      pItem->SetArt("thumb", "");

    if (!pItem->HasArt("thumb"))
    {
      // create unique thumb for auto generated thumbs
      CStdString thumbURL = GetEmbeddedThumbURL(*pItem);
      if (CTextureCache::Get().HasCachedImage(thumbURL))
      {
        CTextureCache::Get().BackgroundCacheImage(thumbURL);
        pItem->SetProperty("HasAutoThumb", true);
        pItem->SetProperty("AutoThumbImage", thumbURL);
        pItem->SetArt("thumb", thumbURL);
        // Item has cached autogen image but no art entry. Save it to db.
        CVideoInfoTag* info = pItem->GetVideoInfoTag();
        if (info->m_iDbId > 0 && !info->m_type.empty())
          m_database->SetArtForItem(info->m_iDbId, info->m_type, "thumb", thumbURL);
      }
      else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
        g_guiSettings.GetBool("myvideos.extractflags"))
      {
        CFileItem item(*pItem);
        CStdString path(item.GetPath());
        if (URIUtils::IsInRAR(item.GetPath()))
          SetupRarOptions(item,path);

        CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL);
        AddJob(extract);

        m_database->Close();
        return true;
      }
//.........这里部分代码省略.........
开发者ID:AdolphHuan,项目名称:xbmc,代码行数:101,代码来源:VideoThumbLoader.cpp

示例3: ADDON_SetSetting

ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
{
  // SetSetting can occur when the addon is enabled, but TV support still
  // disabled. In that case the addon is not loaded, so we should not try
  // to change its settings.
  if (!XBMC)
    return ADDON_STATUS_OK;

  CStdString sname(settingName);
  if (sname == "host")
  {
    if (g_strHostname.compare((const char *)settingValue) != 0)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "user")
  {
    if (g_strUsername.compare((const char *)settingValue) != 0)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "pass")
  {
    if (g_strPassword.compare((const char *)settingValue) != 0)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "streamport")
  {
    if (g_iPortStream != *(int *)settingValue)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "webport")
  {
    if (g_iPortWeb != *(int *)settingValue)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "recordingport")
  {
    if (g_iPortRecording != *(int *)settingValue)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "usefavourites")
  {
    if (g_bUseFavourites != *(bool *)settingValue)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "favouritespath")
  {
    if (g_strFavouritesPath.compare((const char *)settingValue) != 0)
      return ADDON_STATUS_NEED_RESTART;
  }
  else if (sname == "usetimeshift")
  {
    bool newValue = *(bool *)settingValue;
    if (g_bUseTimeshift != newValue)
    {
      XBMC->Log(LOG_DEBUG, "%s - Changed Setting '%s' from '%u' to '%u'", __FUNCTION__,
          settingName, g_bUseTimeshift, newValue);
      g_bUseTimeshift = newValue;
    }
  }
  else if (sname == "timeshiftpath")
  {
    CStdString newValue = (const char *)settingValue;
    if (g_strTimeshiftBufferPath != newValue)
    {
      XBMC->Log(LOG_DEBUG, "%s - Changed Setting '%s' from '%s' to '%s'", __FUNCTION__,
          settingName, g_strTimeshiftBufferPath.c_str(), newValue.c_str());
      g_strTimeshiftBufferPath = newValue;
    }
  }
  return ADDON_STATUS_OK;
}
开发者ID:Memphiz,项目名称:pvr.dvbviewer,代码行数:71,代码来源:client.cpp

示例4: SetFieldExclusionGroup

void SetFieldExclusionGroup(const CStdString& group)
{
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesAuthor", (0 == group.compare(L"ExcludeFieldCodesAuthor")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesAutomation", (0 == group.compare(L"ExcludeFieldCodesAutomation")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesDocument", (0 == group.compare(L"ExcludeFieldCodesDocument")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesFormFields", (0 == group.compare(L"ExcludeFieldCodesFormFields")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesFormulas", (0 == group.compare(L"ExcludeFieldCodesFormulas")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesHyperlinks", (0 == group.compare(L"ExcludeFieldCodesHyperlinks")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesIncludeFields", (0 == group.compare(L"ExcludeFieldCodesIncludeFields")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesLinks", (0 == group.compare(L"ExcludeFieldCodesLinks")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesNumbering", (0 == group.compare(L"ExcludeFieldCodesNumbering")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesReferences", (0 == group.compare(L"ExcludeFieldCodesReferences")));
	Workshare::OptionApi::SetBool(L"ExcludeFieldCodesTables", (0 == group.compare(L"ExcludeFieldCodesTables")));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:14,代码来源:SetFieldExclusionGroup.cpp


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