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


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

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


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

示例1: GetDVDMenuLanguage

const char* CAddonCallbacksAddon::GetDVDMenuLanguage(const void* addonData)
{
  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
  if (!helper)
    return NULL;

  CStdString string = g_langInfo.GetDVDMenuLanguage();

  char *buffer = (char*) malloc (string.length()+1);
  strcpy(buffer, string.c_str());
  return buffer;
}
开发者ID:MickeXBMC,项目名称:xbmc,代码行数:12,代码来源:AddonCallbacksAddon.cpp

示例2: GetAllStationLastUpdateALLOK

//////////////////////////////////////////////////////////////////////////////////////
//
// 函数功能描述:处理获取本地或服务器的网站最后更新时间成功的需要做的操作
// 输入:szResult 网站最后更新时间字符串
// 输出:
// 返回值:1 成功 ; 0 失败
// 其它说明:
//
//////////////////////////////////////////////////////////////////////////////////////
DWORD CWebService::GetAllStationLastUpdateALLOK(const CStdString &szResult)           
{
	if (szResult.length() ==0)
	{
		CStdString strBack;
		g_log.Trace(LOGL_TOP, LOGT_ERROR,__TFILE__, __LINE__,_T("1.bin文件下载失败,主控退出"));

		strBack.Format(_T("BackResult(;0)1.bin下载失败(;0)(;0)"));
		BYTE * pByData = (BYTE *)strBack.c_str();

		g_ServerSocket->SendData(strBack.size() * 2,E_GET_EXCUTE_TASK_RESULT,(char*)pByData);
		g_ServerSocket->UnInit();

		ExitProcess(0);	//退出主控
		return 1;
	}

	std::map<DWORD, T_ServerNetStationInfo*> *pMapLastUpdateTime = NULL;
	pMapLastUpdateTime = new std::map<DWORD, T_ServerNetStationInfo*>;

	ASSERT(pMapLastUpdateTime != NULL);
	m_dwNetLastupdateIndex = g_GlobalDataBlock->GetGlobalID();
	g_GlobalDataBlock->WriteRealData(m_dwNetLastupdateIndex,
		E_ServerNetStationInfoGroup, pMapLastUpdateTime,
		E_WEBSERVICE_CLASS,eWithoutUse);


    SaveLastUpdateToMap(m_dwNetLastupdateIndex, szResult);

	g_log.Trace(LOGL_LOW, LOGT_PROMPT, __TFILE__, __LINE__,\
		_T("GetAllStationLastUpdateALLOK,size: %d ") ,pMapLastUpdateTime->size());

	if (0 == pMapLastUpdateTime->size())
	{
		g_log.Trace(LOGL_LOW, LOGT_PROMPT, __TFILE__, __LINE__,\
			_T("GetAllStationLastUpdateALLOK, %s") ,szResult.c_str());
	}

	dwIsAllNetstationLastUpdateGetted = 1;

	if (1 == dwIsAllNetstationLastUpdateGetted 
		&& 0 == m_dwWebServiceAllStationLastUpdateSended)
		//最新的网站列表获取了 &&  最新的网站最后时间也获取了 &&独立三代任务数据的最后时间也获取了 && 还没有向PPD发送数据已经全部准备好的信息
	{
		PostMessage(E_DATAPRE_THREAD,E_PPD_LASTUPDATE_GETTED_MSG,
			m_dwNetLastupdateIndex);  //网站最后更新时间已经获取了,通知准备线程更新

		m_dwWebServiceAllStationLastUpdateSended = 1;
	}

    return BIZMC_OK;
}
开发者ID:vizcount,项目名称:work,代码行数:61,代码来源:WebService.cpp

示例3: CellTesting

