Skip to content

Commit

Permalink
[stdstring] get rid of CStdString in xbmc/
Browse files Browse the repository at this point in the history
  • Loading branch information
notspiff authored and Montellese committed Jan 7, 2015
1 parent fa9e057 commit ec3f48c
Show file tree
Hide file tree
Showing 45 changed files with 605 additions and 592 deletions.
2 changes: 1 addition & 1 deletion xbmc/AppParamParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void CAppParamParser::EnableDebugMode()
CLog::SetLogLevel(g_advancedSettings.m_logLevel);
}

void CAppParamParser::ParseArg(const CStdString &arg)
void CAppParamParser::ParseArg(const std::string &arg)
{
if (arg == "-fs" || arg == "--fullscreen")
g_advancedSettings.m_startFullScreen = true;
Expand Down
3 changes: 1 addition & 2 deletions xbmc/AppParamParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*
*/

#include "utils/StdString.h"
#include "FileItem.h"

class CAppParamParser
Expand All @@ -30,7 +29,7 @@ class CAppParamParser
private:
bool m_testmode;
CFileItemList m_playlist;
void ParseArg(const CStdString &arg);
void ParseArg(const std::string &arg);
void DisplayHelp();
void DisplayVersion();
void EnableDebugMode();
Expand Down
111 changes: 55 additions & 56 deletions xbmc/Application.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions xbmc/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

#include "guilib/IMsgTargetCallback.h"
#include "utils/GlobalsHandling.h"
#include "utils/StdString.h"

#include <map>
#include <string>

class CAction;
class CFileItem;
Expand Down Expand Up @@ -174,7 +174,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
virtual void OnPlayBackSpeedChanged(int iSpeed);
bool PlayMedia(const CFileItem& item, int iPlaylist = PLAYLIST_MUSIC);
bool PlayMediaSync(const CFileItem& item, int iPlaylist = PLAYLIST_MUSIC);
bool ProcessAndStartPlaylist(const CStdString& strPlayList, PLAYLIST::CPlayList& playlist, int iPlaylist, int track=0);
bool ProcessAndStartPlaylist(const std::string& strPlayList, PLAYLIST::CPlayList& playlist, int iPlaylist, int track=0);
PlayBackRet PlayFile(const CFileItem& item, bool bRestart = false);
void SaveFileState(bool bForeground = false);
void UpdateFileState();
Expand Down Expand Up @@ -257,7 +257,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
\param userInitiated Whether the action was initiated by the user (either via GUI or any other method) or not. It is meant to hide or show dialogs.
\param scanAll Whether to scan everything not already scanned (regardless of whether the user normally doesn't want a folder scanned).
*/
void StartVideoScan(const CStdString &path, bool userInitiated = true, bool scanAll = false);
void StartVideoScan(const std::string &path, bool userInitiated = true, bool scanAll = false);

/*!
\brief Starts a music library cleanup.
Expand All @@ -271,9 +271,9 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
\param userInitiated Whether the action was initiated by the user (either via GUI or any other method) or not. It is meant to hide or show dialogs.
\param flags Flags for controlling the scanning process. See xbmc/music/infoscanner/MusicInfoScanner.h for possible values.
*/
void StartMusicScan(const CStdString &path, bool userInitiated = true, int flags = 0);
void StartMusicAlbumScan(const CStdString& strDirectory, bool refresh=false);
void StartMusicArtistScan(const CStdString& strDirectory, bool refresh=false);
void StartMusicScan(const std::string &path, bool userInitiated = true, int flags = 0);
void StartMusicAlbumScan(const std::string& strDirectory, bool refresh = false);
void StartMusicArtistScan(const std::string& strDirectory, bool refresh = false);

void UpdateLibraries();
void CheckMusicPlaylist();
Expand Down Expand Up @@ -316,7 +316,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
CKaraokeLyricsManager* m_pKaraokeMgr;

PLAYERCOREID m_eForcedNextPlayer;
CStdString m_strPlayListFile;
std::string m_strPlayListFile;

int GlobalIdleTime();

Expand Down Expand Up @@ -374,7 +374,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
void SetRenderGUI(bool renderGUI);
bool GetRenderGUI() const { return m_renderGUI; };

bool SetLanguage(const CStdString &strLanguage);
bool SetLanguage(const std::string &strLanguage);

ReplayGainSettings& GetReplayGainSettings() { return m_replayGainSettings; }

Expand All @@ -390,7 +390,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
virtual void OnSettingAction(const CSetting *setting);
virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);

bool LoadSkin(const CStdString& skinID);
bool LoadSkin(const std::string& skinID);
bool LoadSkin(const boost::shared_ptr<ADDON::CSkinInfo>& skin);

bool m_skinReverting;
Expand Down Expand Up @@ -431,7 +431,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
CFileItemList* m_currentStack;
CFileItemPtr m_stackFileItemToUpdate;

CStdString m_prevMedia;
std::string m_prevMedia;
CSplash* m_splash;
ThreadIdentifier m_threadID; // application thread ID. Used in applicationMessanger to know where we are firing a thread with delay from.
bool m_bInitializing;
Expand Down
18 changes: 9 additions & 9 deletions xbmc/ApplicationMessenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
pSlideShow->Reset();

CFileItemList items;
CStdString strPath = pMsg->strParam;
CStdString extensions = g_advancedSettings.m_pictureExtensions;
std::string strPath = pMsg->strParam;
std::string extensions = g_advancedSettings.m_pictureExtensions;
if (pMsg->param1)
extensions += "|.tbn";
CUtil::GetRecursiveListing(strPath, items, extensions);
Expand Down Expand Up @@ -891,24 +891,24 @@ void CApplicationMessenger::ProcessWindowMessages()
}
}

