本文整理汇总了C++中CStdString::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::Right方法的具体用法?C++ CStdString::Right怎么用?C++ CStdString::Right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::Right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveFromPath
void PathHelper::RemoveFromPath(CStdString sPath)
{
CStdString sFullPath = GetProcessPath();
sFullPath.ToLower();
sPath.ToLower();
if ( sPath.Right(1) == _T("\\") )
{
sPath = sPath.Left(sPath.length() - 1);
}
int nStart = (x64_int_cast)sFullPath.find(sPath);
while (nStart >= 0) // there may be multiple copies
{
int nEnd = nStart + (x64_int_cast)sPath.length() + 1;
sFullPath = sFullPath.Left(nStart) + sFullPath.Right(sFullPath.length() - nEnd );
sFullPath.TrimRight();
sFullPath.TrimLeft();
if (sFullPath.Left(1) == _T(";"))
sFullPath = sFullPath.Mid(1);
sFullPath.Replace(_T(";;"),_T(";"));
nStart = (x64_int_cast)sFullPath.find(sPath);
}
SetProcessPath(sFullPath);
}
示例2: RequestItems
void CLocalFilesSource::RequestItems(bool bUseCurPath)
{
CBoxeeSort previousSort = m_sourceSort;
CStdString strPath = GetBasePath();
if (strPath.Find("sources://all") >= 0 || strPath.CompareNoCase("network://protocols") == 0)
{
m_sourceSort.Reset();
}
else if (strPath.IsEmpty() ||
strPath == "network:/" ||
strPath.Equals("afp:/") ||
(strPath.Left(6).Equals("afp://") && strPath.Right(6).Equals(".local")) ||
strPath.Left(15).Equals("smb://computers") ||
strPath == "nfs:/" ||
(strPath.Left(6).Equals("nfs://") && strPath.Right(6).Equals(".local")) ||
strPath.Left(6).Equals("upnp:/") ||
strPath.Left(5).Equals("bms:/")
)
{
CBoxeeSort specialCasesSort(VIEW_SORT_METHOD_ATOZ, SORT_METHOD_LABEL, SORT_ORDER_ASC, g_localizeStrings.Get(53505), "start");
m_sourceSort = specialCasesSort;
}
CBrowseWindowSource::RequestItems(bUseCurPath);
m_sourceSort = previousSort;
}
示例3: UpdateSortButtonState
void CGUIWindowBoxeeBrowseLocal::UpdateSortButtonState()
{
CStdString strPath = ((CLocalBrowseWindowState*)m_windowState)->GetCurrentPath();
if (CUtil::HasSlashAtEnd(strPath))
{
// remove slash at the end
strPath.Delete(strPath.size() - 1);
}
if (strPath.IsEmpty() ||
strPath == "sources://all" ||
strPath == "network:/" ||
strPath == "network://protocols" ||
strPath.Equals("afp:/") ||
(strPath.Left(6).Equals("afp://") && strPath.Right(6).Equals(".local")) ||
strPath.Left(15).Equals("smb://computers") ||
strPath == "nfs:/" ||
(strPath.Left(6).Equals("nfs://") && strPath.Right(6).Equals(".local")) ||
strPath.Left(6).Equals("upnp:/") ||
strPath.Left(5).Equals("bms:/")
)
{
SET_CONTROL_HIDDEN(SORT_DROPDOWN_BUTTON);
}
else
{
SET_CONTROL_VISIBLE(SORT_DROPDOWN_BUTTON);
}
return;
}
示例4: Init
bool Codec::Init(const CStdString & strFile, unsigned int filecache) {
m_bufferSize = 2048 * sizeof(int16_t) * 50;
m_buffer = new char[m_bufferSize];
CStdString uri = URIUtils::GetFileName(strFile);
CStdString extension = uri.Right(uri.GetLength() - uri.Find('.') - 1);
if (extension.Left(12) == "spotifyradio") {
//if its a radiotrack the radionumber and tracknumber is secretly encoded at the end of the extension
CStdString trackStr = extension.Right(
extension.GetLength() - extension.ReverseFind('#') - 1);
Logger::printOut(extension);
CStdString radioNumber = extension.Left(uri.Find('#'));
Logger::printOut(radioNumber);
radioNumber = radioNumber.Right(
radioNumber.GetLength() - radioNumber.Find('#') - 1);
Logger::printOut("loading codec radio");
RadioHandler::getInstance()->pushToTrack(atoi(radioNumber),
atoi(trackStr));
}
//we have a non legit extension so remove it manually
uri = uri.Left(uri.Find('.'));
Logger::printOut("trying to load track:");
Logger::printOut(uri);
sp_link *spLink = sp_link_create_from_string(uri);
m_currentTrack = sp_link_as_track(spLink);
sp_track_add_ref(m_currentTrack);
sp_link_release(spLink);
m_endOfTrack = false;
m_bufferPos = 0;
m_startStream = false;
m_isPlayerLoaded = false;
m_TotalTime = sp_track_duration(m_currentTrack);
//prefetch the next track!
CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_MUSIC);
int nextSong = g_playlistPlayer.GetNextSong();
if (nextSong >= 0 && nextSong < playlist.size()){
CFileItemPtr song = playlist[nextSong];
if (song != NULL){
CStdString uri = song->GetPath();
if (uri.Left(7).Equals("spotify")){
uri = uri.Left(uri.Find('.'));
Logger::printOut("prefetching track:");
Logger::printOut(uri);
sp_link *spLink = sp_link_create_from_string(uri);
sp_track* track = sp_link_as_track(spLink);
sp_session_player_prefetch(getSession(), track);
sp_link_release(spLink);
}
}
}
return true;
}
示例5: Dialog_Numeric
PyObject* Dialog_Numeric(PyObject *self, PyObject *args)
{
int inputtype = 0;
CStdString value;
PyObject *heading = NULL;
char *cDefault = NULL;
SYSTEMTIME timedate;
GetLocalTime(&timedate);
if (!PyArg_ParseTuple(args, (char*)"iO|s", &inputtype, &heading, &cDefault)) return NULL;
CStdString utf8Heading;
if (heading && PyXBMCGetUnicodeString(utf8Heading, heading, 1))
{
if (inputtype == 1)
{
if (cDefault && strlen(cDefault) == 10)
{
CStdString sDefault = cDefault;
timedate.wDay = atoi(sDefault.Left(2));
timedate.wMonth = atoi(sDefault.Mid(3,4));
timedate.wYear = atoi(sDefault.Right(4));
}
bool gotDate;
Py_BEGIN_ALLOW_THREADS
gotDate = CGUIDialogNumeric::ShowAndGetDate(timedate, utf8Heading);
Py_END_ALLOW_THREADS
if (gotDate)
value.Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
else
{
Py_INCREF(Py_None);
return Py_None;
}
}
else if (inputtype == 2)
{
if (cDefault && strlen(cDefault) == 5)
{
CStdString sDefault = cDefault;
timedate.wHour = atoi(sDefault.Left(2));
timedate.wMinute = atoi(sDefault.Right(2));
}
bool gotTime;
Py_BEGIN_ALLOW_THREADS
gotTime = CGUIDialogNumeric::ShowAndGetTime(timedate, utf8Heading);
Py_END_ALLOW_THREADS
if (gotTime)
value.Format("%2d:%02d", timedate.wHour, timedate.wMinute);
else
{
Py_INCREF(Py_None);
return Py_None;
}
}
else if (inputtype == 3)
示例6: GetDocumentChecksum
DocXDocumentStore::DocXDocumentStore( CStdString sFileName, bool bReadOnly, bool )
: m_sFileName(sFileName),
m_dwChecksum(0)
{
if( _waccess( sFileName, bReadOnly ? 04 : 06 ) != 0 )
Workshare::Exception::Throw(CStdString(_T("Invalid file name")), -1, _T(__FILE__), _T(__FUNCTION__), __LINE__);
if( sFileName.Right(5).CompareNoCase( _T(".docx")) != 0 &&
sFileName.Right(5).CompareNoCase( _T(".docm")) != 0 )
Workshare::Exception::Throw(CStdString(_T("Invalid file name")), -1, _T(__FILE__), _T(__FUNCTION__), __LINE__);
m_dwChecksum = GetDocumentChecksum( bReadOnly );
m_spDocument.reset(new Document(sFileName.c_str(), bReadOnly));
}
示例7: Open
//========================================================================
int CFileURLProtocol::Open(AML_URLContext *h, const char *filename, int flags)
{
if (flags != URL_RDONLY)
{
CLog::Log(LOGDEBUG, "CFileURLProtocol::Open: Only read-only is supported");
return -EINVAL;
}
CStdString url = filename;
if (url.Left(strlen("xb-http://")).Equals("xb-http://"))
{
url = url.Right(url.size() - strlen("xb-"));
}
else if (url.Left(strlen("xb-https://")).Equals("xb-https://"))
{
url = url.Right(url.size() - strlen("xb-"));
}
else if (url.Left(strlen("xb-ftp://")).Equals("xb-ftp://"))
{
url = url.Right(url.size() - strlen("xb-"));
}
else if (url.Left(strlen("xb-ftps://")).Equals("xb-ftps://"))
{
url = url.Right(url.size() - strlen("xb-"));
}
else if (url.Left(strlen("xb-hdhomerun://")).Equals("xb-hdhomerun://"))
{
url = url.Right(url.size() - strlen("xb-"));
}
CLog::Log(LOGDEBUG, "CFileURLProtocol::Open filename2(%s)", url.c_str());
// open the file, always in read mode, calc bitrate
unsigned int cflags = READ_BITRATE;
XFILE::CFile *cfile = new XFILE::CFile();
if (CFileItem(url, true).IsInternetStream())
cflags |= READ_CACHED;
// open file in binary mode
if (!cfile->Open(url, cflags))
{
delete cfile;
return -EIO;
}
h->priv_data = (void *)cfile;
return 0;
}
示例8: UpdateSaveDate
void DocFileField::UpdateSaveDate(WordParserInfo& wpi)
{
if ( wpi.m_FileSaveTime.wYear == 0)
return;
CStdString sInst = GetInst()->GetAllInstructionText().GetData();
if (sInst.Find(L"SAVEDATE") < 0)
return;
int iPos = sInst.Find(L"@");
if (iPos < 0)
return;
// strip out the format
iPos = sInst.Find(L"\"", iPos);
sInst = sInst.Right(sInst.length() - iPos - 1);
iPos = sInst.Find(L"\"", 0);
sInst = sInst.Left(iPos);
CStdString sOut = GetDateString(sInst, wpi.m_FileSaveTime);
if (sOut.IsEmpty())
return;
int iCount = the_RTFFieldResult->GetCount();
for (int i=0; i<iCount; i++)
{
if (the_RTFFieldResult->At(i)->GetType() == rotPcdata)
{
((RTFPCData*)the_RTFFieldResult->At(i))->SetContent(sOut.c_str());
}
}
}
示例9: PrepareDownload
bool CWebServer::PrepareDownload(const char *path, CVariant &details, std::string &protocol)
{
bool exists = false;
CFile *file = new CFile();
if (file->Open(path))
{
exists = true;
file->Close();
}
delete file;
if (exists)
{
protocol = "http";
string url;
CStdString strPath = path;
if (strPath.Left(8) == "image://" ||
(strPath.Left(10) == "special://" && strPath.Right(4) == ".tbn"))
url = "image/";
else
url = "vfs/";
CURL::Encode(strPath);
url += strPath;
details["path"] = url;
}
return exists;
}
示例10: GetTypeName
// Get the thread name using the implementation dependant typeid() class
// and attempt to clean it.
CStdString CThread::GetTypeName(void)
{
CStdString name = typeid(*this).name();
#if defined(_MSC_VER)
// Visual Studio 2010 returns the name as "class CThread" etc
if (name.substr(0, 6) == "class ")
name = name.Right(name.length() - 6);
#elif defined(__GNUC__) && !defined(__clang__)
// gcc provides __cxa_demangle to demangle the name
char* demangled = NULL;
int status;
demangled = __cxa_demangle(name.c_str(), NULL, 0, &status);
if (status == 0)
name = demangled;
else
CLog::Log(LOGDEBUG,"%s, __cxa_demangle(%s) failed with status %d", __FUNCTION__, name.c_str(), status);
if (demangled)
free(demangled);
#endif
return name;
}
示例11: IsAllowed
/*!
\brief Test if file have an allowed extension, as specified with SetMask()
\param strFile File to test
\return \e true if file is allowed
\note If extension is ".ifo", filename format must be "vide_ts.ifo" or
"vts_##_0.ifo". If extension is ".dat", filename format must be
"AVSEQ##(#).DAT", "ITEM###(#).DAT" or "MUSIC##(#).DAT".
*/
bool IDirectory::IsAllowed(const CStdString& strFile) const
{
if (m_strFileMask.empty() || strFile.empty())
return true;
// Check if strFile have an allowed extension
if (!URIUtils::HasExtension(strFile, m_strFileMask))
return false;
// We should ignore all non dvd/vcd related ifo and dat files.
if (URIUtils::HasExtension(strFile, ".ifo"))
{
CStdString fileName = URIUtils::GetFileName(strFile);
// Allow filenames of the form video_ts.ifo or vts_##_0.ifo
return fileName.CompareNoCase("video_ts.ifo") == 0 ||
(fileName.length() == 12 && fileName.Left(4).CompareNoCase("vts_") == 0 &&
fileName.Right(6).CompareNoCase("_0.ifo") == 0);
}
if (URIUtils::HasExtension(strFile, ".dat"))
{
CStdString fileName = URIUtils::GetFileName(strFile);
// Allow filenames of the form AVSEQ##(#).DAT, ITEM###(#).DAT
// and MUSIC##(#).DAT
return (fileName.length() == 11 || fileName.length() == 12) &&
(fileName.Left(5).CompareNoCase("AVSEQ") == 0 || fileName.Left(5).CompareNoCase("MUSIC") == 0 ||
fileName.Left(4).CompareNoCase("ITEM") == 0);
}
return true;
}
示例12: IsAllowed
/*!
\brief Test a file for an extension specified with SetMask().
\param strFile File to test
\return Returns \e true, if file is allowed.
*/
bool IDirectory::IsAllowed(const CStdString& strFile) const
{
CStdString strExtension;
if ( !m_strFileMask.size() ) return true;
if ( !strFile.size() ) return true;
URIUtils::GetExtension(strFile, strExtension);
if (!strExtension.size()) return false;
strExtension.ToLower();
strExtension += '|'; // ensures that we have a | at the end of it
if (m_strFileMask.Find(strExtension) != -1)
{ // it's allowed, but we should also ignore all non dvd related ifo files.
if (strExtension.Equals(".ifo|"))
{
CStdString fileName = URIUtils::GetFileName(strFile);
if (fileName.Equals("video_ts.ifo")) return true;
if (fileName.length() == 12 && fileName.Left(4).Equals("vts_") && fileName.Right(6).Equals("_0.ifo")) return true;
return false;
}
if (strExtension.Equals(".dat|"))
{
CStdString fileName = URIUtils::GetFileName(strFile);
/* VCD filenames are of the form AVSEQ##(#).DAT, ITEM###(#).DAT, MUSIC##(#).DAT - i.e. all 11 or 12 characters long
starting with AVSEQ, MUSIC or ITEM */
if ((fileName.length() == 11 || fileName.length() == 12) &&
(fileName.Left(5).Equals("AVSEQ") || fileName.Left(5).Equals("MUSIC") || fileName.Left(4).Equals("ITEM")))
return true;
return false;
}
return true;
}
return false;
}
示例13: GetCsvMap
void Serializer::GetCsvMap(const char* key, std::map<CStdString, CStdString>& value, bool required)
{
std::list<CStdString> cvsList;
GetCsv(key, cvsList, required);
for(std::list<CStdString>::iterator it = cvsList.begin(); it != cvsList.end(); it++)
{
CStdString keyValuePair = *it;
int colonPos = keyValuePair.Find(':');
if(colonPos != -1)
{
CStdString key = keyValuePair.Left(colonPos);
CStdString val = keyValuePair.Right(keyValuePair.size() - colonPos - 1);
CStdString unescapedKey;
UnEscapePair(key, unescapedKey);
CStdString unescapedVal;
UnEscapePair(val, unescapedVal);
value.insert(std::make_pair(unescapedKey, unescapedVal));
}
else
{
throw(CStdString("DeSerializer: GetCsvMap: missing colon in map element"));
}
}
}
示例14: IsAllowed
/*!
\brief Test a file for an extension specified with SetMask().
\param strFile File to test
\return Returns \e true, if file is allowed.
*/
bool IDirectory::IsAllowed(const CStdString& strFile) const
{
CStdString strExtension;
if ( !m_strFileMask.size() ) return true;
if ( !strFile.size() ) return true;
CUtil::GetExtension(strFile, strExtension);
if (!strExtension.size()) return false;
strExtension.ToLower();
strExtension += '|'; // ensures that we have a | at the end of it
if (m_strFileMask.Find(strExtension) != -1)
{ // it's allowed, but we should also ignore all non dvd related ifo files.
if (strExtension.Equals(".ifo|"))
{
CStdString fileName = CUtil::GetFileName(strFile);
if (fileName.Equals("video_ts.ifo")) return true;
if (fileName.length() == 12 && fileName.Left(4).Equals("vts_") && fileName.Right(6).Equals("_0.ifo")) return true;
return false;
}
return true;
}
return false;
}
示例15: 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");
int pos = max(strFormat.ReverseFind('/'), strFormat.ReverseFind('\\'));
if (pos != -1)
{
strFormat = strFormat.Right(strFormat.GetLength() - pos - 1);
}
CLabelFormatter formatter(strFormat, "");
formatter.FormatLabel(&destItem);
// grab the label to use it as our ripped filename
CStdString track = destItem.GetLabel();
if (track.IsEmpty())
track.Format("%s%02i", "Track-", trackNumber);
track += GetExtension(CSettings::Get().GetInt("audiocds.encoder"));
return track;
}