// helper
void TestEMFDecoding::CellTesting(RTFTable* pTable, int iIndex, int iRows, int iCols, const CStdString& sText, int iText/*==1*/)
{
	RTFCell* pCell =(RTFCell *)GetNthObject(pTable, rotCellcontent, iIndex);
	
	NUnit::Framework::Assert::IsTrue(pCell->GetColsSpanned() == iCols, "Spans incorrect cells");
	NUnit::Framework::Assert::IsTrue(pCell->GetRowsSpanned() == iRows, "Spans bad rows");
	if (sText.length() != 0)
	{
		RTFPCData* pData =(RTFPCData*)GetNthObject(pCell, rotPcdata, iText);
		CWideString s = pData->GetContent();
		NUnit::Framework::Assert::IsTrue(s == sText, "Should have the given Text");
	}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:14,代码来源:TestEMFDecoding.cpp

示例4: SetProtocolOptions

void CURL::SetProtocolOptions(const CStdString& strOptions)
{
  m_strProtocolOptions.Empty();
  m_protocolOptions.Clear();
  if (strOptions.length() > 0)
  {
    if (strOptions[0] == '|')
      m_strProtocolOptions = strOptions.Mid(1);
    else
      m_strProtocolOptions = strOptions;
    m_protocolOptions.AddOptions(m_strProtocolOptions);
  }
}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:13,代码来源:URL.cpp

示例5: SetOptions

void CURL::SetOptions(const CStdString& strOptions)
{
  m_strOptions.Empty();
  if( strOptions.length() > 0)
  {
    if( strOptions[0] == '?' || strOptions[0] == '#' || strOptions[0] == ';' || strOptions.Find("xml") >=0 )
    {
      m_strOptions = strOptions;
    }
    else
      CLog::Log(LOGWARNING, "%s - Invalid options specified for url %s", __FUNCTION__, strOptions.c_str());
  }
}
开发者ID:tmacreturns,项目名称:XBMC_wireless_setup,代码行数:13,代码来源:URL.cpp

示例6: SetPlot

void CEpgInfoTag::SetPlot(const CStdString &strPlot)
{

  CStdString strPlotClean = (m_strPlotOutline.length() > 0 && strPlot.Left(m_strPlotOutline.length()).Equals(m_strPlotOutline)) ?
    strPlot.Right(strPlot.length() - m_strPlotOutline.length()) :
    strPlot;

  if (m_strPlot != strPlotClean)
  {
    m_strPlot = strPlotClean;
    m_bChanged = true;
    UpdatePath();
  }
}
开发者ID:macardi,项目名称:xbmc,代码行数:14,代码来源:EpgInfoTag.cpp

示例7: GetByPath

CFileItemPtr CPVRChannelGroups::GetByPath(const CStdString &strPath) const
{
  // get the filename from curl
  CURL url(strPath);
  CStdString strFileName = url.GetFileName();
  URIUtils::RemoveSlashAtEnd(strFileName);

  CStdString strCheckPath;
  for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
  {
    // check if the path matches
    strCheckPath.Format("channels/%s/%s/", (*it)->IsRadio() ? "radio" : "tv", (*it)->GroupName().c_str());
    if (strFileName.Left(strCheckPath.length()) == strCheckPath)
    {
      strFileName.erase(0, strCheckPath.length());
      return (*it)->GetByIndex(atoi(strFileName.c_str()));
    }
  }

  // no match
  CFileItemPtr retVal(new CFileItem);
  return retVal;
}
开发者ID:RobertMe,项目名称:xbmc,代码行数:23,代码来源:PVRChannelGroups.cpp

示例8: Parse

void CGUIInfoColor::Parse(const CStdString &label, int context)
{
  // Check for the standard $INFO[] block layout, and strip it if present
  CStdString label2 = label;
  if (label.Equals("-", false))
    return;

  if (label.Left(4).Equals("$VAR", false))
  {
    label2 = label.Mid(5, label.length() - 6);
    m_info = g_infoManager.TranslateSkinVariableString(label2, context);
    if (!m_info)
      m_info = g_infoManager.RegisterSkinVariableString(g_SkinInfo->CreateSkinVariable(label2, context));
    return;
  }

  if (label.Left(5).Equals("$INFO", false))
    label2 = label.Mid(6, label.length()-7);

  m_info = g_infoManager.TranslateString(label2);
  if (!m_info)
    m_color = g_colorManager.GetColor(label);
}
开发者ID:MrBishop,项目名称:xbmc,代码行数:23,代码来源:GUIInfoTypes.cpp

示例9: GetLocalizedTime

const char* CAddonCallbacksAddon::GetLocalizedTime(const void* addonData,time_t time, bool bWithSeconds)
{
  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
  if (!helper)
    return NULL;

  CDateTime date(time);

  CStdString string = date.GetAsLocalizedTime("",bWithSeconds);

  char *buffer = (char*) malloc (string.length()+1);
  strcpy(buffer, string.c_str());
  return buffer;
}
开发者ID:Kr0nZ,项目名称:xbmc,代码行数:14,代码来源:AddonCallbacksAddon.cpp

示例10: ParseItemRSS

static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns, const CStdString& path)
{
  CStdString text = item_child->GetText();
  if (name == "title")
  {
    if(text.length() > item->m_strTitle.length())
      item->m_strTitle = text;
  }
  else if (name == "pubDate")
  {
    CDateTime pubDate(ParseDate(text));
    item->m_dateTime = pubDate;
  }
  else if (name == "link")
  {
    SResource res;
    res.tag  = "rss:link";
    res.path = text;
    resources.push_back(res);
  }
  else if(name == "enclosure")
  {
    const char * len  = item_child->Attribute("length");

    SResource res;
    res.tag = "rss:enclosure";
    res.path = XMLUtils::GetAttribute(item_child, "url");
    res.mime = XMLUtils::GetAttribute(item_child, "type");
    if(len)
      res.size = _atoi64(len);

    resources.push_back(res);
  }
  else if(name == "description")
  {
    CStdString description = text;
    HTML::CHTMLUtil::RemoveTags(description);
    item->SetProperty("description", description);
  }
  else if(name == "guid")
  {
    if(IsPathToMedia(text))
    {
      SResource res;
      res.tag  = "rss:guid";
      res.path = text;
      resources.push_back(res);
    }
  }
}
开发者ID:dougall08,项目名称:xbmc,代码行数:50,代码来源:RSSDirectory.cpp