int CApplicationMessenger::SetResponse(CStdString response)
int CApplicationMessenger::SetResponse(std::string response)
{
CSingleLock lock (m_critBuffer);
bufferResponse=response;
lock.Leave();
return 0;
}

CStdString CApplicationMessenger::GetResponse()
std::string CApplicationMessenger::GetResponse()
{
CStdString tmp;
std::string tmp;
CSingleLock lock (m_critBuffer);
tmp=bufferResponse;
lock.Leave();
return tmp;
}

void CApplicationMessenger::ExecBuiltIn(const CStdString &command, bool wait)
void CApplicationMessenger::ExecBuiltIn(const std::string &command, bool wait)
{
ThreadMessage tMsg = {TMSG_EXECUTE_BUILT_IN};
tMsg.strParam = command;
Expand Down Expand Up @@ -1211,7 +1211,7 @@ void CApplicationMessenger::Minimize(bool wait)
SendMessage(tMsg, wait);
}

void CApplicationMessenger::DoModal(CGUIDialog *pDialog, int iWindowID, const CStdString &param)
void CApplicationMessenger::DoModal(CGUIDialog *pDialog, int iWindowID, const std::string &param)
{
ThreadMessage tMsg = {TMSG_GUI_DO_MODAL};
tMsg.lpVoid = pDialog;
Expand All @@ -1220,7 +1220,7 @@ void CApplicationMessenger::DoModal(CGUIDialog *pDialog, int iWindowID, const CS
SendMessage(tMsg, true);
}

void CApplicationMessenger::ExecOS(const CStdString &command, bool waitExit)
void CApplicationMessenger::ExecOS(const std::string &command, bool waitExit)
{
ThreadMessage tMsg = {TMSG_EXECUTE_OS};
tMsg.strParam = command;
Expand Down Expand Up @@ -1316,7 +1316,7 @@ void CApplicationMessenger::ShowVolumeBar(bool up)
SendMessage(tMsg, false);
}

void CApplicationMessenger::SetSplashMessage(const CStdString& message)
void CApplicationMessenger::SetSplashMessage(const std::string& message)
{
ThreadMessage tMsg = {TMSG_SPLASH_MESSAGE};
tMsg.strParam = message;
Expand Down
17 changes: 8 additions & 9 deletions xbmc/ApplicationMessenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/

#include "utils/StdString.h"
#include "guilib/WindowIDs.h"
#include "threads/Thread.h"
#include <boost/shared_ptr.hpp>
Expand Down Expand Up @@ -120,7 +119,7 @@ typedef struct
unsigned int dwMessage;
int param1;
int param2;
CStdString strParam;
std::string strParam;
std::vector<std::string> params;
boost::shared_ptr<CEvent> waitEvent;
void* lpVoid;
Expand Down Expand Up @@ -208,7 +207,7 @@ class CApplicationMessenger
void ActivateScreensaver();
void SwitchToFullscreen(); //
void Minimize(bool wait = false);
void ExecOS(const CStdString &command, bool waitExit = false);
void ExecOS(const std::string &command, bool waitExit = false);
void UserEvent(int code);
//! \brief Set the tag for the currently playing song
void SetCurrentSongTag(const MUSIC_INFO::CMusicInfoTag& tag);
Expand All @@ -222,13 +221,13 @@ class CApplicationMessenger
void CECActivateSource();
void CECStandby();

CStdString GetResponse();
int SetResponse(CStdString response);
void ExecBuiltIn(const CStdString &command, bool wait = false);
std::string GetResponse();
int SetResponse(std::string response);
void ExecBuiltIn(const std::string &command, bool wait = false);

void NetworkMessage(int dwMessage, int dwParam = 0);

void DoModal(CGUIDialog *pDialog, int iWindowID, const CStdString &param = "");
void DoModal(CGUIDialog *pDialog, int iWindowID, const std::string &param = "");
void Show(CGUIDialog *pDialog);
void Close(CGUIWindow *window, bool forceClose, bool waitResult = true, int nextWindowID = 0, bool enableSound = true);
void ActivateWindow(int windowID, const std::vector<std::string> &params, bool swappingWindows);
Expand All @@ -250,7 +249,7 @@ class CApplicationMessenger

void ShowVolumeBar(bool up);

void SetSplashMessage(const CStdString& message);
void SetSplashMessage(const std::string& message);
void SetSplashMessage(int stringID);

bool SetupDisplay();
Expand All @@ -270,7 +269,7 @@ class CApplicationMessenger
std::queue<ThreadMessage*> m_vecWindowMessages;
CCriticalSection m_critSection;
CCriticalSection m_critBuffer;
CStdString bufferResponse;
std::string bufferResponse;
};

XBMC_GLOBAL_REF(CApplicationMessenger,s_messenger);
Expand Down
41 changes: 21 additions & 20 deletions xbmc/Autorun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "storage/MediaManager.h"
#include "video/VideoDatabase.h"
#include "dialogs/GUIDialogYesNo.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
#include "video/windows/GUIWindowVideoBase.h"
Expand All @@ -59,7 +60,7 @@ CAutorun::CAutorun()
CAutorun::~CAutorun()
{}

void CAutorun::ExecuteAutorun(const CStdString& path, bool bypassSettings, bool ignoreplaying, bool startFromBeginning )
void CAutorun::ExecuteAutorun(const std::string& path, bool bypassSettings, bool ignoreplaying, bool startFromBeginning )
{
if ((!ignoreplaying && (g_application.m_pPlayer->IsPlayingAudio() || g_application.m_pPlayer->IsPlayingVideo() || g_windowManager.HasModalDialog())) || g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN)
return ;
Expand All @@ -82,15 +83,15 @@ void CAutorun::ExecuteAutorun(const CStdString& path, bool bypassSettings, bool
PlayDisc(path, bypassSettings, startFromBeginning);
}

bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startFromBeginning)
bool CAutorun::PlayDisc(const std::string& path, bool bypassSettings, bool startFromBeginning)
{
if ( !bypassSettings && CSettings::Get().GetInt("audiocds.autoaction") != AUTOCD_PLAY && !CSettings::Get().GetBool("dvds.autorun"))
return false;

int nSize = g_playlistPlayer.GetPlaylist( PLAYLIST_MUSIC ).size();
int nAddedToPlaylist = 0;

CStdString mediaPath;
std::string mediaPath;

CCdInfo* pInfo = g_mediaManager.GetCdInfo(path);
if (pInfo == NULL)
Expand Down Expand Up @@ -129,7 +130,7 @@ bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startF
/**
* This method tries to determine what type of disc is located in the given drive and starts to play the content appropriately.
*/
bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings /* = false */, bool startFromBeginning /* = false */)
bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings /* = false */, bool startFromBeginning /* = false */)
{
bool bPlaying(false);
CFileItemList vecItems;
Expand All @@ -156,7 +157,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
// is this a root folder we have to check the content to determine a disc type
if( bRoot )
{
CStdString hddvdname = "";
std::string hddvdname = "";
CFileItemPtr phddvdItem;

// check root folders next, for normal structured dvd's
Expand All @@ -167,15 +168,15 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
// is the current item a (non system) folder?
if (pItem->m_bIsFolder && pItem->GetPath() != "." && pItem->GetPath() != "..")
{
CStdString name = pItem->GetPath();
std::string name = pItem->GetPath();
URIUtils::RemoveSlashAtEnd(name);
name = URIUtils::GetFileName(name);

// Check if the current foldername indicates a DVD structure (name is "VIDEO_TS")
if (name.Equals("VIDEO_TS") && bAllowVideo
if (StringUtils::EqualsNoCase(name, "VIDEO_TS") && bAllowVideo
&& (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
CStdString path = URIUtils::AddFileToFolder(pItem->GetPath(), "VIDEO_TS.IFO");
std::string path = URIUtils::AddFileToFolder(pItem->GetPath(), "VIDEO_TS.IFO");
if(!CFile::Exists(path))
path = URIUtils::AddFileToFolder(pItem->GetPath(), "video_ts.ifo");
CFileItemPtr item(new CFileItem(path, false));
Expand All @@ -196,7 +197,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
// Check if the current foldername indicates a Blu-Ray structure (default is "BDMV").
// A BR should also include an "AACS" folder for encryption, Sony-BRs can also include update folders for PS3 (PS3_UPDATE / PS3_VPRM).
// ToDo: for the time beeing, the DVD autorun settings are used to determine if the BR should be started automatically.
if (name.Equals("BDMV") && bAllowVideo
if (StringUtils::EqualsNoCase(name, "BDMV") && bAllowVideo
&& (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
CFileItemPtr item(new CFileItem(URIUtils::AddFileToFolder(pItem->GetPath(), "index.bdmv"), false));
Expand All @@ -222,7 +223,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
CFileItemList items, sitems;

// Advanced Content HD DVD (most discs?)
if (name.Equals("ADV_OBJ"))
if (StringUtils::EqualsNoCase(name, "ADV_OBJ"))
{
CLog::Log(LOGINFO,"HD DVD: Checking for playlist.");
// find playlist file
Expand All @@ -239,7 +240,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
}

// Standard Content HD DVD (few discs?)
if (name.Equals("HVDVD_TS") && bAllowVideo
if (StringUtils::EqualsNoCase(name, "HVDVD_TS") && bAllowVideo
&& (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
if (hddvdname == "")
Expand Down Expand Up @@ -300,7 +301,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
item.m_lStartOffset = STARTOFFSET_RESUME;

// get playername
CStdString hddvdplayer = CPlayerCoreFactory::Get().GetPlayerName(CPlayerCoreFactory::Get().GetDefaultPlayer(item));
std::string hddvdplayer = CPlayerCoreFactory::Get().GetPlayerName(CPlayerCoreFactory::Get().GetDefaultPlayer(item));

// Single *.xpl or *.ifo files require an external player to handle playback.
// If no matching rule was found, DVDPlayer will be default player.
Expand All @@ -324,10 +325,10 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
}

// Video CDs can have multiple file formats. First we need to determine which one is used on the CD
CStdString strExt;
if (name.Equals("MPEGAV"))
std::string strExt;
if (StringUtils::EqualsNoCase(name, "MPEGAV"))
strExt = ".dat";
if (name.Equals("MPEG2"))
if (StringUtils::EqualsNoCase(name, "MPEG2"))
strExt = ".mpg";

// If a file format was extracted we are sure this is a VCD. Autoplay if settings indicate we should.
Expand All @@ -351,7 +352,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
&& (bypassSettings))
{
bPlaying = true;
CStdString strExec = StringUtils::Format("RecursiveSlideShow(%s)", pItem->GetPath().c_str());
std::string strExec = StringUtils::Format("RecursiveSlideShow(%s)", pItem->GetPath().c_str());
CBuiltins::Execute(strExec);
return true;
}
Expand Down Expand Up @@ -428,7 +429,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
if (!pItem->m_bIsFolder && pItem->IsPicture())
{
bPlaying = true;
CStdString strExec = StringUtils::Format("RecursiveSlideShow(%s)", strDrive.c_str());
std::string strExec = StringUtils::Format("RecursiveSlideShow(%s)", strDrive.c_str());
CBuiltins::Execute(strExec);
break;
}
Expand Down Expand Up @@ -491,14 +492,14 @@ bool CAutorun::IsEnabled() const
return m_bEnable;
}

bool CAutorun::PlayDiscAskResume(const CStdString& path)
bool CAutorun::PlayDiscAskResume(const std::string& path)
{
return PlayDisc(path, true, !CanResumePlayDVD(path) || CGUIDialogYesNo::ShowAndGetInput(341, -1, -1, -1, 13404, 12021));
}

bool CAutorun::CanResumePlayDVD(const CStdString& path)
bool CAutorun::CanResumePlayDVD(const std::string& path)
{
CStdString strUniqueId = g_mediaManager.GetDiskUniqueId(path);
std::string strUniqueId = g_mediaManager.GetDiskUniqueId(path);
if (!strUniqueId.empty())
{
CVideoDatabase dbs;
Expand Down
Loading

0 comments on commit ec3f48c

Please sign in to comment.