CStdString strLanguage = CSettings::Get().GetString("locale.language");
strLanguage[0] = toupper(strLanguage[0]);
- CStdString strLangInfoPath;
- strLangInfoPath.Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
+ CStdString strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
CLog::Log(LOGINFO, "load language info file: %s", strLangInfoPath.c_str());
g_langInfo.Load(strLangInfoPath);
CStdString strNewLanguage = strLanguage;
if (strNewLanguage != strPreviousLanguage)
{
- CStdString strLangInfoPath;
- strLangInfoPath.Format("special://xbmc/language/%s/langinfo.xml", strNewLanguage.c_str());
+ CStdString strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strNewLanguage.c_str());
if (!g_langInfo.Load(strLangInfoPath))
return false;
&& (bypassSettings))
{
bPlaying = true;
- CStdString strExec;
- strExec.Format("XBMC.RecursiveSlideShow(%s)", pItem->GetPath().c_str());
+ CStdString strExec = StringUtils::Format("XBMC.RecursiveSlideShow(%s)", pItem->GetPath().c_str());
CBuiltins::Execute(strExec);
return true;
}
if (!pItem->m_bIsFolder && pItem->IsPicture())
{
bPlaying = true;
- CStdString strExec;
- strExec.Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
+ CStdString strExec = StringUtils::Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
CBuiltins::Execute(strExec);
break;
}
if ( m_iDiscNumber > 0 )
song.iTrack |= (m_iDiscNumber << 16); // see CMusicInfoTag::GetDiscNumber()
if (m_Track[i].strTitle.length() == 0) // No track information for this track!
- song.strTitle.Format("Track %2d", i + 1);
+ song.strTitle = StringUtils::Format("Track %2d", i + 1);
else
song.strTitle = m_Track[i].strTitle;
song.strFileName = m_Track[i].strFile;
URIUtils::AddSlashAtEnd(m_strPath);
CStdString label = share.strName;
if (!share.strStatus.IsEmpty())
- label.Format("%s (%s)", share.strName.c_str(), share.strStatus.c_str());
+ label = StringUtils::Format("%s (%s)", share.strName.c_str(), share.strStatus.c_str());
SetLabel(label);
m_iLockMode = share.m_iLockMode;
m_strLockCode = share.m_strLockCode;
CStdString cacheFile;
if (IsCDDA() || IsOnDVD())
- cacheFile.Format("special://temp/r-%08x.fi", (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/r-%08x.fi", (unsigned __int32)crc);
else if (IsMusicDb())
- cacheFile.Format("special://temp/mdb-%08x.fi", (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/mdb-%08x.fi", (unsigned __int32)crc);
else if (IsVideoDb())
- cacheFile.Format("special://temp/vdb-%08x.fi", (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/vdb-%08x.fi", (unsigned __int32)crc);
else if (IsSmartPlayList())
- cacheFile.Format("special://temp/sp-%08x.fi", (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/sp-%08x.fi", (unsigned __int32)crc);
else if (windowID)
- cacheFile.Format("special://temp/%i-%08x.fi", windowID, (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/%i-%08x.fi", windowID, (unsigned __int32)crc);
else
- cacheFile.Format("special://temp/%08x.fi", (unsigned __int32)crc);
+ cacheFile = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32)crc);
return cacheFile;
}
CStdString strText = g_localizeStrings.Get(554); // "Track"
if (strText.GetAt(strText.size() - 1) != ' ')
strText += " ";
- CStdString strTrack;
- strTrack.Format(strText + "%i", iTrack);
+ CStdString strTrack = StringUtils::Format(strText + "%i", iTrack);
GetMusicInfoTag()->SetTitle(strTrack);
GetMusicInfoTag()->SetLoaded(true);
return true;
strLabel = strLabel.Trim();
break;
case WEATHER_TEMPERATURE:
- strLabel.Format("%s%s", g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTempUnitString().c_str());
+ strLabel = StringUtils::Format("%s%s",
+ g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP).c_str(),
+ g_langInfo.GetTempUnitString().c_str());
break;
case WEATHER_LOCATION:
strLabel = g_weatherManager.GetInfo(WEATHER_LABEL_LOCATION);
strLabel = GetDate();
break;
case SYSTEM_FPS:
- strLabel.Format("%02.2f", m_fps);
+ strLabel = StringUtils::Format("%02.2f", m_fps);
break;
case PLAYER_VOLUME:
- strLabel.Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false)));
+ strLabel = StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(g_application.GetVolume(false)));
break;
case PLAYER_SUBTITLE_DELAY:
- strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay);
+ strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay);
break;
case PLAYER_AUDIO_DELAY:
- strLabel.Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay);
+ strLabel = StringUtils::Format("%2.3f s", CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay);
break;
case PLAYER_CHAPTER:
if(g_application.m_pPlayer->IsPlaying())
- strLabel.Format("%02d", g_application.m_pPlayer->GetChapter());
+ strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapter());
break;
case PLAYER_CHAPTERCOUNT:
if(g_application.m_pPlayer->IsPlaying())
- strLabel.Format("%02d", g_application.m_pPlayer->GetChapterCount());
+ strLabel = StringUtils::Format("%02d", g_application.m_pPlayer->GetChapterCount());
break;
case PLAYER_CHAPTERNAME:
if(g_application.m_pPlayer->IsPlaying())
{
int iLevel = 0;
if(g_application.m_pPlayer->IsPlaying() && GetInt(iLevel, PLAYER_CACHELEVEL) && iLevel >= 0)
- strLabel.Format("%i", iLevel);
+ strLabel = StringUtils::Format("%i", iLevel);
}
break;
case PLAYER_TIME:
if(g_application.m_pPlayer->IsPlaying())
{
UpdateAVInfo();
- strLabel.Format("%i", m_audioInfo.channels);
+ strLabel = StringUtils::Format("%i", m_audioInfo.channels);
}
break;
case VIDEOPLAYER_AUDIO_LANG:
case SYSTEM_SCREEN_RESOLUTION:
if(g_Windowing.IsFullScreen())
- strLabel.Format("%ix%i@%.2fHz - %s (%02.2f fps)",
+ strLabel = StringUtils::Format("%ix%i@%.2fHz - %s (%02.2f fps)",
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
CDisplaySettings::Get().GetCurrentResolutionInfo().fRefreshRate,
- g_localizeStrings.Get(244), GetFPS());
+ g_localizeStrings.Get(244).c_str(),
+ GetFPS());
else
- strLabel.Format("%ix%i - %s (%02.2f fps)",
+ strLabel = StringUtils::Format("%ix%i - %s (%02.2f fps)",
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth,
CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight,
- g_localizeStrings.Get(242), GetFPS());
+ g_localizeStrings.Get(242).c_str(),
+ GetFPS());
return strLabel;
break;
int iMemPercentUsed = 100 - iMemPercentFree;
if (info == SYSTEM_FREE_MEMORY)
- strLabel.Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
+ strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
else if (info == SYSTEM_FREE_MEMORY_PERCENT)
- strLabel.Format("%i%%", iMemPercentFree);
+ strLabel = StringUtils::Format("%i%%", iMemPercentFree);
else if (info == SYSTEM_USED_MEMORY)
- strLabel.Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
+ strLabel = StringUtils::Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
else if (info == SYSTEM_USED_MEMORY_PERCENT)
- strLabel.Format("%i%%", iMemPercentUsed);
+ strLabel = StringUtils::Format("%i%%", iMemPercentUsed);
else if (info == SYSTEM_TOTAL_MEMORY)
- strLabel.Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
+ strLabel = StringUtils::Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
}
break;
case SYSTEM_SCREEN_MODE:
strLabel = g_graphicsContext.GetResInfo().strMode;
break;
case SYSTEM_SCREEN_WIDTH:
- strLabel.Format("%i", g_graphicsContext.GetResInfo().iScreenWidth);
+ strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenWidth);
break;
case SYSTEM_SCREEN_HEIGHT:
- strLabel.Format("%i", g_graphicsContext.GetResInfo().iScreenHeight);
+ strLabel = StringUtils::Format("%i", g_graphicsContext.GetResInfo().iScreenHeight);
break;
case SYSTEM_CURRENT_WINDOW:
return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
break;
case SYSTEM_STARTUP_WINDOW:
- strLabel.Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
+ strLabel = StringUtils::Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
break;
case SYSTEM_CURRENT_CONTROL:
{
{
double fTime = g_alarmClock.GetRemaining("shutdowntimer");
if (fTime > 60.f)
- strLabel.Format(g_localizeStrings.Get(13213).c_str(),g_alarmClock.GetRemaining("shutdowntimer")/60.f);
+ strLabel = StringUtils::Format(g_localizeStrings.Get(13213).c_str(), g_alarmClock.GetRemaining("shutdowntimer")/60.f);
else
- strLabel.Format(g_localizeStrings.Get(13214).c_str(),g_alarmClock.GetRemaining("shutdowntimer"));
+ strLabel = StringUtils::Format(g_localizeStrings.Get(13214).c_str(), g_alarmClock.GetRemaining("shutdowntimer"));
}
break;
case SYSTEM_PROFILENAME:
strLabel = CProfilesManager::Get().GetCurrentProfile().getName();
break;
case SYSTEM_PROFILECOUNT:
- strLabel.Format("%i", CProfilesManager::Get().GetNumberOfProfiles());
+ strLabel = StringUtils::Format("%i", CProfilesManager::Get().GetNumberOfProfiles());
break;
case SYSTEM_PROFILEAUTOLOGIN:
{
{
int percent;
if (GetInt(percent, SYSTEM_PROGRESS_BAR) && percent > 0)
- strLabel.Format("%i", percent);
+ strLabel = StringUtils::Format("%i", percent);
}
break;
case SYSTEM_FRIENDLY_NAME:
{
CStdString friendlyName = CSettings::Get().GetString("services.devicename");
if (friendlyName.Equals("XBMC"))
- strLabel.Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
+ strLabel = StringUtils::Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
else
strLabel = friendlyName;
}
case SYSTEM_STEREOSCOPIC_MODE:
{
int stereoMode = CSettings::Get().GetInt("videoscreen.stereoscopicmode");
- strLabel.Format("%i", stereoMode);
+ strLabel = StringUtils::Format("%i", stereoMode);
}
break;
{
CStdString strTime;
if (g_application.m_pPlayer->GetPlaySpeed() != 1)
- strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
+ strTime = StringUtils::Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
else
strTime = GetCurrentPlayTime();
return strTime;
}
else if (info.m_info == SYSTEM_GET_CORE_USAGE)
{
- CStdString strCpu;
- strCpu.Format("%4.2f", g_cpuInfo.GetCoreInfo(atoi(m_stringParameters[info.GetData1()].c_str())).m_fPct);
+ CStdString strCpu = StringUtils::Format("%4.2f", g_cpuInfo.GetCoreInfo(atoi(m_stringParameters[info.GetData1()].c_str())).m_fPct);
return strCpu;
}
else if (info.m_info >= MUSICPLAYER_TITLE && info.m_info <= MUSICPLAYER_ALBUM_ARTIST)
}
if (iSongs < 0)
return "";
- CStdString strLabel;
- strLabel.Format("%i", iSongs);
+ CStdString strLabel = StringUtils::Format("%i", iSongs);
return strLabel;
}
return "";
}
if (info.m_info == MUSICPLAYER_PLAYLISTPOS)
{
- CStdString strPosition = "";
- strPosition.Format("%i", index + 1);
+ CStdString strPosition = StringUtils::Format("%i", index + 1);
return strPosition;
}
else if (info.m_info == MUSICPLAYER_COVER)
{
case PLAYLIST_LENGTH:
{
- CStdString strLength = "";
- strLength.Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());
- return strLength;
+ return StringUtils::Format("%i", g_playlistPlayer.GetPlaylist(iPlaylist).size());;
}
case PLAYLIST_POSITION:
{
- CStdString strPosition = "";
- strPosition.Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
- return strPosition;
+ return StringUtils::Format("%i", g_playlistPlayer.GetCurrentSong() + 1);
}
case PLAYLIST_RANDOM:
{
{
CStdString strBitrate = "";
if (m_audioInfo.bitrate > 0)
- strBitrate.Format("%i", MathUtils::round_int((double)m_audioInfo.bitrate / 1000.0));
+ strBitrate = StringUtils::Format("%i", MathUtils::round_int((double)m_audioInfo.bitrate / 1000.0));
return strBitrate;
}
break;
CStdString strChannels = "";
if (m_audioInfo.channels > 0)
{
- strChannels.Format("%i", m_audioInfo.channels);
+ strChannels = StringUtils::Format("%i", m_audioInfo.channels);
}
return strChannels;
}
CStdString strBitsPerSample = "";
if (g_application.m_pPlayer->GetBitsPerSample() > 0)
{
- strBitsPerSample.Format("%i", g_application.m_pPlayer->GetBitsPerSample());
+ strBitsPerSample = StringUtils::Format("%i", g_application.m_pPlayer->GetBitsPerSample());
}
return strBitsPerSample;
}
CStdString strSampleRate = "";
if (g_application.m_pPlayer->GetSampleRate() > 0)
{
- strSampleRate.Format("%.5g", ((double)g_application.m_pPlayer->GetSampleRate() / 1000.0));
+ strSampleRate = StringUtils::Format("%.5g", ((double)g_application.m_pPlayer->GetSampleRate() / 1000.0));
}
return strSampleRate;
}
break;
case MUSICPLAYER_CODEC:
{
- CStdString strCodec;
- strCodec.Format("%s", m_audioInfo.audioCodecName);
- return strCodec;
+ return StringUtils::Format("%s", m_audioInfo.audioCodecName.c_str());
}
break;
case MUSICPLAYER_LYRICS:
CStdString strTrack;
if (tag.Loaded() && tag.GetTrackNumber() > 0)
{
- strTrack.Format("%02i", tag.GetTrackNumber());
- return strTrack;
+ return StringUtils::Format("%02i", tag.GetTrackNumber());
}
}
break;
CPVRChannel* channeltag = m_currentFile->GetPVRChannelInfoTag();
if (channeltag)
{
- CStdString strNumber;
- strNumber.Format("%i", channeltag->ChannelNumber());
- return strNumber;
+ return StringUtils::Format("%i", channeltag->ChannelNumber());
}
}
break;
{
CStdString rating;
if (tag->GetEPGNow(epgTag) && epgTag.ParentalRating() > 0)
- rating.Format("%i", epgTag.ParentalRating());
+ rating = StringUtils::Format("%i", epgTag.ParentalRating());
return rating;
}
break;
return tag->ChannelName();
case VIDEOPLAYER_CHANNEL_NUMBER:
{
- CStdString strNumber;
- strNumber.Format("%i", tag->ChannelNumber());
- return strNumber;
+ return StringUtils::Format("%i", tag->ChannelNumber());;
}
case VIDEOPLAYER_CHANNEL_GROUP:
{
{
CStdString strRating;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
- strRating.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
+ strRating = StringUtils::Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
return strRating;
}
break;
if (m_currentFile->GetVideoInfoTag()->m_fRating > 0.f)
{
if (m_currentFile->GetVideoInfoTag()->m_strVotes.IsEmpty())
- strRatingAndVotes.Format("%.1f", m_currentFile->GetVideoInfoTag()->m_fRating);
+ strRatingAndVotes = StringUtils::Format("%.1f",
+ m_currentFile->GetVideoInfoTag()->m_fRating);
else
- strRatingAndVotes.Format("%.1f (%s %s)", m_currentFile->GetVideoInfoTag()->m_fRating, m_currentFile->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
+ strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
+ m_currentFile->GetVideoInfoTag()->m_fRating,
+ m_currentFile->GetVideoInfoTag()->m_strVotes.c_str(),
+ g_localizeStrings.Get(20350).c_str());
}
return strRatingAndVotes;
}
{
CStdString strYear;
if (m_currentFile->GetVideoInfoTag()->m_iYear > 0)
- strYear.Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
+ strYear = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iYear);
return strYear;
}
break;
{
CStdString strEpisode;
if (m_currentFile->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
- strEpisode.Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
+ strEpisode = StringUtils::Format("S%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
else
- strEpisode.Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
+ strEpisode = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iEpisode);
return strEpisode;
}
break;
case VIDEOPLAYER_SEASON:
if (m_currentFile->GetVideoInfoTag()->m_iSeason > 0)
{
- CStdString strSeason;
- strSeason.Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
- return strSeason;
+ return StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iSeason);
}
break;
case VIDEOPLAYER_TVSHOW:
{
CStdString strTop250;
if (m_currentFile->GetVideoInfoTag()->m_iTop250 > 0)
- strTop250.Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
+ strTop250 = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_iTop250);
return strTop250;
}
break;
{
CStdString strPlayCount;
if (m_currentFile->GetVideoInfoTag()->m_playCount > 0)
- strPlayCount.Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
+ strPlayCount = StringUtils::Format("%i", m_currentFile->GetVideoInfoTag()->m_playCount);
return strPlayCount;
}
}
return m_gpuTemp.IsValid() ? m_gpuTemp.ToString() : "?";
break;
case SYSTEM_FAN_SPEED:
- text.Format("%i%%", m_fanSpeed * 2);
+ text = StringUtils::Format("%i%%", m_fanSpeed * 2);
break;
case SYSTEM_CPU_USAGE:
#if defined(TARGET_DARWIN_OSX)
- text.Format("%4.2f%%", m_resourceCounter.GetCPUUsage());
+ text = StringUtils::Format("%4.2f%%", m_resourceCounter.GetCPUUsage());
#elif defined(TARGET_DARWIN) || defined(TARGET_WINDOWS)
- text.Format("%d%%", g_cpuInfo.getUsedPercentage());
+ text = StringUtils::Format("%d%%", g_cpuInfo.getUsedPercentage());
#else
- text.Format("%s", g_cpuInfo.GetCoresUsageString());
+ text = StringUtils::Format("%s", g_cpuInfo.GetCoresUsageString().c_str());
#endif
break;
}
{
CStdString tmp;
if (GetXbmcGitRevision())
- tmp.Format("%d.%d%s Git:%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG, GetXbmcGitRevision());
+ tmp = StringUtils::Format("%d.%d%s Git:%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG, GetXbmcGitRevision());
else
- tmp.Format("%d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG);
+ tmp = StringUtils::Format("%d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_TAG);
return tmp;
}
CStdString CGUIInfoManager::GetBuild()
{
- CStdString tmp;
- tmp.Format("%s", __DATE__);
- return tmp;
+ return StringUtils::Format("%s", __DATE__);
}
void CGUIInfoManager::SetDisplayAfterSeek(unsigned int timeOut, int seekOffset)
{
CStdString strPlayCount;
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_playCount > 0)
- strPlayCount.Format("%i", item->GetVideoInfoTag()->m_playCount);
+ strPlayCount = StringUtils::Format("%i", item->GetVideoInfoTag()->m_playCount);
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetPlayCount() > 0)
- strPlayCount.Format("%i", item->GetMusicInfoTag()->GetPlayCount());
+ strPlayCount = StringUtils::Format("%i", item->GetMusicInfoTag()->GetPlayCount());
return strPlayCount;
}
case LISTITEM_LASTPLAYED:
{
CStdString track;
if (item->HasMusicInfoTag())
- track.Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
+ track = StringUtils::Format("%i", item->GetMusicInfoTag()->GetTrackNumber());
return track;
}
{
CStdString disc;
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDiscNumber() > 0)
- disc.Format("%i", item->GetMusicInfoTag()->GetDiscNumber());
+ disc = StringUtils::Format("%i", item->GetMusicInfoTag()->GetDiscNumber());
return disc;
}
case LISTITEM_ARTIST:
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iYear > 0)
- strResult.Format("%i",item->GetVideoInfoTag()->m_iYear);
+ strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iYear);
return strResult;
}
if (item->HasMusicInfoTag())
{
CStdString rating;
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_fRating > 0.f) // movie rating
- rating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+ rating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetRating() > '0')
{ // song rating. Images will probably be better than numbers for this in the long run
rating = item->GetMusicInfoTag()->GetRating();
{
CStdString strRatingAndVotes;
if (item->GetVideoInfoTag()->m_strVotes.IsEmpty())
- strRatingAndVotes.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+ strRatingAndVotes = StringUtils::Format("%.1f",
+ item->GetVideoInfoTag()->m_fRating);
else
- strRatingAndVotes.Format("%.1f (%s %s)", item->GetVideoInfoTag()->m_fRating, item->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
+ strRatingAndVotes = StringUtils::Format("%.1f (%s %s)",
+ item->GetVideoInfoTag()->m_fRating,
+ item->GetVideoInfoTag()->m_strVotes.c_str(),
+ g_localizeStrings.Get(20350).c_str());
return strRatingAndVotes;
}
}
break;
case LISTITEM_PROGRAM_COUNT:
{
- CStdString count;
- count.Format("%i", item->m_iprogramCount);
- return count;
+ return StringUtils::Format("%i", item->m_iprogramCount);;
}
case LISTITEM_DURATION:
{
else if (item->HasVideoInfoTag())
{
if (item->GetVideoInfoTag()->GetDuration() > 0)
- duration.Format("%d", item->GetVideoInfoTag()->GetDuration() / 60);
+ duration = StringUtils::Format("%d", item->GetVideoInfoTag()->GetDuration() / 60);
}
else if (item->HasMusicInfoTag())
{
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iSeason == 0) // prefix episode with 'S'
- strResult.Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
+ strResult = StringUtils::Format("S%d",item->GetVideoInfoTag()->m_iEpisode);
else
- strResult.Format("%d",item->GetVideoInfoTag()->m_iEpisode);
+ strResult = StringUtils::Format("%d",item->GetVideoInfoTag()->m_iEpisode);
return strResult;
}
break;
case LISTITEM_SEASON:
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iSeason > 0)
{
- CStdString strResult;
- strResult.Format("%d",item->GetVideoInfoTag()->m_iSeason);
- return strResult;
+ return StringUtils::Format("%d",item->GetVideoInfoTag()->m_iSeason);;
}
break;
case LISTITEM_TVSHOW:
{
CStdString strResult;
if (item->GetVideoInfoTag()->m_iTop250 > 0)
- strResult.Format("%i",item->GetVideoInfoTag()->m_iTop250);
+ strResult = StringUtils::Format("%i",item->GetVideoInfoTag()->m_iTop250);
return strResult;
}
break;
CStdString strResult;
int iChannels = item->GetVideoInfoTag()->m_streamDetails.GetAudioChannels();
if (iChannels > -1)
- strResult.Format("%i", iChannels);
+ strResult = StringUtils::Format("%i", iChannels);
return strResult;
}
break;
{
CStdString number;
if (item->HasPVRChannelInfoTag())
- number.Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
+ number = StringUtils::Format("%i", item->GetPVRChannelInfoTag()->ChannelNumber());
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->HasPVRChannel())
- number.Format("%i", item->GetEPGInfoTag()->PVRChannelNumber());
+ number = StringUtils::Format("%i", item->GetEPGInfoTag()->PVRChannelNumber());
if (item->HasPVRTimerInfoTag())
- number.Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());
+ number = StringUtils::Format("%i", item->GetPVRTimerInfoTag()->ChannelNumber());
return number;
}
{
CStdString rating;
if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->ParentalRating() > 0)
- rating.Format("%i", item->GetEPGInfoTag()->ParentalRating());
+ rating = StringUtils::Format("%i", item->GetEPGInfoTag()->ParentalRating());
return rating;
}
break;
int val;
if (GetItemInt(val, item, info))
{
- CStdString str;
- str.Format("%d", val);
- return str;
+ return StringUtils::Format("%d", val);;
}
break;
}
case LISTITEM_DBID:
if (item->HasVideoInfoTag())
{
- CStdString dbid;
- dbid.Format("%i", item->GetVideoInfoTag()->m_iDbId);
- return dbid;
+ return StringUtils::Format("%i", item->GetVideoInfoTag()->m_iDbId);;
}
if (item->HasMusicInfoTag())
{
- CStdString dbid;
- dbid.Format("%i", item->GetMusicInfoTag()->GetDatabaseId());
- return dbid;
+ return StringUtils::Format("%i", item->GetMusicInfoTag()->GetDatabaseId());;
}
break;
case LISTITEM_STEREOSCOPIC_MODE:
{
case LISTITEM_RATING: // old song rating format
{
- CStdString rating;
if (item->HasMusicInfoTag())
{
- rating.Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
- return rating;
+ return StringUtils::Format("songrating%c.png", item->GetMusicInfoTag()->GetRating());
}
}
break;
CStdString rating;
if (item->HasVideoInfoTag())
{ // rating for videos is assumed 0..10, so convert to 0..5
- rating.Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
+ rating = StringUtils::Format("rating%d.png", (long)((item->GetVideoInfoTag()->m_fRating * 0.5f) + 0.5f));
}
else if (item->HasMusicInfoTag())
{ // song rating.
- rating.Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
+ rating = StringUtils::Format("rating%c.png", item->GetMusicInfoTag()->GetRating());
}
return rating;
}
g_tuxbox.sCurSrvData.current_event_duration.Replace("(","");
g_tuxbox.sCurSrvData.current_event_duration.Replace(")","");
- m_currentMovieDuration.Format("%s: %s %s (%s - %s)",
- g_localizeStrings.Get(180),
- g_tuxbox.sCurSrvData.current_event_duration,
- g_localizeStrings.Get(12391),
- g_tuxbox.sCurSrvData.current_event_time,
- g_tuxbox.sCurSrvData.next_event_time);
+ m_currentMovieDuration = StringUtils::Format("%s: %s %s (%s - %s)",
+ g_localizeStrings.Get(180).c_str(),
+ g_tuxbox.sCurSrvData.current_event_duration.c_str(),
+ g_localizeStrings.Get(12391).c_str(),
+ g_tuxbox.sCurSrvData.current_event_time.c_str(),
+ g_tuxbox.sCurSrvData.next_event_time.c_str());
}
//Set strVideoGenre
!g_tuxbox.sCurSrvData.current_event_description.Equals("-") &&
!g_tuxbox.sCurSrvData.next_event_description.Equals("-"))
{
- CStdString genre;
- genre.Format("%s %s - (%s: %s)",
- g_localizeStrings.Get(143),
- g_tuxbox.sCurSrvData.current_event_description,
- g_localizeStrings.Get(209),
- g_tuxbox.sCurSrvData.next_event_description);
+ CStdString genre = StringUtils::Format("%s %s - (%s: %s)",
+ g_localizeStrings.Get(143).c_str(),
+ g_tuxbox.sCurSrvData.current_event_description.c_str(),
+ g_localizeStrings.Get(209).c_str(),
+ g_tuxbox.sCurSrvData.next_event_description.c_str());
m_currentFile->GetVideoInfoTag()->m_genre = StringUtils::Split(genre, g_advancedSettings.m_videoItemSeparator);
}
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (slideshow && slideshow->NumSlides())
{
- CStdString index;
- index.Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
- return index;
+ return StringUtils::Format("%d/%d", slideshow->CurrentSlide(), slideshow->NumSlides());
}
}
if (m_currentSlide->HasPictureInfoTag())
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "view/ViewStateSettings.h"
CGUIPassword::CGUIPassword(void)
iVerifyPasswordResult = VerifyPassword(CProfilesManager::Get().GetMasterProfile().getLockMode(), strPassword, strHeader);
if (iVerifyPasswordResult != 0 )
{
- CStdString strLabel,strLabel1;
+ CStdString strLabel1;
strLabel1 = g_localizeStrings.Get(12343);
int iLeft = g_passwordManager.iMasterLockRetriesLeft-i;
- strLabel.Format("%i %s",iLeft,strLabel1.c_str());
+ CStdString strLabel = StringUtils::Format("%i %s", iLeft, strLabel1.c_str());
// PopUp OK and Display: MasterLock mode has changed but no no Mastercode has been set!
CGUIDialogOK::ShowAndGetInput(20076, 12367, 12368, strLabel);
}
CStdString dlgLine1 = "";
if (0 < g_passwordManager.iMasterLockRetriesLeft)
- dlgLine1.Format("%d %s", g_passwordManager.iMasterLockRetriesLeft, g_localizeStrings.Get(12343));
+ dlgLine1 = StringUtils::Format("%d %s",
+ g_passwordManager.iMasterLockRetriesLeft,
+ g_localizeStrings.Get(12343).c_str());
CGUIDialogOK::ShowAndGetInput(20075, 12345, dlgLine1, 0);
}
else
#include "playlists/PlayList.h"
#include "utils/TimeUtils.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "Application.h"
#include "interfaces/AnnouncementManager.h"
for (vector< pair<int,int> >::iterator it = chosenSongIDs.begin(); it != chosenSongIDs.end(); it++)
{
- CStdString song;
- song.Format("%i,", it->second);
+ CStdString song = StringUtils::Format("%i,", it->second);
if (it->first == 1)
sqlWhereMusic += song;
if (it->first == 2)
for (unsigned int i = 0; i < m_history.size(); i++)
{
- CStdString number;
- number.Format("%i,", m_history[i].second);
+ CStdString number = StringUtils::Format("%i,", m_history[i].second);
if (m_history[i].first == 1)
historyWhereMusic += number;
if (m_history[i].first == 2)
#include "playlists/PlayList.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "music/tags/MusicInfoTag.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "guilib/LocalizeStrings.h"
if (bNotify)
{
- CStdString shuffleStr;
- shuffleStr.Format("%s: %s", g_localizeStrings.Get(191), g_localizeStrings.Get(bYesNo ? 593 : 591)); // Shuffle: All/Off
+ CStdString shuffleStr = StringUtils::Format("%s: %s", g_localizeStrings.Get(191).c_str(), g_localizeStrings.Get(bYesNo ? 593 : 591).c_str()); // Shuffle: All/Off
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(559), shuffleStr);
}
#include "LangInfo.h"
#include "guilib/LocalizeStrings.h"
#include "Temperature.h"
-
+#include "utils/StringUtils.h"
CTemperature::CTemperature()
{
if (!IsValid())
return g_localizeStrings.Get(13205); // "Unknown"
- CStdString str;
- str.Format("%2.0f%s", ToLocale(), g_langInfo.GetTempUnitString().c_str());
-
- return str;
+ return StringUtils::Format("%2.0f%s", ToLocale(), g_langInfo.GetTempUnitString().c_str());
}
#include "settings/AdvancedSettings.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "utils/StringUtils.h"
{
Crc32 crc;
crc.ComputeFromLowerCase(url);
- CStdString hex;
- hex.Format("%08x", (unsigned int)crc);
- CStdString hash;
- hash.Format("%c/%s", hex[0], hex.c_str());
+ CStdString hex = StringUtils::Format("%08x", (unsigned int)crc);
+ CStdString hash = StringUtils::Format("%c/%s", hex[0], hex.c_str());
return hash;
}
if (!time)
time = st.st_ctime;
if (time || st.st_size)
- {
- CStdString hash;
- hash.Format("d%"PRId64"s%"PRId64, time, st.st_size);
- return hash;
- }
+ return StringUtils::Format("d%"PRId64"s%"PRId64, time, st.st_size);;
+
}
CLog::Log(LOGDEBUG, "%s - unable to stat url %s", __FUNCTION__, url.c_str());
return "";
#include "utils/RegExp.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "Util.h"
#include "filesystem/File.h"
#include "FileItem.h"
{
if (m_strHostName != "" && m_strFileName != "")
{
- CStdString strFileName = m_strFileName;
- m_strFileName.Format("%s/%s", m_strHostName.c_str(), strFileName.c_str());
+ m_strFileName = StringUtils::Format("%s/%s", m_strHostName.c_str(), m_strFileName.c_str());
m_strHostName = "";
}
else
strURL += m_strHostName;
if (HasPort())
{
- CStdString strPort;
- strPort.Format("%i", m_iPort);
+ CStdString strPort = StringUtils::Format("%i", m_iPort);
strURL += ":";
strURL += strPort;
}
}
else
{
- CStdString strTmp;
- strTmp.Format("%%%02.2x", kar);
+ CStdString strTmp = StringUtils::Format("%%%02.2x", kar);
strResult += strTmp;
}
}
if (URIUtils::IsDVD(strURL)) return ;
CURL url(strURL);
- strDir.Format("%s://%s", url.GetProtocol().c_str(), url.GetFileName().c_str());
+ strDir = StringUtils::Format("%s://%s", url.GetProtocol().c_str(), url.GetFileName().c_str());
}
int CUtil::GetDVDIfoTitle(const CStdString& strFile)
CStdString searchPath = URIUtils::GetDirectory(fn_template);
CStdString mask = URIUtils::GetExtension(fn_template);
-
- CStdString name;
- name.Format(fn_template.c_str(), 0);
+ CStdString name = StringUtils::Format(fn_template.c_str(), 0);
CFileItemList items;
if (!CDirectory::GetDirectory(searchPath, items, mask, DIR_FLAG_NO_FILE_DIRS))
items.SetFastLookup(true);
for (int i = 0; i <= max; i++)
{
- CStdString name;
- name.Format(fn_template.c_str(), i);
+ CStdString name = StringUtils::Format(fn_template.c_str(), i);
if (!items.Get(name))
return name;
}
for (int i = 0; i <= max; i++)
{
- CStdString name;
- name.Format(path_template.c_str(), i);
+ CStdString name = StringUtils::Format(path_template.c_str(), i);
if (!CFile::Exists(name))
return name;
}
iStrInputSize = StrInput.size();
}
// replace any additional /../../ with just /../ if necessary
- CStdString replaceDots;
- replaceDots.Format("..%c..", cDelim);
+ CStdString replaceDots = StringUtils::Format("..%c..", cDelim);
while (StrInput.size() > (unsigned int)iTextMaxLength)
if (!StrInput.Replace(replaceDots, ".."))
break;
iSize = strLookInPaths.size();
for (int i=0;i<9;++i) // 9 cd's
{
- CStdString cdDir;
- cdDir.Format("cd%i",i+1);
+ CStdString cdDir = StringUtils::Format("cd%i",i+1);
for (int i=0;i<iSize;++i)
{
CStdString strPath2 = URIUtils::AddFileToFolder(strLookInPaths[i],cdDir);
{
for (unsigned int k = 0; k < TagConv.m_Langclass.size(); k++)
{
- strDest.Format("special://temp/subtitle.%s.%d.smi", TagConv.m_Langclass[k].Name, i);
+ strDest = StringUtils::Format("special://temp/subtitle.%s.%d.smi", TagConv.m_Langclass[k].Name.c_str(), i);
if (CFile::Cache(vecSubtitles[i], strDest))
{
CLog::Log(LOGINFO, " cached subtitle %s->%s\n", vecSubtitles[i].c_str(), strDest.c_str());
#include "LangInfo.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#define SECONDS_PER_DAY 86400UL
#define SECONDS_PER_HOUR 3600UL
SYSTEMTIME st;
GetAsSystemTime(st);
- CStdString date;
- date.Format("%04i-%02i-%02i", st.wYear, st.wMonth, st.wDay);
-
- return date;
+ return StringUtils::Format("%04i-%02i-%02i", st.wYear, st.wMonth, st.wDay);
}
CStdString CDateTime::GetAsDBDateTime() const
SYSTEMTIME st;
GetAsSystemTime(st);
- CStdString date;
- date.Format("%04i-%02i-%02i %02i:%02i:%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
-
- return date;
+ return StringUtils::Format("%04i-%02i-%02i %02i:%02i:%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}
CStdString CDateTime::GetAsSaveString() const
SYSTEMTIME st;
GetAsSystemTime(st);
- CStdString date;
- date.Format("%04i%02i%02i_%02i%02i%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
-
- return date;
+ return StringUtils::Format("%04i%02i%02i_%02i%02i%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);;
}
void CDateTime::SetFromUTCDateTime(const CDateTime &dateTime)
// Format hour string with the length of the mask
CStdString str;
if (partLength==1)
- str.Format("%d", hour);
+ str = StringUtils::Format("%d", hour);
else
- str.Format("%02d", hour);
+ str = StringUtils::Format("%02d", hour);
strOut+=str;
}
// Format minute string with the length of the mask
CStdString str;
if (partLength==1)
- str.Format("%d", dateTime.wMinute);
+ str = StringUtils::Format("%d", dateTime.wMinute);
else
- str.Format("%02d", dateTime.wMinute);
+ str = StringUtils::Format("%02d", dateTime.wMinute);
strOut+=str;
}
// Format seconds string with the length of the mask
CStdString str;
if (partLength==1)
- str.Format("%d", dateTime.wSecond);
+ str = StringUtils::Format("%d", dateTime.wSecond);
else
- str.Format("%02d", dateTime.wSecond);
+ str = StringUtils::Format("%02d", dateTime.wSecond);
strOut+=str;
}
// Format string with the length of the mask
CStdString str;
if (partLength==1) // single-digit number
- str.Format("%d", dateTime.wDay);
+ str = StringUtils::Format("%d", dateTime.wDay);
else if (partLength==2) // two-digit number
- str.Format("%02d", dateTime.wDay);
+ str = StringUtils::Format("%02d", dateTime.wDay);
else // Day of week string
{
int wday = dateTime.wDayOfWeek;
// Format string with the length of the mask
CStdString str;
if (partLength==1) // single-digit number
- str.Format("%d", dateTime.wMonth);
+ str = StringUtils::Format("%d", dateTime.wMonth);
else if (partLength==2) // two-digit number
- str.Format("%02d", dateTime.wMonth);
+ str = StringUtils::Format("%02d", dateTime.wMonth);
else // Month string
{
int wmonth = dateTime.wMonth;
}
// Format string with the length of the mask
- CStdString str;
- str.Format("%d", dateTime.wYear); // four-digit number
+ CStdString str = StringUtils::Format("%d", dateTime.wYear); // four-digit number
if (partLength<=2)
str.Delete(0, 2); // two-digit number
if (month != time.GetMonth())
CLog::Log(LOGWARNING, "Invalid month %d in %s", time.GetMonth(), time.GetAsDBDateTime().c_str());
- CStdString result;
- result.Format("%s, %02i %s %04i %02i:%02i:%02i GMT", DAY_NAMES[weekDay], time.GetDay(), MONTH_NAMES[month - 1], time.GetYear(), time.GetHour(), time.GetMinute(), time.GetSecond());
+ CStdString result = StringUtils::Format("%s, %02i %s %04i %02i:%02i:%02i GMT", DAY_NAMES[weekDay], time.GetDay(), MONTH_NAMES[month - 1], time.GetYear(), time.GetHour(), time.GetMinute(), time.GetSecond());
return result;
}
void CAddon::BuildProfilePath()
{
- m_profile.Format("special://profile/addon_data/%s/", ID().c_str());
+ m_profile = StringUtils::Format("special://profile/addon_data/%s/", ID().c_str());
}
const CStdString CAddon::Icon() const
#include "FileItem.h"
#include "network/Network.h"
#include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
#include "cores/dvdplayer/DVDCodecs/DVDCodecs.h"
using namespace XFILE;
break;
}
- CStdString strXbmcMessage;
- strXbmcMessage.Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage);
+ CStdString strXbmcMessage = StringUtils::Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage);
CLog::Log(xbmcLogLevel, "%s", strXbmcMessage.c_str());
}
catch (std::exception &e)
CStdString strLine1;
if (bOnOff)
- strLine1.Format(g_localizeStrings.Get(19197), client->Name());
+ strLine1 = StringUtils::Format(g_localizeStrings.Get(19197), client->Name().c_str());
else
- strLine1.Format(g_localizeStrings.Get(19198), client->Name());
+ strLine1 = StringUtils::Format(g_localizeStrings.Get(19198), client->Name().c_str());
CStdString strLine2;
if (strName)
#include "addons/AddonManager.h"
#include "utils/log.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "XBDateTime.h"
#include "addons/Service.h"
#include "dbwrappers/dataset.h"
pItem->SetProperty("Addon.Creator", addon->Author());
pItem->SetProperty("Addon.Disclaimer", addon->Disclaimer());
pItem->SetProperty("Addon.Rating", addon->Stars());
- CStdString starrating;
- starrating.Format("rating%d.png", addon->Stars());
+ CStdString starrating = StringUtils::Format("rating%d.png", addon->Stars());
pItem->SetProperty("Addon.StarRating",starrating);
pItem->SetProperty("Addon.Path", addon->Path());
if (addon->Props().broken == "DEPSNOTMET")
if (repo)
{
CFileItemList dummy;
- CStdString s;
- s.Format("plugin://%s/?action=install"
- "&package=%s&version=%s", repo->ID().c_str(),
+ CStdString s = StringUtils::Format("plugin://%s/?action=install"
+ "&package=%s&version=%s", repo->ID().c_str(),
m_addon->ID().c_str(),
m_addon->Version().c_str());
if (!CDirectory::GetDirectory(s, dummy))
// resolve dependencies
CAddonMgr::Get().FindAddons(); // needed as GetDeps() grabs directly from c-pluff via the addon manager
ADDONDEPS deps = addon->GetDeps();
- CStdString referer;
- referer.Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().c_str());
+ CStdString referer = StringUtils::Format("Referer=%s-%s.zip",addon->ID().c_str(),addon->Version().c_str());
for (ADDONDEPS::iterator it = deps.begin(); it != deps.end(); ++it)
{
if (it->first.Equals("xbmc.metadata"))
if (therepo && !therepo->Props().libname.IsEmpty())
{
CFileItemList dummy;
- CStdString s;
- s.Format("plugin://%s/?action=uninstall"
- "&package=%s", therepo->ID().c_str(), m_addon->ID().c_str());
+ CStdString s = StringUtils::Format("plugin://%s/?action=uninstall"
+ "&package=%s", therepo->ID().c_str(), m_addon->ID().c_str());
if (!CDirectory::GetDirectory(s, dummy))
return false;
}
#include "dialogs/GUIDialogKaiToast.h"
#include "settings/Settings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
namespace ADDON
{
{
CSingleLock lock(m_critSection);
- CStdString heading;
- heading.Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str());
+ CStdString heading = StringUtils::Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str());
/* AddOn lost connection to his backend (for ones that use Network) */
if (m_status == ADDON_STATUS_LOST_CONNECTION)
#include "AddonVersion.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
namespace ADDON
{
CStdString AddonVersion::Print() const
{
- CStdString out;
- out.Format("%s %s", g_localizeStrings.Get(24051), m_originalVersion); // "Version <str>"
- return CStdString(out);
+ return StringUtils::Format("%s %s", g_localizeStrings.Get(24051).c_str(), m_originalVersion.c_str());
}
bool AddonVersion::SplitFileName(CStdString& ID, CStdString& version,
void CGUIDialogAddonInfo::OnUpdate()
{
- CStdString referer;
- referer.Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().c_str());
+ CStdString referer = StringUtils::Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().c_str());
CAddonInstaller::Get().Install(m_addon->ID(), true, referer); // force install
Close();
}
return false;
// Set the heading
- CStdString heading;
- heading.Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName"
+ CStdString heading = StringUtils::Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName"
pDialog->m_strHeading = heading;
pDialog->m_changed = false;
if (iSelected >= 0)
{
if (setting->Attribute("lvalues"))
- value.Format("%i", iSelected);
+ value = StringUtils::Format("%i", iSelected);
else
value = valuesVec[iSelected];
((CGUIButtonControl*) control)->SetLabel2(valuesVec[iSelected]);
}
if (CGUIDialogNumeric::ShowAndGetTime(timedate, label))
{
- value.Format("%02d:%02d", timedate.wHour, timedate.wMinute);
+ value = StringUtils::Format("%02d:%02d", timedate.wHour, timedate.wMinute);
((CGUIButtonControl*) control)->SetLabel2(value);
}
}
if (strcmpi(type, "fileenum") == 0 || strcmpi(type, "labelenum") == 0)
value = ((CGUISpinControlEx*) control)->GetLabel();
else
- value.Format("%i", ((CGUISpinControlEx*) control)->GetValue());
+ value = StringUtils::Format("%i", ((CGUISpinControlEx*) control)->GetValue());
break;
case CGUIControl::GUICONTROL_SETTINGS_SLIDER:
{
CStdString option = setting->Attribute("option");
if (option.size() == 0 || option.CompareNoCase("float") == 0)
- value.Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue());
+ value = StringUtils::Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue());
else
- value.Format("%i", ((CGUISettingsSliderControl *)control)->GetIntValue());
+ value = StringUtils::Format("%i", ((CGUISettingsSliderControl *)control)->GetIntValue());
}
break;
default:
{
CStdString valuestring;
if (elements < 2)
- valuestring.Format(valueformat.c_str(), rangestart);
+ valuestring = StringUtils::Format(valueformat.c_str(), rangestart);
else
- valuestring.Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i);
+ valuestring = StringUtils::Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i);
((CGUISpinControlEx *)pControl)->AddLabel(valuestring, i);
}
((CGUISpinControlEx *)pControl)->SetValue(atoi(m_settings[id]));
if (((CGUISpinControlEx*) control2)->GetFloatValue() > 0.0f)
value = ((CGUISpinControlEx*) control2)->GetLabel();
else
- value.Format("%i", ((CGUISpinControlEx*) control2)->GetValue());
+ value = StringUtils::Format("%i", ((CGUISpinControlEx*) control2)->GetValue());
break;
default:
break;
unsigned int percent;
if (CAddonInstaller::Get().GetProgress(item->GetProperty("Addon.ID").asString(), percent))
{
- CStdString progress;
- progress.Format(g_localizeStrings.Get(24042).c_str(), percent);
+ CStdString progress = StringUtils::Format(g_localizeStrings.Get(24042).c_str(), percent);
item->SetProperty("Addon.Status", progress);
item->SetProperty("Addon.Downloading", true);
}
CStdString sArtist;
CStdString sAlbumName;
if (XMLUtils::GetString(pxeAlbum, "artist", sArtist) && !sArtist.empty())
- sAlbumName.Format("%s - %s", sArtist.c_str(), sTitle.c_str());
+ sAlbumName = StringUtils::Format("%s - %s", sArtist.c_str(), sTitle.c_str());
else
sAlbumName = sTitle;
CStdString sYear;
if (XMLUtils::GetString(pxeAlbum, "year", sYear) && !sYear.empty())
- sAlbumName.Format("%s (%s)", sAlbumName.c_str(), sYear.c_str());
+ sAlbumName = StringUtils::Format("%s (%s)", sAlbumName.c_str(), sYear.c_str());
// if no URL is provided, use the URL we got back from CreateAlbumSearchUrl
// (e.g., in case we only got one result back and were sent to the detail page)
CGUIDialogExtendedProgressBar* pDlgProgress =
(CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
CGUIDialogProgressBarHandle* handle = pDlgProgress->GetHandle(g_localizeStrings.Get(605));
- CStdString strLine0;
+
int iTrack = atoi(m_input.substr(13, m_input.size() - 13 - 5).c_str());
- strLine0.Format("%02i. %s - %s", iTrack,
- StringUtils::Join(m_tag.GetArtist(),
- g_advancedSettings.m_musicItemSeparator).c_str(),
- m_tag.GetTitle().c_str());
+ CStdString strLine0 = StringUtils::Format("%02i. %s - %s", iTrack,
+ StringUtils::Join(m_tag.GetArtist(), g_advancedSettings.m_musicItemSeparator).c_str(),
+ m_tag.GetTitle().c_str());
handle->SetText(strLine0);
// start ripping
return NULL;
// we have to set the tags before we init the Encoder
- CStdString strTrack;
- strTrack.Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));
+ CStdString strTrack = StringUtils::Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));
encoder->SetComment("Ripped with XBMC");
encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(),
if (strAlbumDir.Find("%B") != -1)
{
CStdString strAlbum = infoTag.GetAlbum();
- if (strAlbum.IsEmpty())
- strAlbum.Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
+ if (strAlbum.IsEmpty())
+ strAlbum = StringUtils::Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
else
strAlbum.Replace('/', '_');
strAlbumDir.Replace("%B", strAlbum);
// grab the label to use it as our ripped filename
CStdString track = destItem.GetLabel();
if (track.IsEmpty())
- track.Format("%s%02i", "Track-", trackNumber);
+ track = StringUtils::Format("%s%02i", "Track-", trackNumber);
track += GetExtension(CSettings::Get().GetInt("audiocds.encoder"));
return track;
#include "Application.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "settings/Settings.h"
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
if (add)
{
- CStdString desc, sink;
- desc.Format("%s (PulseAudio)", i->description);
- sink.Format("pulse:%s@default", i->name);
+ CStdString desc = StringUtils::Format("%s (PulseAudio)", i->description);
+ CStdString sink = StringUtils::Format("pulse:%s@default", i->name);
sinkStruct->list->push_back(AEDevice(desc, sink));
CLog::Log(LOGDEBUG, "PulseAudio: Found %s with devicestring %s", desc.c_str(), sink.c_str());
}
sinkStruct.passthrough = passthrough;
sinkStruct.mainloop = m_MainLoop;
sinkStruct.list = &devices;
- CStdString def;
- def.Format("%s (PulseAudio)",g_localizeStrings.Get(409).c_str());
+ CStdString def = StringUtils::Format("%s (PulseAudio)",g_localizeStrings.Get(409).c_str());
devices.push_back(AEDevice(def, "pulse:default@default"));
WaitForOperation(pa_context_get_sink_info_list(m_Context,
SinkInfo, &sinkStruct), m_MainLoop, "EnumerateAudioSinks");
#include <dlfcn.h>
#endif
#include "utils/Environment.h"
+#include "utils/StringUtils.h"
using namespace std;
using namespace XFILE;
if (!CSettings::Get().GetString("network.httpproxyusername").empty() &&
!CSettings::Get().GetString("network.httpproxypassword").empty())
{
- strProxy.Format("%s:%s@", CSettings::Get().GetString("network.httpproxyusername").c_str(),
- CSettings::Get().GetString("network.httpproxypassword").c_str());
+ strProxy = StringUtils::Format("%s:%s@",
+ CSettings::Get().GetString("network.httpproxyusername").c_str(),
+ CSettings::Get().GetString("network.httpproxypassword").c_str());
}
strProxy += CSettings::Get().GetString("network.httpproxyserver");
#include "windowing/WindowingFactory.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
CDummyVideoPlayer::CDummyVideoPlayer(IPlayerCallback& callback)
: IPlayer(callback),
int mins = (int)(m_clock / 60000);
int secs = (int)((m_clock / 1000) % 60);
int ms = (int)(m_clock % 1000);
- CStdString currentTime;
- currentTime.Format("Video goes here %02i:%02i:%03i", mins, secs, ms);
+ CStdString currentTime = StringUtils::Format("Video goes here %02i:%02i:%03i", mins, secs, ms);
float posX = (vw.x1 + vw.x2) * 0.5f;
float posY = (vw.y1 + vw.y2) * 0.5f;
CGUITextLayout::DrawText(font, posX, posY, 0xffffffff, 0, currentTime, XBFONT_CENTER_X | XBFONT_CENTER_Y);
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "Application.h"
#include "ApplicationMessenger.h"
avgerror += m_errorbuff[i];
avgerror /= ERRORBUFFSIZE;
- CStdString state;
- state.Format("sync:%+3d%% avg:%3d%% error:%2d%%"
- , MathUtils::round_int(m_presentcorr * 100)
- , MathUtils::round_int(avgerror * 100)
- , abs(MathUtils::round_int(m_presenterr * 100)));
+ CStdString state = StringUtils::Format("sync:%+3d%% avg:%3d%% error:%2d%%"
+ , MathUtils::round_int(m_presentcorr * 100)
+ , MathUtils::round_int(avgerror * 100)
+ , abs(MathUtils::round_int(m_presenterr * 100)));
return state;
}
#include "DVDStreamInfo.h"
#include "settings/Settings.h"
#include "utils/SystemInfo.h"
+#include "utils/StringUtils.h"
CDVDVideoCodec* CDVDFactoryCodec::OpenCodec(CDVDVideoCodec* pCodec, CDVDStreamInfo &hints, CDVDCodecOptions &options )
{
}
#endif
- CStdString value;
- value.Format("%d", surfaces);
+ CStdString value = StringUtils::Format("%d", surfaces);
options.m_keys.push_back(CDVDCodecOption("surfaces", value));
if( (pCodec = OpenCodec(new CDVDVideoCodecFFmpeg(), hint, options)) ) return pCodec;
if(pos == CStdString::npos)
continue;
- line2.Format("%d,%s,%s", m_order++, layer.get(), line.Mid(pos+1));
+ line2 = StringUtils::Format("%d,%s,%s", m_order++, layer.get(), line.Mid(pos+1).c_str());
m_libass->DecodeDemuxPkt((char*)line2.c_str(), line2.length(), beg, end - beg);
#include "settings/Settings.h"
#include "utils/AMLUtils.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "utils/TimeUtils.h"
#include <unistd.h>
#ifdef TARGET_DARWIN_OSX
#include "VDA.h"
#endif
+#include "utils/StringUtils.h"
using namespace boost;
AVFilter* srcFilter = m_dllAvFilter.avfilter_get_by_name("buffer");
AVFilter* outFilter = m_dllAvFilter.avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
- CStdString args;
-
- args.Format("%d:%d:%d:%d:%d:%d:%d",
- m_pCodecContext->width,
- m_pCodecContext->height,
- m_pCodecContext->pix_fmt,
- m_pCodecContext->time_base.num,
- m_pCodecContext->time_base.den,
- m_pCodecContext->sample_aspect_ratio.num,
- m_pCodecContext->sample_aspect_ratio.den);
+ CStdString args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d",
+ m_pCodecContext->width,
+ m_pCodecContext->height,
+ m_pCodecContext->pix_fmt,
+ m_pCodecContext->time_base.num,
+ m_pCodecContext->time_base.den,
+ m_pCodecContext->sample_aspect_ratio.num,
+ m_pCodecContext->sample_aspect_ratio.den);
if ((result = m_dllAvFilter.avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args, NULL, m_pFilterGraph)) < 0)
{
#include "settings/MediaSettings.h"
#include "boost/shared_ptr.hpp"
#include "utils/AutoPtrHandle.h"
+#include "utils/StringUtils.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
#include "cores/VideoRenderers/RenderManager.h"
static CStdString GUIDToString(const GUID& guid)
{
- CStdString buffer;
- buffer.Format("%08X-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+ CStdString buffer = StringUtils::Format("%08X-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"
, guid.Data1, guid.Data2, guid.Data3
, guid.Data4[0], guid.Data4[1]
, guid.Data4[2], guid.Data4[3], guid.Data4[4]
#include "DVDDemuxBXA.h"
#include "DVDDemuxUtils.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "../DVDClock.h"
// AirTunes audio Demuxer.
{}
void GetStreamInfo(string& strInfo)
{
- CStdString info;
- info.Format("%s", m_codec.c_str());
- strInfo = info;
+ strInfo = StringUtils::Format("%s", m_codec.c_str());
}
};
#include "threads/Thread.h"
#include "threads/SystemClock.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
void CDemuxStreamAudioFFmpeg::GetStreamInfo(std::string& strInfo)
default : type = LOGDEBUG; break;
}
- CStdString message, prefix;
- message.FormatV(format, va);
-
- prefix.Format("ffmpeg[%X]: ", threadId);
+ CStdString message = StringUtils::FormatV(format, va);
+ CStdString prefix = StringUtils::Format("ffmpeg[%X]: ", threadId);
if(avc)
{
if(avc->item_name)
#include "DVDClock.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include <arpa/inet.h>
extern "C" {
{}
void GetStreamInfo(std::string& strInfo)
{
- CStdString info;
- info.Format("%s, delay: %u, drops: %ub %up %ui"
- , m_codec.c_str()
- , m_parent->m_QueueStatus.delay
- , m_parent->m_QueueStatus.bdrops
- , m_parent->m_QueueStatus.pdrops
- , m_parent->m_QueueStatus.idrops);
+ CStdString info = StringUtils::Format("%s, delay: %u, drops: %ub %up %ui"
+ , m_codec.c_str()
+ , m_parent->m_QueueStatus.delay
+ , m_parent->m_QueueStatus.bdrops
+ , m_parent->m_QueueStatus.pdrops
+ , m_parent->m_QueueStatus.idrops);
strInfo = info;
}
};
{}
void GetStreamInfo(string& strInfo)
{
- CStdString info;
- info.Format("%s", m_codec.c_str());
+ CStdString info = StringUtils::Format("%s", m_codec.c_str());
strInfo = info;
}
};
// find any upnp subtitles
CStdString key("upnp:subtitle:1");
- for(unsigned s = 1; m_item.HasProperty(key); key.Format("upnp:subtitle:%u", ++s))
+ for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s))
filenames.push_back(m_item.GetProperty(key).asString());
for(unsigned int i=0;i<filenames.size();i++)
void CDVDPlayer::GetAudioInfo(CStdString& strAudioInfo)
{
{ CSingleLock lock(m_StateSection);
- strAudioInfo.Format("D(%s)", m_StateInput.demux_audio.c_str());
+ strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str());
}
strAudioInfo.AppendFormat("\nP(%s)", m_dvdPlayerAudio.GetPlayerInfo().c_str());
}
void CDVDPlayer::GetVideoInfo(CStdString& strVideoInfo)
{
{ CSingleLock lock(m_StateSection);
- strVideoInfo.Format("D(%s)", m_StateInput.demux_video.c_str());
+ strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str());
}
strVideoInfo.AppendFormat("\nP(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str());
}
strBuf.AppendFormat(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
}
- strGeneralInfo.Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
- , dDelay
- , dDiff
- , strEDL.c_str()
- , (int)(CThread::GetRelativeUsage()*100)
- , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100)
- , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)
- , strBuf.c_str());
+ strGeneralInfo = StringUtils::Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
+ , dDelay
+ , dDiff
+ , strEDL.c_str()
+ , (int)(CThread::GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)
+ , strBuf.c_str());
}
}
// find any upnp subtitles
CStdString key("upnp:subtitle:1");
- for(unsigned s = 1; m_item.HasProperty(key); key.Format("upnp:subtitle:%u", ++s))
+ for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s))
filenames.push_back(m_item.GetProperty(key).asString());
for(unsigned int i=0;i<filenames.size();i++)
void COMXPlayer::GetAudioInfo(CStdString &strAudioInfo)
{
{ CSingleLock lock(m_StateSection);
- strAudioInfo.Format("D(%s)", m_StateInput.demux_audio.c_str());
+ strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str());
}
strAudioInfo.AppendFormat("\nP(%s)", m_omxPlayerAudio.GetPlayerInfo().c_str());
}
void COMXPlayer::GetVideoInfo(CStdString &strVideoInfo)
{
{ CSingleLock lock(m_StateSection);
- strVideoInfo.Format("D(%s)", m_StateInput.demux_video.c_str());
+ strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str());
}
strVideoInfo.AppendFormat("\nP(%s)", m_omxPlayerVideo.GetPlayerInfo().c_str());
}
strBuf.AppendFormat(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
}
- strGeneralInfo.Format("C( ad:% 6.3f a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s af:%d%% vf:%d%% amp:% 5.2f )"
+ strGeneralInfo = StringUtils::Format("C( ad:% 6.3f a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s af:%d%% vf:%d%% amp:% 5.2f )"
, m_omxPlayerAudio.GetDelay()
, dDiff
, strEDL.c_str()
//#include "MathUtils.h"
#include "PCMRemap.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
#ifdef _WIN32
dst->copy = false;
}
- f.Format("%s(%f%s) ", PCMChannelStr(dst->channel).c_str(), dst->level, dst->copy ? "*" : "");
+ f = StringUtils::Format("%s(%f%s) ", PCMChannelStr(dst->channel).c_str(), dst->level, dst->copy ? "*" : "");
s += f;
}
CLog::Log(LOGDEBUG, "CPCMRemap: %s = %s\n", PCMChannelStr(m_outMap[out_ch]).c_str(), s.c_str());
CStdString namestr;
if (namepos < 0 || namepos >= (int)(sizeof(PCMChannelName) / sizeof(const char*)))
- namestr.Format("UNKNOWN CHANNEL:%i", namepos);
+ namestr = StringUtils::Format("UNKNOWN CHANNEL:%i", namepos);
else
namestr = PCMChannelName[namepos];
else if (GetFieldType(m_field) == SECONDS_FIELD)
fmt = "CAST(%s as INTEGER)";
- query.Format(fmt.c_str(), GetField(m_field,strType).c_str());
+ query = StringUtils::Format(fmt.c_str(), GetField(m_field,strType).c_str());
query += negate + parameter;
}
#include "TextureCache.h"
#include "video/windows/GUIWindowVideoBase.h"
#include "URL.h"
+#include "utils/StringUtils.h"
#ifdef TARGET_WINDOWS
#include "WIN32Util.h"
// password entry and re-entry succeeded, write out the lock data
share->m_iHasLock = 2;
CMediaSourceSettings::Get().UpdateSource(type, share->strName, "lockcode", strNewPassword);
- strNewPassword.Format("%i",share->m_iLockMode);
+ strNewPassword = StringUtils::Format("%i", share->m_iLockMode);
CMediaSourceSettings::Get().UpdateSource(type, share->strName, "lockmode", strNewPassword);
CMediaSourceSettings::Get().UpdateSource(type, share->strName, "badpwdcount", "0");
CMediaSourceSettings::Get().Save();
CStdString strNewPW;
CStdString strNewLockMode;
if (CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPW))
- strNewLockMode.Format("%i",share->m_iLockMode);
+ strNewLockMode = StringUtils::Format("%i",share->m_iLockMode);
else
return false;
// password ReSet and re-entry succeeded, write out the lock data
#include "GUIDialogGamepad.h"
#include "utils/md5.h"
+#include "utils/StringUtils.h"
#include "guilib/GUIAudioManager.h"
#include "guilib/GUIWindowManager.h"
#include "GUIDialogOK.h"
if (0 < iRetries)
{
// Show a string telling user they have iRetries retries left
- strLine2.Format("%s %i %s", g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
+ strLine2 = StringUtils::Format("%s %i %s", g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
}
// make a copy of strPassword to prevent from overwriting it later
#include "playlists/SmartPlayList.h"
#include "utils/log.h"
#include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
#include "video/VideoDatabase.h"
#define TIMEOUT_DELAY 500
else if (m_mediaType == "songs")
localizedMediaId = 134;
- CStdString format;
- format.Format(g_localizeStrings.Get(1275).c_str(), g_localizeStrings.Get(localizedMediaId).c_str());
+ CStdString format = StringUtils::Format(g_localizeStrings.Get(1275).c_str(), g_localizeStrings.Get(localizedMediaId).c_str());
SET_CONTROL_LABEL(CONTROL_HEADING, format);
// now we can finally set the label/values of the button settings (genre, actors etc)
}
else
{
- CStdString tmp;
- tmp.Format("%.1f", *valueLower);
+ CStdString tmp = StringUtils::Format("%.1f", *valueLower);
filter.rule->m_parameter.push_back(tmp);
tmp.clear();
- tmp.Format("%.1f", *valueUpper);
+ tmp = StringUtils::Format("%.1f", *valueUpper);
filter.rule->m_parameter.push_back(tmp);
}
}
else
{
CONTROL_ENABLE(itFilter->second.controlIndex);
- label.Format("%s [%d]", label, size);
+ label = StringUtils::Format("%s [%d]", label.c_str(), size);
}
SET_CONTROL_LABEL(itFilter->second.controlIndex, label);
}
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetItems(&selectItems);
- CStdString strHeading;
- strHeading.Format(g_localizeStrings.Get(13401), g_localizeStrings.Get(filter.label));
+ CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(13401), g_localizeStrings.Get(filter.label).c_str());
pDialog->SetHeading(strHeading);
pDialog->SetMultiSelection(true);
else if (m_mediaType == "tvshows")
{
table = "tvshowview";
- year.Format("strftime(\"%%Y\", %s)", DatabaseUtils::GetField(FieldYear, MediaTypeTvShow, DatabaseQueryPartWhere));
+ year = StringUtils::Format("strftime(\"%%Y\", %s)", DatabaseUtils::GetField(FieldYear, MediaTypeTvShow, DatabaseQueryPartWhere).c_str());
}
else if (m_mediaType == "musicvideos")
{
if (m_mediaType == "episodes")
{
- CStdString field; field.Format("CAST(strftime(\"%%s\", c%02d) AS INTEGER)", VIDEODB_ID_EPISODE_AIRED);
+ CStdString field = StringUtils::Format("CAST(strftime(\"%%s\", c%02d) AS INTEGER)", VIDEODB_ID_EPISODE_AIRED);
GetMinMax("episodeview", field, min, max);
interval = 60 * 60 * 24 * 7; // 1 week
{
CStdString text;
if (valueLower != valueUpper)
- text.Format(g_localizeStrings.Get(21467).c_str(), valueLower, valueUpper);
+ text = StringUtils::Format(g_localizeStrings.Get(21467).c_str(), valueLower, valueUpper);
else
- text.Format("%.1f", valueLower);
+ text = StringUtils::Format("%.1f", valueLower);
return text;
}
{
CStdString text;
if (valueLower != valueUpper)
- text.Format(g_localizeStrings.Get(21468).c_str(), MathUtils::round_int((double)valueLower), MathUtils::round_int((double)valueUpper));
+ text = StringUtils::Format(g_localizeStrings.Get(21468).c_str(),
+ MathUtils::round_int((double)valueLower),
+ MathUtils::round_int((double)valueUpper));
else
- text.Format("%d", MathUtils::round_int((double)valueLower));
+ text = StringUtils::Format("%d", MathUtils::round_int((double)valueLower));
return text;
}
CDateTime to = (time_t)valueUpper;
CStdString text;
if (valueLower != valueUpper)
- text.Format(g_localizeStrings.Get(21469).c_str(), from.GetAsLocalizedDate(), to.GetAsLocalizedDate());
+ text = StringUtils::Format(g_localizeStrings.Get(21469).c_str(),
+ from.GetAsLocalizedDate().c_str(),
+ to.GetAsLocalizedDate().c_str());
else
- text.Format("%s", from.GetAsLocalizedDate());
+ text = StringUtils::Format("%s",
+ from.GetAsLocalizedDate().c_str());
return text;
}
CDateTime to = (time_t)valueUpper;
CStdString text;
if (valueLower != valueUpper)
- text.Format(g_localizeStrings.Get(21469).c_str(), from.GetAsLocalizedTime("mm:ss"), to.GetAsLocalizedTime("mm:ss"));
+ text = StringUtils::Format(g_localizeStrings.Get(21469).c_str(),
+ from.GetAsLocalizedTime("mm:ss").c_str(),
+ to.GetAsLocalizedTime("mm:ss").c_str());
else
- text.Format("%s", from.GetAsLocalizedTime("mm:ss"));
+ text = StringUtils::Format("%s", from.GetAsLocalizedTime("mm:ss").c_str());
return text;
}
#include "guilib/Key.h"
#include "Util.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "filesystem/Directory.h"
#include "filesystem/PluginDirectory.h"
#include "filesystem/PVRDirectory.h"
break;
}
if (i < pShares->size()) // found a match - try next
- strName.Format("%s (%i)",dialog->m_name,j++);
+ strName = StringUtils::Format("%s (%i)", dialog->m_name.c_str(), j++);
else
bConfirmed = true;
}
break;
}
if (i < pShares->size() && (*pShares)[i].strName != strOldName) // found a match - try next
- strName.Format("%s (%i)",dialog->m_name,j++);
+ strName = StringUtils::Format("%s (%i)", dialog->m_name.c_str(), j++);
else
bConfirmed = true;
}
else // if (type == "files");
typeStringID = 744; // "Files"
CStdString format;
- format.Format(g_localizeStrings.Get(editNotAdd ? 1028 : 1020).c_str(), g_localizeStrings.Get(typeStringID).c_str());
+ format = StringUtils::Format(g_localizeStrings.Get(editNotAdd ? 1028 : 1020).c_str(), g_localizeStrings.Get(typeStringID).c_str());
SET_CONTROL_LABEL(CONTROL_HEADING, format);
}
}
else if (m_mode == INPUT_TIME)
{ // format up the time
- strLabel.Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
+ strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
start = m_block * 3;
end = m_block * 3 + 2;
}
else if (m_mode == INPUT_TIME_SECONDS)
{ // format up the time
- strLabel.Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond);
+ strLabel = StringUtils::Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond);
start = m_block * 3;
end = m_block * 3 + 2;
}
else if (m_mode == INPUT_DATE)
{ // format up the date
- strLabel.Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
+ strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
start = m_block * 3;
end = m_block * 3 + 2;
if (m_block == 2)
}
else if (m_mode == INPUT_IP_ADDRESS)
{ // format up the date
- strLabel.Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
+ strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
start = m_block * 4;
end = m_block * 4 + 3;
}
if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
memcpy(output, &m_datetime, sizeof(m_datetime));
else if (m_mode == INPUT_IP_ADDRESS)
- {
- CStdString *ipaddress = (CStdString *)output;
- ipaddress->Format("%d.%d.%d.%d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
- }
+ *(CStdString *)output = StringUtils::Format("%d.%d.%d.%d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
else if (m_mode == INPUT_NUMBER || m_mode == INPUT_PASSWORD)
- {
- CStdString *number = (CStdString *)output;
- *number = m_number;
- }
+ *(CStdString *)output = m_number;
}
CStdString CGUIDialogNumeric::GetOutput() const
{
CStdString output;
if (m_mode == INPUT_DATE)
- output.Format("%02i/%02i/%04i", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
+ output = StringUtils::Format("%02i/%02i/%04i", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
else if (m_mode == INPUT_TIME)
- output.Format("%i:%02i", m_datetime.wHour, m_datetime.wMinute);
+ output = StringUtils::Format("%i:%02i", m_datetime.wHour, m_datetime.wMinute);
else if (m_mode == INPUT_TIME_SECONDS)
- output.Format("%i:%02i", m_datetime.wMinute, m_datetime.wSecond);
+ output = StringUtils::Format("%i:%02i", m_datetime.wMinute, m_datetime.wSecond);
else
GetOutput(&output);
return output;
if (0 < iRetries)
{
// Show a string telling user they have iRetries retries left
- strTempHeading.Format("%s. %s %i %s", strHeading.c_str(), g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
+ strTempHeading = StringUtils::Format("%s. %s %i %s", strHeading.c_str(), g_localizeStrings.Get(12342).c_str(), iRetries, g_localizeStrings.Get(12343).c_str());
}
// make a copy of strPassword to prevent from overwriting it later
CStdString strPassTemp = strPassword;
#include "FileItem.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
#define CONTROL_HEADING 1
#define CONTROL_LIST 3
}
m_viewControl.SetCurrentView(m_useDetails ? CONTROL_DETAILS : CONTROL_LIST);
- CStdString items;
- items.Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_NUMBEROFFILES, items);
if (m_multiSelection)
for (unsigned int i = 0; i < sizeof(limits) / sizeof(int); i++)
{
CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_LIMIT, limits[i]);
- CStdString label; label.Format(g_localizeStrings.Get(21436).c_str(), limits[i]);
+ CStdString label = StringUtils::Format(g_localizeStrings.Get(21436).c_str(), limits[i]);
msg.SetLabel(label);
OnMessage(msg);
}
#include "settings/MediaSourceSettings.h"
#include "storage/MediaManager.h"
#include "utils/LabelFormatter.h"
+#include "utils/StringUtils.h"
#define CONTROL_FIELD 15
#define CONTROL_OPERATOR 16
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetItems(&items);
- CStdString strHeading;
- strHeading.Format(g_localizeStrings.Get(13401),g_localizeStrings.Get(iLabel));
+ CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(13401).c_str(), g_localizeStrings.Get(iLabel).c_str());
pDialog->SetHeading(strHeading);
pDialog->SetMultiSelection(m_rule.m_field != FieldPlaylist && m_rule.m_field != FieldVirtualFolder);
CStdString path;
{
CSingleLock lock(m_critSection);
- path.Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
+ path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str());
}
SetPath(path);
switch (info)
{
case CONTAINER_NUM_PAGES:
- label.Format("%u", (m_channels + m_channelsPerPage - 1) / m_channelsPerPage);
+ label = StringUtils::Format("%u", (m_channels + m_channelsPerPage - 1) / m_channelsPerPage);
break;
case CONTAINER_CURRENT_PAGE:
- label.Format("%u", 1 + (m_channelCursor + m_channelOffset) / m_channelsPerPage );
+ label = StringUtils::Format("%u", 1 + (m_channelCursor + m_channelOffset) / m_channelsPerPage );
break;
case CONTAINER_POSITION:
- label.Format("%i", 1 + m_channelCursor + m_channelOffset);
+ label = StringUtils::Format("%i", 1 + m_channelCursor + m_channelOffset);
break;
case CONTAINER_NUM_ITEMS:
- label.Format("%u", m_channels);
+ label = StringUtils::Format("%u", m_channels);
break;
default:
break;
#include "File.h"
#include "SpecialProtocol.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
using namespace ADDON;
CStdString strLabel(addon->Name());
if (url.GetHostName().Equals("search"))
- strLabel.Format("%s - %s", TranslateType(addon->Type(), true), addon->Name());
+ strLabel = StringUtils::Format("%s - %s", TranslateType(addon->Type(), true).c_str(), addon->Name().c_str());
item->SetLabel(strLabel);
if (plugin->ProvidesSeveral())
{
CURL url = item->GetAsUrl();
- CStdString opt;
- opt.Format("?content_type=%s",content.c_str());
+ CStdString opt = StringUtils::Format("?content_type=%s",content.c_str());
url.SetOptions(opt);
item->SetPath(url.Get());
}
#include "utils/URIUtils.h"
#include <vector>
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "URL.h"
using namespace XFILE;
continue;
CFileItemPtr pItem(new CFileItem(applications[i].packageName));
pItem->m_bIsFolder = false;
- CStdString path;
- path.Format("androidapp://%s/%s/%s", url.GetHostName(), dirname, applications[i].packageName);
+ CStdString path = StringUtils::Format("androidapp://%s/%s/%s", url.GetHostName().c_str(), dirname.c_str(), applications[i].packageName.c_str());
pItem->SetPath(path);
pItem->SetLabel(applications[i].packageLabel);
pItem->SetArt("thumb", path+".png");
#include "BlurayDirectory.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "DllLibbluray.h"
#include "FileItem.h"
CStdString buf;
CFileItemPtr item(new CFileItem("", false));
CURL path(m_url);
- buf.Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
+ buf = StringUtils::Format("BDMV/PLAYLIST/%05d.mpls", title->playlist);
path.SetFileName(buf);
item->SetPath(path.Get());
item->GetVideoInfoTag()->m_duration = (int)(title->duration / 90000);
item->GetVideoInfoTag()->m_iTrack = title->playlist;
- buf.Format(label.c_str(), title->playlist);
+ buf = StringUtils::Format(label.c_str(), title->playlist);
item->m_strTitle = buf;
item->SetLabel(buf);
item->m_dwSize = 0;
#include "FileItem.h"
#include "File.h"
#include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
using namespace XFILE;
using namespace MEDIA_DETECT;
continue;
// Format standard cdda item label
- CStdString strLabel;
- strLabel.Format("Track %02.2i", i);
+ CStdString strLabel = StringUtils::Format("Track %02.2i", i);
CFileItemPtr pItem(new CFileItem(strLabel));
pItem->m_bIsFolder = false;
- CStdString path;
- path.Format("cdda://local/%02.2i.cdda", i);
+ CStdString path = StringUtils::Format("cdda://local/%02.2i.cdda", i);
pItem->SetPath(path);
struct __stat64 s64;
void CCurlFile::SetRequestHeader(CStdString header, long value)
{
- CStdString buffer;
- buffer.Format("%ld", value);
- m_requestheaders[header] = buffer;
+ m_requestheaders[header] = StringUtils::Format("%ld", value);
}
std::string CCurlFile::GetServerReportedCharset(void)
#include "FileItem.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
namespace XFILE
{
CStdString host = url.GetHostName();
if (url.HasPort())
- host.Format("%s:%i",url.GetHostName(),url.GetPort());
+ host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort());
m_thisHost = g_DaapClient.GetHost(host);
if (!m_thisHost)
return false;
CStdString path;
if( m_thisHost->version_major != 3 )
{
- path.Format(REQUEST42,
- m_thisHost->host,
- g_DaapClient.m_iDatabase,
- m_currentSongItems[idx].id,
- m_currentSongItems[idx].songformat,
- m_thisHost->sessionid,
- m_thisHost->revision_number);
+ path = StringUtils::Format(REQUEST42,
+ m_thisHost->host,
+ g_DaapClient.m_iDatabase,
+ m_currentSongItems[idx].id,
+ m_currentSongItems[idx].songformat,
+ m_thisHost->sessionid,
+ m_thisHost->revision_number);
}
else
{
- path.Format(REQUEST45,
- m_thisHost->host,
- g_DaapClient.m_iDatabase,
- m_currentSongItems[idx].id,
- m_currentSongItems[idx].songformat,
- m_thisHost->sessionid);
+ path = StringUtils::Format(REQUEST45,
+ m_thisHost->host,
+ g_DaapClient.m_iDatabase,
+ m_currentSongItems[idx].id,
+ m_currentSongItems[idx].songformat,
+ m_thisHost->sessionid);
}
pItem->SetPath(path);
CStdString path;
if( m_thisHost->version_major != 3 )
{
- path.Format(REQUEST42,
- m_thisHost->host,
- g_DaapClient.m_iDatabase,
- m_currentSongItems[c].id,
- m_currentSongItems[c].songformat,
- m_thisHost->sessionid,
- m_thisHost->revision_number);
+ path = StringUtils::Format(REQUEST42,
+ m_thisHost->host,
+ g_DaapClient.m_iDatabase,
+ m_currentSongItems[c].id,
+ m_currentSongItems[c].songformat,
+ m_thisHost->sessionid,
+ m_thisHost->revision_number);
}
else
{
- path.Format(REQUEST45,
- m_thisHost->host,
- g_DaapClient.m_iDatabase,
- m_currentSongItems[c].id,
- m_currentSongItems[c].songformat,
- m_thisHost->sessionid);
+ path = StringUtils::Format(REQUEST45,
+ m_thisHost->host,
+ g_DaapClient.m_iDatabase,
+ m_currentSongItems[c].id,
+ m_currentSongItems[c].songformat,
+ m_thisHost->sessionid);
}
pItem->SetPath(path);
#include "DAAPFile.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include <sys/stat.h>
#include "lib/libXDAAP/private.h"
CLog::Log(LOGDEBUG, "CDAAPFile::Open(%s)", url.GetFileName().c_str());
CStdString host = url.GetHostName();
if (url.HasPort())
- host.Format("%s:%i",url.GetHostName(),url.GetPort());
+ host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort());
m_thisHost = g_DaapClient.GetHost(host);
if (!m_thisHost)
return false;
!(item.IsSmartPlayList() || item.IsPlayList())))
{
if (!contextWindow.empty())
- execute.Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
+ execute = StringUtils::Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
}
else if (item.IsScript())
- execute.Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().Mid(9)).c_str());
+ execute = StringUtils::Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().Mid(9)).c_str());
else if (item.IsAndroidApp())
- execute.Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().Mid(26)).c_str());
+ execute = StringUtils::Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().Mid(26)).c_str());
else // assume a media file
{
if (item.IsVideoDb() && item.HasVideoInfoTag())
- execute.Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
+ execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
else
- execute.Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
+ execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
}
return execute;
}
// need this crap to avoid making mistakes - yeyh for the new rar naming scheme :/
struct __stat64 stat;
int digits = token.size()-4;
- CStdString strNumber, strFormat;
- strFormat.Format("part%%0%ii",digits);
- strNumber.Format(strFormat.c_str(),1);
- CStdString strPath2=strPath;
+ CStdString strFormat = StringUtils::Format("part%%0%ii", digits);
+ CStdString strNumber = StringUtils::Format(strFormat.c_str(), 1);
+ CStdString strPath2 = strPath;
strPath2.Replace(token,strNumber);
if (atoi(token.substr(4).c_str()) > 1 && CFile::Stat(strPath2,&stat) == 0)
{
#include "URL.h"
#include "FileItem.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "DllHDHomeRun.h"
using namespace XFILE;
for(int i=0;i<count;i++)
{
- CStdString device, ip;
CFileItemPtr item;
unsigned int ip_addr = result_list[i].ip_addr;
- device.Format("%x", result_list[i].device_id);
- ip.Format("%u.%u.%u.%u",
+ CStdString device = StringUtils::Format("%x", result_list[i].device_id);
+ CStdString ip = StringUtils::Format("%u.%u.%u.%u",
(unsigned int)(ip_addr >> 24) & 0xFF, (unsigned int)(ip_addr >> 16) & 0xFF,
(unsigned int)(ip_addr >> 8) & 0xFF, (unsigned int)(ip_addr >> 0) & 0xFF);
CStdString label;
if(status.signal_present)
- label.Format("Current Stream: N/A");
+ label = StringUtils::Format("Current Stream: N/A");
else
- label.Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
+ label = StringUtils::Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality);
CStdString path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName();
URIUtils::RemoveSlashAtEnd(path);
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
extern "C" {
#include "libhts/htsmsg.h"
CHTSPSession::ParseItem(it->second, tag, event, *item);
item->m_bIsFolder = false;
item->SetLabel(item->m_strTitle);
- item->m_strTitle.Format("%d", it->second.num);
+ item->m_strTitle = StringUtils::Format("%d", it->second.num);
items.Add(item);
}
CStdString filename, label;
for(STags::iterator it = tags.begin(); it != tags.end(); it++)
{
- filename.Format("tags/%d/", it->second.id);
- label.Format("Tag: %s", it->second.name);
+ filename = StringUtils::Format("tags/%d/", it->second.id);
+ label = StringUtils::Format("Tag: %s", it->second.name.c_str());
item.reset(new CFileItem("", true));
url.SetFileName(filename);
{
CVideoInfoTag* tag = item.GetVideoInfoTag();
- CStdString temp;
-
CURL url(item.GetPath());
- temp.Format("tags/%d/%d.ts", tagid, channel.id);
+ CStdString temp = StringUtils::Format("tags/%d/%d.ts", tagid, channel.id);
url.SetFileName(temp);
tag->m_iSeason = 0;
#include "iso9660.h"
#include "Util.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "FileItem.h"
CStdString strDirectory = url.GetFileName();
if (strDirectory != "")
{
- strSearchMask.Format("\\%s", strDirectory.c_str());
+ strSearchMask = StringUtils::Format("\\%s", strDirectory.c_str());
}
else
{
Crc32 crc;
crc.ComputeFromLowerCase(path);
- CStdString strFileName;
- strFileName.Format("special://temp/%08x.fi", (unsigned __int32) crc);
+ CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc);
CFile::Delete(strFileName);
}
#include "DirectoryNodeAlbumRecentlyAdded.h"
#include "music/MusicDatabase.h"
#include "FileItem.h"
+#include "utils/StringUtils.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
for (int i=0; i<(int)albums.size(); ++i)
{
CAlbum& album=albums[i];
- CStdString strDir;
- strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+ CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
CFileItemPtr pItem(new CFileItem(strDir, album));
items.Add(pItem);
}
#include "DirectoryNodeAlbumRecentlyPlayed.h"
#include "music/MusicDatabase.h"
#include "FileItem.h"
+#include "utils/StringUtils.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
for (int i=0; i<(int)albums.size(); ++i)
{
CAlbum& album=albums[i];
- CStdString strDir;
- strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+ CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
CFileItemPtr pItem(new CFileItem(strDir, album));
items.Add(pItem);
}
#include "DirectoryNodeAlbumTop100.h"
#include "music/MusicDatabase.h"
#include "FileItem.h"
+#include "utils/StringUtils.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
for (int i=0; i<(int)albums.size(); ++i)
{
CAlbum& album=albums[i];
- CStdString strDir;
- strDir.Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
+ CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum);
CFileItemPtr pItem(new CFileItem(strDir, album));
items.Add(pItem);
}
#include "FileItem.h"
#include "music/MusicDatabase.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
namespace XFILE
{
continue;
CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(OverviewChildren[i].label)));
- CStdString strDir;
- strDir.Format("%s/", OverviewChildren[i].id);
+ CStdString strDir = StringUtils::Format("%s/", OverviewChildren[i].id.c_str());
pItem->SetPath(BuildPath() + strDir);
pItem->m_bIsFolder = true;
pItem->SetCanQueue(false);
#include "DirectoryNodeTop100.h"
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
using namespace std;
using namespace XFILE::MUSICDATABASEDIRECTORY;
for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i)
{
CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(Top100Children[i].label)));
- CStdString strDir;
- strDir.Format("%s/", Top100Children[i].id);
+ CStdString strDir = StringUtils::Format("%s/", Top100Children[i].id.c_str());
pItem->SetPath(BuildPath() + strDir);
pItem->m_bIsFolder = true;
items.Add(pItem);
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
using namespace MUSIC_INFO;
using namespace XFILE;
for (int i=0; i<iStreams; ++i)
{
- CStdString strLabel;
- strLabel.Format("%s - %s %02.2i", strFileName.c_str(),g_localizeStrings.Get(554).c_str(),i+1);
+ CStdString strLabel = StringUtils::Format("%s - %s %02.2i", strFileName.c_str(), g_localizeStrings.Get(554).c_str(), i+1);
CFileItemPtr pItem(new CFileItem(strLabel));
- strLabel.Format("%s%s-%i.%s", strPath.c_str(),strFileName.c_str(),i+1,m_strExt.c_str());
+ strLabel = StringUtils::Format("%s%s-%i.%s", strPath.c_str(), strFileName.c_str(), i+1, m_strExt.c_str());
pItem->SetPath(strLabel);
if (m_tag.Loaded())
CLog::Log(LOGDEBUG, "%s - Adding channel number %d: %s", __FUNCTION__, channum, name.c_str());
- CStdString number;
- number.Format("%d", channum); // CStdString easier for string manipulation than int.
+ CStdString number = StringUtils::Format("%d", channum); // CStdString easier for string manipulation than int.
url.SetFileName("guide/" + number);
CFileItemPtr item(new CFileItem(url.Get(), true));
item->m_strTitle = number;
CDateTime localstart;
if (program[i].starttime)
localstart = CTimeUtils::GetLocalTime(program[i].starttime);
- item->m_strTitle.Format("%s - %s", localstart.GetAsLocalizedTime("HH:mm", false), title); // e.g. 20:30 - Mythbusters
+ item->m_strTitle = StringUtils::Format("%s - %s",
+ localstart.GetAsLocalizedTime("HH:mm", false).c_str(),
+ title.c_str()); // e.g. 20:30 - Mythbusters
if (!subtitle.IsEmpty())
item->m_strTitle += " - \"" + subtitle + "\""; // e.g. 20:30 - Mythbusters - "The Pirate Special"
item->m_dateTime = localstart;
#include "PipesManager.h"
#include "threads/SingleLock.h"
+#include "utils/StringUtils.h"
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
CStdString PipesManager::GetUniquePipeName()
{
CSingleLock lock(m_lock);
- CStdString id;
- id.Format("pipe://%d/",m_nGenIdHelper++);
- return id;
+ return StringUtils::Format("pipe://%d/", m_nGenIdHelper++);
}
XFILE::Pipe *PipesManager::CreatePipe(const CStdString &name, int nMaxPipeSize)
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "ApplicationMessenger.h"
#include "Application.h"
#include "URL.h"
m_totalItems = 0;
// setup our parameters to send the script
- CStdString strHandle;
- strHandle.Format("%i", handle);
+ CStdString strHandle = StringUtils::Format("%i", handle);
vector<string> argv;
argv.push_back(basePath);
argv.push_back(strHandle);
CStdString basePath(url.Get());
// setup our parameters to send the script
- CStdString strHandle;
- strHandle.Format("%i", -1);
+ CStdString strHandle = StringUtils::Format("%i", -1);
vector<string> argv;
argv.push_back(basePath);
argv.push_back(strHandle);
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#if defined(TARGET_DARWIN)
#include "osx/OSXGNUReplacements.h" // strnlen
}
// add a new session to our buffer
- CStdString path, user;
- user = origin.username;
+ CStdString user = origin.username;
CURL::Encode(user);
- path.Format("sap://%s/%s/0x%x.sdp", header.origin.c_str(), desc.origin.c_str(), header.msgid);
+ CStdString path = StringUtils::Format("sap://%s/%s/0x%x.sdp", header.origin.c_str(), desc.origin.c_str(), header.msgid);
CSession session;
session.path = path;
session.origin = header.origin;
}
if (nt_error == NT_STATUS_OBJECT_NAME_NOT_FOUND)
- cError.Format(g_localizeStrings.Get(770).c_str(),nt_error);
+ cError = StringUtils::Format(g_localizeStrings.Get(770).c_str(),nt_error);
else
cError = get_friendly_nt_error_msg(nt_error);
}
if (errno == ENODEV || errno == ENOENT)
- cError.Format(g_localizeStrings.Get(770).c_str(),errno);
+ cError = StringUtils::Format(g_localizeStrings.Get(770).c_str(),errno);
else
cError = strerror(errno);
#include "profiles/ProfilesManager.h"
#include "utils/log.h"
#include "utils/XMLUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
using namespace XFILE;
else if (uiButtonsWithCode == 10)
{
// Prepare variables
- CStdString strDigits;
- strDigits.Format("%u", uiChannel);
+ CStdString strDigits = StringUtils::Format("%u", uiChannel);
unsigned int uiNumberOfDigits = strDigits.GetLength();
// Change the channel using IR commands
#include "FileItem.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
using namespace XFILE;
bIsBouquet = false; //On Empty is Bouquet
if (enigma2)
{
- CStdString strPort;
- strPort.Format(":%i",url.GetPort());
+ CStdString strPort = StringUtils::Format(":%i",url.GetPort());
if (strRoot.Right(strPort.GetLength()) != strPort) // If not root dir, enable Channels
strFilter = "e2"; // Disable Bouquets for Enigma2
{
// Allways take getallservices for Enigma2
strBQRequest = "web/getallservices"; //Bouquets and Channels
- strXMLRootString.Format("e2servicelistrecursive");
- strXMLChildString.Format("e2bouquet");
+ strXMLRootString = StringUtils::Format("e2servicelistrecursive");
+ strXMLChildString = StringUtils::Format("e2bouquet");
}
bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString )
{
CLog::Log(LOGDEBUG, "%s - Default defined RootMenu : (3) Movies", __FUNCTION__);
strBQRequest = "xml/services?mode=3&submode=4";
- strXMLRootString.Format("movies");
- strXMLChildString.Format("service");
+ strXMLRootString = StringUtils::Format("movies");
+ strXMLChildString = StringUtils::Format("service");
}
else if(g_advancedSettings.m_iTuxBoxDefaultRootMenu <= 0 || g_advancedSettings.m_iTuxBoxDefaultRootMenu == 1 ||
g_advancedSettings.m_iTuxBoxDefaultRootMenu > 4 )
if(strBQRequest.IsEmpty())
{
strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
- strXMLRootString.Format("bouquets");
- strXMLChildString.Format("bouquet");
+ strXMLRootString = StringUtils::Format("bouquets");
+ strXMLChildString = StringUtils::Format("bouquet");
}
}
}
{
CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (1) Services", __FUNCTION__);
strBQRequest = "xml/services?mode=0&submode=1"; //Services
- strXMLRootString.Format("services");
- strXMLChildString.Format("service");
+ strXMLRootString = StringUtils::Format("services");
+ strXMLChildString = StringUtils::Format("service");
}
else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 2)
{
CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (2) Satellites", __FUNCTION__);
strBQRequest = "xml/services?mode=0&submode=2"; //Satellites
- strXMLRootString.Format("satellites");
- strXMLChildString.Format("satellite");
+ strXMLRootString = StringUtils::Format("satellites");
+ strXMLChildString = StringUtils::Format("satellite");
}
else if(g_advancedSettings.m_iTuxBoxDefaultSubMenu == 3)
{
CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (3) Providers", __FUNCTION__);
strBQRequest = "xml/services?mode=0&submode=3"; //Providers
- strXMLRootString.Format("providers");
- strXMLChildString.Format("provider");
+ strXMLRootString = StringUtils::Format("providers");
+ strXMLChildString = StringUtils::Format("provider");
}
else
{
CLog::Log(LOGDEBUG, "%s - Default defined SubMenu : (4) Bouquets", __FUNCTION__);
strBQRequest = "xml/services?mode=0&submode=4"; //Bouquets
- strXMLRootString.Format("bouquets");
- strXMLChildString.Format("bouquet");
+ strXMLRootString = StringUtils::Format("bouquets");
+ strXMLChildString = StringUtils::Format("bouquet");
}
}
}
#include "VTPSession.h"
#include "URL.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "FileItem.h"
vector<CVTPSession::Channel>::iterator it;
for(it = channels.begin(); it != channels.end(); it++)
{
- CStdString buffer;
CFileItemPtr item(new CFileItem("", false));
- buffer.Format("%s/%d.ts", base.c_str(), it->index);
+ CStdString buffer = StringUtils::Format("%s/%d.ts", base.c_str(), it->index);
item->SetPath(buffer);
item->m_strTitle = it->name;
- buffer.Format("%d - %s", it->index, it->name);
+ buffer = StringUtils::Format("%d - %s", it->index, it->name.c_str());
item->SetLabel(buffer);
items.Add(item);
Crc32 crc;
crc.ComputeFromLowerCase(path);
- CStdString strFileName;
- strFileName.Format("special://temp/%08x.fi", (unsigned __int32) crc);
+ CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc);
CFile::Delete(strFileName);
}
// get year
if (params.GetYear() != -1)
{
- CStdString strTemp;
- strTemp.Format("%i",params.GetYear());
+ CStdString strTemp = StringUtils::Format("%i",params.GetYear());
if (!strLabel.IsEmpty())
strLabel += " / ";
strLabel += strTemp;
#include "guilib/LocalizeStrings.h"
#include "video/VideoDatabase.h"
#include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
using namespace XFILE::VIDEODATABASEDIRECTORY;
using namespace std;
}
CVideoDbUrl itemUrl = videoUrl;
- CStdString strDir; strDir.Format("%s/", MovieChildren[i].id);
+ CStdString strDir = StringUtils::Format("%s/", MovieChildren[i].id.c_str());
itemUrl.AppendPath(strDir);
CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), true));
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
using namespace XFILE::VIDEODATABASEDIRECTORY;
CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(MusicVideoChildren[i].label)));
CVideoDbUrl itemUrl = videoUrl;
- CStdString strDir; strDir.Format("%s/", MusicVideoChildren[i].id);
+ CStdString strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str());
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
#include "settings/Settings.h"
#include "FileItem.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
using namespace XFILE::VIDEODATABASEDIRECTORY;
return "";
}
default:
- CStdString season;
- season.Format(g_localizeStrings.Get(20358), GetID()); // Season <season>
+ CStdString season = StringUtils::Format(g_localizeStrings.Get(20358), GetID()); // Season <season>
return season;
}
}
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "video/VideoDbUrl.h"
+#include "utils/StringUtils.h"
using namespace XFILE::VIDEODATABASEDIRECTORY;
CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(TvShowChildren[i].label)));
CVideoDbUrl itemUrl = videoUrl;
- CStdString strDir; strDir.Format("%s/", TvShowChildren[i].id);
+ CStdString strDir = StringUtils::Format("%s/", TvShowChildren[i].id.c_str());
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
#ifdef _DEBUG_OUTPUT
CStdString strTmp;
- strTmp.Format("****************** Adding dir : %s\r", path);
+ strTmp = StringUtils::Format("****************** Adding dir : %s\r", path);
OutputDebugString( strTmp.c_str() );
#endif
strcpy( pFile_Pointer->name , temp_text.c_str());
#ifdef _DEBUG_OUTPUT
//CStdString strTmp;
- //strTmp.Format("adding sector : %X, File : %s size = %u pos = %x\r",sector,temp_text.c_str(), isodir.dwFileLengthLE, isodir.dwFileLocationLE );
+ //strTmp = StringUtils::Format("adding sector : %X, File : %s size = %u pos = %x\r",sector,temp_text.c_str(), isodir.dwFileLengthLE, isodir.dwFileLocationLE );
//OutputDebugString( strTmp.c_str());
#endif
DWORD dwFileLocation = from_733(isodir.extent);
#ifdef _DEBUG_OUTPUT
CStdString strTmp;
- strTmp.Format("adding directory sector : %X, File : %s size = %u pos = %x\r", sector, temp_text.c_str(), from_733(isodir.size), dwFileLocation );
+ strTmp = StringUtils::Format("adding directory sector : %X, File : %s size = %u pos = %x\r", sector, temp_text.c_str(), from_733(isodir.size), dwFileLocation );
OutputDebugString( strTmp.c_str());
#endif
std::cout << "File contents:" << std::endl;
while ((size = file.Read(buf, sizeof(buf))) > 0)
{
- str.Format(" %08X", count);
+ str = StringUtils::Format(" %08X", count);
std::cout << str << " ";
count += size;
for (i = 0; i < size; i++)
{
- str.Format("%02X ", buf[i]);
+ str = StringUtils::Format("%02X ", buf[i]);
std::cout << str;
}
while (i++ < sizeof(buf))
std::cout << "File contents:\n";
while ((size = file.Read(buf, sizeof(buf))) > 0)
{
- str.Format(" %08X", count);
+ str = StringUtils::Format(" %08X", count);
std::cout << str << " ";
count += size;
for (i = 0; i < size; i++)
{
- str.Format("%02X ", buf[i]);
+ str = StringUtils::Format("%02X ", buf[i]);
std::cout << str;
}
while (i++ < sizeof(buf))
std::cout << "File contents:" << std::endl;
while ((size = file->Read(buf, sizeof(buf))) > 0)
{
- str.Format(" %08X", count);
+ str = StringUtils::Format(" %08X", count);
std::cout << str << " ";
count += size;
for (i = 0; i < size; i++)
{
- str.Format("%02X ", buf[i]);
+ str = StringUtils::Format("%02X ", buf[i]);
std::cout << str;
}
while (i++ < sizeof(buf))
#include "filesystem/Directory.h"
#include "filesystem/File.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "FileItem.h"
#include "settings/Settings.h"
std::cout << "File contents:" << std::endl;
while ((size = file->Read(buf, sizeof(buf))) > 0)
{
- str.Format(" %08X", count);
+ str = StringUtils::Format(" %08X", count);
std::cout << str << " ";
count += size;
for (i = 0; i < size; i++)
{
- str.Format("%02X ", buf[i]);
+ str = StringUtils::Format("%02X ", buf[i]);
std::cout << str;
}
while (i++ < sizeof(buf))
void CGUIAction::SetNavigation(int id)
{
if (id == 0) return;
- CStdString strId;
- strId.Format("%i", id);
+ CStdString strId = StringUtils::Format("%i", id);
for (iActions it = m_actions.begin() ; it != m_actions.end() ; ++it)
{
if (StringUtils::IsInteger(it->action) && it->condition.IsEmpty())
if (m_matchTimer.GetElapsedMilliseconds() < letter_match_timeout)
m_match.push_back(letter);
else
- m_match.Format("%c", letter);
+ m_match = StringUtils::Format("%c", letter);
m_matchTimer.StartZero();
{
CGUIListItemPtr pItem = m_items[item];
if (pItem->m_bIsFolder)
- strLabel.Format("[%s]", pItem->GetLabel().c_str());
+ strLabel = StringUtils::Format("[%s]", pItem->GetLabel().c_str());
else
strLabel = pItem->GetLabel();
}
switch (info)
{
case CONTAINER_NUM_PAGES:
- label.Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
+ label = StringUtils::Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
break;
case CONTAINER_CURRENT_PAGE:
- label.Format("%u", GetCurrentPage());
+ label = StringUtils::Format("%u", GetCurrentPage());
break;
case CONTAINER_POSITION:
- label.Format("%i", GetCursor());
+ label = StringUtils::Format("%i", GetCursor());
break;
case CONTAINER_NUM_ITEMS:
{
unsigned int numItems = GetNumItems();
if (numItems && m_items[0]->IsFileItem() && (boost::static_pointer_cast<CFileItem>(m_items[0]))->IsParentFolder())
- label.Format("%u", numItems-1);
+ label = StringUtils::Format("%u", numItems-1);
else
- label.Format("%u", numItems);
+ label = StringUtils::Format("%u", numItems);
}
break;
default:
int labelNumber = 0;
if (XMLUtils::GetInt(pControlNode, "number", labelNumber))
{
- CStdString label;
- label.Format("%i", labelNumber);
+ CStdString label = StringUtils::Format("%i", labelNumber);
infoLabels.push_back(CGUIInfoLabel(label));
return; // done
}
{
if (infoNode->FirstChild())
{
- CStdString info;
- info.Format("$INFO[%s]", infoNode->FirstChild()->Value());
+ CStdString info = StringUtils::Format("$INFO[%s]", infoNode->FirstChild()->Value());
infoLabels.push_back(CGUIInfoLabel(info, fallback, parentID));
}
infoNode = infoNode->NextSibling("info");
#include "GUIControlProfiler.h"
#include "utils/XBMCTinyXML.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
bool CGUIControlProfiler::m_bIsRunning = false;
xmlControl->SetAttribute("type", lpszType);
if (m_controlID != 0)
{
- CStdString str;
- str.Format("%u", m_controlID);
+ CStdString str = StringUtils::Format("%u", m_controlID);
xmlControl->SetAttribute("id", str.c_str());
}
float pct = (float)GetTotalTime() / (float)m_pProfiler->GetTotalTime();
if (pct > 0.01f)
{
- CStdString str;
- str.Format("%.0f", pct * 100.0f);
+ CStdString str = StringUtils::Format("%.0f", pct * 100.0f);
xmlControl->SetAttribute("percent", str.c_str());
}
CStdString val;
TiXmlElement *elem = new TiXmlElement("rendertime");
xmlControl->LinkEndChild(elem);
- val.Format("%u", rend);
+ val = StringUtils::Format("%u", rend);
TiXmlText *text = new TiXmlText(val.c_str());
elem->LinkEndChild(text);
elem = new TiXmlElement("visibletime");
xmlControl->LinkEndChild(elem);
- val.Format("%u", vis);
+ val = StringUtils::Format("%u", vis);
text = new TiXmlText(val.c_str());
elem->LinkEndChild(text);
}
doc.InsertEndChild(decl);
TiXmlElement *root = new TiXmlElement("guicontrolprofiler");
- CStdString str;
- str.Format("%d", m_iFrameCount);
+ CStdString str = StringUtils::Format("%d", m_iFrameCount);
root->SetAttribute("framecount", str.c_str());
root->SetAttribute("timeunit", "ms");
doc.LinkEndChild(root);
CheckFont(strPath,"special://xbmc/media/Fonts",file);
// check if we already have this font file loaded (font object could differ only by color or style)
- CStdString TTFfontName;
- TTFfontName.Format("%s_%f_%f%s", strFilename, newSize, aspect, border ? "_border" : "");
+ CStdString TTFfontName = StringUtils::Format("%s_%f_%f%s", strFilename.c_str(), newSize, aspect, border ? "_border" : "");
CGUIFontTTFBase* pFontFile = GetFontFile(TTFfontName);
if (!pFontFile)
RescaleFontSizeAndAspect(&newSize, &aspect, fontInfo.sourceRes, fontInfo.preserveAspect);
- CStdString TTFfontName;
- TTFfontName.Format("%s_%f_%f%s", strFilename, newSize, aspect, fontInfo.border ? "_border" : "");
+ CStdString TTFfontName = StringUtils::Format("%s_%f_%f%s", strFilename.c_str(), newSize, aspect, fontInfo.border ? "_border" : "");
CGUIFontTTFBase* pFontFile = GetFontFile(TTFfontName);
if (!pFontFile)
{
#include "GUIWindowManager.h"
#include "settings/Settings.h"
#include "utils/md5.h"
-
+#include "utils/StringUtils.h"
#include "dialogs/GUIDialogKeyboardGeneric.h"
#if defined(TARGET_DARWIN_IOS)
if (1 > iRetries && strHeading.size())
strHeadingTemp = strHeading;
else
- strHeadingTemp.Format("%s - %i %s", g_localizeStrings.Get(12326).c_str(), CSettings::Get().GetInt("masterlock.maxretries") - iRetries, g_localizeStrings.Get(12343).c_str());
+ strHeadingTemp = StringUtils::Format("%s - %i %s",
+ g_localizeStrings.Get(12326).c_str(),
+ CSettings::Get().GetInt("masterlock.maxretries") - iRetries,
+ g_localizeStrings.Get(12343).c_str());
CStdString strUserInput = "";
if (!ShowAndGetInput(strUserInput, strHeadingTemp, false, true, autoCloseMs)) //bool hiddenInput = false/true ? TODO: GUI Setting to enable disable this feature y/n?
#include "GUIListContainer.h"
#include "GUIListItem.h"
#include "Key.h"
+#include "utils/StringUtils.h"
CGUIListContainer::CGUIListContainer(int parentID, int controlID, float posX, float posY, float width, float height, ORIENTATION orientation, const CScroller& scroller, int preloadItems)
: CGUIBaseContainer(parentID, controlID, posX, posY, width, height, orientation, scroller, preloadItems)
CGUIListItemLayout layout;
layout.CreateListControlLayouts(width, textureHeight + spaceBetweenItems, false, labelInfo, labelInfo2, textureButton, textureButtonFocus, textureHeight, itemWidth, itemHeight, "", "");
m_layouts.push_back(layout);
- CStdString condition;
- condition.Format("control.hasfocus(%i)", controlID);
+ CStdString condition = StringUtils::Format("control.hasfocus(%i)", controlID);
CStdString condition2 = "!" + condition;
CGUIListItemLayout focusLayout;
focusLayout.CreateListControlLayouts(width, textureHeight + spaceBetweenItems, true, labelInfo, labelInfo2, textureButton, textureButtonFocus, textureHeight, itemWidth, itemHeight, condition2, condition);
#include "GUIListItem.h"
#include "GUIWindowManager.h"
#include "FileItem.h"
+#include "utils/StringUtils.h"
CGUIProgressControl::CGUIProgressControl(int parentID, int controlID,
float posX, float posY, float width,
CStdString CGUIProgressControl::GetDescription() const
{
- CStdString percent;
- percent.Format("%2.f", m_fPercent);
- return percent;
+ return StringUtils::Format("%2.f", m_fPercent);
}
bool CGUIProgressControl::UpdateLayout(void)
#include "GUIScrollBarControl.h"
#include "Key.h"
+#include "utils/StringUtils.h"
#define MIN_NIB_SIZE 4.0f
CStdString CGUIScrollBar::GetDescription() const
{
- CStdString description;
- description.Format("%i/%i", m_offset, m_numItems);
- return description;
+ return StringUtils::Format("%i/%i", m_offset, m_numItems);
}
bool CGUIScrollBar::UpdateColors()
#include "GUIInfoManager.h"
#include "Key.h"
#include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
#include "GUIWindowManager.h"
static const SliderAction actions[] = {
SEND_CLICK_MESSAGE(GetID(), GetParentID(), MathUtils::round_int(percent));
if (m_action && (!m_dragging || m_action->fireOnDrag))
{
- CStdString action;
- action.Format(m_action->formatString, percent);
+ CStdString action = StringUtils::Format(m_action->formatString, percent);
CGUIMessage message(GUI_MSG_EXECUTE, m_controlID, m_parentID);
message.SetStringParam(action);
g_windowManager.SendMessage(message);
if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
{
if (m_rangeSelection)
- description.Format("[%2.2f, %2.2f]", m_floatValues[0], m_floatValues[1]);
+ description = StringUtils::Format("[%2.2f, %2.2f]", m_floatValues[0], m_floatValues[1]);
else
- description.Format("%2.2f", m_floatValues[0]);
+ description = StringUtils::Format("%2.2f", m_floatValues[0]);
}
else if (m_iType == SPIN_CONTROL_TYPE_INT)
{
if (m_rangeSelection)
- description.Format("[%i, %i]", m_intValues[0], m_intValues[1]);
+ description = StringUtils::Format("[%i, %i]", m_intValues[0], m_intValues[1]);
else
- description.Format("%i", m_intValues[0]);
+ description = StringUtils::Format("%i", m_intValues[0]);
}
else
{
if (m_rangeSelection)
- description.Format("[%i%%, %i%%]", MathUtils::round_int(m_percentValues[0]), MathUtils::round_int(m_percentValues[1]));
+ description = StringUtils::Format("[%i%%, %i%%]", MathUtils::round_int(m_percentValues[0]), MathUtils::round_int(m_percentValues[1]));
else
- description.Format("%i%%", MathUtils::round_int(m_percentValues[0]));
+ description = StringUtils::Format("%i%%", MathUtils::round_int(m_percentValues[0]));
}
return description;
}
#include "GUISpinControl.h"
#include "Key.h"
+#include "utils/StringUtils.h"
using namespace std;
{
if (m_bShowRange)
{
- text.Format("%i/%i", m_iValue, m_iEnd);
+ text = StringUtils::Format("%i/%i", m_iValue, m_iEnd);
}
else
{
- text.Format("%i", m_iValue);
+ text = StringUtils::Format("%i", m_iValue);
}
}
else if (m_iType == SPIN_CONTROL_TYPE_PAGE)
int currentPage = m_currentItem / m_itemsPerPage + 1;
if (m_currentItem >= m_numItems - m_itemsPerPage)
currentPage = numPages;
- text.Format("%i/%i", currentPage, numPages);
+ text = StringUtils::Format("%i/%i", currentPage, numPages);
}
else if (m_iType == SPIN_CONTROL_TYPE_FLOAT)
{
if (m_bShowRange)
{
- text.Format("%02.2f/%02.2f", m_fValue, m_fEnd);
+ text = StringUtils::Format("%02.2f/%02.2f", m_fValue, m_fEnd);
}
else
{
- text.Format("%02.2f", m_fValue);
+ text = StringUtils::Format("%02.2f", m_fValue);
}
}
else
{
if (m_bShowRange)
{
- text.Format("(%i/%i) %s", m_iValue + 1, (int)m_vecLabels.size(), CStdString(m_vecLabels[m_iValue]).c_str() );
+ text = StringUtils::Format("(%i/%i) %s", m_iValue + 1, (int)m_vecLabels.size(), CStdString(m_vecLabels[m_iValue]).c_str() );
}
else
{
- text.Format("%s", CStdString(m_vecLabels[m_iValue]).c_str() );
+ text = StringUtils::Format("%s", CStdString(m_vecLabels[m_iValue]).c_str() );
}
}
- else text.Format("?%i?", m_iValue);
+ else text = StringUtils::Format("?%i?", m_iValue);
}
CStdString CGUISpinControl::GetDescription() const
{
- CStdString strLabel;
- strLabel.Format("%i/%i", 1 + GetValue(), GetMaximum());
- return strLabel;
+ return StringUtils::Format("%i/%i", 1 + GetValue(), GetMaximum());
}
bool CGUISpinControl::IsFocusedOnUp() const
*/
#include "GUISpinControlEx.h"
+#include "utils/StringUtils.h"
CGUISpinControlEx::CGUISpinControlEx(int parentID, int controlID, float posX, float posY, float width, float height, float spinWidth, float spinHeight, const CLabelInfo& spinInfo, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus, const CTextureInfo& textureUp, const CTextureInfo& textureDown, const CTextureInfo& textureUpFocus, const CTextureInfo& textureDownFocus, const CLabelInfo& labelInfo, int iType)
: CGUISpinControl(parentID, controlID, posX, posY, spinWidth, spinHeight, textureUp, textureDown, textureUpFocus, textureDownFocus, spinInfo, iType)
CStdString CGUISpinControlEx::GetDescription() const
{
- CStdString strLabel;
- strLabel.Format("%s (%s)", m_buttonControl.GetDescription(), GetLabel());
- return strLabel;
+ return StringUtils::Format("%s (%s)", m_buttonControl.GetDescription().c_str(), GetLabel().c_str());
}
void CGUISpinControlEx::SetItemInvalid(bool invalid)
#include "GUIInfoManager.h"
#include "utils/XBMCTinyXML.h"
#include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
using namespace std;
switch (info)
{
case CONTAINER_NUM_PAGES:
- label.Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
+ label = StringUtils::Format("%u", (GetRows() + m_itemsPerPage - 1) / m_itemsPerPage);
break;
case CONTAINER_CURRENT_PAGE:
- label.Format("%u", GetCurrentPage());
+ label = StringUtils::Format("%u", GetCurrentPage());
break;
default:
break;
#include "utils/log.h"
#include "XBTF.h"
#include "JpegIO.h"
-
+#include "utils/StringUtils.h"
#include <setjmp.h>
#define EXIF_TAG_ORIENTATION 0x0112
// override libjpeg's error function to avoid an exit() call
void CJpegIO::jpeg_error_exit(j_common_ptr cinfo)
{
- CStdString msg;
- msg.Format("Error %i: %s",cinfo->err->msg_code, cinfo->err->jpeg_message_table[cinfo->err->msg_code]);
+ CStdString msg = StringUtils::Format("Error %i: %s",cinfo->err->msg_code, cinfo->err->jpeg_message_table[cinfo->err->msg_code]);
CLog::Log(LOGWARNING, "JpegIO: %s", msg.c_str());
my_error_mgr *myerr = (my_error_mgr*)cinfo->err;
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "addons/Skin.h"
#ifdef _DEBUG
#include "utils/TimeUtils.h"
if (!m_referenceCount)
return; // nothing to see here
- CStdString strLog;
- strLog.Format(" texture:%s has %i frames %i refcount\n", m_textureName.c_str(), m_texture.m_textures.size(), m_referenceCount);
+ CStdString strLog = StringUtils::Format(" texture:%s has %i frames %i refcount\n", m_textureName.c_str(), m_texture.m_textures.size(), m_referenceCount);
OutputDebugString(strLog.c_str());
}
void CGUITextureManager::Dump() const
{
- CStdString strLog;
- strLog.Format("total texturemaps size:%i\n", m_vecTextures.size());
+ CStdString strLog = StringUtils::Format("total texturemaps size:%i\n", m_vecTextures.size());
OutputDebugString(strLog.c_str());
for (int i = 0; i < (int)m_vecTextures.size(); ++i)
}
if (plugin->Provides(CPluginSource::VIDEO))
- cmd.Format("ActivateWindow(Video,plugin://%s%s,return)", addonid, urlParameters);
+ cmd = StringUtils::Format("ActivateWindow(Video,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::AUDIO))
- cmd.Format("ActivateWindow(Music,plugin://%s%s,return)", addonid, urlParameters);
+ cmd = StringUtils::Format("ActivateWindow(Music,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::EXECUTABLE))
- cmd.Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid, urlParameters);
+ cmd = StringUtils::Format("ActivateWindow(Programs,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else if (plugin->Provides(CPluginSource::IMAGE))
- cmd.Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid, urlParameters);
+ cmd = StringUtils::Format("ActivateWindow(Pictures,plugin://%s%s,return)", addonid.c_str(), urlParameters.c_str());
else
// Pass the script name (params[0]) and all the parameters
// (params[1] ... params[x]) separated by a comma to RunPlugin
- cmd.Format("RunPlugin(%s)", StringUtils::JoinString(params, ","));
+ cmd = StringUtils::Format("RunPlugin(%s)", StringUtils::JoinString(params, ",").c_str());
}
else if (addon->Type() >= ADDON_SCRIPT && addon->Type() <= ADDON_SCRIPT_LYRICS)
// Pass the script name (params[0]) and all the parameters
// (params[1] ... params[x]) separated by a comma to RunScript
- cmd.Format("RunScript(%s)", StringUtils::JoinString(params, ","));
+ cmd = StringUtils::Format("RunScript(%s)", StringUtils::JoinString(params, ",").c_str());
return Execute(cmd);
}
CStdString cmd;
if (params.size() == 0)
- cmd.Format("RunAddon(%s)", id.c_str());
+ cmd = StringUtils::Format("RunAddon(%s)", id.c_str());
else
- cmd.Format("RunAddon(%s, %s)", id.c_str(), argv.c_str());
+ cmd = StringUtils::Format("RunAddon(%s, %s)", id.c_str(), argv.c_str());
CApplicationMessenger::Get().ExecBuiltIn(cmd, parameterObject["wait"].asBoolean());
return ACK;
CFileItemList items;
for (unsigned int index = 0; index < albums.size(); index++)
{
- CStdString path;
- path.Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum);
+ CStdString path = StringUtils::Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum);
CFileItemPtr item;
FillAlbumItem(albums[index], path, item);
CFileItemList items;
for (unsigned int index = 0; index < albums.size(); index++)
{
- CStdString path;
- path.Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum);
+ CStdString path = StringUtils::Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum);
CFileItemPtr item;
FillAlbumItem(albums[index], path, item);
if (directory.empty())
cmd = "updatelibrary(music)";
else
- cmd.Format("updatelibrary(music, %s)", StringUtils::Paramify(directory).c_str());
+ cmd = StringUtils::Format("updatelibrary(music, %s)", StringUtils::Paramify(directory).c_str());
CApplicationMessenger::Get().ExecBuiltIn(cmd);
return ACK;
{
CStdString cmd;
if (parameterObject["options"].isMember("path"))
- cmd.Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
+ cmd = StringUtils::Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str());
else
- cmd.Format("exportlibrary(music, true, %s, %s)",
- parameterObject["options"]["images"].asBoolean() ? "true" : "false",
- parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false");
+ cmd = StringUtils::Format("exportlibrary(music, true, %s, %s)",
+ parameterObject["options"]["images"].asBoolean() ? "true" : "false",
+ parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false");
CApplicationMessenger::Get().ExecBuiltIn(cmd);
return ACK;
#include "utils/log.h"
#include "utils/StdString.h"
#include "utils/JSONVariantParser.h"
+#include "utils/StringUtils.h"
#include "JSONRPC.h"
#include "PlayerOperations.h"
#include "PlaylistOperations.h"
// Let's check the type of the provided parameter
if (!IsType(value, type))
{
- errorMessage.Format("Invalid type %s received", ValueTypeToString(value.type()));
+ errorMessage = StringUtils::Format("Invalid type %s received", ValueTypeToString(value.type()));
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (status != OK)
{
CLog::Log(LOGDEBUG, "JSONRPC: Value does not match extended type %s of type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
- errorMessage.Format("value does not match extended type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
+ errorMessage = StringUtils::Format("value does not match extended type %s", extends.at(extendsIndex)->ID.c_str(), name.c_str());
errorData["message"] = errorMessage.c_str();
return status;
}
{
CLog::Log(LOGDEBUG, "JSONRPC: Number of array elements does not match minItems and/or maxItems in type %s", name.c_str());
if (minItems > 0 && maxItems > 0)
- errorMessage.Format("Between %d and %d array items expected but %d received", minItems, maxItems, value.size());
+ errorMessage = StringUtils::Format("Between %d and %d array items expected but %d received", minItems, maxItems, value.size());
else if (minItems > 0)
- errorMessage.Format("At least %d array items expected but only %d received", minItems, value.size());
+ errorMessage = StringUtils::Format("At least %d array items expected but only %d received", minItems, value.size());
else
- errorMessage.Format("Only %d array items expected but %d received", maxItems, value.size());
+ errorMessage = StringUtils::Format("Only %d array items expected but %d received", maxItems, value.size());
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (status != OK)
{
CLog::Log(LOGDEBUG, "JSONRPC: Array element at index %u does not match in type %s", arrayIndex, name.c_str());
- errorMessage.Format("array element at index %u does not match", arrayIndex);
+ errorMessage = StringUtils::Format("array element at index %u does not match", arrayIndex);
errorData["message"] = errorMessage.c_str();
return status;
}
if (value.size() < items.size() || (value.size() != items.size() && additionalItems.size() == 0))
{
CLog::Log(LOGDEBUG, "JSONRPC: One of the array elements does not match in type %s", name.c_str());
- errorMessage.Format("%d array elements expected but %d received", items.size(), value.size());
+ errorMessage = StringUtils::Format("%d array elements expected but %d received", items.size(), value.size());
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (!ok)
{
CLog::Log(LOGDEBUG, "JSONRPC: Array contains non-conforming additional items in type %s", name.c_str());
- errorMessage.Format("Array element at index %u does not match the \"additionalItems\" schema", arrayIndex);
+ errorMessage = StringUtils::Format("Array element at index %u does not match the \"additionalItems\" schema", arrayIndex);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (outputValue[checkingIndex] == outputValue[checkedIndex])
{
CLog::Log(LOGDEBUG, "JSONRPC: Not unique array element at index %u and %u in type %s", checkingIndex, checkedIndex, name.c_str());
- errorMessage.Format("Array element at index %u is not unique (same as array element at index %u)", checkingIndex, checkedIndex);
+ errorMessage = StringUtils::Format("Array element at index %u is not unique (same as array element at index %u)", checkingIndex, checkedIndex);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
{
CLog::Log(LOGDEBUG, "JSONRPC: Value does not lay between minimum and maximum in type %s", name.c_str());
if (value.isDouble())
- errorMessage.Format("Value between %f (%s) and %f (%s) expected but %f received",
+ errorMessage = StringUtils::Format("Value between %f (%s) and %f (%s) expected but %f received",
minimum, exclusiveMinimum ? "exclusive" : "inclusive", maximum, exclusiveMaximum ? "exclusive" : "inclusive", numberValue);
else
- errorMessage.Format("Value between %d (%s) and %d (%s) expected but %d received",
+ errorMessage = StringUtils::Format("Value between %d (%s) and %d (%s) expected but %d received",
(int)minimum, exclusiveMinimum ? "exclusive" : "inclusive", (int)maximum, exclusiveMaximum ? "exclusive" : "inclusive", (int)numberValue);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
if ((HasType(type, IntegerValue) && divisibleBy > 0 && ((int)numberValue % divisibleBy) != 0))
{
CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet divisibleBy requirements in type %s", name.c_str());
- errorMessage.Format("Value should be divisible by %d but %d received", divisibleBy, (int)numberValue);
+ errorMessage = StringUtils::Format("Value should be divisible by %d but %d received", divisibleBy, (int)numberValue);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (size < minLength)
{
CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet minLength requirements in type %s", name.c_str());
- errorMessage.Format("Value should have a minimum length of %d but has a length of %d", minLength, size);
+ errorMessage = StringUtils::Format("Value should have a minimum length of %d but has a length of %d", minLength, size);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (maxLength >= 0 && size > maxLength)
{
CLog::Log(LOGDEBUG, "JSONRPC: Value does not meet maxLength requirements in type %s", name.c_str());
- errorMessage.Format("Value should have a maximum length of %d but has a length of %d", maxLength, size);
+ errorMessage = StringUtils::Format("Value should have a maximum length of %d but has a length of %d", maxLength, size);
errorData["message"] = errorMessage.c_str();
return InvalidParams;
}
if (description.at(0) != '{')
{
- CStdString json;
- json.Format("{%s}", description);
- description = json;
+ description = StringUtils::Format("{%s}", description.c_str());
}
descriptionObject = CJSONVariantParser::Parse((const unsigned char *)description.c_str(), description.size());
int tvshowID = (int)parameterObject["tvshowid"].asInteger();
- CStdString strPath;
- strPath.Format("videodb://tvshows/titles/%i/", tvshowID);
+ CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/", tvshowID);
CFileItemList items;
if (!videodatabase.GetSeasonsNav(strPath, items, -1, -1, -1, -1, tvshowID, false))
return InternalError;
int tvshowID = (int)parameterObject["tvshowid"].asInteger();
int season = (int)parameterObject["season"].asInteger();
- CStdString strPath;
- strPath.Format("videodb://tvshows/titles/%i/%i/", tvshowID, season);
+ CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/%i/", tvshowID, season);
CVideoDbUrl videoUrl;
videoUrl.FromString(strPath);
if (tvshowid <= 0)
tvshowid = videodatabase.GetTvShowForEpisode(id);
- CStdString basePath; basePath.Format("videodb://tvshows/titles/%ld/%ld/%ld", tvshowid, infos.m_iSeason, id);
+ CStdString basePath = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld", tvshowid, infos.m_iSeason, id);
pItem->SetPath(basePath);
HandleFileItem("episodeid", true, "episodedetails", pItem, parameterObject, parameterObject["properties"], result, false);
if (directory.empty())
cmd = "updatelibrary(video)";
else
- cmd.Format("updatelibrary(video, %s)", StringUtils::Paramify(directory).c_str());
+ cmd = StringUtils::Format("updatelibrary(video, %s)", StringUtils::Paramify(directory).c_str());
CApplicationMessenger::Get().ExecBuiltIn(cmd);
return ACK;
{
CStdString cmd;
if (parameterObject["options"].isMember("path"))
- cmd.Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
+ cmd = StringUtils::Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str());
else
- cmd.Format("exportlibrary(video, true, %s, %s, %s)",
- parameterObject["options"]["images"].asBoolean() ? "true" : "false",
- parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false",
- parameterObject["options"]["actorthumbs"].asBoolean() ? "true" : "false");
+ cmd = StringUtils::Format("exportlibrary(video, true, %s, %s, %s)",
+ parameterObject["options"]["images"].asBoolean() ? "true" : "false",
+ parameterObject["options"]["overwrite"].asBoolean() ? "true" : "false",
+ parameterObject["options"]["actorthumbs"].asBoolean() ? "true" : "false");
CApplicationMessenger::Get().ExecBuiltIn(cmd);
return ACK;
#include "addons/GUIDialogAddonSettings.h"
#include "guilib/GUIWindowManager.h"
#include "GUIUserMessages.h"
+#include "utils/StringUtils.h"
using namespace ADDON;
return pAddon->Profile();
else if (strcmpi(id, "stars") == 0)
{
- CStdString tmps;
- tmps.Format("%d", pAddon->Stars());
- return tmps;
+ return StringUtils::Format("%d", pAddon->Stars());
}
else if (strcmpi(id, "summary") == 0)
return pAddon->Summary();
#include "dialogs/GUIDialogKaiToast.h"
#include "ModuleXbmcgui.h"
#include "guilib/GUIKeyboardFactory.h"
+#include "utils/StringUtils.h"
#define ACTIVE_WINDOW g_windowManager.GetActiveWindow()
timedate.wYear = atoi(sDefault.Right(4));
}
if (CGUIDialogNumeric::ShowAndGetDate(timedate, heading))
- value.Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
+ value = StringUtils::Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
else
return emptyString;
}
timedate.wMinute = atoi(sDefault.Right(2));
}
if (CGUIDialogNumeric::ShowAndGetTime(timedate, heading))
- value.Format("%2d:%02d", timedate.wHour, timedate.wMinute);
+ value = StringUtils::Format("%2d:%02d", timedate.wHour, timedate.wMinute);
else
return emptyString;
}
timedate.wYear = atoi(sDefault.Right(4));
}
if (CGUIDialogNumeric::ShowAndGetDate(timedate, heading))
- value.Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
+ value = StringUtils::Format("%2d/%2d/%4d", timedate.wDay, timedate.wMonth, timedate.wYear);
else
value = emptyString;
}
timedate.wMinute = atoi(sDefault.Right(2));
}
if (CGUIDialogNumeric::ShowAndGetTime(timedate, heading))
- value.Format("%2d:%02d", timedate.wHour, timedate.wMinute);
+ value = StringUtils::Format("%2d:%02d", timedate.wHour, timedate.wMinute);
else
value = emptyString;
}
if (lowerKey.CompareNoCase("startoffset") == 0)
{ // special case for start offset - don't actually store in a property,
// we store it in item.m_lStartOffset instead
- value.Format("%f", item->m_lStartOffset / 75.0);
+ value = StringUtils::Format("%f", item->m_lStartOffset / 75.0);
}
else if (lowerKey.CompareNoCase("totaltime") == 0)
- value.Format("%f", item->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
+ value = StringUtils::Format("%f", item->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds);
else if (lowerKey.CompareNoCase("resumetime") == 0)
- value.Format("%f", item->GetVideoInfoTag()->m_resumePoint.timeInSeconds);
+ value = StringUtils::Format("%f", item->GetVideoInfoTag()->m_resumePoint.timeInSeconds);
else if (lowerKey.CompareNoCase("fanart_image") == 0)
value = item->GetArt("fanart");
else
LOCKGUI;
CStdString property;
- property.Format("contextmenulabel(%i)", itemCount);
+ property = StringUtils::Format("contextmenulabel(%i)", itemCount);
item->SetProperty(property, uText);
- property.Format("contextmenuaction(%i)", itemCount);
+ property = StringUtils::Format("contextmenuaction(%i)", itemCount);
item->SetProperty(property, uAction);
}
#include "storage/MediaManager.h"
#include "utils/FileUtils.h"
#include "utils/LangCodeExpander.h"
-
+#include "utils/StringUtils.h"
#include "CallbackHandler.h"
#include "AddonUtils.h"
XBMC_TRACE;
Crc32 crc;
crc.ComputeFromLowerCase(path);
- CStdString strPath;
- strPath.Format("%08x.tbn", (unsigned __int32)crc);
- return strPath;
+ return StringUtils::Format("%08x.tbn", (unsigned __int32)crc);;
}
String makeLegalFilename(const String& filename, bool fatX)
result.Replace("xx", "%p");
}
else if (strcmpi(id, "meridiem") == 0)
- result.Format("%s/%s", g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_AM), g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_PM));
+ result = StringUtils::Format("%s/%s",
+ g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_AM).c_str(),
+ g_langInfo.GetMeridiemSymbol(CLangInfo::MERIDIEM_SYMBOL_PM).c_str());
return result;
}
#include "addons/Skin.h"
#include "filesystem/File.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "addons/Addon.h"
// These #defs are for WindowXML
}
}
- desc.Format(g_localizeStrings.Get(2100), script);
+ desc = StringUtils::Format(g_localizeStrings.Get(2100), script.c_str());
pDlgToast->QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(257), desc);
}
}
#include "LanguageHook.h"
#include "swig.h"
+#include "utils/StringUtils.h"
#include <string>
emptyString = PyString_FromString("");
strRetval = PyObject_CallMethod(emptyString, (char*)"join", (char*)"O", tbList);
- msg.Format("%s%s", msg.c_str(),PyString_AsString(strRetval));
+ msg = StringUtils::Format("%s%s", msg.c_str(),PyString_AsString(strRetval));
Py_DECREF(tbList);
Py_DECREF(emptyString);
if (dev->Label.size() > 0)
{
MountPoint = dev->Label.c_str();
- TestPath.Format("/media/%s", MountPoint.c_str());
+ TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
struct stat St;
if (stat("/media", &St) != 0)
return; //If /media doesn't exist something is wrong.
{
CLog::Log(LOGDEBUG, "HAL: Proposed Mountpoint already existed");
MountPoint.append("_");
- TestPath.Format("/media/%s", MountPoint.c_str());
+ TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
}
}
else
{
MountPoint = StorageTypeToString(dev->Type);
- TestPath.Format("/media/%s", MountPoint.c_str());
+ TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
int Nbr = 0;
struct stat St;
if (stat("/media", &St) != 0)
{
CLog::Log(LOGDEBUG, "HAL: Proposed Mountpoint already existed");
Nbr++;
- MountPoint.Format("%s%i", StorageTypeToString(dev->Type), Nbr);
- TestPath.Format("/media/%s", MountPoint.c_str());
+ MountPoint = StringUtils::Format("%s%i", StorageTypeToString(dev->Type), Nbr);
+ TestPath = StringUtils::Format("/media/%s", MountPoint.c_str());
}
}
if (Mount(dev, MountPoint))
if (volume->FileSystem.Equals("vfat"))
{
int mask = umask (0);
- temporaryString.Format("umask=%#o", mask);
+ temporaryString = StringUtils::Format("umask=%#o", mask);
s = temporaryString.c_str();
dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &s);
- temporaryString.Format("uid=%u", getuid());
+ temporaryString = StringUtils::Format("uid=%u", getuid());
s = temporaryString.c_str();
dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &s);
s = "shortname=mixed";
#define BYTE char
#include "utils/log.h"
#include "threads/CriticalSection.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "MediaSource.h"
{ // Not the prettiest but it's better than having to reproduce it elsewere in the code...
CStdString rtn, tmp1, tmp2, tmp3, tmp4;
if (UUID.size() > 0)
- tmp1.Format("UUID %s | ", UUID.c_str());
+ tmp1 = StringUtils::Format("UUID %s | ", UUID.c_str());
if (FileSystem.size() > 0)
- tmp2.Format("FileSystem %s | ", FileSystem.c_str());
+ tmp2 = StringUtils::Format("FileSystem %s | ", FileSystem.c_str());
if (MountPoint.size() > 0)
- tmp3.Format("Mounted on %s | ", MountPoint.c_str());
+ tmp3 = StringUtils::Format("Mounted on %s | ", MountPoint.c_str());
if (HotPlugged)
- tmp4.Format("HotPlugged YES | ");
+ tmp4 = StringUtils::Format("HotPlugged YES | ");
else
- tmp4.Format("HotPlugged NO | ");
+ tmp4 = StringUtils::Format("HotPlugged NO | ");
if (Approved)
- rtn.Format("%s%s%s%sType %i |Approved YES ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
+ rtn = StringUtils::Format("%s%s%s%sType %i |Approved YES ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
else
- rtn.Format("%s%s%s%sType %i |Approved NO ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
+ rtn = StringUtils::Format("%s%s%s%sType %i |Approved NO ", tmp1.c_str(), tmp2.c_str(), tmp3.c_str(), tmp4.c_str(), Type);
return rtn;
}
{
CStdString strFileName = m_pDS->fv(song_strFileName).get_asString();
CStdString strExt = URIUtils::GetExtension(strFileName);
- song.strFileName.Format("musicdb://albums/%ld/%ld%s", m_pDS->fv(song_idAlbum).get_asInt(), m_pDS->fv(song_idSong).get_asInt(), strExt.c_str());
+ song.strFileName = StringUtils::Format("musicdb://albums/%ld/%ld%s",
+ m_pDS->fv(song_idAlbum).get_asInt(),
+ m_pDS->fv(song_idSong).get_asInt(),
+ strExt.c_str());
}
return song;
CMusicDbUrl itemUrl = baseUrl;
CStdString strFileName = record->at(song_strFileName).get_asString();
CStdString strExt = URIUtils::GetExtension(strFileName);
- CStdString path; path.Format("%ld%s", record->at(song_idSong).get_asInt(), strExt.c_str());
+ CStdString path = StringUtils::Format("%ld%s", record->at(song_idSong).get_asInt(), strExt.c_str());
itemUrl.AppendPath(path);
item->SetPath(itemUrl.ToString());
}
CStdString artistLabel(g_localizeStrings.Get(557)); // Artist
while (!m_pDS->eof())
{
- CStdString path;
- path.Format("musicdb://artists/%ld/", m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("musicdb://artists/%ld/", m_pDS->fv(0).get_asInt());
CFileItemPtr pItem(new CFileItem(path, true));
- CStdString label;
- label.Format("[%s] %s", artistLabel.c_str(), m_pDS->fv(1).get_asString());
+ CStdString label = StringUtils::Format("[%s] %s", artistLabel.c_str(), m_pDS->fv(1).get_asString().c_str());
pItem->SetLabel(label);
- label.Format("A %s", m_pDS->fv(1).get_asString()); // sort label is stored in the title tag
+ label = StringUtils::Format("A %s", m_pDS->fv(1).get_asString().c_str()); // sort label is stored in the title tag
pItem->GetMusicInfoTag()->SetTitle(label);
pItem->GetMusicInfoTag()->SetDatabaseId(m_pDS->fv(0).get_asInt(), "artist");
artists.Add(pItem);
if (!strBaseDir.empty() && baseUrl.FromString(strBaseDir))
return false;
- CStdString strSQL;
- strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100) order by albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100)");
+ CStdString strSQL = StringUtils::Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100) order by albumview.idAlbum in (select song.idAlbum from song where song.iTimesPlayed>0 group by idAlbum order by sum(song.iTimesPlayed) desc limit 100)");
CLog::Log(LOGDEBUG,"GetTop100AlbumSongs() query: %s", strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL;
- strSQL.Format("select distinct albumview.* from song join albumview on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i", RECENTLY_PLAYED_LIMIT);
+ CStdString strSQL = StringUtils::Format("select distinct albumview.* from song join albumview on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i", RECENTLY_PLAYED_LIMIT);
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
int iRowsFound = m_pDS->num_rows();
if (!strBaseDir.empty() && !baseUrl.FromString(strBaseDir))
return false;
- CStdString strSQL;
- strSQL.Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select distinct albumview.idAlbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
+ CStdString strSQL = StringUtils::Format("select * from songview join albumview on (songview.idAlbum = albumview.idAlbum) where albumview.idAlbum in (select distinct albumview.idAlbum from albumview join song on albumview.idAlbum=song.idAlbum where song.lastplayed IS NOT NULL order by song.lastplayed desc limit %i)", g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
CLog::Log(LOGDEBUG,"GetRecentlyPlayedAlbumSongs() query: %s", strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL;
- strSQL.Format("select * from albumview where strAlbum != '' order by idAlbum desc limit %u", limit ? limit : g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
+ CStdString strSQL = StringUtils::Format("select * from albumview where strAlbum != '' order by idAlbum desc limit %u", limit ? limit : g_advancedSettings.m_iMusicLibraryRecentlyAddedItems);
CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
while (!m_pDS->eof())
{
CAlbum album = GetAlbumFromDataset(m_pDS.get());
- CStdString path;
- path.Format("musicdb://albums/%ld/", album.idAlbum);
+ CStdString path = StringUtils::Format("musicdb://albums/%ld/", album.idAlbum);
CFileItemPtr pItem(new CFileItem(path, album));
- CStdString label;
- label.Format("[%s] %s", albumLabel.c_str(), album.strAlbum);
+ CStdString label = StringUtils::Format("[%s] %s", albumLabel.c_str(), album.strAlbum.c_str());
pItem->SetLabel(label);
- label.Format("B %s", album.strAlbum); // sort label is stored in the title tag
+ label = StringUtils::Format("B %s", album.strAlbum.c_str()); // sort label is stored in the title tag
pItem->GetMusicInfoTag()->SetTitle(label);
albums.Add(pItem);
m_pDS->next();
// Delete old info if any
if (bRequery)
{
- CStdString strFile;
- strFile.Format("%x.cddb", pCdInfo->GetCddbDiscId());
+ CStdString strFile = StringUtils::Format("%x.cddb", pCdInfo->GetCddbDiscId());
CFile::Delete(URIUtils::AddFileToFolder(CProfilesManager::Get().GetCDDBFolder(), strFile));
}
{
pCdInfo->SetNoCDDBInfo();
// ..no, an error occured, display it to the user
- CStdString strErrorText;
- strErrorText.Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
+ CStdString strErrorText = StringUtils::Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText());
CGUIDialogOK::ShowAndGetInput(255, 257, strErrorText, 0);
}
} // if ( !cddb.queryCDinfo( pCdInfo ) )
{
if (it->second == strSelectedAlbum)
{
- CStdString strFile;
- strFile.Format("%x.cddb", it->first);
+ CStdString strFile = StringUtils::Format("%x.cddb", it->first);
CFile::Delete(URIUtils::AddFileToFolder(CProfilesManager::Get().GetCDDBFolder(), strFile));
break;
}
pItem->GetMusicInfoTag()->SetDatabaseId(m_pDS->fv("genre.idGenre").get_asInt(), "genre");
CMusicDbUrl itemUrl = musicUrl;
- CStdString strDir; strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
pItem->GetMusicInfoTag()->SetReleaseDate(stTime);
CMusicDbUrl itemUrl = musicUrl;
- CStdString strDir; strDir.Format("%ld/", m_pDS->fv("iYear").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("iYear").get_asInt());
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
CFileItemPtr pItem(new CFileItem(labelValue));
CMusicDbUrl itemUrl = musicUrl;
- CStdString strDir; strDir.Format("%s/", labelValue.c_str());
+ CStdString strDir = StringUtils::Format("%s/", labelValue.c_str());
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
CFileItemPtr pItem(new CFileItem(artist));
CMusicDbUrl itemUrl = musicUrl;
- CStdString path; path.Format("%ld/", artist.idArtist);
+ CStdString path = StringUtils::Format("%ld/", artist.idArtist);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
try
{
CMusicDbUrl itemUrl = musicUrl;
- CStdString path; path.Format("%ld/", record->at(album_idAlbum).get_asInt());
+ CStdString path = StringUtils::Format("%ld/", record->at(album_idAlbum).get_asInt());
itemUrl.AppendPath(path);
CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), GetAlbumFromDataset(record)));
if (itemType.Equals("genres"))
return GetGenreById(id);
else if (itemType.Equals("years"))
- {
- CStdString tmp; tmp.Format("%d", id);
- return tmp;
- }
+ return StringUtils::Format("%d", id);
else if (itemType.Equals("artists"))
return GetArtistById(id);
else if (itemType.Equals("albums"))
while (!m_pDS->eof())
{
CSong song = GetSongFromDataset( false );
- CStdString songnum;
- songnum.Format( "%06d", song.iKaraokeNumber );
+ CStdString songnum = StringUtils::Format("%06d", song.iKaraokeNumber);
if ( asHTML )
outdoc = "<tr><td>" + songnum + "</td><td>" + StringUtils::Join(song.artist, g_advancedSettings.m_musicItemSeparator) + "</td><td>" + song.strTitle + "</td></tr>\r\n";
for (unsigned int i = 0; i < thumbs.size(); ++i)
{
CStdString strItemPath;
- strItemPath.Format("thumb://Remote%i", i);
+ strItemPath = StringUtils::Format("thumb://Remote%i", i);
CFileItemPtr item(new CFileItem(strItemPath, false));
item->SetArt("thumb", thumbs[i]);
item->SetIconImage("DefaultPicture.png");
// Grab the thumbnails from the web
for (unsigned int i = 0; i < m_artist.fanart.GetNumFanarts(); i++)
{
- CStdString strItemPath;
- strItemPath.Format("fanart://Remote%i",i);
+ CStdString strItemPath = StringUtils::Format("fanart://Remote%i",i);
CFileItemPtr item(new CFileItem(strItemPath, false));
CStdString thumb = m_artist.fanart.GetPreviewURL(i);
item->SetArt("thumb", CTextureUtils::GetWrappedThumbURL(thumb));
if (window)
{
CFileItem item(*m_song);
- CStdString path;
- path.Format("musicdb://albums/%li",m_albumId);
+ CStdString path = StringUtils::Format("musicdb://albums/%li",m_albumId);
item.SetPath(path);
item.m_bIsFolder = true;
window->OnInfo(&item, true);
#include "FileItem.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
#define CONTROL_LIST 2
#define CONTROL_PRESETS_LABEL 3
CStdString strHeading;
if (m_viz)
{
- strHeading.Format(g_localizeStrings.Get(13407).c_str(), m_viz->Name().c_str());
+ strHeading = StringUtils::Format(g_localizeStrings.Get(13407).c_str(), m_viz->Name().c_str());
//clear filelist
CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST);
void CMusicAlbumInfo::SetAlbum(CAlbum& album)
{
m_album = album;
- m_album.m_strDateOfRelease.Format("%i", album.iYear);
+ m_album.m_strDateOfRelease = StringUtils::Format("%i", album.iYear);
m_strTitle2 = "";
m_bLoaded = true;
}
if (pDialog)
{
// set the label to [relevance] album - artist
- CStdString strTemp;
- strTemp.Format("[%0.2f] %s", relevance, info.GetTitle2());
+ CStdString strTemp = StringUtils::Format("[%0.2f] %s", relevance, info.GetTitle2().c_str());
CFileItem item(strTemp);
item.m_idepth = i; // use this to hold the index of the album in the scraper
pDlg->Add(&item);
{
CStdString genres = StringUtils::Join(scraper.GetArtist(i).GetArtist().genre, g_advancedSettings.m_musicItemSeparator);
if (!genres.empty())
- strTemp.Format("[%s] %s", genres.c_str(), strTemp.c_str());
+ strTemp = StringUtils::Format("[%s] %s", genres.c_str(), strTemp.c_str());
}
item.SetLabel(strTemp);
item.m_idepth = i; // use this to hold the index of the album in the scraper
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#define CONTROL_LABEL_SONGNUMBER 401
#define CONTROL_LABEL_SONGNAME 402
if ( m_updateData )
{
// Update on-screen labels
- CStdString message;
- message.Format( "%06d", m_selectedNumber );
+ CStdString message = StringUtils::Format("%06d", m_selectedNumber);
message = g_localizeStrings.Get(179) + ": " + message; // Translated "Song"
SET_CONTROL_LABEL(CONTROL_LABEL_SONGNUMBER, message);
#include "addons/Skin.h"
#include "utils/MathUtils.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
typedef struct
{
m_colorLyrics = gLyricColors[coloridx].text;
m_colorLyricsOutline = gLyricColors[coloridx].outline;
- m_colorSinging.Format( "%08X", gLyricColors[coloridx].active );
+ m_colorSinging = StringUtils::Format("%08X", gLyricColors[coloridx].active);
m_delayAfter = 50; // 5 seconds
m_showLyricsBeforeStart = 50; // 7.5 seconds
for ( unsigned int i = 0; i < m_lyrics.size(); i++ )
{
- CStdString timing;
- timing.Format( "%02d:%02d.%d", m_lyrics[i].timing / 600, (m_lyrics[i].timing % 600) / 10, (m_lyrics[i].timing % 10) );
+ CStdString timing = StringUtils::Format("%02d:%02d.%d",
+ m_lyrics[i].timing / 600,
+ (m_lyrics[i].timing % 600) / 10,
+ (m_lyrics[i].timing % 10));
if ( (m_lyrics[i].flags & LYRICS_NEW_PARAGRAPH) != 0 )
out += "\n\n";
CStdString CMusicInfoTag::GetYearString() const
{
- CStdString strReturn;
- strReturn.Format("%i", m_dwReleaseDate.wYear);
- return m_dwReleaseDate.wYear ? strReturn : "";
+ return m_dwReleaseDate.wYear ? StringUtils::Format("%i", m_dwReleaseDate.wYear) : StringUtils::Empty;
}
const CStdString &CMusicInfoTag::GetComment() const
StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/"))
iItems--;
}
- CStdString items;
- items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
// set the filter label
long idArtist = m_musicdatabase.GetArtistByName(item->GetLabel());
if (idArtist == -1)
return false;
- CStdString path; path.Format("musicdb://artists/%ld/", idArtist);
+ CStdString path = StringUtils::Format("musicdb://artists/%ld/", idArtist);
CArtist artist;
m_musicdatabase.GetArtistInfo(idArtist,artist,false);
*item = CFileItem(artist);
long idAlbum = m_musicdatabase.GetAlbumByName(item->GetLabel());
if (idAlbum == -1)
return false;
- CStdString path; path.Format("musicdb://albums/%ld/", idAlbum);
+ CStdString path = StringUtils::Format("musicdb://albums/%ld/", idAlbum);
CAlbum album;
m_musicdatabase.GetAlbumInfo(idAlbum,album,NULL);
*item = CFileItem(path,album);
CStdString strPath;
CVideoDatabase database;
database.Open();
- strPath.Format("videodb://musicvideos/artists/%ld/",database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)));
+ strPath = StringUtils::Format("videodb://musicvideos/artists/%ld/",
+ database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)));
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
CONTENT_TYPE content = CONTENT_ALBUMS;
if (params.GetAlbumId() != -1)
- path.Format("musicdb://albums/%i/",params.GetAlbumId());
+ path = StringUtils::Format("musicdb://albums/%i/",params.GetAlbumId());
else if (params.GetArtistId() != -1)
{
- path.Format("musicdb://artists/%i/",params.GetArtistId());
+ path = StringUtils::Format("musicdb://artists/%i/",params.GetArtistId());
content = CONTENT_ARTISTS;
}
SET_CONTROL_LABEL(CONTROL_BTNREPEAT, g_localizeStrings.Get(iRepeat));
// Update object count label
- CStdString items;
- items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
MarkPlaying();
// No music info and it's not CDDA so we'll just show the filename
CStdString str;
str = CUtil::GetTitleFromPath(pItem->GetPath());
- str.Format("%02.2i. %s ", pItem->m_iprogramCount, str);
+ str = StringUtils::Format("%02.2i. %s ", pItem->m_iprogramCount, str.c_str());
pItem->SetLabel(str);
}
}
#include "GUIWindowMusicPlaylistEditor.h"
#include "Util.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "Autorun.h"
#include "dialogs/GUIDialogFileBrowser.h"
#include "filesystem/PlaylistFileDirectory.h"
CGUIWindowMusicBase::UpdateButtons();
// Update object count label
- CStdString items;
- items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); // " 14 Objects"
+ CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); // " 14 Objects"
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
}
OnMessage(msg);
// indicate how many songs we have
- CStdString items;
- items.Format("%i %s", m_playlist->Size(), g_localizeStrings.Get(134).c_str()); // "123 Songs"
+ CStdString items = StringUtils::Format("%i %s", m_playlist->Size(), g_localizeStrings.Get(134).c_str()); // "123 Songs"
SET_CONTROL_LABEL(CONTROL_LABEL_PLAYLIST, items);
m_playlistThumbLoader.Load(*m_playlist);
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "Autorun.h"
#include "cdrip/CDDARipper.h"
#include "cores/IPlayer.h"
}
// Update object count label
- CStdString items;
- items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
}
if (reverseHeader.size() > 0 && m_reverseSockets.find(it->m_sessionId) != m_reverseSockets.end())
{
//search the reverse socket to this sessionid
- response.Format("POST /event HTTP/1.1\r\n");
+ response = StringUtils::Format("POST /event HTTP/1.1\r\n");
reverseSocket = m_reverseSockets[it->m_sessionId]; //that is our reverse socket
response += reverseHeader;
}
const time_t ltime = time(NULL);
char *date = asctime(gmtime(<ime)); //Fri, 17 Dec 2010 11:18:01 GMT;
date[strlen(date) - 1] = '\0'; // remove \n
- response.Format("HTTP/1.1 %d %s\nDate: %s\r\n", status, statusMsg.c_str(), date);
+ response = StringUtils::Format("HTTP/1.1 %d %s\nDate: %s\r\n", status, statusMsg.c_str(), date);
if (responseHeader.size() > 0)
{
response += responseHeader;
if (responseBody.size() > 0)
{
- response.Format("%sContent-Length: %d\r\n", response.c_str(), responseBody.size());
+ response = StringUtils::Format("%sContent-Length: %d\r\n", response.c_str(), responseBody.size());
}
response += "\r\n";
case EVENT_LOADING:
case EVENT_PAUSED:
case EVENT_STOPPED:
- reverseBody.Format(EVENT_INFO, m_sessionCounter, eventStrings[state]);
+ reverseBody = StringUtils::Format(EVENT_INFO, m_sessionCounter, eventStrings[state]);
CLog::Log(LOGDEBUG, "AIRPLAY: sending event: %s", eventStrings[state]);
break;
}
reverseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
- reverseHeader.Format("%sContent-Length: %d\r\n",reverseHeader.c_str(),reverseBody.size());
- reverseHeader.Format("%sx-apple-session-id: %s\r\n",reverseHeader.c_str(),m_sessionId.c_str());
+ reverseHeader = StringUtils::Format("%sContent-Length: %d\r\n",reverseHeader.c_str(), reverseBody.size());
+ reverseHeader = StringUtils::Format("%sx-apple-session-id: %s\r\n",reverseHeader.c_str(), m_sessionId.c_str());
m_lastEvent = state;
}
}
void CAirPlayServer::CTCPClient::ComposeAuthRequestAnswer(CStdString& responseHeader, CStdString& responseBody)
{
- CStdString randomStr;
int16_t random=rand();
- randomStr.Format("%i", random);
+ CStdString randomStr = StringUtils::Format("%i", random);
m_authNonce=XBMC::XBMC_MD5::GetMD5(randomStr);
- responseHeader.Format(AUTH_REQUIRED,m_authNonce);
+ responseHeader = StringUtils::Format(AUTH_REQUIRED, m_authNonce.c_str());
responseBody.clear();
}
if (g_application.m_pPlayer->GetTotalTime())
{
float position = ((float) g_application.m_pPlayer->GetTime()) / 1000;
- responseBody.Format("duration: %.6f\r\nposition: %.6f\r\n", (float)g_application.m_pPlayer->GetTotalTime() / 1000, position);
+ responseBody = StringUtils::Format("duration: %.6f\r\nposition: %.6f\r\n", (float)g_application.m_pPlayer->GetTotalTime() / 1000, position);
}
else
{
cachePosition = position + (duration * g_application.m_pPlayer->GetCachePercentage() / 100.0f);
}
- responseBody.Format(PLAYBACK_INFO, duration, cachePosition, position, (playing ? 1 : 0), duration);
+ responseBody = StringUtils::Format(PLAYBACK_INFO, duration, cachePosition, position, (playing ? 1 : 0), duration);
responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
if (g_application.m_pPlayer->IsCaching())
}
else
{
- responseBody.Format(PLAYBACK_INFO_NOT_READY, duration, cachePosition, position, (playing ? 1 : 0), duration);
+ responseBody = StringUtils::Format(PLAYBACK_INFO_NOT_READY, duration, cachePosition, position, (playing ? 1 : 0), duration);
responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
}
}
else if (uri == "/server-info")
{
CLog::Log(LOGDEBUG, "AIRPLAY: got request %s", uri.c_str());
- responseBody.Format(SERVER_INFO, g_application.getNetwork().GetFirstConnectedInterface()->GetMacAddress());
+ responseBody = StringUtils::Format(SERVER_INFO, g_application.getNetwork().GetFirstConnectedInterface()->GetMacAddress().c_str());
responseHeader = "Content-Type: text/x-apple-plist+xml\r\n";
}
#include "GUIInfoManager.h"
#include "guilib/GUIWindowManager.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "utils/EndianSwap.h"
if (success)
{
- CStdString appName;
- appName.Format("%s@%s", m_macAddress.c_str(), g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME).c_str());
+ CStdString appName = StringUtils::Format("%s@%s",
+ m_macAddress.c_str(),
+ g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME).c_str());
std::vector<std::pair<std::string, std::string> > txt;
txt.push_back(std::make_pair("txtvers", "1"));
CStdString pwStr;
CStdString portStr;
- hwStr.Format("--mac=%s", m_macAddress.c_str());
- pwStr.Format("--password=%s",password.c_str());
- portStr.Format("--server_port=%d",m_port);
+ hwStr = StringUtils::Format("--mac=%s", m_macAddress.c_str());
+ pwStr = StringUtils::Format("--password=%s",password.c_str());
+ portStr = StringUtils::Format("--server_port=%d",m_port);
if (!password.empty())
{
#include "DNSNameCache.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include <netinet/in.h>
#include <arpa/inet.h>
if (address != INADDR_NONE)
{
- strIpAddress.Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
+ strIpAddress = StringUtils::Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
return true;
}
struct hostent *host = gethostbyname(strHostName.c_str());
if (host && host->h_addr_list[0])
{
- strIpAddress.Format("%d.%d.%d.%d", (unsigned char)host->h_addr_list[0][0], (unsigned char)host->h_addr_list[0][1], (unsigned char)host->h_addr_list[0][2], (unsigned char)host->h_addr_list[0][3]);
+ strIpAddress = StringUtils::Format("%d.%d.%d.%d",
+ (unsigned char)host->h_addr_list[0][0],
+ (unsigned char)host->h_addr_list[0][1],
+ (unsigned char)host->h_addr_list[0][2],
+ (unsigned char)host->h_addr_list[0][3]);
g_DNSCache.Add(strHostName, strIpAddress);
return true;
}
#include "guilib/GUIWindowManager.h"
#include "guilib/GUIEditControl.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "guilib/LocalizeStrings.h"
m_protocol = NET_PROTOCOL_SMB; // default to smb
m_username = url.GetUserName();
m_password = url.GetPassWord();
- m_port.Format("%i", url.GetPort());
+ m_port = StringUtils::Format("%i", url.GetPort());
m_server = url.GetHostName();
m_path = url.GetFileName();
URIUtils::RemoveSlashAtEnd(m_path);
#include "utils/log.h"
#include "utils/XMLUtils.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "WakeOnAccess.h"
int nest_level = NestDetect::Level();
if (nest_level > 1)
{
- CStdString nest;
- nest.Format("Nesting:%d", nest_level);
+ CStdString nest = StringUtils::Format("Nesting:%d", nest_level);
m_dialog->SetLine(2, nest);
}
}
void CWakeOnAccess::WakeUpHost(const WakeUpEntry& server)
{
- CStdString heading = LOCALIZED(13027);
- heading.Format (heading, server.host);
+ CStdString heading = StringUtils::Format(LOCALIZED(13027), server.host.c_str());
ProgressDialogHelper dlg (heading);
{
if (IsEnabled()) // show notification only if we have general feature enabled
{
- CStdString message = LOCALIZED(13034);
- message.Format(message, host);
+ CStdString message = StringUtils::Format(LOCALIZED(13034), host.c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000);
}
CLog::Log(LOGDEBUG, "%s - Create new entry for host '%s'", __FUNCTION__, host.c_str());
if (IsEnabled()) // show notification only if we have general feature enabled
{
- CStdString message = LOCALIZED(13035);
- message.Format(message, host);
+ CStdString message = StringUtils::Format(LOCALIZED(13035), host.c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000);
}
if (IsEnabled())
{
CStdString heading = LOCALIZED(13033);
- CStdString message = LOCALIZED(13036);
- message.Format(message, host);
+ CStdString message = StringUtils::Format(LOCALIZED(13036), host.c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, heading, message, 4000, true, 3000);
}
}
{
getData = false;
- CStdString contentLength;
- contentLength.Format("%" PRId64, fileLength);
+ CStdString contentLength = StringUtils::Format("%" PRId64, fileLength);
response = MHD_create_response_from_data(0, NULL, MHD_NO, MHD_NO);
if (response == NULL)
{
case 200: //Found exact match
strtok((char *)recv_buffer.c_str(), " ");
- read_buffer.Format("cddb read %s %08x", strtok(NULL, " "), discid);
+ read_buffer = StringUtils::Format("cddb read %s %08x", strtok(NULL, " "), discid);
break;
case 210: //Found exact matches, list follows (until terminating marker)
CStdString Xcddb::GetCacheFile(uint32_t disc_id) const
{
CStdString strFileName;
- strFileName.Format("%x.cddb", disc_id);
+ strFileName = StringUtils::Format("%x.cddb", disc_id);
return URIUtils::AddFileToFolder(cCacheDir, strFileName);
}
#include "Util.h"
#include "utils/StringUtils.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
using namespace std;
{
m_network = network;
m_interfaceName = interfaceName;
- m_interfaceMacAdr.Format("%02X:%02X:%02X:%02X:%02X:%02X",
- (uint8_t)interfaceMacAddrRaw[0],
- (uint8_t)interfaceMacAddrRaw[1],
- (uint8_t)interfaceMacAddrRaw[2],
- (uint8_t)interfaceMacAddrRaw[3],
- (uint8_t)interfaceMacAddrRaw[4],
- (uint8_t)interfaceMacAddrRaw[5]);
+ m_interfaceMacAdr = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
+ (uint8_t)interfaceMacAddrRaw[0],
+ (uint8_t)interfaceMacAddrRaw[1],
+ (uint8_t)interfaceMacAddrRaw[2],
+ (uint8_t)interfaceMacAddrRaw[3],
+ (uint8_t)interfaceMacAddrRaw[4],
+ (uint8_t)interfaceMacAddrRaw[5]);
memcpy(m_interfaceMacAddrRaw, interfaceMacAddrRaw, sizeof(m_interfaceMacAddrRaw));
}
u_char *cp = (u_char*)LLADDR(sdl);
- mac.Format("%02X:%02X:%02X:%02X:%02X:%02X",
- cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
+ mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
+ cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
ret = true;
break;
}
}
struct sockaddr* res = &areq.arp_ha;
- mac.Format("%02X:%02X:%02X:%02X:%02X:%02X",
+ mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
(uint8_t) res->sa_data[0], (uint8_t) res->sa_data[1], (uint8_t) res->sa_data[2],
(uint8_t) res->sa_data[3], (uint8_t) res->sa_data[4], (uint8_t) res->sa_data[5]);
result.push_back(NetworkAccessPoint(essId, macAddress, signalLevel, encryption, channel));
unsigned char* mac = (unsigned char*)iwe->u.ap_addr.sa_data;
// macAddress is big-endian, write in byte chunks
- macAddress.Format("%02x-%02x-%02x-%02x-%02x-%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ macAddress = StringUtils::Format("%02x-%02x-%02x-%02x-%02x-%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
// Reset the remaining fields
essId = "";
encryption = ENC_NONE;
{
if(info.Match(PLT_ProtocolInfo("*", "*", allowed[type], "*")))
{
- CStdString prop;
- prop.Format("upnp:subtitle:%d", ++subs);
+ CStdString prop = StringUtils::Format("upnp:subtitle:%d", ++subs);
item.SetProperty(prop, (const char*)res.m_Uri);
break;
}
#include "URL.h"
#include "utils/URIUtils.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "playlists/PlayList.h"
#include "GUIUserMessages.h"
CStdString buffer;
- buffer.Format("%ld", data["volume"].asInteger());
+ buffer = StringUtils::Format("%ld", data["volume"].asInteger());
rct->SetStateVariable("Volume", buffer.c_str());
- buffer.Format("%ld", 256 * (data["volume"].asInteger() * 60 - 60) / 100);
+ buffer = StringUtils::Format("%ld", 256 * (data["volume"].asInteger() * 60 - 60) / 100);
rct->SetStateVariable("VolumeDb", buffer.c_str());
rct->SetStateVariable("Mute", data["muted"].asBoolean() ? "1" : "0");
if (slideshow)
{
CStdString index;
- index.Format("%d", slideshow->NumSlides());
+ index = StringUtils::Format("%d", slideshow->NumSlides());
avt->SetStateVariable("NumberOfTracks", index.c_str());
- index.Format("%d", slideshow->CurrentSlide());
+ index = StringUtils::Format("%d", slideshow->CurrentSlide());
avt->SetStateVariable("CurrentTrack", index.c_str());
}
if (genre.GetLength() > 0) {
// all tracks by genre filtered by artist and/or album
CStdString strPath;
- strPath.Format("musicdb://genres/%ld/%ld/%ld/",
- database.GetGenreByName((const char*)genre),
- database.GetArtistByName((const char*)artist), // will return -1 if no artist
- database.GetAlbumByName((const char*)album)); // will return -1 if no album
+ strPath = StringUtils::Format("musicdb://genres/%ld/%ld/%ld/",
+ database.GetGenreByName((const char*)genre),
+ database.GetArtistByName((const char*)artist), // will return -1 if no artist
+ database.GetAlbumByName((const char*)album)); // will return -1 if no album
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
} else if (artist.GetLength() > 0) {
// all tracks by artist name filtered by album if passed
CStdString strPath;
- strPath.Format("musicdb://artists/%ld/%ld/",
- database.GetArtistByName((const char*)artist),
- database.GetAlbumByName((const char*)album)); // will return -1 if no album
+ strPath = StringUtils::Format("musicdb://artists/%ld/%ld/",
+ database.GetArtistByName((const char*)artist),
+ database.GetAlbumByName((const char*)album)); // will return -1 if no album
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
} else if (album.GetLength() > 0) {
// all tracks by album name
- CStdString strPath;
- strPath.Format("musicdb://albums/%ld/",
- database.GetAlbumByName((const char*)album));
+ CStdString strPath = StringUtils::Format("musicdb://albums/%ld/",
+ database.GetAlbumByName((const char*)album));
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
}
database.Open();
if (genre.GetLength() > 0) {
- CStdString strPath;
- strPath.Format("musicdb://genres/%ld/%ld/",
- database.GetGenreByName((const char*)genre),
- database.GetArtistByName((const char*)artist)); // no artist should return -1
+ CStdString strPath = StringUtils::Format("musicdb://genres/%ld/%ld/",
+ database.GetGenreByName((const char*)genre),
+ database.GetArtistByName((const char*)artist)); // no artist should return -1
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
} else if (artist.GetLength() > 0) {
- CStdString strPath;
- strPath.Format("musicdb://artists/%ld/",
- database.GetArtistByName((const char*)artist));
+ CStdString strPath = StringUtils::Format("musicdb://artists/%ld/",
+ database.GetArtistByName((const char*)artist));
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
}
if (genre.GetLength() > 0) {
CMusicDatabase database;
database.Open();
- CStdString strPath;
- strPath.Format("musicdb://genres/%ld/", database.GetGenreByName((const char*)genre));
+ CStdString strPath = StringUtils::Format("musicdb://genres/%ld/", database.GetGenreByName((const char*)genre));
return OnBrowseDirectChildren(action, strPath.c_str(), filter, starting_index, requested_count, sort_criteria, context);
}
return OnBrowseDirectChildren(action, "musicdb://artists/", filter, starting_index, requested_count, sort_criteria, context);
#include "utils/log.h"
#include "threads/SingleLock.h"
#include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
// undefine if you want to build without the wlan stuff
// might be needed for VS2003
{
CStdString result;
unsigned char* mAddr = m_adapter.Address;
- result.Format("%02X:%02X:%02X:%02X:%02X:%02X", mAddr[0], mAddr[1], mAddr[2], mAddr[3], mAddr[4], mAddr[5]);
+ result = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X", mAddr[0], mAddr[1], mAddr[2], mAddr[3], mAddr[4], mAddr[5]);
return result;
}
{
if (PhysAddrLen == 6)
{
- mac.Format("%02X:%02X:%02X:%02X:%02X:%02X",
+ mac = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X",
bPhysAddr[0], bPhysAddr[1], bPhysAddr[2],
bPhysAddr[3], bPhysAddr[4], bPhysAddr[5]);
return true;
CStdString essId((char*)bss_entry.dot11Ssid.ucSSID, (unsigned int)bss_entry.dot11Ssid.uSSIDLength);
CStdString macAddress;
// macAddress is big-endian, write in byte chunks
- macAddress.Format("%02x-%02x-%02x-%02x-%02x-%02x",
+ macAddress = StringUtils::Format("%02x-%02x-%02x-%02x-%02x-%02x",
bss_entry.dot11Bssid[0], bss_entry.dot11Bssid[1], bss_entry.dot11Bssid[2],
bss_entry.dot11Bssid[3], bss_entry.dot11Bssid[4], bss_entry.dot11Bssid[5]);
int signalLevel = bss_entry.lRssi;
#include "PlatformDefs.h"
#endif
#include "utils/StdString.h"
+#include "utils/StringUtils.h"
class CSetting;
if (iVal > 65536)
iVal = 65536;
- strHexString.Format("%04X", iVal);
+ strHexString = StringUtils::Format("%04X", iVal);
};
};
#include "peripherals/Peripherals.h"
#include <usb.h>
#include "utils/log.h"
+#include "utils/StringUtils.h"
using namespace PERIPHERALS;
GetType(dev->config[0].interface[0].altsetting[0].bInterfaceClass) :
GetType(dev->descriptor.bDeviceClass);
#ifdef TARGET_FREEBSD
- result.m_strLocation.Format("%s", dev->filename);
+ result.m_strLocation = StringUtils::Format("%s", dev->filename);
#else
- result.m_strLocation.Format("/bus%s/dev%s", bus->dirname, dev->filename);
+ result.m_strLocation = StringUtils::Format("/bus%s/dev%s", bus->dirname, dev->filename);
#endif
result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
if (!results.ContainsResult(result))
}
}
if (!ttlDeviceFilePath.empty())
- privateDataRef->result.m_strLocation.Format("%s", ttlDeviceFilePath.c_str());
+ privateDataRef->result.m_strLocation = StringUtils::Format("%s", ttlDeviceFilePath.c_str());
else
- privateDataRef->result.m_strLocation.Format("%d", locationId);
+ privateDataRef->result.m_strLocation = StringUtils::Format("%d", locationId);
if (bDeviceClass == kUSBCompositeClass)
privateDataRef->result.m_type = refCon->GetType(bInterfaceClass);
{
PeripheralTypeTranslator::FormatHexString(scanResult.m_iVendorId, m_strVendorId);
PeripheralTypeTranslator::FormatHexString(scanResult.m_iProductId, m_strProductId);
- m_strFileLocation.Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType), scanResult.m_strLocation.c_str(), scanResult.m_iSequence);
+ m_strFileLocation = StringUtils::Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev",
+ PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType),
+ scanResult.m_strLocation.c_str(),
+ scanResult.m_iSequence);
}
CPeripheral::~CPeripheral(void)
return bReturn;
g_peripherals.GetSettingsFromMapping(*this);
- m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_mappedBusType), m_strVendorId.c_str(), m_strProductId.c_str());
+ m_strSettingsFile = StringUtils::Format("special://profile/peripheral_data/%s_%s_%s.xml",
+ PeripheralTypeTranslator::BusTypeToString(m_mappedBusType),
+ m_strVendorId.c_str(),
+ m_strProductId.c_str());
LoadPersistedSettings();
for (unsigned int iFeaturePtr = 0; iFeaturePtr < m_features.size(); iFeaturePtr++)
{
CSettingInt *intSetting = (CSettingInt *) (*itr).second;
if (intSetting)
- strValue.Format("%d", intSetting->GetValue());
+ strValue = StringUtils::Format("%d", intSetting->GetValue());
}
break;
case SettingTypeNumber:
{
CSettingNumber *floatSetting = (CSettingNumber *) (*itr).second;
if (floatSetting)
- strValue.Format("%.2f", floatSetting->GetValue());
+ strValue = StringUtils::Format("%.2f", floatSetting->GetValue());
}
break;
case SettingTypeBool:
{
CSettingBool *boolSetting = (CSettingBool *) (*itr).second;
if (boolSetting)
- strValue.Format("%d", boolSetting->GetValue() ? 1:0);
+ strValue = StringUtils::Format("%d", boolSetting->GetValue() ? 1:0);
}
break;
default:
CLog::Log(LOGERROR, g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
// display warning: incompatible libCEC
- CStdString strMessage;
- strMessage.Format(g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
+ CStdString strMessage = StringUtils::Format(g_localizeStrings.Get(36040).c_str(), m_cecAdapter ? m_configuration.serverVersion : -1, CEC_LIB_SUPPORTED_VERSION);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(36000), strMessage);
m_bError = true;
if (m_cecAdapter)
void CPeripheralCecAdapter::SetVersionInfo(const libcec_configuration &configuration)
{
- m_strVersionInfo.Format("libCEC %s - firmware v%d", m_cecAdapter->ToString((cec_server_version)configuration.serverVersion), configuration.iFirmwareVersion);
+ m_strVersionInfo = StringUtils::Format("libCEC %s - firmware v%d", m_cecAdapter->ToString((cec_server_version)configuration.serverVersion), configuration.iFirmwareVersion);
// append firmware build date
if (configuration.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN)
CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, m_strComPort.c_str());
// scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy
- CStdString strMessage;
- strMessage.Format(g_localizeStrings.Get(21336), g_localizeStrings.Get(36000));
+ CStdString strMessage = StringUtils::Format(g_localizeStrings.Get(21336).c_str(), g_localizeStrings.Get(36000).c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strMessage);
bool bConnectionFailedDisplayed(false);
m_configuration.iHDMIPort > CEC_MAX_HDMI_PORTNUMBER))
{
m_configuration.iPhysicalAddress = config.iPhysicalAddress;
- strPhysicalAddress.Format("%x", config.iPhysicalAddress);
+ strPhysicalAddress = StringUtils::Format("%x", config.iPhysicalAddress);
}
bChanged |= SetSetting("physical_address", strPhysicalAddress);
// request the OSD name of the TV
CStdString strNotification;
cec_osd_name tvName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV);
- strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name);
+ strNotification = StringUtils::Format("%s: %s", g_localizeStrings.Get(36016).c_str(), tvName.name);
CStdString strAmpName = UpdateAudioSystemStatus();
if (!strAmpName.empty())
if (m_strKeymap.IsEmpty())
{
- m_strKeymap.Format("v%sp%s", VendorIdAsString(), ProductIdAsString());
+ m_strKeymap = StringUtils::Format("v%sp%s", VendorIdAsString(), ProductIdAsString());
SetSetting("keymap", m_strKeymap);
}
switch (info)
{
case SLIDE_RESOLUTION:
- value.Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height);
+ value = StringUtils::Format("%d x %d", m_exifInfo.Width, m_exifInfo.Height);
break;
case SLIDE_COLOUR:
value = m_exifInfo.IsColor ? "Colour" : "Black and White";
// value = m_exifInfo.Software;
case SLIDE_EXIF_APERTURE:
if (m_exifInfo.ApertureFNumber)
- value.Format("%3.1f", m_exifInfo.ApertureFNumber);
+ value = StringUtils::Format("%3.1f", m_exifInfo.ApertureFNumber);
break;
case SLIDE_EXIF_ORIENTATION:
switch (m_exifInfo.Orientation)
case SLIDE_EXIF_FOCAL_LENGTH:
if (m_exifInfo.FocalLength)
{
- value.Format("%4.2fmm", m_exifInfo.FocalLength);
+ value = StringUtils::Format("%4.2fmm", m_exifInfo.FocalLength);
if (m_exifInfo.FocalLength35mmEquiv != 0)
value.AppendFormat(" (35mm Equivalent = %umm)", m_exifInfo.FocalLength35mmEquiv);
}
if (m_exifInfo.Distance < 0)
value = "Infinite";
else if (m_exifInfo.Distance > 0)
- value.Format("%4.2fm", m_exifInfo.Distance);
+ value = StringUtils::Format("%4.2fm", m_exifInfo.Distance);
break;
case SLIDE_EXIF_EXPOSURE:
switch (m_exifInfo.ExposureProgram)
if (m_exifInfo.ExposureTime)
{
if (m_exifInfo.ExposureTime < 0.010f)
- value.Format("%6.4fs", m_exifInfo.ExposureTime);
+ value = StringUtils::Format("%6.4fs", m_exifInfo.ExposureTime);
else
- value.Format("%5.3fs", m_exifInfo.ExposureTime);
+ value = StringUtils::Format("%5.3fs", m_exifInfo.ExposureTime);
if (m_exifInfo.ExposureTime <= 0.5)
value.AppendFormat(" (1/%d)", (int)(0.5 + 1/m_exifInfo.ExposureTime));
}
break;
case SLIDE_EXIF_EXPOSURE_BIAS:
if (m_exifInfo.ExposureBias != 0)
- value.Format("%4.2f EV", m_exifInfo.ExposureBias);
+ value = StringUtils::Format("%4.2f EV", m_exifInfo.ExposureBias);
break;
case SLIDE_EXIF_EXPOSURE_MODE:
switch (m_exifInfo.ExposureMode)
break;
case SLIDE_EXIF_ISO_EQUIV:
if (m_exifInfo.ISOequivalent)
- value.Format("%2d", m_exifInfo.ISOequivalent);
+ value = StringUtils::Format("%2d", m_exifInfo.ISOequivalent);
break;
case SLIDE_EXIF_DIGITAL_ZOOM:
if (m_exifInfo.DigitalZoomRatio)
- value.Format("%1.3fx", m_exifInfo.DigitalZoomRatio);
+ value = StringUtils::Format("%1.3fx", m_exifInfo.DigitalZoomRatio);
break;
case SLIDE_EXIF_CCD_WIDTH:
if (m_exifInfo.CCDWidth)
- value.Format("%4.2fmm", m_exifInfo.CCDWidth);
+ value = StringUtils::Format("%4.2fmm", m_exifInfo.CCDWidth);
break;
case SLIDE_EXIF_GPS_LATITUDE:
value = m_exifInfo.GpsLat;
CLog::Log(LOGERROR, "Could not save M3U playlist: [%s]", strPlaylist.c_str());
return;
}
- CStdString strLine;
- strLine.Format("%s\n",M3U_START_MARKER);
+ CStdString strLine = StringUtils::Format("%s\n",M3U_START_MARKER);
file.Write(strLine.c_str(),strLine.size());
for (int i = 0; i < (int)m_vecItems.size(); ++i)
{
CFileItemPtr item = m_vecItems[i];
CStdString strDescription=item->GetLabel();
g_charsetConverter.utf8ToStringCharset(strDescription);
- strLine.Format( "%s:%i,%s\n", M3U_INFO_MARKER, item->GetMusicInfoTag()->GetDuration() / 1000, strDescription.c_str() );
+ strLine = StringUtils::Format( "%s:%i,%s\n", M3U_INFO_MARKER, item->GetMusicInfoTag()->GetDuration() / 1000, strDescription.c_str() );
file.Write(strLine.c_str(),strLine.size());
CStdString strFileName = ResolveURL(item);
g_charsetConverter.utf8ToStringCharset(strFileName);
- strLine.Format("%s\n",strFileName.c_str());
+ strLine = StringUtils::Format("%s\n",strFileName.c_str());
file.Write(strLine.c_str(),strLine.size());
}
file.Close();
CStdString CSmartPlaylistRule::GetLocalizedRule() const
{
- CStdString rule;
- rule.Format("%s %s %s", GetLocalizedField(m_field).c_str(), GetLocalizedOperator(m_operator).c_str(), GetParameter().c_str());
- return rule;
+ return StringUtils::Format("%s %s %s", GetLocalizedField(m_field).c_str(), GetLocalizedOperator(m_operator).c_str(), GetParameter().c_str());
}
CStdString CSmartPlaylistRule::GetVideoResolutionQuery(const CStdString ¶meter) const
// special-casing
if (m_field == FieldTime)
{ // translate time to seconds
- CStdString seconds; seconds.Format("%i", StringUtils::TimeStringToSeconds(param));
+ CStdString seconds = StringUtils::Format("%i", StringUtils::TimeStringToSeconds(param));
return db.PrepareSQL(operatorString.c_str(), seconds.c_str());
}
return CDatabaseQueryRule::FormatParameter(operatorString, param, db, strType);
if (playlist.GetType().Equals(strType))
{
if ((*it)->m_operator == CDatabaseQueryRule::OPERATOR_DOES_NOT_EQUAL)
- currentRule.Format("NOT (%s)", playlistQuery.c_str());
+ currentRule = StringUtils::Format("NOT (%s)", playlistQuery.c_str());
else
currentRule = playlistQuery;
}
#include "guilib/GUIWindowManager.h"
#include "URL.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
CGUIDialogLockSettings::CGUIDialogLockSettings(void)
: CGUIDialogSettings(WINDOW_DIALOG_LOCK_SETTINGS, "LockSettings.xml")
// update our settings label
if (m_bGetUser)
{
- CStdString strLabel;
CStdString strLabel2=m_strURL;
CURL::Decode(strLabel2);
- strLabel.Format(g_localizeStrings.Get(20152),strLabel2.c_str());
- SET_CONTROL_LABEL(2,strLabel);
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20152), strLabel2.c_str());
+ SET_CONTROL_LABEL(2, strLabel);
}
else
SET_CONTROL_LABEL(2,g_localizeStrings.Get(20066));
{
AddButton(1,20142);
if (!m_strUser.IsEmpty())
- m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+ m_settings[0].name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
AddButton(2,12326);
if (!m_locks.code.IsEmpty())
- m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+ m_settings[1].name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
if (m_saveUserDetails)
AddBool(3, 13423, m_saveUserDetails);
return;
if (m_locks.mode > LOCK_MODE_QWERTY)
m_locks.mode = LOCK_MODE_EVERYONE;
if (m_locks.mode != LOCK_MODE_EVERYONE)
- m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+ m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(m_iButtonLabel).c_str(), g_localizeStrings.Get(12336+m_locks.mode).c_str());
else
- m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+ m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(m_iButtonLabel).c_str(), g_localizeStrings.Get(1223).c_str());
if (m_bDetails)
{
CStdString strHeading;
CStdString strDecodeUrl = m_strURL;
CURL::Decode(strDecodeUrl);
- strHeading.Format("%s %s",g_localizeStrings.Get(14062).c_str(),strDecodeUrl.c_str());
+ strHeading = StringUtils::Format("%s %s", g_localizeStrings.Get(14062).c_str(), strDecodeUrl.c_str());
if (CGUIKeyboardFactory::ShowAndGetInput(m_strUser,strHeading,true))
{
m_bChanged = true;
- m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+ m_settings[0].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(20142).c_str(), m_strUser.c_str());
UpdateSetting(1);
}
return;
EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
m_bChanged = true;
if (m_locks.mode != LOCK_MODE_EVERYONE)
- setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+ setting.name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
else
- setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+ setting.name = StringUtils::Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
UpdateSetting(1);
}
}
if (setting.id == 2 && m_bGetUser)
{
- CStdString strHeading;
CStdString strDecodeUrl = m_strURL;
CURL::Decode(strDecodeUrl);
- strHeading.Format("%s %s",g_localizeStrings.Get(20143).c_str(),strDecodeUrl.c_str());
+ CStdString strHeading = StringUtils::Format("%s %s", g_localizeStrings.Get(20143).c_str(), strDecodeUrl.c_str());
if (CGUIKeyboardFactory::ShowAndGetInput(m_locks.code,strHeading,true,true))
{
- m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+ m_settings[1].name = StringUtils::Format("%s (%s)", g_localizeStrings.Get(12326).c_str(), g_localizeStrings.Get(20141).c_str());
m_bChanged = true;
UpdateSetting(2);
}
void CPVRGUIInfo::CharInfoActiveTimerTitle(CStdString &strValue) const
{
- strValue.Format("%s", m_strActiveTimerTitle);
+ strValue = StringUtils::Format("%s", m_strActiveTimerTitle.c_str());
}
void CPVRGUIInfo::CharInfoActiveTimerChannelName(CStdString &strValue) const
{
- strValue.Format("%s", m_strActiveTimerChannelName);
+ strValue = StringUtils::Format("%s", m_strActiveTimerChannelName.c_str());
}
void CPVRGUIInfo::CharInfoActiveTimerChannelIcon(CStdString &strValue) const
{
- strValue.Format("%s", m_strActiveTimerChannelIcon);
+ strValue = StringUtils::Format("%s", m_strActiveTimerChannelIcon.c_str());
}
void CPVRGUIInfo::CharInfoActiveTimerDateTime(CStdString &strValue) const
{
- strValue.Format("%s", m_strActiveTimerTime);
+ strValue = StringUtils::Format("%s", m_strActiveTimerTime.c_str());
}
void CPVRGUIInfo::CharInfoNextTimerTitle(CStdString &strValue) const
{
- strValue.Format("%s", m_strNextRecordingTitle);
+ strValue = StringUtils::Format("%s", m_strNextRecordingTitle.c_str());
}
void CPVRGUIInfo::CharInfoNextTimerChannelName(CStdString &strValue) const
{
- strValue.Format("%s", m_strNextRecordingChannelName);
+ strValue = StringUtils::Format("%s", m_strNextRecordingChannelName.c_str());
}
void CPVRGUIInfo::CharInfoNextTimerChannelIcon(CStdString &strValue) const
{
- strValue.Format("%s", m_strNextRecordingChannelIcon);
+ strValue = StringUtils::Format("%s", m_strNextRecordingChannelIcon.c_str());
}
void CPVRGUIInfo::CharInfoNextTimerDateTime(CStdString &strValue) const
{
- strValue.Format("%s", m_strNextRecordingTime);
+ strValue = StringUtils::Format("%s", m_strNextRecordingTime.c_str());
}
void CPVRGUIInfo::CharInfoPlayingDuration(CStdString &strValue) const
{
- strValue.Format("%s", StringUtils::SecondsToTimeString(m_iDuration / 1000, TIME_FORMAT_GUESS));
+ strValue = StringUtils::Format("%s", StringUtils::SecondsToTimeString(m_iDuration / 1000, TIME_FORMAT_GUESS).c_str());
}
void CPVRGUIInfo::CharInfoPlayingTime(CStdString &strValue) const
{
- strValue.Format("%s", StringUtils::SecondsToTimeString(GetStartTime()/1000, TIME_FORMAT_GUESS));
+ strValue = StringUtils::Format("%s", StringUtils::SecondsToTimeString(GetStartTime()/1000, TIME_FORMAT_GUESS).c_str());
}
void CPVRGUIInfo::CharInfoNextTimer(CStdString &strValue) const
{
- strValue.Format("%s", m_strNextTimerInfo);
+ strValue = StringUtils::Format("%s", m_strNextTimerInfo.c_str());
}
void CPVRGUIInfo::CharInfoBackendNumber(CStdString &strValue) const
{
if (m_iActiveClients > 0)
- strValue.Format("%u %s %u", m_iAddonInfoToggleCurrent+1, g_localizeStrings.Get(20163), m_iActiveClients);
+ strValue = StringUtils::Format("%u %s %u", m_iAddonInfoToggleCurrent+1, g_localizeStrings.Get(20163).c_str(), m_iActiveClients);
else
- strValue.Format("%s", g_localizeStrings.Get(14023));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(14023).c_str());
}
void CPVRGUIInfo::CharInfoTotalDiskSpace(CStdString &strValue) const
{
- strValue.Format("%s", m_strTotalDiskspace);
+ strValue = StringUtils::Format("%s", m_strTotalDiskspace.c_str());
}
void CPVRGUIInfo::CharInfoVideoBR(CStdString &strValue) const
{
- strValue.Format("%.2f Mbit/s", m_qualityInfo.dVideoBitrate);
+ strValue = StringUtils::Format("%.2f Mbit/s", m_qualityInfo.dVideoBitrate);
}
void CPVRGUIInfo::CharInfoAudioBR(CStdString &strValue) const
{
- strValue.Format("%.0f kbit/s", m_qualityInfo.dAudioBitrate);
+ strValue = StringUtils::Format("%.0f kbit/s", m_qualityInfo.dAudioBitrate);
}
void CPVRGUIInfo::CharInfoDolbyBR(CStdString &strValue) const
{
- strValue.Format("%.0f kbit/s", m_qualityInfo.dDolbyBitrate);
+ strValue = StringUtils::Format("%.0f kbit/s", m_qualityInfo.dDolbyBitrate);
}
void CPVRGUIInfo::CharInfoSignal(CStdString &strValue) const
{
- strValue.Format("%d %%", m_qualityInfo.iSignal / 655);
+ strValue = StringUtils::Format("%d %%", m_qualityInfo.iSignal / 655);
}
void CPVRGUIInfo::CharInfoSNR(CStdString &strValue) const
{
- strValue.Format("%d %%", m_qualityInfo.iSNR / 655);
+ strValue = StringUtils::Format("%d %%", m_qualityInfo.iSNR / 655);
}
void CPVRGUIInfo::CharInfoBER(CStdString &strValue) const
{
- strValue.Format("%08X", m_qualityInfo.iBER);
+ strValue = StringUtils::Format("%08X", m_qualityInfo.iBER);
}
void CPVRGUIInfo::CharInfoUNC(CStdString &strValue) const
{
- strValue.Format("%08X", m_qualityInfo.iUNC);
+ strValue = StringUtils::Format("%08X", m_qualityInfo.iUNC);
}
void CPVRGUIInfo::CharInfoFrontendName(CStdString &strValue) const
{
if (!strcmp(m_qualityInfo.strAdapterName, StringUtils::EmptyString))
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_qualityInfo.strAdapterName);
+ strValue = StringUtils::Format("%s", m_qualityInfo.strAdapterName);
}
void CPVRGUIInfo::CharInfoFrontendStatus(CStdString &strValue) const
{
if (!strcmp(m_qualityInfo.strAdapterStatus, StringUtils::EmptyString))
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_qualityInfo.strAdapterStatus);
+ strValue = StringUtils::Format("%s", m_qualityInfo.strAdapterStatus);
}
void CPVRGUIInfo::CharInfoBackendName(CStdString &strValue) const
{
if (m_strBackendName.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendName);
+ strValue = StringUtils::Format("%s", m_strBackendName.c_str());
}
void CPVRGUIInfo::CharInfoBackendVersion(CStdString &strValue) const
{
if (m_strBackendVersion.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendVersion);
+ strValue = StringUtils::Format("%s", m_strBackendVersion.c_str());
}
void CPVRGUIInfo::CharInfoBackendHost(CStdString &strValue) const
{
if (m_strBackendHost.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendHost);
+ strValue = StringUtils::Format("%s", m_strBackendHost.c_str());
}
void CPVRGUIInfo::CharInfoBackendDiskspace(CStdString &strValue) const
{
if (m_strBackendDiskspace.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendDiskspace);
+ strValue = StringUtils::Format("%s", m_strBackendDiskspace.c_str());
}
void CPVRGUIInfo::CharInfoBackendChannels(CStdString &strValue) const
{
if (m_strBackendChannels.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendChannels);
+ strValue = StringUtils::Format("%s", m_strBackendChannels.c_str());
}
void CPVRGUIInfo::CharInfoBackendTimers(CStdString &strValue) const
{
if (m_strBackendTimers.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendTimers);
+ strValue = StringUtils::Format("%s", m_strBackendTimers.c_str());
}
void CPVRGUIInfo::CharInfoBackendRecordings(CStdString &strValue) const
{
if (m_strBackendRecordings.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strBackendRecordings);
+ strValue = StringUtils::Format("%s", m_strBackendRecordings.c_str());
}
void CPVRGUIInfo::CharInfoPlayingClientName(CStdString &strValue) const
{
if (m_strPlayingClientName.IsEmpty())
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_strPlayingClientName);
+ strValue = StringUtils::Format("%s", m_strPlayingClientName.c_str());
}
void CPVRGUIInfo::CharInfoEncryption(CStdString &strValue) const
{
CPVRChannelPtr channel;
if (g_PVRClients->GetPlayingChannel(channel))
- strValue.Format("%s", channel->EncryptionName().c_str());
+ strValue = StringUtils::Format("%s", channel->EncryptionName().c_str());
else
strValue = StringUtils::EmptyString;
}
void CPVRGUIInfo::CharInfoService(CStdString &strValue) const
{
if (!strcmp(m_qualityInfo.strServiceName, StringUtils::EmptyString))
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_qualityInfo.strServiceName);
+ strValue = StringUtils::Format("%s", m_qualityInfo.strServiceName);
}
void CPVRGUIInfo::CharInfoMux(CStdString &strValue) const
{
if (!strcmp(m_qualityInfo.strMuxName, StringUtils::EmptyString))
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_qualityInfo.strMuxName);
+ strValue = StringUtils::Format("%s", m_qualityInfo.strMuxName);
}
void CPVRGUIInfo::CharInfoProvider(CStdString &strValue) const
{
if (!strcmp(m_qualityInfo.strProviderName, StringUtils::EmptyString))
- strValue.Format("%s", g_localizeStrings.Get(13205));
+ strValue = StringUtils::Format("%s", g_localizeStrings.Get(13205).c_str());
else
- strValue.Format("%s", m_qualityInfo.strProviderName);
+ strValue = StringUtils::Format("%s", m_qualityInfo.strProviderName);
}
void CPVRGUIInfo::UpdateBackendCache(void)
{
kBTotal /= 1024; // Convert to MBytes
kBUsed /= 1024; // Convert to MBytes
- strBackendDiskspace.Format("%s %.1f GByte - %s: %.1f GByte",
- g_localizeStrings.Get(20161), (float) kBTotal / 1024, g_localizeStrings.Get(20162), (float) kBUsed / 1024);
+ strBackendDiskspace = StringUtils::Format("%s %.1f GByte - %s: %.1f GByte",
+ g_localizeStrings.Get(20161).c_str(), (float) kBTotal / 1024, g_localizeStrings.Get(20162).c_str(), (float) kBUsed / 1024);
}
else
{
int NumChannels = activeClient->second->GetChannelsAmount();
if (NumChannels >= 0)
- strBackendChannels.Format("%i", NumChannels);
+ strBackendChannels = StringUtils::Format("%i", NumChannels);
else
strBackendChannels = g_localizeStrings.Get(161);
int NumTimers = activeClient->second->GetTimersAmount();
if (NumTimers >= 0)
- strBackendTimers.Format("%i", NumTimers);
+ strBackendTimers = StringUtils::Format("%i", NumTimers);
else
strBackendTimers = g_localizeStrings.Get(161);
int NumRecordings = activeClient->second->GetRecordingsAmount();
if (NumRecordings >= 0)
- strBackendRecordings.Format("%i", NumRecordings);
+ strBackendRecordings = StringUtils::Format("%i", NumRecordings);
else
strBackendRecordings = g_localizeStrings.Get(161);
if (tag && tag->HasPVRTimerInfoTag())
{
CPVRTimerInfoTag *timer = tag->GetPVRTimerInfoTag();
- strNextRecordingTitle.Format("%s", timer->Title());
- strNextRecordingChannelName.Format("%s", timer->ChannelName());
- strNextRecordingChannelIcon.Format("%s", timer->ChannelIcon());
- strNextRecordingTime.Format("%s", timer->StartAsLocalTime().GetAsLocalizedDateTime(false, false));
-
- strNextTimerInfo.Format("%s %s %s %s",
- g_localizeStrings.Get(19106),
- timer->StartAsLocalTime().GetAsLocalizedDate(true),
- g_localizeStrings.Get(19107),
- timer->StartAsLocalTime().GetAsLocalizedTime("HH:mm", false));
+ strNextRecordingTitle = StringUtils::Format("%s", timer->Title().c_str());
+ strNextRecordingChannelName = StringUtils::Format("%s", timer->ChannelName().c_str());
+ strNextRecordingChannelIcon = StringUtils::Format("%s", timer->ChannelIcon().c_str());
+ strNextRecordingTime = StringUtils::Format("%s", timer->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str());
+
+ strNextTimerInfo = StringUtils::Format("%s %s %s %s",
+ g_localizeStrings.Get(19106).c_str(),
+ timer->StartAsLocalTime().GetAsLocalizedDate(true).c_str(),
+ g_localizeStrings.Get(19107).c_str(),
+ timer->StartAsLocalTime().GetAsLocalizedTime("HH:mm", false).c_str());
}
CSingleLock lock(m_critSection);
if (m_iTimerInfoToggleCurrent < activeTags.size() && activeTags.at(m_iTimerInfoToggleCurrent)->HasPVRTimerInfoTag())
{
CPVRTimerInfoTag *tag = activeTags.at(m_iTimerInfoToggleCurrent)->GetPVRTimerInfoTag();
- strActiveTimerTitle.Format("%s", tag->Title());
- strActiveTimerChannelName.Format("%s", tag->ChannelName());
- strActiveTimerChannelIcon.Format("%s", tag->ChannelIcon());
- strActiveTimerTime.Format("%s", tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false));
+ strActiveTimerTitle = StringUtils::Format("%s", tag->Title().c_str());
+ strActiveTimerChannelName = StringUtils::Format("%s", tag->ChannelName().c_str());
+ strActiveTimerChannelIcon = StringUtils::Format("%s", tag->ChannelIcon().c_str());
+ strActiveTimerTime = StringUtils::Format("%s", tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str());
}
}
{
nextEvent.GetAsTime(iWakeupTime);
- CStdString strExecCommand;
- strExecCommand.Format("%s %d", strWakeupCommand, iWakeupTime);
+ CStdString strExecCommand = StringUtils::Format("%s %d", strWakeupCommand.c_str(), iWakeupTime);
const int iReturn = system(strExecCommand.c_str());
if (iReturn != 0)
{
CLog::Log(LOGNOTICE, "PVRManager - %s - could not determine %s channel to start playback with. No last played channel found, and first channel of active group could also not be determined.", __FUNCTION__, bIsRadio ? "radio": "tv");
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(bIsRadio ? 19021 : 19020).c_str()); // RADIO/TV could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(bIsRadio ? 19021 : 19020).c_str()); // RADIO/TV could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
CLog::Log(LOGERROR, "PVRManager - %s - failed to switch to channel '%s'", __FUNCTION__, channel.ChannelName().c_str());
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel.ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
catch (exception &e) { LogException(e, "GetConnectionString()"); return false; }
/* display name = backend name:connection string */
- strFriendlyName.Format("%s:%s", strBackendName.c_str(), strConnectionString.c_str());
+ strFriendlyName = StringUtils::Format("%s:%s", strBackendName.c_str(), strConnectionString.c_str());
/* backend version number */
try { strBackendVersion = m_pStruct->GetBackendVersion(); }
m_bChanged = false;
if (m_strChannelName.IsEmpty())
- m_strChannelName.Format("%s %d", g_localizeStrings.Get(19029), m_iUniqueId);
+ m_strChannelName = StringUtils::Format("%s %d", g_localizeStrings.Get(19029).c_str(), m_iUniqueId);
UpdateEncryptionName();
}
if (m_strIconPath != strIconPath)
{
/* update the path */
- m_strIconPath.Format("%s", strIconPath);
+ m_strIconPath = StringUtils::Format("%s", strIconPath.c_str());
SetChanged();
m_bChanged = true;
CStdString strName(strChannelName);
if (strName.IsEmpty())
- strName.Format(g_localizeStrings.Get(19085), ClientChannelNumber());
+ strName = StringUtils::Format(g_localizeStrings.Get(19085).c_str(), ClientChannelNumber());
CSingleLock lock(m_critSection);
if (m_strChannelName != strName)
if (m_strClientChannelName != strClientChannelName)
{
/* update the client channel name */
- m_strClientChannelName.Format("%s", strClientChannelName);
+ m_strClientChannelName = StringUtils::Format("%s", strClientChannelName.c_str());
SetChanged();
// this is not persisted, so don't update m_bChanged
if (m_strInputFormat != strInputFormat)
{
/* update the input format */
- m_strInputFormat.Format("%s", strInputFormat);
+ m_strInputFormat = StringUtils::Format("%s", strInputFormat.c_str());
SetChanged();
m_bChanged = true;
if (m_strStreamURL != strStreamURL)
{
/* update the stream url */
- m_strStreamURL.Format("%s", strStreamURL);
+ m_strStreamURL = StringUtils::Format("%s", strStreamURL.c_str());
SetChanged();
m_bChanged = true;
CStdString strFileNameAndPath;
CSingleLock lock(m_critSection);
- strFileNameAndPath.Format("pvr://channels/%s/%s/%i.pvr", (m_bIsRadio ? "radio" : "tv"), group->GroupName().c_str(), iNewChannelGroupPosition);
+ strFileNameAndPath = StringUtils::Format("pvr://channels/%s/%s/%i.pvr", (m_bIsRadio ? "radio" : "tv"), group->GroupName().c_str(), iNewChannelGroupPosition);
if (m_strFileNameAndPath != strFileNameAndPath)
{
m_strFileNameAndPath = strFileNameAndPath;
bool bCleanEPG = !m_strEPGScraper.IsEmpty() || strScraper.IsEmpty();
/* update the scraper name */
- m_strEPGScraper.Format("%s", strScraper);
+ m_strEPGScraper = StringUtils::Format("%s", strScraper.c_str());
SetChanged();
m_bChanged = true;
CStdString strIconPath = strBasePath + strSanitizedChannelName;
CStdString strIconPathLower = strBasePath + strSanitizedChannelName.ToLower();
CStdString strIconPathUid;
- strIconPathUid.Format("%08d", groupMember.channel->UniqueID());
+ strIconPathUid = StringUtils::Format("%08d", groupMember.channel->UniqueID());
strIconPathUid = URIUtils::AddFileToFolder(strBasePath, strIconPathUid);
SetChannelIconPath(groupMember.channel, strIconPath + ".tbn") ||
#include "settings/Settings.h"
#include "guilib/GUIWindowManager.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "filesystem/File.h"
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());
+ strCheckPath = StringUtils::Format("channels/%s/%s/", (*it)->IsRadio() ? "radio" : "tv", (*it)->GroupName().c_str());
if (strFileName.Left(strCheckPath.length()) == strCheckPath)
{
strFileName.erase(0, strCheckPath.length());
CStdString strPath;
for (std::vector<CPVRChannelGroupPtr>::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
{
- strPath.Format("channels/%s/%i", m_bRadio ? "radio" : "tv", (*it)->GroupID());
+ strPath = StringUtils::Format("channels/%s/%i", m_bRadio ? "radio" : "tv", (*it)->GroupID());
CFileItemPtr group(new CFileItem(strPath, true));
group->m_strTitle = (*it)->GroupName();
group->SetLabel((*it)->GroupName());
#include "pvr/addons/PVRClients.h"
#include "settings/Settings.h"
#include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
#define BUTTON_OK 4
#define BUTTON_APPLY 5
unsigned int iNewSelect = bMoveUp ? m_iSelected - 1 : m_iSelected + 1;
if (m_channelItems->Get(iNewSelect)->GetProperty("Number").asString() != "-")
{
- strNumber.Format("%i", m_iSelected+1);
+ strNumber = StringUtils::Format("%i", m_iSelected+1);
m_channelItems->Get(iNewSelect)->SetProperty("Number", strNumber);
- strNumber.Format("%i", iNewSelect+1);
+ strNumber = StringUtils::Format("%i", iNewSelect+1);
m_channelItems->Get(m_iSelected)->SetProperty("Number", strNumber);
}
m_channelItems->Swap(iNewSelect, m_iSelected);
channelFile->SetProperty("Icon", channel->IconPath());
channelFile->SetProperty("EPGSource", (int)0);
channelFile->SetProperty("ParentalLocked", channel->IsLocked());
- CStdString number; number.Format("%i", channel->ChannelNumber());
- channelFile->SetProperty("Number", number);
+ channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));
if (channel->IsVirtual())
{
pItem = m_channelItems->Get(iChannelPtr);
if (pItem->GetProperty("ActiveChannel").asBoolean())
{
- strNumber.Format("%i", ++iNextChannelNumber);
+ strNumber = StringUtils::Format("%i", ++iNextChannelNumber);
pItem->SetProperty("Number", strNumber);
}
else
if (!g_PVRManager.CheckParentalLock(*channel) ||
!g_application.m_pPlayer->SwitchChannel(*channel))
{
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
#include "guilib/GUIWindowManager.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
#include "pvr/PVRManager.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
if (m_selectedGroup->IsInternalGroup())
{
CStdString strNewLabel;
- strNewLabel.Format("%s %s", g_localizeStrings.Get(19022), m_bIsRadio ? g_localizeStrings.Get(19024) : g_localizeStrings.Get(19023));
+ strNewLabel = StringUtils::Format("%s %s",
+ g_localizeStrings.Get(19022).c_str(),
+ m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
- strNewLabel.Format("%s %s", g_localizeStrings.Get(19218), m_bIsRadio ? g_localizeStrings.Get(19024) : g_localizeStrings.Get(19023));
+ strNewLabel = StringUtils::Format("%s %s",
+ g_localizeStrings.Get(19218).c_str(),
+ m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
}
else
{
CStdString strNewLabel;
- strNewLabel.Format("%s", g_localizeStrings.Get(19219));
+ strNewLabel = StringUtils::Format("%s", g_localizeStrings.Get(19219).c_str());
SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
- strNewLabel.Format("%s %s", g_localizeStrings.Get(19220), m_selectedGroup->GroupName());
+ strNewLabel = StringUtils::Format("%s %s", g_localizeStrings.Get(19220).c_str(), m_selectedGroup->GroupName().c_str());
SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
}
if (!m_progItem->GetEPGInfoTag()->HasPVRChannel() ||
(ret = g_application.PlayFile(CFileItem(*m_progItem->GetEPGInfoTag()->ChannelTag()))) == PLAYBACK_FAIL)
{
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(19029).c_str()); // Channel could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(19029).c_str()); // Channel could not be played. Check the log for details.
CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
}
else if (ret == PLAYBACK_OK)
#include "guilib/GUIRadioButtonControl.h"
#include "guilib/GUISpinControlEx.h"
#include "guilib/GUIWindowManager.h"
+#include "utils/StringUtils.h"
#include "addons/include/xbmc_pvr_types.h"
#include "pvr/PVRManager.h"
for (int i = 1; i < 12*60/5; i++)
{
CStdString string;
- string.Format(g_localizeStrings.Get(14044), i*5);
+ string = StringUtils::Format(g_localizeStrings.Get(14044), i*5);
pSpin->AddLabel(string, i*5);
}
pSpin->SetValue(m_searchFilter->m_iMinimumDuration);
for (int i = 1; i < 12*60/5; i++)
{
CStdString string;
- string.Format(g_localizeStrings.Get(14044),i*5);
+ string = StringUtils::Format(g_localizeStrings.Get(14044), i*5);
pSpin->AddLabel(string, i*5);
}
pSpin->SetValue(m_searchFilter->m_iMaximumDuration);
#include "guilib/GUIKeyboardFactory.h"
#include "dialogs/GUIDialogNumeric.h"
#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
#include "pvr/PVRManager.h"
#include "pvr/timers/PVRTimerInfoTag.h"
CStdString string;
CFileItemPtr item = channelsList[i];
const CPVRChannel *channel = item->GetPVRChannelInfoTag();
- string.Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str());
+ string = StringUtils::Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str());
channelNames.push_back(string);
if (channel->ChannelID() == timerChannelID)
m_selectedChannelEntry = entry;
bool CPVRRecording::Rename(const CStdString &strNewName)
{
- m_strTitle.Format("%s", strNewName);
+ m_strTitle = StringUtils::Format("%s", strNewName.c_str());
PVR_ERROR error = g_PVRClients->RenameRecording(*this);
if (error != PVR_ERROR_NO_ERROR)
{
m_resumePoint.totalTimeInSeconds = tag.m_resumePoint.totalTimeInSeconds;
}
- CStdString strShow;
- strShow.Format("%s - ", g_localizeStrings.Get(20364).c_str());
+ CStdString strShow = StringUtils::Format("%s - ", g_localizeStrings.Get(20364).c_str());
if (m_strPlotOutline.Left(strShow.size()).Equals(strShow))
{
CStdString strEpisode = m_strPlotOutline;
int pos = strTitle.ReverseFind('/');
strTitle.erase(0, pos + 1);
strEpisode.erase(0, strShow.size());
- m_strTitle.Format("%s - %s", strTitle.c_str(), strEpisode);
+ m_strTitle = StringUtils::Format("%s - %s", strTitle.c_str(), strEpisode.c_str());
pos = strEpisode.Find('-');
strEpisode.erase(0, pos + 2);
m_strPlotOutline = strEpisode;
strTitle.Replace('/',' ');
if (!m_strDirectory.IsEmpty())
- strDirectory.Format("%s/", m_strDirectory.c_str());
+ strDirectory = StringUtils::Format("%s/", m_strDirectory.c_str());
if (!m_strChannelName.IsEmpty())
- strChannel.Format(" (%s)", m_strChannelName.c_str());
- m_strFileNameAndPath.Format("pvr://recordings/%s%s, TV%s, %s.pvr", strDirectory.c_str(), strTitle.c_str(), strChannel.c_str(), strDatetime.c_str());
+ strChannel = StringUtils::Format(" (%s)", m_strChannelName.c_str());
+ m_strFileNameAndPath = StringUtils::Format("pvr://recordings/%s%s, TV%s, %s.pvr", strDirectory.c_str(), strTitle.c_str(), strChannel.c_str(), strDatetime.c_str());
}
}
#include "video/VideoDatabase.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
+
#include "pvr/PVRManager.h"
#include "pvr/addons/PVRClients.h"
#include "PVRRecordings.h"
CStdString strFilePath;
if(strUseBase.empty())
- strFilePath.Format("pvr://recordings/%s/", strCurrent.c_str());
+ strFilePath = StringUtils::Format("pvr://recordings/%s/", strCurrent.c_str());
else
- strFilePath.Format("pvr://recordings/%s/%s/", strUseBase.c_str(), strCurrent.c_str());
+ strFilePath = StringUtils::Format("pvr://recordings/%s/%s/", strUseBase.c_str(), strCurrent.c_str());
if (!results->Contains(strFilePath))
{
if (bAutoSkip && results->Size() == 1 && files.Size() == 0)
{
- CStdString strGetPath;
- strGetPath.Format("%s/%s/", strUseBase.c_str(), results->Get(0)->GetLabel());
+ CStdString strGetPath = StringUtils::Format("%s/%s/", strUseBase.c_str(), results->Get(0)->GetLabel().c_str());
results->Clear();
if(strUseBase.empty())
strAllPath = "pvr://recordings";
else
- strAllPath.Format("pvr://recordings/%s", strUseBase.c_str());
+ strAllPath = StringUtils::Format("pvr://recordings/%s", strUseBase.c_str());
pItem->SetPath(AddAllRecordingsPathExtension(strAllPath));
pItem->SetSpecialSort(SortSpecialOnTop);
pItem->SetLabelPreformated(true);
m_channel = channel;
m_bIsRadio = channel && channel->IsRadio();
m_state = timer.state;
- m_strFileNameAndPath.Format("pvr://client%i/timers/%i", m_iClientId, m_iClientIndex);
+ m_strFileNameAndPath = StringUtils::Format("pvr://client%i/timers/%i", m_iClientId, m_iClientIndex);
UpdateSummary();
}
if (!m_bIsRepeating || !m_iWeekdays)
{
- m_strSummary.Format("%s %s %s %s %s",
- StartAsLocalTime().GetAsLocalizedDate(),
- g_localizeStrings.Get(19159),
- StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
- g_localizeStrings.Get(19160),
- EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+ m_strSummary = StringUtils::Format("%s %s %s %s %s",
+ StartAsLocalTime().GetAsLocalizedDate().c_str(),
+ g_localizeStrings.Get(19159).c_str(),
+ StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+ g_localizeStrings.Get(19160).c_str(),
+ EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
}
else if (m_FirstDay.IsValid())
{
- m_strSummary.Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s %s %s",
- m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149) : "__",
- m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150) : "__",
- m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151) : "__",
- m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152) : "__",
- m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153) : "__",
- m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154) : "__",
- m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155) : "__",
- g_localizeStrings.Get(19156),
- FirstDayAsLocalTime().GetAsLocalizedDate(false),
- g_localizeStrings.Get(19159),
- StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
- g_localizeStrings.Get(19160),
- EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+ m_strSummary = StringUtils::Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s %s %s",
+ m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149).c_str() : "__",
+ m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150).c_str() : "__",
+ m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151).c_str() : "__",
+ m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152).c_str() : "__",
+ m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153).c_str() : "__",
+ m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154).c_str() : "__",
+ m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155).c_str() : "__",
+ g_localizeStrings.Get(19156).c_str(),
+ FirstDayAsLocalTime().GetAsLocalizedDate(false).c_str(),
+ g_localizeStrings.Get(19159).c_str(),
+ StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+ g_localizeStrings.Get(19160).c_str(),
+ EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
}
else
{
- m_strSummary.Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s",
- m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149) : "__",
- m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150) : "__",
- m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151) : "__",
- m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152) : "__",
- m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153) : "__",
- m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154) : "__",
- m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155) : "__",
- g_localizeStrings.Get(19159),
- StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
- g_localizeStrings.Get(19160),
- EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+ m_strSummary = StringUtils::Format("%s-%s-%s-%s-%s-%s-%s %s %s %s %s",
+ m_iWeekdays & 0x01 ? g_localizeStrings.Get(19149).c_str() : "__",
+ m_iWeekdays & 0x02 ? g_localizeStrings.Get(19150).c_str() : "__",
+ m_iWeekdays & 0x04 ? g_localizeStrings.Get(19151).c_str() : "__",
+ m_iWeekdays & 0x08 ? g_localizeStrings.Get(19152).c_str() : "__",
+ m_iWeekdays & 0x10 ? g_localizeStrings.Get(19153).c_str() : "__",
+ m_iWeekdays & 0x20 ? g_localizeStrings.Get(19154).c_str() : "__",
+ m_iWeekdays & 0x40 ? g_localizeStrings.Get(19155).c_str() : "__",
+ g_localizeStrings.Get(19159).c_str(),
+ StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+ g_localizeStrings.Get(19160).c_str(),
+ EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
}
}
if (tag.Plot().empty())
{
- newTag->m_strSummary.Format("%s %s %s %s %s",
- newTag->StartAsLocalTime().GetAsLocalizedDate(),
- g_localizeStrings.Get(19159),
- newTag->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
- g_localizeStrings.Get(19160),
- newTag->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+ newTag->m_strSummary= StringUtils::Format("%s %s %s %s %s",
+ newTag->StartAsLocalTime().GetAsLocalizedDate().c_str(),
+ g_localizeStrings.Get(19159).c_str(),
+ newTag->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+ g_localizeStrings.Get(19160).c_str(),
+ newTag->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
}
else
{
{
case PVR_TIMER_STATE_ABORTED:
case PVR_TIMER_STATE_CANCELLED:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19224), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19224).c_str(), m_strTitle.c_str());
break;
case PVR_TIMER_STATE_SCHEDULED:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19225), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19225).c_str(), m_strTitle.c_str());
break;
case PVR_TIMER_STATE_RECORDING:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19226), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19226).c_str(), m_strTitle.c_str());
break;
case PVR_TIMER_STATE_COMPLETED:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19227), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19227).c_str(), m_strTitle.c_str());
break;
case PVR_TIMER_STATE_CONFLICT_OK:
case PVR_TIMER_STATE_CONFLICT_NOK:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19277), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19277).c_str(), m_strTitle.c_str());
break;
case PVR_TIMER_STATE_ERROR:
- strText.Format("%s: '%s'", g_localizeStrings.Get(19278), m_strTitle.c_str());
+ strText = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(19278).c_str(), m_strTitle.c_str());
break;
default:
break;
if (g_PVRManager.IsStarted())
{
CStdString strMessage;
- strMessage.Format("%s: '%s'",
- (timer->EndAsUTC() <= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()) ?
- g_localizeStrings.Get(19227) :
- g_localizeStrings.Get(19228),
- timer->m_strTitle.c_str());
+ strMessage = StringUtils::Format("%s: '%s'",
+ (timer->EndAsUTC() <= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()) ?
+ g_localizeStrings.Get(19227).c_str() :
+ g_localizeStrings.Get(19228).c_str(),
+ timer->m_strTitle.c_str());
timerNotifications.push_back(strMessage);
}
newTimer->m_bIsRadio = channel.IsRadio();
/* generate summary string */
- newTimer->m_strSummary.Format("%s %s %s %s %s",
- newTimer->StartAsLocalTime().GetAsLocalizedDate(),
- g_localizeStrings.Get(19159),
- newTimer->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false),
- g_localizeStrings.Get(19160),
- newTimer->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false));
+ newTimer->m_strSummary = StringUtils::Format("%s %s %s %s %s",
+ newTimer->StartAsLocalTime().GetAsLocalizedDate().c_str(),
+ g_localizeStrings.Get(19159).c_str(),
+ newTimer->StartAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str(),
+ g_localizeStrings.Get(19160).c_str(),
+ newTimer->EndAsLocalTime().GetAsLocalizedTime(StringUtils::EmptyString, false).c_str());
}
CDateTime startTime(0);
SetSelectedGroup(currentGroup);
CStdString strPath;
- strPath.Format("pvr://channels/%s/%s/",
+ strPath = StringUtils::Format("pvr://channels/%s/%s/",
m_bRadio ? "radio" : "tv",
- m_bShowHiddenChannels ? ".hidden" : currentGroup->GroupName());
+ m_bShowHiddenChannels ? ".hidden" : currentGroup->GroupName().c_str());
m_parent->m_vecItems->SetPath(strPath);
m_parent->Update(m_parent->m_vecItems->GetPath());
return bReturn;
CStdString strIndex;
- strIndex.Format("%i", channel->ChannelNumber());
+ strIndex = StringUtils::Format("%i", channel->ChannelNumber());
CGUIDialogNumeric::ShowAndGetNumber(strIndex, g_localizeStrings.Get(19052));
int newIndex = atoi(strIndex.c_str());
bReturn = UpdateEpgForChannel(item);
- CStdString strMessage;
- strMessage.Format("%s: '%s'", g_localizeStrings.Get(bReturn ? 19253 : 19254), channel->ChannelName());
+ CStdString strMessage = StringUtils::Format("%s: '%s'", g_localizeStrings.Get(bReturn ? 19253 : 19254).c_str(), channel->ChannelName().c_str());
CGUIDialogKaiToast::QueueNotification(bReturn ? CGUIDialogKaiToast::Info : CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166),
strMessage);
if (ret == PLAYBACK_FAIL)
{
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
}
if (!bSwitchSuccessful)
{
- CStdString msg;
CStdString channelName = g_localizeStrings.Get(19029); // Channel
if (channel)
channelName = channel->ChannelName();
- msg.Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
bool bReturn = PlayFile(&channelItem);
if (!bReturn)
{
- CStdString msg;
- msg.Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
}
// Suppress resume from 0
if (positionInSeconds > 0)
- resumeString.Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(positionInSeconds).c_str());
+ resumeString = StringUtils::Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(positionInSeconds).c_str());
}
return resumeString;
}
{
m_RenderRenderer = (const char*)m_AIdentifier.Description;
m_RenderVendor = (const char*)m_AIdentifier.Driver;
- m_RenderVersion.Format("%d.%d.%d.%04d", HIWORD(m_AIdentifier.DriverVersion.HighPart), LOWORD(m_AIdentifier.DriverVersion.HighPart),
- HIWORD(m_AIdentifier.DriverVersion.LowPart) , LOWORD(m_AIdentifier.DriverVersion.LowPart));
+ m_RenderVersion = StringUtils::Format("%d.%d.%d.%04d", HIWORD(m_AIdentifier.DriverVersion.HighPart), LOWORD(m_AIdentifier.DriverVersion.HighPart),
+ HIWORD(m_AIdentifier.DriverVersion.LowPart) , LOWORD(m_AIdentifier.DriverVersion.LowPart));
}
CLog::Log(LOGDEBUG, __FUNCTION__" - adapter %d: %s, %s, VendorId %lu, DeviceId %lu",
CStdString CRenderSystemDX::GetErrorDescription(HRESULT hr)
{
- CStdString strError;
- strError.Format("%X - %s (%s)", hr, DXGetErrorString(hr), DXGetErrorDescription(hr));
-
- return strError;
+ return StringUtils::Format("%X - %s (%s)", hr, DXGetErrorString(hr), DXGetErrorDescription(hr));
}
void CRenderSystemDX::SetStereoMode(RENDER_STEREO_MODE mode, RENDER_STEREO_VIEW view)
m_extraLogLevels = 0;
for (int i=LOGMASKBIT;i<31;++i)
{
- CStdString str;
- str.Format("bit%i", i-LOGMASKBIT+1);
+ CStdString str = StringUtils::Format("bit%i", i-LOGMASKBIT+1);
if (addon->GetSetting(str) == "true")
m_extraLogLevels |= (1 << i);
}
#include "guilib/GUIControlGroupList.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "guilib/GUIKeyboardFactory.h"
#define CONTROL_GROUP_LIST 5
{
CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
if (pControl && setting.data) {
- CStdString strIndex;
- strIndex.Format("%i", *(int *)setting.data);
+ CStdString strIndex = StringUtils::Format("%i", *(int *)setting.data);
pControl->SetLabel2(strIndex);
}
}
pControl->SetWidth(width);
((CGUIEditControl *)pControl)->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, 0);
if (setting.data) {
- CStdString strIndex;
- strIndex.Format("%i", *(int *)setting.data);
+ CStdString strIndex = StringUtils::Format("%i", *(int *)setting.data);
((CGUIEditControl *)pControl)->SetLabel2(strIndex);
}
}
if (i == min && minLabel)
format = minLabel;
else
- format.Format("%i", i);
+ format = StringUtils::Format("%i", i);
setting.entry.push_back(make_pair(i, format));
}
m_settings.push_back(setting);
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "windowing/WindowingFactory.h"
using namespace std;
{
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
pDialog->SetHeading(20325);
- CStdString strText;
- strText.Format(g_localizeStrings.Get(20326).c_str(), g_graphicsContext.GetResInfo(m_Res[m_iCurRes]).strMode.c_str());
+ CStdString strText = StringUtils::Format(g_localizeStrings.Get(20326).c_str(), g_graphicsContext.GetResInfo(m_Res[m_iCurRes]).strMode.c_str());
pDialog->SetLine(0, strText);
pDialog->SetLine(1, 20327);
pDialog->SetChoice(0, 222);
// recenter our control...
pControl->SetPosition((info.iWidth - pControl->GetWidth()) / 2,
(info.iHeight - pControl->GetHeight()) / 2);
- strStatus.Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), info.fPixelRatio);
+ strStatus = StringUtils::Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), info.fPixelRatio);
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
}
}
{
info.Overscan.left = pControl->GetXLocation();
info.Overscan.top = pControl->GetYLocation();
- strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
+ strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
}
break;
info.Overscan.bottom = pControl->GetYLocation();
int iXOff1 = info.iWidth - pControl->GetXLocation();
int iYOff1 = info.iHeight - pControl->GetYLocation();
- strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
+ strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
}
break;
case CONTROL_SUBTITLES:
{
info.iSubtitles = pControl->GetYLocation();
- strStatus.Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
+ strStatus = StringUtils::Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
}
break;
// set the label control correctly
CStdString strText;
if (g_Windowing.IsFullScreen())
- strText.Format("%ix%i@%.2f - %s | %s", info.iScreenWidth,
- info.iScreenHeight, info.fRefreshRate,
- g_localizeStrings.Get(244).c_str(), strStatus.c_str());
+ strText = StringUtils::Format("%ix%i@%.2f - %s | %s",
+ info.iScreenWidth,
+ info.iScreenHeight,
+ info.fRefreshRate,
+ g_localizeStrings.Get(244).c_str(),
+ strStatus.c_str());
else
- strText.Format("%ix%i - %s | %s", info.iScreenWidth,
- info.iScreenHeight,
- g_localizeStrings.Get(242).c_str(), strStatus.c_str());
+ strText = StringUtils::Format("%ix%i - %s | %s",
+ info.iScreenWidth,
+ info.iScreenHeight,
+ g_localizeStrings.Get(242).c_str(),
+ strStatus.c_str());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
}
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogSelect.h"
#include "guilib/Key.h"
+#include "utils/StringUtils.h"
CAutorunMediaJob::CAutorunMediaJob(const CStdString &label, const CStdString &path)
{
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
- CStdString strAction;
- strAction.Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str());
+ CStdString strAction = StringUtils::Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str());
CBuiltins::Execute(strAction);
}
#include "utils/log.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "utils/JobManager.h"
+#include "utils/StringUtils.h"
#include "AutorunMediaJob.h"
#include "FileItem.h"
if(bReturnAsDevice == false)
strDevice.Replace("\\\\.\\","");
else if(!strDevice.empty() && strDevice[1]==':')
- strDevice.Format("\\\\.\\%c:", strDevice[0]);
+ strDevice = StringUtils::Format("\\\\.\\%c:", strDevice[0]);
URIUtils::RemoveSlashAtEnd(strDevice);
#endif
pathVideoTS = g_mediaManager.TranslateDevicePath("");
CLog::Log(LOGDEBUG, "GetDiskUniqueId: Trying to retrieve ID for path %s", pathVideoTS.c_str());
- CStdString strID;
+
CDVDInputStreamNavigator dvdNavigator(NULL);
dvdNavigator.Open(pathVideoTS, "");
CStdString serialString;
dvdNavigator.GetDVDSerialString(serialString);
- strID.Format("removable://%s_%s", labelString.c_str(), serialString.c_str());
+ CStdString strID = StringUtils::Format("removable://%s_%s", labelString.c_str(), serialString.c_str());
CLog::Log(LOGDEBUG, "GetDiskUniqueId: Got ID %s for DVD disk", strID.c_str());
return strID;
#include "settings/AdvancedSettings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "PosixMountProvider.h"
CMediaSource source;
source.strPath = m_MountPath;
if (m_Label.empty())
- source.strName.Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
+ source.strName = StringUtils::Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
else
source.strName = m_Label;
if (m_isOptical)
CStdString CDeviceKitDiskDevice::toString()
{
- CStdString str;
- str.Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
+ return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
"IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s "
"IsOptical %s",
m_DeviceKitUDI.c_str(), BOOL2SZ(m_isFileSystem), m_FileSystem,
BOOL2SZ(m_isSystemInternal), BOOL2SZ(m_isMounted),
BOOL2SZ(m_isRemovable), BOOL2SZ(m_isPartition), BOOL2SZ(m_isOptical));
-
- return str;
}
CDeviceKitDisksProvider::CDeviceKitDisksProvider()
#include "settings/AdvancedSettings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "PosixMountProvider.h"
CMediaSource source;
source.strPath = m_MountPath;
if (m_Label.empty())
- source.strName.Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
+ source.strName = StringUtils::Format("%.1f GB %s", m_PartitionSizeGiB, g_localizeStrings.Get(155).c_str());
else
source.strName = m_Label;
if (m_isOptical)
CStdString CUDiskDevice::toString()
{
- CStdString str;
- str.Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
+ return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s "
"IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s "
"IsOptical %s",
m_DeviceKitUDI.c_str(), BOOL2SZ(m_isFileSystem), m_FileSystem,
BOOL2SZ(m_isSystemInternal), BOOL2SZ(m_isMounted),
BOOL2SZ(m_isRemovable), BOOL2SZ(m_isPartition), BOOL2SZ(m_isOptical));
-
- return str;
}
CUDisksProvider::CUDisksProvider()
#include "threads/SingleLock.h"
#include "log.h"
#include "dialogs/GUIDialogKaiToast.h"
+#include "utils/StringUtils.h"
using namespace std;
strStarted = g_localizeStrings.Get(13210);
}
- CStdString strMessage;
-
- strMessage.Format(strStarted.c_str(),static_cast<int>(event.m_fSecs)/60,static_cast<int>(event.m_fSecs)%60);
+ CStdString strMessage = StringUtils::Format(strStarted.c_str(),
+ static_cast<int>(event.m_fSecs)/60,
+ static_cast<int>(event.m_fSecs)%60);
if(!bSilent)
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, strAlarmClock, strMessage);
{
float remaining = static_cast<float>(iter->second.m_fSecs-iter->second.watch.GetElapsedSeconds());
CStdString strStarted = g_localizeStrings.Get(13212);
- strMessage.Format(strStarted.c_str(),static_cast<int>(remaining)/60,static_cast<int>(remaining)%60);
+ strMessage = StringUtils::Format(strStarted.c_str(),
+ static_cast<int>(remaining)/60,
+ static_cast<int>(remaining)%60);
}
if (iter->second.m_strCommand.IsEmpty() || iter->second.m_fSecs > iter->second.watch.GetElapsedSeconds())
{
#include "guilib/GUIWindowManager.h"
#include "log.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
CAsyncFileCopy::CAsyncFileCopy() : CThread("AsyncFileCopy")
// and update the dialog as we go
if (dlg && dlg->IsDialogRunning())
{
- CStdString speedString;
- speedString.Format("%2.2f KB/s", m_speed / 1024);
+ CStdString speedString = StringUtils::Format("%2.2f KB/s", m_speed / 1024);
dlg->SetHeading(heading);
dlg->SetLine(0, url1.Get());
dlg->SetLine(1, url2.Get());
CStdString strCore;
#ifdef TARGET_WINDOWS
// atm we get only the average over all cores
- strCore.Format("CPU %d core(s) average: %3.1f%% ",m_cpuCount, iter->second.m_fPct);
+ strCore = StringUtils::Format("CPU %d core(s) average: %3.1f%% ", m_cpuCount, iter->second.m_fPct);
#else
- strCore.Format("CPU%d: %3.1f%% ",iter->first, iter->second.m_fPct);
+ strCore = StringUtils::Format("CPU%d: %3.1f%% ", iter->first, iter->second.m_fPct);
#endif
strCores+=strCore;
iter++;
#include "music/MusicDatabase.h"
#include "utils/log.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "video/VideoDatabase.h"
std::string DatabaseUtils::MediaTypeToString(MediaType mediaType)
{
CStdString result;
if (field == FieldId) return "musicvideoview.idMVideo";
- else if (field == FieldTitle) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
- else if (field == FieldTime) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_RUNTIME);
- else if (field == FieldDirector) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_DIRECTOR);
- else if (field == FieldStudio) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_STUDIOS);
- else if (field == FieldYear) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
- else if (field == FieldPlot) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_PLOT);
- else if (field == FieldAlbum) result.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
- else if (field == FieldArtist) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_ARTIST);
- else if (field == FieldGenre) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_GENRE);
- else if (field == FieldTrackNumber) result.Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_TRACK);
+ else if (field == FieldTitle) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
+ else if (field == FieldTime) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_RUNTIME);
+ else if (field == FieldDirector) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_DIRECTOR);
+ else if (field == FieldStudio) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_STUDIOS);
+ else if (field == FieldYear) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
+ else if (field == FieldPlot) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_PLOT);
+ else if (field == FieldAlbum) result = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+ else if (field == FieldArtist) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_ARTIST);
+ else if (field == FieldGenre) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_GENRE);
+ else if (field == FieldTrackNumber) result = StringUtils::Format("musicvideoview.c%02d", VIDEODB_ID_MUSICVIDEO_TRACK);
else if (field == FieldFilename) return "musicvideoview.strFilename";
else if (field == FieldPath) return "musicvideoview.strPath";
else if (field == FieldPlaycount) return "musicvideoview.playCount";
{
// We need some extra logic to get the title value if sorttitle isn't set
if (queryPart == DatabaseQueryPartOrderBy)
- result.Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE, VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE);
+ result = StringUtils::Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE, VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE);
else
- result.Format("movieview.c%02d", VIDEODB_ID_TITLE);
+ result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TITLE);
}
- else if (field == FieldPlot) result.Format("movieview.c%02d", VIDEODB_ID_PLOT);
- else if (field == FieldPlotOutline) result.Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
- else if (field == FieldTagline) result.Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
- else if (field == FieldVotes) result.Format("movieview.c%02d", VIDEODB_ID_VOTES);
+ else if (field == FieldPlot) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOT);
+ else if (field == FieldPlotOutline) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
+ else if (field == FieldTagline) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
+ else if (field == FieldVotes) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_VOTES);
else if (field == FieldRating)
{
if (queryPart == DatabaseQueryPartOrderBy)
- result.Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
+ result = StringUtils::Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
else
- result.Format("movieview.c%02d", VIDEODB_ID_RATING);
+ result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RATING);
}
- else if (field == FieldWriter) result.Format("movieview.c%02d", VIDEODB_ID_CREDITS);
- else if (field == FieldYear) result.Format("movieview.c%02d", VIDEODB_ID_YEAR);
- else if (field == FieldSortTitle) result.Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
- else if (field == FieldTime) result.Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
- else if (field == FieldMPAA) result.Format("movieview.c%02d", VIDEODB_ID_MPAA);
- else if (field == FieldTop250) result.Format("movieview.c%02d", VIDEODB_ID_TOP250);
+ else if (field == FieldWriter) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_CREDITS);
+ else if (field == FieldYear) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_YEAR);
+ else if (field == FieldSortTitle) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
+ else if (field == FieldTime) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
+ else if (field == FieldMPAA) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_MPAA);
+ else if (field == FieldTop250) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TOP250);
else if (field == FieldSet) return "movieview.strSet";
- else if (field == FieldGenre) result.Format("movieview.c%02d", VIDEODB_ID_GENRE);
- else if (field == FieldDirector) result.Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
- else if (field == FieldStudio) result.Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
- else if (field == FieldTrailer) result.Format("movieview.c%02d", VIDEODB_ID_TRAILER);
- else if (field == FieldCountry) result.Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
+ else if (field == FieldGenre) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_GENRE);
+ else if (field == FieldDirector) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
+ else if (field == FieldStudio) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
+ else if (field == FieldTrailer) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TRAILER);
+ else if (field == FieldCountry) result = StringUtils::Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
else if (field == FieldFilename) return "movieview.strFilename";
else if (field == FieldPath) return "movieview.strPath";
else if (field == FieldPlaycount) return "movieview.playCount";
{
// We need some extra logic to get the title value if sorttitle isn't set
if (queryPart == DatabaseQueryPartOrderBy)
- result.Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
+ result = StringUtils::Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
else
- result.Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
+ result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
}
- else if (field == FieldPlot) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
- else if (field == FieldTvShowStatus) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
- else if (field == FieldVotes) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
- else if (field == FieldRating) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
- else if (field == FieldYear) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
- else if (field == FieldGenre) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
- else if (field == FieldMPAA) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
- else if (field == FieldStudio) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
- else if (field == FieldSortTitle) result.Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
+ else if (field == FieldPlot) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
+ else if (field == FieldTvShowStatus) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
+ else if (field == FieldVotes) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
+ else if (field == FieldRating) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
+ else if (field == FieldYear) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
+ else if (field == FieldGenre) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
+ else if (field == FieldMPAA) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
+ else if (field == FieldStudio) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
+ else if (field == FieldSortTitle) result = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
else if (field == FieldPath) return "tvshowview.strPath";
else if (field == FieldDateAdded) return "tvshowview.dateAdded";
else if (field == FieldLastPlayed) return "tvshowview.lastPlayed";
{
CStdString result;
if (field == FieldId) return "episodeview.idEpisode";
- else if (field == FieldTitle) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
- else if (field == FieldPlot) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
- else if (field == FieldVotes) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
- else if (field == FieldRating) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
- else if (field == FieldWriter) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
- else if (field == FieldAirDate) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
- else if (field == FieldTime) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
- else if (field == FieldDirector) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
- else if (field == FieldSeason) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
- else if (field == FieldEpisodeNumber) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
- else if (field == FieldUniqueId) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
- else if (field == FieldEpisodeNumberSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
- else if (field == FieldSeasonSpecialSort) result.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
+ else if (field == FieldTitle) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
+ else if (field == FieldPlot) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
+ else if (field == FieldVotes) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
+ else if (field == FieldRating) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
+ else if (field == FieldWriter) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
+ else if (field == FieldAirDate) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
+ else if (field == FieldTime) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
+ else if (field == FieldDirector) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
+ else if (field == FieldSeason) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
+ else if (field == FieldEpisodeNumber) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
+ else if (field == FieldUniqueId) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_UNIQUEID);
+ else if (field == FieldEpisodeNumberSpecialSort) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTEPISODE);
+ else if (field == FieldSeasonSpecialSort) result = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SORTSEASON);
else if (field == FieldFilename) return "episodeview.strFilename";
else if (field == FieldPath) return "episodeview.strPath";
else if (field == FieldPlaycount) return "episodeview.playCount";
else if (season == 0)
label = g_localizeStrings.Get(20381);
else
- label.Format(g_localizeStrings.Get(20358), season);
+ label = StringUtils::Format(g_localizeStrings.Get(20358), season);
return GetThumb("season" + path + label, CProfilesManager::Get().GetVideoThumbFolder(), true);
}
CStdString CEdenVideoArtUpdater::GetCachedEpisodeThumb(const CFileItem &item)
{
// get the locally cached thumb
- CStdString strCRC;
- strCRC.Format("%sepisode%i", item.GetVideoInfoTag()->m_strFileNameAndPath.c_str(), item.GetVideoInfoTag()->m_iEpisode);
+ CStdString strCRC = StringUtils::Format("%sepisode%i",
+ item.GetVideoInfoTag()->m_strFileNameAndPath.c_str(),
+ item.GetVideoInfoTag()->m_iEpisode);
return GetThumb(strCRC, CProfilesManager::Get().GetVideoThumbFolder(), true);
}
CStdString thumb;
if (split)
{
- CStdString hex;
- hex.Format("%08x", (__int32)crc);
- thumb.Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
+ CStdString hex = StringUtils::Format("%08x", (__int32)crc);
+ thumb = StringUtils::Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
}
else
- thumb.Format("%08x.tbn", (unsigned __int32)crc);
+ thumb = StringUtils::Format("%08x.tbn", (unsigned __int32)crc);
return URIUtils::AddFileToFolder(path2, thumb);
}
#include "log.h"
#include "Util.h"
#include "URIUtils.h"
+#include "utils/StringUtils.h"
#include "URL.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/GUIWindowManager.h"
double current = data->current + ((double)ipercent * data->opWeight * (double)m_time)/ 100.0;
if (avgSpeed > 1000000.0f)
- data->base->m_avgSpeed.Format("%.1f MB/s", avgSpeed / 1000000.0f);
+ data->base->m_avgSpeed = StringUtils::Format("%.1f MB/s", avgSpeed / 1000000.0f);
else
- data->base->m_avgSpeed.Format("%.1f KB/s", avgSpeed / 1000.0f);
+ data->base->m_avgSpeed = StringUtils::Format("%.1f KB/s", avgSpeed / 1000.0f);
if (data->base->m_handle)
{
CStdString line;
- line.Format("%s (%s)", data->base->GetCurrentFile().c_str(),
- data->base->GetAverageSpeed().c_str());
+ line = StringUtils::Format("%s (%s)",
+ data->base->GetCurrentFile().c_str(),
+ data->base->GetAverageSpeed().c_str());
data->base->m_handle->SetText(line);
data->base->m_handle->SetPercentage((float)current);
}
*/
#include "HTMLUtil.h"
+#include "utils/StringUtils.h"
using namespace std;
using namespace HTML;
num = strStripped.Mid(i,iPos-i);
wchar_t val = (wchar_t)wcstol(num.c_str(),NULL,base);
if (base == 10)
- num.Format(L"&#%ls;",num.c_str());
+ num = StringUtils::Format(L"&#%ls;", num.c_str());
else
- num.Format(L"&#x%ls;",num.c_str());
+ num = StringUtils::Format(L"&#x%ls;", num.c_str());
strStripped.Replace(num,CStdStringW(1,val));
iPos = strStripped.Find(L"&#", iStart);
{
case 'N':
if (music && music->GetTrackNumber() > 0)
- value.Format("%02.2i", music->GetTrackNumber());
+ value = StringUtils::Format("%02.2i", music->GetTrackNumber());
if (movie&& movie->m_iTrack > 0)
- value.Format("%02.2i", movie->m_iTrack);
+ value = StringUtils::Format("%02.2i", movie->m_iTrack);
break;
case 'S':
if (music && music->GetDiscNumber() > 0)
- value.Format("%02.2i", music->GetDiscNumber());
+ value = StringUtils::Format("%02.2i", music->GetDiscNumber());
break;
case 'A':
if (music && music->GetArtist().size())
else if (movie->m_premiered.IsValid())
value = movie->m_premiered.GetAsLocalizedDate();
else if (movie->m_iYear > 0)
- value.Format("%i",movie->m_iYear);
+ value = StringUtils::Format("%i", movie->m_iYear);
}
break;
case 'F': // filename
if (music && music->GetRating() != '0')
value = music->GetRating();
else if (movie && movie->m_fRating != 0.f)
- value.Format("%.1f", movie->m_fRating);
+ value = StringUtils::Format("%.1f", movie->m_fRating);
break;
case 'C': // programs count
- value.Format("%i", item->m_iprogramCount);
+ value = StringUtils::Format("%i", item->m_iprogramCount);
break;
case 'K':
value = item->m_strTitle;
break;
case 'M':
if (movie && movie->m_iEpisode > 0)
- value.Format("%i %s", movie->m_iEpisode,g_localizeStrings.Get(movie->m_iEpisode == 1 ? 20452 : 20453));
+ value = StringUtils::Format("%i %s",
+ movie->m_iEpisode,
+ g_localizeStrings.Get(movie->m_iEpisode == 1 ? 20452 : 20453).c_str());
break;
case 'E':
if (movie && movie->m_iEpisode > 0)
{ // episode number
if (movie->m_iSeason == 0)
- value.Format("S%02.2i", movie->m_iEpisode);
+ value = StringUtils::Format("S%02.2i", movie->m_iEpisode);
else
- value.Format("%02.2i", movie->m_iEpisode);
+ value = StringUtils::Format("%02.2i", movie->m_iEpisode);
}
break;
case 'P':
if (movie && movie->m_iEpisode > 0)
{ // season*100+episode number
if (movie->m_iSeason == 0)
- value.Format("S%02.2i", movie->m_iEpisode);
+ value = StringUtils::Format("S%02.2i", movie->m_iEpisode);
else
- value.Format("%ix%02.2i", movie->m_iSeason,movie->m_iEpisode);
+ value = StringUtils::Format("%ix%02.2i", movie->m_iSeason,movie->m_iEpisode);
}
break;
case 'O':
break;
case 'V': // Playcount
if (music)
- value.Format("%i", music->GetPlayCount());
+ value = StringUtils::Format("%i", music->GetPlayCount());
if (movie)
- value.Format("%i", movie->m_playCount);
+ value = StringUtils::Format("%i", movie->m_playCount);
break;
case 'X': // Bitrate
if( !item->m_bIsFolder && item->m_dwSize != 0 )
- value.Format("%i kbps", item->m_dwSize);
+ value = StringUtils::Format("%i kbps", item->m_dwSize);
break;
case 'W': // Listeners
if( !item->m_bIsFolder && music && music->GetListeners() != 0 )
- value.Format("%i %s", music->GetListeners(), g_localizeStrings.Get(music->GetListeners() == 1 ? 20454 : 20455));
+ value = StringUtils::Format("%i %s",
+ music->GetListeners(),
+ g_localizeStrings.Get(music->GetListeners() == 1 ? 20454 : 20455).c_str());
break;
case 'a': // Date Added
if (movie && movie->m_dateAdded.IsValid())
#include "utils/XBMCTinyXML.h"
#include "LangInfo.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#define MAKECODE(a, b, c, d) ((((long)(a))<<24) | (((long)(b))<<16) | (((long)(c))<<8) | (long)(d))
#define MAKETWOCHARCODE(a, b) ((((long)(a))<<8) | (long)(b))
{
for(unsigned int i = 0; i < sizeof(g_iso639_2) / sizeof(LCENTRY); i++)
{
- if (strCharCode.Equals(g_iso639_2[i].name))
+ if (StringUtils::EqualsNoCase(strCharCode, g_iso639_2[i].name))
{
CodeToString(g_iso639_2[i].code, strThreeCharCode);
return true;
for (; i < items.Size(); ++i)
{
CFileItemPtr item = items.Get(i);
- CStdString value;
- CStdString strRating;
- value.Format("%i", i + 1);
- strRating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+ CStdString value = StringUtils::Format("%i", i + 1);
+ CStdString strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);;
home->SetProperty("LatestMovie." + value + ".Title" , item->GetLabel());
home->SetProperty("LatestMovie." + value + ".Rating" , strRating);
}
for (; i < NUM_ITEMS; ++i)
{
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestMovie." + value + ".Title" , "");
home->SetProperty("LatestMovie." + value + ".Thumb" , "");
home->SetProperty("LatestMovie." + value + ".Rating" , "");
CFileItemPtr item = TVShowItems.Get(i);
int EpisodeSeason = item->GetVideoInfoTag()->m_iSeason;
int EpisodeNumber = item->GetVideoInfoTag()->m_iEpisode;
- CStdString EpisodeNo;
- CStdString value;
- CStdString strRating;
- EpisodeNo.Format("s%02de%02d", EpisodeSeason, EpisodeNumber);
- value.Format("%i", i + 1);
- strRating.Format("%.1f", item->GetVideoInfoTag()->m_fRating);
+ CStdString EpisodeNo = StringUtils::Format("s%02de%02d", EpisodeSeason, EpisodeNumber);
+ CStdString value = StringUtils::Format("%i", i + 1);
+ CStdString strRating = StringUtils::Format("%.1f", item->GetVideoInfoTag()->m_fRating);
CFileItem show(item->GetVideoInfoTag()->m_strShowPath, true);
}
for (; i < NUM_ITEMS; ++i)
{
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestEpisode." + value + ".ShowTitle" , "");
home->SetProperty("LatestEpisode." + value + ".EpisodeTitle" , "");
home->SetProperty("LatestEpisode." + value + ".Rating" , "");
for (; i < MusicVideoItems.Size(); ++i)
{
CFileItemPtr item = MusicVideoItems.Get(i);
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestMusicVideo." + value + ".Title" , item->GetLabel());
home->SetProperty("LatestMusicVideo." + value + ".Year" , item->GetVideoInfoTag()->m_iYear);
}
for (; i < NUM_ITEMS; ++i)
{
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestMusicVideo." + value + ".Title" , "");
home->SetProperty("LatestMusicVideo." + value + ".Thumb" , "");
home->SetProperty("LatestMusicVideo." + value + ".Year" , "");
for (; i < musicItems.Size(); ++i)
{
CFileItemPtr item = musicItems.Get(i);
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
CStdString strRating;
CStdString strAlbum = item->GetMusicInfoTag()->GetAlbum();
}
}
- strRating.Format("%c", item->GetMusicInfoTag()->GetRating());
+ strRating = StringUtils::Format("%c", item->GetMusicInfoTag()->GetRating());
home->SetProperty("LatestSong." + value + ".Title" , item->GetMusicInfoTag()->GetTitle());
home->SetProperty("LatestSong." + value + ".Year" , item->GetMusicInfoTag()->GetYear());
}
for (; i < NUM_ITEMS; ++i)
{
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestSong." + value + ".Title" , "");
home->SetProperty("LatestSong." + value + ".Year" , "");
home->SetProperty("LatestSong." + value + ".Artist" , "");
{
for (; i < (int)albums.size(); ++i)
{
- CStdString value;
- CStdString strPath;
- CStdString strThumb;
- CStdString strFanart;
- CStdString strDBpath;
- CStdString strSQLAlbum;
- CAlbum& album=albums[i];
-
- value.Format("%i", i + 1);
- strThumb = musicdatabase.GetArtForItem(album.idAlbum, "album", "thumb");
- strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, "album", "fanart");
- strDBpath.Format("musicdb://albums/%i/", album.idAlbum);
- strSQLAlbum.Format("idAlbum=%i", album.idAlbum);
-
+ CAlbum& album=albums[i];
+ CStdString value = StringUtils::Format("%i", i + 1);
+ CStdString strThumb = musicdatabase.GetArtForItem(album.idAlbum, "album", "thumb");
+ CStdString strFanart = musicdatabase.GetArtistArtForItem(album.idAlbum, "album", "fanart");
+ CStdString strDBpath = StringUtils::Format("musicdb://albums/%i/", album.idAlbum);
+ CStdString strSQLAlbum = StringUtils::Format("idAlbum=%i", album.idAlbum);
CStdString strArtist = musicdatabase.GetSingleValue("albumview", "strArtists", strSQLAlbum);
home->SetProperty("LatestAlbum." + value + ".Title" , album.strAlbum);
}
for (; i < NUM_ITEMS; ++i)
{
- CStdString value;
- value.Format("%i", i + 1);
+ CStdString value = StringUtils::Format("%i", i + 1);
home->SetProperty("LatestAlbum." + value + ".Title" , "");
home->SetProperty("LatestAlbum." + value + ".Year" , "");
home->SetProperty("LatestAlbum." + value + ".Artist" , "");
#include "RegExp.h"
#include "StdString.h"
#include "log.h"
+#include "utils/StringUtils.h"
using namespace PCRE;
int size = GetSubCount(); // past the subpatterns is junk
for (int i = 0; i <= size; i++)
{
- CStdString t;
- t.Format("[%i,%i]", m_iOvector[(i*2)], m_iOvector[(i*2)+1]);
+ CStdString t = StringUtils::Format("[%i,%i]", m_iOvector[(i*2)], m_iOvector[(i*2)+1]);
if (i != size)
t += ",";
str += t;
#include "addons/Scraper.h"
#include "URL.h"
#include "Util.h"
+#include "utils/StringUtils.h"
#include "log.h"
#include "CharsetConverter.h"
#include "utils/StringUtils.h"
int iIndex;
for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--)
{
- CStdString temp;
iIndex = 0;
- temp.Format("$$%i",i+1);
+ CStdString temp = StringUtils::Format("$$%i",i+1);
while ((size_t)(iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING
{
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.GetLength(),m_param[i]);
int pos = reg.GetSubStart(1);
std::string szReplace(reg.GetMatch(1));
- CStdString replace;
- replace.Format("&#x%s;", szReplace.c_str());
+ CStdString replace = StringUtils::Format("&#x%s;", szReplace.c_str());
string.replace(string.begin()+pos-2, string.begin()+pos+4, replace);
}
int pos2 = reg2.GetSubStart(2);
std::string szHexValue(reg2.GetMatch(1));
- CStdString replace;
- replace.Format("%c", strtol(szHexValue.c_str(), NULL, 16));
+ CStdString replace = StringUtils::Format("%c", strtol(szHexValue.c_str(), NULL, 16));
string.replace(string.begin()+pos1-2, string.begin()+pos2+reg2.GetSubLength(2), replace);
}
{
CURL url(values.at(FieldPath).asString());
- CStdString label;
- label.Format("%s %d", url.GetFileNameWithoutPath().c_str(), values.at(FieldStartOffset).asInteger());
- return label;
+ return StringUtils::Format("%s %d", url.GetFileNameWithoutPath().c_str(), values.at(FieldStartOffset).asInteger());
}
string ByPath(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %d", values.at(FieldPath).asString().c_str(), values.at(FieldStartOffset).asInteger());
- return label;
+ return StringUtils::Format("%s %d", values.at(FieldPath).asString().c_str(), values.at(FieldStartOffset).asInteger());
}
string ByLastPlayed(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %s", values.at(FieldLastPlayed).asString().c_str(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%s %s", values.at(FieldLastPlayed).asString().c_str(), ByLabel(attributes, values).c_str());
}
string ByPlaycount(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i %s", (int)values.at(FieldPlaycount).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", (int)values.at(FieldPlaycount).asInteger(), ByLabel(attributes, values).c_str());
}
string ByDate(SortAttribute attributes, const SortItem &values)
string ByDateAdded(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %d", values.at(FieldDateAdded).asString().c_str(), (int)values.at(FieldId).asInteger());
- return label;
+ return StringUtils::Format("%s %d", values.at(FieldDateAdded).asString().c_str(), (int)values.at(FieldId).asInteger());;
}
string BySize(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%"PRId64, values.at(FieldSize).asInteger());
- return label;
+ return StringUtils::Format("%"PRId64, values.at(FieldSize).asInteger());
}
string ByDriveType(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%d %s", (int)values.at(FieldDriveType).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%d %s", (int)values.at(FieldDriveType).asInteger(), ByLabel(attributes, values).c_str());
}
string ByTitle(SortAttribute attributes, const SortItem &values)
if (attributes & SortAttributeIgnoreArticle)
album = SortUtils::RemoveArticles(album);
- CStdString label;
- label.Format("%s %s", album, ArrayToString(attributes, values.at(FieldArtist)));
+ CStdString label = StringUtils::Format("%s %s", album.c_str(), ArrayToString(attributes, values.at(FieldArtist)).c_str());
const CVariant &track = values.at(FieldTrackNumber);
if (!track.isNull())
string ByTrackNumber(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i", (int)values.at(FieldTrackNumber).asInteger());
- return label;
+ return StringUtils::Format("%i", (int)values.at(FieldTrackNumber).asInteger());
}
string ByTime(SortAttribute attributes, const SortItem &values)
CStdString label;
const CVariant &time = values.at(FieldTime);
if (time.isInteger())
- label.Format("%i", (int)time.asInteger());
+ label = StringUtils::Format("%i", (int)time.asInteger());
else
- label.Format("%s", time.asString());
+ label = StringUtils::Format("%s", time.asString().c_str());
return label;
}
string ByProgramCount(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i", (int)values.at(FieldProgramCount).asInteger());
- return label;
+ return StringUtils::Format("%i", (int)values.at(FieldProgramCount).asInteger());
}
string ByPlaylistOrder(SortAttribute attributes, const SortItem &values)
string ByRating(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%f %s", values.at(FieldRating).asFloat(), ByLabel(attributes, values).c_str());
}
string ByVotes(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%d %s", (int)values.at(FieldVotes).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%d %s", (int)values.at(FieldVotes).asInteger(), ByLabel(attributes, values).c_str());
}
string ByTop250(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%d %s", (int)values.at(FieldTop250).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%d %s", (int)values.at(FieldTop250).asInteger(), ByLabel(attributes, values).c_str());
}
string ByMPAA(SortAttribute attributes, const SortItem &values)
if (title.empty())
title = ByLabel(attributes, values);
- CStdString label;
- label.Format("%"PRIu64" %s", num, title.c_str());
- return label;
+ return StringUtils::Format("%"PRIu64" %s", num, title.c_str());
}
string BySeason(SortAttribute attributes, const SortItem &values)
if (!specialSeason.isNull())
season = (int)specialSeason.asInteger();
- CStdString label;
- label.Format("%i %s", season, ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", season, ByLabel(attributes, values).c_str());
}
string ByNumberOfEpisodes(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i %s", (int)values.at(FieldNumberOfEpisodes).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfEpisodes).asInteger(), ByLabel(attributes, values).c_str());
}
string ByNumberOfWatchedEpisodes(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i %s", (int)values.at(FieldNumberOfWatchedEpisodes).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", (int)values.at(FieldNumberOfWatchedEpisodes).asInteger(), ByLabel(attributes, values).c_str());
}
string ByTvShowStatus(SortAttribute attributes, const SortItem &values)
string ByVideoResolution(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i %s", (int)values.at(FieldVideoResolution).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", (int)values.at(FieldVideoResolution).asInteger(), ByLabel(attributes, values).c_str());
}
string ByVideoCodec(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %s", values.at(FieldVideoCodec).asString(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%s %s", values.at(FieldVideoCodec).asString().c_str(), ByLabel(attributes, values).c_str());
}
string ByVideoAspectRatio(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%f %s", values.at(FieldVideoAspectRatio).asString(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%f %s", values.at(FieldVideoAspectRatio).asString().c_str(), ByLabel(attributes, values).c_str());
}
string ByAudioChannels(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i %s", (int)values.at(FieldAudioChannels).asInteger(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%i %s", (int)values.at(FieldAudioChannels).asInteger(), ByLabel(attributes, values).c_str());
}
string ByAudioCodec(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %s", values.at(FieldAudioCodec).asString(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%s %s", values.at(FieldAudioCodec).asString().c_str(), ByLabel(attributes, values).c_str());
}
string ByAudioLanguage(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %s", values.at(FieldAudioLanguage).asString(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%s %s", values.at(FieldAudioLanguage).asString().c_str(), ByLabel(attributes, values).c_str());;
}
string BySubtitleLanguage(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%s %s", values.at(FieldSubtitleLanguage).asString(), ByLabel(attributes, values).c_str());
- return label;
+ return StringUtils::Format("%s %s", values.at(FieldSubtitleLanguage).asString().c_str(), ByLabel(attributes, values).c_str());
}
string ByBitrate(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%"PRId64, values.at(FieldBitrate).asInteger());
- return label;
+ return StringUtils::Format("%"PRId64, values.at(FieldBitrate).asInteger());
}
string ByListeners(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i", values.at(FieldListeners).asInteger());
- return label;
+ return StringUtils::Format("%i", values.at(FieldListeners).asInteger());;
}
string ByRandom(SortAttribute attributes, const SortItem &values)
{
- CStdString label;
- label.Format("%i", CUtil::GetRandomNumber());
- return label;
+ return StringUtils::Format("%i", CUtil::GetRandomNumber());;
}
string ByChannel(SortAttribute attributes, const SortItem &values)
#endif // #ifdef SS_ANSI
- // -------------------------------------------------------------------------
- // FUNCTION: CStdStr::Format
- // void _cdecl Formst(CStdStringA& PCSTR szFormat, ...)
- // void _cdecl Format(PCSTR szFormat);
- //
- // DESCRIPTION:
- // This function does sprintf/wsprintf style formatting on CStdStringA
- // objects. It looks a lot like MFC's CString::Format. Some people
- // might even call this identical. Fortunately, these people are now
- // dead... heh heh.
- //
- // PARAMETERS:
- // nId - ID of string resource holding the format string
- // szFormat - a PCSTR holding the format specifiers
- // argList - a va_list holding the arguments for the format specifiers.
- //
- // RETURN VALUE: None.
- // -------------------------------------------------------------------------
- // formatting (using wsprintf style formatting)
-
- // If they want a Format() function that safely handles string objects
- // without casting
-
-#ifdef SS_SAFE_FORMAT
-
- // Question: Joe, you wacky coder you, why do you have so many overloads
- // of the Format() function
- // Answer: One reason only - CString compatability. In short, by making
- // the Format() function a template this way, I can do strong typing
- // and allow people to pass CStdString arguments as fillers for
- // "%s" format specifiers without crashing their program! The downside
- // is that I need to overload on the number of arguments. If you are
- // passing more arguments than I have listed below in any of my
- // overloads, just add another one.
- //
- // Yes, yes, this is really ugly. In essence what I am doing here is
- // protecting people from a bad (and incorrect) programming practice
- // that they should not be doing anyway. I am protecting them from
- // themselves. Why am I doing this? Well, if you had any idea the
- // number of times I've been emailed by people about this
- // "incompatability" in my code, you wouldn't ask.
-
- void Fmt(const CT* szFmt, ...)
- {
- va_list argList;
- va_start(argList, szFmt);
- FormatV(szFmt, argList);
- va_end(argList);
- }
-
-#ifndef SS_ANSI
-
- void Format(UINT nId)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- this->swap(strFmt);
- }
- template<class A1>
- void Format(UINT nId, const A1& v)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- Fmt(strFmt, FmtArg<A1>(v)());
- }
- template<class A1, class A2>
- void Format(UINT nId, const A1& v1, const A2& v2)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)());
- }
- template<class A1, class A2, class A3>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)());
- }
- }
- template<class A1, class A2, class A3, class A4>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(),FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(),FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(),FmtArg<A10>(v10)(),FmtArg<A11>(v11)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(), FmtArg<A13>(v13)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(), FmtArg<A13>(v13)(),FmtArg<A14>(v14)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15, class A16>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15,
- const A16& v16)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)(), FmtArg<A16>(v16)());
- }
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15, class A16, class A17>
- void Format(UINT nId, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15,
- const A16& v16, const A17& v17)
- {
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- {
- Fmt(strFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)(),FmtArg<A16>(v16)(),FmtArg<A17>(v17)());
- }
- }
-
-#endif // #ifndef SS_ANSI
-
- // ...now the other overload of Format: the one that takes a string literal
-
- void Format(const CT* szFmt)
- {
- *this = szFmt;
- }
- template<class A1>
- void Format(const CT* szFmt, const A1& v)
- {
- Fmt(szFmt, FmtArg<A1>(v)());
- }
- template<class A1, class A2>
- void Format(const CT* szFmt, const A1& v1, const A2& v2)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)());
- }
- template<class A1, class A2, class A3>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)());
- }
- template<class A1, class A2, class A3, class A4>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)());
- }
- template<class A1, class A2, class A3, class A4, class A5>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(),FmtArg<A10>(v10)(),FmtArg<A11>(v11)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(), FmtArg<A13>(v13)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(), FmtArg<A13>(v13)(),FmtArg<A14>(v14)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15, class A16>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15,
- const A16& v16)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)(), FmtArg<A16>(v16)());
- }
- template<class A1, class A2, class A3, class A4, class A5, class A6,
- class A7, class A8, class A9, class A10, class A11, class A12,
- class A13, class A14, class A15, class A16, class A17>
- void Format(const CT* szFmt, const A1& v1, const A2& v2, const A3& v3,
- const A4& v4, const A5& v5, const A6& v6, const A7& v7,
- const A8& v8, const A9& v9, const A10& v10, const A11& v11,
- const A12& v12, const A13& v13, const A14& v14, const A15& v15,
- const A16& v16, const A17& v17)
- {
- Fmt(szFmt, FmtArg<A1>(v1)(), FmtArg<A2>(v2)(),
- FmtArg<A3>(v3)(), FmtArg<A4>(v4)(), FmtArg<A5>(v5)(),
- FmtArg<A6>(v6)(), FmtArg<A7>(v7)(), FmtArg<A8>(v8)(),
- FmtArg<A9>(v9)(), FmtArg<A10>(v10)(),FmtArg<A11>(v11)(),
- FmtArg<A12>(v12)(),FmtArg<A13>(v13)(),FmtArg<A14>(v14)(),
- FmtArg<A15>(v15)(),FmtArg<A16>(v16)(),FmtArg<A17>(v17)());
- }
-
-#else // #ifdef SS_SAFE_FORMAT
-
-
-#ifndef SS_ANSI
-
- void Format(UINT nId, ...)
- {
- va_list argList;
- va_start(argList, nId);
-
- MYTYPE strFmt;
- if ( strFmt.Load(nId) )
- FormatV(strFmt, argList);
-
- va_end(argList);
- }
-
-#endif // #ifdef SS_ANSI
-
- void Format(const CT* szFmt, ...)
- {
- va_list argList;
- va_start(argList, szFmt);
- FormatV(szFmt, argList);
- va_end(argList);
- }
-
-#endif // #ifdef SS_SAFE_FORMAT
-
void AppendFormat(const CT* szFmt, ...)
{
va_list argList;
}
if (!i)
- strLabel.Format("%.0lf %cB ", s, prefixes[i]);
+ strLabel = StringUtils::Format("%.0lf %cB ", s, prefixes[i]);
else if (s >= 100.0)
- strLabel.Format("%.1lf %cB", s, prefixes[i]);
+ strLabel = StringUtils::Format("%.1lf %cB", s, prefixes[i]);
else
- strLabel.Format("%.2lf %cB", s, prefixes[i]);
+ strLabel = StringUtils::Format("%.2lf %cB", s, prefixes[i]);
return strLabel;
}
CStdString CSysInfoJob::GetCPUFreqInfo()
{
- CStdString strCPUFreq;
double CPUFreq = GetCPUFrequency();
- strCPUFreq.Format("%4.2fMHz", CPUFreq);
- return strCPUFreq;
+ return StringUtils::Format("%4.2fMHz", CPUFreq);;
}
CSysData::INTERNET_STATE CSysInfoJob::GetInternetState()
CStdString CSysInfoJob::GetBatteryLevel()
{
- CStdString strVal;
- strVal.Format("%d%%", g_powerManager.BatteryLevel());
- return strVal;
+ return StringUtils::Format("%d%%", g_powerManager.BatteryLevel());
}
double CSysInfoJob::GetCPUFrequency()
SystemUpTime(iInputMinutes,iMinutes, iHours, iDays);
if (iDays > 0)
{
- strSystemUptime.Format("%i %s, %i %s, %i %s",
- iDays,g_localizeStrings.Get(12393),
- iHours,g_localizeStrings.Get(12392),
- iMinutes, g_localizeStrings.Get(12391));
+ strSystemUptime = StringUtils::Format("%i %s, %i %s, %i %s",
+ iDays, g_localizeStrings.Get(12393).c_str(),
+ iHours, g_localizeStrings.Get(12392).c_str(),
+ iMinutes, g_localizeStrings.Get(12391).c_str());
}
else if (iDays == 0 && iHours >= 1 )
{
- strSystemUptime.Format("%i %s, %i %s",
- iHours,g_localizeStrings.Get(12392),
- iMinutes, g_localizeStrings.Get(12391));
+ strSystemUptime = StringUtils::Format("%i %s, %i %s",
+ iHours, g_localizeStrings.Get(12392).c_str(),
+ iMinutes, g_localizeStrings.Get(12391).c_str());
}
else if (iDays == 0 && iHours == 0 && iMinutes >= 0)
{
- strSystemUptime.Format("%i %s",
- iMinutes, g_localizeStrings.Get(12391));
+ strSystemUptime = StringUtils::Format("%i %s",
+ iMinutes, g_localizeStrings.Get(12391).c_str());
}
return strSystemUptime;
}
struct utsname un;
if (uname(&un)==0)
{
- CStdString strKernel;
- strKernel.Format("%s %s %s %s", un.sysname, un.release, un.version, un.machine);
- return strKernel;
+ return StringUtils::Format("%s %s %s %s", un.sysname, un.release, un.version, un.machine);;
}
return "";
switch(drive)
{
case SYSTEM_FREE_SPACE:
- strRet.Format("%i MB %s", totalFree, g_localizeStrings.Get(160));
+ strRet = StringUtils::Format("%i MB %s", totalFree, g_localizeStrings.Get(160).c_str());
break;
case SYSTEM_USED_SPACE:
- strRet.Format("%i MB %s", totalUsed, g_localizeStrings.Get(20162));
+ strRet = StringUtils::Format("%i MB %s", totalUsed, g_localizeStrings.Get(20162).c_str());
break;
case SYSTEM_TOTAL_SPACE:
- strRet.Format("%i MB %s", total, g_localizeStrings.Get(20161));
+ strRet = StringUtils::Format("%i MB %s", total, g_localizeStrings.Get(20161).c_str());
break;
case SYSTEM_FREE_SPACE_PERCENT:
- strRet.Format("%i %% %s", percentFree, g_localizeStrings.Get(160));
+ strRet = StringUtils::Format("%i %% %s", percentFree, g_localizeStrings.Get(160).c_str());
break;
case SYSTEM_USED_SPACE_PERCENT:
- strRet.Format("%i %% %s", percentused, g_localizeStrings.Get(20162));
+ strRet = StringUtils::Format("%i %% %s", percentused, g_localizeStrings.Get(20162).c_str());
break;
}
}
CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
CLog::Log(LOGDEBUG, "%s - WARNING: Zaping Failed no Zap Point found!", __FUNCTION__);
CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__);
- CStdString strText;
- strText.Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel());
+ CStdString strText = StringUtils::Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel().c_str());
CGUIDialogOK::ShowAndGetInput(21331, strText, 21333, 0);
}
}
}
CLog::Log(LOGDEBUG, "%s - Sending all audio pids: %s%s", __FUNCTION__, strAudioChannelPid.c_str(), strAPids.c_str());
- strVideoStream.Format("0,%s,%s,%s%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str(), strAPids.c_str());
+ strVideoStream = StringUtils::Format("0,%s,%s,%s%s",
+ sStrmInfo.pmt.Left(4).c_str(),
+ sStrmInfo.vpid.Left(4).c_str(),
+ sStrmInfo.apid.Left(4).c_str(),
+ strAPids.c_str());
}
else
- strVideoStream.Format("0,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str());
+ strVideoStream = StringUtils::Format("0,%s,%s,%s",
+ sStrmInfo.pmt.Left(4).c_str(),
+ sStrmInfo.vpid.Left(4).c_str(),
+ sStrmInfo.apid.Left(4).c_str());
}
else
- strVideoStream.Format("0,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), strAudioChannelPid.Left(4).c_str());
+ strVideoStream = StringUtils::Format("0,%s,%s,%s",
+ sStrmInfo.pmt.Left(4).c_str(),
+ sStrmInfo.vpid.Left(4).c_str(),
+ strAudioChannelPid.Left(4).c_str());
CURL streamURL;
streamURL.SetProtocol("http");
if (g_application.m_pPlayer->IsPlaying() && !g_tuxbox.sZapstream.available)
CApplicationMessenger::Get().MediaStop();
- strLabel.Format("%s: %s %s-%s",items.GetLabel().c_str(), sCurSrvData.current_event_date.c_str(),sCurSrvData.current_event_start.c_str(), sCurSrvData.current_event_start.c_str());
- strLabel2.Format("%s", sCurSrvData.current_event_description.c_str());
+ strLabel = StringUtils::Format("%s: %s %s-%s",
+ items.GetLabel().c_str(),
+ sCurSrvData.current_event_date.c_str(),
+ sCurSrvData.current_event_start.c_str(),
+ sCurSrvData.current_event_start.c_str());
+ strLabel2 = StringUtils::Format("%s", sCurSrvData.current_event_description.c_str());
// Set Event details
CStdString strGenre, strTitle;
- strGenre.Format("%s %s - (%s: %s)",g_localizeStrings.Get(143),sCurSrvData.current_event_description, g_localizeStrings.Get(209),sCurSrvData.next_event_description);
- strTitle.Format("%s",sCurSrvData.current_event_details);
+ strGenre = StringUtils::Format("%s %s - (%s: %s)",
+ g_localizeStrings.Get(143).c_str(), sCurSrvData.current_event_description.c_str(),
+ g_localizeStrings.Get(209).c_str(), sCurSrvData.next_event_description.c_str());
+ strTitle = StringUtils::Format("%s", sCurSrvData.current_event_details.c_str());
int iDuration = atoi(sCurSrvData.current_event_duration.c_str());
items.GetVideoInfoTag()->m_genre = StringUtils::Split(strGenre, g_advancedSettings.m_videoItemSeparator); // VIDEOPLAYER_GENRE: current_event_description (Film Name)
while(pService)
{
if(pService->Attribute("name"))
- strName.Format("%s",pService->Attribute("name"));
+ strName = StringUtils::Format("%s", pService->Attribute("name"));
if(pService->Attribute("png"))
- strPng.Format("%s",pService->Attribute("png"));
+ strPng = StringUtils::Format("%s", pService->Attribute("png"));
if(strName.Equals(strServiceName))
{
- strPng.Format("%s%s",piconPath.c_str(), strPng.c_str());
+ strPng = StringUtils::Format("%s%s", piconPath.c_str(), strPng.c_str());
strPng.ToLower();
CLog::Log(LOGDEBUG, "%s %s: Path is: %s", __FUNCTION__,strServiceName.c_str(), strPng.c_str());
return strPng;
if(iMode <0 || iMode >4)
{
- strSubMode.Format("xml/services?mode=0&submode=4");
- strXMLRootString.Format("bouquets");
- strXMLChildString.Format("bouquet");
+ strSubMode = StringUtils::Format("xml/services?mode=0&submode=4");
+ strXMLRootString = StringUtils::Format("bouquets");
+ strXMLChildString = StringUtils::Format("bouquet");
return strSubMode;
}
int iSubMode = CGUIDialogContextMenu::ShowAndGetChoice(choices);
if (iSubMode == 1)
{
- strXMLRootString.Format("services");
- strXMLChildString.Format("service");
+ strXMLRootString = StringUtils::Format("services");
+ strXMLChildString = StringUtils::Format("service");
}
else if (iSubMode == 2)
{
- strXMLRootString.Format("satellites");
- strXMLChildString.Format("satellite");
+ strXMLRootString = StringUtils::Format("satellites");
+ strXMLChildString = StringUtils::Format("satellite");
}
else if (iSubMode == 3)
{
- strXMLRootString.Format("providers");
- strXMLChildString.Format("provider");
+ strXMLRootString = StringUtils::Format("providers");
+ strXMLChildString = StringUtils::Format("provider");
}
else // if (iSubMode == 4 || iSubMode < 0)
{
iSubMode = 4;
- strXMLRootString.Format("bouquets");
- strXMLChildString.Format("bouquet");
+ strXMLRootString = StringUtils::Format("bouquets");
+ strXMLChildString = StringUtils::Format("bouquet");
}
- strSubMode.Format("xml/services?mode=%i&submode=%i",iMode,iSubMode);
+ strSubMode = StringUtils::Format("xml/services?mode=%i&submode=%i",iMode,iSubMode);
return strSubMode;
}
//Input: url/path of share/item file/folder
strTemp = strSubMode.GetAt(ipointSubMode+9);
if(strTemp.Equals("1"))
{
- strXMLRootString.Format("unknowns");
- strXMLChildString.Format("unknown");
+ strXMLRootString = StringUtils::Format("unknowns");
+ strXMLChildString = StringUtils::Format("unknown");
}
else if(strTemp.Equals("2"))
{
- strXMLRootString.Format("satellites");
- strXMLChildString.Format("satellite");
+ strXMLRootString = StringUtils::Format("satellites");
+ strXMLChildString = StringUtils::Format("satellite");
}
else if(strTemp.Equals("3"))
{
- strXMLRootString.Format("providers");
- strXMLChildString.Format("provider");
+ strXMLRootString = StringUtils::Format("providers");
+ strXMLChildString = StringUtils::Format("provider");
}
else if(strTemp.Equals("4"))
{
- strXMLRootString.Format("bouquets");
- strXMLChildString.Format("bouquet");
+ strXMLRootString = StringUtils::Format("bouquets");
+ strXMLChildString = StringUtils::Format("bouquet");
}
}
strUrlPath += "?cache=";
strUrlPath += strBuffer;
- strBuffer.Format("%i", wOptions);
+ strBuffer = StringUtils::Format("%i", wOptions);
strUrlPath += "&flags=";
strUrlPath += strBuffer;
#endif
std::vector<std::string> argv;
argv.push_back(addon->LibPath());
- CStdString strSetting;
- strSetting.Format("%i", m_location);
+ CStdString strSetting = StringUtils::Format("%i", m_location);
argv.push_back(strSetting);
// Download our weather
void CWeatherJob::FormatTemperature(CStdString &text, int temp)
{
CTemperature temperature = CTemperature::CreateFromCelsius(temp);
- text.Format("%.0f", temperature.ToLocale());
+ text = StringUtils::Format("%.0f", temperature.ToLocale());
}
void CWeatherJob::LoadLocalizedToken()
else
{
LocalizeOverviewToken(direction);
- m_info.currentWind.Format(g_localizeStrings.Get(434).c_str(),
- direction, speed, g_langInfo.GetSpeedUnitString().c_str());
+ m_info.currentWind = StringUtils::Format(g_localizeStrings.Get(434).c_str(),
+ direction.c_str(), speed, g_langInfo.GetSpeedUnitString().c_str());
}
- CStdString windspeed;
- windspeed.Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str());
+ CStdString windspeed = StringUtils::Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str());
window->SetProperty("Current.WindSpeed",windspeed);
FormatTemperature(m_info.currentDewPoint,
strtol(window->GetProperty("Current.DewPoint").asString().c_str(),0,10));
if (window->GetProperty("Current.Humidity").asString().empty())
m_info.currentHumidity.clear();
else
- m_info.currentHumidity.Format("%s%%",window->GetProperty("Current.Humidity").asString().c_str());
+ m_info.currentHumidity = StringUtils::Format("%s%%", window->GetProperty("Current.Humidity").asString().c_str());
m_info.location = window->GetProperty("Current.Location").asString();
for (int i=0;i<NUM_DAYS;++i)
{
- CStdString strDay;
- strDay.Format("Day%i.Title",i);
+ CStdString strDay = StringUtils::Format("Day%i.Title",i);
m_info.forecast[i].m_day = window->GetProperty(strDay).asString();
LocalizeOverviewToken(m_info.forecast[i].m_day);
- strDay.Format("Day%i.HighTemp",i);
+ strDay = StringUtils::Format("Day%i.HighTemp",i);
FormatTemperature(m_info.forecast[i].m_high,
strtol(window->GetProperty(strDay).asString().c_str(),0,10));
- strDay.Format("Day%i.LowTemp",i);
+ strDay = StringUtils::Format("Day%i.LowTemp",i);
FormatTemperature(m_info.forecast[i].m_low,
strtol(window->GetProperty(strDay).asString().c_str(),0,10));
- strDay.Format("Day%i.OutlookIcon",i);
+ strDay = StringUtils::Format("Day%i.OutlookIcon",i);
m_info.forecast[i].m_icon = ConstructPath(window->GetProperty(strDay).asString());
- strDay.Format("Day%i.Outlook",i);
+ strDay = StringUtils::Format("Day%i.Outlook",i);
m_info.forecast[i].m_overview = window->GetProperty(strDay).asString();
LocalizeOverview(m_info.forecast[i].m_overview);
}
CGUIWindow* window = g_windowManager.GetWindow(WINDOW_WEATHER);
if (window)
{
- CStdString setting;
- setting.Format("Location%i", iLocation);
+ CStdString setting = StringUtils::Format("Location%i", iLocation);
return window->GetProperty(setting).asString();
}
return "";
void XMLUtils::SetInt(TiXmlNode* pRootNode, const char *strTag, int value)
{
- CStdString strValue;
- strValue.Format("%i", value);
+ CStdString strValue = StringUtils::Format("%i", value);
SetString(pRootNode, strTag, strValue);
}
void XMLUtils::SetLong(TiXmlNode* pRootNode, const char *strTag, long value)
{
- CStdString strValue;
- strValue.Format("%ld", value);
+ CStdString strValue = StringUtils::Format("%ld", value);
SetString(pRootNode, strTag, strValue);
}
void XMLUtils::SetFloat(TiXmlNode* pRootNode, const char *strTag, float value)
{
- CStdString strValue;
- strValue.Format("%f", value);
+ CStdString strValue = StringUtils::Format("%f", value);
SetString(pRootNode, strTag, strValue);
}
void XMLUtils::SetHex(TiXmlNode* pRootNode, const char *strTag, uint32_t value)
{
- CStdString strValue;
- strValue.Format("%x", value);
+ CStdString strValue = StringUtils::Format("%x", value);
SetString(pRootNode, strTag, strValue);
}
#include "threads/SingleLock.h"
#include "threads/Thread.h"
#include "utils/StdString.h"
+#include "utils/StringUtils.h"
#if defined(TARGET_ANDROID)
#include "android/activity/XBMCApp.h"
#elif defined(TARGET_WINDOWS)
}
else if (m_repeatCount)
{
- CStdString strData2;
- strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), levelNames[m_repeatLogLevel]);
+ strPrefix = StringUtils::Format(prefixFormat,
+ time.wHour,
+ time.wMinute,
+ time.wSecond,
+ (uint64_t)CThread::GetCurrentThreadId(),
+ levelNames[m_repeatLogLevel]);
- strData2.Format("Previous line repeats %d times." LINE_ENDING, m_repeatCount);
+ CStdString strData2 = StringUtils::Format("Previous line repeats %d times."
+ LINE_ENDING,
+ m_repeatCount);
fputs(strPrefix.c_str(), m_file);
fputs(strData2.c_str(), m_file);
OutputDebugString(strData2);
strData.Replace("\n", LINE_ENDING" ");
strData += LINE_ENDING;
- strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, (uint64_t)CThread::GetCurrentThreadId(), levelNames[loglevel]);
+ strPrefix = StringUtils::Format(prefixFormat,
+ time.wHour,
+ time.wMinute,
+ time.wSecond,
+ (uint64_t)CThread::GetCurrentThreadId(),
+ levelNames[loglevel]);
//print to adb
#if defined(TARGET_ANDROID) && defined(_DEBUG)
{
// the log folder location is initialized in the CAdvancedSettings
// constructor and changed in CApplication::Create()
- CStdString strLogFile, strLogFileOld;
-
- strLogFile.Format("%sxbmc.log", path);
- strLogFileOld.Format("%sxbmc.old.log", path);
+ CStdString strLogFile = StringUtils::Format("%sxbmc.log", path);
+ CStdString strLogFileOld = StringUtils::Format("%sxbmc.old.log", path);
#if defined(TARGET_WINDOWS)
// the appdata folder might be redirected to an unc share
Log(LOGDEBUG, "MEM_DUMP: Dumping from %p", pData);
for (int i = 0; i < length; i+=16)
{
- CStdString strLine;
- strLine.Format("MEM_DUMP: %04x ", i);
+ CStdString strLine = StringUtils::Format("MEM_DUMP: %04x ", i);
char *alpha = pData;
for (int k=0; k < 4 && i + 4*k < length; k++)
{
for (int j=0; j < 4 && i + 4*k + j < length; j++)
{
- CStdString strFormat;
- strFormat.Format(" %02x", (unsigned char)*pData++);
+ CStdString strFormat = StringUtils::Format(" %02x", (unsigned char)*pData++);
strLine += strFormat;
}
strLine += " ";
*/
#include "md5.h"
+#include "utils/StringUtils.h"
typedef unsigned char md5byte;
{
unsigned char szBuf[16] = {'\0'};
getDigest(szBuf);
- digest.Format("%02X%02X%02X%02X%02X%02X%02X%02X"\
- "%02X%02X%02X%02X%02X%02X%02X%02X", szBuf[0], szBuf[1], szBuf[2],
- szBuf[3], szBuf[4], szBuf[5], szBuf[6], szBuf[7], szBuf[8],
- szBuf[9], szBuf[10], szBuf[11], szBuf[12], szBuf[13], szBuf[14],
- szBuf[15]);
+ digest = StringUtils::Format("%02X%02X%02X%02X%02X%02X%02X%02X"\
+ "%02X%02X%02X%02X%02X%02X%02X%02X",
+ szBuf[0], szBuf[1], szBuf[2],
+ szBuf[3], szBuf[4], szBuf[5], szBuf[6], szBuf[7], szBuf[8],
+ szBuf[9], szBuf[10], szBuf[11], szBuf[12], szBuf[13], szBuf[14],
+ szBuf[15]);
}
CStdString XBMC::XBMC_MD5::GetMD5(const CStdString &text)
#include "music/MusicDatabase.h"
#include "dbwrappers/qry_dat.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include "gtest/gtest.h"
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_RUNTIME);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_RUNTIME);
varstr = DatabaseUtils::GetField(FieldTime, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_DIRECTOR);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_DIRECTOR);
varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_STUDIOS);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_STUDIOS);
varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_YEAR);
varstr = DatabaseUtils::GetField(FieldYear, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_PLOT);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_PLOT);
varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
varstr = DatabaseUtils::GetField(FieldAlbum, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ARTIST);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_ARTIST);
varstr = DatabaseUtils::GetField(FieldArtist, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_GENRE);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_GENRE);
varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TRACK);
+ refstr = StringUtils::Format("musicvideoview.c%02d",VIDEODB_ID_MUSICVIDEO_TRACK);
varstr = DatabaseUtils::GetField(FieldTrackNumber, MediaTypeMusicVideo,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_TITLE);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d "
+ refstr = StringUtils::Format("CASE WHEN length(movieview.c%02d) > 0 THEN movieview.c%02d "
"ELSE movieview.c%02d END", VIDEODB_ID_SORTTITLE,
VIDEODB_ID_SORTTITLE, VIDEODB_ID_TITLE, VIDEODB_ID_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeMovie,
DatabaseQueryPartOrderBy);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_PLOT);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOT);
varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_PLOTOUTLINE);
varstr = DatabaseUtils::GetField(FieldPlotOutline, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TAGLINE);
varstr = DatabaseUtils::GetField(FieldTagline, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_VOTES);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_VOTES);
varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_RATING);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RATING);
varstr = DatabaseUtils::GetField(FieldRating, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
+ refstr = StringUtils::Format("CAST(movieview.c%02d as DECIMAL(5,3))", VIDEODB_ID_RATING);
varstr = DatabaseUtils::GetField(FieldRating, MediaTypeMovie,
DatabaseQueryPartOrderBy);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_CREDITS);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_CREDITS);
varstr = DatabaseUtils::GetField(FieldWriter, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_YEAR);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_YEAR);
varstr = DatabaseUtils::GetField(FieldYear, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_SORTTITLE);
varstr = DatabaseUtils::GetField(FieldSortTitle, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_RUNTIME);
varstr = DatabaseUtils::GetField(FieldTime, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_MPAA);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_MPAA);
varstr = DatabaseUtils::GetField(FieldMPAA, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_TOP250);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TOP250);
varstr = DatabaseUtils::GetField(FieldTop250, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_GENRE);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_GENRE);
varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_DIRECTOR);
varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_STUDIOS);
varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_TRAILER);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_TRAILER);
varstr = DatabaseUtils::GetField(FieldTrailer, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
+ refstr = StringUtils::Format("movieview.c%02d", VIDEODB_ID_COUNTRY);
varstr = DatabaseUtils::GetField(FieldCountry, MediaTypeMovie,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d "
+ refstr = StringUtils::Format("CASE WHEN length(tvshowview.c%02d) > 0 THEN tvshowview.c%02d "
"ELSE tvshowview.c%02d END", VIDEODB_ID_TV_SORTTITLE,
VIDEODB_ID_TV_SORTTITLE, VIDEODB_ID_TV_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeTvShow,
DatabaseQueryPartOrderBy);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PLOT);
varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STATUS);
varstr = DatabaseUtils::GetField(FieldTvShowStatus, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_VOTES);
varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_RATING);
varstr = DatabaseUtils::GetField(FieldRating, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_PREMIERED);
varstr = DatabaseUtils::GetField(FieldYear, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_GENRE);
varstr = DatabaseUtils::GetField(FieldGenre, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_MPAA);
varstr = DatabaseUtils::GetField(FieldMPAA, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_STUDIOS);
varstr = DatabaseUtils::GetField(FieldStudio, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
+ refstr = StringUtils::Format("tvshowview.c%02d", VIDEODB_ID_TV_SORTTITLE);
varstr = DatabaseUtils::GetField(FieldSortTitle, MediaTypeTvShow,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_TITLE);
varstr = DatabaseUtils::GetField(FieldTitle, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_PLOT);
varstr = DatabaseUtils::GetField(FieldPlot, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_VOTES);
varstr = DatabaseUtils::GetField(FieldVotes, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RATING);
varstr = DatabaseUtils::GetField(FieldRating, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_CREDITS);
varstr = DatabaseUtils::GetField(FieldWriter, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_AIRED);
varstr = DatabaseUtils::GetField(FieldAirDate, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_RUNTIME);
varstr = DatabaseUtils::GetField(FieldTime, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_DIRECTOR);
varstr = DatabaseUtils::GetField(FieldDirector, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_SEASON);
varstr = DatabaseUtils::GetField(FieldSeason, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
- refstr.Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
+ refstr = StringUtils::Format("episodeview.c%02d", VIDEODB_ID_EPISODE_EPISODE);
varstr = DatabaseUtils::GetField(FieldEpisodeNumber, MediaTypeEpisode,
DatabaseQueryPartSelect);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
*/
#include "utils/XMLUtils.h"
+#include "utils/StringUtils.h"
#include "XBDateTime.h"
#include "gtest/gtest.h"
EXPECT_TRUE(XMLUtils::GetDouble(a.RootElement(), "node", val));
refstr = "1000.100000";
- valstr.Format("%f", val);
+ valstr = StringUtils::Format("%f", val);
EXPECT_STREQ(refstr.c_str(), valstr.c_str());
}
#include "utils/fft.h"
#include "utils/StdString.h"
+#include "utils/StringUtils.h"
#include "gtest/gtest.h"
/* To more consistently test the resulting floating point numbers, they
* are converted to strings and the strings are tested for equality.
*/
- refstr.Format("%.6f", reffftdata[i]);
- varstr.Format("%.6f", vardata[i]);
+ refstr = StringUtils::Format("%.6f", reffftdata[i]);
+ varstr = StringUtils::Format("%.6f", vardata[i]);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
}
}
fft(vardata, REFDATA_NUMELEMENTS/2, -1);
for (i = 0; i < REFDATA_NUMELEMENTS; i++)
{
- refstr.Format("%.6f", reffftinversedata[i]);
- varstr.Format("%.6f", vardata[i]);
+ refstr = StringUtils::Format("%.6f", reffftinversedata[i]);
+ varstr = StringUtils::Format("%.6f", vardata[i]);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
}
}
twochannelrfft(vardata, REFDATA_NUMELEMENTS/2);
for (i = 0; i < REFDATA_NUMELEMENTS; i++)
{
- refstr.Format("%.6f", reftwochannelrfftdata[i]);
- varstr.Format("%.6f", vardata[i]);
+ refstr = StringUtils::Format("%.6f", reftwochannelrfftdata[i]);
+ varstr = StringUtils::Format("%.6f", vardata[i]);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
}
}
twochanwithwindow(vardata, REFDATA_NUMELEMENTS/2);
for (i = 0; i < REFDATA_NUMELEMENTS; i++)
{
- refstr.Format("%.6f", reftwochanwithwindowdata[i]);
- varstr.Format("%.6f", vardata[i]);
+ refstr = StringUtils::Format("%.6f", reftwochanwithwindowdata[i]);
+ varstr = StringUtils::Format("%.6f", vardata[i]);
EXPECT_STREQ(refstr.c_str(), varstr.c_str());
}
}
#include "utils/fstrcmp.h"
#include "utils/StdString.h"
+#include "utils/StringUtils.h"
#include "gtest/gtest.h"
/* NOTE: Third parameter is not used at all in fstrcmp. */
refresult = "1.000000";
- varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+ varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
EXPECT_STREQ(refresult.c_str(), varresult.c_str());
varstr = "Testfstrcmp_test_string";
refresult = "0.913043";
- varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+ varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
EXPECT_STREQ(refresult.c_str(), varresult.c_str());
varstr = "";
refresult = "0.000000";
- varresult.Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
+ varresult = StringUtils::Format("%.6f", fstrcmp(refstr.c_str(), varstr.c_str(), 0.0));
EXPECT_STREQ(refresult.c_str(), varresult.c_str());
}
#endif
#include "Application.h"
#include "utils/LangCodeExpander.h"
+#include "utils/StringUtils.h"
CPlayerController::CPlayerController()
{
if (info.name.length() == 0)
sub = lang;
else
- sub.Format("%s - %s", lang.c_str(), info.name.c_str());
+ sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str());
}
else
sub = g_localizeStrings.Get(1223);
if (info.name.length() == 0)
sub = lang;
else
- sub.Format("%s - %s", lang.c_str(), info.name.c_str());
+ sub = StringUtils::Format("%s - %s", lang.c_str(), info.name.c_str());
}
else
sub = g_localizeStrings.Get(1223);
if (info.name.empty())
aud = lan;
else
- aud.Format("%s - %s", lan.c_str(), info.name.c_str());
+ aud = StringUtils::Format("%s - %s", lan.c_str(), info.name.c_str());
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime);
return true;
}
m_sliderAction == ACTION_VSHIFT_UP || m_sliderAction == ACTION_VSHIFT_DOWN ||
m_sliderAction == ACTION_SUBTITLE_VSHIFT_UP || m_sliderAction == ACTION_SUBTITLE_VSHIFT_DOWN)
{
- CStdString strValue;
- strValue.Format("%1.2f",slider->GetFloatValue());
+ CStdString strValue = StringUtils::Format("%1.2f",slider->GetFloatValue());
slider->SetTextValue(strValue);
}
else if (m_sliderAction == ACTION_VOLAMP_UP || m_sliderAction == ACTION_VOLAMP_DOWN)
CLog::Log(LOGINFO, "create movie table");
CStdString columns = "CREATE TABLE movie ( idMovie integer primary key, idFile integer";
+
for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- {
- CStdString column;
- column.Format(",c%02d text", i);
- columns += column;
- }
+ columns += StringUtils::Format(",c%02d text", i);
+
columns += ", idSet integer)";
m_pDS->exec(columns.c_str());
m_pDS->exec("CREATE UNIQUE INDEX ix_movie_file_1 ON movie (idFile, idMovie)");
CLog::Log(LOGINFO, "create tvshow table");
columns = "CREATE TABLE tvshow ( idShow integer primary key";
+
for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- {
- CStdString column;
- column.Format(",c%02d text", i);
- columns += column;
- }
+ columns += StringUtils::Format(",c%02d text", i);;
+
columns += ")";
m_pDS->exec(columns.c_str());
{
CStdString column;
if ( i == VIDEODB_ID_EPISODE_SEASON || i == VIDEODB_ID_EPISODE_EPISODE || i == VIDEODB_ID_EPISODE_BOOKMARK)
- column.Format(",c%02d varchar(24)", i);
+ column = StringUtils::Format(",c%02d varchar(24)", i);
else
- column.Format(",c%02d text", i);
+ column = StringUtils::Format(",c%02d text", i);
columns += column;
}
m_pDS->exec(columns.c_str());
m_pDS->exec("CREATE UNIQUE INDEX ix_episode_file_1 on episode (idEpisode, idFile)");
m_pDS->exec("CREATE UNIQUE INDEX id_episode_file_2 on episode (idFile, idEpisode)");
- CStdString createColIndex;
- createColIndex.Format("CREATE INDEX ix_episode_season_episode on episode (c%02d, c%02d)", VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_EPISODE);
+ CStdString createColIndex = StringUtils::Format("CREATE INDEX ix_episode_season_episode on episode (c%02d, c%02d)", VIDEODB_ID_EPISODE_SEASON, VIDEODB_ID_EPISODE_EPISODE);
m_pDS->exec(createColIndex.c_str());
- createColIndex.Format("CREATE INDEX ix_episode_bookmark on episode (c%02d)", VIDEODB_ID_EPISODE_BOOKMARK);
+ createColIndex = StringUtils::Format("CREATE INDEX ix_episode_bookmark on episode (c%02d)", VIDEODB_ID_EPISODE_BOOKMARK);
m_pDS->exec(createColIndex.c_str());
m_pDS->exec("CREATE INDEX ix_episode_show1 on episode(idEpisode,idShow)");
m_pDS->exec("CREATE INDEX ix_episode_show2 on episode(idShow,idEpisode)");
CLog::Log(LOGINFO, "create musicvideo table");
columns = "CREATE TABLE musicvideo ( idMVideo integer primary key, idFile integer";
for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- {
- CStdString column;
- column.Format(",c%02d text", i);
- columns += column;
- }
+ columns += StringUtils::Format(",c%02d text", i);;
+
columns += ")";
m_pDS->exec(columns.c_str());
strSQL = "update tvshow set ";
for (int iType = VIDEODB_ID_TV_MIN + 1; iType < VIDEODB_ID_TV_MAX; iType++)
- {
- CStdString column;
- column.Format("c%02d=NULL,", iType);
- strSQL += column;
- }
+ strSQL += StringUtils::Format("c%02d=NULL,", iType);
+
strSQL = strSQL.Mid(0, strSQL.size() - 1) + PrepareSQL(" where idShow=%i", idTvShow);
m_pDS->exec(strSQL.c_str());
}
int idFile = AddFile(strFilenameAndPath);
if (idFile < 0)
return;
- CStdString strSQL;
- strSQL.Format("select * from settings where idFile=%i", idFile);
+ CStdString strSQL = StringUtils::Format("select * from settings where idFile=%i", idFile);
m_pDS->query( strSQL.c_str() );
if (m_pDS->num_rows() > 0)
{
m_pDS->exec( PrepareSQL("delete from stacktimes where idFile=%i", idFile) );
// add the items
- CStdString timeString;
- timeString.Format("%i", times[0]);
+ CStdString timeString = StringUtils::Format("%i", times[0]);
for (unsigned int i = 1; i < times.size(); i++)
- {
- CStdString time;
- time.Format(",%i", times[i]);
- timeString += time;
- }
+ timeString += StringUtils::Format(",%i", times[i]);
+
m_pDS->exec( PrepareSQL("insert into stacktimes (idFile,times) values (%i,'%s')\n", idFile, timeString.c_str()) );
}
catch (...)
// content columns
CStdStringArray c_columns;
for (int i = 0; i < 22; i++)
- {
- CStdString c;
- c.Format("c%02d", i);
- c_columns.push_back(c);
- }
+ c_columns.push_back(StringUtils::Format("c%02d", i));
tables.insert(pair<CStdString, CStdStringArray> ("episode", c_columns));
tables.insert(pair<CStdString, CStdStringArray> ("movie", c_columns));
extFilter.group.clear();
extFilter.order.clear();
}
- strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+ strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
CVideoDbUrl videoUrl;
if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
pItem->GetVideoInfoTag()->m_type = type;
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", it->first);
+ CStdString path = StringUtils::Format("%ld/", it->first);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
pItem->GetVideoInfoTag()->m_type = type;
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("%ld/", m_pDS->fv(0).get_asInt());
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
extFilter.group.clear();
extFilter.order.clear();
}
- strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+ strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
// parse the base path to get additional filters
CVideoDbUrl videoUrl;
pItem->GetVideoInfoTag()->m_type = "tag";
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", idTag);
+ CStdString path = StringUtils::Format("%ld/", idTag);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
extFilter.group.clear();
extFilter.order.clear();
}
- strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+ strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
CVideoDbUrl videoUrl;
if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
CFileItemPtr pItem(new CFileItem(it->second.first));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", it->first);
+ CStdString path = StringUtils::Format("%ld/", it->first);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
CFileItemPtr pItem(new CFileItem(m_pDS->fv(0).get_asString()));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", m_pDS->fv(1).get_asInt());
+ CStdString path = StringUtils::Format("%ld/", m_pDS->fv(1).get_asInt());
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
extFilter.group.clear();
extFilter.order.clear();
}
- strSQL.Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
+ strSQL = StringUtils::Format(strSQL.c_str(), !extFilter.fields.empty() ? extFilter.fields.c_str() : "*");
CVideoDbUrl videoUrl;
if (!BuildSQL(strBaseDir, strSQL, extFilter, strSQL, videoUrl))
CFileItemPtr pItem(new CFileItem(it->second.name));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", it->first);
+ CStdString path = StringUtils::Format("%ld/", it->first);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("%ld/", m_pDS->fv(0).get_asInt());
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
// check path
if (g_passwordManager.IsDatabasePathUnlocked(CStdString(m_pDS->fv("path.strPath").get_asString()),*CMediaSourceSettings::Get().GetSources("video")))
{
- CStdString year;
- year.Format("%d", lYear);
+ CStdString year = StringUtils::Format("%d", lYear);
if (idContent == VIDEODB_CONTENT_MOVIES || idContent == VIDEODB_CONTENT_MUSICVIDEOS)
mapYears.insert(pair<int, pair<CStdString,int> >(lYear, pair<CStdString,int>(year,m_pDS->fv(2).get_asInt())));
else
CFileItemPtr pItem(new CFileItem(it->second.first));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", it->first);
+ CStdString path = StringUtils::Format("%ld/", it->first);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
CDateTime time;
time.SetFromDateString(m_pDS->fv(0).get_asString());
lYear = time.GetYear();
- strLabel.Format("%i",lYear);
+ strLabel = StringUtils::Format("%i",lYear);
}
else if (idContent == VIDEODB_CONTENT_MOVIES || idContent == VIDEODB_CONTENT_MUSICVIDEOS)
{
CFileItemPtr pItem(new CFileItem(strLabel));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", lYear);
+ CStdString path = StringUtils::Format("%ld/", lYear);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
if (iSeason == 0)
strLabel = g_localizeStrings.Get(20381);
else
- strLabel.Format(g_localizeStrings.Get(20358),iSeason);
+ strLabel = StringUtils::Format(g_localizeStrings.Get(20358), iSeason);
CFileItemPtr pItem(new CFileItem(strLabel));
CVideoDbUrl itemUrl = videoUrl;
- CStdString strDir; strDir.Format("%ld/", it->first);
+ CStdString strDir = StringUtils::Format("%ld/", it->first);
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
if (iSeason == 0)
strLabel = g_localizeStrings.Get(20381);
else
- strLabel.Format(g_localizeStrings.Get(20358),iSeason);
+ strLabel = StringUtils::Format(g_localizeStrings.Get(20358), iSeason);
CFileItemPtr pItem(new CFileItem(strLabel));
CVideoDbUrl itemUrl = videoUrl;
- CStdString strDir; strDir.Format("%ld/", iSeason);
+ CStdString strDir = StringUtils::Format("%ld/", iSeason);
itemUrl.AppendPath(strDir);
pItem->SetPath(itemUrl.ToString());
if (itemType.Equals("genres"))
return GetGenreById(id);
else if (itemType.Equals("years"))
- {
- CStdString tmp; tmp.Format("%d", id);
- return tmp;
- }
+ return StringUtils::Format("%d", id);
else if (itemType.Equals("actors") || itemType.Equals("directors") || itemType.Equals("artists"))
return GetPersonById(id);
else if (itemType.Equals("studios"))
CFileItemPtr pItem(new CFileItem(movie));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld", movie.m_iDbId);
+ CStdString path = StringUtils::Format("%ld", movie.m_iDbId);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
CFileItemPtr pItem(new CFileItem(movie));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld/", record->at(0).get_asInt());
+ CStdString path = StringUtils::Format("%ld/", record->at(0).get_asInt());
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
CVideoDbUrl itemUrl = videoUrl;
CStdString path;
if (appendFullShowPath && videoUrl.GetItemType() != "episodes")
- path.Format("%ld/%ld/%ld", record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(), movie.m_iSeason, idEpisode);
+ path = StringUtils::Format("%ld/%ld/%ld", record->at(VIDEODB_DETAILS_EPISODE_TVSHOW_ID).get_asInt(), movie.m_iSeason, idEpisode);
else
- path.Format("%ld", idEpisode);
+ path = StringUtils::Format("%ld", idEpisode);
itemUrl.AppendPath(path);
pItem->SetPath(itemUrl.ToString());
if (NULL == m_pDB.get()) return 0;
if (NULL == m_pDS.get()) return 0;
- CStdString strSQL;
- strSQL.Format("select count(1) as nummovies from musicvideoview where %s",strWhere.c_str());
+ CStdString strSQL = StringUtils::Format("select count(1) as nummovies from musicvideoview where %s",strWhere.c_str());
m_pDS->query( strSQL.c_str() );
int iResult = 0;
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
pItem->SetPath("videodb://movies/genres/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("country.strCountry").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("country.idCountry").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("country.idCountry").get_asInt());
pItem->SetPath("videodb://movies/genres/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
pItem->SetPath("videodb://tvshows/genres/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
pItem->SetPath("videodb://movies/actors/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
pItem->SetPath("videodb://tvshows/actors/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("actors.idActor").get_asInt());
pItem->SetPath("videodb://musicvideos/artists/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv("genre.strGenre").get_asString()));
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("genre.idGenre").get_asInt());
pItem->SetPath("videodb://musicvideos/genres/"+ strDir);
pItem->m_bIsFolder=true;
items.Add(pItem);
CStdString strLike;
if (!strSearch.IsEmpty())
{
- strLike.Format("and musicvideo.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
+ strLike = StringUtils::Format("and musicvideo.c%02d",VIDEODB_ID_MUSICVIDEO_ALBUM);
strLike += "like '%%s%%%'";
}
if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(0).get_asString()));
- CStdString strDir;
- strDir.Format("%ld", m_pDS->fv(1).get_asInt());
+ CStdString strDir = StringUtils::Format("%ld", m_pDS->fv(1).get_asInt());
pItem->SetPath("videodb://musicvideos/titles/"+ strDir);
pItem->m_bIsFolder=false;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" - "+m_pDS->fv(2).get_asString()));
- CStdString strDir;
- strDir.Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
+ CStdString strDir = StringUtils::Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
pItem->SetPath("videodb://"+ strDir);
pItem->m_bIsFolder=false;
CFileItemPtr item(new CFileItem(musicvideo));
CVideoDbUrl itemUrl = videoUrl;
- CStdString path; path.Format("%ld", record->at(0).get_asInt());
+ CStdString path = StringUtils::Format("%ld", record->at(0).get_asInt());
itemUrl.AppendPath(path);
item->SetPath(itemUrl.ToString());
if (NULL == m_pDS.get()) return false;
// We don't use PrepareSQL here, as the WHERE clause is already formatted.
- CStdString strSQL;
- strSQL.Format("select * from musicvideoview where %s",strWhere.c_str());
+ CStdString strSQL = StringUtils::Format("select * from musicvideoview where %s", strWhere.c_str());
strSQL += PrepareSQL(" order by RANDOM() limit 1");
CLog::Log(LOGDEBUG, "%s query = %s", __FUNCTION__, strSQL.c_str());
// run query
return false;
}
*item->GetVideoInfoTag() = GetDetailsForMusicVideo(m_pDS);
- CStdString path; path.Format("videodb://musicvideos/titles/%ld",item->GetVideoInfoTag()->m_iDbId);
+ CStdString path = StringUtils::Format("videodb://musicvideos/titles/%ld",item->GetVideoInfoTag()->m_iDbId);
item->SetPath(path);
idSong = m_pDS->fv("idMVideo").get_asInt();
item->SetLabel(item->GetVideoInfoTag()->m_strTitle);
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
CStdString path;
if (setId <= 0 || !CSettings::Get().GetBool("videolibrary.groupmoviesets"))
- path.Format("videodb://movies/titles/%i", movieId);
+ path = StringUtils::Format("videodb://movies/titles/%i", movieId);
else
- path.Format("videodb://movies/sets/%i/%i", setId, movieId);
+ path = StringUtils::Format("videodb://movies/sets/%i/%i", setId, movieId);
pItem->SetPath(path);
pItem->m_bIsFolder=false;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
- CStdString strDir;
- strDir.Format("tvshows/titles/%ld/", m_pDS->fv("tvshow.idShow").get_asInt());
+ CStdString strDir = StringUtils::Format("tvshows/titles/%ld/", m_pDS->fv("tvshow.idShow").get_asInt());
pItem->SetPath("videodb://"+ strDir);
pItem->m_bIsFolder=true;
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")"));
- CStdString path; path.Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
pItem->SetPath(path);
pItem->m_bIsFolder=false;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
- CStdString strDir;
- strDir.Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
+ CStdString strDir = StringUtils::Format("3/2/%ld",m_pDS->fv("musicvideo.idMVideo").get_asInt());
pItem->SetPath("videodb://"+ strDir);
pItem->m_bIsFolder=false;
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()+" ("+m_pDS->fv(4).get_asString()+")"));
- CStdString path; path.Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld",m_pDS->fv("episode.idShow").get_asInt(),m_pDS->fv(2).get_asInt(),m_pDS->fv(0).get_asInt());
pItem->SetPath(path);
pItem->m_bIsFolder=false;
items.Add(pItem);
}
CFileItemPtr pItem(new CFileItem(m_pDS->fv(1).get_asString()));
- CStdString path; path.Format("videodb://movies/titles/%ld", m_pDS->fv(0).get_asInt());
+ CStdString path = StringUtils::Format("videodb://movies/titles/%ld", m_pDS->fv(0).get_asInt());
pItem->SetPath(path);
pItem->m_bIsFolder=false;
continue;
}
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("directorlinkmovie.idDirector").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinkmovie.idDirector").get_asInt());
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
pItem->SetPath("videodb://movies/directors/"+ strDir);
continue;
}
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("directorlinktvshow.idDirector").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinktvshow.idDirector").get_asInt());
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
pItem->SetPath("videodb://tvshows/studios/"+ strDir);
continue;
}
- CStdString strDir;
- strDir.Format("%ld/", m_pDS->fv("directorlinkmusicvideo.idDirector").get_asInt());
+ CStdString strDir = StringUtils::Format("%ld/", m_pDS->fv("directorlinkmusicvideo.idDirector").get_asInt());
CFileItemPtr pItem(new CFileItem(m_pDS->fv("actors.strActor").get_asString()));
pItem->SetPath("videodb://musicvideos/albums/"+ strDir);
}
CLog::Log(LOGDEBUG, "%s: Cleaning path table", __FUNCTION__);
- sql.Format("delete from path where strContent='' and strSettings='' and strHash='' and exclude!=1 "
+ sql = StringUtils::Format("delete from path where strContent='' and strSettings='' and strHash='' and exclude!=1 "
"and idPath not in (select distinct idPath from files) "
"and idPath not in (select distinct idPath from tvshowlinkpath) "
"and idPath not in (select distinct c%02d from movie) "
for (int i = 0; i < episodes.Size(); i++)
{
CVideoInfoTag *tag = episodes[i]->GetVideoInfoTag();
- CStdString episode;
- episode.Format("%s.s%02de%02d.avi", showName.c_str(), tag->m_iSeason, tag->m_iEpisode);
+ CStdString episode = StringUtils::Format("%s.s%02de%02d.avi", showName.c_str(), tag->m_iSeason, tag->m_iEpisode);
// and make a file
CStdString episodePath = URIUtils::AddFileToFolder(TVFolder, episode);
CFile file;
for (int i = 0; i < items.Size(); i++)
{
CVideoInfoTag *tag = items[i]->GetVideoInfoTag();
- CStdString movie;
- movie.Format("%s.avi", tag->m_strTitle.c_str());
+ CStdString movie = StringUtils::Format("%s.avi", tag->m_strTitle.c_str());
CFile file;
if (file.OpenForWrite(URIUtils::AddFileToFolder(moviePath, movie)))
file.Close();
{
if (!singleFiles)
{
- CStdString epName;
- epName.Format("s%02ie%02i.avi", episode.m_iSeason, episode.m_iEpisode);
+ CStdString epName = StringUtils::Format("s%02ie%02i.avi", episode.m_iSeason, episode.m_iEpisode);
item.SetPath(URIUtils::AddFileToFolder(showDir, epName));
}
for (map<string, string>::const_iterator i = artwork.begin(); i != artwork.end(); ++i)
CVideoInfoTag info;
info.Load(episode);
CFileItem item(info);
- CStdString filename;
- filename.Format("s%02ie%02i.avi", info.m_iSeason, info.m_iEpisode);
+ CStdString filename = StringUtils::Format("s%02ie%02i.avi", info.m_iSeason, info.m_iEpisode);
CFileItem artItem(item);
artItem.SetPath(GetSafeFile(artPath, filename));
scanner.GetArtwork(&artItem, CONTENT_MOVIES, useFolders, true, actorsDir);
if (showInfo && content == CONTENT_TVSHOWS)
{
- strTitle.Format("%s - %ix%i - %s", showInfo->m_strTitle.c_str(), movieDetails.m_iSeason, movieDetails.m_iEpisode, strTitle.c_str());
+ strTitle = StringUtils::Format("%s - %ix%i - %s", showInfo->m_strTitle.c_str(), movieDetails.m_iSeason, movieDetails.m_iEpisode, strTitle.c_str());
}
std::string redactPath = pItem->GetPath();
if (!time)
time = buffer.st_ctime;
if (time)
- {
- CStdString hash;
- hash.Format("fast%"PRId64, time);
- return hash;
- }
+ return StringUtils::Format("fast%"PRId64, time);
}
return "";
}
{
CStdString character;
if (it->strRole.IsEmpty() || !bIncludeRole)
- character.Format("%s\n", it->strName.c_str());
+ character = StringUtils::Format("%s\n", it->strName.c_str());
else
- character.Format("%s %s %s\n", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
+ character = StringUtils::Format("%s %s %s\n", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
strLabel += character;
}
return strLabel.TrimRight("\n");
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/IPlayer.h"
#include "utils/LangCodeExpander.h"
+#include "utils/StringUtils.h"
using namespace std;
using namespace XFILE;
if (info.name.length() == 0)
strItem = strLanguage;
else
- strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
+ strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str());
strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1);
setting.entry.push_back(make_pair(setting.entry.size(), strItem));
if (info.name.length() == 0)
strItem = strLanguage;
else
- strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
+ strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str());
strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1);
CStdString CGUIDialogAudioSubtitleSettings::PercentAsDecibel(float value, float interval)
{
- CStdString text;
- text.Format("%2.1f dB", CAEUtil::PercentToGain(value));
- return text;
+ return StringUtils::Format("%2.1f dB", CAEUtil::PercentToGain(value));;
}
CStdString CGUIDialogAudioSubtitleSettings::FormatDecibel(float value, float interval)
{
- CStdString text;
- text.Format("%2.1f dB", value);
- return text;
+ return StringUtils::Format("%2.1f dB", value);;
}
CStdString CGUIDialogAudioSubtitleSettings::FormatDelay(float value, float interval)
{
CStdString text;
if (fabs(value) < 0.5f*interval)
- text.Format(g_localizeStrings.Get(22003).c_str(), 0.0);
+ text = StringUtils::Format(g_localizeStrings.Get(22003).c_str(), 0.0);
else if (value < 0)
- text.Format(g_localizeStrings.Get(22004).c_str(), fabs(value));
+ text = StringUtils::Format(g_localizeStrings.Get(22004).c_str(), fabs(value));
else
- text.Format(g_localizeStrings.Get(22005).c_str(), value);
+ text = StringUtils::Format(g_localizeStrings.Get(22005).c_str(), value);
return text;
}
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "FileItem.h"
+#include "utils/StringUtils.h"
using namespace std;
SendMessage(GUI_MSG_LABEL_RESET, GetID(), STACK_LIST);
for (int i = 0; i < m_iNumberOfFiles; i++)
{
- CStdString label;
- label.Format(g_localizeStrings.Get(23051).c_str(), i+1);
+ CStdString label = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), i+1);
CFileItemPtr item(new CFileItem(label));
m_stackItems->Add(item);
}
// construct subtitle path
URIUtils::RemoveExtension(strFileName);
- CStdString strSubName;
- strSubName.Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());
+ CStdString strSubName = StringUtils::Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());
CStdString strSubPath = URIUtils::AddFileToFolder(strDestPath, strSubName);
// and copy the file across
CStdString bookmarkTime;
if (m_bookmarks[i].type == CBookmark::EPISODE)
- bookmarkTime.Format("%s %i %s %i", g_localizeStrings.Get(20373), m_bookmarks[i].seasonNumber, g_localizeStrings.Get(20359).c_str(), m_bookmarks[i].episodeNumber);
+ bookmarkTime = StringUtils::Format("%s %i %s %i", g_localizeStrings.Get(20373).c_str(), m_bookmarks[i].seasonNumber, g_localizeStrings.Get(20359).c_str(), m_bookmarks[i].episodeNumber);
else
bookmarkTime = StringUtils::SecondsToTimeString((long)m_bookmarks[i].timeInSeconds, TIME_FORMAT_HH_MM_SS);
{
Crc32 crc;
crc.ComputeFromLowerCase(g_application.CurrentFile());
- bookmark.thumbNailImage.Format("%08x_%i.jpg", (unsigned __int32) crc, (int)bookmark.timeInSeconds);
+ bookmark.thumbNailImage = StringUtils::Format("%08x_%i.jpg", (unsigned __int32) crc, (int)bookmark.timeInSeconds);
bookmark.thumbNailImage = URIUtils::AddFileToFolder(CProfilesManager::Get().GetBookmarksThumbFolder(), bookmark.thumbNailImage);
if (!CPicture::CreateThumbnailFromSurface(thumbnail->GetPixels(), width, height, thumbnail->GetWidth() * 4,
bookmark.thumbNailImage))
CContextButtons choices;
for (unsigned int i=0; i < episodes.size(); ++i)
{
- CStdString strButton;
- strButton.Format("%s %i, %s %i", g_localizeStrings.Get(20373), episodes[i].m_iSeason, g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode);
+ CStdString strButton = StringUtils::Format("%s %i, %s %i",
+ g_localizeStrings.Get(20373).c_str(), episodes[i].m_iSeason,
+ g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode);
choices.Add(i, strButton);
}
if (iItem < 0 || iItem >= m_castList->Size())
break;
CStdString strItem = m_castList->Get(iItem)->GetLabel();
- CStdString strFind;
- strFind.Format(" %s ",g_localizeStrings.Get(20347));
+ CStdString strFind = StringUtils::Format(" %s ",g_localizeStrings.Get(20347).c_str());
int iPos = strItem.Find(strFind);
if (iPos == -1)
iPos = strItem.size();
if (it->strRole.IsEmpty())
character = it->strName;
else
- character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
+ character = StringUtils::Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
CFileItemPtr item(new CFileItem(it->strName));
if (!it->thumb.IsEmpty())
item->SetArt("thumb", it->thumb);
{
if (!m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty())
{
- CStdString strPath;
- strPath.Format("videodb://tvshows/titles/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId);
+ CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId);
Close();
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return;
for (unsigned int i = 0; i < thumbs.size(); ++i)
{
- CStdString strItemPath;
- strItemPath.Format("thumb://Remote%i", i);
+ CStdString strItemPath = StringUtils::Format("thumb://Remote%i", i);
CFileItemPtr item(new CFileItem(strItemPath, false));
item->SetArt("thumb", thumbs[i]);
item->SetIconImage("DefaultPicture.png");
// Grab the thumbnails from the web
for (unsigned int i = 0; i < m_movieItem->GetVideoInfoTag()->m_fanart.GetNumFanarts(); i++)
{
- CStdString strItemPath;
- strItemPath.Format("fanart://Remote%i",i);
+ CStdString strItemPath = StringUtils::Format("fanart://Remote%i",i);
CFileItemPtr item(new CFileItem(strItemPath, false));
CStdString thumb = m_movieItem->GetVideoInfoTag()->m_fanart.GetPreviewURL(i);
item->SetArt("thumb", CTextureUtils::GetWrappedThumbURL(thumb));
item.SetPath(m_movieItem->GetVideoInfoTag()->m_strTrailer);
*item.GetVideoInfoTag() = *m_movieItem->GetVideoInfoTag();
item.GetVideoInfoTag()->m_streamDetails.Reset();
- item.GetVideoInfoTag()->m_strTitle.Format("%s (%s)",m_movieItem->GetVideoInfoTag()->m_strTitle.c_str(),g_localizeStrings.Get(20410));
+ item.GetVideoInfoTag()->m_strTitle = StringUtils::Format("%s (%s)",
+ m_movieItem->GetVideoInfoTag()->m_strTitle.c_str(),
+ g_localizeStrings.Get(20410).c_str());
CVideoThumbLoader::SetArt(item, m_movieItem->GetArt());
item.GetVideoInfoTag()->m_iDbId = -1;
item.GetVideoInfoTag()->m_iFileId = -1;
if (!videodb.Open())
return false;
- CStdString strHeading; strHeading.Format(g_localizeStrings.Get(20457));
- CStdString baseDir;
- baseDir.Format("videodb://movies/sets/%d", setItem->GetVideoInfoTag()->m_iDbId);
+ CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(20457));
+ CStdString baseDir = StringUtils::Format("videodb://movies/sets/%d", setItem->GetVideoInfoTag()->m_iDbId);
if (!CDirectory::GetDirectory(baseDir, originalMovies) || originalMovies.Size() <= 0) // keep a copy of the original members of the set
return false;
if (currentSetId > 0)
{
// add clear item
- CStdString strClear; strClear.Format(g_localizeStrings.Get(20467), currentSetLabel);
+ CStdString strClear = StringUtils::Format(g_localizeStrings.Get(20467), currentSetLabel.c_str());
CFileItemPtr clearItem(new CFileItem(strClear));
clearItem->GetVideoInfoTag()->m_iDbId = -1; // -1 will be used to clear set
listItems.AddFront(clearItem, 0);
// add keep current set item
- CStdString strKeep; strKeep.Format(g_localizeStrings.Get(20469), currentSetLabel);
+ CStdString strKeep = StringUtils::Format(g_localizeStrings.Get(20469), currentSetLabel.c_str());
CFileItemPtr keepItem(new CFileItem(strKeep));
keepItem->GetVideoInfoTag()->m_iDbId = currentSetId;
listItems.AddFront(keepItem, 1);
if (dialog == NULL)
return false;
- CStdString strHeading;
- strHeading.Format(g_localizeStrings.Get(20466));
+ CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(20466));
dialog->Reset();
dialog->SetHeading(strHeading);
dialog->SetItems(&listItems);
#include "guilib/GUIWindowManager.h"
#include "GUIPassword.h"
#include "utils/MathUtils.h"
+#include "utils/StringUtils.h"
#ifdef HAS_VIDEO_PLAYBACK
#include "cores/VideoRenderers/RenderManager.h"
#include "cores/VideoRenderers/RenderFlags.h"
CStdString CGUIDialogVideoSettings::FormatInteger(float value, float minimum)
{
- CStdString text;
- text.Format("%i", MathUtils::round_int(value));
- return text;
+ return StringUtils::Format("%i", MathUtils::round_int(value));
}
CStdString CGUIDialogVideoSettings::FormatFloat(float value, float minimum)
{
- CStdString text;
- text.Format("%2.2f", value);
- return text;
+ return StringUtils::Format("%2.2f", value);
}
#include "utils/log.h"
#include "utils/TimeUtils.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "XBDateTime.h"
#include "input/ButtonTranslator.h"
#include "pvr/PVRManager.h"
else
{
int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
- CStdString strChannel;
- strChannel.Format("%i", action.GetID() - REMOTE_0);
+ CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
iChannelNumber = atoi(strChannel.c_str());
}
// We show CPU usage for the entire process, as it's arguably more useful.
double dCPU = m_resourceCounter.GetCPUUsage();
CStdString strCores;
- strCores.Format("cpu:%.0f%%", dCPU);
+ strCores = StringUtils::Format("cpu:%.0f%%", dCPU);
#else
CStdString strCores = g_cpuInfo.GetCoresUsageString();
#endif
CStdString strClock;
if (g_VideoReferenceClock.GetClockInfo(missedvblanks, clockspeed, refreshrate))
- strClock.Format("S( refresh:%i missed:%i speed:%+.3f%% %s )"
- , refreshrate
- , missedvblanks
- , clockspeed - 100.0
- , g_renderManager.GetVSyncState().c_str());
+ strClock = StringUtils::Format("S( refresh:%i missed:%i speed:%+.3f%% %s )"
+ , refreshrate
+ , missedvblanks
+ , clockspeed - 100.0
+ , g_renderManager.GetVSyncState().c_str());
- strGeneralFPS.Format("%s\nW( fps:%02.2f %s ) %s"
- , strGeneral.c_str()
- , g_infoManager.GetFPS()
- , strCores.c_str(), strClock.c_str() );
+ strGeneralFPS = StringUtils::Format("%s\nW( fps:%02.2f %s ) %s"
+ , strGeneral.c_str()
+ , g_infoManager.GetFPS()
+ , strCores.c_str(), strClock.c_str() );
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW3);
msg.SetLabel(strGeneralFPS);
// get the "View Mode" string
CStdString strTitle = g_localizeStrings.Get(629);
CStdString strMode = g_localizeStrings.Get(630 + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode);
- CStdString strInfo;
- strInfo.Format("%s : %s", strTitle.c_str(), strMode.c_str());
+ CStdString strInfo = StringUtils::Format("%s : %s", strTitle.c_str(), strMode.c_str());
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1);
msg.SetLabel(strInfo);
OnMessage(msg);
float xscale = (float)res.iScreenWidth / (float)res.iWidth;
float yscale = (float)res.iScreenHeight / (float)res.iHeight;
- CStdString strSizing;
- strSizing.Format(g_localizeStrings.Get(245),
- (int)info.SrcRect.Width(), (int)info.SrcRect.Height(),
- (int)(info.DestRect.Width() * xscale), (int)(info.DestRect.Height() * yscale),
- CDisplaySettings::Get().GetZoomAmount(), info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
- CDisplaySettings::Get().GetPixelRatio(), CDisplaySettings::Get().GetVerticalShift());
+ CStdString strSizing = StringUtils::Format(g_localizeStrings.Get(245),
+ (int)info.SrcRect.Width(),
+ (int)info.SrcRect.Height(),
+ (int)(info.DestRect.Width() * xscale),
+ (int)(info.DestRect.Height() * yscale),
+ CDisplaySettings::Get().GetZoomAmount(),
+ info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
+ CDisplaySettings::Get().GetPixelRatio(),
+ CDisplaySettings::Get().GetVerticalShift());
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW2);
msg.SetLabel(strSizing);
OnMessage(msg);
{
CStdString strStatus;
if (g_Windowing.IsFullScreen())
- strStatus.Format("%s %ix%i@%.2fHz - %s",
- g_localizeStrings.Get(13287), res.iScreenWidth,
- res.iScreenHeight, res.fRefreshRate,
- g_localizeStrings.Get(244));
+ strStatus = StringUtils::Format("%s %ix%i@%.2fHz - %s",
+ g_localizeStrings.Get(13287).c_str(),
+ res.iScreenWidth,
+ res.iScreenHeight,
+ res.fRefreshRate,
+ g_localizeStrings.Get(244).c_str());
else
- strStatus.Format("%s %ix%i - %s",
- g_localizeStrings.Get(13287), res.iScreenWidth,
- res.iScreenHeight, g_localizeStrings.Get(242));
+ strStatus = StringUtils::Format("%s %ix%i - %s",
+ g_localizeStrings.Get(13287).c_str(),
+ res.iScreenWidth,
+ res.iScreenHeight,
+ g_localizeStrings.Get(242).c_str());
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW3);
msg.SetLabel(strStatus);
if (!hasDetails && (scrUrl.m_url.size() == 0 || needsRefresh))
{
// 4a. show dialog that we're busy querying www.imdb.com
- CStdString strHeading;
- strHeading.Format(g_localizeStrings.Get(197),info->Name().c_str());
+ CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(197),info->Name().c_str());
pDlgProgress->SetHeading(strHeading);
pDlgProgress->SetLine(0, movieName);
pDlgProgress->SetLine(1, "");
GetResumeItemOffset(&item, startOffset, startPart);
if (startOffset > 0)
{
- resumeString.Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(startOffset/75).c_str());
+ resumeString = StringUtils::Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(startOffset/75).c_str());
if (startPart > 0)
{
- CStdString partString;
- partString.Format(g_localizeStrings.Get(23051).c_str(), startPart);
+ CStdString partString = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), startPart);
resumeString += " (" + partString + ")";
}
}
// everything is ok, so add to database
m_database.Open();
int idMovie = m_database.AddMovie(pItem->GetPath());
- movie.m_strIMDBNumber.Format("xx%08i", idMovie);
+ movie.m_strIMDBNumber = StringUtils::Format("xx%08i", idMovie);
m_database.SetDetailsForMovie(pItem->GetPath(), movie, pItem->GetArt());
m_database.Close();
StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/"))
iItems--;
}
- CStdString items;
- items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
// set the filter label
{
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
pDialog->SetHeading(432);
- CStdString strLabel;
- strLabel.Format(g_localizeStrings.Get(433),pItem->GetLabel());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433),pItem->GetLabel().c_str());
pDialog->SetLine(1, strLabel);
pDialog->SetLine(2, "");;
pDialog->DoModal();
{
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
pDialog->SetHeading(432);
- CStdString strLabel;
- strLabel.Format(g_localizeStrings.Get(433), pItem->GetLabel());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433), pItem->GetLabel().c_str());
pDialog->SetLine(1, strLabel);
pDialog->SetLine(2, "");
pDialog->DoModal();
}
else
{
- CStdString strLine;
- strLine.Format(g_localizeStrings.Get(433),pItem->GetLabel());
+ CStdString strLine = StringUtils::Format(g_localizeStrings.Get(433), pItem->GetLabel().c_str());
pDialog->SetLine(0, strLine);
pDialog->SetLine(1, "");
pDialog->SetLine(2, "");;
{
std::string mediaType = videoUrl.GetItemType();
- CStdString strLabelAdd; strLabelAdd.Format(g_localizeStrings.Get(20460), GetLocalizedType(videoUrl.GetItemType()).c_str());
- CStdString strLabelRemove; strLabelRemove.Format(g_localizeStrings.Get(20461), GetLocalizedType(videoUrl.GetItemType()).c_str());
+ CStdString strLabelAdd = StringUtils::Format(g_localizeStrings.Get(20460), GetLocalizedType(videoUrl.GetItemType()).c_str());
+ CStdString strLabelRemove = StringUtils::Format(g_localizeStrings.Get(20461), GetLocalizedType(videoUrl.GetItemType()).c_str());
buttons.Add(CONTEXT_BUTTON_TAGS_ADD_ITEMS, strLabelAdd);
buttons.Add(CONTEXT_BUTTON_TAGS_REMOVE_ITEMS, strLabelRemove);
buttons.Add(CONTEXT_BUTTON_DELETE, 646);
for (unsigned int i = 0; i < thumbs.size(); i++)
{
- CStdString strItemPath;
- strItemPath.Format("thumb://Remote%i",i);
+ CStdString strItemPath = StringUtils::Format("thumb://Remote%i",i);
CFileItemPtr item(new CFileItem(strItemPath, false));
item->SetArt("thumb", thumbs[i]);
item->SetIconImage("DefaultPicture.png");
CFileItemList items;
CStdString localizedType = GetLocalizedType(mediaType);
- CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
if (!GetItemsForTag(strLabel, mediaType, items, item->GetVideoInfoTag()->m_iDbId))
return true;
CFileItemList items;
CStdString localizedType = GetLocalizedType(mediaType);
- CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
if (!GetItemsForTag(strLabel, mediaType, items, item->GetVideoInfoTag()->m_iDbId, false))
return true;
CStdString strPath;
CMusicDatabase database;
database.Open();
- strPath.Format("musicdb://artists/%ld/",database.GetArtistByName(StringUtils::Join(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)));
+ strPath = StringUtils::Format("musicdb://artists/%ld/",
+ database.GetArtistByName(StringUtils::Join(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)));
g_windowManager.ActivateWindow(WINDOW_MUSIC_NAV,strPath);
return true;
}
CStdString strPath;
CMusicDatabase database;
database.Open();
- strPath.Format("musicdb://albums/%ld/",database.GetAlbumByName(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_strAlbum));
+ strPath = StringUtils::Format("musicdb://albums/%ld/",
+ database.GetAlbumByName(m_vecItems->Get(itemNumber)->GetVideoInfoTag()->m_strAlbum));
g_windowManager.ActivateWindow(WINDOW_MUSIC_NAV,strPath);
return true;
}
if (!videodb.GetSingleValue("tag", "tag.idTag", videodb.PrepareSQL("tag.strTag = '%s' AND tag.idTag IN (SELECT taglinks.idTag FROM taglinks WHERE taglinks.media_type = '%s')", strTag.c_str(), mediaType.c_str())).empty())
{
- CStdString strError; strError.Format(g_localizeStrings.Get(20463), strTag.c_str());
+ CStdString strError = StringUtils::Format(g_localizeStrings.Get(20463), strTag.c_str());
CGUIDialogOK::ShowAndGetInput(20462, "", strError, "");
return true;
}
int idTag = videodb.AddTag(strTag);
CFileItemList items;
- CStdString strLabel; strLabel.Format(g_localizeStrings.Get(20464), localizedType.c_str());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464), localizedType.c_str());
if (GetItemsForTag(strLabel, mediaType, items, idTag))
{
for (int index = 0; index < items.Size(); index++)
#include "GUIViewControl.h"
#include "guilib/GUIWindowManager.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "GUIInfoManager.h"
{
IGUIContainer *view = (IGUIContainer *)m_visibleViews[i];
CGUIMessage msg(GUI_MSG_LABEL_ADD, m_parentWindow, m_viewAsControl, i);
- CStdString label;
- label.Format(g_localizeStrings.Get(534).c_str(), view->GetLabel().c_str()); // View: %s
+ CStdString label = StringUtils::Format(g_localizeStrings.Get(534).c_str(), view->GetLabel().c_str()); // View: %s
msg.SetLabel(label);
g_windowManager.SendMessage(msg, m_parentWindow);
}
g_windowManager.SendMessage(msgSelect, m_parentWindow);
// otherwise it's just a normal button
- CStdString label;
- label.Format(g_localizeStrings.Get(534).c_str(), viewLabel.c_str()); // View: %s
+ CStdString label = StringUtils::Format(g_localizeStrings.Get(534).c_str(), viewLabel.c_str()); // View: %s
CGUIMessage msgSet(GUI_MSG_LABEL_SET, m_parentWindow, m_viewAsControl);
msgSet.SetLabel(label);
g_windowManager.SendMessage(msgSet, m_parentWindow);
#include "utils/SystemInfo.h"
#include "utils/Environment.h"
#include "utils/URIUtils.h"
+#include "utils/StringUtils.h"
// default Broadcom registy bits (setup when installing a CrystalHD card)
#define BC_REG_PATH "Software\\Broadcom\\MediaPC"
if( DRIVE_FIXED == GetDriveType( strDrive.c_str() ) &&
GetDiskFreeSpaceEx( ( strDrive.c_str() ), NULL, &ULTotal, &ULTotalFree ) )
{
- strRet.Format("%s %d MB %s",strDrive.c_str(), int(ULTotalFree.QuadPart/(1024*1024)),g_localizeStrings.Get(160));
+ strRet = StringUtils::Format("%s %d MB %s",strDrive.c_str(), int(ULTotalFree.QuadPart/(1024*1024)),g_localizeStrings.Get(160));
result.push_back(strRet);
}
iPos += (strlen( pcBuffer + iPos) + 1 );
CStdString CWIN32Util::GetResInfoString()
{
- CStdString strRes;
DEVMODE devmode;
ZeroMemory(&devmode, sizeof(devmode));
devmode.dmSize = sizeof(devmode);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
- strRes.Format("Desktop Resolution: %dx%d %dBit at %dHz",devmode.dmPelsWidth,devmode.dmPelsHeight,devmode.dmBitsPerPel,devmode.dmDisplayFrequency);
- return strRes;
+ return StringUtils::Format("Desktop Resolution: %dx%d %dBit at %dHz",devmode.dmPelsWidth,devmode.dmPelsHeight,devmode.dmBitsPerPel,devmode.dmDisplayFrequency);
}
int CWIN32Util::GetDesktopColorDepth()
cDL = dvdDevice[0];
}
- CStdString strVolFormat;
- strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+ CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
HANDLE hDrive= CreateFile( strVolFormat.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- CStdString strRootFormat;
- strRootFormat.Format( _T("%c:\\"), cDL);
+ CStdString strRootFormat = StringUtils::Format( _T("%c:\\"), cDL);
if( ( hDrive != INVALID_HANDLE_VALUE || GetLastError() == NO_ERROR) &&
( GetDriveType( strRootFormat ) == DRIVE_CDROM ) )
{
// unmount it here too as it won't hurt
if(dwReq == IOCTL_STORAGE_EJECT_MEDIA && bRet == 1)
{
- strRootFormat.Format( _T("%c:"), cDL);
+ strRootFormat = StringUtils::Format( _T("%c:"), cDL);
CMediaSource share;
share.strPath = strRootFormat;
share.strName = share.strPath;
cDL = dvdDevice[0];
}
- CStdString strVolFormat;
- strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+ CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
if(GetDriveStatus(strVolFormat, true) != 1)
return ToggleTray(cDL);
cDL = dvdDevice[0];
}
- CStdString strVolFormat;
- strVolFormat.Format( _T("\\\\.\\%c:" ), cDL);
+ CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDL);
if(GetDriveStatus(strVolFormat, true) == 1)
return ToggleTray(cDL);
if( !cDriveLetter )
return false;
- CStdString strVolFormat;
- strVolFormat.Format( _T("\\\\.\\%c:" ), cDriveLetter);
+ CStdString strVolFormat = StringUtils::Format( _T("\\\\.\\%c:" ), cDriveLetter);
long DiskNumber = -1;
switch(uDriveType)
{
case DRIVE_CDROM:
- share.strName.Format( "%s (%s)", share.strPath, g_localizeStrings.Get(218));
+ share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), g_localizeStrings.Get(218).c_str());
break;
case DRIVE_REMOVABLE:
if(share.strName.IsEmpty())
- share.strName.Format( "%s (%s)", g_localizeStrings.Get(437), share.strPath);
+ share.strName = StringUtils::Format( "%s (%s)", g_localizeStrings.Get(437).c_str(), share.strPath.c_str());
break;
case DRIVE_UNKNOWN:
- share.strName.Format( "%s (%s)", share.strPath, g_localizeStrings.Get(13205));
+ share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), g_localizeStrings.Get(13205).c_str());
break;
default:
if(share.strName.empty())
share.strName = share.strPath;
else
- share.strName.Format( "%s (%s)", share.strPath, share.strName);
+ share.strName = StringUtils::Format( "%s (%s)", share.strPath.c_str(), share.strName.c_str());
break;
}
}
CStdString strRegKey;
CLog::Log(LOGDEBUG, "CrystalHD: detecting CrystalHD installation path");
- strRegKey.Format("%s\\%s", BC_REG_PATH, BC_REG_PRODUCT );
+ strRegKey = StringUtils::Format("%s\\%s", BC_REG_PATH, BC_REG_PRODUCT );
if( CWIN32Util::UtilRegOpenKeyEx( HKEY_LOCAL_MACHINE, strRegKey.c_str(), KEY_READ, &hKey ))
{
bool CWIN32Util::IsUsbDevice(const CStdStringW &strWdrive)
{
- CStdStringW strWDevicePath;
- strWDevicePath.Format(L"\\\\.\\%s",strWdrive.Left(2));
+ CStdStringW strWDevicePath = StringUtils::Format(L"\\\\.\\%s",strWdrive.Left(2).c_str());
HANDLE deviceHandle = CreateFileW(
strWDevicePath.c_str(),
#include "filesystem/SpecialProtocol.h"
#include "Application.h"
#include "windowing/WindowingFactory.h"
+#include "utils/StringUtils.h"
FARPROC WINAPI delayHookNotifyFunc (unsigned dliNotify, PDelayLoadInfo pdli)
{
{
case dliFailLoadLib:
g_application.Stop(1);
- CStdString strError;
- strError.Format("Uh oh, can't load %s, exiting.", pdli->szDll);
+ CStdString strError = StringUtils::Format("Uh oh, can't load %s, exiting.", pdli->szDll);
MessageBox(NULL, strError.c_str(), "XBMC: Fatal Error", MB_OK|MB_ICONERROR);
exit(1);
break;
#include "settings/DisplaySettings.h"
#include "settings/lib/Setting.h"
#include "settings/Settings.h"
+#include "utils/StringUtils.h"
using namespace std;
newRes.iHeight = height;
newRes.iScreenWidth = width;
newRes.iScreenHeight = height;
- newRes.strMode.Format("%dx%d", width, height);
+ newRes.strMode = StringUtils::Format("%dx%d", width, height);
if (refreshRate > 1)
newRes.strMode.AppendFormat("@ %.2f", refreshRate);
if (dwFlags & D3DPRESENTFLAG_INTERLACED)
if (dwFlags & D3DPRESENTFLAG_MODE3DSBS)
newRes.strMode += "sbs";
if (screen > 0)
- newRes.strMode.Format("%s #%d", newRes.strMode, screen + 1);
+ newRes.strMode = StringUtils::Format("%s #%d", newRes.strMode.c_str(), screen + 1);
if (refreshRate > 1)
newRes.strMode += " - Full Screen";
}
#include <X11/Xlib.h>
#include "cores/VideoRenderers/RenderManager.h"
#include "utils/TimeUtils.h"
+#include "utils/StringUtils.h"
#if defined(HAS_XRANDR)
#include <X11/extensions/Xrandr.h>
CLog::Log(LOGINFO, "Pixel Ratio: %f", res.fPixelRatio);
- res.strMode.Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
+ res.strMode = StringUtils::Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
res.strOutput = out.name;
res.strId = mode.id;
res.iSubtitles = (int)(0.95*mode.h);
#include "guilib/GraphicContext.h"
#include "guilib/Texture.h"
#include "windowing/X11/XRandR.h"
+#include "utils/StringUtils.h"
#include <vector>
using namespace std;
CLog::Log(LOGINFO, "Pixel Ratio: %f", res.fPixelRatio);
- res.strMode.Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
+ res.strMode = StringUtils::Format("%s: %s @ %.2fHz", out.name.c_str(), mode.name.c_str(), mode.hz);
res.strOutput = out.name;
res.strId = mode.id;
res.iSubtitles = (int)(0.95*mode.h);
res->bFullScreen = true;
res->iSubtitles = (int)(0.965 * res->iHeight);
res->fPixelRatio = 1.0f;
- res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
+ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
return res->iWidth > 0 && res->iHeight> 0;
#include "utils/AMLUtils.h"
#endif
#endif
+#include "utils/StringUtils.h"
CEGLNativeTypeAndroid::CEGLNativeTypeAndroid()
{
res->fPixelRatio = 1.0f;
res->iScreenWidth = res->iWidth;
res->iScreenHeight = res->iHeight;
- res->strMode.Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
+ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str());
return true;
#include "utils/log.h"
#include "guilib/gui3d.h"
#include "linux/DllBCM.h"
+#include "utils/StringUtils.h"
#ifndef __VIDEOCORE4__
#define __VIDEOCORE4__
m_desktopRes.fPixelRatio = get_display_aspect_ratio((SDTV_ASPECT_T)tv_state.display.sdtv.display_options.aspect) / ((float)m_desktopRes.iScreenWidth / (float)m_desktopRes.iScreenHeight);
}
- m_desktopRes.strMode.Format("%dx%d", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight);
+ m_desktopRes.strMode = StringUtils::Format("%dx%d", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight);
if((int)m_desktopRes.fRefreshRate > 1)
{
- m_desktopRes.strMode.Format("%dx%d @ %.2f%s - Full Screen", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight, m_desktopRes.fRefreshRate,
+ m_desktopRes.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", m_desktopRes.iScreenWidth, m_desktopRes.iScreenHeight, m_desktopRes.fRefreshRate,
m_desktopRes.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
}
m_initDesktopRes = false;
res.iWidth = gui_width;
res.iHeight = gui_height;
- res.strMode.Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
+ res.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res.iScreenWidth, res.iScreenHeight, res.fRefreshRate,
res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio,
res2.dwFlags |= D3DPRESENTFLAG_MODE3DSBS;
res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight);
res2.fPixelRatio *= 2.0f;
- res2.strMode.Format("%dx%d", res2.iScreenWidth, res2.iScreenHeight);
- res2.strMode.Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
+ res2.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
res2.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) SBS\n", i, res2.strMode.c_str(), res2.fPixelRatio);
res2.dwFlags |= D3DPRESENTFLAG_MODE3DTB;
res2.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res2.iScreenWidth / (float)res2.iScreenHeight);
res2.fPixelRatio *= 0.5f;
- res2.strMode.Format("%dx%d", res2.iScreenWidth, res2.iScreenHeight);
- res2.strMode.Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
+ res2.strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res2.iScreenWidth, res2.iScreenHeight, res2.fRefreshRate,
res2.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) TAB\n", i, res2.strMode.c_str(), res2.fPixelRatio);
#include "guilib/Resolution.h"
#include "guilib/gui3d.h"
+#include "utils/StringUtils.h"
+
#include "windowing/DllWaylandClient.h"
#include "windowing/DllXKBCommon.h"
res.fPixelRatio = 1.0f;
res.iScreenWidth = res.iWidth;
res.iScreenHeight = res.iHeight;
- res.strMode.Format("%dx%d @ %.2fp",
+ res.strMode = StringUtils::Format("%dx%d @ %.2fp",
res.iScreenWidth,
res.iScreenHeight,
res.fRefreshRate);
#include "settings/DisplaySettings.h"
#include "guilib/GraphicContext.h"
#include "guilib/Texture.h"
+#include "utils/StringUtils.h"
#include <vector>
#undef BOOL
//mode str by doing it without appending "Full Screen".
//this is what linux does - though it feels that there shouldn't be
//the same resolution twice... - thats why i add a FIXME here.
- res.strMode.Format("%dx%d @ %.2f", w, h, refreshrate);
+ res.strMode = StringUtils::Format("%dx%d @ %.2f", w, h, refreshrate);
g_graphicsContext.ResetOverscan(res);
CDisplaySettings::Get().AddResolutionInfo(res);
}
#include "input/KeyboardStat.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "osx/XBMCHelper.h"
#include "utils/SystemInfo.h"
#include "osx/CocoaInterface.h"
// mode str by doing it without appending "Full Screen".
// this is what linux does - though it feels that there shouldn't be
// the same resolution twice... - thats why i add a FIXME here.
- res.strMode.Format("%dx%d @ %.2f", w, h, refreshrate);
+ res.strMode = StringUtils::Format("%dx%d @ %.2f", w, h, refreshrate);
g_graphicsContext.ResetOverscan(res);
CDisplaySettings::Get().AddResolutionInfo(res);
}
#include "network/ZeroconfBrowser.h"
#include "GUIUserMessages.h"
#include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
#ifdef TARGET_WINDOWS
// optical medium
if (lpdbv -> dbcv_flags & DBTF_MEDIA)
{
- CStdString strdrive;
- strdrive.Format("%c:\\", CWIN32Util::FirstDriveFromMask(lpdbv ->dbcv_unitmask));
+ CStdString strdrive = StringUtils::Format("%c:\\", CWIN32Util::FirstDriveFromMask(lpdbv ->dbcv_unitmask));
if(wParam == DBT_DEVICEARRIVAL)
{
CLog::Log(LOGDEBUG, __FUNCTION__": Drive %s Media has arrived.", strdrive.c_str());
if (action.GetID() >= ACTION_FILTER_SMS2 && action.GetID() <= ACTION_FILTER_SMS9)
{
- CStdString filter;
- filter.Format("%i", (int)(action.GetID() - ACTION_FILTER_SMS2 + 2));
+ CStdString filter = StringUtils::Format("%i", (int)(action.GetID() - ACTION_FILTER_SMS2 + 2));
CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_FILTER_ITEMS, 1); // 1 for append
message.SetStringParam(filter);
OnMessage(message);
else
CONTROL_ENABLE(CONTROL_BTNSORTBY);
- CStdString sortLabel;
- sortLabel.Format(g_localizeStrings.Get(550).c_str(), g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
+ CStdString sortLabel = StringUtils::Format(g_localizeStrings.Get(550).c_str(),
+ g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
SET_CONTROL_LABEL(CONTROL_BTNSORTBY, sortLabel);
}
- CStdString items;
- items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
+ CStdString items = StringUtils::Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
SET_CONTROL_LABEL2(CONTROL_BTN_FILTER, GetProperty("filter").asString());
{
// Could be a cue item, all items of a cue share the same filename
// so add the offsets to build the history string
- strHistoryString.Format("%ld%ld", pItem->m_lStartOffset, pItem->m_lEndOffset);
+ strHistoryString = StringUtils::Format("%ld%ld",
+ pItem->m_lStartOffset,
+ pItem->m_lEndOffset);
strHistoryString += pItem->GetPath();
}
else
CStdString action;
for (int i = CONTEXT_BUTTON_USER1; i <= CONTEXT_BUTTON_USER10; i++)
{
- label.Format("contextmenulabel(%i)", i - CONTEXT_BUTTON_USER1);
+ label = StringUtils::Format("contextmenulabel(%i)", i - CONTEXT_BUTTON_USER1);
if (item->GetProperty(label).empty())
break;
- action.Format("contextmenuaction(%i)", i - CONTEXT_BUTTON_USER1);
+ action = StringUtils::Format("contextmenuaction(%i)", i - CONTEXT_BUTTON_USER1);
if (item->GetProperty(action).empty())
break;
case CONTEXT_BUTTON_USER9:
case CONTEXT_BUTTON_USER10:
{
- CStdString action;
- action.Format("contextmenuaction(%i)", button - CONTEXT_BUTTON_USER1);
+ CStdString action = StringUtils::Format("contextmenuaction(%i)", button - CONTEXT_BUTTON_USER1);
CApplicationMessenger::Get().ExecBuiltIn(m_vecItems->Get(itemNumber)->GetProperty(action).asString());
return true;
}
#include "guilib/GUIControlProfiler.h"
#include "GUIInfoManager.h"
#include "utils/Variant.h"
+#include "utils/StringUtils.h"
#include <climits>
CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : "";
CStdString strCores = g_cpuInfo.GetCoresUsageString();
#if !defined(TARGET_POSIX)
- info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", g_advancedSettings.m_logFolder.c_str(),
- stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
+ info = StringUtils::Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", g_advancedSettings.m_logFolder.c_str(),
+ stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
#else
double dCPU = m_resourceCounter.GetCPUUsage();
- info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_advancedSettings.m_logFolder.c_str(),
- stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
+ info = StringUtils::Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_advancedSettings.m_logFolder.c_str(),
+ stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
#endif
}
}
CStdString items;
if (selectedCount > 0)
- items.Format("%i/%i %s (%s)", selectedCount, totalCount, g_localizeStrings.Get(127).c_str(), StringUtils::SizeToString(selectedSize).c_str());
+ items = StringUtils::Format("%i/%i %s (%s)", selectedCount, totalCount, g_localizeStrings.Get(127).c_str(), StringUtils::SizeToString(selectedSize).c_str());
else
- items.Format("%i %s", totalCount, g_localizeStrings.Get(127).c_str());
+ items = StringUtils::Format("%i %s", totalCount, g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_NUMFILES_LEFT + i, items);
}
}
#endif
#include "interfaces/Builtins.h"
#include "utils/Weather.h"
+#include "utils/StringUtils.h"
#include "network/Network.h"
#include "addons/Skin.h"
#include "guilib/GUIMessage.h"
if (GetFocusedControlID() == CONTROL_BIG_LIST && g_windowManager.GetTopMostModalDialogID() == WINDOW_INVALID)
if (m_viewControl.HasControl(CONTROL_BIG_LIST))
m_iSelectedItem = m_viewControl.GetSelectedItem();
- CStdString strLabel;
- strLabel.Format(g_localizeStrings.Get(20114),m_iSelectedItem+1, CProfilesManager::Get().GetNumberOfProfiles());
+ CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20114), m_iSelectedItem+1, CProfilesManager::Get().GetNumberOfProfiles());
SET_CONTROL_LABEL(CONTROL_LABEL_SELECTED_PROFILE,strLabel);
CGUIWindow::FrameMove();
}
if (profile->getDate().IsEmpty())
strLabel = g_localizeStrings.Get(20113);
else
- strLabel.Format(g_localizeStrings.Get(20112), profile->getDate());
+ strLabel = StringUtils::Format(g_localizeStrings.Get(20112).c_str(), profile->getDate().c_str());
item->SetLabel2(strLabel);
item->SetArt("thumb", profile->getThumb());
if (profile->getThumb().IsEmpty() || profile->getThumb().Equals("-"))
#ifdef HAS_SYSINFO
#include "utils/SystemInfo.h"
#endif
+#include "utils/StringUtils.h"
#include "storage/MediaManager.h"
#define CONTROL_BT_STORAGE 94
void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label, int info)
{
- CStdString tmpStr;
- tmpStr.Format(format, g_localizeStrings.Get(label).c_str(), g_infoManager.GetLabel(info).c_str());
+ CStdString tmpStr = StringUtils::Format(format, g_localizeStrings.Get(label).c_str(), g_infoManager.GetLabel(info).c_str());
SET_CONTROL_LABEL(id, tmpStr);
}
#include "LangInfo.h"
#include "utils/log.h"
#include "utils/SystemInfo.h"
+#include "utils/StringUtils.h"
#include "addons/AddonManager.h"
using namespace ADDON;
}
else
{
- strLabel.Format("AreaCode %i", i);
+ strLabel = StringUtils::Format("AreaCode %i", i);
msg2.SetLabel(strLabel);
msg2.SetParam1(i);
CStdString day;
for (int i = 0; i < NUM_DAYS; i++)
{
- day.Format("Day%i.", i);
+ day = StringUtils::Format("Day%i.", i);
SetProperty(day + "Title", g_weatherManager.GetForecast(i).m_day);
SetProperty(day + "HighTemp", g_weatherManager.GetForecast(i).m_high);
SetProperty(day + "LowTemp", g_weatherManager.GetForecast(i).m_low);
CStdString day;
for (int i = 0; i < NUM_DAYS; i++)
{
- day.Format("Day%i.", i);
+ day = StringUtils::Format("Day%i.", i);
SetProperty(day + "Title", "");
SetProperty(day + "HighTemp", "");
SetProperty(day + "LowTemp", "");