本文整理汇总了C++中CStdString::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::erase方法的具体用法?C++ CStdString::erase怎么用?C++ CStdString::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::erase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: url
CPVRChannel *CPVRChannels::GetByPath(const CStdString &strPath)
{
CPVRChannels *channels = NULL;
int iChannelNumber = -1;
/* get the filename from curl */
CURL url(strPath);
CStdString strFileName = url.GetFileName();
CUtil::RemoveSlashAtEnd(strFileName);
if (strFileName.Left(16) == "channels/tv/all/")
{
strFileName.erase(0,16);
iChannelNumber = atoi(strFileName.c_str());
channels = &PVRChannelsTV;
}
else if (strFileName.Left(19) == "channels/radio/all/")
{
strFileName.erase(0,19);
iChannelNumber = atoi(strFileName.c_str());
channels = &PVRChannelsRadio;
}
return channels ? channels->GetByChannelNumber(iChannelNumber) : NULL;
}
示例2: Update
void CPVRRecording::Update(const CPVRRecording &tag)
{
m_strRecordingId = tag.m_strRecordingId;
m_iClientId = tag.m_iClientId;
m_strTitle = tag.m_strTitle;
m_recordingTime = tag.m_recordingTime;
m_duration = tag.m_duration;
m_iPriority = tag.m_iPriority;
m_iLifetime = tag.m_iLifetime;
m_strDirectory = tag.m_strDirectory;
m_strPlot = tag.m_strPlot;
m_strPlotOutline = tag.m_strPlotOutline;
m_strStreamURL = tag.m_strStreamURL;
m_strChannelName = tag.m_strChannelName;
m_strGenre = tag.m_strGenre;
CStdString strShow;
strShow.Format("%s - ", g_localizeStrings.Get(20364).c_str());
if (m_strPlotOutline.Left(strShow.size()).Equals(strShow))
{
CStdString strEpisode = m_strPlotOutline;
CStdString strTitle = m_strDirectory;
int pos = strTitle.ReverseFind('/');
strTitle.erase(0, pos + 1);
strEpisode.erase(0, strShow.size());
m_strTitle.Format("%s - %s", strTitle.c_str(), strEpisode);
pos = strEpisode.Find('-');
strEpisode.erase(0, pos + 2);
m_strPlotOutline = strEpisode;
}
UpdatePath();
}
示例3: GetTrackName
CStdString CCDDARipper::GetTrackName(CFileItem *item)
{
// get track number from "cdda://local/01.cdda"
int trackNumber = atoi(item->GetPath().substr(13, item->GetPath().size() - 13 - 5).c_str());
// Format up our ripped file label
CFileItem destItem(*item);
destItem.SetLabel("");
// get track file name format from audiocds.trackpathformat setting,
// use only format part starting from the last '/'
CStdString strFormat = CSettings::Get().GetString("audiocds.trackpathformat");
size_t pos = strFormat.find_last_of("/\\");
if (pos != std::string::npos)
strFormat.erase(0, pos+1);
CLabelFormatter formatter(strFormat, "");
formatter.FormatLabel(&destItem);
// grab the label to use it as our ripped filename
CStdString track = destItem.GetLabel();
if (track.empty())
track = StringUtils::Format("%s%02i", "Track-", trackNumber);
AddonPtr addon;
CAddonMgr::Get().GetAddon(CSettings::Get().GetString("audiocds.encoder"), addon);
if (addon)
{
boost::shared_ptr<CAudioEncoder> enc = boost::static_pointer_cast<CAudioEncoder>(addon);
track += enc->extension;
}
return track;
}
示例4: ParseItem
static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const CStdString& path)
{
for (TiXmlElement* child = root->FirstChildElement(); child; child = child->NextSiblingElement())
{
CStdString name = child->Value();
CStdString xmlns;
size_t pos = name.find(':');
if(pos != std::string::npos)
{
xmlns = name.substr(0, pos);
name.erase(0, pos+1);
}
if (xmlns == "media")
ParseItemMRSS (item, resources, child, name, xmlns, path);
else if (xmlns == "itunes")
ParseItemItunes (item, resources, child, name, xmlns, path);
else if (xmlns == "voddler")
ParseItemVoddler(item, resources, child, name, xmlns, path);
else if (xmlns == "boxee")
ParseItemBoxee (item, resources, child, name, xmlns, path);
else if (xmlns == "zn")
ParseItemZink (item, resources, child, name, xmlns, path);
else if (xmlns == "svtplay")
ParseItemSVT (item, resources, child, name, xmlns, path);
else
ParseItemRSS (item, resources, child, name, xmlns, path);
}
}
示例5: DeleteChannelsFromGroup
bool CPVRDatabase::DeleteChannelsFromGroup(const CPVRChannelGroup &group, const vector<int> &channelsToDelete)
{
bool bDelete(true);
unsigned int iDeletedChannels(0);
/* invalid group id */
if (group.GroupID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid group id: %d", __FUNCTION__, group.GroupID());
return false;
}
while (iDeletedChannels < channelsToDelete.size())
{
CStdString strChannelsToDelete;
for (unsigned int iChannelPtr = 0; iChannelPtr + iDeletedChannels < channelsToDelete.size() && iChannelPtr < 50; iChannelPtr++)
strChannelsToDelete += StringUtils::Format(", %d", channelsToDelete.at(iDeletedChannels + iChannelPtr));
if (!strChannelsToDelete.empty())
{
strChannelsToDelete.erase(0, 2);
Filter filter;
filter.AppendWhere(PrepareSQL("idGroup = %u", group.GroupID()));
filter.AppendWhere(PrepareSQL("idChannel IN (%s)", strChannelsToDelete.c_str()));
bDelete = DeleteValues("map_channelgroups_channels", filter) && bDelete;
}
iDeletedChannels += 50;
}
return bDelete;
}
示例6: GetDirectory
bool CPVRRecordings::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
bool bSuccess(false);
CFileItemList files;
{
CSingleLock lock(m_critSection);
CURL url(strPath);
CStdString strFileName = url.GetFileName();
URIUtils::RemoveSlashAtEnd(strFileName);
if (strFileName.Left(10) == "recordings")
{
strFileName.erase(0, 10);
GetSubDirectories(strFileName, &items, true);
GetContents(strFileName, &files);
bSuccess = true;
}
}
if(bSuccess)
{
for (int i = 0; i < files.Size(); i++)
{
CFileItemPtr pFileItem = files.Get(i);
CFileItemPtr pThumbItem = items.Get(pFileItem->GetPath());
if (!pThumbItem->HasThumbnail())
m_thumbLoader.LoadItem(pThumbItem.get());
}
}
return bSuccess;
}
示例7: RemoveExtension
void URIUtils::RemoveExtension(CStdString& strFileName)
{
if(IsURL(strFileName))
{
CURL url(strFileName);
strFileName = url.GetFileName();
RemoveExtension(strFileName);
url.SetFileName(strFileName);
strFileName = url.Get();
return;
}
size_t period = strFileName.find_last_of("./\\");
if (period != string::npos && strFileName[period] == '.')
{
CStdString strExtension = strFileName.substr(period);
StringUtils::ToLower(strExtension);
strExtension += "|";
CStdString strFileMask;
strFileMask = g_advancedSettings.m_pictureExtensions;
strFileMask += "|" + g_advancedSettings.m_musicExtensions;
strFileMask += "|" + g_advancedSettings.m_videoExtensions;
strFileMask += "|" + g_advancedSettings.m_subtitlesExtensions;
#if defined(TARGET_DARWIN)
strFileMask += "|.py|.xml|.milk|.xpr|.xbt|.cdg|.app|.applescript|.workflow";
#else
strFileMask += "|.py|.xml|.milk|.xpr|.xbt|.cdg";
#endif
strFileMask += "|";
if (strFileMask.find(strExtension) != std::string::npos)
strFileName.erase(period);
}
}
示例8: iChannelIndex
const CPVRChannel *CPVRChannelGroupsContainer::GetByPath(const CStdString &strPath)
{
const CPVRChannelGroup *channels = NULL;
int iChannelIndex(-1);
/* get the filename from curl */
CURL url(strPath);
CStdString strFileName = url.GetFileName();
URIUtils::RemoveSlashAtEnd(strFileName);
CStdString strCheckPath;
for (unsigned int bRadio = 0; bRadio <= 1; bRadio++)
{
const CPVRChannelGroups *groups = Get(bRadio == 1);
for (unsigned int iGroupPtr = 0; iGroupPtr < groups->size(); iGroupPtr++)
{
const CPVRChannelGroup *group = groups->at(iGroupPtr);
strCheckPath.Format("channels/%s/%s/", group->IsRadio() ? "radio" : "tv", group->GroupName().c_str());
if (strFileName.Left(strCheckPath.length()) == strCheckPath)
{
strFileName.erase(0, strCheckPath.length());
channels = group;
iChannelIndex = atoi(strFileName.c_str());
break;
}
}
}
return channels ? channels->GetByIndex(iChannelIndex) : NULL;
}
示例9: GetAndCutNextTerm
void CTextSearch::GetAndCutNextTerm(CStdString &strSearchTerm, CStdString &strNextTerm)
{
CStdString strFindNext(" ");
if (StringUtils::EndsWith(strSearchTerm, "\""))
{
strSearchTerm.erase(0, 1);
strFindNext = "\"";
}
int iNextPos = strSearchTerm.Find(strFindNext);
if (iNextPos != -1)
{
strNextTerm = strSearchTerm.Left(iNextPos);
strSearchTerm.erase(0, iNextPos + 1);
}
else
{
strNextTerm = strSearchTerm;
strSearchTerm.clear();
}
}
示例10: ReplaceInvalidFileNameChars
CStdString DocProvHelper::ReplaceInvalidFileNameChars(CStdString sString) const
{
while (true)
{
/* TXTEX_IGNORE */ int iPos = sString.FindOneOf(_T(":*?\"&<>|"));
if (iPos==-1)
break;
sString.erase(sString.begin()+iPos);
}
return sString;
}
示例11: GetCommonPath
void URIUtils::GetCommonPath(CStdString& strParent, const CStdString& strPath)
{
// find the common path of parent and path
unsigned int j = 1;
while (j <= min(strParent.size(), strPath.size()) && strnicmp(strParent.c_str(), strPath.c_str(), j) == 0)
j++;
strParent.erase(j - 1);
// they should at least share a / at the end, though for things such as path/cd1 and path/cd2 there won't be
if (!HasSlashAtEnd(strParent))
{
strParent = GetDirectory(strParent);
AddSlashAtEnd(strParent);
}
}
示例12: GetDocNumFromDocID
CStdString CIManTestUtils::GetDocNumFromDocID(CStdString sDocID)
{
int iSlash = (x64_int_cast)sDocID.rfind(_T('/'));
if(iSlash == -1)
return _T("");
sDocID.resize(iSlash);
iSlash = (x64_int_cast)sDocID.rfind(_T('/'));
if(iSlash == -1)
return _T("");
sDocID.erase(0, iSlash + 1);
return sDocID;
}
示例13: ff_avutil_log
void ff_avutil_log(void* ptr, int level, const char* format, va_list va)
{
static CStdString buffer;
AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
if(level >= AV_LOG_DEBUG && g_advancedSettings.m_logLevel <= LOG_LEVEL_DEBUG_SAMBA)
return;
else if(g_advancedSettings.m_logLevel <= LOG_LEVEL_NORMAL)
return;
int type;
switch(level)
{
case AV_LOG_INFO : type = LOGINFO; break;
case AV_LOG_ERROR : type = LOGERROR; break;
case AV_LOG_DEBUG :
default : type = LOGDEBUG; break;
}
CStdString message, prefix;
message.FormatV(format, va);
prefix = "ffmpeg: ";
if(avc)
{
if(avc->item_name)
prefix += CStdString("[") + avc->item_name(ptr) + "] ";
else if(avc->class_name)
prefix += CStdString("[") + avc->class_name + "] ";
}
buffer += message;
int pos, start = 0;
while( (pos = buffer.find_first_of('\n', start)) >= 0 )
{
if(pos>start)
CLog::Log(type, "%s%s", prefix.c_str(), buffer.substr(start, pos-start).c_str());
start = pos+1;
}
buffer.erase(0, start);
}
示例14: GetCustomExtensions
void CAdvancedSettings::GetCustomExtensions(TiXmlElement *pRootElement, CStdString& extensions)
{
CStdString extraExtensions;
CSettings::GetString(pRootElement,"add",extraExtensions,"");
if (extraExtensions != "")
extensions += "|" + extraExtensions;
CSettings::GetString(pRootElement,"remove",extraExtensions,"");
if (extraExtensions != "")
{
CStdStringArray exts;
StringUtils::SplitString(extraExtensions,"|",exts);
for (unsigned int i=0;i<exts.size();++i)
{
int iPos = extensions.Find(exts[i]);
if (iPos == -1)
continue;
extensions.erase(iPos,exts[i].size()+1);
}
}
}
示例15: OnProfilePath
bool CGUIDialogProfileSettings::OnProfilePath(CStdString &dir, bool isDefault)
{
VECSOURCES shares;
CMediaSource share;
share.strName = "Profiles";
share.strPath = "special://masterprofile/profiles/";
shares.push_back(share);
CStdString strDirectory;
if (dir.IsEmpty())
strDirectory = share.strPath;
else
strDirectory = URIUtils::AddFileToFolder("special://masterprofile/", dir);
if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares,g_localizeStrings.Get(657),strDirectory,true))
{
dir = strDirectory;
if (!isDefault)
dir.erase(0,24);
return true;
}
return false;
}