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


C++ CStdStringArray类代码示例

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


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

示例1: SplitString

vector<string> StringUtils::Split(const std::string& input, const std::string& delimiter, unsigned int iMaxStrings /* = 0 */)
{
    vector<string> strArray;
    if (input.empty())
        return strArray;

    CStdStringArray result;
    SplitString(input, delimiter, result, iMaxStrings);

    for (unsigned int index = 0; index < result.size(); index++)
        strArray.push_back(result.at(index));

    return strArray;
}
开发者ID:Rogaven,项目名称:xbmc,代码行数:14,代码来源:StringUtils.cpp

示例2: ResolveConstant

CStdString CGUIIncludes::ResolveConstant(const CStdString &constant) const
{
  CStdStringArray values;
  StringUtils::SplitString(constant, ",", values);
  for (unsigned int i = 0; i < values.size(); ++i)
  {
    map<CStdString, CStdString>::const_iterator it = m_constants.find(values[i]);
    if (it != m_constants.end())
      values[i] = it->second;
  }
  CStdString value;
  StringUtils::JoinString(values, ",", value);
  return value;
}
开发者ID:AWilco,项目名称:xbmc,代码行数:14,代码来源:GUIIncludes.cpp

示例3: Clear

bool DvbChannel::FromConfRecord(const CStdString &record)
{
  // parse a record from channels.conf and extract relevant info from it.
  // note that channels.conf is different between DVBT and ATSC but this should work on both
  Clear();
  CStdStringArray params;
  StringUtils::SplitString(record, ":", params);

  if (params.size() < 5)
    return false;

  if (params[0].Find(';') == -1)
  {
    m_serviceName = params[0];
    m_serviceProvider = "";
  }
  else
  {
    CStdStringArray params2;
    StringUtils::SplitString(params[0], ";", params2);
    m_serviceName = params2[0];
    m_serviceProvider = params2[1];
  }

  m_serverChannelName = m_serviceName;
  m_serverChannelNameShort = m_serviceName;

  m_freq = params[1];
  m_tuningParams = params[2];
  m_videoPid = atoi(params[3]);
  ParseAudioPids(params[4], false);
  ParseAudioPids(params[5], true);
  m_serviceId = atoi(params[6]);
  m_originalNetworkId = atoi(params[7]);
  m_transportStreamId = atoi(params[8]);
  m_virtualChannel = params[9];

  if (m_virtualChannel == "0.0")
    m_virtualChannel = "";

  //optional, only for development without server
  if (params.size() > 10)
    m_serverId = params[10];

  m_isEnabled = true;

  return true;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:48,代码来源:dvbchannel.cpp

示例4: CAddon

CSkinInfo::CSkinInfo(const cp_extension_t *ext)
  : CAddon(ext)
{
  ELEMENTS elements;
  if (CAddonMgr::Get().GetExtElements(ext->configuration, "res", elements))
  {
    for (ELEMENTS::iterator i = elements.begin(); i != elements.end(); ++i)
    {
      int width = atoi(CAddonMgr::Get().GetExtValue(*i, "@width"));
      int height = atoi(CAddonMgr::Get().GetExtValue(*i, "@height"));
      bool defRes = CAddonMgr::Get().GetExtValue(*i, "@default").Equals("true");
      CStdString folder = CAddonMgr::Get().GetExtValue(*i, "@folder");
      float aspect = 0;
      CStdStringArray fracs;
      CStdString strAspect = CAddonMgr::Get().GetExtValue(*i, "@aspect");
      StringUtils::SplitString(strAspect, ":", fracs);
      if (fracs.size() == 2)
        aspect = (float)(atof(fracs[0].c_str())/atof(fracs[1].c_str()));
      if (width > 0 && height > 0)
      {
        RESOLUTION_INFO res(width, height, aspect, folder);
        res.strId = strAspect; // for skin usage, store aspect string in strId
        if (defRes)
          m_defaultRes = res;
        m_resolutions.push_back(res);
      }
    }
  }
  else
  { // no resolutions specified -> backward compatibility
    CStdString defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultwideresolution");
    if (defaultWide.IsEmpty())
      defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolution");
    TranslateResolution(defaultWide, m_defaultRes);
  }

  CStdString str = CAddonMgr::Get().GetExtValue(ext->configuration, "@effectslowdown");
  if (!str.IsEmpty())
    m_effectsSlowDown = (float)atof(str.c_str());
  else
    m_effectsSlowDown = 1.f;

  str = CAddonMgr::Get().GetExtValue(ext->configuration, "@debugging");
  m_debugging = !strcmp(str.c_str(), "true");

  LoadStartupWindows(ext);
  m_Version = 2.11;
}
开发者ID:cpaowner,项目名称:xbmc,代码行数:48,代码来源:Skin.cpp

示例5: TranslateKeyboardString

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:tmacreturns,项目名称:XBMC_wireless_setup,代码行数:48,代码来源:ButtonTranslator.cpp

示例6: ShowAndGetFileList

bool CGUIDialogFileBrowser::ShowAndGetFileList(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, CStdStringArray &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */)
{
  CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser();
  if (!browser)
    return false;
  g_windowManager.AddUniqueInstance(browser);

  browser->m_useFileDirectories = useFileDirectories;
  browser->m_multipleSelection = true;
  browser->m_browsingForImages = useThumbs;
  browser->SetHeading(heading);
  browser->SetSources(shares);
  browser->m_browsingForFolders = 0;
  browser->m_rootDir.SetMask(mask);
  browser->m_addNetworkShareEnabled = false;
  browser->DoModal();
  bool confirmed(browser->IsConfirmed());
  if (confirmed)
  {
    if (browser->m_markedPath.size())
      path = browser->m_markedPath;
    else
      path.push_back(browser->m_selectedPath);
  }
  g_windowManager.Remove(browser->GetID());
  delete browser;
  return confirmed;
}
开发者ID:Pulfer,项目名称:xbmc,代码行数:28,代码来源:GUIDialogFileBrowser.cpp

示例7: GetDirectory

  bool CStackDirectory::GetDirectory(const CStdString& strPath, CFileItemList& items)
  {
    items.Clear();
    CStdStringArray files;
    if (!GetPaths(strPath, files))
      return false;   // error in path

    for (unsigned int i = 0; i < files.size(); i++)
    {
      CStdString file = files[i];
      CFileItemPtr item(new CFileItem(file));
      item->SetPath(file);
      item->m_bIsFolder = false;
      items.Add(item);
    }
    return true;
  }
开发者ID:CharlieMarshall,项目名称:xbmc,代码行数:17,代码来源:StackDirectory.cpp

示例8: TEST

TEST(TestStringUtils, FindBestMatch)
{
  double refdouble, vardouble;
  int refint, varint;
  CStdStringArray strarray;

  refint = 3;
  refdouble = 0.5625f;
  strarray.push_back("");
  strarray.push_back("a");
  strarray.push_back("e");
  strarray.push_back("es");
  strarray.push_back("t");
  varint = StringUtils::FindBestMatch("test", strarray, vardouble);
  EXPECT_EQ(refint, varint);
  EXPECT_EQ(refdouble, vardouble);
}
开发者ID:SuhasBharadwajK,项目名称:xbmc,代码行数:17,代码来源:TestStringUtils.cpp

示例9: 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

示例10: lock

void CGUIRSSControl::Render()
{
  // only render the control if they are enabled
  if (g_guiSettings.GetBool("lookandfeel.enablerssfeeds") && g_rssManager.IsActive())
  {
    CSingleLock lock(m_criticalSection);
    // Create RSS background/worker thread if needed
    if (m_pReader == NULL)
    {
      if (g_rssManager.GetReader(GetID(), GetParentID(), this, m_pReader))
        m_scrollInfo.characterPos = m_pReader->m_SavedScrollPos;
      else
      {
        if (m_strRSSTags != "")
        {
          CStdStringArray vecSplitTags;

          StringUtils::SplitString(m_strRSSTags, ",", vecSplitTags);

          for (unsigned int i = 0;i < vecSplitTags.size();i++)
            m_pReader->AddTag(vecSplitTags[i]);
        }
        // use half the width of the control as spacing between feeds, and double this between feed sets
        float spaceWidth = (m_label.font) ? m_label.font->GetCharWidth(L' ') : 15;
        m_pReader->Create(this, m_vecUrls, m_vecIntervals, (int)(0.5f*GetWidth() / spaceWidth) + 1, m_rtl);
      }
    }

    if (m_label.font)
    {
      vecColors colors;
      colors.push_back(m_label.textColor);
      colors.push_back(m_headlineColor);
      colors.push_back(m_channelColor);
      m_label.font->DrawScrollingText(m_posX, m_posY, colors, m_label.shadowColor, m_feed, 0, m_width, m_scrollInfo);
    }

    if (m_pReader)
    {
      m_pReader->CheckForUpdates();
      m_pReader->m_SavedScrollPos = m_scrollInfo.characterPos;
    }
  }
  CGUIControl::Render();
}
开发者ID:A600,项目名称:xbmc,代码行数:45,代码来源:GUIRSSControl.cpp

示例11: FindBestMatch

int StringUtils::FindBestMatch(const CStdString &str, const CStdStringArray &strings, double &matchscore)
{
  int best = -1;
  matchscore = 0;

  int i = 0;
  for (CStdStringArray::const_iterator it = strings.begin(); it != strings.end(); it++, i++)
  {
    int maxlength = max(str.length(), it->length());
    double score = StringUtils::CompareFuzzy(str, *it) / maxlength;
    if (score > matchscore)
    {
      matchscore = score;
      best = i;
    }
  }
  return best;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例12:

void CWIN32Util::ExtendDllPath()
{
  CStdString strEnv;
  CStdStringArray vecEnv;
  strEnv = CEnvironment::getenv("PATH");
  if (strEnv.IsEmpty())
    CLog::Log(LOGWARNING, "Can get system env PATH or PATH is empty");

  StringUtils::SplitString(DLL_ENV_PATH, ";", vecEnv);
  for (int i=0; i<(int)vecEnv.size(); ++i)
    strEnv.append(";" + CSpecialProtocol::TranslatePath(vecEnv[i]));

  if (CEnvironment::setenv("PATH", strEnv) == 0)
    CLog::Log(LOGDEBUG,"Setting system env PATH to %S",strEnv.c_str());
  else
    CLog::Log(LOGDEBUG,"Can't set system env PATH to %S",strEnv.c_str());

}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:18,代码来源:WIN32Util.cpp

示例13: GetRegionNames

// Fills the array with the region names available for this language
void CLangInfo::GetRegionNames(CStdStringArray& array)
{
  for (ITMAPREGIONS it=m_regions.begin(); it!=m_regions.end(); ++it)
  {
    CStdString strName=it->first;
    if (strName=="N/A")
      strName=g_localizeStrings.Get(416);
    array.push_back(strName);
  }
}
开发者ID:A600,项目名称:xbmc,代码行数:11,代码来源:LangInfo.cpp

示例14: strcpy

//-------------------------------------------------------------------------------------------------------------------
void Xcddb::addTitle(const char *buffer)
{
  char value[2048];
  int trk_nr = 0;
  //TTITLEN
  if (buffer[7] == '=')
  { //Einstellig
    trk_nr = buffer[6] - 47;
    strcpy(value, buffer + 8);
  }
  else if (buffer[8] == '=')
  { //Zweistellig
    trk_nr = ((buffer[6] - 48) * 10) + buffer[7] - 47;
    strcpy(value, buffer + 9);
  }
  else if (buffer[9] == '=')
  { //Dreistellig
    trk_nr = ((buffer[6] - 48) * 100) + ((buffer[7] - 48) * 10) + buffer[8] - 47;
    strcpy(value, buffer + 10);
  }
  else
  {
    return ;
  }

  // track artist" / "track title
  CStdString strValue = value;
  CStdStringArray values;
  StringUtils::SplitString(value, " / ", values);
  if (values.size() > 1)
  {
    g_charsetConverter.unknownToUTF8(values[0]);
    m_mapArtists[trk_nr] += values[0];
    g_charsetConverter.unknownToUTF8(values[1]);
    m_mapTitles[trk_nr] += values[1];
  }
  else
  {
    g_charsetConverter.unknownToUTF8(values[0]);
    m_mapTitles[trk_nr] += values[0];
  }
}
开发者ID:,项目名称:,代码行数:43,代码来源:

示例15: TranslateUrl

CStdString CVideoDatabaseFile::TranslateUrl(const CURL& url)
{
  CStdString strFileName=URIUtils::GetFileName(url.Get());
  if (strFileName.empty())
	  return "";

  CStdString strPath = URIUtils::GetDirectory(url.Get());
  if (strPath.empty())
	  return "";

  CStdString strExtension = URIUtils::GetExtension(strFileName);
  URIUtils::RemoveExtension(strFileName);

  if (!StringUtils::IsNaturalNumber(strFileName))
    return "";
  long idDb=atol(strFileName.c_str());

  CStdStringArray pathElem;
  StringUtils::SplitString(strPath, "/", pathElem);
  if (pathElem.size() == 0)
    return "";

  CStdString itemType = pathElem.at(2);
  VIDEODB_CONTENT_TYPE type;
  if (itemType.Equals("movies") || itemType.Equals("recentlyaddedmovies"))
    type = VIDEODB_CONTENT_MOVIES;
  else if (itemType.Equals("episodes") || itemType.Equals("recentlyaddedepisodes"))
    type = VIDEODB_CONTENT_EPISODES;
  else if (itemType.Equals("musicvideos") || itemType.Equals("recentlyaddedmusicvideos"))
    type = VIDEODB_CONTENT_MUSICVIDEOS;
  else
    return "";

  CVideoDatabase videoDatabase;
  if (!videoDatabase.Open())
    return "";

  CStdString realFilename;
  videoDatabase.GetFilePathById(idDb, realFilename, type);

  return realFilename;
}
开发者ID:,项目名称:,代码行数:42,代码来源:


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