示例11: GenerateUniquePathNameFromDocID

CStdString DocProvHelper::GenerateUniquePathNameFromDocID(CStdString sDocumentID) const
{
	sDocumentID.Trim();

	/* TXTEX_IGNORE */ 	sDocumentID.Replace( '\\', _T('/') );
	/* TXTEX_IGNORE */ 	sDocumentID.Replace( _T("://"), _T("/") );

	int nLastPeriod = (x64_int_cast)sDocumentID.length() - 4;
	/* TXTEX_IGNORE */ 	if( nLastPeriod >= 0 && sDocumentID.GetAt( nLastPeriod ) == _T('.') )
		/* TXTEX_IGNORE */ 		sDocumentID.SetAt( nLastPeriod, _T('_') );

	return ReplaceInvalidFileNameChars(sDocumentID);

}
开发者ID:killbug2004,项目名称:WSProf,代码行数:14,代码来源:DocProvHelper.cpp

示例12: Parse

void CGUIInfoColor::Parse(const CStdString &label)
{
  // Check for the standard $INFO[] block layout, and strip it if present
  CStdString label2 = label;
  if (label.Equals("-", false))
    return;

  if (label.Left(5).Equals("$INFO", false))
    label2 = label.Mid(6, label.length()-7);

  m_info = g_infoManager.TranslateString(label2);
  if (!m_info)
    m_color = g_colorManager.GetColor(label);
}
开发者ID:maoueh,项目名称:xbmc,代码行数:14,代码来源:GUIInfoTypes.cpp

示例13: Parse

