本文整理汇总了C++中CStdString::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::Empty方法的具体用法?C++ CStdString::Empty怎么用?C++ CStdString::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::Empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetURLWithoutFilename
void CURL::GetURLWithoutFilename(CStdString& strURL) const
{
unsigned int sizeneed = m_strProtocol.length()
+ m_strDomain.length()
+ m_strUserName.length()
+ m_strPassword.length()
+ m_strHostName.length()
+ 10;
if( strURL.capacity() < sizeneed )
strURL.reserve(sizeneed);
if (m_strProtocol == "")
{
#ifdef _LINUX
strURL.Empty();
#else
strURL = m_strFileName.substr(0, 2); // only copy 'e:'
#endif
return ;
}
strURL = m_strProtocol;
strURL += "://";
if (m_strDomain != "")
{
strURL += m_strDomain;
strURL += ";";
}
else if (m_strUserName != "")
{
strURL += URLEncodeInline(m_strUserName);
if (m_strPassword != "")
{
strURL += ":";
strURL += URLEncodeInline(m_strPassword);
}
strURL += "@";
}
else if (m_strDomain != "")
strURL += "@";
if (m_strHostName != "")
{
if( m_strProtocol.Equals("rar") || m_strProtocol.Equals("zip") || m_strProtocol.Equals("musicsearch"))
strURL += URLEncodeInline(m_strHostName);
else
strURL += m_strHostName;
if (HasPort())
{
CStdString strPort;
strPort.Format("%i", m_iPort);
strURL += ":";
strURL += strPort;
}
strURL += "/";
}
}
示例2: PaintText
void CEditUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
if( m_sText.IsEmpty() ) return;
CStdString sText = m_sText;
if( m_bPasswordMode ) {
sText.Empty();
LPCTSTR p = m_sText.GetData();
while( *p != _T('\0') ) {
sText += m_cPasswordChar;
p = ::CharNext(p);
}
}
RECT rc = m_rcItem;
rc.left += m_rcTextPadding.left;
rc.right -= m_rcTextPadding.right;
rc.top += m_rcTextPadding.top;
rc.bottom -= m_rcTextPadding.bottom;
if( IsEnabled() ) {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
else {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
}
示例3: GetErrorDescription
void DMSHelper::GetErrorDescription(HRESULT hr, CStdString& sErrReason)
{
sErrReason.Empty();
if( GetDocProvProxy())
{
GetDocProvProxy()->GetErrorDescription(hr, sErrReason);
}
}
示例4: StartServer
bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, const CStdString &password/*=""*/)
{
bool success = false;
CStdString pw = password;
CNetworkInterface *net = g_application.getNetwork().GetFirstConnectedInterface();
StopServer(true);
if (net)
{
m_macAddress = net->GetMacAddress();
m_macAddress.Replace(":","");
while (m_macAddress.size() < 12)
{
m_macAddress = CStdString("0") + m_macAddress;
}
}
else
{
m_macAddress = "000102030405";
}
if (!usePassword)
{
pw.Empty();
}
ServerInstance = new CAirTunesServer(port, nonlocal);
if (ServerInstance->Initialize(password))
{
ServerInstance->Create();
success = true;
}
if (success)
{
CStdString appName;
appName.Format("%[email protected]", m_macAddress.c_str());
std::map<std::string, std::string> txt;
txt["cn"] = "0,1";
txt["ch"] = "2";
txt["ek"] = "1";
txt["et"] = "0,1";
txt["sv"] = "false";
txt["tp"] = "UDP";
txt["sm"] = "false";
txt["ss"] = "16";
txt["sr"] = "44100";
txt["pw"] = "false";
txt["vn"] = "3";
txt["txtvers"] = "1";
CZeroconf::GetInstance()->PublishService("servers.airtunes", "_raop._tcp", appName, port, txt);
}
return success;
}
示例5:
bool N7Xml::GetString(XMLNode xRootNode, const char* strTag, CStdString& strStringValue)
{
XMLNode xNode = xRootNode.getChildNode(strTag );
if (!xNode.isEmpty())
{
strStringValue = xNode.getText();
return true;
}
strStringValue.Empty();
return false;
}
示例6: ExtractQuoteInfo
////////////////////////////////////////////////////////////////////////////////////
// Function: ExtractQuoteInfo()
// Extracts the information in quotes from the string line, returning it in quote
////////////////////////////////////////////////////////////////////////////////////
bool CCueDocument::ExtractQuoteInfo(const CStdString &line, CStdString "e)
{
quote.Empty();
int left = line.Find('\"');
if (left < 0) return false;
int right = line.Find('\"', left + 1);
if (right < 0) return false;
quote = line.Mid(left + 1, right - left - 1);
g_charsetConverter.unknownToUTF8(quote);
return true;
}
示例7: GetEncoding
/*!
Returns true if the encoding of the document is other then UTF-8.
/param strEncoding Returns the encoding of the document. Empty if UTF-8
*/
bool XMLUtils::GetEncoding(const CXBMCTinyXML* pDoc, CStdString& strEncoding)
{
const TiXmlNode* pNode=NULL;
while ((pNode=pDoc->IterateChildren(pNode)) && pNode->Type()!=TiXmlNode::TINYXML_DECLARATION) {}
if (!pNode) return false;
const TiXmlDeclaration* pDecl=pNode->ToDeclaration();
if (!pDecl) return false;
strEncoding=pDecl->Encoding();
if (strEncoding.Equals("UTF-8") || strEncoding.Equals("UTF8")) strEncoding.Empty();
strEncoding.MakeUpper();
return !strEncoding.IsEmpty(); // Other encoding then UTF8?
}
示例8: GetString
bool CGUIControlFactory::GetString(const TiXmlNode* pRootNode, const char *strTag, CStdString &text)
{
if (!XMLUtils::GetString(pRootNode, strTag, text))
return false;
if (text == "-")
text.Empty();
if (StringUtils::IsNaturalNumber(text))
text = g_localizeStrings.Get(atoi(text.c_str()));
else
g_charsetConverter.unknownToUTF8(text);
return true;
}
示例9: GetString
bool XMLUtils::GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue)
{
const TiXmlElement* pElement = pRootNode->FirstChildElement(strTag );
if (!pElement) return false;
const TiXmlNode* pNode = pElement->FirstChild();
if (pNode != NULL)
{
strStringValue = pNode->Value();
return true;
}
strStringValue.Empty();
return false;
}
示例10: Create
HRESULT CNfoFile::Create(const CStdString& strPath)
{
if (FAILED(Load(strPath)))
return E_FAIL;
CStdString strURL;
CFileItemList items;
bool bNfo=false;
if (m_strContent.Equals("albums"))
{
CAlbum album;
bNfo = GetDetails(album);
CDirectory::GetDirectory("q:\\system\\scrapers\\music",items,".xml",false);
}
else if (m_strContent.Equals("artists"))
{
CArtist artist;
bNfo = GetDetails(artist);
CDirectory::GetDirectory("q:\\system\\scrapers\\music",items,".xml",false);
}
else if (m_strContent.Equals("tvshows") || m_strContent.Equals("movies") || m_strContent.Equals("musicvideos"))
{
// first check if it's an XML file with the info we need
CVideoInfoTag details;
bNfo = GetDetails(details);
CDirectory::GetDirectory(_P("q:\\system\\scrapers\\video"),items,".xml",false);
if (m_strContent.Equals("tvshows") && bNfo) // need to identify which scraper
strURL = details.m_strEpisodeGuide;
}
if (bNfo)
{
m_strScraper = "NFO";
if (!m_strContent.Equals("tvshows") || !CUtil::GetFileName(strPath).Equals("tvshow.nfo")) // need to identify which scraper
return S_OK;
}
for (int i=0;i<items.Size();++i)
{
if (!items[i]->m_bIsFolder && !FAILED(Scrape(items[i]->m_strPath,strURL)))
{
strURL.Empty();
break;
}
}
if (m_strContent.Equals("tvshows"))
return (strURL.IsEmpty() && !m_strScraper.IsEmpty())?S_OK:E_FAIL;
return (m_strImDbUrl.size() > 0) ? S_OK : E_FAIL;
}
示例11: Lookup
bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddress)
{
if (strHostName.empty() && strIpAddress.empty())
return false;
// first see if this is already an ip address
unsigned long address = inet_addr(strHostName.c_str());
strIpAddress.Empty();
if (address != INADDR_NONE)
{
strIpAddress.Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
return true;
}
示例12: GetFirstFontSetUnicode
bool GUIFontManager::GetFirstFontSetUnicode(CStdString& strFontSet)
{
strFontSet.Empty();
// Load our font file
CXBMCTinyXML xmlDoc;
if (!OpenFontFile(xmlDoc))
return false;
TiXmlElement* pRootElement = xmlDoc.RootElement();
const TiXmlNode *pChild = pRootElement->FirstChild();
CStdString strValue = pChild->Value();
if (strValue == "fontset")
{
while (pChild)
{
strValue = pChild->Value();
if (strValue == "fontset")
{
const char* idAttr = ((TiXmlElement*) pChild)->Attribute("id");
const char* unicodeAttr = ((TiXmlElement*) pChild)->Attribute("unicode");
// Check if this is a fontset with a ttf attribute set to true
if (unicodeAttr != NULL && stricmp(unicodeAttr, "true") == 0)
{
// This is the first ttf fontset
strFontSet=idAttr;
break;
}
}
pChild = pChild->NextSibling();
}
// If no fontset was loaded
if (pChild == NULL)
CLog::Log(LOGWARNING, "file doesnt have <fontset> with attribute unicode=\"true\"");
}
else
{
CLog::Log(LOGERROR, "file doesnt have <fontset> in <fonts>, but rather %s", strValue.c_str());
}
return !strFontSet.IsEmpty();
}
示例13: SecondsToTimeString
void StringUtils::SecondsToTimeString(long lSeconds, CStdString& strHMS, TIME_FORMAT format)
{
int hh = lSeconds / 3600;
lSeconds = lSeconds % 3600;
int mm = lSeconds / 60;
int ss = lSeconds % 60;
if (format == TIME_FORMAT_GUESS)
format = (hh >= 1) ? TIME_FORMAT_HH_MM_SS : TIME_FORMAT_MM_SS;
strHMS.Empty();
if (format & TIME_FORMAT_HH)
strHMS.AppendFormat("%02.2i", hh);
if (format & TIME_FORMAT_MM)
strHMS.AppendFormat(strHMS.IsEmpty() ? "%02.2i" : ":%02.2i", mm);
if (format & TIME_FORMAT_SS)
strHMS.AppendFormat(strHMS.IsEmpty() ? "%02.2i" : ":%02.2i", ss);
}
示例14: GetPath
bool XMLUtils::GetPath(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue)
{
const TiXmlElement* pElement = pRootNode->FirstChildElement(strTag);
if (!pElement) return false;
int pathVersion = 0;
pElement->Attribute("pathversion", &pathVersion);
const char* encoded = pElement->Attribute("urlencoded");
const TiXmlNode* pNode = pElement->FirstChild();
if (pNode != NULL)
{
strStringValue = pNode->Value();
if (encoded && strcasecmp(encoded,"yes") == 0)
CURL::Decode(strStringValue);
strStringValue = CSpecialProtocol::ReplaceOldPath(strStringValue, pathVersion);
return true;
}
strStringValue.Empty();
return false;
}
示例15: GetCsv
void Serializer::GetCsv(const char* key, std::list<CStdString>& value, bool required)
{
CStdString stringValue;
stringValue.Trim();
CStdString element;
bool first = true;
GetString(key, stringValue, required);
for(unsigned int i=0; i<stringValue.length(); i++)
{
TCHAR c = stringValue[i];
if(c == ',')
{
if(first)
{
first = false; // only erase default value if something found
value.clear();
}
element.Trim();
CStdString unescapedElement;
UnEscapeCsv(element, unescapedElement);
value.push_back(unescapedElement);
element.Empty();
}
else
{
element += c;
}
}
if (!element.IsEmpty())
{
if(first)
{
first = false; // only erase default value if something found
value.clear();
}
element.Trim();
CStdString unescapedElement;
UnEscapeCsv(element, unescapedElement);
value.push_back(unescapedElement);
}
}