void CGUIInfoColor::Parse(const CStdString &label, int context)
{
  // Check for the standard $INFO[] block layout, and strip it if present
  CStdString label2 = label;
  if (label.Equals("-", false))
    return;

  if (StringUtils::StartsWithNoCase(label, "$var["))
  {
    label2 = label.substr(5, label.length() - 6);
    m_info = g_infoManager.TranslateSkinVariableString(label2, context);
    if (!m_info)
      m_info = g_infoManager.RegisterSkinVariableString(g_SkinInfo->CreateSkinVariable(label2, context));
    return;
  }

  if (StringUtils::StartsWithNoCase(label, "$info["))
    label2 = label.substr(6, label.length()-7);

  m_info = g_infoManager.TranslateString(label2);
  if (!m_info)
    m_color = g_colorManager.GetColor(label);
}
开发者ID:DasMarx,项目名称:xbmc,代码行数:23,代码来源:GUIInfoTypes.cpp

示例14: TestReplaceFileExtension

void TestGlobalMethods::TestReplaceFileExtension()
{
	CStdString sFile = _T("NotPDF.doc");
	CStdString sExtension = _T("pdf");
	CStdString sResult = ReplaceFileExtension(sFile, sExtension.c_str());
	int iPosition = sResult.ReverseFind(_T('.'));
	CStdString sNewExtension = sResult.Right((int)sResult.length() - (iPosition + 1));
	assertMessage(0 != iPosition, _T("Failed to locate file extension separator '.'"));
	assertMessage(0 == (int)sExtension.CompareNoCase(sNewExtension), _T("Failed to match the expected extension 'pdf'"));

	sFile = _T("IsPDF.pdf");
	sExtension = _T("pdf");
	sResult = ReplaceFileExtension(sFile, sExtension.c_str());
	sNewExtension = sResult.Right((int)sResult.length() - (sResult.Find(_T("."), 0) + 1));
	assertMessage(sExtension.length() == sNewExtension.length(), _T("We expected the extension lengths to be equal"));

	sFile = _T("NoExtension");
	sExtension = _T("pdf");
	sResult = ReplaceFileExtension(sFile, sExtension.c_str());
	iPosition = sResult.ReverseFind(_T('.'));
	assertMessage(0 != iPosition, _T("Failed to locate file extension separator '.'"));
	assertMessage(0 == (int)sExtension.CompareNoCase(sResult.Right((int)sResult.length() - (iPosition + 1))), _T("Failed to match the expected extension 'pdf'"));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:23,代码来源:TestGlobalMethods.cpp

示例15: readCharMapFromXML

void CKeyboardLayoutConfiguration::readCharMapFromXML(const TiXmlElement* pXMLMap, map<WCHAR, WCHAR>& charToCharMap, const char* mapRootElement)
{
  if (pXMLMap && !pXMLMap->NoChildren())
  { // map keys
    const TiXmlElement* pEntry = pXMLMap->FirstChildElement();
    while (pEntry)
    {
      CStdString strInChar = pEntry->Attribute("inchar");
      CStdString strOutChar = pEntry->Attribute("outchar");
      if (strInChar.length() > 0 && strOutChar.length() > 0)
      {
        CStdStringW fromStr;
        g_charsetConverter.utf8ToW(strInChar, fromStr);
        CStdStringW toStr;
        g_charsetConverter.utf8ToW(strOutChar, toStr);
        if (fromStr.size()==1 && toStr.size()==1)
        {
          charToCharMap.insert(pair<WCHAR, WCHAR>(fromStr[0], toStr[0]));
          CLog::Log(LOGDEBUG, "insert map entry from %c to %c ", fromStr[0], toStr[0]);
        }
        else
        {
          CLog::Log(LOGERROR, "String from %ls or to %ls does not have the expected length of 1", fromStr.c_str(), toStr.c_str());
        }
      }
      else
      {
        CLog::Log(LOGERROR, "map entry misses attribute <inchar> or <outchar> or content of them");
      }
      pEntry = pEntry->NextSiblingElement();
    }
  }
  else
  {
    CLog::Log(LOGDEBUG, "XML-Configuration doesn't contain expected map root element %s", mapRootElement);
  }
}
开发者ID:A600,项目名称:xbmc,代码行数:37,代码来源:KeyboardLayoutConfiguration.cpp


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