diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2014-07-14 11:55:22 +1200 |
---|---|---|
committer | jmarshallnz <jcmarsha@gmail.com> | 2014-07-14 11:55:22 +1200 |
commit | 7b8fcdbfa67b842fa427c79a0f75e940ddbdfb75 (patch) | |
tree | 88b14b74370842b16551d775419b471d0fe4e546 | |
parent | b0a93739ab167315a60b4b50bb1a6209af78d663 (diff) | |
parent | 7d3889a3aa00648b0551ad710939c7a36da77feb (diff) |
Merge pull request #4987 from jmarshallnz/stdstring_removal_part2
Stdstring removal part2
683 files changed, 5413 insertions, 5432 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 4f6edc764e..749e3c05e2 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2085,7 +2085,7 @@ void CApplication::UnloadSkin(bool forReload /* = false */) bool CApplication::LoadUserWindows() { // Start from wherever home.xml is - std::vector<CStdString> vecSkinPath; + std::vector<std::string> vecSkinPath; g_SkinInfo->GetSkinPaths(vecSkinPath); for (unsigned int i = 0;i < vecSkinPath.size();++i) { @@ -2207,7 +2207,7 @@ float CApplication::GetDimScreenSaverLevel() const return 0; if (!m_screenSaver->GetSetting("level").empty()) - return 100.0f - (float)atof(m_screenSaver->GetSetting("level")); + return 100.0f - (float)atof(m_screenSaver->GetSetting("level").c_str()); return 100.0f; } diff --git a/xbmc/Application.h b/xbmc/Application.h index 171b51e27b..ca2d0c50b0 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -26,6 +26,7 @@ #include "guilib/IMsgTargetCallback.h" #include "threads/Condition.h" #include "utils/GlobalsHandling.h" +#include "utils/StdString.h" #include <map> diff --git a/xbmc/ApplicationPlayer.cpp b/xbmc/ApplicationPlayer.cpp index 62a463072a..9742006784 100644 --- a/xbmc/ApplicationPlayer.cpp +++ b/xbmc/ApplicationPlayer.cpp @@ -150,7 +150,7 @@ int CApplicationPlayer::GetChapterCount() return 0; } -void CApplicationPlayer::GetChapterName(CStdString& strChapterName) +void CApplicationPlayer::GetChapterName(std::string& strChapterName) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) @@ -262,7 +262,7 @@ void CApplicationPlayer::SeekTime(int64_t iTime) player->SeekTime(iTime); } -CStdString CApplicationPlayer::GetPlayingTitle() +std::string CApplicationPlayer::GetPlayingTitle() { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) @@ -422,7 +422,7 @@ void CApplicationPlayer::DoAudioWork() player->DoAudioWork(); } -CStdString CApplicationPlayer::GetPlayerState() +std::string CApplicationPlayer::GetPlayerState() { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) @@ -443,7 +443,7 @@ bool CApplicationPlayer::GetStreamDetails(CStreamDetails &details) return (player && player->GetStreamDetails(details)); } -bool CApplicationPlayer::SetPlayerState(CStdString state) +bool CApplicationPlayer::SetPlayerState(const std::string& state) { boost::shared_ptr<IPlayer> player = GetInternal(); return (player && player->SetPlayerState(state)); @@ -527,7 +527,7 @@ void CApplicationPlayer::SetSubtitleVisible(bool bVisible) player->SetSubtitleVisible(bVisible); } -int CApplicationPlayer::AddSubtitle(const CStdString& strSubPath) +int CApplicationPlayer::AddSubtitle(const std::string& strSubPath) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) @@ -584,21 +584,21 @@ void CApplicationPlayer::GetSubtitleCapabilities(std::vector<int> &subCaps) player->GetSubtitleCapabilities(subCaps); } -void CApplicationPlayer::GetAudioInfo( CStdString& strAudioInfo) +void CApplicationPlayer::GetAudioInfo(std::string& strAudioInfo) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) player->GetAudioInfo(strAudioInfo); } -void CApplicationPlayer::GetVideoInfo( CStdString& strVideoInfo) +void CApplicationPlayer::GetVideoInfo(std::string& strVideoInfo) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) player->GetVideoInfo(strVideoInfo); } -void CApplicationPlayer::GetGeneralInfo( CStdString& strVideoInfo) +void CApplicationPlayer::GetGeneralInfo(std::string& strVideoInfo) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) diff --git a/xbmc/ApplicationPlayer.h b/xbmc/ApplicationPlayer.h index 53be002d2d..964570c251 100644 --- a/xbmc/ApplicationPlayer.h +++ b/xbmc/ApplicationPlayer.h @@ -80,14 +80,14 @@ public: void SetPlaySpeed(int iSpeed, bool bApplicationMuted); // proxy calls - int AddSubtitle(const CStdString& strSubPath); + int AddSubtitle(const std::string& strSubPath); bool CanPause(); bool CanRecord(); bool CanSeek(); bool ControlsVolume() const; void DoAudioWork(); void GetAudioCapabilities(std::vector<int> &audioCaps); - void GetAudioInfo( CStdString& strAudioInfo); + void GetAudioInfo(std::string& strAudioInfo); int GetAudioStream(); int GetAudioStreamCount(); void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info); @@ -95,13 +95,13 @@ public: float GetCachePercentage() const; int GetChapterCount(); int GetChapter(); - void GetChapterName(CStdString& strChapterName); + void GetChapterName(std::string& strChapterName); void GetDeinterlaceMethods(std::vector<int> &deinterlaceMethods); void GetDeinterlaceModes(std::vector<int> &deinterlaceModes); - void GetGeneralInfo( CStdString& strVideoInfo); + void GetGeneralInfo(std::string& strVideoInfo); float GetPercentage() const; - CStdString GetPlayerState(); - CStdString GetPlayingTitle(); + std::string GetPlayerState(); + std::string GetPlayingTitle(); void GetRenderFeatures(std::vector<int> &renderFeatures); void GetScalingMethods(std::vector<int> &scalingMethods); bool GetStreamDetails(CStreamDetails &details); @@ -113,7 +113,7 @@ public: TextCacheStruct_t* GetTeletextCache(); int64_t GetTime() const; int64_t GetTotalTime() const; - void GetVideoInfo( CStdString& strVideoInfo); + void GetVideoInfo(std::string& strVideoInfo); void GetVideoStreamInfo(SPlayerVideoStreamInfo &info); bool HasAudio() const; bool HasMenu() const; @@ -143,7 +143,7 @@ public: void SetAVDelay(float fValue = 0.0f); void SetDynamicRangeCompression(long drc); void SetMute(bool bOnOff); - bool SetPlayerState(CStdString state); + bool SetPlayerState(const std::string& state); void SetSubtitle(int iStream); void SetSubTitleDelay(float fValue = 0.0f); void SetSubtitleVisible(bool bVisible); diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 66a7437c20..1364ce1c4b 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -1965,14 +1965,14 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *f break; case NETWORK_DNS1_ADDRESS: { - vector<CStdString> nss = g_application.getNetwork().GetNameServers(); + vector<std::string> nss = g_application.getNetwork().GetNameServers(); if (nss.size() >= 1) return nss[0]; } break; case NETWORK_DNS2_ADDRESS: { - vector<CStdString> nss = g_application.getNetwork().GetNameServers(); + vector<std::string> nss = g_application.getNetwork().GetNameServers(); if (nss.size() >= 2) return nss[1]; } @@ -3777,9 +3777,9 @@ CStdString CGUIInfoManager::GetVideoLabel(int item) case VIDEOPLAYER_GENRE: return tag->GetEPGNow(epgTag) ? StringUtils::Join(epgTag.Genre(), g_advancedSettings.m_videoItemSeparator) : ""; case VIDEOPLAYER_PLOT: - return tag->GetEPGNow(epgTag) ? epgTag.Plot() : StringUtils::EmptyString; + return tag->GetEPGNow(epgTag) ? epgTag.Plot() : ""; case VIDEOPLAYER_PLOT_OUTLINE: - return tag->GetEPGNow(epgTag) ? epgTag.PlotOutline() : StringUtils::EmptyString; + return tag->GetEPGNow(epgTag) ? epgTag.PlotOutline() : ""; case VIDEOPLAYER_STARTTIME: return tag->GetEPGNow(epgTag) ? epgTag.StartAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false); case VIDEOPLAYER_ENDTIME: @@ -3795,9 +3795,9 @@ CStdString CGUIInfoManager::GetVideoLabel(int item) case VIDEOPLAYER_NEXT_GENRE: return tag->GetEPGNext(epgTag) ? StringUtils::Join(epgTag.Genre(), g_advancedSettings.m_videoItemSeparator) : ""; case VIDEOPLAYER_NEXT_PLOT: - return tag->GetEPGNext(epgTag) ? epgTag.Plot() : StringUtils::EmptyString; + return tag->GetEPGNext(epgTag) ? epgTag.Plot() : ""; case VIDEOPLAYER_NEXT_PLOT_OUTLINE: - return tag->GetEPGNext(epgTag) ? epgTag.PlotOutline() : StringUtils::EmptyString; + return tag->GetEPGNext(epgTag) ? epgTag.PlotOutline() : ""; case VIDEOPLAYER_NEXT_STARTTIME: return tag->GetEPGNext(epgTag) ? epgTag.StartAsLocalTime().GetAsLocalizedTime("", false) : CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false); case VIDEOPLAYER_NEXT_ENDTIME: @@ -5250,8 +5250,8 @@ void CGUIInfoManager::UpdateFromTuxBox() // Set m_currentMovieDuration if(!g_tuxbox.sCurSrvData.current_event_duration.empty() && !g_tuxbox.sCurSrvData.next_event_description.empty() && - !g_tuxbox.sCurSrvData.current_event_duration.Equals("-") && - !g_tuxbox.sCurSrvData.next_event_description.Equals("-")) + g_tuxbox.sCurSrvData.current_event_duration != "-" && + g_tuxbox.sCurSrvData.next_event_description != "-") { StringUtils::Replace(g_tuxbox.sCurSrvData.current_event_duration, "(",""); StringUtils::Replace(g_tuxbox.sCurSrvData.current_event_duration, ")",""); @@ -5267,8 +5267,8 @@ void CGUIInfoManager::UpdateFromTuxBox() //Set strVideoGenre if (!g_tuxbox.sCurSrvData.current_event_description.empty() && !g_tuxbox.sCurSrvData.next_event_description.empty() && - !g_tuxbox.sCurSrvData.current_event_description.Equals("-") && - !g_tuxbox.sCurSrvData.next_event_description.Equals("-")) + g_tuxbox.sCurSrvData.current_event_description != "-" && + g_tuxbox.sCurSrvData.next_event_description != "-") { CStdString genre = StringUtils::Format("%s %s - (%s: %s)", g_localizeStrings.Get(143).c_str(), @@ -5279,7 +5279,7 @@ void CGUIInfoManager::UpdateFromTuxBox() } //Set m_currentMovie.m_director - if (!g_tuxbox.sCurSrvData.current_event_details.Equals("-") && + if (g_tuxbox.sCurSrvData.current_event_details != "-" && !g_tuxbox.sCurSrvData.current_event_details.empty()) { m_currentFile->GetVideoInfoTag()->m_director = StringUtils::Split(g_tuxbox.sCurSrvData.current_event_details, g_advancedSettings.m_videoItemSeparator); @@ -5541,7 +5541,7 @@ int CGUIInfoManager::TranslateSkinVariableString(const CStdString& name, int con for (vector<CSkinVariableString>::const_iterator it = m_skinVariableStrings.begin(); it != m_skinVariableStrings.end(); ++it) { - if (it->GetName().Equals(name) && it->GetContext() == context) + if (StringUtils::EqualsNoCase(it->GetName(), name) && it->GetContext() == context) return it - m_skinVariableStrings.begin() + CONDITIONAL_LABEL_START; } return 0; diff --git a/xbmc/NfoFile.h b/xbmc/NfoFile.h index f830f6d4b8..4193a2ec75 100644 --- a/xbmc/NfoFile.h +++ b/xbmc/NfoFile.h @@ -30,6 +30,7 @@ #include "addons/Scraper.h" #include "utils/CharsetConverter.h" #include "utils/XMLUtils.h" +#include "utils/StdString.h" class CNfoFile { diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp index 41c6d3161a..5348c74227 100644 --- a/xbmc/PartyModeManager.cpp +++ b/xbmc/PartyModeManager.cpp @@ -113,7 +113,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS CMusicDatabase db; if (db.Open()) { - set<CStdString> playlists; + set<std::string> playlists; if ( playlistLoaded ) m_strCurrentFilterMusic = playlist.GetWhereClause(db, playlists); @@ -142,7 +142,7 @@ bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUS CVideoDatabase db; if (db.Open()) { - set<CStdString> playlists; + set<std::string> playlists; if ( playlistLoaded ) m_strCurrentFilterVideo = playlist.GetWhereClause(db, playlists); diff --git a/xbmc/TextureDatabase.cpp b/xbmc/TextureDatabase.cpp index 6916b601e4..2af5ec8fc1 100644 --- a/xbmc/TextureDatabase.cpp +++ b/xbmc/TextureDatabase.cpp @@ -72,14 +72,14 @@ int CTextureRule::TranslateField(const char *field) const return FieldNone; } -CStdString CTextureRule::TranslateField(int field) const +std::string CTextureRule::TranslateField(int field) const { for (unsigned int i = 0; i < NUM_FIELDS; i++) if (field == fields[i].field) return fields[i].string; return "none"; } -CStdString CTextureRule::GetField(int field, const CStdString &type) const +std::string CTextureRule::GetField(int field, const std::string &type) const { if (field == TF_Id) return "texture.id"; else if (field == TF_Url) return "texture.url"; @@ -100,9 +100,12 @@ CDatabaseQueryRule::FIELD_TYPE CTextureRule::GetFieldType(int field) const return TEXT_FIELD; } -CStdString CTextureRule::FormatParameter(const CStdString &operatorString, const CStdString ¶m, const CDatabase &db, const CStdString &strType) const +std::string CTextureRule::FormatParameter(const std::string &operatorString, + const std::string ¶m, + const CDatabase &db, + const std::string &strType) const { - CStdString parameter(param); + std::string parameter(param); if (m_field == TF_Url) parameter = CTextureUtils::UnwrapImageURL(param); return CDatabaseQueryRule::FormatParameter(operatorString, parameter, db, strType); @@ -285,8 +288,8 @@ bool CTextureDatabase::GetTextures(CVariant &items, const Filter &filter) if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = "SELECT %s FROM texture JOIN sizes ON (texture.id=sizes.idtexture AND sizes.size=1)"; - CStdString sqlFilter; + std::string sql = "SELECT %s FROM texture JOIN sizes ON (texture.id=sizes.idtexture AND sizes.size=1)"; + std::string sqlFilter; if (!CDatabase::BuildSQL("", filter, sqlFilter)) return false; diff --git a/xbmc/TextureDatabase.h b/xbmc/TextureDatabase.h index 77207cb076..088199cbbc 100644 --- a/xbmc/TextureDatabase.h +++ b/xbmc/TextureDatabase.h @@ -35,10 +35,13 @@ public: static void GetAvailableFields(std::vector<std::string> &fieldList); protected: virtual int TranslateField(const char *field) const; - virtual CStdString TranslateField(int field) const; - virtual CStdString GetField(int field, const CStdString& type) const; + virtual std::string TranslateField(int field) const; + virtual std::string GetField(int field, const std::string& type) const; virtual FIELD_TYPE GetFieldType(int field) const; - virtual CStdString FormatParameter(const CStdString &negate, const CStdString &oper, const CDatabase &db, const CStdString &type) const; + virtual std::string FormatParameter(const std::string &negate, + const std::string &oper, + const CDatabase &db, + const std::string &type) const; }; class CTextureUtils diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp index 38b7b7129a..1bdb5f14a9 100644 --- a/xbmc/addons/Addon.cpp +++ b/xbmc/addons/Addon.cpp @@ -90,7 +90,7 @@ static const TypeMapping types[] = {"xbmc.audioencoder", ADDON_AUDIOENCODER, 200, "DefaultAddonAudioEncoder.png" }, {"xbmc.service", ADDON_SERVICE, 24018, "DefaultAddonService.png" }}; -const CStdString TranslateType(const ADDON::TYPE &type, bool pretty/*=false*/) +const std::string TranslateType(const ADDON::TYPE &type, bool pretty/*=false*/) { for (unsigned int index=0; index < sizeof(types)/sizeof(types[0]); ++index) { @@ -106,18 +106,18 @@ const CStdString TranslateType(const ADDON::TYPE &type, bool pretty/*=false*/) return ""; } -TYPE TranslateType(const CStdString &string) +TYPE TranslateType(const std::string &string) { for (unsigned int index=0; index < sizeof(types)/sizeof(types[0]); ++index) { const TypeMapping &map = types[index]; - if (string.Equals(map.name)) + if (string == map.name) return map.type; } return ADDON_UNKNOWN; } -const CStdString GetIcon(const ADDON::TYPE& type) +const std::string GetIcon(const ADDON::TYPE& type) { for (unsigned int index=0; index < sizeof(types)/sizeof(types[0]); ++index) { @@ -130,20 +130,20 @@ const CStdString GetIcon(const ADDON::TYPE& type) #define EMPTY_IF(x,y) \ { \ - CStdString fan=CAddonMgr::Get().GetExtValue(metadata->configuration, x); \ - if (fan.Equals("true")) \ + std::string fan=CAddonMgr::Get().GetExtValue(metadata->configuration, x); \ + if (fan == "true") \ y.clear(); \ } #define SS(x) (x) ? x : "" AddonProps::AddonProps(const cp_extension_t *ext) - : id(ext->plugin->identifier) + : id(SS(ext->plugin->identifier)) , version(SS(ext->plugin->version)) , minversion(SS(ext->plugin->abi_bw_compatibility)) - , name(ext->plugin->name) - , path(ext->plugin->plugin_path) - , author(ext->plugin->provider_name) + , name(SS(ext->plugin->name)) + , path(SS(ext->plugin->plugin_path)) + , author(SS(ext->plugin->provider_name)) , stars(0) { if (ext->ext_point_id) @@ -160,7 +160,7 @@ AddonProps::AddonProps(const cp_extension_t *ext) description = CAddonMgr::Get().GetTranslatedString(metadata->configuration, "description"); disclaimer = CAddonMgr::Get().GetTranslatedString(metadata->configuration, "disclaimer"); license = CAddonMgr::Get().GetExtValue(metadata->configuration, "license"); - CStdString language; + std::string language; language = CAddonMgr::Get().GetExtValue(metadata->configuration, "language"); if (!language.empty()) extrainfo.insert(make_pair("language",language)); @@ -173,12 +173,12 @@ AddonProps::AddonProps(const cp_extension_t *ext) } AddonProps::AddonProps(const cp_plugin_info_t *plugin) - : id(plugin->identifier) + : id(SS(plugin->identifier)) , version(SS(plugin->version)) , minversion(SS(plugin->abi_bw_compatibility)) - , name(plugin->name) - , path(plugin->plugin_path) - , author(plugin->provider_name) + , name(SS(plugin->name)) + , path(SS(plugin->plugin_path)) + , author(SS(plugin->provider_name)) , stars(0) { BuildDependencies(plugin); @@ -242,7 +242,7 @@ void AddonProps::BuildDependencies(const cp_plugin_info_t *plugin) if (!plugin) return; for (unsigned int i = 0; i < plugin->num_imports; ++i) - dependencies.insert(make_pair(CStdString(plugin->imports[i].plugin_id), + dependencies.insert(make_pair(std::string(plugin->imports[i].plugin_id), make_pair(AddonVersion(SS(plugin->imports[i].version)), plugin->imports[i].optional != 0))); } @@ -331,7 +331,7 @@ void CAddon::BuildLibName(const cp_extension_t *extension) if (!extension) { m_strLibName = "default"; - CStdString ext; + std::string ext; switch (m_props.type) { case ADDON_SCRAPER_ALBUMS: @@ -395,7 +395,7 @@ void CAddon::BuildLibName(const cp_extension_t *extension) case ADDON_REPOSITORY: case ADDON_AUDIOENCODER: { - CStdString temp = CAddonMgr::Get().GetExtValue(extension->configuration, "@library"); + std::string temp = CAddonMgr::Get().GetExtValue(extension->configuration, "@library"); m_strLibName = temp; } break; @@ -412,7 +412,7 @@ void CAddon::BuildLibName(const cp_extension_t *extension) bool CAddon::LoadStrings() { // Path where the language strings reside - CStdString chosenPath = URIUtils::AddFileToFolder(m_props.path, "resources/language/"); + std::string chosenPath = URIUtils::AddFileToFolder(m_props.path, "resources/language/"); m_hasStrings = m_strings.Load(chosenPath, CSettings::Get().GetString("locale.language")); return m_checkedStrings = true; @@ -425,7 +425,7 @@ void CAddon::ClearStrings() m_hasStrings = false; } -CStdString CAddon::GetString(uint32_t id) +std::string CAddon::GetString(uint32_t id) { if (!m_hasStrings && ! m_checkedStrings && !LoadStrings()) return ""; @@ -447,7 +447,7 @@ bool CAddon::LoadSettings(bool bForce /* = false*/) return true; if (!m_hasSettings) return false; - CStdString addonFileName = URIUtils::AddFileToFolder(m_props.path, "resources/settings.xml"); + std::string addonFileName = URIUtils::AddFileToFolder(m_props.path, "resources/settings.xml"); if (!m_addonXmlDoc.LoadFile(addonFileName)) { @@ -498,9 +498,9 @@ void CAddon::SaveSettings(void) return; // no settings to save // break down the path into directories - CStdString strAddon = URIUtils::GetDirectory(m_userSettingsPath); + std::string strAddon = URIUtils::GetDirectory(m_userSettingsPath); URIUtils::RemoveSlashAtEnd(strAddon); - CStdString strRoot = URIUtils::GetDirectory(strAddon); + std::string strRoot = URIUtils::GetDirectory(strAddon); URIUtils::RemoveSlashAtEnd(strRoot); // create the individual folders @@ -521,18 +521,18 @@ void CAddon::SaveSettings(void) #endif } -CStdString CAddon::GetSetting(const CStdString& key) +std::string CAddon::GetSetting(const std::string& key) { if (!LoadSettings()) return ""; // no settings available - map<CStdString, CStdString>::const_iterator i = m_settings.find(key); + map<std::string, std::string>::const_iterator i = m_settings.find(key); if (i != m_settings.end()) return i->second; return ""; } -void CAddon::UpdateSetting(const CStdString& key, const CStdString& value) +void CAddon::UpdateSetting(const std::string& key, const std::string& value) { LoadSettings(); if (key.empty()) return; @@ -575,7 +575,7 @@ void CAddon::SettingsToXML(CXBMCTinyXML &doc) const { TiXmlElement node("settings"); doc.InsertEndChild(node); - for (map<CStdString, CStdString>::const_iterator i = m_settings.begin(); i != m_settings.end(); ++i) + for (map<std::string, std::string>::const_iterator i = m_settings.begin(); i != m_settings.end(); ++i) { TiXmlElement nodeSetting("setting"); nodeSetting.SetAttribute("id", i->first.c_str()); @@ -595,14 +595,14 @@ void CAddon::BuildProfilePath() m_profile = StringUtils::Format("special://profile/addon_data/%s/", ID().c_str()); } -const CStdString CAddon::Icon() const +const std::string CAddon::Icon() const { if (CURL::IsFullPath(m_props.icon)) return m_props.icon; return URIUtils::AddFileToFolder(m_props.path, m_props.icon); } -const CStdString CAddon::LibPath() const +const std::string CAddon::LibPath() const { return URIUtils::AddFileToFolder(m_props.path, m_strLibName); } diff --git a/xbmc/addons/Addon.h b/xbmc/addons/Addon.h index fc37e7d993..68da98c2bf 100644 --- a/xbmc/addons/Addon.h +++ b/xbmc/addons/Addon.h @@ -24,6 +24,7 @@ #include "utils/XBMCTinyXML.h" #include "guilib/LocalizeStrings.h" #include "utils/ISerializable.h" +#include <vector> class TiXmlElement; class CAddonCallbacksAddon; @@ -37,14 +38,14 @@ namespace ADDON typedef std::vector<AddonPtr>::iterator IVECADDONS; // utils -const CStdString TranslateType(const TYPE &type, bool pretty=false); -const CStdString GetIcon(const TYPE &type); - TYPE TranslateType(const CStdString &string); +const std::string TranslateType(const TYPE &type, bool pretty=false); +const std::string GetIcon(const TYPE &type); + TYPE TranslateType(const std::string &string); class AddonProps : public ISerializable { public: - AddonProps(const CStdString &id, TYPE type, const CStdString &versionstr, const CStdString &minversionstr) + AddonProps(const std::string &id, TYPE type, const std::string &versionstr, const std::string &minversionstr) : id(id) , type(type) , version(versionstr) @@ -65,24 +66,24 @@ public: void Serialize(CVariant &variant) const; - CStdString id; + std::string id; TYPE type; AddonVersion version; AddonVersion minversion; - CStdString name; - CStdString license; - CStdString summary; - CStdString description; - CStdString path; - CStdString libname; - CStdString author; - CStdString source; - CStdString icon; - CStdString disclaimer; - CStdString changelog; - CStdString fanart; + std::string name; + std::string license; + std::string summary; + std::string description; + std::string path; + std::string libname; + std::string author; + std::string source; + std::string icon; + std::string disclaimer; + std::string changelog; + std::string fanart; ADDONDEPS dependencies; - CStdString broken; + std::string broken; InfoMap extrainfo; int stars; private: @@ -122,7 +123,7 @@ public: \param value the value that the setting should take \sa LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting */ - void UpdateSetting(const CStdString& key, const CStdString& value); + void UpdateSetting(const std::string& key, const std::string& value); /*! \brief Retrieve a particular settings value If a previously configured user setting is available, we return it's value, else we return the default (if available) @@ -130,33 +131,33 @@ public: \return the current value of the setting, or the default if the setting has yet to be configured. \sa LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting */ - virtual CStdString GetSetting(const CStdString& key); + virtual std::string GetSetting(const std::string& key); TiXmlElement* GetSettingsXML(); - virtual CStdString GetString(uint32_t id); + virtual std::string GetString(uint32_t id); // properties TYPE Type() const { return m_props.type; } bool IsType(TYPE type) const { return type == m_props.type; } AddonProps Props() const { return m_props; } AddonProps& Props() { return m_props; } - const CStdString ID() const { return m_props.id; } - const CStdString Name() const { return m_props.name; } + const std::string ID() const { return m_props.id; } + const std::string Name() const { return m_props.name; } bool Enabled() const { return m_enabled; } virtual bool IsInUse() const { return false; }; const AddonVersion Version() const { return m_props.version; } const AddonVersion MinVersion() const { return m_props.minversion; } - const CStdString Summary() const { return m_props.summary; } - const CStdString Description() const { return m_props.description; } - const CStdString Path() const { return m_props.path; } - const CStdString Profile() const { return m_profile; } - const CStdString LibPath() const; - const CStdString Author() const { return m_props.author; } - const CStdString ChangeLog() const { return m_props.changelog; } - const CStdString FanArt() const { return m_props.fanart; } - const CStdString Icon() const; + const std::string Summary() const { return m_props.summary; } + const std::string Description() const { return m_props.description; } + const std::string Path() const { return m_props.path; } + const std::string Profile() const { return m_profile; } + const std::string LibPath() const; + const std::string Author() const { return m_props.author; } + const std::string ChangeLog() const { return m_props.changelog; } + const std::string FanArt() const { return m_props.fanart; } + const std::string Icon() const; int Stars() const { return m_props.stars; } - const CStdString Disclaimer() const { return m_props.disclaimer; } + const std::string Disclaimer() const { return m_props.disclaimer; } const InfoMap &ExtraInfo() const { return m_props.extrainfo; } const ADDONDEPS &GetDeps() const { return m_props.dependencies; } @@ -209,14 +210,14 @@ protected: void SettingsToXML(CXBMCTinyXML &doc) const; CXBMCTinyXML m_addonXmlDoc; - CStdString m_strLibName; + std::string m_strLibName; bool m_settingsLoaded; bool m_userSettingsLoaded; private: friend class CAddonMgr; AddonProps m_props; - CStdString m_userSettingsPath; + std::string m_userSettingsPath; void BuildProfilePath(); virtual bool IsAddonLibrary() { return false; } @@ -230,10 +231,10 @@ private: bool m_checkedStrings; bool m_hasSettings; - CStdString m_profile; + std::string m_profile; bool m_enabled; CLocalizeStrings m_strings; - std::map<CStdString, CStdString> m_settings; + std::map<std::string, std::string> m_settings; }; class CAddonLibrary : public CAddon diff --git a/xbmc/addons/AddonCallbacksAddon.cpp b/xbmc/addons/AddonCallbacksAddon.cpp index 7ad5dfafcc..24450e9e9f 100644 --- a/xbmc/addons/AddonCallbacksAddon.cpp +++ b/xbmc/addons/AddonCallbacksAddon.cpp @@ -113,7 +113,7 @@ void CAddonCallbacksAddon::AddOnLog(void *addonData, const addon_log_t addonLogL break; } - CStdString strXbmcMessage = StringUtils::Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage); + std::string strXbmcMessage = StringUtils::Format("AddOnLog: %s: %s", addonHelper->m_addon->Name().c_str(), strMessage); CLog::Log(xbmcLogLevel, "%s", strXbmcMessage.c_str()); } catch (std::exception &e) @@ -214,7 +214,7 @@ bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSetti else if (type == "number" || type == "enum" || type == "labelenum") { - *(int*) settingValue = (int) atoi(addonHelper->m_addon->GetSetting(id)); + *(int*) settingValue = (int) atoi(addonHelper->m_addon->GetSetting(id).c_str()); return true; } else if (type == "bool") @@ -227,12 +227,12 @@ bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSetti const char *option = setting->Attribute("option"); if (option && strcmpi(option, "int") == 0) { - *(int*) settingValue = (int) atoi(addonHelper->m_addon->GetSetting(id)); + *(int*) settingValue = (int) atoi(addonHelper->m_addon->GetSetting(id).c_str()); return true; } else { - *(float*) settingValue = (float) atof(addonHelper->m_addon->GetSetting(id)); + *(float*) settingValue = (float) atof(addonHelper->m_addon->GetSetting(id).c_str()); return true; } } @@ -254,7 +254,7 @@ bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSetti char* CAddonCallbacksAddon::UnknownToUTF8(const char *strSource) { - CStdString string; + std::string string; if (strSource != NULL) g_charsetConverter.unknownToUTF8(strSource, string); else @@ -271,7 +271,7 @@ char* CAddonCallbacksAddon::GetLocalizedString(const void* addonData, long dwCod CAddonCallbacksAddon* addonHelper = helper->GetHelperAddon(); - CStdString string; + std::string string; if (dwCode >= 30000 && dwCode <= 30999) string = addonHelper->m_addon->GetString(dwCode).c_str(); else if (dwCode >= 32000 && dwCode <= 32999) @@ -289,7 +289,7 @@ char* CAddonCallbacksAddon::GetDVDMenuLanguage(const void* addonData) if (!helper) return NULL; - CStdString string = g_langInfo.GetDVDMenuLanguage(); + std::string string = g_langInfo.GetDVDMenuLanguage(); char* buffer = strdup(string.c_str()); return buffer; diff --git a/xbmc/addons/AddonCallbacksGUI.cpp b/xbmc/addons/AddonCallbacksGUI.cpp index 79d6370f7d..ba4b2078e9 100644 --- a/xbmc/addons/AddonCallbacksGUI.cpp +++ b/xbmc/addons/AddonCallbacksGUI.cpp @@ -178,7 +178,7 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam CAddonCallbacksGUI* guiHelper = helper->GetHelperGUI(); RESOLUTION_INFO res; - CStdString strSkinPath; + std::string strSkinPath; if (!forceFallback) { /* Check to see if the XML file exists in current skin. If not use @@ -188,7 +188,7 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam if (!XFILE::CFile::Exists(strSkinPath)) { /* Check for the matching folder for the skin in the fallback skins folder */ - CStdString basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources"); + std::string basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources"); basePath = URIUtils::AddFileToFolder(basePath, "skins"); basePath = URIUtils::AddFileToFolder(basePath, URIUtils::GetFileName(g_SkinInfo->Path())); strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res, basePath); @@ -204,9 +204,9 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam if (forceFallback) { //FIXME make this static method of current skin? - CStdString str("none"); + std::string str("none"); AddonProps props(str, ADDON_SKIN, str, str); - CStdString basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources"); + std::string basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources"); basePath = URIUtils::AddFileToFolder(basePath, "skins"); basePath = URIUtils::AddFileToFolder(basePath, defaultSkin); props.path = basePath; @@ -518,7 +518,7 @@ void CAddonCallbacksGUI::Window_SetProperty(void *addonData, GUIHANDLE handle, c if (!pWindow) return; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -545,7 +545,7 @@ void CAddonCallbacksGUI::Window_SetPropertyInt(void *addonData, GUIHANDLE handle if (!pWindow) return; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -572,7 +572,7 @@ void CAddonCallbacksGUI::Window_SetPropertyBool(void *addonData, GUIHANDLE handl if (!pWindow) return; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -599,7 +599,7 @@ void CAddonCallbacksGUI::Window_SetPropertyDouble(void *addonData, GUIHANDLE han if (!pWindow) return; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -626,7 +626,7 @@ const char* CAddonCallbacksGUI::Window_GetProperty(void *addonData, GUIHANDLE ha if (!pWindow) return NULL; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -655,7 +655,7 @@ int CAddonCallbacksGUI::Window_GetPropertyInt(void *addonData, GUIHANDLE handle, if (!pWindow) return -1; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -684,7 +684,7 @@ bool CAddonCallbacksGUI::Window_GetPropertyBool(void *addonData, GUIHANDLE handl if (!pWindow) return false; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -713,7 +713,7 @@ double CAddonCallbacksGUI::Window_GetPropertyDouble(void *addonData, GUIHANDLE h if (!pWindow) return 0.0; - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); Lock(); @@ -1131,7 +1131,7 @@ const char* CAddonCallbacksGUI::Control_Progress_GetDescription(void *addonData, return NULL; CGUIProgressControl *pControl = (CGUIProgressControl*)handle; - CStdString string = pControl->GetDescription(); + std::string string = pControl->GetDescription(); char *buffer = (char*) malloc (string.length()+1); strcpy(buffer, string.c_str()); @@ -1169,7 +1169,7 @@ const char* CAddonCallbacksGUI::ListItem_GetLabel(void *addonData, GUIHANDLE han if (!helper || !handle) return NULL; - CStdString string = ((CFileItem*)handle)->GetLabel(); + std::string string = ((CFileItem*)handle)->GetLabel(); char *buffer = (char*) malloc (string.length()+1); strcpy(buffer, string.c_str()); return buffer; @@ -1190,7 +1190,7 @@ const char* CAddonCallbacksGUI::ListItem_GetLabel2(void *addonData, GUIHANDLE ha if (!helper || !handle) return NULL; - CStdString string = ((CFileItem*)handle)->GetLabel2(); + std::string string = ((CFileItem*)handle)->GetLabel2(); char *buffer = (char*) malloc (string.length()+1); strcpy(buffer, string.c_str()); @@ -1296,8 +1296,8 @@ void CAddonCallbacksGUI::RenderAddon_Delete(void *addonData, GUIHANDLE handle) -CGUIAddonWindow::CGUIAddonWindow(int id, CStdString strXML, CAddon* addon) - : CGUIMediaWindow(id, strXML) +CGUIAddonWindow::CGUIAddonWindow(int id, const std::string& strXML, CAddon* addon) + : CGUIMediaWindow(id, strXML.c_str()) , m_iWindowId(id) , m_iOldWindowId(0) , m_bModal(false) @@ -1430,8 +1430,8 @@ bool CGUIAddonWindow::OnMessage(CGUIMessage& message) void CGUIAddonWindow::AllocResources(bool forceLoad /*= FALSE */) { - CStdString tmpDir = URIUtils::GetDirectory(GetProperty("xmlfile").asString()); - CStdString fallbackMediaPath; + std::string tmpDir = URIUtils::GetDirectory(GetProperty("xmlfile").asString()); + std::string fallbackMediaPath; URIUtils::GetParentPath(tmpDir, fallbackMediaPath); URIUtils::RemoveSlashAtEnd(fallbackMediaPath); m_mediaDir = fallbackMediaPath; @@ -1547,7 +1547,7 @@ void CGUIAddonWindow::SetupShares() } -CGUIAddonWindowDialog::CGUIAddonWindowDialog(int id, CStdString strXML, CAddon* addon) +CGUIAddonWindowDialog::CGUIAddonWindowDialog(int id, const std::string& strXML, CAddon* addon) : CGUIAddonWindow(id,strXML,addon) { m_bRunning = false; diff --git a/xbmc/addons/AddonCallbacksGUI.h b/xbmc/addons/AddonCallbacksGUI.h index fadd857f50..2a3df8f9c1 100644 --- a/xbmc/addons/AddonCallbacksGUI.h +++ b/xbmc/addons/AddonCallbacksGUI.h @@ -124,7 +124,7 @@ class CGUIAddonWindow : public CGUIMediaWindow friend class CAddonCallbacksGUI; public: - CGUIAddonWindow(int id, CStdString strXML, CAddon* addon); + CGUIAddonWindow(int id, const std::string& strXML, CAddon* addon); virtual ~CGUIAddonWindow(void); virtual bool OnMessage(CGUIMessage& message); @@ -162,13 +162,13 @@ protected: private: CEvent m_actionEvent; CAddon *m_addon; - CStdString m_mediaDir; + std::string m_mediaDir; }; class CGUIAddonWindowDialog : public CGUIAddonWindow { public: - CGUIAddonWindowDialog(int id, CStdString strXML, CAddon* addon); + CGUIAddonWindowDialog(int id, const std::string& strXML, CAddon* addon); virtual ~CGUIAddonWindowDialog(void); void Show(bool show = true); diff --git a/xbmc/addons/AddonCallbacksPVR.cpp b/xbmc/addons/AddonCallbacksPVR.cpp index 73dede1c9e..3e297f4eca 100644 --- a/xbmc/addons/AddonCallbacksPVR.cpp +++ b/xbmc/addons/AddonCallbacksPVR.cpp @@ -254,13 +254,13 @@ void CAddonCallbacksPVR::PVRRecording(void *addonData, const char *strName, cons return; } - CStdString strLine1; + std::string strLine1; if (bOnOff) strLine1 = StringUtils::Format(g_localizeStrings.Get(19197).c_str(), client->Name().c_str()); else strLine1 = StringUtils::Format(g_localizeStrings.Get(19198).c_str(), client->Name().c_str()); - CStdString strLine2; + std::string strLine2; if (strName) strLine2 = strName; else if (strFileName) diff --git a/xbmc/addons/AddonDatabase.cpp b/xbmc/addons/AddonDatabase.cpp index 1f24a3fe28..51a8da8146 100644 --- a/xbmc/addons/AddonDatabase.cpp +++ b/xbmc/addons/AddonDatabase.cpp @@ -109,7 +109,7 @@ int CAddonDatabase::AddAddon(const AddonPtr& addon, if (NULL == m_pDB.get()) return -1; if (NULL == m_pDS.get()) return -1; - CStdString sql = PrepareSQL("insert into addon (id, type, name, summary," + std::string sql = PrepareSQL("insert into addon (id, type, name, summary," "description, stars, path, icon, changelog, " "fanart, addonID, version, author, disclaimer, minversion)" " values(NULL, '%s', '%s', '%s', '%s', %i," @@ -160,7 +160,7 @@ AddonVersion CAddonDatabase::GetAddonVersion(const std::string &id) // there may be multiple addons with this id (eg from different repositories) in the database, // so we want to retrieve the latest version. Order by version won't work as the database // won't know that 1.10 > 1.2, so grab them all and order outside - CStdString sql = PrepareSQL("select version from addon where addonID='%s'",id.c_str()); + std::string sql = PrepareSQL("select version from addon where addonID='%s'",id.c_str()); m_pDS2->query(sql.c_str()); if (m_pDS2->eof()) @@ -182,7 +182,7 @@ AddonVersion CAddonDatabase::GetAddonVersion(const std::string &id) return maxversion; } -bool CAddonDatabase::GetAddon(const CStdString& id, AddonPtr& addon) +bool CAddonDatabase::GetAddon(const std::string& id, AddonPtr& addon) { try { @@ -192,7 +192,7 @@ bool CAddonDatabase::GetAddon(const CStdString& id, AddonPtr& addon) // there may be multiple addons with this id (eg from different repositories) in the database, // so we want to retrieve the latest version. Order by version won't work as the database // won't know that 1.10 > 1.2, so grab them all and order outside - CStdString sql = PrepareSQL("select id,version from addon where addonID='%s'",id.c_str()); + std::string sql = PrepareSQL("select id,version from addon where addonID='%s'",id.c_str()); m_pDS2->query(sql.c_str()); if (m_pDS2->eof()) @@ -220,14 +220,14 @@ bool CAddonDatabase::GetAddon(const CStdString& id, AddonPtr& addon) return false; } -bool CAddonDatabase::GetRepoForAddon(const CStdString& addonID, CStdString& repo) +bool CAddonDatabase::GetRepoForAddon(const std::string& addonID, std::string& repo) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS2.get()) return false; - CStdString sql = PrepareSQL("select repo.addonID from repo join addonlinkrepo on repo.id=addonlinkrepo.idRepo join addon on addonlinkrepo.idAddon=addon.id where addon.addonID like '%s'", addonID.c_str()); + std::string sql = PrepareSQL("select repo.addonID from repo join addonlinkrepo on repo.id=addonlinkrepo.idRepo join addon on addonlinkrepo.idAddon=addon.id where addon.addonID like '%s'", addonID.c_str()); m_pDS2->query(sql.c_str()); if (!m_pDS2->eof()) { @@ -314,7 +314,7 @@ bool CAddonDatabase::GetAddons(VECADDONS& addons) if (NULL == m_pDB.get()) return false; if (NULL == m_pDS2.get()) return false; - CStdString sql = PrepareSQL("select distinct addonID from addon"); + std::string sql = PrepareSQL("select distinct addonID from addon"); m_pDS->query(sql.c_str()); while (!m_pDS->eof()) { @@ -333,14 +333,14 @@ bool CAddonDatabase::GetAddons(VECADDONS& addons) return false; } -void CAddonDatabase::DeleteRepository(const CStdString& id) +void CAddonDatabase::DeleteRepository(const std::string& id) { try { if (NULL == m_pDB.get()) return; if (NULL == m_pDS.get()) return; - CStdString sql = PrepareSQL("select id from repo where addonID='%s'",id.c_str()); + std::string sql = PrepareSQL("select id from repo where addonID='%s'",id.c_str()); m_pDS->query(sql.c_str()); if (!m_pDS->eof()) DeleteRepository(m_pDS->fv(0).get_asInt()); @@ -358,7 +358,7 @@ void CAddonDatabase::DeleteRepository(int idRepo) if (NULL == m_pDB.get()) return; if (NULL == m_pDS.get()) return; - CStdString sql = PrepareSQL("delete from repo where id=%i",idRepo); + std::string sql = PrepareSQL("delete from repo where id=%i",idRepo); m_pDS->exec(sql.c_str()); sql = PrepareSQL("delete from addon where id in (select idAddon from addonlinkrepo where idRepo=%i)",idRepo); m_pDS->exec(sql.c_str()); @@ -376,14 +376,14 @@ void CAddonDatabase::DeleteRepository(int idRepo) } } -int CAddonDatabase::AddRepository(const CStdString& id, const VECADDONS& addons, const CStdString& checksum) +int CAddonDatabase::AddRepository(const std::string& id, const VECADDONS& addons, const std::string& checksum) { try { if (NULL == m_pDB.get()) return -1; if (NULL == m_pDS.get()) return -1; - CStdString sql; + std::string sql; int idRepo = GetRepoChecksum(id,sql); if (idRepo > -1) DeleteRepository(idRepo); @@ -431,7 +431,7 @@ int CAddonDatabase::GetRepoChecksum(const std::string& id, std::string& checksum return -1; } -CDateTime CAddonDatabase::GetRepoTimestamp(const CStdString& id) +CDateTime CAddonDatabase::GetRepoTimestamp(const std::string& id) { CDateTime date; try @@ -439,7 +439,7 @@ CDateTime CAddonDatabase::GetRepoTimestamp(const CStdString& id) if (NULL == m_pDB.get()) return date; if (NULL == m_pDS.get()) return date; - CStdString strSQL = PrepareSQL("select * from repo where addonID='%s'",id.c_str()); + std::string strSQL = PrepareSQL("select * from repo where addonID='%s'",id.c_str()); m_pDS->query(strSQL.c_str()); if (!m_pDS->eof()) { @@ -454,14 +454,14 @@ CDateTime CAddonDatabase::GetRepoTimestamp(const CStdString& id) return date; } -bool CAddonDatabase::SetRepoTimestamp(const CStdString& id, const CStdString& time) +bool CAddonDatabase::SetRepoTimestamp(const std::string& id, const std::string& time) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = PrepareSQL("update repo set lastcheck='%s' where addonID='%s'",time.c_str(),id.c_str()); + std::string sql = PrepareSQL("update repo set lastcheck='%s' where addonID='%s'",time.c_str(),id.c_str()); m_pDS->exec(sql.c_str()); return true; @@ -480,7 +480,7 @@ bool CAddonDatabase::GetRepository(int id, VECADDONS& addons) if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString strSQL = PrepareSQL("select * from addonlinkrepo where idRepo=%i",id); + std::string strSQL = PrepareSQL("select * from addonlinkrepo where idRepo=%i",id); m_pDS->query(strSQL.c_str()); while (!m_pDS->eof()) { @@ -498,14 +498,14 @@ bool CAddonDatabase::GetRepository(int id, VECADDONS& addons) return false; } -bool CAddonDatabase::GetRepository(const CStdString& id, VECADDONS& addons) +bool CAddonDatabase::GetRepository(const std::string& id, VECADDONS& addons) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString strSQL = PrepareSQL("select id from repo where addonID='%s'",id.c_str()); + std::string strSQL = PrepareSQL("select id from repo where addonID='%s'",id.c_str()); m_pDS->query(strSQL.c_str()); if (!m_pDS->eof()) return GetRepository(m_pDS->fv(0).get_asInt(),addons); @@ -517,14 +517,14 @@ bool CAddonDatabase::GetRepository(const CStdString& id, VECADDONS& addons) return false; } -bool CAddonDatabase::Search(const CStdString& search, VECADDONS& addons) +bool CAddonDatabase::Search(const std::string& search, VECADDONS& addons) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString strSQL; + std::string strSQL; strSQL=PrepareSQL("SELECT addonID FROM addon WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%'", search.c_str(), search.c_str(), search.c_str()); CLog::Log(LOGDEBUG, "%s query: %s", __FUNCTION__, strSQL.c_str()); @@ -562,20 +562,20 @@ void CAddonDatabase::SetPropertiesFromAddon(const AddonPtr& addon, pItem->SetProperty("Addon.Creator", addon->Author()); pItem->SetProperty("Addon.Disclaimer", addon->Disclaimer()); pItem->SetProperty("Addon.Rating", addon->Stars()); - CStdString starrating = StringUtils::Format("rating%d.png", addon->Stars()); + std::string starrating = StringUtils::Format("rating%d.png", addon->Stars()); pItem->SetProperty("Addon.StarRating",starrating); pItem->SetProperty("Addon.Path", addon->Path()); if (addon->Props().broken == "DEPSNOTMET") pItem->SetProperty("Addon.Broken", g_localizeStrings.Get(24044)); else pItem->SetProperty("Addon.Broken", addon->Props().broken); - std::map<CStdString,CStdString>::iterator it = + std::map<std::string,std::string>::iterator it = addon->Props().extrainfo.find("language"); if (it != addon->Props().extrainfo.end()) pItem->SetProperty("Addon.Language", it->second); } -bool CAddonDatabase::DisableAddon(const CStdString &addonID, bool disable /* = true */) +bool CAddonDatabase::DisableAddon(const std::string &addonID, bool disable /* = true */) { try { @@ -586,7 +586,7 @@ bool CAddonDatabase::DisableAddon(const CStdString &addonID, bool disable /* = t { if (!IsAddonDisabled(addonID)) // Enabled { - CStdString sql = PrepareSQL("insert into disabled(id, addonID) values(NULL, '%s')", addonID.c_str()); + std::string sql = PrepareSQL("insert into disabled(id, addonID) values(NULL, '%s')", addonID.c_str()); m_pDS->exec(sql); AddonPtr addon; @@ -609,7 +609,7 @@ bool CAddonDatabase::DisableAddon(const CStdString &addonID, bool disable /* = t else { bool disabled = IsAddonDisabled(addonID); //we need to know if service addon is running - CStdString sql = PrepareSQL("delete from disabled where addonID='%s'", addonID.c_str()); + std::string sql = PrepareSQL("delete from disabled where addonID='%s'", addonID.c_str()); m_pDS->exec(sql); AddonPtr addon; @@ -633,7 +633,7 @@ bool CAddonDatabase::DisableAddon(const CStdString &addonID, bool disable /* = t return false; } -bool CAddonDatabase::BreakAddon(const CStdString &addonID, const CStdString& reason) +bool CAddonDatabase::BreakAddon(const std::string &addonID, const std::string& reason) { if (reason.empty()) return ExecuteQuery(PrepareSQL("DELETE FROM broken WHERE addonID='%s'", addonID.c_str())); @@ -642,22 +642,22 @@ bool CAddonDatabase::BreakAddon(const CStdString &addonID, const CStdString& rea addonID.c_str(), reason.c_str())); } -bool CAddonDatabase::HasAddon(const CStdString &addonID) +bool CAddonDatabase::HasAddon(const std::string &addonID) { - CStdString strWhereClause = PrepareSQL("addonID = '%s'", addonID.c_str()); - CStdString strHasAddon = GetSingleValue("addon", "id", strWhereClause); + std::string strWhereClause = PrepareSQL("addonID = '%s'", addonID.c_str()); + std::string strHasAddon = GetSingleValue("addon", "id", strWhereClause); return !strHasAddon.empty(); } -bool CAddonDatabase::IsAddonDisabled(const CStdString &addonID) +bool CAddonDatabase::IsAddonDisabled(const std::string &addonID) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = PrepareSQL("select id from disabled where addonID='%s'", addonID.c_str()); + std::string sql = PrepareSQL("select id from disabled where addonID='%s'", addonID.c_str()); m_pDS->query(sql.c_str()); bool ret = !m_pDS->eof(); // in the disabled table -> disabled m_pDS->close(); @@ -670,15 +670,15 @@ bool CAddonDatabase::IsAddonDisabled(const CStdString &addonID) return false; } -bool CAddonDatabase::IsSystemPVRAddonEnabled(const CStdString &addonID) +bool CAddonDatabase::IsSystemPVRAddonEnabled(const std::string &addonID) { - CStdString strWhereClause = PrepareSQL("addonID = '%s'", addonID.c_str()); - CStdString strEnabled = GetSingleValue("pvrenabled", "id", strWhereClause); + std::string strWhereClause = PrepareSQL("addonID = '%s'", addonID.c_str()); + std::string strEnabled = GetSingleValue("pvrenabled", "id", strWhereClause); return !strEnabled.empty(); } -CStdString CAddonDatabase::IsAddonBroken(const CStdString &addonID) +std::string CAddonDatabase::IsAddonBroken(const std::string &addonID) { return GetSingleValue(PrepareSQL("SELECT reason FROM broken WHERE addonID='%s'", addonID.c_str())); } @@ -702,15 +702,15 @@ bool CAddonDatabase::HasDisabledAddons() return false; } -bool CAddonDatabase::BlacklistAddon(const CStdString& addonID, - const CStdString& version) +bool CAddonDatabase::BlacklistAddon(const std::string& addonID, + const std::string& version) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = PrepareSQL("insert into blacklist(id, addonID, version) values(NULL, '%s', '%s')", addonID.c_str(),version.c_str()); + std::string sql = PrepareSQL("insert into blacklist(id, addonID, version) values(NULL, '%s', '%s')", addonID.c_str(),version.c_str()); m_pDS->exec(sql); return true; @@ -722,22 +722,22 @@ bool CAddonDatabase::BlacklistAddon(const CStdString& addonID, return false; } -bool CAddonDatabase::IsAddonBlacklisted(const CStdString& addonID, - const CStdString& version) +bool CAddonDatabase::IsAddonBlacklisted(const std::string& addonID, + const std::string& version) { - CStdString where = PrepareSQL("addonID='%s' and version='%s'",addonID.c_str(),version.c_str()); + std::string where = PrepareSQL("addonID='%s' and version='%s'",addonID.c_str(),version.c_str()); return !GetSingleValue("blacklist","addonID",where).empty(); } -bool CAddonDatabase::RemoveAddonFromBlacklist(const CStdString& addonID, - const CStdString& version) +bool CAddonDatabase::RemoveAddonFromBlacklist(const std::string& addonID, + const std::string& version) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = PrepareSQL("delete from blacklist where addonID='%s' and version='%s'",addonID.c_str(),version.c_str()); + std::string sql = PrepareSQL("delete from blacklist where addonID='%s' and version='%s'",addonID.c_str(),version.c_str()); m_pDS->exec(sql); return true; } @@ -748,29 +748,29 @@ bool CAddonDatabase::RemoveAddonFromBlacklist(const CStdString& addonID, return false; } -bool CAddonDatabase::AddPackage(const CStdString& addonID, - const CStdString& packageFileName, - const CStdString& hash) +bool CAddonDatabase::AddPackage(const std::string& addonID, + const std::string& packageFileName, + const std::string& hash) { - CStdString sql = PrepareSQL("insert into package(id, addonID, filename, hash)" + std::string sql = PrepareSQL("insert into package(id, addonID, filename, hash)" "values(NULL, '%s', '%s', '%s')", addonID.c_str(), packageFileName.c_str(), hash.c_str()); return ExecuteQuery(sql); } -bool CAddonDatabase::GetPackageHash(const CStdString& addonID, - const CStdString& packageFileName, - CStdString& hash) +bool CAddonDatabase::GetPackageHash(const std::string& addonID, + const std::string& packageFileName, + std::string& hash) { - CStdString where = PrepareSQL("addonID='%s' and filename='%s'", + std::string where = PrepareSQL("addonID='%s' and filename='%s'", addonID.c_str(), packageFileName.c_str()); hash = GetSingleValue("package", "hash", where); return !hash.empty(); } -bool CAddonDatabase::RemovePackage(const CStdString& packageFileName) +bool CAddonDatabase::RemovePackage(const std::string& packageFileName) { - CStdString sql = PrepareSQL("delete from package where filename='%s'", packageFileName.c_str()); + std::string sql = PrepareSQL("delete from package where filename='%s'", packageFileName.c_str()); return ExecuteQuery(sql); } diff --git a/xbmc/addons/AddonDatabase.h b/xbmc/addons/AddonDatabase.h index 1556e054f3..4d0566fa5b 100644 --- a/xbmc/addons/AddonDatabase.h +++ b/xbmc/addons/AddonDatabase.h @@ -21,8 +21,8 @@ #include "dbwrappers/Database.h" #include "addons/Addon.h" -#include "utils/StdString.h" #include "FileItem.h" +#include <string> class CAddonDatabase : public CDatabase { @@ -32,7 +32,7 @@ public: virtual bool Open(); int AddAddon(const ADDON::AddonPtr& item, int idRepo); - bool GetAddon(const CStdString& addonID, ADDON::AddonPtr& addon); + bool GetAddon(const std::string& addonID, ADDON::AddonPtr& addon); bool GetAddons(ADDON::VECADDONS& addons); /*! \brief grab the (largest) add-on version for an add-on */ @@ -43,22 +43,22 @@ public: \param repo [out] - the id of the repository \return true if a repo was found, false otherwise. */ - bool GetRepoForAddon(const CStdString& addonID, CStdString& repo); - int AddRepository(const CStdString& id, const ADDON::VECADDONS& addons, const CStdString& checksum); - void DeleteRepository(const CStdString& id); + bool GetRepoForAddon(const std::string& addonID, std::string& repo); + int AddRepository(const std::string& id, const ADDON::VECADDONS& addons, const std::string& checksum); + void DeleteRepository(const std::string& id); void DeleteRepository(int id); int GetRepoChecksum(const std::string& id, std::string& checksum); - bool GetRepository(const CStdString& id, ADDON::VECADDONS& addons); + bool GetRepository(const std::string& id, ADDON::VECADDONS& addons); bool GetRepository(int id, ADDON::VECADDONS& addons); - bool SetRepoTimestamp(const CStdString& id, const CStdString& timestamp); + bool SetRepoTimestamp(const std::string& id, const std::string& timestamp); /*! \brief Retrieve the time a repository was last checked \param id id of the repo \return last time the repo was checked, current time if not available \sa SetRepoTimestamp */ - CDateTime GetRepoTimestamp(const CStdString& id); + CDateTime GetRepoTimestamp(const std::string& id); - bool Search(const CStdString& search, ADDON::VECADDONS& items); + bool Search(const std::string& search, ADDON::VECADDONS& items); static void SetPropertiesFromAddon(const ADDON::AddonPtr& addon, CFileItemPtr& item); /*! \brief Disable an addon. @@ -67,18 +67,18 @@ public: \param disable whether to enable or disable. Defaults to true (disable) \return true on success, false on failure \sa IsAddonDisabled, HasDisabledAddons */ - bool DisableAddon(const CStdString &addonID, bool disable = true); + bool DisableAddon(const std::string &addonID, bool disable = true); /*! \brief Checks if an addon is in the database. \param addonID id of the addon to be checked \return true if addon is in database, false if addon is not in database yet */ - bool HasAddon(const CStdString &addonID); + bool HasAddon(const std::string &addonID); /*! \brief Check whether an addon has been disabled via DisableAddon. \param addonID id of the addon to check \return true if the addon is disabled, false otherwise \sa DisableAddon, HasDisabledAddons */ - bool IsAddonDisabled(const CStdString &addonID); + bool IsAddonDisabled(const std::string &addonID); /*! \brief Check whether we have disabled addons. \return true if we have disabled addons, false otherwise @@ -87,7 +87,7 @@ public: /*! @deprecated only here to allow clean upgrades from earlier pvr versions */ - bool IsSystemPVRAddonEnabled(const CStdString &addonID); + bool IsSystemPVRAddonEnabled(const std::string &addonID); /*! \brief Mark an addon as broken Sets a flag that this addon has been marked as broken in the repository. @@ -95,18 +95,18 @@ public: \param reason why it is broken - if non empty we take it as broken. Defaults to empty \return true on success, false on failure \sa IsAddonBroken */ - bool BreakAddon(const CStdString &addonID, const CStdString& reason=""); + bool BreakAddon(const std::string &addonID, const std::string& reason=""); /*! \brief Check whether an addon has been marked as broken via BreakAddon. \param addonID id of the addon to check \return reason if the addon is broken, blank otherwise \sa BreakAddon */ - CStdString IsAddonBroken(const CStdString &addonID); + std::string IsAddonBroken(const std::string &addonID); - bool BlacklistAddon(const CStdString& addonID, const CStdString& version); - bool IsAddonBlacklisted(const CStdString& addonID, const CStdString& version); - bool RemoveAddonFromBlacklist(const CStdString& addonID, - const CStdString& version); + bool BlacklistAddon(const std::string& addonID, const std::string& version); + bool IsAddonBlacklisted(const std::string& addonID, const std::string& version); + bool RemoveAddonFromBlacklist(const std::string& addonID, + const std::string& version); /*! \brief Store an addon's package filename and that file's hash for future verification \param addonID id of the addon we're adding a package for @@ -115,9 +115,9 @@ public: \return Whether or not the info successfully made it into the DB. \sa GetPackageHash, RemovePackage */ - bool AddPackage(const CStdString& addonID, - const CStdString& packageFileName, - const CStdString& hash); + bool AddPackage(const std::string& addonID, + const std::string& packageFileName, + const std::string& hash); /*! \brief Query the MD5 checksum of the given given addon's given package \param addonID id of the addon we're who's package we're querying \param packageFileName filename of the package @@ -125,15 +125,15 @@ public: \return Whether or not we found a hash for the given addon's given package \sa AddPackage, RemovePackage */ - bool GetPackageHash(const CStdString& addonID, - const CStdString& packageFileName, - CStdString& hash); + bool GetPackageHash(const std::string& addonID, + const std::string& packageFileName, + std::string& hash); /*! \brief Remove a package's info from the database \param packageFileName filename of the package \return Whether or not we succeeded in removing the package \sa AddPackage, GetPackageHash */ - bool RemovePackage(const CStdString& packageFileName); + bool RemovePackage(const std::string& packageFileName); protected: virtual void CreateTables(); virtual void CreateAnalytics(); diff --git a/xbmc/addons/AddonDll.h b/xbmc/addons/AddonDll.h index b48fd1e89f..d5e05b27d9 100644 --- a/xbmc/addons/AddonDll.h +++ b/xbmc/addons/AddonDll.h @@ -19,6 +19,7 @@ * */ #include <math.h> +#include <string> #include "Addon.h" #include "DllAddon.h" @@ -33,6 +34,7 @@ #include "interfaces/IAnnouncer.h" #include "interfaces/AnnouncementManager.h" #include "utils/XMLUtils.h" +#include "Util.h" namespace ADDON { @@ -49,7 +51,7 @@ namespace ADDON // addon settings virtual void SaveSettings(); - virtual CStdString GetSetting(const CStdString& key); + virtual std::string GetSetting(const std::string& key); ADDON_STATUS Create(); virtual void Stop(); @@ -158,14 +160,14 @@ AddonPtr CAddonDll<TheDll, TheStruct, TheProps>::Clone() const template<class TheDll, typename TheStruct, typename TheProps> bool CAddonDll<TheDll, TheStruct, TheProps>::LoadDll() { - CStdString strFileName; + std::string strFileName; if (!m_bIsChild) { strFileName = LibPath(); } else { //FIXME hack to load same Dll twice - CStdString extension = URIUtils::GetExtension(m_strLibName); + std::string extension = URIUtils::GetExtension(m_strLibName); strFileName = "special://temp/" + m_strLibName; URIUtils::RemoveExtension(strFileName); strFileName += "-" + ID() + extension; @@ -182,14 +184,14 @@ bool CAddonDll<TheDll, TheStruct, TheProps>::LoadDll() // The usual soname requirements apply. no subdirs, and filename is ^lib.*\.so$ if (!XFILE::CFile::Exists(strFileName)) { - CStdString tempbin = getenv("XBMC_ANDROID_LIBS"); + std::string tempbin = getenv("XBMC_ANDROID_LIBS"); strFileName = tempbin + "/" + m_strLibName; } #endif if (!XFILE::CFile::Exists(strFileName)) { - CStdString temp = CSpecialProtocol::TranslatePath("special://xbmc/"); - CStdString tempbin = CSpecialProtocol::TranslatePath("special://xbmcbin/"); + std::string temp = CSpecialProtocol::TranslatePath("special://xbmc/"); + std::string tempbin = CSpecialProtocol::TranslatePath("special://xbmcbin/"); strFileName.erase(0, temp.size()); strFileName = tempbin + strFileName; if (!XFILE::CFile::Exists(strFileName)) @@ -423,7 +425,7 @@ TiXmlElement CAddonDll<TheDll, TheStruct, TheProps>::MakeSetting(DllSetting& set node.SetAttribute("id", setting.id); node.SetAttribute("type", "enum"); node.SetAttribute("label", setting.label); - CStdString values; + std::string values; for (unsigned int i = 0; i < setting.entry.size(); i++) { values.append(setting.entry[i]); @@ -449,7 +451,7 @@ void CAddonDll<TheDll, TheStruct, TheProps>::SaveSettings() } template<class TheDll, typename TheStruct, typename TheProps> -CStdString CAddonDll<TheDll, TheStruct, TheProps>::GetSetting(const CStdString& key) +std::string CAddonDll<TheDll, TheStruct, TheProps>::GetSetting(const std::string& key) { return CAddon::GetSetting(key); } @@ -498,7 +500,7 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::TransferSettings() else if (type == "enum" || type =="integer" || type == "labelenum" || type == "rangeofnum") { - int tmp = atoi(GetSetting(id)); + int tmp = atoi(GetSetting(id).c_str()); status = m_pDll->SetSetting(id, (int*) &tmp); } else if (type == "bool") @@ -509,7 +511,7 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::TransferSettings() else if (type == "rangeofnum" || type == "slider" || type == "number") { - float tmpf = (float)atof(GetSetting(id)); + float tmpf = (float)atof(GetSetting(id).c_str()); int tmpi; if (option && strcmpi(option,"int") == 0) diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index fe8ecab100..11fa3cef90 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -118,7 +118,7 @@ bool CAddonInstaller::IsDownloading() const void CAddonInstaller::GetInstallList(VECADDONS &addons) const { CSingleLock lock(m_critSection); - vector<CStdString> addonIDs; + vector<std::string> addonIDs; for (JobMap::const_iterator i = m_downloadJobs.begin(); i != m_downloadJobs.end(); ++i) { if (i->second.jobID) @@ -128,7 +128,7 @@ void CAddonInstaller::GetInstallList(VECADDONS &addons) const CAddonDatabase database; database.Open(); - for (vector<CStdString>::iterator it = addonIDs.begin(); it != addonIDs.end();++it) + for (vector<std::string>::iterator it = addonIDs.begin(); it != addonIDs.end();++it) { AddonPtr addon; if (database.GetAddon(*it, addon)) @@ -136,7 +136,7 @@ void CAddonInstaller::GetInstallList(VECADDONS &addons) const } } -bool CAddonInstaller::GetProgress(const CStdString &addonID, unsigned int &percent) const +bool CAddonInstaller::GetProgress(const std::string &addonID, unsigned int &percent) const { CSingleLock lock(m_critSection); JobMap::const_iterator i = m_downloadJobs.find(addonID); @@ -148,7 +148,7 @@ bool CAddonInstaller::GetProgress(const CStdString &addonID, unsigned int &perce return false; } -bool CAddonInstaller::Cancel(const CStdString &addonID) +bool CAddonInstaller::Cancel(const std::string &addonID) { CSingleLock lock(m_critSection); JobMap::iterator i = m_downloadJobs.find(addonID); @@ -161,7 +161,7 @@ bool CAddonInstaller::Cancel(const CStdString &addonID) return false; } -bool CAddonInstaller::PromptForInstall(const CStdString &addonID, AddonPtr &addon) +bool CAddonInstaller::PromptForInstall(const std::string &addonID, AddonPtr &addon) { if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER)) return false; @@ -211,7 +211,7 @@ bool CAddonInstaller::PromptForInstall(const CStdString &addonID, AddonPtr &addo return false; } -bool CAddonInstaller::Install(const CStdString &addonID, bool force, const CStdString &referer, bool background) +bool CAddonInstaller::Install(const std::string &addonID, bool force, const std::string &referer, bool background) { if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER)) return false; @@ -226,12 +226,12 @@ bool CAddonInstaller::Install(const CStdString &addonID, bool force, const CStdS database.Open(); if (database.GetAddon(addonID, addon)) { - CStdString repo; + std::string repo; database.GetRepoForAddon(addonID,repo); AddonPtr ptr; CAddonMgr::Get().GetAddon(repo,ptr); RepositoryPtr therepo = boost::dynamic_pointer_cast<CRepository>(ptr); - CStdString hash; + std::string hash; if (therepo) hash = therepo->GetAddonHash(addon); return DoInstall(addon, hash, addonInstalled, referer, background); @@ -239,7 +239,7 @@ bool CAddonInstaller::Install(const CStdString &addonID, bool force, const CStdS return false; } -bool CAddonInstaller::DoInstall(const AddonPtr &addon, const CStdString &hash, bool update, const CStdString &referer, bool background) +bool CAddonInstaller::DoInstall(const AddonPtr &addon, const std::string &hash, bool update, const std::string &referer, bool background) { // check whether we already have the addon installing CSingleLock lock(m_critSection); @@ -274,7 +274,7 @@ bool CAddonInstaller::DoInstall(const AddonPtr &addon, const CStdString &hash, b return true; } -bool CAddonInstaller::InstallFromZip(const CStdString &path) +bool CAddonInstaller::InstallFromZip(const std::string &path) { if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER)) return false; @@ -291,7 +291,7 @@ bool CAddonInstaller::InstallFromZip(const CStdString &path) } // TODO: possibly add support for github generated zips here? - CStdString archive = URIUtils::AddFileToFolder(items[0]->GetPath(), "addon.xml"); + std::string archive = URIUtils::AddFileToFolder(items[0]->GetPath(), "addon.xml"); CXBMCTinyXML xml; AddonPtr addon; @@ -308,13 +308,13 @@ bool CAddonInstaller::InstallFromZip(const CStdString &path) return false; } -void CAddonInstaller::InstallFromXBMCRepo(const set<CStdString> &addonIDs) +void CAddonInstaller::InstallFromXBMCRepo(const set<std::string> &addonIDs) { // first check we have the our repositories up to date (and wait until we do) UpdateRepos(false, true); // now install the addons - for (set<CStdString>::const_iterator i = addonIDs.begin(); i != addonIDs.end(); ++i) + for (set<std::string>::const_iterator i = addonIDs.begin(); i != addonIDs.end(); ++i) Install(*i); } @@ -337,7 +337,7 @@ bool CAddonInstaller::CheckDependencies(const AddonPtr &addon, database.Open(); for (ADDONDEPS::const_iterator i = deps.begin(); i != deps.end(); ++i) { - const CStdString &addonID = i->first; + const std::string &addonID = i->first; const AddonVersion &version = i->second.first; bool optional = i->second.second; AddonPtr dep; @@ -424,7 +424,7 @@ void CAddonInstaller::UpdateRepos(bool force, bool wait) } } -bool CAddonInstaller::HasJob(const CStdString& ID) const +bool CAddonInstaller::HasJob(const std::string& ID) const { CSingleLock lock(m_critSection); return m_downloadJobs.find(ID) != m_downloadJobs.end(); @@ -432,7 +432,7 @@ bool CAddonInstaller::HasJob(const CStdString& ID) const void CAddonInstaller::PrunePackageCache() { - std::map<CStdString,CFileItemList*> packs; + std::map<std::string,CFileItemList*> packs; int64_t size = EnumeratePackageFolder(packs); int64_t limit = (int64_t)g_advancedSettings.m_addonPackageFolderSize*1024*1024; if (size < limit) @@ -443,7 +443,7 @@ void CAddonInstaller::PrunePackageCache() CFileItemList items; CAddonDatabase db; db.Open(); - for (std::map<CStdString,CFileItemList*>::const_iterator it = packs.begin(); + for (std::map<std::string,CFileItemList*>::const_iterator it = packs.begin(); it != packs.end();++it) { it->second->Sort(SortByLabel, SortOrderDescending); @@ -463,7 +463,7 @@ void CAddonInstaller::PrunePackageCache() { // 2. Remove the oldest packages (leaving least 1 for each add-on) items.Clear(); - for (std::map<CStdString,CFileItemList*>::iterator it = packs.begin(); + for (std::map<std::string,CFileItemList*>::iterator it = packs.begin(); it != packs.end();++it) { if (it->second->Size() > 1) @@ -479,12 +479,12 @@ void CAddonInstaller::PrunePackageCache() } } // clean up our mess - for (std::map<CStdString,CFileItemList*>::iterator it = packs.begin(); + for (std::map<std::string,CFileItemList*>::iterator it = packs.begin(); it != packs.end();++it) delete it->second; } -int64_t CAddonInstaller::EnumeratePackageFolder(std::map<CStdString,CFileItemList*>& result) +int64_t CAddonInstaller::EnumeratePackageFolder(std::map<std::string,CFileItemList*>& result) { CFileItemList items; CDirectory::GetDirectory("special://home/addons/packages/",items,".zip",DIR_FLAG_NO_FILE_DIRS); @@ -494,7 +494,7 @@ int64_t CAddonInstaller::EnumeratePackageFolder(std::map<CStdString,CFileItemLis if (items[i]->m_bIsFolder) continue; size += items[i]->m_dwSize; - CStdString pack,dummy; + std::string pack,dummy; AddonVersion::SplitFileName(pack,dummy,items[i]->GetLabel()); if (result.find(pack) == result.end()) result[pack] = new CFileItemList; @@ -504,7 +504,7 @@ int64_t CAddonInstaller::EnumeratePackageFolder(std::map<CStdString,CFileItemLis return size; } -CAddonInstallJob::CAddonInstallJob(const AddonPtr &addon, const CStdString &hash, bool update, const CStdString &referer) +CAddonInstallJob::CAddonInstallJob(const AddonPtr &addon, const std::string &hash, bool update, const std::string &referer) : m_addon(addon), m_hash(hash), m_update(update), m_referer(referer) { } @@ -513,7 +513,7 @@ AddonPtr CAddonInstallJob::GetRepoForAddon(const AddonPtr& addon) { CAddonDatabase database; database.Open(); - CStdString repo; + std::string repo; database.GetRepoForAddon(addon->ID(), repo); AddonPtr repoPtr; CAddonMgr::Get().GetAddon(repo, repoPtr); @@ -524,15 +524,15 @@ AddonPtr CAddonInstallJob::GetRepoForAddon(const AddonPtr& addon) bool CAddonInstallJob::DoWork() { AddonPtr repoPtr = GetRepoForAddon(m_addon); - CStdString installFrom; + std::string installFrom; if (!repoPtr || repoPtr->Props().libname.empty()) { // Addons are installed by downloading the .zip package on the server to the local // packages folder, then extracting from the local .zip package into the addons folder // Both these functions are achieved by "copying" using the vfs. - CStdString dest="special://home/addons/packages/"; - CStdString package = URIUtils::AddFileToFolder("special://home/addons/packages/", + std::string dest="special://home/addons/packages/"; + std::string package = URIUtils::AddFileToFolder("special://home/addons/packages/", URIUtils::GetFileName(m_addon->Path())); if (URIUtils::HasSlashAtEnd(m_addon->Path())) { // passed in a folder - all we need do is copy it across @@ -540,7 +540,7 @@ bool CAddonInstallJob::DoWork() } else { - CStdString md5; + std::string md5; CAddonDatabase db; db.Open(); @@ -557,7 +557,7 @@ bool CAddonInstallJob::DoWork() // zip passed in - download + extract if (!CFile::Exists(package)) { - CStdString path(m_addon->Path()); + std::string path(m_addon->Path()); if (!m_referer.empty() && URIUtils::IsInternetStream(path)) { CURL url(path); @@ -576,7 +576,7 @@ bool CAddonInstallJob::DoWork() if (!m_hash.empty()) { md5 = CUtil::GetFileMD5(package); - if (!md5.Equals(m_hash)) + if (!StringUtils::EqualsNoCase(md5, m_hash)) { CFile::Delete(package); ReportInstallError(m_addon->ID(), URIUtils::GetFileName(package)); @@ -617,7 +617,7 @@ bool CAddonInstallJob::DoWork() return true; } -bool CAddonInstallJob::DownloadPackage(const CStdString &path, const CStdString &dest) +bool CAddonInstallJob::DownloadPackage(const std::string &path, const std::string &dest) { // need to download/copy the package first CFileItemList list; list.Add(CFileItemPtr(new CFileItem(path,false))); @@ -657,7 +657,7 @@ bool CAddonInstallJob::OnPreInstall() return false; } -bool CAddonInstallJob::DeleteAddon(const CStdString &addonFolder) +bool CAddonInstallJob::DeleteAddon(const std::string &addonFolder) { CFileItemList list; list.Add(CFileItemPtr(new CFileItem(addonFolder, true))); @@ -666,17 +666,17 @@ bool CAddonInstallJob::DeleteAddon(const CStdString &addonFolder) return job.DoWork(); } -bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& repo) +bool CAddonInstallJob::Install(const std::string &installFrom, const AddonPtr& repo) { // The first thing we do is install dependencies ADDONDEPS deps = m_addon->GetDeps(); - CStdString referer = StringUtils::Format("Referer=%s-%s.zip",m_addon->ID().c_str(),m_addon->Version().asString().c_str()); + std::string referer = StringUtils::Format("Referer=%s-%s.zip",m_addon->ID().c_str(),m_addon->Version().asString().c_str()); for (ADDONDEPS::iterator it = deps.begin(); it != deps.end(); ++it) { - if (it->first.Equals("xbmc.metadata")) + if (it->first == "xbmc.metadata") continue; - const CStdString &addonID = it->first; + const std::string &addonID = it->first; const AddonVersion &version = it->second.first; bool optional = it->second.second; AddonPtr dependency; @@ -703,7 +703,7 @@ bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& re if (repo) { CFileItemList dummy; - CStdString s = StringUtils::Format("plugin://%s/?action=install" + std::string s = StringUtils::Format("plugin://%s/?action=install" "&package=%s&version=%s", repo->ID().c_str(), m_addon->ID().c_str(), m_addon->Version().asString().c_str()); @@ -712,7 +712,7 @@ bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& re } else { - CStdString addonFolder(installFrom); + std::string addonFolder(installFrom); URIUtils::RemoveSlashAtEnd(addonFolder); addonFolder = URIUtils::AddFileToFolder("special://home/addons/", URIUtils::GetFileName(addonFolder)); @@ -725,7 +725,7 @@ bool CAddonInstallJob::Install(const CStdString &installFrom, const AddonPtr& re AddonPtr addon; if (!job.DoWork() || !CAddonMgr::Get().LoadAddonDescription(addonFolder, addon)) { // failed extraction or failed to load addon description - CStdString addonID = URIUtils::GetFileName(addonFolder); + std::string addonID = URIUtils::GetFileName(addonFolder); ReportInstallError(addonID, addonID); CLog::Log(LOGERROR,"Could not read addon description of %s", addonID.c_str()); DeleteAddon(addonFolder); @@ -794,8 +794,8 @@ void CAddonInstallJob::OnPostInstall(bool reloadAddon) } } -void CAddonInstallJob::ReportInstallError(const CStdString& addonID, - const CStdString& fileName) +void CAddonInstallJob::ReportInstallError(const std::string& addonID, + const std::string& fileName) { AddonPtr addon; CAddonDatabase database; @@ -819,7 +819,7 @@ void CAddonInstallJob::ReportInstallError(const CStdString& addonID, } } -CStdString CAddonInstallJob::AddonID() const +std::string CAddonInstallJob::AddonID() const { return (m_addon) ? m_addon->ID() : ""; } @@ -848,7 +848,7 @@ bool CAddonUnInstallJob::DoWork() if (therepo && !therepo->Props().libname.empty()) { CFileItemList dummy; - CStdString s = StringUtils::Format("plugin://%s/?action=uninstall" + std::string 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; diff --git a/xbmc/addons/AddonInstaller.h b/xbmc/addons/AddonInstaller.h index 47c929a36a..ab93a2f8c8 100644 --- a/xbmc/addons/AddonInstaller.h +++ b/xbmc/addons/AddonInstaller.h @@ -40,8 +40,8 @@ public: bool IsDownloading() const; void GetInstallList(ADDON::VECADDONS &addons) const; - bool GetProgress(const CStdString &addonID, unsigned int &percent) const; - bool Cancel(const CStdString &addonID); + bool GetProgress(const std::string &addonID, unsigned int &percent) const; + bool Cancel(const std::string &addonID); /*! \brief Prompt the user as to whether they wish to install an addon. \param addonID the addon ID of the item to install. @@ -49,7 +49,7 @@ public: \return true on successful install, false otherwise. \sa Install */ - bool PromptForInstall(const CStdString &addonID, ADDON::AddonPtr &addon); + bool PromptForInstall(const std::string &addonID, ADDON::AddonPtr &addon); /*! \brief Install an addon if it is available in a repository \param addonID the addon ID of the item to install @@ -59,19 +59,19 @@ public: \return true on successful install, false on failure. \sa DoInstall */ - bool Install(const CStdString &addonID, bool force = false, const CStdString &referer="", bool background = true); + bool Install(const std::string &addonID, bool force = false, const std::string &referer="", bool background = true); /*! \brief Install an addon from the given zip path \param path the zip file to install from \return true if successful, false otherwise \sa DoInstall */ - bool InstallFromZip(const CStdString &path); + bool InstallFromZip(const std::string &path); /*! \brief Install a set of addons from the official repository (if needed) \param addonIDs a set of addon IDs to install */ - void InstallFromXBMCRepo(const std::set<CStdString> &addonIDs); + void InstallFromXBMCRepo(const std::set<std::string> &addonIDs); /*! \brief Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. @@ -94,7 +94,7 @@ public: * \param ID The ID of the add-on * \return true if a job exists, false otherwise */ - bool HasJob(const CStdString& ID) const; + bool HasJob(const std::string& ID) const; /*! \brief Fetch the last repository update time. \return the last time a repository was updated. @@ -117,7 +117,7 @@ public: unsigned int progress; }; - typedef std::map<CStdString,CDownloadJob> JobMap; + typedef std::map<std::string,CDownloadJob> JobMap; private: // private construction, and no assignements; use the provided singleton methods @@ -134,7 +134,7 @@ private: \param background whether to install in the background or not. Defaults to true. \return true on successful install, false on failure. */ - bool DoInstall(const ADDON::AddonPtr &addon, const CStdString &hash = "", bool update = false, const CStdString &referer = "", bool background = true); + bool DoInstall(const ADDON::AddonPtr &addon, const std::string &hash = "", bool update = false, const std::string &referer = "", bool background = true); /*! \brief Check whether dependencies of an addon exist or are installable. Iterates through the addon's dependencies, checking they're installed or installable. @@ -148,7 +148,7 @@ private: std::vector<std::string>& preDeps, CAddonDatabase &database); void PrunePackageCache(); - int64_t EnumeratePackageFolder(std::map<CStdString,CFileItemList*>& result); + int64_t EnumeratePackageFolder(std::map<std::string,CFileItemList*>& result); CCriticalSection m_critSection; JobMap m_downloadJobs; @@ -160,19 +160,19 @@ private: class CAddonInstallJob : public CFileOperationJob { public: - CAddonInstallJob(const ADDON::AddonPtr &addon, const CStdString &hash = "", bool update = false, const CStdString &referer = ""); + CAddonInstallJob(const ADDON::AddonPtr &addon, const std::string &hash = "", bool update = false, const std::string &referer = ""); virtual bool DoWork(); /*! \brief return the id of the addon being installed \return id of the installing addon */ - CStdString AddonID() const; + std::string AddonID() const; /*! \brief Delete an addon following install failure \param addonFolder - the folder to delete */ - static bool DeleteAddon(const CStdString &addonFolder); + static bool DeleteAddon(const std::string &addonFolder); /*! \brief Find which repository hosts an add-on * \param addon The add-on to find the repository for @@ -182,19 +182,19 @@ public: private: bool OnPreInstall(); void OnPostInstall(bool reloadAddon); - bool Install(const CStdString &installFrom, const ADDON::AddonPtr& repo=ADDON::AddonPtr()); - bool DownloadPackage(const CStdString &path, const CStdString &dest); + bool Install(const std::string &installFrom, const ADDON::AddonPtr& repo=ADDON::AddonPtr()); + bool DownloadPackage(const std::string &path, const std::string &dest); /*! \brief Queue a notification for addon installation/update failure \param addonID - addon id \param fileName - filename which is shown in case the addon id is unknown */ - void ReportInstallError(const CStdString& addonID, const CStdString& fileName); + void ReportInstallError(const std::string& addonID, const std::string& fileName); ADDON::AddonPtr m_addon; - CStdString m_hash; + std::string m_hash; bool m_update; - CStdString m_referer; + std::string m_referer; }; class CAddonUnInstallJob : public CFileOperationJob diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index a4daf38422..155c40247c 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -120,14 +120,14 @@ AddonPtr CAddonMgr::Factory(const cp_extension_t *props) { // begin temporary platform handling for Dlls // ideally platforms issues will be handled by C-Pluff // this is not an attempt at a solution - CStdString value; + std::string value; if (type == ADDON_SCREENSAVER && 0 == strnicmp(props->plugin->identifier, "screensaver.xbmc.builtin.", 25)) { // built in screensaver return AddonPtr(new CAddon(props)); } if (type == ADDON_SCREENSAVER) { // Python screensaver - CStdString library = CAddonMgr::Get().GetExtValue(props->configuration, "@library"); + std::string library = CAddonMgr::Get().GetExtValue(props->configuration, "@library"); if (URIUtils::HasExtension(library, ".py")) return AddonPtr(new CScreenSaver(props)); } @@ -136,22 +136,21 @@ AddonPtr CAddonMgr::Factory(const cp_extension_t *props) { // built in audio encoder return AddonPtr(new CAudioEncoder(props)); } + std::string tograb; #if defined(TARGET_ANDROID) - if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_android")) && value.empty()) - break; + tograb = "@library_android"; #elif defined(TARGET_LINUX) || defined(TARGET_FREEBSD) - if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_linux")) && value.empty()) - break; + tograb = "@library_linux"; #elif defined(TARGET_WINDOWS) && defined(HAS_SDL_OPENGL) - if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_wingl")) && value.empty()) - break; + tograb = "@library_wingl"; #elif defined(TARGET_WINDOWS) && defined(HAS_DX) - if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_windx")) && value.empty()) - break; + tograb = "@library_windx"; #elif defined(TARGET_DARWIN) - if ((value = GetExtValue(props->plugin->extensions->configuration, "@library_osx")) && value.empty()) - break; + tograb = "@library_osx"; #endif + value = GetExtValue(props->plugin->extensions->configuration, tograb.c_str()); + if (value.empty()) + break; if (type == ADDON_VIZ) { #if defined(HAS_VISUALISATION) @@ -197,7 +196,7 @@ bool CAddonMgr::CheckUserDirs(const cp_cfg_element_t *settings) ELEMENTS::iterator itr = elements.begin(); while (itr != elements.end()) { - CStdString path = GetExtValue(*itr++, "@path"); + std::string path = GetExtValue(*itr++, "@path"); if (!CFile::Exists(path)) { if (!CUtil::CreateDirectoryEx(path)) @@ -358,19 +357,19 @@ void CAddonMgr::RemoveFromUpdateableAddons(AddonPtr &pAddon) struct AddonIdFinder { - AddonIdFinder(const CStdString& id) + AddonIdFinder(const std::string& id) : m_id(id) {} bool operator()(const AddonPtr& addon) { - return m_id.Equals(addon->ID()); + return m_id == addon->ID(); } private: - CStdString m_id; + std::string m_id; }; -bool CAddonMgr::ReloadSettings(const CStdString &id) +bool CAddonMgr::ReloadSettings(const std::string &id) { CSingleLock lock(m_critSection); VECADDONS::iterator it = std::find_if(m_updateableAddons.begin(), m_updateableAddons.end(), AddonIdFinder(id)); @@ -432,7 +431,7 @@ bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, bool enabled /* = return false; cp_status_t status; int num; - CStdString ext_point(TranslateType(type)); + std::string ext_point(TranslateType(type)); cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num); for(int i=0; i <num; i++) { @@ -461,7 +460,7 @@ bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, bool enabled /* = return addons.size() > 0; } -bool CAddonMgr::GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type/*=ADDON_UNKNOWN*/, bool enabledOnly /*= true*/) +bool CAddonMgr::GetAddon(const std::string &str, AddonPtr &addon, const TYPE &type/*=ADDON_UNKNOWN*/, bool enabledOnly /*= true*/) { CSingleLock lock(m_critSection); @@ -495,7 +494,7 @@ bool CAddonMgr::GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &typ //TODO handle all 'default' cases here, not just scrapers & vizs bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon) { - CStdString setting; + std::string setting; switch (type) { case ADDON_VIZ: @@ -528,7 +527,7 @@ bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon) return GetAddon(setting, addon, type); } -bool CAddonMgr::SetDefault(const TYPE &type, const CStdString &addonID) +bool CAddonMgr::SetDefault(const TYPE &type, const std::string &addonID) { switch (type) { @@ -560,7 +559,7 @@ bool CAddonMgr::SetDefault(const TYPE &type, const CStdString &addonID) return true; } -CStdString CAddonMgr::GetString(const CStdString &id, const int number) +std::string CAddonMgr::GetString(const std::string &id, const int number) { AddonPtr addon; if (GetAddon(id, addon)) @@ -582,7 +581,7 @@ void CAddonMgr::FindAddons() NotifyObservers(ObservableMessageAddons); } -void CAddonMgr::RemoveAddon(const CStdString& ID) +void CAddonMgr::RemoveAddon(const std::string& ID) { if (m_cpluff && m_cp_context) { @@ -617,10 +616,10 @@ bool CAddonMgr::IsAddonDisabled(const std::string& ID) return ret; } -const char *CAddonMgr::GetTranslatedString(const cp_cfg_element_t *root, const char *tag) +std::string CAddonMgr::GetTranslatedString(const cp_cfg_element_t *root, const char *tag) { if (!root) - return NULL; + return ""; const cp_cfg_element_t *eng = NULL; for (unsigned int i = 0; i < root->num_children; i++) @@ -635,7 +634,7 @@ const char *CAddonMgr::GetTranslatedString(const cp_cfg_element_t *root, const c eng = &child; } } - return (eng) ? eng->value : NULL; + return (eng) ? eng->value : ""; } AddonPtr CAddonMgr::AddonFromProps(AddonProps& addonProps) @@ -743,7 +742,7 @@ bool CAddonMgr::GetExtElements(cp_cfg_element_t *base, const char *path, ELEMENT for (unsigned int i = 0; i < base->num_children; i++) { - CStdString temp = base->children[i].name; + std::string temp = base->children[i].name; if (!temp.compare(path)) elements.push_back(&base->children[i]); } @@ -763,12 +762,13 @@ const cp_extension_t *CAddonMgr::GetExtension(const cp_plugin_info_t *props, con return NULL; } -CStdString CAddonMgr::GetExtValue(cp_cfg_element_t *base, const char *path) +std::string CAddonMgr::GetExtValue(cp_cfg_element_t *base, const char *path) { - const char *value = NULL; + const char *value = ""; if (base && (value = m_cpluff->lookup_cfg_value(base, path))) - return CStdString(value); - else return CStdString(); + return value; + else + return ""; } bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, vector<std::string> &result) const @@ -776,15 +776,15 @@ bool CAddonMgr::GetExtList(cp_cfg_element_t *base, const char *path, vector<std: result.clear(); if (!base || !path) return false; - CStdString all = m_cpluff->lookup_cfg_value(base, path); - if (all.empty()) + const char *all = m_cpluff->lookup_cfg_value(base, path); + if (!all || *all == 0) return false; StringUtils::Tokenize(all, result, " "); return true; } AddonPtr CAddonMgr::GetAddonFromDescriptor(const cp_plugin_info_t *info, - const CStdString& type) + const std::string& type) { if (!info) return AddonPtr(); @@ -810,7 +810,7 @@ AddonPtr CAddonMgr::GetAddonFromDescriptor(const cp_plugin_info_t *info, } // FIXME: This function may not be required -bool CAddonMgr::LoadAddonDescription(const CStdString &path, AddonPtr &addon) +bool CAddonMgr::LoadAddonDescription(const std::string &path, AddonPtr &addon) { cp_status_t status; cp_plugin_info_t *info = m_cpluff->load_plugin_descriptor(m_cp_context, CSpecialProtocol::TranslatePath(path).c_str(), &status); diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h index 711f947b0a..8aea7fdd7c 100644 --- a/xbmc/addons/AddonManager.h +++ b/xbmc/addons/AddonManager.h @@ -20,8 +20,8 @@ */ #include "Addon.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" #include "utils/Observer.h" +#include <string> #include <vector> #include <map> #include <deque> @@ -39,14 +39,14 @@ namespace ADDON typedef std::map<TYPE, VECADDONS>::iterator IMAPADDONS; typedef std::vector<cp_cfg_element_t*> ELEMENTS; - const CStdString ADDON_METAFILE = "description.xml"; - const CStdString ADDON_VIS_EXT = "*.vis"; - const CStdString ADDON_PYTHON_EXT = "*.py"; - const CStdString ADDON_SCRAPER_EXT = "*.xml"; - const CStdString ADDON_SCREENSAVER_EXT = "*.xbs"; - const CStdString ADDON_PVRDLL_EXT = "*.pvr"; - const CStdString ADDON_DSP_AUDIO_EXT = "*.adsp"; - const CStdString ADDON_VERSION_RE = "(?<Major>\\d*)\\.?(?<Minor>\\d*)?\\.?(?<Build>\\d*)?\\.?(?<Revision>\\d*)?"; + const std::string ADDON_METAFILE = "description.xml"; + const std::string ADDON_VIS_EXT = "*.vis"; + const std::string ADDON_PYTHON_EXT = "*.py"; + const std::string ADDON_SCRAPER_EXT = "*.xml"; + const std::string ADDON_SCREENSAVER_EXT = "*.xbs"; + const std::string ADDON_PVRDLL_EXT = "*.pvr"; + const std::string ADDON_DSP_AUDIO_EXT = "*.adsp"; + const std::string ADDON_VERSION_RE = "(?<Major>\\d*)\\.?(?<Minor>\\d*)?\\.?(?<Build>\\d*)?\\.?(?<Revision>\\d*)?"; /** * Class - IAddonMgrCallback @@ -82,7 +82,7 @@ namespace ADDON /* Addon access */ bool GetDefault(const TYPE &type, AddonPtr &addon); - bool SetDefault(const TYPE &type, const CStdString &addonID); + bool SetDefault(const TYPE &type, const std::string &addonID); /*! \brief Retrieve a specific addon (of a specific type) \param id the id of the addon to retrieve. \param addon [out] the retrieved addon pointer - only use if the function returns true. @@ -90,13 +90,13 @@ namespace ADDON \param enabledOnly whether we only want enabled addons - set to false to allow both enabled and disabled addons - defaults to true. \return true if an addon matching the id of the given type is available and is enabled (if enabledOnly is true). */ - bool GetAddon(const CStdString &id, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabledOnly = true); + bool GetAddon(const std::string &id, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabledOnly = true); bool HasAddons(const TYPE &type, bool enabled = true); bool GetAddons(const TYPE &type, VECADDONS &addons, bool enabled = true); bool GetAllAddons(VECADDONS &addons, bool enabled = true, bool allowRepos = false); void AddToUpdateableAddons(AddonPtr &pAddon); void RemoveFromUpdateableAddons(AddonPtr &pAddon); - bool ReloadSettings(const CStdString &id); + bool ReloadSettings(const std::string &id); /*! \brief Get all addons with available updates \param addons List to fill with all outdated addons \param getLocalVersion Whether to get the local addon version or the addon verion from the repository @@ -107,12 +107,12 @@ namespace ADDON \return True if there are outdated addons otherwise false */ bool HasOutdatedAddons(); - CStdString GetString(const CStdString &id, const int number); + std::string GetString(const std::string &id, const int number); - const char *GetTranslatedString(const cp_cfg_element_t *root, const char *tag); + std::string GetTranslatedString(const cp_cfg_element_t *root, const char *tag); static AddonPtr AddonFromProps(AddonProps& props); void FindAddons(); - void RemoveAddon(const CStdString& ID); + void RemoveAddon(const std::string& ID); /* \brief Disable an addon Triggers the database routine and saves the current addon state to cache. @@ -130,7 +130,7 @@ namespace ADDON bool IsAddonDisabled(const std::string& ID); /* libcpluff */ - CStdString GetExtValue(cp_cfg_element_t *base, const char *path); + std::string GetExtValue(cp_cfg_element_t *base, const char *path); /*! \brief Retrieve a vector of repeated elements from a given configuration element \param base the base configuration element. @@ -157,7 +157,7 @@ namespace ADDON \param addon [out] returned addon. \return true if addon is set, false otherwise. */ - bool LoadAddonDescription(const CStdString &path, AddonPtr &addon); + bool LoadAddonDescription(const std::string &path, AddonPtr &addon); /*! \brief Load the addon in the given in-memory xml This loads the addon using c-pluff which parses the addon descriptor file. @@ -184,8 +184,8 @@ namespace ADDON void StopServices(const bool onlylogin); private: - void LoadAddons(const CStdString &path, - std::map<CStdString, AddonPtr>& unresolved); + void LoadAddons(const std::string &path, + std::map<std::string, AddonPtr>& unresolved); /* libcpluff */ const cp_cfg_element_t *GetExtElement(cp_cfg_element_t *base, const char *path); @@ -200,7 +200,7 @@ namespace ADDON \return an AddonPtr based on the descriptor. May be NULL if no suitable extension point is found. */ AddonPtr GetAddonFromDescriptor(const cp_plugin_info_t *info, - const CStdString& type=""); + const std::string& type=""); /*! \brief Check whether this addon is supported on the current platform \param info the plugin descriptor diff --git a/xbmc/addons/AddonStatusHandler.cpp b/xbmc/addons/AddonStatusHandler.cpp index e2d3b90ae5..7bb874a4dd 100644 --- a/xbmc/addons/AddonStatusHandler.cpp +++ b/xbmc/addons/AddonStatusHandler.cpp @@ -43,8 +43,8 @@ namespace ADDON CCriticalSection CAddonStatusHandler::m_critSection; -CAddonStatusHandler::CAddonStatusHandler(const CStdString &addonID, ADDON_STATUS status, CStdString message, bool sameThread) - : CThread("AddonStatus " + addonID) +CAddonStatusHandler::CAddonStatusHandler(const std::string &addonID, ADDON_STATUS status, std::string message, bool sameThread) + : CThread(("AddonStatus " + addonID).c_str()) { if (!CAddonMgr::Get().GetAddon(addonID, m_addon)) return; @@ -82,7 +82,7 @@ void CAddonStatusHandler::Process() { CSingleLock lock(m_critSection); - CStdString heading = StringUtils::Format("%s: %s", TranslateType(m_addon->Type(), true).c_str(), m_addon->Name().c_str()); + std::string 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) diff --git a/xbmc/addons/AddonStatusHandler.h b/xbmc/addons/AddonStatusHandler.h index b511c9c034..c9b65bdfda 100644 --- a/xbmc/addons/AddonStatusHandler.h +++ b/xbmc/addons/AddonStatusHandler.h @@ -23,6 +23,7 @@ #include "IAddon.h" #include "include/xbmc_addon_types.h" #include "threads/CriticalSection.h" +#include <string> namespace ADDON { @@ -36,7 +37,7 @@ namespace ADDON class CAddonStatusHandler : private CThread { public: - CAddonStatusHandler(const CStdString &addonID, ADDON_STATUS status, CStdString message, bool sameThread = true); + CAddonStatusHandler(const std::string &addonID, ADDON_STATUS status, std::string message, bool sameThread = true); ~CAddonStatusHandler(); /* Thread handling */ @@ -48,7 +49,7 @@ namespace ADDON static CCriticalSection m_critSection; AddonPtr m_addon; ADDON_STATUS m_status; - CStdString m_message; + std::string m_message; }; diff --git a/xbmc/addons/AddonVersion.cpp b/xbmc/addons/AddonVersion.cpp index 72fe3e4bf1..9d5a112e09 100644 --- a/xbmc/addons/AddonVersion.cpp +++ b/xbmc/addons/AddonVersion.cpp @@ -123,8 +123,8 @@ namespace ADDON return out; } - bool AddonVersion::SplitFileName(CStdString& ID, CStdString& version, - const CStdString& filename) + bool AddonVersion::SplitFileName(std::string& ID, std::string& version, + const std::string& filename) { size_t dpos = filename.rfind("-"); if (dpos == std::string::npos) diff --git a/xbmc/addons/AddonVersion.h b/xbmc/addons/AddonVersion.h index 92a4df7a21..be24cc9829 100644 --- a/xbmc/addons/AddonVersion.h +++ b/xbmc/addons/AddonVersion.h @@ -20,7 +20,6 @@ #include <string> #include <boost/operators.hpp> -#include "utils/StdString.h" namespace ADDON { @@ -52,8 +51,8 @@ namespace ADDON std::string asString() const; bool empty() const; - static bool SplitFileName(CStdString& ID, CStdString& version, - const CStdString& filename); + static bool SplitFileName(std::string& ID, std::string& version, + const std::string& filename); protected: int mEpoch; diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp index b002bdd461..92e397165c 100644 --- a/xbmc/addons/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/GUIDialogAddonInfo.cpp @@ -150,7 +150,7 @@ void CGUIDialogAddonInfo::OnInitWindow() void CGUIDialogAddonInfo::UpdateControls() { - CStdString xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons"); + std::string xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons"); bool isInstalled = NULL != m_localAddon.get(); bool isSystem = isInstalled && StringUtils::StartsWith(m_localAddon->Path(), xbmcPath); bool isEnabled = isInstalled && m_item->GetProperty("Addon.Enabled").asBoolean(); @@ -180,7 +180,7 @@ void CGUIDialogAddonInfo::UpdateControls() void CGUIDialogAddonInfo::OnUpdate() { - CStdString referer = StringUtils::Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().asString().c_str()); + std::string referer = StringUtils::Format("Referer=%s-%s.zip",m_localAddon->ID().c_str(),m_localAddon->Version().asString().c_str()); CAddonInstaller::Get().Install(m_addon->ID(), true, referer); // force install Close(); } @@ -318,7 +318,7 @@ void CGUIDialogAddonInfo::OnRollback() CContextButtons buttons; for (unsigned int i=0;i<m_rollbackVersions.size();++i) { - CStdString label(m_rollbackVersions[i]); + std::string label(m_rollbackVersions[i]); if (m_rollbackVersions[i] == m_localAddon->Version().asString()) label += " "+g_localizeStrings.Get(24094); if (database.IsAddonBlacklisted(m_localAddon->ID(),label)) @@ -332,7 +332,7 @@ void CGUIDialogAddonInfo::OnRollback() // blacklist everything newer for (unsigned int j=choice+1;j<m_rollbackVersions.size();++j) database.BlacklistAddon(m_localAddon->ID(),m_rollbackVersions[j]); - CStdString path = "special://home/addons/packages/"; + std::string path = "special://home/addons/packages/"; path += m_localAddon->ID()+"-"+m_rollbackVersions[choice]+".zip"; // needed as cpluff won't downgrade if (!m_localAddon->IsType(ADDON_SERVICE)) @@ -392,7 +392,7 @@ bool CGUIDialogAddonInfo::SetItem(const CFileItemPtr& item) if (addons[j]->Type() == (TYPE)i) ++num; } - m_item->SetProperty(CStdString("Repo.") + TranslateType((TYPE)i), num); + m_item->SetProperty("Repo." + TranslateType((TYPE)i), num); tot += num; } m_item->SetProperty("Repo.Addons", tot); @@ -440,14 +440,14 @@ void CGUIDialogAddonInfo::GrabRollbackVersions() { if (items[i]->m_bIsFolder) continue; - CStdString ID, version; + std::string ID, version; AddonVersion::SplitFileName(ID,version,items[i]->GetLabel()); - if (ID.Equals(m_localAddon->ID())) + if (ID == m_localAddon->ID()) { - CStdString hash, path(items[i]->GetPath()); + std::string hash, path(items[i]->GetPath()); if (db.GetPackageHash(m_localAddon->ID(), path, hash)) { - CStdString md5 = CUtil::GetFileMD5(path); + std::string md5 = CUtil::GetFileMD5(path); if (md5 == hash) m_rollbackVersions.push_back(version); else /* The package has been corrupted */ diff --git a/xbmc/addons/GUIDialogAddonInfo.h b/xbmc/addons/GUIDialogAddonInfo.h index aa76090b46..53b7a276a2 100644 --- a/xbmc/addons/GUIDialogAddonInfo.h +++ b/xbmc/addons/GUIDialogAddonInfo.h @@ -75,6 +75,6 @@ protected: // rollback data void GrabRollbackVersions(); - std::vector<CStdString> m_rollbackVersions; + std::vector<std::string> m_rollbackVersions; }; diff --git a/xbmc/addons/GUIDialogAddonSettings.cpp b/xbmc/addons/GUIDialogAddonSettings.cpp index 2228108d61..87437387e3 100644 --- a/xbmc/addons/GUIDialogAddonSettings.cpp +++ b/xbmc/addons/GUIDialogAddonSettings.cpp @@ -131,8 +131,8 @@ bool CGUIDialogAddonSettings::OnMessage(CGUIMessage& message) } case GUI_MSG_SETTING_UPDATED: { - CStdString id = message.GetStringParam(0); - CStdString value = message.GetStringParam(1); + std::string id = message.GetStringParam(0); + std::string value = message.GetStringParam(1); m_settings[id] = value; if (GetFocusedControl()) { @@ -207,7 +207,7 @@ bool CGUIDialogAddonSettings::ShowAndGetInput(const AddonPtr &addon, bool saveTo return false; // Set the heading - CStdString heading = StringUtils::Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName" + std::string heading = StringUtils::Format("$LOCALIZE[10004] - %s", addon->Name().c_str()); // "Settings - AddonName" pDialog->m_strHeading = heading; pDialog->m_changed = false; @@ -242,8 +242,8 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) { const char *option = setting->Attribute("option"); const char *source = setting->Attribute("source"); - CStdString value = m_buttonValues[id]; - CStdString label = GetString(setting->Attribute("label")); + std::string value = m_buttonValues[id]; + std::string label = GetString(setting->Attribute("label")); if (type == "text") { @@ -263,7 +263,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) // if hidden hide input if (bHidden) { - CStdString hiddenText; + std::string hiddenText; hiddenText.append(value.size(), L'*'); ((CGUIButtonControl *)control)->SetLabel2(hiddenText); } @@ -298,9 +298,9 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) StringUtils::Tokenize(setting->Attribute("lvalues"), valuesVec, "|"); for (unsigned int i = 0; i < valuesVec.size(); i++) { - if (i == (unsigned int)atoi(value)) + if (i == (unsigned int)atoi(value.c_str())) selected = i; - CStdString localized = m_addon->GetString(atoi(valuesVec[i].c_str())); + std::string localized = m_addon->GetString(atoi(valuesVec[i].c_str())); if (localized.empty()) localized = g_localizeStrings.Get(atoi(valuesVec[i].c_str())); valuesVec[i] = localized; @@ -370,7 +370,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) else { // set the proper mask - CStdString strMask; + std::string strMask; if (setting->Attribute("mask")) { strMask = setting->Attribute("mask"); @@ -414,7 +414,7 @@ bool CGUIDialogAddonSettings::ShowVirtualKeyboard(int iControl) } else if (type == "action") { - CStdString action = XMLUtils::GetAttribute(setting, "action"); + std::string action = XMLUtils::GetAttribute(setting, "action"); if (!action.empty()) { // replace $CWD with the url of plugin/script @@ -511,7 +511,7 @@ void CGUIDialogAddonSettings::UpdateFromControls() if (control) { - CStdString value; + std::string value; switch (control->GetControlType()) { case CGUIControl::GUICONTROL_BUTTON: @@ -528,7 +528,7 @@ void CGUIDialogAddonSettings::UpdateFromControls() break; case CGUIControl::GUICONTROL_SETTINGS_SLIDER: { - CStdString option = XMLUtils::GetAttribute(setting, "option"); + std::string option = XMLUtils::GetAttribute(setting, "option"); if (option.size() == 0 || StringUtils::EqualsNoCase(option, "float")) value = StringUtils::Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue()); else @@ -549,7 +549,7 @@ void CGUIDialogAddonSettings::SaveSettings(void) { UpdateFromControls(); - for (map<CStdString, CStdString>::iterator i = m_settings.begin(); i != m_settings.end(); ++i) + for (map<std::string, std::string>::iterator i = m_settings.begin(); i != m_settings.end(); ++i) m_addon->UpdateSetting(i->first, i->second); if (m_saveToDisk) @@ -605,7 +605,7 @@ void CGUIDialogAddonSettings::CreateSections() { // add a category CGUIButtonControl *button = originalButton ? originalButton->Clone() : NULL; - CStdString label = GetString(category->Attribute("label")); + std::string label = GetString(category->Attribute("label")); if (label.empty()) label = g_localizeStrings.Get(128); @@ -692,7 +692,7 @@ void CGUIDialogAddonSettings::CreateControls() ((CGUIButtonControl *)pControl)->SetLabel(label); if (!id.empty()) { - CStdString value = m_settings[id]; + std::string value = m_settings[id]; m_buttonValues[id] = value; // get any option to test for hidden const std::string option = XMLUtils::GetAttribute(setting, "option"); @@ -700,7 +700,7 @@ void CGUIDialogAddonSettings::CreateControls() value = CURL::Decode(value); else if (option == "hidden") { - CStdString hiddenText; + std::string hiddenText; hiddenText.append(value.size(), L'*'); ((CGUIButtonControl *)pControl)->SetLabel2(hiddenText); } @@ -714,7 +714,7 @@ void CGUIDialogAddonSettings::CreateControls() int selected = atoi(value.c_str()); if (selected >= 0 && selected < (int)valuesVec.size()) { - CStdString label = m_addon->GetString(atoi(valuesVec[selected].c_str())); + std::string label = m_addon->GetString(atoi(valuesVec[selected].c_str())); if (label.empty()) label = g_localizeStrings.Get(atoi(valuesVec[selected].c_str())); ((CGUIButtonControl *)pControl)->SetLabel2(label); @@ -768,7 +768,7 @@ void CGUIDialogAddonSettings::CreateControls() iAdd = atoi(entryVec[i].c_str()); if (!lvalues.empty()) { - CStdString replace = m_addon->GetString(atoi(valuesVec[i].c_str())); + std::string replace = m_addon->GetString(atoi(valuesVec[i].c_str())); if (replace.empty()) replace = g_localizeStrings.Get(atoi(valuesVec[i].c_str())); ((CGUISpinControlEx *)pControl)->AddLabel(replace, iAdd); @@ -781,7 +781,7 @@ void CGUIDialogAddonSettings::CreateControls() ((CGUISpinControlEx*) pControl)->SetValueFromLabel(m_settings[id]); } else - ((CGUISpinControlEx*) pControl)->SetValue(atoi(m_settings[id])); + ((CGUISpinControlEx*) pControl)->SetValue(atoi(m_settings[id].c_str())); } else if (type == "fileenum") @@ -817,19 +817,19 @@ void CGUIDialogAddonSettings::CreateControls() int elements = 2; setting->Attribute("elements", &elements); - CStdString valueformat; + std::string valueformat; if (setting->Attribute("valueformat")) valueformat = m_addon->GetString(atoi(setting->Attribute("valueformat"))); for (int i = 0; i < elements; i++) { - CStdString valuestring; + std::string valuestring; if (elements < 2) valuestring = StringUtils::Format(valueformat.c_str(), rangestart); else valuestring = StringUtils::Format(valueformat.c_str(), rangestart+(rangeend-rangestart)/(elements-1)*i); ((CGUISpinControlEx *)pControl)->AddLabel(valuestring, i); } - ((CGUISpinControlEx *)pControl)->SetValue(atoi(m_settings[id])); + ((CGUISpinControlEx *)pControl)->SetValue(atoi(m_settings[id].c_str())); } // Sample: <setting id="mysettingname" type="slider" label="30000" range="5,5,60" option="int" default="5"/> // to make ints from 5-60 with 5 steps @@ -868,7 +868,7 @@ void CGUIDialogAddonSettings::CreateControls() ((CGUISettingsSliderControl *)pControl)->SetType(iType); ((CGUISettingsSliderControl *)pControl)->SetFloatRange(fMin, fMax); ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(fInc); - ((CGUISettingsSliderControl *)pControl)->SetFloatValue((float)atof(m_settings[id])); + ((CGUISettingsSliderControl *)pControl)->SetFloatValue((float)atof(m_settings[id].c_str())); } else if (type == "lsep") { @@ -901,9 +901,9 @@ void CGUIDialogAddonSettings::CreateControls() EnableControls(); } -CStdString CGUIDialogAddonSettings::GetAddonNames(const CStdString& addonIDslist) const +std::string CGUIDialogAddonSettings::GetAddonNames(const std::string& addonIDslist) const { - CStdString retVal; + std::string retVal; vector<string> addons = StringUtils::Split(addonIDslist, ","); for (vector<string>::const_iterator it = addons.begin(); it != addons.end() ; it ++) { @@ -918,11 +918,11 @@ CStdString CGUIDialogAddonSettings::GetAddonNames(const CStdString& addonIDslist return retVal; } -vector<std::string> CGUIDialogAddonSettings::GetFileEnumValues(const CStdString &path, const CStdString &mask, const CStdString &options) const +vector<std::string> CGUIDialogAddonSettings::GetFileEnumValues(const std::string &path, const std::string &mask, const std::string &options) const { // Create our base path, used for type "fileenum" settings // replace $PROFILE with the profile path of the plugin/script - CStdString fullPath = path; + std::string fullPath = path; if (fullPath.find("$PROFILE") != std::string::npos) StringUtils::Replace(fullPath, "$PROFILE", m_addon->Profile()); else @@ -940,7 +940,7 @@ vector<std::string> CGUIDialogAddonSettings::GetFileEnumValues(const CStdString for (int i = 0; i < items.Size(); ++i) { CFileItemPtr pItem = items[i]; - if ((mask.Equals("/") && pItem->m_bIsFolder) || !pItem->m_bIsFolder) + if ((mask == "/" && pItem->m_bIsFolder) || !pItem->m_bIsFolder) { if (hideExtensions) pItem->RemoveExtension(); @@ -978,7 +978,7 @@ void CGUIDialogAddonSettings::EnableControls() } } -bool CGUIDialogAddonSettings::GetCondition(const CStdString &condition, const int controlId) +bool CGUIDialogAddonSettings::GetCondition(const std::string &condition, const int controlId) { if (condition.empty()) return true; @@ -998,16 +998,16 @@ bool CGUIDialogAddonSettings::GetCondition(const CStdString &condition, const in for (unsigned int i = 0; i < conditionVec.size(); i++) { - vector<CStdString> condVec; + vector<std::string> condVec; if (!TranslateSingleString(conditionVec[i], condVec)) continue; - const CGUIControl* control2 = GetControl(controlId + atoi(condVec[1])); + const CGUIControl* control2 = GetControl(controlId + atoi(condVec[1].c_str())); if (!control2) continue; bControlDependend = true; //once we are here - this condition depends on another control - CStdString value; + std::string value; switch (control2->GetControlType()) { case CGUIControl::GUICONTROL_BUTTON: @@ -1026,33 +1026,33 @@ bool CGUIDialogAddonSettings::GetCondition(const CStdString &condition, const in break; } - if (condVec[0].Equals("eq")) + if (condVec[0] == "eq") { if (bCompare) - bCondition &= value.Equals(condVec[2]); + bCondition &= StringUtils::EqualsNoCase(value, condVec[2]); else - bCondition |= value.Equals(condVec[2]); + bCondition |= StringUtils::EqualsNoCase(value, condVec[2]); } - else if (condVec[0].Equals("!eq")) + else if (condVec[0] == "!eq") { if (bCompare) - bCondition &= !value.Equals(condVec[2]); + bCondition &= !StringUtils::EqualsNoCase(value, condVec[2]); else - bCondition |= !value.Equals(condVec[2]); + bCondition |= !StringUtils::EqualsNoCase(value, condVec[2]); } - else if (condVec[0].Equals("gt")) + else if (condVec[0] == "gt") { if (bCompare) - bCondition &= (atoi(value) > atoi(condVec[2])); + bCondition &= (atoi(value.c_str()) > atoi(condVec[2].c_str())); else - bCondition |= (atoi(value) > atoi(condVec[2])); + bCondition |= (atoi(value.c_str()) > atoi(condVec[2].c_str())); } - else if (condVec[0].Equals("lt")) + else if (condVec[0] == "lt") { if (bCompare) - bCondition &= (atoi(value) < atoi(condVec[2])); + bCondition &= (atoi(value.c_str()) < atoi(condVec[2].c_str())); else - bCondition |= (atoi(value) < atoi(condVec[2])); + bCondition |= (atoi(value.c_str()) < atoi(condVec[2].c_str())); } } @@ -1064,9 +1064,9 @@ bool CGUIDialogAddonSettings::GetCondition(const CStdString &condition, const in return bCondition; } -bool CGUIDialogAddonSettings::TranslateSingleString(const CStdString &strCondition, vector<CStdString> &condVec) +bool CGUIDialogAddonSettings::TranslateSingleString(const std::string &strCondition, vector<std::string> &condVec) { - CStdString strTest = strCondition; + std::string strTest = strCondition; StringUtils::ToLower(strTest); StringUtils::Trim(strTest); @@ -1085,11 +1085,11 @@ bool CGUIDialogAddonSettings::TranslateSingleString(const CStdString &strConditi return false; } -CStdString CGUIDialogAddonSettings::GetString(const char *value, bool subSetting) const +std::string CGUIDialogAddonSettings::GetString(const char *value, bool subSetting) const { if (!value) return ""; - CStdString prefix(subSetting ? "- " : ""); + std::string prefix(subSetting ? "- " : ""); if (StringUtils::IsNaturalNumber(value)) return prefix + m_addon->GetString(atoi(value)); return prefix + value; @@ -1174,7 +1174,7 @@ void CGUIDialogAddonSettings::DoProcess(unsigned int currentTime, CDirtyRegionLi } } -CStdString CGUIDialogAddonSettings::GetCurrentID() const +std::string CGUIDialogAddonSettings::GetCurrentID() const { if (m_addon) return m_addon->ID(); diff --git a/xbmc/addons/GUIDialogAddonSettings.h b/xbmc/addons/GUIDialogAddonSettings.h index 382167e678..11228ed6cf 100644 --- a/xbmc/addons/GUIDialogAddonSettings.h +++ b/xbmc/addons/GUIDialogAddonSettings.h @@ -37,7 +37,7 @@ public: static bool ShowAndGetInput(const ADDON::AddonPtr &addon, bool saveToDisk = true); virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions); - CStdString GetCurrentID() const; + std::string GetCurrentID() const; protected: virtual void OnInitWindow(); virtual int GetDefaultLabelID(int controlId) const; @@ -48,7 +48,7 @@ private: \param subsetting whether the character string should be prefixed by "- ", defaults to false \return the localized addon string */ - CStdString GetString(const char *value, bool subSetting = false) const; + std::string GetString(const char *value, bool subSetting = false) const; /*! \brief return a the values for a fileenum setting \param path the path to use for files @@ -56,13 +56,13 @@ private: \param options any options, such as "hideext" to hide extensions \return the filenames in the path that match the mask */ - std::vector<std::string> GetFileEnumValues(const CStdString &path, const CStdString &mask, const CStdString &options) const; + std::vector<std::string> GetFileEnumValues(const std::string &path, const std::string &mask, const std::string &options) const; /*! \brief Translate list of addon IDs to list of addon names \param addonIDslist comma seperated list of addon IDs \return comma seperated list of addon names */ - CStdString GetAddonNames(const CStdString& addonIDslist) const; + std::string GetAddonNames(const std::string& addonIDslist) const; void CreateSections(); void FreeSections(); @@ -71,22 +71,22 @@ private: void UpdateFromControls(); void EnableControls(); void SetDefaultSettings(); - bool GetCondition(const CStdString &condition, const int controlId); + bool GetCondition(const std::string &condition, const int controlId); void SaveSettings(void); bool ShowVirtualKeyboard(int iControl); - bool TranslateSingleString(const CStdString &strCondition, std::vector<CStdString> &enableVec); + bool TranslateSingleString(const std::string &strCondition, std::vector<std::string> &enableVec); const TiXmlElement *GetFirstSetting() const; ADDON::AddonPtr m_addon; - std::map<CStdString,CStdString> m_buttonValues; + std::map<std::string,std::string> m_buttonValues; bool m_changed; bool m_saveToDisk; // whether the addon settings should be saved to disk or just stored locally in the addon unsigned int m_currentSection; unsigned int m_totalSections; - std::map<CStdString,CStdString> m_settings; // local storage of values + std::map<std::string,std::string> m_settings; // local storage of values }; diff --git a/xbmc/addons/GUIViewStateAddonBrowser.cpp b/xbmc/addons/GUIViewStateAddonBrowser.cpp index f3dfd1700b..c6497f4ecd 100644 --- a/xbmc/addons/GUIViewStateAddonBrowser.cpp +++ b/xbmc/addons/GUIViewStateAddonBrowser.cpp @@ -57,7 +57,7 @@ void CGUIViewStateAddonBrowser::SaveViewState() SaveViewToDb(m_items.GetPath(), WINDOW_ADDON_BROWSER); } -CStdString CGUIViewStateAddonBrowser::GetExtensions() +std::string CGUIViewStateAddonBrowser::GetExtensions() { return ""; } diff --git a/xbmc/addons/GUIViewStateAddonBrowser.h b/xbmc/addons/GUIViewStateAddonBrowser.h index b127eb9d3a..565cdc8613 100644 --- a/xbmc/addons/GUIViewStateAddonBrowser.h +++ b/xbmc/addons/GUIViewStateAddonBrowser.h @@ -29,7 +29,7 @@ public: protected: virtual void SaveViewState(); - virtual CStdString GetExtensions(); + virtual std::string GetExtensions(); virtual VECSOURCES& GetSources(); }; diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index 8c1bde44bc..87f7758cb9 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -222,7 +222,7 @@ class UpdateAddons : public IRunnable CAddonMgr::Get().GetAllOutdatedAddons(addons, true); // get local for (VECADDONS::iterator i = addons.begin(); i != addons.end(); ++i) { - CStdString referer = StringUtils::Format("Referer=%s-%s.zip",(*i)->ID().c_str(),(*i)->Version().asString().c_str()); + std::string referer = StringUtils::Format("Referer=%s-%s.zip",(*i)->ID().c_str(),(*i)->Version().asString().c_str()); CAddonInstaller::Get().Install((*i)->ID(), true, referer); // force install } } @@ -237,7 +237,7 @@ bool CGUIWindowAddonBrowser::OnClick(int iItem) VECSOURCES shares = *CMediaSourceSettings::Get().GetSources("files"); g_mediaManager.GetLocalDrives(shares); g_mediaManager.GetNetworkLocations(shares); - CStdString path; + std::string path; if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "*.zip", g_localizeStrings.Get(24041), path)) CAddonInstaller::Get().InstallFromZip(path); return true; @@ -385,7 +385,7 @@ void CGUIWindowAddonBrowser::SetItemLabel2(CFileItemPtr item) unsigned int percent; if (CAddonInstaller::Get().GetProgress(item->GetProperty("Addon.ID").asString(), percent)) { - CStdString progress = StringUtils::Format(g_localizeStrings.Get(24042).c_str(), percent); + std::string progress = StringUtils::Format(g_localizeStrings.Get(24042).c_str(), percent); item->SetProperty("Addon.Status", progress); item->SetProperty("Addon.Downloading", true); } @@ -409,7 +409,7 @@ bool CGUIWindowAddonBrowser::Update(const std::string &strDirectory, bool update return true; } -int CGUIWindowAddonBrowser::SelectAddonID(TYPE type, CStdString &addonID, bool showNone /*= false*/) +int CGUIWindowAddonBrowser::SelectAddonID(TYPE type, std::string &addonID, bool showNone /*= false*/) { vector<ADDON::TYPE> types; types.push_back(type); @@ -423,7 +423,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(ADDON::TYPE type, vector<string> &addo return SelectAddonID(types, addonIDs, showNone, multipleSelection); } -int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, CStdString &addonID, bool showNone /*= false*/) +int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, std::string &addonID, bool showNone /*= false*/) { vector<string> addonIDs; if (!addonID.empty()) @@ -443,7 +443,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, vect return 0; CFileItemList items; - CStdString heading; + std::string heading; int iTypes = 0; for (vector<ADDON::TYPE>::const_iterator it = types.begin(); it != types.end(); ++it) { diff --git a/xbmc/addons/GUIWindowAddonBrowser.h b/xbmc/addons/GUIWindowAddonBrowser.h index acbec9f02a..abe89c2c04 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.h +++ b/xbmc/addons/GUIWindowAddonBrowser.h @@ -40,8 +40,8 @@ public: \param showNone whether there should be a "None" item in the list (defaults to false) \return 1 if an addon was selected, 2 if "Get More" was chosen, or 0 if an error occurred or if the selection process was cancelled */ - static int SelectAddonID(ADDON::TYPE type, CStdString &addonID, bool showNone = false); - static int SelectAddonID(const std::vector<ADDON::TYPE> &types, CStdString &addonID, bool showNone = false); + static int SelectAddonID(ADDON::TYPE type, std::string &addonID, bool showNone = false); + static int SelectAddonID(const std::vector<ADDON::TYPE> &types, std::string &addonID, bool showNone = false); /*! \brief Popup a selection dialog with a list of addons of the given type \param type the type of addon wanted \param addonIDs [out] array of selected addon IDs diff --git a/xbmc/addons/IAddon.h b/xbmc/addons/IAddon.h index fde7c885b3..028bc24caa 100644 --- a/xbmc/addons/IAddon.h +++ b/xbmc/addons/IAddon.h @@ -19,12 +19,13 @@ * */ #include "boost/shared_ptr.hpp" -#include "utils/StdString.h" #include <boost/enable_shared_from_this.hpp> -#include <set> #include <map> +#include <set> +#include <string> +#include <stdint.h> class TiXmlElement; @@ -73,8 +74,8 @@ namespace ADDON class CAddonMgr; class AddonVersion; - typedef std::map<CStdString, std::pair<const AddonVersion, bool> > ADDONDEPS; - typedef std::map<CStdString, CStdString> InfoMap; + typedef std::map<std::string, std::pair<const AddonVersion, bool> > ADDONDEPS; + typedef std::map<std::string, std::string> InfoMap; class AddonProps; class IAddon : public boost::enable_shared_from_this<IAddon> @@ -86,30 +87,30 @@ namespace ADDON virtual bool IsType(TYPE type) const =0; virtual AddonProps Props() const =0; virtual AddonProps& Props() =0; - virtual const CStdString ID() const =0; - virtual const CStdString Name() const =0; + virtual const std::string ID() const =0; + virtual const std::string Name() const =0; virtual bool Enabled() const =0; virtual bool IsInUse() const =0; virtual const AddonVersion Version() const =0; virtual const AddonVersion MinVersion() const =0; - virtual const CStdString Summary() const =0; - virtual const CStdString Description() const =0; - virtual const CStdString Path() const =0; - virtual const CStdString Profile() const =0; - virtual const CStdString LibPath() const =0; - virtual const CStdString ChangeLog() const =0; - virtual const CStdString FanArt() const =0; - virtual const CStdString Author() const =0; - virtual const CStdString Icon() const =0; + virtual const std::string Summary() const =0; + virtual const std::string Description() const =0; + virtual const std::string Path() const =0; + virtual const std::string Profile() const =0; + virtual const std::string LibPath() const =0; + virtual const std::string ChangeLog() const =0; + virtual const std::string FanArt() const =0; + virtual const std::string Author() const =0; + virtual const std::string Icon() const =0; virtual int Stars() const =0; - virtual const CStdString Disclaimer() const =0; + virtual const std::string Disclaimer() const =0; virtual const InfoMap &ExtraInfo() const =0; virtual bool HasSettings() =0; virtual void SaveSettings() =0; - virtual void UpdateSetting(const CStdString& key, const CStdString& value) =0; - virtual CStdString GetSetting(const CStdString& key) =0; + virtual void UpdateSetting(const std::string& key, const std::string& value) =0; + virtual std::string GetSetting(const std::string& key) =0; virtual TiXmlElement* GetSettingsXML() =0; - virtual CStdString GetString(uint32_t id) =0; + virtual std::string GetString(uint32_t id) =0; virtual const ADDONDEPS &GetDeps() const =0; virtual AddonVersion GetDependencyVersion(const std::string &dependencyID) const =0; virtual bool MeetsVersion(const AddonVersion &version) const =0; diff --git a/xbmc/addons/PluginSource.cpp b/xbmc/addons/PluginSource.cpp index f64563c0ca..8269b3c1d8 100644 --- a/xbmc/addons/PluginSource.cpp +++ b/xbmc/addons/PluginSource.cpp @@ -29,7 +29,7 @@ namespace ADDON CPluginSource::CPluginSource(const AddonProps &props) : CAddon(props) { - CStdString provides; + std::string provides; InfoMap::const_iterator i = Props().extrainfo.find("provides"); if (i != Props().extrainfo.end()) provides = i->second; @@ -39,7 +39,7 @@ CPluginSource::CPluginSource(const AddonProps &props) CPluginSource::CPluginSource(const cp_extension_t *ext) : CAddon(ext) { - CStdString provides; + std::string provides; if (ext) { provides = CAddonMgr::Get().GetExtValue(ext->configuration, "provides"); @@ -54,9 +54,9 @@ AddonPtr CPluginSource::Clone() const return AddonPtr(new CPluginSource(*this)); } -void CPluginSource::SetProvides(const CStdString &content) +void CPluginSource::SetProvides(const std::string &content) { - vector<CStdString> provides; + vector<std::string> provides; if (!content.empty()) { vector<string> provides = StringUtils::Split(content, " "); @@ -71,15 +71,15 @@ void CPluginSource::SetProvides(const CStdString &content) m_providedContent.insert(EXECUTABLE); } -CPluginSource::Content CPluginSource::Translate(const CStdString &content) +CPluginSource::Content CPluginSource::Translate(const std::string &content) { - if (content.Equals("audio")) + if (content == "audio") return CPluginSource::AUDIO; - else if (content.Equals("image")) + else if (content == "image") return CPluginSource::IMAGE; - else if (content.Equals("executable")) + else if (content == "executable") return CPluginSource::EXECUTABLE; - else if (content.Equals("video")) + else if (content == "video") return CPluginSource::VIDEO; else return CPluginSource::UNKNOWN; diff --git a/xbmc/addons/PluginSource.h b/xbmc/addons/PluginSource.h index 2c9637d7dc..87e1f34b7b 100644 --- a/xbmc/addons/PluginSource.h +++ b/xbmc/addons/PluginSource.h @@ -45,13 +45,13 @@ public: return m_providedContent.size() > 1; } - static Content Translate(const CStdString &content); + static Content Translate(const std::string &content); private: /*! \brief Set the provided content for this plugin If no valid content types are passed in, we set the EXECUTABLE type \param content a space-separated list of content types */ - void SetProvides(const CStdString &content); + void SetProvides(const std::string &content); std::set<Content> m_providedContent; }; diff --git a/xbmc/addons/Repository.cpp b/xbmc/addons/Repository.cpp index 51e1a2dd13..5d25287ff5 100644 --- a/xbmc/addons/Repository.cpp +++ b/xbmc/addons/Repository.cpp @@ -71,11 +71,11 @@ CRepository::CRepository(const cp_extension_t *ext) DirInfo dir; dir.version = min_version; dir.checksum = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "checksum"); - dir.compressed = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "info@compressed").Equals("true"); + dir.compressed = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "info@compressed") == "true"; dir.info = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "info"); dir.datadir = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "datadir"); - dir.zipped = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "datadir@zip").Equals("true"); - dir.hashes = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "hashes").Equals("true"); + dir.zipped = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "datadir@zip") == "true"; + dir.hashes = CAddonMgr::Get().GetExtValue(&ext->configuration->children[i], "hashes") == "true"; m_dirs.push_back(dir); } } @@ -85,11 +85,11 @@ CRepository::CRepository(const cp_extension_t *ext) { DirInfo info; info.checksum = CAddonMgr::Get().GetExtValue(ext->configuration, "checksum"); - info.compressed = CAddonMgr::Get().GetExtValue(ext->configuration, "info@compressed").Equals("true"); + info.compressed = CAddonMgr::Get().GetExtValue(ext->configuration, "info@compressed") == "true"; info.info = CAddonMgr::Get().GetExtValue(ext->configuration, "info"); info.datadir = CAddonMgr::Get().GetExtValue(ext->configuration, "datadir"); - info.zipped = CAddonMgr::Get().GetExtValue(ext->configuration, "datadir@zip").Equals("true"); - info.hashes = CAddonMgr::Get().GetExtValue(ext->configuration, "hashes").Equals("true"); + info.zipped = CAddonMgr::Get().GetExtValue(ext->configuration, "datadir@zip") == "true"; + info.hashes = CAddonMgr::Get().GetExtValue(ext->configuration, "hashes") == "true"; m_dirs.push_back(info); } } diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp index 8ab526c91f..225220b5e2 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -67,7 +67,7 @@ static const ContentMapping content[] = {"tvshows", CONTENT_TVSHOWS, 20343 }, {"musicvideos", CONTENT_MUSICVIDEOS, 20389 }}; -CStdString TranslateContent(const CONTENT_TYPE &type, bool pretty/*=false*/) +std::string TranslateContent(const CONTENT_TYPE &type, bool pretty/*=false*/) { for (unsigned int index=0; index < sizeof(content)/sizeof(content[0]); ++index) { @@ -83,12 +83,12 @@ CStdString TranslateContent(const CONTENT_TYPE &type, bool pretty/*=false*/) return ""; } -CONTENT_TYPE TranslateContent(const CStdString &string) +CONTENT_TYPE TranslateContent(const std::string &string) { for (unsigned int index=0; index < sizeof(content)/sizeof(content[0]); ++index) { const ContentMapping &map = content[index]; - if (string.Equals(map.name)) + if (string == map.name) return map.type; } return CONTENT_NONE; @@ -118,8 +118,8 @@ static void CheckScraperError(const TiXmlElement *pxeRoot) { if (!pxeRoot || stricmp(pxeRoot->Value(), "error")) return; - CStdString sTitle; - CStdString sMessage; + std::string sTitle; + std::string sMessage; XMLUtils::GetString(pxeRoot, "title", sTitle); XMLUtils::GetString(pxeRoot, "message", sMessage); throw CScraperError(sTitle, sMessage); @@ -130,8 +130,8 @@ CScraper::CScraper(const cp_extension_t *ext) : CAddon(ext), m_fLoaded(false) if (ext) { m_language = CAddonMgr::Get().GetExtValue(ext->configuration, "@language"); - m_requiressettings = CAddonMgr::Get().GetExtValue(ext->configuration,"@requiressettings").Equals("true"); - CStdString persistence = CAddonMgr::Get().GetExtValue(ext->configuration, "@cachepersistence"); + m_requiressettings = CAddonMgr::Get().GetExtValue(ext->configuration,"@requiressettings") == "true"; + std::string persistence = CAddonMgr::Get().GetExtValue(ext->configuration, "@cachepersistence"); if (!persistence.empty()) m_persistence.SetFromTimeString(persistence); } @@ -177,7 +177,7 @@ bool CScraper::Supports(const CONTENT_TYPE &content) const return Type() == ScraperTypeFromContent(content); } -bool CScraper::SetPathSettings(CONTENT_TYPE content, const CStdString& xml) +bool CScraper::SetPathSettings(CONTENT_TYPE content, const std::string& xml) { m_pathContent = content; if (!LoadSettings()) @@ -193,7 +193,7 @@ bool CScraper::SetPathSettings(CONTENT_TYPE content, const CStdString& xml) return m_userSettingsLoaded; } -CStdString CScraper::GetPathSettings() +std::string CScraper::GetPathSettings() { if (!LoadSettings()) return ""; @@ -209,7 +209,7 @@ CStdString CScraper::GetPathSettings() void CScraper::ClearCache() { - CStdString strCachePath = URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath, "scrapers"); + std::string strCachePath = URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath, "scrapers"); // create scraper cache dir if needed if (!CDirectory::Exists(strCachePath)) @@ -237,7 +237,7 @@ void CScraper::ClearCache() // is XML output by chained functions, possibly recursively // the CCurlFile object is passed in so that URL fetches can be canceled from other threads // throws CScraperError abort on internal failures (e.g., parse errors) -vector<string> CScraper::Run(const CStdString& function, +vector<string> CScraper::Run(const std::string& function, const CScraperUrl& scrURL, CCurlFile& http, const vector<string>* extras) @@ -245,7 +245,7 @@ vector<string> CScraper::Run(const CStdString& function, if (!Load()) throw CScraperError(); - CStdString strXML = InternalRun(function,scrURL,http,extras); + std::string strXML = InternalRun(function,scrURL,http,extras); if (strXML.empty()) { if (function != "NfoUrl" && function != "ResolveIDToUrl") @@ -306,7 +306,7 @@ vector<string> CScraper::Run(const CStdString& function, // just like Run, but returns an empty list instead of throwing in case of error // don't use in new code; errors should be handled appropriately -vector<string> CScraper::RunNoThrow(const CStdString& function, +vector<string> CScraper::RunNoThrow(const std::string& function, const CScraperUrl& url, XFILE::CCurlFile& http, const vector<string>* extras) @@ -318,12 +318,12 @@ vector<string> CScraper::RunNoThrow(const CStdString& function, } catch (const CScraperError &sce) { - ASSERT(sce.FAborted()); // the only kind we should get + assert(sce.FAborted()); // the only kind we should get } return vcs; } -CStdString CScraper::InternalRun(const CStdString& function, +std::string CScraper::InternalRun(const std::string& function, const CScraperUrl& scrURL, CCurlFile& http, const vector<string>* extras) @@ -332,7 +332,7 @@ CStdString CScraper::InternalRun(const CStdString& function, unsigned int i; for (i=0;i<scrURL.m_url.size();++i) { - CStdString strCurrHTML; + std::string strCurrHTML; if (!CScraperUrl::Get(scrURL.m_url[i],m_parser.m_param[i],http,ID()) || m_parser.m_param[i].size() == 0) return ""; } @@ -361,7 +361,7 @@ bool CScraper::Load() ADDONDEPS::iterator itr = deps.begin(); while (itr != deps.end()) { - if (itr->first.Equals("xbmc.metadata")) + if (itr->first == "xbmc.metadata") { ++itr; continue; @@ -420,7 +420,7 @@ bool CScraper::IsNoop() // pass in contents of .nfo file; returns URL (possibly empty if none found) // and may populate strId, or throws CScraperError on error -CScraperUrl CScraper::NfoUrl(const CStdString &sNfoContent) +CScraperUrl CScraper::NfoUrl(const std::string &sNfoContent) { CScraperUrl scurlRet; @@ -485,7 +485,7 @@ CScraperUrl CScraper::NfoUrl(const CStdString &sNfoContent) return scurlRet; } -CScraperUrl CScraper::ResolveIDToUrl(const CStdString& externalID) +CScraperUrl CScraper::ResolveIDToUrl(const std::string& externalID) { CScraperUrl scurlRet; @@ -554,11 +554,11 @@ static bool RelevanceSortFunction(const CScraperUrl &left, const CScraperUrl &ri // fetch list of matching movies sorted by relevance (may be empty); // throws CScraperError on error; first called with fFirst set, then unset if first try fails -std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStdString &sMovie, +std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const std::string &sMovie, bool fFirst) { // prepare parameters for URL creation - CStdString sTitle, sTitleYear, sYear; + std::string sTitle, sTitleYear, sYear; CUtil::CleanString(sMovie, sTitle, sTitleYear, sYear, true/*fRemoveExt*/, fFirst); CLog::Log(LOGDEBUG, "%s: Searching for '%s' using %s scraper " @@ -595,7 +595,7 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd vcsOut = Run("GetSearchResults", scurl, fcurl, &vcsIn); bool fSort(true); - std::set<CStdString> stsDupeCheck; + std::set<std::string> stsDupeCheck; bool fResults(false); for (vector<string>::const_iterator i = vcsOut.begin(); i != vcsOut.end(); ++i) { @@ -638,9 +638,9 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd scurlMovie.ParseElement(pxeLink); // calculate the relavance of this hit - CStdString sCompareTitle = scurlMovie.strTitle; + std::string sCompareTitle = scurlMovie.strTitle; StringUtils::ToLower(sCompareTitle); - CStdString sMatchTitle = sTitle; + std::string sMatchTitle = sTitle; StringUtils::ToLower(sMatchTitle); /* @@ -649,12 +649,12 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd * An exact match scores 1, a match off by a year scores 0.5 (release dates can vary between * countries), otherwise it scores 0. */ - CStdString sCompareYear; + std::string sCompareYear; XMLUtils::GetString(pxeMovie, "year", sCompareYear); double yearScore = 0; if (!sYear.empty() && !sCompareYear.empty()) - yearScore = std::max(0.0, 1-0.5*abs(atoi(sYear)-atoi(sCompareYear))); + yearScore = std::max(0.0, 1-0.5*abs(atoi(sYear.c_str())-atoi(sCompareYear.c_str()))); scurlMovie.relevance = fstrcmp(sMatchTitle.c_str(), sCompareTitle.c_str(), 0.0) + yearScore; @@ -662,7 +662,7 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd if (!sCompareYear.empty()) scurlMovie.strTitle += StringUtils::Format(" (%s)", sCompareYear.c_str()); - CStdString sLanguage; + std::string sLanguage; if (XMLUtils::GetString(pxeMovie, "language", sLanguage) && !sLanguage.empty()) scurlMovie.strTitle += StringUtils::Format(" (%s)", sLanguage.c_str()); @@ -684,8 +684,8 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd // find album by artist, using fcurl for web fetches // returns a list of albums (empty if no match or failure) -std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CCurlFile &fcurl, const CStdString &sAlbum, - const CStdString &sArtist) +std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CCurlFile &fcurl, const std::string &sAlbum, + const std::string &sArtist) { CLog::Log(LOGDEBUG, "%s: Searching for '%s - %s' using %s scraper " "(path: '%s', content: '%s', version: '%s')", __FUNCTION__, sArtist.c_str(), @@ -736,17 +736,17 @@ std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CCurlFile &fcurl, const CStdStr for (TiXmlElement* pxeAlbum = xhDoc.FirstChild("results").FirstChild("entity").Element(); pxeAlbum; pxeAlbum = pxeAlbum->NextSiblingElement()) { - CStdString sTitle; + std::string sTitle; if (XMLUtils::GetString(pxeAlbum, "title", sTitle) && !sTitle.empty()) { - CStdString sArtist; - CStdString sAlbumName; + std::string sArtist; + std::string sAlbumName; if (XMLUtils::GetString(pxeAlbum, "artist", sArtist) && !sArtist.empty()) sAlbumName = StringUtils::Format("%s - %s", sArtist.c_str(), sTitle.c_str()); else sAlbumName = sTitle; - CStdString sYear; + std::string sYear; if (XMLUtils::GetString(pxeAlbum, "year", sYear) && !sYear.empty()) sAlbumName = StringUtils::Format("%s (%s)", sAlbumName.c_str(), sYear.c_str()); @@ -782,7 +782,7 @@ std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CCurlFile &fcurl, const CStdStr // find artist, using fcurl for web fetches // returns a list of artists (empty if no match or failure) std::vector<CMusicArtistInfo> CScraper::FindArtist(CCurlFile &fcurl, - const CStdString &sArtist) + const std::string &sArtist) { CLog::Log(LOGDEBUG, "%s: Searching for '%s' using %s scraper " "(file: '%s', content: '%s', version: '%s')", __FUNCTION__, sArtist.c_str(), @@ -847,7 +847,7 @@ std::vector<CMusicArtistInfo> CScraper::FindArtist(CCurlFile &fcurl, continue; CMusicArtistInfo ari(pxnTitle->FirstChild()->Value(), scurlArtist); - CStdString genre; + std::string genre; XMLUtils::GetString(pxeArtist, "genre", genre); if (!genre.empty()) ari.GetArtist().genre = StringUtils::Split(genre, g_advancedSettings.m_musicItemSeparator); @@ -893,7 +893,7 @@ EPISODELIST CScraper::GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl { EPISODE ep; TiXmlElement *pxeLink = pxeMovie->FirstChildElement("url"); - CStdString strEpNum; + std::string strEpNum; if (pxeLink && XMLUtils::GetInt(pxeMovie, "season", ep.iSeason) && XMLUtils::GetString(pxeMovie, "epnum", strEpNum) && !strEpNum.empty()) { @@ -910,11 +910,11 @@ EPISODELIST CScraper::GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl // date must be the format of yyyy-mm-dd ep.cDate.SetValid(FALSE); - CStdString sDate; + std::string sDate; if (XMLUtils::GetString(pxeMovie, "aired", sDate) && sDate.length() == 10) { tm tm; - if (strptime(sDate, "%Y-%m-%d", &tm)) + if (strptime(sDate.c_str(), "%Y-%m-%d", &tm)) ep.cDate.SetDate(1900+tm.tm_year, tm.tm_mon + 1, tm.tm_mday); } vcep.push_back(ep); @@ -935,7 +935,7 @@ bool CScraper::GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl ADDON::TranslateContent(Content()).c_str(), Version().asString().c_str()); video.Reset(); - CStdString sFunc = fMovie ? "GetDetails" : "GetEpisodeDetails"; + std::string sFunc = fMovie ? "GetDetails" : "GetEpisodeDetails"; vector<string> vcsIn; vcsIn.push_back(scurl.strId); vcsIn.push_back(scurl.m_url[0].m_url); @@ -995,7 +995,7 @@ bool CScraper::GetAlbumDetails(CCurlFile &fcurl, const CScraperUrl &scurl, CAlbu // takes a URL (one returned from FindArtist), the original search string, and // returns true and populates artist on success, false on failure bool CScraper::GetArtistDetails(CCurlFile &fcurl, const CScraperUrl &scurl, - const CStdString &sSearch, CArtist &artist) + const std::string &sSearch, CArtist &artist) { if (!scurl.m_url.size()) return false; diff --git a/xbmc/addons/Scraper.h b/xbmc/addons/Scraper.h index 717a480151..c7274f2844 100644 --- a/xbmc/addons/Scraper.h +++ b/xbmc/addons/Scraper.h @@ -56,8 +56,8 @@ namespace ADDON class CScraper; typedef boost::shared_ptr<CScraper> ScraperPtr; -CStdString TranslateContent(const CONTENT_TYPE &content, bool pretty=false); -CONTENT_TYPE TranslateContent(const CStdString &string); +std::string TranslateContent(const CONTENT_TYPE &content, bool pretty=false); +CONTENT_TYPE TranslateContent(const std::string &string); TYPE ScraperTypeFromContent(const CONTENT_TYPE &content); // thrown as exception to signal abort or show error dialog @@ -65,17 +65,17 @@ class CScraperError { public: CScraperError() : m_fAborted(true) {} - CScraperError(const CStdString &sTitle, const CStdString &sMessage) : + CScraperError(const std::string &sTitle, const std::string &sMessage) : m_fAborted(false), m_sTitle(sTitle), m_sMessage(sMessage) {} bool FAborted() const { return m_fAborted; } - const CStdString &Title() const { return m_sTitle; } - const CStdString &Message() const { return m_sMessage; } + const std::string &Title() const { return m_sTitle; } + const std::string &Message() const { return m_sMessage; } private: bool m_fAborted; - CStdString m_sTitle; - CStdString m_sMessage; + std::string m_sTitle; + std::string m_sMessage; }; class CScraper : public CAddon @@ -94,7 +94,7 @@ public: \return true if settings are available, false otherwise \sa GetPathSettings */ - bool SetPathSettings(CONTENT_TYPE content, const CStdString& xml); + bool SetPathSettings(CONTENT_TYPE content, const std::string& xml); /*! \brief Get the scraper settings for a particular path in the form of an XML string Loads the default and user settings (if not already loaded) and returns the user settings in the @@ -102,7 +102,7 @@ public: \return a string containing the XML settings \sa SetPathSettings */ - CStdString GetPathSettings(); + std::string GetPathSettings(); /*! \brief Clear any previously cached results for this scraper Any previously cached files are cleared if they have been cached for longer than the specified @@ -111,7 +111,7 @@ public: void ClearCache(); CONTENT_TYPE Content() const { return m_pathContent; } - const CStdString& Language() const { return m_language; } + const std::string& Language() const { return m_language; } bool RequiresSettings() const { return m_requiressettings; } bool Supports(const CONTENT_TYPE &content) const; @@ -119,7 +119,7 @@ public: bool IsNoop(); // scraper media functions - CScraperUrl NfoUrl(const CStdString &sNfoContent); + CScraperUrl NfoUrl(const std::string &sNfoContent); /*! \brief Resolve an external ID (e.g. MusicBrainz IDs) to a URL using scrapers If we have an ID in hand, e.g. MusicBrainz IDs or TheTVDB Season IDs @@ -130,14 +130,14 @@ public: \return a populated URL pointing to the details page for the given ID or an empty URL if we couldn't resolve the ID. */ - CScraperUrl ResolveIDToUrl(const CStdString &externalID); + CScraperUrl ResolveIDToUrl(const std::string &externalID); std::vector<CScraperUrl> FindMovie(XFILE::CCurlFile &fcurl, - const CStdString &sMovie, bool fFirst); + const std::string &sMovie, bool fFirst); std::vector<MUSIC_GRABBER::CMusicAlbumInfo> FindAlbum(XFILE::CCurlFile &fcurl, - const CStdString &sAlbum, const CStdString &sArtist = ""); + const std::string &sAlbum, const std::string &sArtist = ""); std::vector<MUSIC_GRABBER::CMusicArtistInfo> FindArtist( - XFILE::CCurlFile &fcurl, const CStdString &sArtist); + XFILE::CCurlFile &fcurl, const std::string &sArtist); VIDEO::EPISODELIST GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl); bool GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl, @@ -145,29 +145,29 @@ public: bool GetAlbumDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl, CAlbum &album); bool GetArtistDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl, - const CStdString &sSearch, CArtist &artist); + const std::string &sSearch, CArtist &artist); private: CScraper(const CScraper &rhs); - CStdString SearchStringEncoding() const + std::string SearchStringEncoding() const { return m_parser.GetSearchStringEncoding(); } bool Load(); - std::vector<std::string> Run(const CStdString& function, + std::vector<std::string> Run(const std::string& function, const CScraperUrl& url, XFILE::CCurlFile& http, const std::vector<std::string>* extras = NULL); - std::vector<std::string> RunNoThrow(const CStdString& function, + std::vector<std::string> RunNoThrow(const std::string& function, const CScraperUrl& url, XFILE::CCurlFile& http, const std::vector<std::string>* extras = NULL); - CStdString InternalRun(const CStdString& function, + std::string InternalRun(const std::string& function, const CScraperUrl& url, XFILE::CCurlFile& http, const std::vector<std::string>* extras); bool m_fLoaded; - CStdString m_language; + std::string m_language; bool m_requiressettings; CDateTimeSpan m_persistence; CONTENT_TYPE m_pathContent; diff --git a/xbmc/addons/Service.cpp b/xbmc/addons/Service.cpp index 7cf0fe73dc..508fded52b 100644 --- a/xbmc/addons/Service.cpp +++ b/xbmc/addons/Service.cpp @@ -33,8 +33,8 @@ CService::CService(const cp_extension_t *ext) { BuildServiceType(); - CStdString start = CAddonMgr::Get().GetExtValue(ext->configuration, "@start"); - if (start.Equals("startup")) + std::string start = CAddonMgr::Get().GetExtValue(ext->configuration, "@start"); + if (start == "startup") m_startOption = STARTUP; } @@ -93,17 +93,17 @@ bool CService::Stop() void CService::BuildServiceType() { - CStdString str = LibPath(); - CStdString ext; + std::string str = LibPath(); + std::string ext; size_t p = str.find_last_of('.'); if (p != string::npos) ext = str.substr(p + 1); #ifdef HAS_PYTHON - CStdString pythonExt = ADDON_PYTHON_EXT; + std::string pythonExt = ADDON_PYTHON_EXT; pythonExt.erase(0, 2); - if ( ext.Equals(pythonExt) ) + if ( ext == pythonExt ) m_type = PYTHON; else #endif diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp index 29f98432ca..77389a134b 100644 --- a/xbmc/addons/Skin.cpp +++ b/xbmc/addons/Skin.cpp @@ -55,12 +55,12 @@ CSkinInfo::CSkinInfo(const cp_extension_t *ext) { for (ELEMENTS::iterator i = elements.begin(); i != elements.end(); ++i) { - int width = atoi(CAddonMgr::Get().GetExtValue(*i, "@width")); - int height = atoi(CAddonMgr::Get().GetExtValue(*i, "@height")); - bool defRes = CAddonMgr::Get().GetExtValue(*i, "@default").Equals("true"); - CStdString folder = CAddonMgr::Get().GetExtValue(*i, "@folder"); + int width = atoi(CAddonMgr::Get().GetExtValue(*i, "@width").c_str()); + int height = atoi(CAddonMgr::Get().GetExtValue(*i, "@height").c_str()); + bool defRes = CAddonMgr::Get().GetExtValue(*i, "@default") == "true"; + std::string folder = CAddonMgr::Get().GetExtValue(*i, "@folder"); float aspect = 0; - CStdString strAspect = CAddonMgr::Get().GetExtValue(*i, "@aspect"); + std::string strAspect = CAddonMgr::Get().GetExtValue(*i, "@aspect"); vector<string> fracs = StringUtils::Split(strAspect, ":"); if (fracs.size() == 2) aspect = (float)(atof(fracs[0].c_str())/atof(fracs[1].c_str())); @@ -76,13 +76,13 @@ CSkinInfo::CSkinInfo(const cp_extension_t *ext) } else { // no resolutions specified -> backward compatibility - CStdString defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultwideresolution"); + std::string defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultwideresolution"); if (defaultWide.empty()) defaultWide = CAddonMgr::Get().GetExtValue(ext->configuration, "@defaultresolution"); TranslateResolution(defaultWide, m_defaultRes); } - CStdString str = CAddonMgr::Get().GetExtValue(ext->configuration, "@effectslowdown"); + std::string str = CAddonMgr::Get().GetExtValue(ext->configuration, "@effectslowdown"); if (!str.empty()) m_effectsSlowDown = (float)atof(str.c_str()); else @@ -145,12 +145,12 @@ void CSkinInfo::Start() } } -CStdString CSkinInfo::GetSkinPath(const CStdString& strFile, RESOLUTION_INFO *res, const CStdString& strBaseDir /* = "" */) const +std::string CSkinInfo::GetSkinPath(const std::string& strFile, RESOLUTION_INFO *res, const std::string& strBaseDir /* = "" */) const { if (m_resolutions.empty()) return ""; // invalid skin - CStdString strPathToUse = Path(); + std::string strPathToUse = Path(); if (!strBaseDir.empty()) strPathToUse = strBaseDir; @@ -163,7 +163,7 @@ CStdString CSkinInfo::GetSkinPath(const CStdString& strFile, RESOLUTION_INFO *re const RESOLUTION_INFO &target = g_graphicsContext.GetResInfo(); *res = *std::min_element(m_resolutions.begin(), m_resolutions.end(), closestRes(target)); - CStdString strPath = URIUtils::AddFileToFolder(strPathToUse, res->strMode); + std::string strPath = URIUtils::AddFileToFolder(strPathToUse, res->strMode); strPath = URIUtils::AddFileToFolder(strPath, strFile); if (CFile::Exists(strPath)) return strPath; @@ -176,14 +176,14 @@ CStdString CSkinInfo::GetSkinPath(const CStdString& strFile, RESOLUTION_INFO *re return strPath; } -bool CSkinInfo::HasSkinFile(const CStdString &strFile) const +bool CSkinInfo::HasSkinFile(const std::string &strFile) const { return CFile::Exists(GetSkinPath(strFile)); } void CSkinInfo::LoadIncludes() { - CStdString includesPath = CSpecialProtocol::TranslatePathConvertCase(GetSkinPath("includes.xml")); + std::string includesPath = CSpecialProtocol::TranslatePathConvertCase(GetSkinPath("includes.xml")); CLog::Log(LOGINFO, "Loading skin includes from %s", includesPath.c_str()); m_includes.ClearIncludes(); m_includes.LoadIncludes(includesPath); @@ -226,7 +226,7 @@ bool CSkinInfo::LoadStartupWindows(const cp_extension_t *ext) return true; } -void CSkinInfo::GetSkinPaths(std::vector<CStdString> &paths) const +void CSkinInfo::GetSkinPaths(std::vector<std::string> &paths) const { RESOLUTION_INFO res; GetSkinPath("Home.xml", &res); @@ -236,19 +236,20 @@ void CSkinInfo::GetSkinPaths(std::vector<CStdString> &paths) const paths.push_back(URIUtils::AddFileToFolder(Path(), m_defaultRes.strMode)); } -bool CSkinInfo::TranslateResolution(const CStdString &name, RESOLUTION_INFO &res) +bool CSkinInfo::TranslateResolution(const std::string &name, RESOLUTION_INFO &res) { - if (name.Equals("pal")) + std::string lower(name); StringUtils::ToLower(lower); + if (lower == "pal") res = RESOLUTION_INFO(720, 576, 4.0f/3, "pal"); - else if (name.Equals("pal16x9")) + else if (lower == "pal16x9") res = RESOLUTION_INFO(720, 576, 16.0f/9, "pal16x9"); - else if (name.Equals("ntsc")) + else if (lower == "ntsc") res = RESOLUTION_INFO(720, 480, 4.0f/3, "ntsc"); - else if (name.Equals("ntsc16x9")) + else if (lower == "ntsc16x9") res = RESOLUTION_INFO(720, 480, 16.0f/9, "ntsc16x9"); - else if (name.Equals("720p")) + else if (lower == "720p") res = RESOLUTION_INFO(1280, 720, 0, "720p"); - else if (name.Equals("1080i")) + else if (lower == "1080i") res = RESOLUTION_INFO(1920, 1080, 0, "1080i"); else return false; @@ -269,14 +270,14 @@ bool CSkinInfo::IsInUse() const return CSettings::Get().GetString("lookandfeel.skin") == ID(); } -const INFO::CSkinVariableString* CSkinInfo::CreateSkinVariable(const CStdString& name, int context) +const INFO::CSkinVariableString* CSkinInfo::CreateSkinVariable(const std::string& name, int context) { return m_includes.CreateSkinVariable(name, context); } void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data) { - CStdString settingValue = ((const CSettingString*)setting)->GetValue(); + std::string settingValue = ((const CSettingString*)setting)->GetValue(); // Remove the .xml extension from the Themes if (URIUtils::HasExtension(settingValue, ".xml")) URIUtils::RemoveExtension(settingValue); @@ -366,7 +367,7 @@ void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vect void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data) { - CStdString settingValue = ((const CSettingString*)setting)->GetValue(); + std::string settingValue = ((const CSettingString*)setting)->GetValue(); current = "SKINDEFAULT"; //find skins... @@ -407,7 +408,7 @@ void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vect void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data) { // get the choosen theme and remove the extension from the current theme (backward compat) - CStdString settingValue = ((const CSettingString*)setting)->GetValue(); + std::string settingValue = ((const CSettingString*)setting)->GetValue(); URIUtils::RemoveExtension(settingValue); current = "SKINDEFAULT"; diff --git a/xbmc/addons/Skin.h b/xbmc/addons/Skin.h index 07ab01c64a..fa4b0e8fb4 100644 --- a/xbmc/addons/Skin.h +++ b/xbmc/addons/Skin.h @@ -39,12 +39,12 @@ public: class CStartupWindow { public: - CStartupWindow(int id, const CStdString &name) + CStartupWindow(int id, const std::string &name) { m_id = id; m_name = name; }; int m_id; - CStdString m_name; + std::string m_name; }; //FIXME remove this, kept for current repo handling @@ -57,7 +57,7 @@ public: */ void Start(); - bool HasSkinFile(const CStdString &strFile) const; + bool HasSkinFile(const std::string &strFile) const; /*! \brief Get the full path to the specified file in the skin We search for XML files in the skin folder that best matches the current resolution. @@ -66,7 +66,7 @@ public: \param baseDir [in] If non-empty, the given directory is searched instead of the skin's directory. Defaults to empty. \return path to the XML file */ - CStdString GetSkinPath(const CStdString& file, RESOLUTION_INFO *res = NULL, const CStdString& baseDir = "") const; + std::string GetSkinPath(const std::string& file, RESOLUTION_INFO *res = NULL, const std::string& baseDir = "") const; AddonVersion APIVersion() const { return m_version; }; @@ -93,7 +93,7 @@ public: \param res [out] the resolution structure if name is valid \return true if the resolution is valid, false otherwise */ - static bool TranslateResolution(const CStdString &name, RESOLUTION_INFO &res); + static bool TranslateResolution(const std::string &name, RESOLUTION_INFO &res); void ResolveIncludes(TiXmlElement *node, std::map<INFO::InfoPtr, bool>* xmlIncludeConditions = NULL); @@ -104,14 +104,14 @@ public: /*! \brief Retrieve the skin paths to search for skin XML files \param paths [out] vector of paths to search, in order. */ - void GetSkinPaths(std::vector<CStdString> &paths) const; + void GetSkinPaths(std::vector<std::string> &paths) const; bool IsInUse() const; - const CStdString& GetCurrentAspect() const { return m_currentAspect; } + const std::string& GetCurrentAspect() const { return m_currentAspect; } void LoadIncludes(); - const INFO::CSkinVariableString* CreateSkinVariable(const CStdString& name, int context); + const INFO::CSkinVariableString* CreateSkinVariable(const std::string& name, int context); static void SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data); static void SettingOptionsSkinFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data); @@ -124,7 +124,7 @@ protected: \param res RESOLUTION to translate \return directory name for res */ - CStdString GetDirFromRes(RESOLUTION res) const; + std::string GetDirFromRes(RESOLUTION res) const; /*! \brief grab a resolution tag from a skin's configuration data \param props passed addoninfo structure to check for resolution @@ -143,7 +143,7 @@ protected: float m_effectsSlowDown; CGUIIncludes m_includes; - CStdString m_currentAspect; + std::string m_currentAspect; std::vector<CStartupWindow> m_startupWindows; bool m_debugging; diff --git a/xbmc/addons/Visualisation.cpp b/xbmc/addons/Visualisation.cpp index fd2670de2d..9412963a78 100644 --- a/xbmc/addons/Visualisation.cpp +++ b/xbmc/addons/Visualisation.cpp @@ -88,11 +88,11 @@ bool CVisualisation::Create(int x, int y, int w, int h, void *device) if (CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>::Create() == ADDON_STATUS_OK) { // Start the visualisation - CStdString strFile = URIUtils::GetFileName(g_application.CurrentFile()); + std::string strFile = URIUtils::GetFileName(g_application.CurrentFile()); CLog::Log(LOGDEBUG, "Visualisation::Start()\n"); try { - m_pStruct->Start(m_iChannels, m_iSamplesPerSec, m_iBitsPerSample, strFile); + m_pStruct->Start(m_iChannels, m_iSamplesPerSec, m_iBitsPerSample, strFile.c_str()); } catch (std::exception e) { @@ -117,7 +117,7 @@ bool CVisualisation::Create(int x, int y, int w, int h, void *device) return false; } -void CVisualisation::Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const CStdString &strSongName) +void CVisualisation::Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const std::string &strSongName) { // notify visz. that new song has been started // pass it the nr of audio channels, sample rate, bits/sample and offcourse the songname @@ -214,9 +214,9 @@ bool CVisualisation::OnAction(VIS_ACTION action, void *param) if ( action == VIS_ACTION_UPDATE_TRACK && param ) { const CMusicInfoTag* tag = (const CMusicInfoTag*)param; - CStdString artist(StringUtils::Join(tag->GetArtist(), g_advancedSettings.m_musicItemSeparator)); - CStdString albumArtist(StringUtils::Join(tag->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator)); - CStdString genre(StringUtils::Join(tag->GetGenre(), g_advancedSettings.m_musicItemSeparator)); + std::string artist(StringUtils::Join(tag->GetArtist(), g_advancedSettings.m_musicItemSeparator)); + std::string albumArtist(StringUtils::Join(tag->GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator)); + std::string genre(StringUtils::Join(tag->GetGenre(), g_advancedSettings.m_musicItemSeparator)); VisTrack track; track.title = tag->GetTitle().c_str(); @@ -362,7 +362,7 @@ bool CVisualisation::UpdateTrack() return handled; } -bool CVisualisation::GetPresetList(std::vector<CStdString> &vecpresets) +bool CVisualisation::GetPresetList(std::vector<std::string> &vecpresets) { vecpresets = m_presets; return !m_presets.empty(); @@ -395,7 +395,7 @@ bool CVisualisation::GetPresets() return (!m_presets.empty()); } -bool CVisualisation::GetSubModuleList(std::vector<CStdString> &vecmodules) +bool CVisualisation::GetSubModuleList(std::vector<std::string> &vecmodules) { vecmodules = m_submodules; return !m_submodules.empty(); @@ -428,11 +428,11 @@ bool CVisualisation::GetSubModules() return (!m_submodules.empty()); } -CStdString CVisualisation::GetFriendlyName(const CStdString& strVisz, - const CStdString& strSubModule) +std::string CVisualisation::GetFriendlyName(const std::string& strVisz, + const std::string& strSubModule) { // should be of the format "moduleName (visName)" - return CStdString(strSubModule + " (" + strVisz + ")"); + return strSubModule + " (" + strVisz + ")"; } bool CVisualisation::IsLocked() @@ -478,7 +478,7 @@ unsigned CVisualisation::GetPreset() return index; } -CStdString CVisualisation::GetPresetName() +std::string CVisualisation::GetPresetName() { if (!m_presets.empty()) return m_presets[GetPreset()]; diff --git a/xbmc/addons/Visualisation.h b/xbmc/addons/Visualisation.h index ddc39edb73..0a2a1cb6b1 100644 --- a/xbmc/addons/Visualisation.h +++ b/xbmc/addons/Visualisation.h @@ -60,7 +60,7 @@ namespace ADDON virtual void OnInitialize(int iChannels, int iSamplesPerSec, int iBitsPerSample); virtual void OnAudioData(const float* pAudioData, int iAudioDataLength); bool Create(int x, int y, int w, int h, void *device); - void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const CStdString &strSongName); + void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const std::string &strSongName); void AudioData(const float *pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength); void Render(); void Stop(); @@ -70,10 +70,10 @@ namespace ADDON bool HasSubModules() { return !m_submodules.empty(); } bool IsLocked(); unsigned GetPreset(); - CStdString GetPresetName(); - bool GetPresetList(std::vector<CStdString>& vecpresets); - bool GetSubModuleList(std::vector<CStdString>& vecmodules); - static CStdString GetFriendlyName(const CStdString& vis, const CStdString& module); + std::string GetPresetName(); + bool GetPresetList(std::vector<std::string>& vecpresets); + bool GetSubModuleList(std::vector<std::string>& vecmodules); + static std::string GetFriendlyName(const std::string& vis, const std::string& module); void Destroy(); private: @@ -90,9 +90,9 @@ namespace ADDON int m_height; // cached preset list - std::vector<CStdString> m_presets; + std::vector<std::string> m_presets; // cached submodule list - std::vector<CStdString> m_submodules; + std::vector<std::string> m_submodules; int m_currentModule; // audio properties @@ -106,6 +106,6 @@ namespace ADDON bool m_bCalculate_Freq; // True if the vis wants freq data // track information - CStdString m_AlbumThumb; + std::string m_AlbumThumb; }; } diff --git a/xbmc/cdrip/CDDARipJob.cpp b/xbmc/cdrip/CDDARipJob.cpp index 045a73b314..bbacedbe4b 100644 --- a/xbmc/cdrip/CDDARipJob.cpp +++ b/xbmc/cdrip/CDDARipJob.cpp @@ -40,8 +40,8 @@ using namespace ADDON; using namespace MUSIC_INFO; using namespace XFILE; -CCDDARipJob::CCDDARipJob(const CStdString& input, - const CStdString& output, +CCDDARipJob::CCDDARipJob(const std::string& input, + const std::string& output, const CMusicInfoTag& tag, int encoder, bool eject, @@ -88,7 +88,7 @@ bool CCDDARipJob::DoWork() CGUIDialogProgressBarHandle* handle = pDlgProgress->GetHandle(g_localizeStrings.Get(605)); int iTrack = atoi(m_input.substr(13, m_input.size() - 13 - 5).c_str()); - CStdString strLine0 = StringUtils::Format("%02i. %s - %s", iTrack, + std::string 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); @@ -201,7 +201,7 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader) return NULL; // we have to set the tags before we init the Encoder - CStdString strTrack = StringUtils::Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10)); + std::string 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(), @@ -223,7 +223,7 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader) return encoder; } -CStdString CCDDARipJob::SetupTempFile() +std::string CCDDARipJob::SetupTempFile() { char tmp[MAX_PATH]; #ifndef TARGET_POSIX diff --git a/xbmc/cdrip/CDDARipJob.h b/xbmc/cdrip/CDDARipJob.h index ee961c1149..350d1fffca 100644 --- a/xbmc/cdrip/CDDARipJob.h +++ b/xbmc/cdrip/CDDARipJob.h @@ -20,7 +20,6 @@ */ #include "utils/Job.h" -#include "utils/StdString.h" #include "music/tags/MusicInfoTag.h" class CEncoder; @@ -42,7 +41,7 @@ public: //! \param rate The sample rate of the input //! \param channels Number of audio channels in input //! \param bps The bits per sample for input - CCDDARipJob(const CStdString& input, const CStdString& output, + CCDDARipJob(const std::string& input, const std::string& output, const MUSIC_INFO::CMusicInfoTag& tag, int encoder, bool eject=false, unsigned int rate=44100, unsigned int channels=2, unsigned int bps=16); @@ -52,13 +51,13 @@ public: virtual const char* GetType() const { return "cdrip"; }; virtual bool operator==(const CJob *job) const; virtual bool DoWork(); - CStdString GetOutput() const { return m_output; } + std::string GetOutput() const { return m_output; } protected: //! \brief Setup the audio encoder CEncoder* SetupEncoder(XFILE::CFile& reader); //! \brief Helper used if output is a remote url - CStdString SetupTempFile(); + std::string SetupTempFile(); //! \brief Rip a chunk of audio //! \param reader The input reader @@ -74,8 +73,8 @@ protected: unsigned int m_channels; //< The number of channels in input file unsigned int m_bps; //< The bits per sample of input MUSIC_INFO::CMusicInfoTag m_tag; //< Music tag to attach to output file - CStdString m_input; //< The input url - CStdString m_output; //< The output url + std::string m_input; //< The input url + std::string m_output; //< The output url bool m_eject; //< Should we eject tray when we are finished? int m_encoder; //< The audio encoder }; diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp index b837cfee89..73a8cac4e8 100644 --- a/xbmc/cdrip/CDDARipper.cpp +++ b/xbmc/cdrip/CDDARipper.cpp @@ -81,12 +81,12 @@ bool CCDDARipper::RipTrack(CFileItem* pItem) } // construct directory where the track is stored - CStdString strDirectory; + std::string strDirectory; int legalType; if (!CreateAlbumDir(*pItem->GetMusicInfoTag(), strDirectory, legalType)) return false; - CStdString strFile = URIUtils::AddFileToFolder(strDirectory, + std::string strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(pItem), legalType)); AddJob(new CCDDARipJob(pItem->GetPath(),strFile, @@ -126,7 +126,7 @@ bool CCDDARipper::RipCD() } // construct directory where the tracks are stored - CStdString strDirectory; + std::string strDirectory; int legalType; if (!CreateAlbumDir(*vecItems[0]->GetMusicInfoTag(), strDirectory, legalType)) return false; @@ -137,7 +137,7 @@ bool CCDDARipper::RipCD() CFileItemPtr item = vecItems[i]; // construct filename - CStdString strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(item.get()), legalType)); + std::string strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(item.get()), legalType)); // don't rip non cdda items if (item->GetPath().find(".cdda") == std::string::npos) @@ -153,7 +153,7 @@ bool CCDDARipper::RipCD() return true; } -bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType) +bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, std::string& strDirectory, int& legalType) { CSettingPath *recordingpathSetting = (CSettingPath*)CSettings::Get().GetSetting("audiocds.recordingpath"); if (recordingpathSetting != NULL) @@ -186,7 +186,7 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdS legalType = LEGAL_WIN32_COMPAT; #endif - CStdString strAlbumDir = GetAlbumDirName(infoTag); + std::string strAlbumDir = GetAlbumDirName(infoTag); if (!strAlbumDir.empty()) { @@ -206,9 +206,9 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdS return true; } -CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag) +std::string CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag) { - CStdString strAlbumDir; + std::string strAlbumDir; // use audiocds.trackpathformat setting to format // directory name where CD tracks will be stored, @@ -223,7 +223,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag // replace %A with album artist name if (strAlbumDir.find("%A") != std::string::npos) { - CStdString strAlbumArtist = StringUtils::Join(infoTag.GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator); + std::string strAlbumArtist = StringUtils::Join(infoTag.GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator); if (strAlbumArtist.empty()) strAlbumArtist = StringUtils::Join(infoTag.GetArtist(), g_advancedSettings.m_musicItemSeparator); if (strAlbumArtist.empty()) @@ -236,7 +236,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag // replace %B with album title if (strAlbumDir.find("%B") != std::string::npos) { - CStdString strAlbum = infoTag.GetAlbum(); + std::string strAlbum = infoTag.GetAlbum(); if (strAlbum.empty()) strAlbum = StringUtils::Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str()); else @@ -247,7 +247,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag // replace %G with genre if (strAlbumDir.find("%G") != std::string::npos) { - CStdString strGenre = StringUtils::Join(infoTag.GetGenre(), g_advancedSettings.m_musicItemSeparator); + std::string strGenre = StringUtils::Join(infoTag.GetGenre(), g_advancedSettings.m_musicItemSeparator); if (strGenre.empty()) strGenre = "Unknown Genre"; else @@ -258,7 +258,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag // replace %Y with year if (strAlbumDir.find("%Y") != std::string::npos) { - CStdString strYear = infoTag.GetYearString(); + std::string strYear = infoTag.GetYearString(); if (strYear.empty()) strYear = "Unknown Year"; else @@ -269,7 +269,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag return strAlbumDir; } -CStdString CCDDARipper::GetTrackName(CFileItem *item) +std::string CCDDARipper::GetTrackName(CFileItem *item) { // get track number from "cdda://local/01.cdda" int trackNumber = atoi(item->GetPath().substr(13, item->GetPath().size() - 13 - 5).c_str()); @@ -280,7 +280,7 @@ CStdString CCDDARipper::GetTrackName(CFileItem *item) // get track file name format from audiocds.trackpathformat setting, // use only format part starting from the last '/' - CStdString strFormat = CSettings::Get().GetString("audiocds.trackpathformat"); + std::string strFormat = CSettings::Get().GetString("audiocds.trackpathformat"); size_t pos = strFormat.find_last_of("/\\"); if (pos != std::string::npos) strFormat.erase(0, pos+1); @@ -289,7 +289,7 @@ CStdString CCDDARipper::GetTrackName(CFileItem *item) formatter.FormatLabel(&destItem); // grab the label to use it as our ripped filename - CStdString track = destItem.GetLabel(); + std::string track = destItem.GetLabel(); if (track.empty()) track = StringUtils::Format("%s%02i", "Track-", trackNumber); @@ -310,7 +310,7 @@ void CCDDARipper::OnJobComplete(unsigned int jobID, bool success, CJob* job) { if(CJobQueue::QueueEmpty()) { - CStdString dir = URIUtils::GetDirectory(((CCDDARipJob*)job)->GetOutput()); + std::string dir = URIUtils::GetDirectory(((CCDDARipJob*)job)->GetOutput()); bool unimportant; int source = CUtil::GetMatchingSource(dir, *CMediaSourceSettings::Get().CMediaSourceSettings::GetSources("music"), unimportant); diff --git a/xbmc/cdrip/CDDARipper.h b/xbmc/cdrip/CDDARipper.h index 488ef7ef2f..51cbab420a 100644 --- a/xbmc/cdrip/CDDARipper.h +++ b/xbmc/cdrip/CDDARipper.h @@ -82,19 +82,19 @@ private: \param[out] legalType created directory type (see LEGAL_... constants) \return true if success, false if failure */ - bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType); + bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, std::string& strDirectory, int& legalType); /*! \brief Return formatted album subfolder for rip path \param infoTag music info tags for the CD, used to format album name \return album subfolder path name */ - CStdString GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag); + std::string GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag); /*! \brief Return file name for the track \param item CFileItem representing a track \return track file name */ - CStdString GetTrackName(CFileItem *item); + std::string GetTrackName(CFileItem *item); }; #endif // _CCDDARIPPERMP3_H diff --git a/xbmc/cdrip/Encoder.h b/xbmc/cdrip/Encoder.h index 38d80654df..744f80785f 100644 --- a/xbmc/cdrip/Encoder.h +++ b/xbmc/cdrip/Encoder.h @@ -21,9 +21,11 @@ * */ -#include <string> #include <boost/shared_ptr.hpp> #include "IEncoder.h" +#include <string> +#include <stdint.h> +#include <stdio.h> #define WRITEBUFFER_SIZE 131072 // 128k buffer diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp index f827f8a3a0..3392f591c8 100644 --- a/xbmc/cdrip/EncoderFFmpeg.cpp +++ b/xbmc/cdrip/EncoderFFmpeg.cpp @@ -67,7 +67,7 @@ bool CEncoderFFmpeg::Init(audioenc_callbacks &callbacks) m_callbacks = callbacks; - CStdString filename = URIUtils::GetFileName(m_strFile); + std::string filename = URIUtils::GetFileName(m_strFile); if(avformat_alloc_output_context2(&m_Format,NULL,NULL,filename.c_str())) { CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Unable to guess the output format for the file %s", filename.c_str()); diff --git a/xbmc/commons/Exception.h b/xbmc/commons/Exception.h index 0d4f5140bd..a6be3037ce 100644 --- a/xbmc/commons/Exception.h +++ b/xbmc/commons/Exception.h @@ -25,7 +25,6 @@ // it wont cause a linker circular dependency since it's just // a header. #include "utils/StringUtils.h" -#include "utils/StdString.h" //--------------------------------------------------------- #include "ilog.h" @@ -58,7 +57,7 @@ namespace XbmcCommons private: std::string classname; - CStdString message; + std::string message; protected: static ILogger* logger; diff --git a/xbmc/commons/ilog.cpp b/xbmc/commons/ilog.cpp index 194faa8952..36ec535f87 100644 --- a/xbmc/commons/ilog.cpp +++ b/xbmc/commons/ilog.cpp @@ -19,14 +19,13 @@ */ #include "commons/ilog.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" namespace XbmcCommons { void ILogger::Log(int loglevel, const char *format, ... ) { - CStdString strData; + std::string strData; strData.reserve(16384); va_list va; @@ -34,6 +33,6 @@ namespace XbmcCommons strData = StringUtils::FormatV(format,va); va_end(va); - log(loglevel, strData); + log(loglevel, strData.c_str()); } } diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h index 9324e1ecab..01aafe36c4 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "cores/AudioEngine/Interfaces/AESound.h" #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEResample.h" #include "filesystem/File.h" diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h index ee50e2f825..353fcaa543 100644 --- a/xbmc/cores/AudioEngine/Interfaces/AE.h +++ b/xbmc/cores/AudioEngine/Interfaces/AE.h @@ -21,6 +21,7 @@ #include <list> #include <map> +#include <vector> #include "system.h" #include "threads/CriticalSection.h" diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp index 9013c21b7f..8dee4bc076 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp @@ -30,7 +30,6 @@ #include "AESinkALSA.h" #include "cores/AudioEngine/Utils/AEUtil.h" #include "cores/AudioEngine/Utils/AEELDParser.h" -#include "utils/StdString.h" #include "utils/log.h" #include "utils/MathUtils.h" #include "utils/SystemInfo.h" diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp index aff9c067ef..a23f8270ca 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp @@ -90,7 +90,7 @@ static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_cou }; // implemented in AESinkWASAPI.cpp -extern CStdStringA localWideToUtf(LPCWSTR wstr); +extern std::string localWideToUtf(LPCWSTR wstr); static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext) { @@ -98,12 +98,14 @@ static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LP std::list<DSDevice> &enumerator = *static_cast<std::list<DSDevice>*>(lpContext); int bufSize = MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, NULL, 0); - CStdStringW strW (L"", bufSize); - if ( bufSize == 0 || MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, strW.GetBuf(bufSize), bufSize) != bufSize ) - strW.clear(); - strW.RelBuf(); + wchar_t *strW = new wchar_t[bufSize+1]; + if ( bufSize == 0 || MultiByteToWideChar(CP_ACP, 0, lpcstrDescription, -1, strW, bufSize) != bufSize ) + strW[0] = 0; + else + strW[bufSize] = 0; dev.name = localWideToUtf(strW); + delete[] strW; dev.lpGuid = lpGuid; diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp index f55872a9c4..2b6e646928 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkOSS.cpp @@ -23,7 +23,6 @@ #include <limits.h> #include "cores/AudioEngine/Utils/AEUtil.h" -#include "utils/StdString.h" #include "utils/log.h" #include "threads/SingleLock.h" #include <sstream> diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp index be58cac4f9..2b70b8ecc6 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkProfiler.cpp @@ -25,7 +25,6 @@ #include "cores/AudioEngine/Sinks/AESinkProfiler.h" #include "cores/AudioEngine/Utils/AEUtil.h" -#include "utils/StdString.h" #include "utils/log.h" #include "utils/TimeUtils.h" diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp index dfd77149ad..3dd1029f58 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp @@ -26,7 +26,6 @@ #include "cores/AudioEngine/Utils/AEUtil.h" #include "settings/AdvancedSettings.h" -#include "utils/StdString.h" #include "utils/log.h" #include "utils/TimeUtils.h" #include "threads/SingleLock.h" @@ -165,15 +164,15 @@ DWORD ChLayoutToChMask(const enum AEChannel * layout, unsigned int * numberOfCha return mask; } -CStdStringA localWideToUtf(LPCWSTR wstr) +std::string localWideToUtf(LPCWSTR wstr) { if (wstr == NULL) return ""; int bufSize = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL); - CStdStringA strA ("", bufSize); - if ( bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, strA.GetBuf(bufSize), bufSize, NULL, NULL) != bufSize ) + std::string strA ("", bufSize); + strA.resize(bufSize); + if ( bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &strA[0], bufSize, NULL, NULL) != bufSize ) strA.clear(); - strA.RelBuf(); return strA; } diff --git a/xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp b/xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp index cfa4cbd8f4..1599e683b0 100644 --- a/xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp +++ b/xbmc/cores/AudioEngine/Sinks/osx/CoreAudioStream.cpp @@ -22,7 +22,6 @@ #include "CoreAudioHelpers.h" #include "utils/log.h" -#include "utils/StdString.h" CCoreAudioStream::CCoreAudioStream() : m_StreamId (0 ) @@ -427,7 +426,7 @@ OSStatus CCoreAudioStream::HardwareStreamListener(AudioObjectID inObjectID, // hardware physical format has changed. if (AudioObjectGetPropertyData(ca_stream->m_StreamId, &inAddresses[i], 0, NULL, &propertySize, &actualFormat) == noErr) { - CStdString formatString; + std::string formatString; CLog::Log(LOGINFO, "CCoreAudioStream::HardwareStreamListener: " "Hardware physical format changed to %s", StreamDescriptionToString(actualFormat, formatString)); ca_stream->m_physical_format_event.Set(); @@ -440,7 +439,7 @@ OSStatus CCoreAudioStream::HardwareStreamListener(AudioObjectID inObjectID, UInt32 propertySize = sizeof(AudioStreamBasicDescription); if (AudioObjectGetPropertyData(ca_stream->m_StreamId, &inAddresses[i], 0, NULL, &propertySize, &actualFormat) == noErr) { - CStdString formatString; + std::string formatString; CLog::Log(LOGINFO, "CCoreAudioStream::HardwareStreamListener: " "Hardware virtual format changed to %s", StreamDescriptionToString(actualFormat, formatString)); ca_stream->m_virtual_format_event.Set(); diff --git a/xbmc/cores/AudioEngine/Utils/AEBuffer.cpp b/xbmc/cores/AudioEngine/Utils/AEBuffer.cpp index 1ebe5ec918..6eb4770b01 100644 --- a/xbmc/cores/AudioEngine/Utils/AEBuffer.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEBuffer.cpp @@ -19,7 +19,6 @@ */ #include "AEBuffer.h" -#include "utils/StdString.h" /* needed for ASSERT */ #include <algorithm> CAEBuffer::CAEBuffer() : diff --git a/xbmc/cores/AudioEngine/Utils/AEBuffer.h b/xbmc/cores/AudioEngine/Utils/AEBuffer.h index ab54cb460d..cb067c7de6 100644 --- a/xbmc/cores/AudioEngine/Utils/AEBuffer.h +++ b/xbmc/cores/AudioEngine/Utils/AEBuffer.h @@ -20,10 +20,7 @@ */ #include "system.h" - -#ifdef _DEBUG -#include "utils/StdString.h" /* needed for ASSERT */ -#endif +#include <assert.h> /** * This class wraps a block of 16 byte aligned memory for simple buffer @@ -56,8 +53,8 @@ public: inline void Write(const void *src, const size_t size) { #ifdef _DEBUG - ASSERT(src); - ASSERT(size <= m_bufferSize); + assert(src); + assert(size <= m_bufferSize); #endif memcpy(m_buffer, src, size); m_bufferPos = 0; @@ -66,8 +63,8 @@ public: inline void Push(const void *src, const size_t size) { #ifdef _DEBUG - ASSERT(src); - ASSERT(size <= m_bufferSize - m_bufferPos); + assert(src); + assert(size <= m_bufferSize - m_bufferPos); #endif memcpy(m_buffer + m_bufferPos, src, size); m_bufferPos += size; @@ -76,8 +73,8 @@ public: inline void UnShift(const void *src, const size_t size) { #ifdef _DEBUG - ASSERT(src); - ASSERT(size < m_bufferSize - m_bufferPos); + assert(src); + assert(size < m_bufferSize - m_bufferPos); #endif memmove(m_buffer + size, m_buffer, m_bufferSize - size); memcpy (m_buffer, src, size); @@ -87,7 +84,7 @@ public: inline void* Take(const size_t size) { #ifdef _DEBUG - ASSERT(size <= m_bufferSize - m_bufferPos); + assert(size <= m_bufferSize - m_bufferPos); #endif void* ret = m_buffer + m_bufferPos; @@ -99,7 +96,7 @@ public: inline void* Raw(const size_t size) { #ifdef _DEBUG - ASSERT(size <= m_bufferSize); + assert(size <= m_bufferSize); #endif return m_buffer; } @@ -108,8 +105,8 @@ public: inline void Read(void *dst, const size_t size) { #ifdef _DEBUG - ASSERT(size <= m_bufferSize); - ASSERT(dst); + assert(size <= m_bufferSize); + assert(dst); #endif memcpy(dst, m_buffer, size); } @@ -117,7 +114,7 @@ public: inline void Pop(void *dst, const size_t size) { #ifdef _DEBUG - ASSERT(size <= m_bufferPos); + assert(size <= m_bufferPos); #endif m_bufferPos -= size; if (dst) @@ -127,7 +124,7 @@ public: inline void Shift(void *dst, const size_t size) { #ifdef _DEBUG - ASSERT(size <= m_bufferPos); + assert(size <= m_bufferPos); #endif if (dst) memcpy(dst, m_buffer, size); @@ -158,7 +155,7 @@ public: inline void CursorSeek (const size_t pos ) { #ifdef _DEBUG - ASSERT(pos <= m_bufferSize); + assert(pos <= m_bufferSize); #endif m_cursorPos = pos; } @@ -166,7 +163,7 @@ public: inline void* CursorRead(const size_t size) { #ifdef _DEBUG - ASSERT(m_cursorPos + size <= m_bufferPos); + assert(m_cursorPos + size <= m_bufferPos); #endif uint8_t* out = m_buffer + m_cursorPos; m_cursorPos += size; diff --git a/xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp b/xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp index 37988e1805..f2657ad37f 100644 --- a/xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp @@ -21,6 +21,7 @@ #include "AEChannelInfo.h" #include <limits> #include <string.h> +#include <assert.h> CAEChannelInfo::CAEChannelInfo() { @@ -162,14 +163,14 @@ CAEChannelInfo& CAEChannelInfo::operator=(const enum AEChannel* rhs) } /* the last entry should be NULL, if not we were passed a non null terminated list */ - ASSERT(rhs[m_channelCount] == AE_CH_NULL); + assert(rhs[m_channelCount] == AE_CH_NULL); return *this; } CAEChannelInfo& CAEChannelInfo::operator=(const enum AEStdChLayout rhs) { - ASSERT(rhs > AE_CH_LAYOUT_INVALID && rhs < AE_CH_LAYOUT_MAX); + assert(rhs > AE_CH_LAYOUT_INVALID && rhs < AE_CH_LAYOUT_MAX); static enum AEChannel layouts[AE_CH_LAYOUT_MAX][9] = { {AE_CH_FC, AE_CH_NULL}, @@ -210,8 +211,8 @@ bool CAEChannelInfo::operator!=(const CAEChannelInfo& rhs) CAEChannelInfo& CAEChannelInfo::operator+=(const enum AEChannel& rhs) { - ASSERT(m_channelCount < AE_CH_MAX); - ASSERT(rhs > AE_CH_NULL && rhs < AE_CH_MAX); + assert(m_channelCount < AE_CH_MAX); + assert(rhs > AE_CH_NULL && rhs < AE_CH_MAX); m_channels[m_channelCount++] = rhs; return *this; @@ -219,7 +220,7 @@ CAEChannelInfo& CAEChannelInfo::operator+=(const enum AEChannel& rhs) CAEChannelInfo& CAEChannelInfo::operator-=(const enum AEChannel& rhs) { - ASSERT(rhs > AE_CH_NULL && rhs < AE_CH_MAX); + assert(rhs > AE_CH_NULL && rhs < AE_CH_MAX); unsigned int i = 0; while(i < m_channelCount && m_channels[i] != rhs) @@ -237,7 +238,7 @@ CAEChannelInfo& CAEChannelInfo::operator-=(const enum AEChannel& rhs) const enum AEChannel CAEChannelInfo::operator[](unsigned int i) const { - ASSERT(i < m_channelCount); + assert(i < m_channelCount); return m_channels[i]; } @@ -259,7 +260,7 @@ CAEChannelInfo::operator std::string() const const char* CAEChannelInfo::GetChName(const enum AEChannel ch) { - ASSERT(ch >= 0 && ch < AE_CH_MAX); + assert(ch >= 0 && ch < AE_CH_MAX); static const char* channels[AE_CH_MAX] = { @@ -363,4 +364,4 @@ void CAEChannelInfo::AddMissingChannels(const CAEChannelInfo& rhs) for (unsigned int i = 0; i < rhs.Count(); i++) if (!HasChannel(rhs[i])) *this += rhs[i]; -}
\ No newline at end of file +} diff --git a/xbmc/cores/AudioEngine/Utils/AEChannelInfo.h b/xbmc/cores/AudioEngine/Utils/AEChannelInfo.h index 2a6e5dbff6..d0dd1968b8 100644 --- a/xbmc/cores/AudioEngine/Utils/AEChannelInfo.h +++ b/xbmc/cores/AudioEngine/Utils/AEChannelInfo.h @@ -21,7 +21,7 @@ #include <stdint.h> #include <vector> -#include "utils/StdString.h" +#include <string> /** * The possible channels diff --git a/xbmc/cores/AudioEngine/Utils/AEELDParser.cpp b/xbmc/cores/AudioEngine/Utils/AEELDParser.cpp index ff9f2c78d5..af4715c330 100644 --- a/xbmc/cores/AudioEngine/Utils/AEELDParser.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEELDParser.cpp @@ -22,6 +22,7 @@ #include "AEDeviceInfo.h" #include "utils/EndianSwap.h" #include <string.h> +#include <algorithm> #include <stdio.h> diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp index c9d5af4442..12c5fa7a5d 100644 --- a/xbmc/cores/AudioEngine/Utils/AEUtil.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEUtil.cpp @@ -21,7 +21,6 @@ #define __STDC_LIMIT_MACROS #endif -#include "utils/StdString.h" #include "AEUtil.h" #include "utils/log.h" #include "utils/TimeUtils.h" @@ -500,7 +499,7 @@ void CAEUtil::FloatRand4(const float min, const float max, float result[4], __m1 const float factor = delta / (float)INT32_MAX; /* cant return sseresult if we are not using SSE intrinsics */ - ASSERT(result && !sseresult); + assert(result && !sseresult); result[0] = ((float)(m_seed = (214013 * m_seed + 2531011)) * factor) - delta; result[1] = ((float)(m_seed = (214013 * m_seed + 2531011)) * factor) - delta; diff --git a/xbmc/cores/AudioEngine/Utils/AEUtil.h b/xbmc/cores/AudioEngine/Utils/AEUtil.h index f46731419b..1e61c50716 100644 --- a/xbmc/cores/AudioEngine/Utils/AEUtil.h +++ b/xbmc/cores/AudioEngine/Utils/AEUtil.h @@ -20,7 +20,6 @@ */ #include "AEAudioFormat.h" -#include "utils/StdString.h" #include "PlatformDefs.h" #include <math.h> diff --git a/xbmc/cores/DllLoader/DllLoader.cpp b/xbmc/cores/DllLoader/DllLoader.cpp index 377b04e70e..5d29034c2d 100644 --- a/xbmc/cores/DllLoader/DllLoader.cpp +++ b/xbmc/cores/DllLoader/DllLoader.cpp @@ -144,7 +144,7 @@ int DllLoader::Parse() { int iResult = 0; - CStdString strFileName= GetFileName(); + std::string strFileName= GetFileName(); FILE* fp = fopen_utf8(CSpecialProtocol::TranslatePath(strFileName).c_str(), "rb"); if (fp) @@ -817,7 +817,7 @@ void DllLoader::UnloadSymbols() try { - CStdStringW strNameW; + std::wstring strNameW; g_charsetConverter.utf8ToW(GetName(), strNameW); // Get the address of the global struct g_dmi @@ -830,8 +830,8 @@ void DllLoader::UnloadSymbols() // Search for the dll we are unloading... while (entry) { - CStdStringW baseName=(wchar_t*)((LDR_DATA_TABLE_ENTRY*)entry)->BaseDllName.Buffer; - if (baseName.Equals(strNameW)) + std::wstring baseName=(wchar_t*)((LDR_DATA_TABLE_ENTRY*)entry)->BaseDllName.Buffer; + if (baseName == strNameW) { // ...and remove it from the LoadedModuleList and free its memory. LIST_ENTRY* back=entry->Blink; diff --git a/xbmc/cores/DllLoader/DllLoaderContainer.cpp b/xbmc/cores/DllLoader/DllLoaderContainer.cpp index 7963c0643a..46315794f0 100644 --- a/xbmc/cores/DllLoader/DllLoaderContainer.cpp +++ b/xbmc/cores/DllLoader/DllLoaderContainer.cpp @@ -100,7 +100,7 @@ LibraryLoader* DllLoaderContainer::LoadModule(const char* sName, const char* sCu } else if (sCurrentDir) { - CStdString strPath=sCurrentDir; + std::string strPath=sCurrentDir; strPath+=sName; pDll = GetModule(strPath.c_str()); } @@ -132,10 +132,10 @@ LibraryLoader* DllLoaderContainer::FindModule(const char* sName, const char* sCu if (URIUtils::IsInArchive(sName)) { CURL url(sName); - CStdString newName = "special://temp/"; + std::string newName = "special://temp/"; newName += url.GetFileName(); CFile::Copy(sName, newName); - return FindModule(newName, sCurrentDir, bLoadSymbols); + return FindModule(newName.c_str(), sCurrentDir, bLoadSymbols); } if (CURL::IsFullPath(sName)) @@ -148,7 +148,7 @@ LibraryLoader* DllLoaderContainer::FindModule(const char* sName, const char* sCu #endif else if (sCurrentDir) { // in the path of the parent dll? - CStdString strPath=sCurrentDir; + std::string strPath=sCurrentDir; strPath+=sName; if (CFile::Exists(strPath)) @@ -159,9 +159,9 @@ LibraryLoader* DllLoaderContainer::FindModule(const char* sName, const char* sCu std::vector<std::string> vecEnv; #if defined(TARGET_ANDROID) - CStdString systemLibs = getenv("XBMC_ANDROID_SYSTEM_LIBS"); + std::string systemLibs = getenv("XBMC_ANDROID_SYSTEM_LIBS"); vecEnv = StringUtils::Split(systemLibs, ":"); - CStdString localLibs = getenv("XBMC_ANDROID_LIBS"); + std::string localLibs = getenv("XBMC_ANDROID_LIBS"); vecEnv.insert(vecEnv.begin(),localLibs); #else vecEnv = StringUtils::Split(ENV_PATH, ";"); @@ -170,7 +170,7 @@ LibraryLoader* DllLoaderContainer::FindModule(const char* sName, const char* sCu for (std::vector<std::string>::const_iterator i = vecEnv.begin(); i != vecEnv.end(); ++i) { - CStdString strPath = *i; + std::string strPath = *i; URIUtils::AddSlashAtEnd(strPath); #ifdef LOGALL diff --git a/xbmc/cores/DllLoader/SoLoader.cpp b/xbmc/cores/DllLoader/SoLoader.cpp index 5e0157749c..717ce66fc2 100644 --- a/xbmc/cores/DllLoader/SoLoader.cpp +++ b/xbmc/cores/DllLoader/SoLoader.cpp @@ -20,7 +20,6 @@ #include <dlfcn.h> #include "SoLoader.h" -#include "utils/StdString.h" #include "filesystem/SpecialProtocol.h" #include "utils/log.h" #if defined(TARGET_ANDROID) @@ -45,7 +44,7 @@ bool SoLoader::Load() if (m_soHandle != NULL) return true; - CStdString strFileName= CSpecialProtocol::TranslatePath(GetFileName()); + std::string strFileName= CSpecialProtocol::TranslatePath(GetFileName()); int flags = RTLD_LAZY; if (strFileName == "xbmc.so") { diff --git a/xbmc/cores/DllLoader/Win32DllLoader.cpp b/xbmc/cores/DllLoader/Win32DllLoader.cpp index e7772beb4a..4bc961d543 100644 --- a/xbmc/cores/DllLoader/Win32DllLoader.cpp +++ b/xbmc/cores/DllLoader/Win32DllLoader.cpp @@ -22,9 +22,9 @@ #include "Win32DllLoader.h" #include "DllLoader.h" #include "DllLoaderContainer.h" -#include "utils/StdString.h" #include "Util.h" #include "utils/log.h" +#include "utils/StringUtils.h" #include "filesystem/SpecialProtocol.h" #include "utils/CharsetConverter.h" @@ -135,7 +135,7 @@ Export win32_exports[] = { NULL, -1, NULL, NULL } }; -Win32DllLoader::Win32DllLoader(const char *dll) : LibraryLoader(dll) +Win32DllLoader::Win32DllLoader(const std::string& dll) : LibraryLoader(dll) { m_dllHandle = NULL; bIsSystemDll = false; @@ -154,9 +154,9 @@ bool Win32DllLoader::Load() if (m_dllHandle != NULL) return true; - CStdString strFileName = GetFileName(); + std::string strFileName = GetFileName(); - CStdStringW strDllW; + std::wstring strDllW; g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(strFileName), strDllW, false, false, false); m_dllHandle = LoadLibraryExW(strDllW.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!m_dllHandle) @@ -240,9 +240,9 @@ bool Win32DllLoader::HasSymbols() return false; } -void Win32DllLoader::OverrideImports(const CStdString &dll) +void Win32DllLoader::OverrideImports(const std::string &dll) { - CStdStringW strdllW; + std::wstring strdllW; g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(dll), strdllW, false); BYTE* image_base = (BYTE*)GetModuleHandleW(strdllW.c_str()); @@ -337,7 +337,7 @@ bool Win32DllLoader::NeedsHooking(const char *dllName) return false; } } - CStdStringW strdllNameW; + std::wstring strdllNameW; g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(dllName), strdllNameW, false); HMODULE hModule = GetModuleHandleW(strdllNameW.c_str()); if (hModule == NULL) @@ -345,16 +345,16 @@ bool Win32DllLoader::NeedsHooking(const char *dllName) wchar_t filepathW[MAX_PATH]; GetModuleFileNameW(hModule, filepathW, MAX_PATH); - CStdString dllPath; + std::string dllPath; g_charsetConverter.wToUTF8(filepathW, dllPath); // compare this filepath with some special directories - CStdString xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc"); - CStdString homePath = CSpecialProtocol::TranslatePath("special://home"); - CStdString tempPath = CSpecialProtocol::TranslatePath("special://temp"); - return ((strncmp(xbmcPath.c_str(), dllPath.c_str(), xbmcPath.size()) == 0) || - (strncmp(homePath.c_str(), dllPath.c_str(), homePath.size()) == 0) || - (strncmp(tempPath.c_str(), dllPath.c_str(), tempPath.size()) == 0)); + std::string xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc"); + std::string homePath = CSpecialProtocol::TranslatePath("special://home"); + std::string tempPath = CSpecialProtocol::TranslatePath("special://temp"); + return (StringUtils::StartsWith(dllPath, xbmcPath) || + StringUtils::StartsWith(dllPath, homePath) || + StringUtils::StartsWith(dllPath, tempPath)); } void Win32DllLoader::RestoreImports() diff --git a/xbmc/cores/DllLoader/Win32DllLoader.h b/xbmc/cores/DllLoader/Win32DllLoader.h index a211b884c8..0839555fcc 100644 --- a/xbmc/cores/DllLoader/Win32DllLoader.h +++ b/xbmc/cores/DllLoader/Win32DllLoader.h @@ -23,7 +23,6 @@ */ #include "LibraryLoader.h" -#include "utils/StdString.h" class Win32DllLoader : public LibraryLoader { @@ -35,7 +34,7 @@ public: DWORD function; }; - Win32DllLoader(const char *dll); + Win32DllLoader(const std::string& dll); ~Win32DllLoader(); virtual bool Load(); @@ -47,7 +46,7 @@ public: virtual bool HasSymbols(); private: - void OverrideImports(const CStdString &dll); + void OverrideImports(const std::string &dll); void RestoreImports(); static bool ResolveImport(const char *dllName, const char *functionName, void **fixup); static bool ResolveOrdinal(const char *dllName, unsigned long ordinal, void **fixup); diff --git a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp index bfaad29f09..bf4d64ee69 100644 --- a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp +++ b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp @@ -37,6 +37,8 @@ #define __except catch #endif +#include <string.h> +#include <vector> using namespace std; vector<string> m_vecAtoms; @@ -103,7 +105,7 @@ extern "C" BOOL WINAPI dllFindClose(HANDLE hFile) #ifdef TARGET_WINDOWS static void to_WIN32_FIND_DATA(LPWIN32_FIND_DATAW wdata, LPWIN32_FIND_DATA data) { - CStdString strname; + std::string strname; g_charsetConverter.wToUTF8(wdata->cFileName, strname); size_t size = sizeof(data->cFileName) / sizeof(char); strncpy(data->cFileName, strname.c_str(), size); @@ -128,7 +130,7 @@ static void to_WIN32_FIND_DATA(LPWIN32_FIND_DATAW wdata, LPWIN32_FIND_DATA data) static void to_WIN32_FIND_DATAW(LPWIN32_FIND_DATA data, LPWIN32_FIND_DATAW wdata) { - CStdStringW strwname; + std::wstring strwname; g_charsetConverter.utf8ToW(data->cFileName, strwname, false); size_t size = sizeof(wdata->cFileName) / sizeof(wchar_t); wcsncpy(wdata->cFileName, strwname.c_str(), size); @@ -166,7 +168,7 @@ extern "C" HANDLE WINAPI dllFindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA #ifdef TARGET_WINDOWS struct _WIN32_FIND_DATAW FindFileDataW; - CStdStringW strwfile; + std::wstring strwfile; g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(p), strwfile, false); HANDLE res = FindFirstFileW(strwfile.c_str(), &FindFileDataW); if (res != INVALID_HANDLE_VALUE) diff --git a/xbmc/cores/DllLoader/exports/emu_kernel32.h b/xbmc/cores/DllLoader/exports/emu_kernel32.h index db16ea7a66..4944404012 100644 --- a/xbmc/cores/DllLoader/exports/emu_kernel32.h +++ b/xbmc/cores/DllLoader/exports/emu_kernel32.h @@ -21,8 +21,8 @@ * */ -#include "utils/StdString.h" #include "system.h" +#include <stdarg.h> #define MAX_LEADBYTES 12 #define MAX_DEFAULTCHAR 2 @@ -100,7 +100,7 @@ typedef struct _OSVERSIONINFO DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; - TCHAR szCSDVersion[128]; + char szCSDVersion[128]; } OSVERSIONINFO, *LPOSVERSIONINFO; diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp index 82675dc8e5..33341ac9b9 100644 --- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp +++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp @@ -199,7 +199,7 @@ extern "C" void __stdcall update_emu_environ() && CSettings::Get().GetInt("network.httpproxyport") > 0 && CSettings::Get().GetInt("network.httpproxytype") == 0) { - CStdString strProxy; + std::string strProxy; if (!CSettings::Get().GetString("network.httpproxyusername").empty() && !CSettings::Get().GetString("network.httpproxypassword").empty()) { @@ -249,7 +249,7 @@ static int convert_fmode(const char* mode) #ifdef TARGET_WINDOWS static void to_finddata64i32(_wfinddata64i32_t *wdata, _finddata64i32_t *data) { - CStdString strname; + std::string strname; g_charsetConverter.wToUTF8(wdata->name, strname); size_t size = sizeof(data->name) / sizeof(char); strncpy(data->name, strname.c_str(), size); @@ -264,7 +264,7 @@ static void to_finddata64i32(_wfinddata64i32_t *wdata, _finddata64i32_t *data) static void to_wfinddata64i32(_finddata64i32_t *data, _wfinddata64i32_t *wdata) { - CStdStringW strwname; + std::wstring strwname; g_charsetConverter.utf8ToW(data->name, strwname, false); size_t size = sizeof(wdata->name) / sizeof(wchar_t); wcsncpy(wdata->name, strwname.c_str(), size); @@ -815,7 +815,7 @@ extern "C" // Make sure the slashes are correct & translate the path struct _wfinddata64i32_t wdata; - CStdStringW strwfile; + std::wstring strwfile; g_charsetConverter.utf8ToW(CUtil::ValidatePath(CSpecialProtocol::TranslatePath(str)), strwfile, false); intptr_t ret = _wfindfirst64i32(strwfile.c_str(), &wdata); if (ret != -1) @@ -823,11 +823,11 @@ extern "C" return ret; } // non-local files. handle through IDirectory-class - only supports '*.bah' or '*.*' - CStdString strURL(file); - CStdString strMask; + std::string strURL(file); + std::string strMask; if (url.GetFileName().find("*.*") != string::npos) { - CStdString strReplaced = url.GetFileName(); + std::string strReplaced = url.GetFileName(); StringUtils::Replace(strReplaced, "*.*",""); url.SetFileName(strReplaced); } @@ -838,7 +838,7 @@ extern "C" } else if (url.GetFileName().find("*") != string::npos) { - CStdString strReplaced = url.GetFileName(); + std::string strReplaced = url.GetFileName(); StringUtils::Replace(strReplaced, "*",""); url.SetFileName(strReplaced); } @@ -1490,7 +1490,7 @@ extern "C" int dllvprintf(const char *format, va_list va) { - CStdString buffer = StringUtils::FormatV(format, va); + std::string buffer = StringUtils::FormatV(format, va); CLog::Log(LOGDEBUG, " msg: %s", buffer.c_str()); return buffer.length(); } @@ -1918,9 +1918,9 @@ extern "C" if (!dir) return -1; // Make sure the slashes are correct & translate the path - CStdString strPath = CUtil::ValidatePath(CSpecialProtocol::TranslatePath(dir)); + std::string strPath = CUtil::ValidatePath(CSpecialProtocol::TranslatePath(dir)); #ifndef TARGET_POSIX - CStdStringW strWPath; + std::wstring strWPath; g_charsetConverter.utf8ToW(strPath, strWPath, false); return _wmkdir(strWPath.c_str()); #else diff --git a/xbmc/cores/DummyVideoPlayer.cpp b/xbmc/cores/DummyVideoPlayer.cpp index 0d7cfc68da..7e27399c86 100644 --- a/xbmc/cores/DummyVideoPlayer.cpp +++ b/xbmc/cores/DummyVideoPlayer.cpp @@ -170,17 +170,17 @@ void CDummyVideoPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) } } -void CDummyVideoPlayer::GetAudioInfo(CStdString& strAudioInfo) +void CDummyVideoPlayer::GetAudioInfo(std::string& strAudioInfo) { strAudioInfo = "DummyVideoPlayer - nothing to see here"; } -void CDummyVideoPlayer::GetVideoInfo(CStdString& strVideoInfo) +void CDummyVideoPlayer::GetVideoInfo(std::string& strVideoInfo) { strVideoInfo = "DummyVideoPlayer - nothing to see here"; } -void CDummyVideoPlayer::GetGeneralInfo(CStdString& strGeneralInfo) +void CDummyVideoPlayer::GetGeneralInfo(std::string& strGeneralInfo) { strGeneralInfo = "DummyVideoPlayer - what are you still looking for?"; } @@ -255,12 +255,12 @@ void CDummyVideoPlayer::ShowOSD(bool bOnoff) { } -CStdString CDummyVideoPlayer::GetPlayerState() +std::string CDummyVideoPlayer::GetPlayerState() { return ""; } -bool CDummyVideoPlayer::SetPlayerState(CStdString state) +bool CDummyVideoPlayer::SetPlayerState(const std::string& state) { return true; } @@ -290,7 +290,7 @@ void CDummyVideoPlayer::Render() int mins = (int)(m_clock / 60000); int secs = (int)((m_clock / 1000) % 60); int ms = (int)(m_clock % 1000); - CStdString currentTime = StringUtils::Format("Video goes here %02i:%02i:%03i", mins, secs, ms); + std::string 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); diff --git a/xbmc/cores/DummyVideoPlayer.h b/xbmc/cores/DummyVideoPlayer.h index f02d440d26..85cb90edab 100644 --- a/xbmc/cores/DummyVideoPlayer.h +++ b/xbmc/cores/DummyVideoPlayer.h @@ -50,9 +50,9 @@ public: virtual void SetBrightness(bool bPlus) {} virtual void SetHue(bool bPlus) {} virtual void SetSaturation(bool bPlus) {} - virtual void GetAudioInfo(CStdString& strAudioInfo); - virtual void GetVideoInfo(CStdString& strVideoInfo); - virtual void GetGeneralInfo( CStdString& strVideoInfo); + virtual void GetAudioInfo(std::string& strAudioInfo); + virtual void GetVideoInfo(std::string& strVideoInfo); + virtual void GetGeneralInfo( std::string& strVideoInfo); virtual void Update(bool bPauseDrawing) {} virtual void SwitchToNextAudioLanguage(); virtual bool CanRecord() { return false; } @@ -72,8 +72,8 @@ public: virtual void ShowOSD(bool bOnoff); virtual void DoAudioWork() {} - virtual CStdString GetPlayerState(); - virtual bool SetPlayerState(CStdString state); + virtual std::string GetPlayerState(); + virtual bool SetPlayerState(const std::string& state); private: virtual void Process(); diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index 5390bd1067..3667a57ebf 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -143,25 +143,24 @@ bool CExternalPlayer::IsPlaying() const void CExternalPlayer::Process() { - CStdString mainFile = m_launchFilename; - CStdString archiveContent = ""; + std::string mainFile = m_launchFilename; + std::string archiveContent; if (m_args.find("{0}") == std::string::npos) { // Unwind archive names CURL url(m_launchFilename); - CStdString protocol = url.GetProtocol(); - if (protocol == "zip" || protocol == "rar"/* || protocol == "iso9660" ??*/ || protocol == "udf") + if (url.IsProtocol("zip") || url.IsProtocol("rar") /* || url.IsProtocol("iso9660") ??*/ || url.IsProtocol("udf")) { mainFile = url.GetHostName(); archiveContent = url.GetFileName(); } - if (protocol == "musicdb") + if (url.IsProtocol("musicdb")) mainFile = CMusicDatabaseFile::TranslateUrl(url); - if (protocol == "bluray") + if (url.IsProtocol("bluray")) { CURL base(url.GetHostName()); - if(base.GetProtocol() == "udf") + if (base.IsProtocol("udf")) { mainFile = base.GetHostName(); /* image file */ archiveContent = base.GetFileName(); @@ -181,7 +180,7 @@ void CExternalPlayer::Process() if (vecSplit.size() != 4) continue; - CStdString strMatch = vecSplit[0]; + std::string strMatch = vecSplit[0]; StringUtils::Replace(strMatch, ",,",","); bool bCaseless = vecSplit[3].find('i') != std::string::npos; CRegExp regExp(bCaseless, CRegExp::autoUtf8); @@ -194,7 +193,7 @@ void CExternalPlayer::Process() if (regExp.RegFind(mainFile) > -1) { - CStdString strPat = vecSplit[1]; + std::string strPat = vecSplit[1]; StringUtils::Replace(strPat, ",,",","); if (!regExp.RegComp(strPat.c_str())) @@ -203,7 +202,7 @@ void CExternalPlayer::Process() continue; } - CStdString strRep = vecSplit[2]; + std::string strRep = vecSplit[2]; StringUtils::Replace(strRep, ",,",","); bool bGlobal = vecSplit[3].find('g') != std::string::npos; bool bStop = vecSplit[3].find('s') != std::string::npos; @@ -228,8 +227,8 @@ void CExternalPlayer::Process() CLog::Log(LOGNOTICE, "%s: Start", __FUNCTION__); // make sure we surround the arguments with quotes where necessary - CStdString strFName; - CStdString strFArgs; + std::string strFName; + std::string strFArgs; #if defined(TARGET_WINDOWS) // W32 batch-file handline if (StringUtils::EndsWith(m_filename, ".bat") || StringUtils::EndsWith(m_filename, ".cmd")) @@ -414,7 +413,7 @@ BOOL CExternalPlayer::ExecuteAppW32(const char* strPath, const char* strSwitches si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = m_hideconsole ? SW_HIDE : SW_SHOW; - CStdStringW WstrPath, WstrSwitches; + std::wstring WstrPath, WstrSwitches; g_charsetConverter.utf8ToW(strPath, WstrPath); g_charsetConverter.utf8ToW(strSwitches, WstrSwitches); @@ -538,17 +537,17 @@ void CExternalPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) { } -void CExternalPlayer::GetAudioInfo(CStdString& strAudioInfo) +void CExternalPlayer::GetAudioInfo(std::string& strAudioInfo) { strAudioInfo = "CExternalPlayer:GetAudioInfo"; } -void CExternalPlayer::GetVideoInfo(CStdString& strVideoInfo) +void CExternalPlayer::GetVideoInfo(std::string& strVideoInfo) { strVideoInfo = "CExternalPlayer:GetVideoInfo"; } -void CExternalPlayer::GetGeneralInfo(CStdString& strGeneralInfo) +void CExternalPlayer::GetGeneralInfo(std::string& strGeneralInfo) { strGeneralInfo = "CExternalPlayer:GetGeneralInfo"; } @@ -621,12 +620,12 @@ void CExternalPlayer::ShowOSD(bool bOnoff) { } -CStdString CExternalPlayer::GetPlayerState() +std::string CExternalPlayer::GetPlayerState() { return ""; } -bool CExternalPlayer::SetPlayerState(CStdString state) +bool CExternalPlayer::SetPlayerState(const std::string& state) { return true; } @@ -640,7 +639,7 @@ bool CExternalPlayer::Initialize(TiXmlElement* pConfig) } else { - CStdString xml; + std::string xml; xml<<*pConfig; CLog::Log(LOGERROR, "ExternalPlayer Error: filename element missing from: %s", xml.c_str()); return false; @@ -662,7 +661,7 @@ bool CExternalPlayer::Initialize(TiXmlElement* pConfig) if (XMLUtils::GetBoolean(pConfig, "hidecursor", bHideCursor) && bHideCursor) m_warpcursor = WARP_BOTTOM_RIGHT; - CStdString warpCursor; + std::string warpCursor; if (XMLUtils::GetString(pConfig, "warpcursor", warpCursor) && !warpCursor.empty()) { if (warpCursor == "bottomright") m_warpcursor = WARP_BOTTOM_RIGHT; @@ -732,9 +731,9 @@ void CExternalPlayer::GetCustomRegexpReplacers(TiXmlElement *pRootElement, bool bGlobal = szGlobal && stricmp(szGlobal, "true") == 0; bool bStop = szStop && stricmp(szStop, "true") == 0; - CStdString strMatch; - CStdString strPat; - CStdString strRep; + std::string strMatch; + std::string strPat; + std::string strRep; XMLUtils::GetString(pReplacer,"match",strMatch); XMLUtils::GetString(pReplacer,"pat",strPat); XMLUtils::GetString(pReplacer,"rep",strRep); @@ -749,7 +748,7 @@ void CExternalPlayer::GetCustomRegexpReplacers(TiXmlElement *pRootElement, StringUtils::Replace(strPat, ",",",,"); StringUtils::Replace(strRep, ",",",,"); - CStdString strReplacer = strMatch + " , " + strPat + " , " + strRep + " , " + (bGlobal ? "g" : "") + (bStop ? "s" : ""); + std::string strReplacer = strMatch + " , " + strPat + " , " + strRep + " , " + (bGlobal ? "g" : "") + (bStop ? "s" : ""); if (iAction == 2) settings.insert(settings.begin() + i++, 1, strReplacer); else diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.h b/xbmc/cores/ExternalPlayer/ExternalPlayer.h index aaad767e1f..66f1cbfa56 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.h +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.h @@ -22,6 +22,8 @@ #include "cores/IPlayer.h" #include "threads/Thread.h" +#include <string> +#include <vector> class CGUIDialogOK; @@ -55,9 +57,9 @@ public: virtual void SetBrightness(bool bPlus) {} virtual void SetHue(bool bPlus) {} virtual void SetSaturation(bool bPlus) {} - virtual void GetAudioInfo(CStdString& strAudioInfo); - virtual void GetVideoInfo(CStdString& strVideoInfo); - virtual void GetGeneralInfo( CStdString& strVideoInfo); + virtual void GetAudioInfo(std::string& strAudioInfo); + virtual void GetVideoInfo(std::string& strVideoInfo); + virtual void GetGeneralInfo(std::string& strVideoInfo); virtual void SwitchToNextAudioLanguage(); virtual bool CanRecord() { return false; } virtual bool IsRecording() { return false; } @@ -75,8 +77,8 @@ public: virtual void ShowOSD(bool bOnoff); virtual void DoAudioWork() {} - virtual CStdString GetPlayerState(); - virtual bool SetPlayerState(CStdString state); + virtual std::string GetPlayerState(); + virtual bool SetPlayerState(const std::string& state); #if defined(TARGET_WINDOWS) virtual BOOL ExecuteAppW32(const char* strPath, const char* strSwitches); @@ -98,7 +100,7 @@ private: int m_speed; int m_totalTime; int m_time; - CStdString m_launchFilename; + std::string m_launchFilename; HWND m_hwndXbmc; #if defined(TARGET_WINDOWS) POINT m_ptCursorpos; @@ -107,8 +109,8 @@ private: CGUIDialogOK* m_dialog; int m_xPos; int m_yPos; - CStdString m_filename; - CStdString m_args; + std::string m_filename; + std::string m_args; bool m_hideconsole; bool m_hidexbmc; bool m_islauncher; diff --git a/xbmc/cores/FFmpeg.cpp b/xbmc/cores/FFmpeg.cpp index 4f134d74cd..7e72df13a6 100644 --- a/xbmc/cores/FFmpeg.cpp +++ b/xbmc/cores/FFmpeg.cpp @@ -21,7 +21,6 @@ #include "cores/FFmpeg.h" #include "utils/log.h" #include "threads/SharedSection.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" #include "threads/Thread.h" #include "settings/AdvancedSettings.h" @@ -64,7 +63,7 @@ int ffmpeg_lockmgr_cb(void **mutex, enum AVLockOp operation) } static CCriticalSection m_logSection; -std::map<uintptr_t, CStdString> g_logbuffer; +std::map<uintptr_t, std::string> g_logbuffer; void ff_flush_avutil_log_buffers(void) { @@ -72,7 +71,7 @@ void ff_flush_avutil_log_buffers(void) /* Loop through the logbuffer list and remove any blank buffers If the thread using the buffer is still active, it will just add a new buffer next time it writes to the log */ - std::map<uintptr_t, CStdString>::iterator it; + std::map<uintptr_t, std::string>::iterator it; for (it = g_logbuffer.begin(); it != g_logbuffer.end(); ) if ((*it).second.empty()) g_logbuffer.erase(it++); @@ -84,7 +83,7 @@ void ff_avutil_log(void* ptr, int level, const char* format, va_list va) { CSingleLock lock(m_logSection); uintptr_t threadId = (uintptr_t)CThread::GetCurrentThreadId(); - CStdString &buffer = g_logbuffer[threadId]; + std::string &buffer = g_logbuffer[threadId]; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; @@ -103,14 +102,14 @@ void ff_avutil_log(void* ptr, int level, const char* format, va_list va) default : type = LOGDEBUG; break; } - CStdString message = StringUtils::FormatV(format, va); - CStdString prefix = StringUtils::Format("ffmpeg[%X]: ", threadId); + std::string message = StringUtils::FormatV(format, va); + std::string prefix = StringUtils::Format("ffmpeg[%X]: ", threadId); if(avc) { if(avc->item_name) - prefix += CStdString("[") + avc->item_name(ptr) + "] "; + prefix += std::string("[") + avc->item_name(ptr) + "] "; else if(avc->class_name) - prefix += CStdString("[") + avc->class_name + "] "; + prefix += std::string("[") + avc->class_name + "] "; } buffer += message; diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h index 62cd1bedc2..26489cbe81 100644 --- a/xbmc/cores/IPlayer.h +++ b/xbmc/cores/IPlayer.h @@ -23,8 +23,8 @@ #include "system.h" // until we get sane int types used here #include "IAudioCallback.h" #include "IPlayerCallback.h" -#include "utils/StdString.h" #include "guilib/Geometry.h" +#include <string> struct TextCacheStruct_t; class TiXmlElement; @@ -50,7 +50,7 @@ public: double starttime; /* start time in seconds */ double startpercent; /* start time in percent */ bool identify; /* identify mode, used for checking format and length of a file */ - CStdString state; /* potential playerstate to restore to */ + std::string state; /* potential playerstate to restore to */ bool fullscreen; /* player is allowed to switch to fullscreen */ bool video_only; /* player is not allowed to play audio streams, video streams only */ }; @@ -151,9 +151,9 @@ public: virtual void SetVolume(float volume){} virtual bool ControlsVolume(){ return false;} virtual void SetDynamicRangeCompression(long drc){} - virtual void GetAudioInfo( CStdString& strAudioInfo) = 0; - virtual void GetVideoInfo( CStdString& strVideoInfo) = 0; - virtual void GetGeneralInfo( CStdString& strVideoInfo) = 0; + virtual void GetAudioInfo( std::string& strAudioInfo) = 0; + virtual void GetVideoInfo( std::string& strVideoInfo) = 0; + virtual void GetGeneralInfo( std::string& strVideoInfo) = 0; virtual bool CanRecord() { return false;}; virtual bool IsRecording() { return false;}; virtual bool Record(bool bOnOff) { return false;}; @@ -169,7 +169,7 @@ public: virtual void SetSubtitle(int iStream){}; virtual bool GetSubtitleVisible(){ return false;}; virtual void SetSubtitleVisible(bool bVisible){}; - virtual int AddSubtitle(const CStdString& strSubPath) {return -1;}; + virtual int AddSubtitle(const std::string& strSubPath) {return -1;}; virtual int GetAudioStreamCount() { return 0; } virtual int GetAudioStream() { return -1; } @@ -181,7 +181,7 @@ public: virtual int GetChapterCount() { return 0; } virtual int GetChapter() { return -1; } - virtual void GetChapterName(CStdString& strChapterName) { return; } + virtual void GetChapterName(std::string& strChapterName) { return; } virtual int SeekChapter(int iChapter) { return -1; } // virtual bool GetChapterInfo(int chapter, SChapterInfo &info) { return false; } @@ -214,10 +214,10 @@ public: virtual bool OnAction(const CAction &action) { return false; }; //returns a state that is needed for resuming from a specific time - virtual CStdString GetPlayerState() { return ""; }; - virtual bool SetPlayerState(CStdString state) { return false;}; + virtual std::string GetPlayerState() { return ""; }; + virtual bool SetPlayerState(const std::string& state) { return false;}; - virtual CStdString GetPlayingTitle() { return ""; }; + virtual std::string GetPlayingTitle() { return ""; }; virtual bool SwitchChannel(const PVR::CPVRChannel &channel) { return false; } diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp index ca9aa843a2..b6fb1a3e31 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -205,14 +205,14 @@ void CXBMCRenderManager::WaitPresentTime(double presenttime) //printf("%f %f % 2.0f%% % f % f\n", presenttime, clock, m_presentcorr * 100, error, error_org); } -CStdString CXBMCRenderManager::GetVSyncState() +std::string CXBMCRenderManager::GetVSyncState() { double avgerror = 0.0; for (int i = 0; i < ERRORBUFFSIZE; i++) avgerror += m_errorbuff[i]; avgerror /= ERRORBUFFSIZE; - CStdString state = StringUtils::Format("sync:%+3d%% avg:%3d%% error:%2d%%" + std::string 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))); diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h index c3f5517fc4..8b237fb6c0 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoRenderers/RenderManager.h @@ -137,7 +137,7 @@ public: static double GetPresentTime(); void WaitPresentTime(double presenttime); - CStdString GetVSyncState(); + std::string GetVSyncState(); void UpdateResolution(); diff --git a/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.cpp b/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.cpp index 17e9415447..6fd49046d6 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.cpp +++ b/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.cpp @@ -134,7 +134,7 @@ bool CWinShader::UnlockVertexBuffer() return true; } -bool CWinShader::LoadEffect(CStdString filename, DefinesMap* defines) +bool CWinShader::LoadEffect(const std::string& filename, DefinesMap* defines) { CLog::Log(LOGDEBUG, __FUNCTION__" - loading shader %s", filename.c_str()); @@ -145,7 +145,7 @@ bool CWinShader::LoadEffect(CStdString filename, DefinesMap* defines) return false; } - CStdString pStrEffect; + std::string pStrEffect; getline(file, pStrEffect, '\0'); if (!m_effect.Create(pStrEffect, defines)) @@ -303,7 +303,7 @@ bool CYUV2RGBShader::Create(unsigned int sourceWidth, unsigned int sourceHeight, m_texSteps[0] = 1.0f/(float)texWidth; m_texSteps[1] = 1.0f/(float)sourceHeight; - CStdString effectString = "special://xbmc/system/shaders/yuv2rgb_d3d.fx"; + std::string effectString = "special://xbmc/system/shaders/yuv2rgb_d3d.fx"; if(!LoadEffect(effectString, &defines)) { @@ -515,7 +515,7 @@ bool CConvolutionShader::CreateHQKernel(ESCALINGMETHOD method) //================================================================================== bool CConvolutionShader1Pass::Create(ESCALINGMETHOD method) { - CStdString effectString; + std::string effectString; switch(method) { case VS_SCALINGMETHOD_CUBIC: @@ -640,7 +640,7 @@ CConvolutionShaderSeparable::CConvolutionShaderSeparable() bool CConvolutionShaderSeparable::Create(ESCALINGMETHOD method) { - CStdString effectString; + std::string effectString; switch(method) { case VS_SCALINGMETHOD_CUBIC: @@ -889,7 +889,7 @@ void CConvolutionShaderSeparable::SetShaderParameters(CD3DTexture &sourceTexture bool CTestShader::Create() { - CStdString effectString = "special://xbmc/system/shaders/testshader.fx"; + std::string effectString = "special://xbmc/system/shaders/testshader.fx"; if(!LoadEffect(effectString, NULL)) { diff --git a/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.h b/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.h index 7c9551c8f1..8a3f715bc3 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.h +++ b/xbmc/cores/VideoRenderers/VideoShaders/WinVideoFilter.h @@ -56,7 +56,7 @@ protected: virtual bool CreateVertexBuffer(DWORD FVF, unsigned int vertCount, unsigned int vertSize, unsigned int primitivesCount); virtual bool LockVertexBuffer(void **data); virtual bool UnlockVertexBuffer(); - virtual bool LoadEffect(CStdString filename, DefinesMap* defines); + virtual bool LoadEffect(const std::string& filename, DefinesMap* defines); virtual bool Execute(std::vector<LPDIRECT3DSURFACE9> *vecRT, unsigned int vertexIndexStep); CD3DEffect m_effect; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp index f77ac4059b..32d58d4060 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp @@ -140,7 +140,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne //when support for a hardware decoder is not compiled in //only print it if it's actually available on the platform - CStdString hwSupport; + std::string hwSupport; #if defined(TARGET_DARWIN_OSX) hwSupport += "VDADecoder:yes "; #endif @@ -309,7 +309,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne } #endif - CStdString value = StringUtils::Format("%d", surfaces); + std::string value = StringUtils::Format("%d", surfaces); options.m_keys.push_back(CDVDCodecOption("surfaces", value)); if( (pCodec = OpenCodec(new CDVDVideoCodecFFmpeg(), hint, options)) ) return pCodec; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp index 4fe030fab1..03cda12d79 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp @@ -81,7 +81,7 @@ int CDVDOverlayCodecSSA::Decode(DemuxPacket *pPacket) int sh, sm, ss, sc, eh, em, es, ec; double beg, end; size_t pos; - CStdString line, line2; + std::string line, line2; std::vector<std::string> lines; StringUtils::Tokenize((const char*)data, lines, "\r\n"); for(size_t i=0; i<lines.size(); i++) @@ -100,7 +100,7 @@ int CDVDOverlayCodecSSA::Decode(DemuxPacket *pPacket) pos = line.find_first_of(",", 0); pos = line.find_first_of(",", pos+1); pos = line.find_first_of(",", pos+1); - if(pos == CStdString::npos) + if(pos == std::string::npos) continue; line2 = StringUtils::Format("%d,%s,%s", m_order++, layer.get(), line.substr(pos+1).c_str()); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecTX3G.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecTX3G.cpp index c013cc5259..93dfdb1c3b 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecTX3G.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecTX3G.cpp @@ -180,7 +180,7 @@ int CDVDOverlayCodecTX3G::Decode(DemuxPacket *pPacket) // Copy text to out and add HTML markup for the style records int charIndex = 0; - CStdStringA strUTF8; + std::string strUTF8; // index over textLength chars to include broken encoders, // so we pickup closing styles on broken encoders for (pos = text, end = text + textLength; pos <= end; pos++) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp index 9da801563f..2dcc2442a4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp @@ -169,7 +169,7 @@ public: }; void PrintFormat(BCM::BC_PIC_INFO_BLOCK &pib); -void BcmDebugLog( BCM::BC_STATUS lResult, CStdString strFuncName=""); +void BcmDebugLog( BCM::BC_STATUS lResult, std::string strFuncName=""); const char* g_DtsStatusText[] = { "BC_STS_SUCCESS", @@ -1115,7 +1115,7 @@ CCrystalHD::CCrystalHD() : m_dll = new DllLibCrystalHD; #ifdef TARGET_WINDOWS - CStdString strDll; + std::string strDll; if(CWIN32Util::GetCrystalHDLibraryPath(strDll) && m_dll->SetFile(strDll) && m_dll->Load() && m_dll->IsLoaded() ) #else if (m_dll->Load() && m_dll->IsLoaded() ) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index b6c1e04433..0d4dcd5624 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -505,7 +505,7 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p , m_pCodecContext->pix_fmt) == m_formats.end(); bool need_reopen = false; - if(!m_filters.Equals(m_filters_next)) + if(m_filters != m_filters_next) need_reopen = true; if(m_pFilterIn) @@ -671,7 +671,7 @@ bool CDVDVideoCodecFFmpeg::GetPicture(DVDVideoPicture* pDvdVideoPicture) return true; } -int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters, bool scale) +int CDVDVideoCodecFFmpeg::FilterOpen(const std::string& filters, bool scale) { int result; @@ -696,7 +696,7 @@ int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters, bool scale) AVFilter* srcFilter = avfilter_get_by_name("buffer"); AVFilter* outFilter = avfilter_get_by_name("buffersink"); // should be last filter in the graph for now - CStdString args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d", + std::string args = StringUtils::Format("%d:%d:%d:%d:%d:%d:%d", m_pCodecContext->width, m_pCodecContext->height, m_pCodecContext->pix_fmt, @@ -705,7 +705,7 @@ int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters, bool scale) m_pCodecContext->sample_aspect_ratio.num, m_pCodecContext->sample_aspect_ratio.den); - if ((result = avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args, NULL, m_pFilterGraph)) < 0) + if ((result = avfilter_graph_create_filter(&m_pFilterIn, srcFilter, "src", args.c_str(), NULL, m_pFilterGraph)) < 0) { CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterOpen - avfilter_graph_create_filter: src"); return result; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h index 75ac0f21ec..1f564bbed6 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h @@ -23,7 +23,7 @@ #include "DVDVideoCodec.h" #include "DVDResource.h" #include <string> -#include "utils/StdString.h" +#include <vector> extern "C" { #include "libavfilter/avfilter.h" @@ -80,14 +80,14 @@ public: protected: static enum PixelFormat GetFormat(struct AVCodecContext * avctx, const PixelFormat * fmt); - int FilterOpen(const CStdString& filters, bool scale); + int FilterOpen(const std::string& filters, bool scale); void FilterClose(); int FilterProcess(AVFrame* frame); void UpdateName() { if(m_pCodecContext->codec->name) - m_name = CStdString("ff-") + m_pCodecContext->codec->name; + m_name = std::string("ff-") + m_pCodecContext->codec->name; else m_name = "ffmpeg"; @@ -98,8 +98,8 @@ protected: AVFrame* m_pFrame; AVCodecContext* m_pCodecContext; - CStdString m_filters; - CStdString m_filters_next; + std::string m_filters; + std::string m_filters_next; AVFilterGraph* m_pFilterGraph; AVFilterContext* m_pFilterIn; AVFilterContext* m_pFilterOut; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp index 5538cef6f1..6db3ed4f41 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp @@ -245,7 +245,7 @@ bool CDVDVideoCodecVDA::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options) return false; } - CStdString rendervendor = g_Windowing.GetRenderVendor(); + std::string rendervendor = g_Windowing.GetRenderVendor(); StringUtils::ToLower(rendervendor); if (rendervendor.find("nvidia") != std::string::npos) { diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp index 6ce5eb4efb..5e489dcd20 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.cpp @@ -22,7 +22,7 @@ #include "utils/log.h" #include "cores/FFmpeg.h" -CDVDVideoPPFFmpeg::CDVDVideoPPFFmpeg(const CStdString& mType) +CDVDVideoPPFFmpeg::CDVDVideoPPFFmpeg(const std::string& mType) { m_sType = mType; m_pMode = m_pContext = NULL; @@ -90,7 +90,7 @@ bool CDVDVideoPPFFmpeg::CheckInit(int iWidth, int iHeight) return false; } -void CDVDVideoPPFFmpeg::SetType(const CStdString& mType, bool deinterlace) +void CDVDVideoPPFFmpeg::SetType(const std::string& mType, bool deinterlace) { m_deinterlace = deinterlace; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.h index 5febe0b5b2..0ba6fd31aa 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoPPFFmpeg.h @@ -21,23 +21,23 @@ */ #include "DVDVideoCodec.h" -#include "utils/StdString.h" +#include <string> class CDVDVideoPPFFmpeg { public: - CDVDVideoPPFFmpeg(const CStdString& mType); + CDVDVideoPPFFmpeg(const std::string& mType); ~CDVDVideoPPFFmpeg(); - void SetType(const CStdString& mType, bool deinterlace); + void SetType(const std::string& mType, bool deinterlace); void SetTarget(DVDVideoPicture *pPicture){ m_pTarget = pPicture; }; bool Process (DVDVideoPicture *pPicture); bool GetPicture(DVDVideoPicture *pPicture); protected: - CStdString m_sType; + std::string m_sType; void *m_pContext; void *m_pMode; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp index cbcec26f3d..06ebb99b1d 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp @@ -280,9 +280,9 @@ static const pci_device NoDeintProcForProgDevices[] = { { 0 , 0x0000 } }; -static CStdString GUIDToString(const GUID& guid) +static std::string GUIDToString(const GUID& guid) { - CStdString buffer = StringUtils::Format("%08X-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" + std::string 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] diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp index 7b0a0c2ef4..7339728065 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp @@ -213,7 +213,7 @@ OMX_ERRORTYPE COpenMax::SetStateForComponent(OMX_STATETYPE state) return omx_err; } -bool COpenMax::Initialize( const CStdString &decoder_name) +bool COpenMax::Initialize( const std::string &decoder_name) { OMX_ERRORTYPE omx_err = m_dll->OMX_Init(); if (omx_err) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h index 0d9ff187ed..a14b8e43b4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h @@ -75,7 +75,7 @@ protected: }; // initialize OpenMax and get decoder component - bool Initialize( const CStdString &decoder_name); + bool Initialize( const std::string &decoder_name); void Deinitialize(); // OpenMax Decoder delegate callback routines. diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 7ef23f3729..89a76ff2fe 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -216,12 +216,11 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) // special stream type that makes avformat handle file opening // allows internal ffmpeg protocols to be used CURL url = m_pInput->GetURL(); - CStdString protocol = url.GetProtocol(); AVDictionary *options = GetFFMpegOptionsFromURL(url); int result=-1; - if (protocol.Equals("mms")) + if (url.IsProtocol("mms")) { // try mmsh, then mmst url.SetProtocol("mmsh"); @@ -522,11 +521,10 @@ void CDVDDemuxFFmpeg::SetSpeed(int iSpeed) AVDictionary *CDVDDemuxFFmpeg::GetFFMpegOptionsFromURL(const CURL &url) { - CStdString protocol = url.GetProtocol(); AVDictionary *options = NULL; - if (protocol.Equals("http") || protocol.Equals("https")) + if (url.IsProtocol("http") || url.IsProtocol("https")) { std::map<std::string, std::string> protocolOptions; url.GetProtocolOptions(protocolOptions); @@ -534,19 +532,19 @@ AVDictionary *CDVDDemuxFFmpeg::GetFFMpegOptionsFromURL(const CURL &url) bool hasUserAgent = false; for(std::map<std::string, std::string>::const_iterator it = protocolOptions.begin(); it != protocolOptions.end(); ++it) { - const CStdString &name = it->first; - const CStdString &value = it->second; + std::string name = it->first; StringUtils::ToLower(name); + const std::string &value = it->second; - if (name.Equals("seekable")) + if (name == "seekable") av_dict_set(&options, "seekable", value.c_str(), 0); - else if (name.Equals("User-Agent")) + else if (name == "user-agent") { av_dict_set(&options, "user-agent", value.c_str(), 0); hasUserAgent = true; } - else if (!name.Equals("auth") && !name.Equals("Encoding")) + else if (name != "auth" && name != "encoding") // all other protocol options can be added as http header. - headers.append(name).append(": ").append(value).append("\r\n"); + headers.append(it->first).append(": ").append(value).append("\r\n"); } if (!hasUserAgent) // set default xbmc user-agent. diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp index 6d274fd660..3674416516 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp @@ -51,13 +51,12 @@ public: {} void GetStreamInfo(std::string& strInfo) { - CStdString info = StringUtils::Format("%s, delay: %u, drops: %ub %up %ui" + strInfo = 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; } }; @@ -74,8 +73,7 @@ public: {} void GetStreamInfo(string& strInfo) { - CStdString info = StringUtils::Format("%s", m_codec.c_str()); - strInfo = info; + strInfo = StringUtils::Format("%s", m_codec.c_str()); } }; diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp index 1da0a6462a..82fd7fcc0b 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp +++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp @@ -55,7 +55,7 @@ #include "utils/LangCodeExpander.h" -bool CDVDFileInfo::GetFileDuration(const CStdString &path, int& duration) +bool CDVDFileInfo::GetFileDuration(const std::string &path, int& duration) { std::auto_ptr<CDVDInputStream> input; std::auto_ptr<CDVDDemux> demux; @@ -64,7 +64,7 @@ bool CDVDFileInfo::GetFileDuration(const CStdString &path, int& duration) if (!input.get()) return false; - if (!input->Open(path, "")) + if (!input->Open(path.c_str(), "")) return false; demux.reset(CDVDFactoryDemuxer::CreateDemuxer(input.get())); @@ -93,7 +93,9 @@ int DegreeToOrientation(int degrees) } } -bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, CTextureDetails &details, CStreamDetails *pStreamDetails) +bool CDVDFileInfo::ExtractThumb(const std::string &strPath, + CTextureDetails &details, + CStreamDetails *pStreamDetails) { std::string redactPath = CURL::GetRedacted(strPath); unsigned int nTime = XbmcThreads::SystemClockMillis(); @@ -146,7 +148,7 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, CTextureDetails &deta //extern subtitles std::vector<std::string> filenames; - CStdString video_path; + std::string video_path; if (strPath.empty()) video_path = pInputStream->GetFileName(); else @@ -159,7 +161,7 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, CTextureDetails &deta // if vobsub subtitle: if (URIUtils::GetExtension(filenames[i]) == ".idx") { - CStdString strSubFile; + std::string strSubFile; if ( CUtil::FindVobSubPair(filenames, filenames[i], strSubFile) ) AddExternalSubtitleToDetails(video_path, *pStreamDetails, filenames[i], strSubFile); } @@ -322,14 +324,14 @@ bool CDVDFileInfo::GetFileStreamDetails(CFileItem *pItem) if (!pItem) return false; - CStdString strFileNameAndPath; + std::string strFileNameAndPath; if (pItem->HasVideoInfoTag()) strFileNameAndPath = pItem->GetVideoInfoTag()->m_strFileNameAndPath; if (strFileNameAndPath.empty()) strFileNameAndPath = pItem->GetPath(); - CStdString playablePath = strFileNameAndPath; + std::string playablePath = strFileNameAndPath; if (URIUtils::IsStack(playablePath)) playablePath = XFILE::CStackDirectory::GetFirstStackedFile(playablePath); @@ -372,7 +374,7 @@ bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDem } /* returns true if details have been added */ -bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const CStdString &path) +bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const std::string &path) { bool retVal = false; details.Reset(); @@ -450,7 +452,7 @@ bool CDVDFileInfo::DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDem return retVal; } -bool CDVDFileInfo::AddExternalSubtitleToDetails(const CStdString &path, CStreamDetails &details, const std::string& filename, const std::string& subfilename) +bool CDVDFileInfo::AddExternalSubtitleToDetails(const std::string &path, CStreamDetails &details, const std::string& filename, const std::string& subfilename) { std::string ext = URIUtils::GetExtension(filename); std::string vobsubfile = subfilename; @@ -477,7 +479,7 @@ bool CDVDFileInfo::AddExternalSubtitleToDetails(const CStdString &path, CStreamD } if(ext == ".sub") { - CStdString strReplace(URIUtils::ReplaceExtension(filename,".idx")); + std::string strReplace(URIUtils::ReplaceExtension(filename,".idx")); if (XFILE::CFile::Exists(strReplace)) return false; } diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.h b/xbmc/cores/dvdplayer/DVDFileInfo.h index f0667361da..63491ebe6a 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.h +++ b/xbmc/cores/dvdplayer/DVDFileInfo.h @@ -20,7 +20,8 @@ #pragma once -#include "utils/StdString.h" +#include <string> +#include <vector> class CFileItem; class CDVDDemux; @@ -33,21 +34,23 @@ class CDVDFileInfo { public: // Extract a thumbnail immage from the media at strPath, optionally populating a streamdetails class with the data - static bool ExtractThumb(const CStdString &strPath, CTextureDetails &details, CStreamDetails *pStreamDetails); + static bool ExtractThumb(const std::string &strPath, + CTextureDetails &details, + CStreamDetails *pStreamDetails); // Probe the files streams and store the info in the VideoInfoTag static bool GetFileStreamDetails(CFileItem *pItem); - static bool DemuxerToStreamDetails(CDVDInputStream* pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const CStdString &path = ""); + static bool DemuxerToStreamDetails(CDVDInputStream* pInputStream, CDVDDemux *pDemux, CStreamDetails &details, const std::string &path = ""); /** \brief Probe the file's internal and external streams and store the info in the StreamDetails parameter. * \param[out] details The file's StreamDetails consisting of internal streams and external subtitle streams. */ static bool DemuxerToStreamDetails(CDVDInputStream *pInputStream, CDVDDemux *pDemuxer, const std::vector<CStreamDetailSubtitle> &subs, CStreamDetails &details); - static bool GetFileDuration(const CStdString &path, int &duration); + static bool GetFileDuration(const std::string &path, int &duration); /** \brief Probe the streams of an external subtitle file and store the info in the StreamDetails parameter. * \param[out] details The external subtitle file's StreamDetails. */ - static bool AddExternalSubtitleToDetails(const CStdString &path, CStreamDetails &details, const std::string& filename, const std::string& subfilename = ""); + static bool AddExternalSubtitleToDetails(const std::string &path, CStreamDetails &details, const std::string& filename, const std::string& subfilename = ""); }; diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp index 6763b6d9d2..4fb07e39be 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp @@ -148,7 +148,7 @@ BD_DIR_H *DllLibbluray::dir_open(const char* dirname) CLog::Log(LOGDEBUG, "CDVDInputStreamBluray - Opening dir %s\n", dirname); SDirState *st = new SDirState(); - CStdString strDirname(dirname); + std::string strDirname(dirname); if(!CDirectory::GetDirectory(strDirname, st->list)) { @@ -255,11 +255,11 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content if(m_player == NULL) return false; - CStdString strPath(strFile); - CStdString filename; - CStdString root; + std::string strPath(strFile); + std::string filename; + std::string root; - if(StringUtils::StartsWithNoCase(strPath, "bluray:")) + if(URIUtils::IsProtocol(strPath, "bluray")) { CURL url(strPath); root = url.GetHostName(); @@ -351,7 +351,7 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content return false; } - if(filename.Equals("index.bdmv")) + if(StringUtils::EqualsNoCase(filename, "index.bdmv")) { m_navmode = false; m_title = GetTitleLongest(); @@ -361,7 +361,7 @@ bool CDVDInputStreamBluray::Open(const char* strFile, const std::string& content m_navmode = false; m_title = GetTitleFile(filename); } - else if(filename.Equals("MovieObject.bdmv")) + else if(StringUtils::EqualsNoCase(filename, "MovieObject.bdmv")) { m_navmode = true; if (m_navmode && !disc_info->first_play_supported) { diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp index 8fc5b370d2..3fd9a07458 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp @@ -78,7 +78,7 @@ bool CDVDInputStreamNavigator::Open(const char* strFile, const std::string& cont // libdvdcss fails if the file path contains VIDEO_TS.IFO or VIDEO_TS/VIDEO_TS.IFO // libdvdnav is still able to play without, so strip them. - CStdString path = strFile; + std::string path = strFile; if(URIUtils::GetFileName(path) == "VIDEO_TS.IFO") path = URIUtils::GetParentPath(path); URIUtils::RemoveSlashAtEnd(path); @@ -861,7 +861,7 @@ bool CDVDInputStreamNavigator::GetSubtitleStreamInfo(const int iId, DVDNavStream lang[1] = (subp_attributes.lang_code & 255); lang[0] = (subp_attributes.lang_code >> 8) & 255; - CStdString temp; + std::string temp; g_LangCodeExpander.ConvertToThreeCharCode(temp, lang); info.language = temp; @@ -1047,7 +1047,7 @@ bool CDVDInputStreamNavigator::GetAudioStreamInfo(const int iId, DVDNavStreamInf lang[1] = (audio_attributes.lang_code & 255); lang[0] = (audio_attributes.lang_code >> 8) & 255; - CStdString temp; + std::string temp; g_LangCodeExpander.ConvertToThreeCharCode(temp, lang); info.language = temp; diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp index e85dbbfc55..610bcce569 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.cpp @@ -362,11 +362,11 @@ void CDVDInputStreamPVRManager::Pause(bool bPaused) g_PVRClients->PauseStream(bPaused); } -CStdString CDVDInputStreamPVRManager::GetInputFormat() +std::string CDVDInputStreamPVRManager::GetInputFormat() { if (!m_pOtherStream && g_PVRManager.IsStarted()) return g_PVRClients->GetCurrentInputFormat(); - return StringUtils::EmptyString; + return ""; } bool CDVDInputStreamPVRManager::CloseAndOpen(const char* strFile) diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h index ebb16ce92a..81dbdfce4a 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamPVRManager.h @@ -82,7 +82,7 @@ public: list of the input formats. \return The name of the input format */ - CStdString GetInputFormat(); + std::string GetInputFormat(); /* returns m_pOtherStream */ CDVDInputStream* GetOtherStream(); diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp index 4760bd4c3c..62ddd3de07 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.cpp @@ -158,7 +158,7 @@ bool CDVDInputStreamRTMP::Open(const char* strFile, const std::string& content) m_optionvalues.clear(); for (int i=0; options[i].name; i++) { - CStdString tmp = m_item.GetProperty(options[i].name).asString(); + std::string tmp = m_item.GetProperty(options[i].name).asString(); if (!tmp.empty()) { m_optionvalues.push_back(tmp); diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h index 2a5bee4d6c..b013f33725 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamRTMP.h @@ -46,7 +46,7 @@ protected: bool m_eof; bool m_bPaused; char* m_sStreamPlaying; - std::vector<CStdString> m_optionvalues; + std::vector<std::string> m_optionvalues; RTMP *m_rtmp; DllLibRTMP m_libRTMP; diff --git a/xbmc/cores/dvdplayer/DVDMessage.h b/xbmc/cores/dvdplayer/DVDMessage.h index a7fbe086d6..a365821bfd 100644 --- a/xbmc/cores/dvdplayer/DVDMessage.h +++ b/xbmc/cores/dvdplayer/DVDMessage.h @@ -203,7 +203,7 @@ private: class CDVDMsgPlayerSetState : public CDVDMsg { public: - CDVDMsgPlayerSetState(std::string& state) : CDVDMsg(PLAYER_SET_STATE), m_state(state) {} + CDVDMsgPlayerSetState(const std::string& state) : CDVDMsg(PLAYER_SET_STATE), m_state(state) {} std::string GetState() { return m_state; } private: std::string m_state; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 9ba6249cba..4f85e2a069 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -190,7 +190,7 @@ static bool PredicateAudioPriority(const SelectionStream& lh, const SelectionStr if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.audiolanguage"), "original")) { - CStdString audio_language = g_langInfo.GetAudioLanguage(); + std::string audio_language = g_langInfo.GetAudioLanguage(); PREDICATE_RETURN(g_LangCodeExpander.CompareLangCodes(audio_language, lh.language) , g_LangCodeExpander.CompareLangCodes(audio_language, rh.language)); } @@ -262,7 +262,7 @@ public: , rh.flags & CDemuxStream::FLAG_FORCED); } - CStdString subtitle_language = g_langInfo.GetSubtitleLanguage(); + std::string subtitle_language = g_langInfo.GetSubtitleLanguage(); if(!original) { PREDICATE_RETURN((STREAM_SOURCE_MASK(lh.source) == STREAM_SOURCE_DEMUX_SUB || STREAM_SOURCE_MASK(lh.source) == STREAM_SOURCE_TEXT) && g_LangCodeExpander.CompareLangCodes(subtitle_language, lh.language) @@ -462,7 +462,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer) s.flags = stream->flags; s.filename = demuxer->GetFileName(); stream->GetStreamName(s.name); - CStdString codec; + std::string codec; demuxer->GetStreamCodecName(stream->iId, codec); s.codec = codec; s.channels = 0; // Default to 0. Overwrite if STREAM_AUDIO below. @@ -624,8 +624,8 @@ bool CDVDPlayer::OpenInputStream() CLog::Log(LOGNOTICE, "Creating InputStream"); // correct the filename if needed - CStdString filename(m_filename); - if (StringUtils::StartsWith(filename, "dvd://") + std::string filename(m_filename); + if (URIUtils::IsProtocol(filename, "dvd") || StringUtils::EqualsNoCase(filename, "iso9660://video_ts/video_ts.ifo")) { m_filename = g_mediaManager.TranslateDevicePath(""); @@ -657,7 +657,7 @@ bool CDVDPlayer::OpenInputStream() CUtil::ScanForExternalSubtitles( m_filename, filenames ); // find any upnp subtitles - CStdString key("upnp:subtitle:1"); + std::string key("upnp:subtitle:1"); for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s)) filenames.push_back(m_item.GetProperty(key).asString()); @@ -666,7 +666,7 @@ bool CDVDPlayer::OpenInputStream() // if vobsub subtitle: if (URIUtils::HasExtension(filenames[i], ".idx")) { - CStdString strSubFile; + std::string strSubFile; if ( CUtil::FindVobSubPair( filenames, filenames[i], strSubFile ) ) AddSubtitleFile(filenames[i], strSubFile); } @@ -2575,7 +2575,7 @@ bool CDVDPlayer::SeekScene(bool bPlus) return false; } -void CDVDPlayer::GetAudioInfo(CStdString& strAudioInfo) +void CDVDPlayer::GetAudioInfo(std::string& strAudioInfo) { { CSingleLock lock(m_StateSection); strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str()); @@ -2583,7 +2583,7 @@ void CDVDPlayer::GetAudioInfo(CStdString& strAudioInfo) strAudioInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerAudio.GetPlayerInfo().c_str()); } -void CDVDPlayer::GetVideoInfo(CStdString& strVideoInfo) +void CDVDPlayer::GetVideoInfo(std::string& strVideoInfo) { { CSingleLock lock(m_StateSection); strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str()); @@ -2591,7 +2591,7 @@ void CDVDPlayer::GetVideoInfo(CStdString& strVideoInfo) strVideoInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str()); } -void CDVDPlayer::GetGeneralInfo(CStdString& strGeneralInfo) +void CDVDPlayer::GetGeneralInfo(std::string& strGeneralInfo) { if (!m_bStop) { @@ -2604,10 +2604,9 @@ void CDVDPlayer::GetGeneralInfo(CStdString& strGeneralInfo) if( apts != DVD_NOPTS_VALUE && vpts != DVD_NOPTS_VALUE ) dDiff = (apts - vpts) / DVD_TIME_BASE; - CStdString strEDL; - strEDL += StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str()); + std::string strEDL = StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str()); - CStdString strBuf; + std::string strBuf; CSingleLock lock(m_StateSection); if(m_StateInput.cache_bytes >= 0) { @@ -3674,13 +3673,13 @@ bool CDVDPlayer::HasMenu() return false; } -CStdString CDVDPlayer::GetPlayerState() +std::string CDVDPlayer::GetPlayerState() { CSingleLock lock(m_StateSection); return m_State.player_state; } -bool CDVDPlayer::SetPlayerState(CStdString state) +bool CDVDPlayer::SetPlayerState(const std::string& state) { m_messenger.Put(new CDVDMsgPlayerSetState(state)); return true; @@ -3698,7 +3697,7 @@ int CDVDPlayer::GetChapter() return m_State.chapter; } -void CDVDPlayer::GetChapterName(CStdString& strChapterName) +void CDVDPlayer::GetChapterName(std::string& strChapterName) { CSingleLock lock(m_StateSection); strChapterName = m_State.chapter_name; @@ -3721,7 +3720,7 @@ int CDVDPlayer::SeekChapter(int iChapter) return 0; } -int CDVDPlayer::AddSubtitle(const CStdString& strSubPath) +int CDVDPlayer::AddSubtitle(const std::string& strSubPath) { return AddSubtitleFile(strSubPath); } @@ -3743,7 +3742,7 @@ void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { info.bitrate = m_dvdPlayerVideo.GetVideoBitrate(); - CStdString retVal; + std::string retVal; if (m_pDemuxer && (m_CurrentVideo.id != -1)) { m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal); @@ -3800,7 +3799,7 @@ void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info) if (stream) { info.channels = stream->iChannels; - CStdString codecName; + std::string codecName; m_pDemuxer->GetStreamCodecName(stream->iId, codecName); info.audioCodecName = codecName; } @@ -4080,7 +4079,7 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details) return false; } -CStdString CDVDPlayer::GetPlayingTitle() +std::string CDVDPlayer::GetPlayingTitle() { /* Currently we support only Title Name from Teletext line 30 */ TextCacheStruct_t* ttcache = m_dvdPlayerTeletext.GetTeletextCache(); diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h index bf73d27ceb..6d8097549c 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h @@ -191,9 +191,9 @@ public: virtual void UnRegisterAudioCallback() { m_dvdPlayerAudio.UnRegisterAudioCallback(); } virtual void SetVolume(float nVolume) { m_dvdPlayerAudio.SetVolume(nVolume); } virtual void SetDynamicRangeCompression(long drc) { m_dvdPlayerAudio.SetDynamicRangeCompression(drc); } - virtual void GetAudioInfo(CStdString& strAudioInfo); - virtual void GetVideoInfo(CStdString& strVideoInfo); - virtual void GetGeneralInfo( CStdString& strVideoInfo); + virtual void GetAudioInfo(std::string& strAudioInfo); + virtual void GetVideoInfo(std::string& strVideoInfo); + virtual void GetGeneralInfo(std::string& strVideoInfo); virtual bool CanRecord(); virtual bool IsRecording(); virtual bool CanPause(); @@ -209,7 +209,7 @@ public: virtual void SetSubtitle(int iStream); virtual bool GetSubtitleVisible(); virtual void SetSubtitleVisible(bool bVisible); - virtual int AddSubtitle(const CStdString& strSubPath); + virtual int AddSubtitle(const std::string& strSubPath); virtual int GetAudioStreamCount(); virtual int GetAudioStream(); @@ -220,7 +220,7 @@ public: virtual int GetChapterCount(); virtual int GetChapter(); - virtual void GetChapterName(CStdString& strChapterName); + virtual void GetChapterName(std::string& strChapterName); virtual int SeekChapter(int iChapter); virtual void SeekTime(int64_t iTime); @@ -235,10 +235,10 @@ public: virtual bool GetStreamDetails(CStreamDetails &details); virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info); - virtual CStdString GetPlayerState(); - virtual bool SetPlayerState(CStdString state); + virtual std::string GetPlayerState(); + virtual bool SetPlayerState(const std::string& state); - virtual CStdString GetPlayingTitle(); + virtual std::string GetPlayingTitle(); virtual bool SwitchChannel(const PVR::CPVRChannel &channel); virtual bool CachePVRStream(void) const; diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 633e333b2f..be532ec34a 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -309,7 +309,7 @@ void CDVDPlayerVideo::Process() DVDVideoPicture picture; CPulldownCorrection pulldown; CDVDVideoPPFFmpeg mPostProcess(""); - CStdString sPostProcessType; + std::string sPostProcessType; bool bPostProcessDeint = false; memset(&picture, 0, sizeof(DVDVideoPicture)); @@ -1064,7 +1064,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) | GetFlagsColorPrimaries(pPicture->color_primaries) | GetFlagsColorTransfer(pPicture->color_transfer); - CStdString formatstr = GetRenderFormatName(pPicture->format); + std::string formatstr = GetRenderFormatName(pPicture->format); if(m_bAllowFullscreen) { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp index 90a9b07122..4f50a803af 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp @@ -23,7 +23,6 @@ #include "DVDClock.h" #include "utils/RegExp.h" #include "DVDStreamInfo.h" -#include "utils/StdString.h" #include "DVDSubtitleTagMicroDVD.h" using namespace std; diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp index 4612ab3d18..43f625b3bc 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMicroDVD.cpp @@ -23,7 +23,6 @@ #include "DVDClock.h" #include "utils/RegExp.h" #include "DVDStreamInfo.h" -#include "utils/StdString.h" #include "utils/log.h" #include "DVDSubtitleTagMicroDVD.h" diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp index b1040b75e7..49673fe939 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSami.cpp @@ -23,7 +23,6 @@ #include "DVDClock.h" #include "utils/RegExp.h" #include "DVDStreamInfo.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "DVDSubtitleTagSami.h" @@ -52,8 +51,8 @@ bool CDVDSubtitleParserSami::Open(CDVDStreamInfo &hints) if (!reg.RegComp("<SYNC START=([0-9]+)>")) return false; - CStdString strFileName; - CStdString strClassID; + std::string strFileName; + std::string strClassID; strFileName = URIUtils::GetFileName(m_filename); CDVDSubtitleTagSami TagConv; @@ -86,7 +85,7 @@ bool CDVDSubtitleParserSami::Open(CDVDStreamInfo &hints) const char* text = line; if (pos > -1) { - CStdString start = reg.GetMatch(1); + std::string start = reg.GetMatch(1); if(pOverlay) { TagConv.ConvertLine(pOverlay, text, pos, lang); diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp index eb6283a40b..7810175209 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserSubrip.cpp @@ -21,7 +21,6 @@ #include "DVDSubtitleParserSubrip.h" #include "DVDCodecs/Overlay/DVDOverlayText.h" #include "DVDClock.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" #include "DVDSubtitleTagSami.h" @@ -47,7 +46,7 @@ bool CDVDSubtitleParserSubrip::Open(CDVDStreamInfo &hints) return false; char line[1024]; - CStdString strLine; + std::string strLine; while (m_pStream->ReadLine(line, sizeof(line))) { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp index 73741d65ec..20035aaa60 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserVplayer.cpp @@ -22,7 +22,6 @@ #include "DVDCodecs/Overlay/DVDOverlayText.h" #include "DVDClock.h" #include "utils/RegExp.h" -#include "utils/StdString.h" using namespace std; diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagMicroDVD.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagMicroDVD.cpp index 98fd87dfa7..5c4b773ff8 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagMicroDVD.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagMicroDVD.cpp @@ -20,12 +20,11 @@ #include "DVDSubtitleTagMicroDVD.h" #include "DVDCodecs/Overlay/DVDOverlayText.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" void CDVDSubtitleTagMicroDVD::ConvertLine(CDVDOverlayText* pOverlay, const char* line, int len) { - CStdString strUTF8; + std::string strUTF8; strUTF8.assign(line, len); m_flag[FLAG_BOLD] = 0; @@ -42,11 +41,11 @@ void CDVDSubtitleTagMicroDVD::ConvertLine(CDVDOverlayText* pOverlay, const char* if (strUTF8[pos] == '{') { size_t pos2, pos3; - if (((pos2 = strUTF8.find(':', pos)) != CStdString::npos) && \ - ((pos3 = strUTF8.find('}', pos2)) != CStdString::npos)) + if (((pos2 = strUTF8.find(':', pos)) != std::string::npos) && \ + ((pos3 = strUTF8.find('}', pos2)) != std::string::npos)) { - CStdString tagName = strUTF8.substr(pos + 1, pos2 - pos - 1); - CStdString tagValue = strUTF8.substr(pos2 + 1, pos3 - pos2 - 1); + std::string tagName = strUTF8.substr(pos + 1, pos2 - pos - 1); + std::string tagValue = strUTF8.substr(pos2 + 1, pos3 - pos2 - 1); StringUtils::ToLower(tagValue); strUTF8.erase(pos, pos3 - pos + 1); if ((tagName == "Y") || (tagName == "y")) @@ -82,7 +81,7 @@ void CDVDSubtitleTagMicroDVD::ConvertLine(CDVDOverlayText* pOverlay, const char* } if( bHex && (m_flag[FLAG_COLOR] == 0)) { - CStdString tempColorTag = "[COLOR "; + std::string tempColorTag = "[COLOR "; tempColorTag += "FF"; tempColorTag += tagValue.substr(1, 6); tempColorTag += "]"; @@ -113,7 +112,7 @@ void CDVDSubtitleTagMicroDVD::ConvertLine(CDVDOverlayText* pOverlay, const char* else if (machine_status == 2) { size_t pos4; - if ((pos4= strUTF8.find('|', pos)) != CStdString::npos) + if ((pos4= strUTF8.find('|', pos)) != std::string::npos) { pos = pos4; if (m_flag[FLAG_BOLD] == TAG_ONE_LINE) diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.cpp index 47857eb073..326f0eb32f 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.cpp @@ -47,7 +47,7 @@ bool CDVDSubtitleTagSami::Init() void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* line, int len, const char* lang) { - CStdStringA strUTF8; + std::string strUTF8; strUTF8.assign(line, len); StringUtils::Trim(strUTF8); @@ -56,7 +56,7 @@ void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* lin while ((pos=m_tags->RegFind(strUTF8.c_str(), pos)) >= 0) { // Parse Tags - CStdString fullTag = m_tags->GetMatch(0); + std::string fullTag = m_tags->GetMatch(0); StringUtils::ToLower(fullTag); strUTF8.erase(pos, fullTag.length()); if (fullTag == "<b>" || fullTag == "{\\b1}") @@ -93,8 +93,8 @@ void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* lin StringUtils::StartsWith(fullTag, "{\\1c&h")) { m_flag[FLAG_COLOR] = true; - CStdString tempColorTag = "[COLOR FF"; - CStdString tagOptionValue; + std::string tempColorTag = "[COLOR FF"; + std::string tagOptionValue; if (StringUtils::StartsWith(fullTag, "{\\c&h")) tagOptionValue = fullTag.substr(5,6); else @@ -111,13 +111,13 @@ void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* lin int pos2 = 5; while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0) { - CStdString tagOptionName = m_tagOptions->GetMatch(1); - CStdString tagOptionValue = m_tagOptions->GetMatch(2); + std::string tagOptionName = m_tagOptions->GetMatch(1); + std::string tagOptionValue = m_tagOptions->GetMatch(2); pos2 += tagOptionName.length() + tagOptionValue.length(); if (tagOptionName == "color") { m_flag[FLAG_COLOR] = true; - CStdString tempColorTag = "[COLOR "; + std::string tempColorTag = "[COLOR "; if (tagOptionValue[0] == '#') { tagOptionValue.erase(0, 1); @@ -151,8 +151,8 @@ void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* lin int pos2 = 3; while ((pos2 = m_tagOptions->RegFind(fullTag.c_str(), pos2)) >= 0) { - CStdString tagOptionName = m_tagOptions->GetMatch(1); - CStdString tagOptionValue = m_tagOptions->GetMatch(2); + std::string tagOptionName = m_tagOptions->GetMatch(1); + std::string tagOptionValue = m_tagOptions->GetMatch(2); pos2 += tagOptionName.length() + tagOptionValue.length(); if (tagOptionName == "class") { diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.h b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.h index 5a3767160e..05c434257f 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.h +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.h @@ -21,7 +21,8 @@ */ #include <stdio.h> -#include "utils/StdString.h" +#include <string> +#include <vector> #define FLAG_BOLD 0 #define FLAG_ITALIC 1 @@ -52,10 +53,10 @@ public: typedef struct { - CStdString ID; - CStdString Name; - CStdString Lang; - CStdString SAMIType; + std::string ID; + std::string Name; + std::string Lang; + std::string SAMIType; } SLangclass; std::vector<SLangclass> m_Langclass; diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp index 73a7995503..6890c264df 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitlesLibass.cpp @@ -36,7 +36,7 @@ static void libass_log(int level, const char *fmt, va_list args, void *data) { if(level >= 5) return; - CStdString log = StringUtils::FormatV(fmt, args); + std::string log = StringUtils::FormatV(fmt, args); CLog::Log(LOGDEBUG, "CDVDSubtitlesLibass: [ass] %s", log.c_str()); } @@ -55,7 +55,7 @@ CDVDSubtitlesLibass::CDVDSubtitlesLibass() } //Setting the font directory to the temp dir(where mkv fonts are extracted to) - CStdString strPath = "special://temp/fonts/"; + std::string strPath = "special://temp/fonts/"; CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Creating ASS library structure"); m_library = m_dll.ass_library_init(); diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp index e65ee405ca..00f540c81c 100644 --- a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp +++ b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp @@ -316,9 +316,9 @@ double CPullupCorrection::CalcFrameDuration() } //looks pretty in the log -CStdString CPullupCorrection::GetPatternStr() +std::string CPullupCorrection::GetPatternStr() { - CStdString patternstr; + std::string patternstr; for (unsigned int i = 0; i < m_pattern.size(); i++) patternstr += StringUtils::Format("%.2f ", m_pattern[i]); diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.h b/xbmc/cores/dvdplayer/DVDTSCorrection.h index a35fef8e7e..6fa7e51840 100644 --- a/xbmc/cores/dvdplayer/DVDTSCorrection.h +++ b/xbmc/cores/dvdplayer/DVDTSCorrection.h @@ -20,10 +20,9 @@ * */ +#include <string> #include <vector> -#include "utils/StdString.h" - #define DIFFRINGSIZE 120 class CPullupCorrection @@ -66,5 +65,5 @@ class CPullupCorrection double m_frameduration; //frameduration exposed to dvdplayer, used for calculating the fps bool m_haspattern; //for the log int m_patternlength; //for the codec info - CStdString GetPatternStr(); //also for the log + std::string GetPatternStr(); //also for the log }; diff --git a/xbmc/cores/dvdplayer/Edl.cpp b/xbmc/cores/dvdplayer/Edl.cpp index 86cd1d8aa0..0bcfce64e3 100644 --- a/xbmc/cores/dvdplayer/Edl.cpp +++ b/xbmc/cores/dvdplayer/Edl.cpp @@ -66,7 +66,7 @@ void CEdl::Clear() m_iTotalCutTime = 0; } -bool CEdl::ReadEditDecisionLists(const CStdString& strMovie, const float fFrameRate, const int iHeight) +bool CEdl::ReadEditDecisionLists(const std::string& strMovie, const float fFrameRate, const int iHeight) { /* * The frame rate hints returned from ffmpeg for the video stream do not appear to take into @@ -173,11 +173,11 @@ bool CEdl::ReadEditDecisionLists(const CStdString& strMovie, const float fFrameR return bFound; } -bool CEdl::ReadEdl(const CStdString& strMovie, const float fFramesPerSecond) +bool CEdl::ReadEdl(const std::string& strMovie, const float fFramesPerSecond) { Clear(); - CStdString edlFilename(URIUtils::ReplaceExtension(strMovie, ".edl")); + std::string edlFilename(URIUtils::ReplaceExtension(strMovie, ".edl")); if (!CFile::Exists(edlFilename)) return false; @@ -190,11 +190,10 @@ bool CEdl::ReadEdl(const CStdString& strMovie, const float fFramesPerSecond) bool bError = false; int iLine = 0; - CStdString strBuffer; - while (edlFile.ReadString(strBuffer.GetBuffer(1024), 1024)) + std::string strBuffer; + strBuffer.resize(1024); + while (edlFile.ReadString(&strBuffer[0], 1024)) { - strBuffer.ReleaseBuffer(); - // Log any errors from previous run in the loop if (bError) CLog::Log(LOGWARNING, "%s - Error on line %i in EDL file: %s", __FUNCTION__, iLine, edlFilename.c_str()); @@ -206,7 +205,7 @@ bool CEdl::ReadEdl(const CStdString& strMovie, const float fFramesPerSecond) char buffer1[513]; char buffer2[513]; int iAction; - int iFieldsRead = sscanf(strBuffer, "%512s %512s %i", buffer1, + int iFieldsRead = sscanf(strBuffer.c_str(), "%512s %512s %i", buffer1, buffer2, &iAction); if (iFieldsRead != 2 && iFieldsRead != 3) // Make sure we read the right number of fields { @@ -324,8 +323,6 @@ bool CEdl::ReadEdl(const CStdString& strMovie, const float fFramesPerSecond) } } - strBuffer.ReleaseBuffer(); - if (bError) // Log last line warning, if there was one, since while loop will have terminated. CLog::Log(LOGWARNING, "%s - Error on line %i in EDL file: %s", __FUNCTION__, iLine, edlFilename.c_str()); @@ -345,11 +342,11 @@ bool CEdl::ReadEdl(const CStdString& strMovie, const float fFramesPerSecond) } } -bool CEdl::ReadComskip(const CStdString& strMovie, const float fFramesPerSecond) +bool CEdl::ReadComskip(const std::string& strMovie, const float fFramesPerSecond) { Clear(); - CStdString comskipFilename(URIUtils::ReplaceExtension(strMovie, ".txt")); + std::string comskipFilename(URIUtils::ReplaceExtension(strMovie, ".txt")); if (!CFile::Exists(comskipFilename)) return false; @@ -425,7 +422,7 @@ bool CEdl::ReadComskip(const CStdString& strMovie, const float fFramesPerSecond) } } -bool CEdl::ReadVideoReDo(const CStdString& strMovie) +bool CEdl::ReadVideoReDo(const std::string& strMovie) { /* * VideoReDo file is strange. Tags are XML like, but it isn't an XML file. @@ -434,7 +431,7 @@ bool CEdl::ReadVideoReDo(const CStdString& strMovie) */ Clear(); - CStdString videoReDoFilename(URIUtils::ReplaceExtension(strMovie, ".Vprj")); + std::string videoReDoFilename(URIUtils::ReplaceExtension(strMovie, ".Vprj")); if (!CFile::Exists(videoReDoFilename)) return false; @@ -516,11 +513,11 @@ bool CEdl::ReadVideoReDo(const CStdString& strMovie) } } -bool CEdl::ReadBeyondTV(const CStdString& strMovie) +bool CEdl::ReadBeyondTV(const std::string& strMovie) { Clear(); - CStdString beyondTVFilename(URIUtils::ReplaceExtension(strMovie, URIUtils::GetExtension(strMovie) + ".chapters.xml")); + std::string beyondTVFilename(URIUtils::ReplaceExtension(strMovie, URIUtils::GetExtension(strMovie) + ".chapters.xml")); if (!CFile::Exists(beyondTVFilename)) return false; @@ -599,7 +596,7 @@ bool CEdl::ReadBeyondTV(const CStdString& strMovie) } } -bool CEdl::ReadPvr(const CStdString &strMovie) +bool CEdl::ReadPvr(const std::string &strMovie) { if (!PVR::g_PVRManager.IsStarted()) { @@ -785,7 +782,7 @@ bool CEdl::WriteMPlayerEdl() return false; } - CStdString strBuffer; + std::string strBuffer; for (int i = 0; i < (int)m_vecCuts.size(); i++) { /* @@ -808,7 +805,7 @@ bool CEdl::WriteMPlayerEdl() return true; } -CStdString CEdl::GetMPlayerEdl() +std::string CEdl::GetMPlayerEdl() { return MPLAYER_EDL_FILENAME; } @@ -867,9 +864,9 @@ bool CEdl::HasSceneMarker() return !m_vecSceneMarkers.empty(); } -CStdString CEdl::GetInfo() +std::string CEdl::GetInfo() { - CStdString strInfo = ""; + std::string strInfo; if (HasCut()) { int cutCount = 0, muteCount = 0, commBreakCount = 0; @@ -965,14 +962,14 @@ bool CEdl::GetNextSceneMarker(bool bPlus, const int64_t iClock, int64_t *iSceneM return bFound; } -CStdString CEdl::MillisecondsToTimeString(const int64_t iMilliseconds) +std::string CEdl::MillisecondsToTimeString(const int64_t iMilliseconds) { - CStdString strTimeString = StringUtils::SecondsToTimeString((long)(iMilliseconds / 1000), TIME_FORMAT_HH_MM_SS); // milliseconds to seconds + std::string strTimeString = StringUtils::SecondsToTimeString((long)(iMilliseconds / 1000), TIME_FORMAT_HH_MM_SS); // milliseconds to seconds strTimeString += StringUtils::Format(".%03i", iMilliseconds % 1000); return strTimeString; } -bool CEdl::ReadMythCommBreakList(const CStdString& strMovie, const float fFramesPerSecond) +bool CEdl::ReadMythCommBreakList(const std::string& strMovie, const float fFramesPerSecond) { /* * Exists() sets up all the internal bits needed for GetCommBreakList(). @@ -1022,7 +1019,7 @@ bool CEdl::ReadMythCommBreakList(const CStdString& strMovie, const float fFrames } } -bool CEdl::ReadMythCutList(const CStdString& strMovie, const float fFramesPerSecond) +bool CEdl::ReadMythCutList(const std::string& strMovie, const float fFramesPerSecond) { /* * Exists() sets up all the internal bits needed for GetCutList(). diff --git a/xbmc/cores/dvdplayer/Edl.h b/xbmc/cores/dvdplayer/Edl.h index 993192c139..4e6b71f08c 100644 --- a/xbmc/cores/dvdplayer/Edl.h +++ b/xbmc/cores/dvdplayer/Edl.h @@ -20,9 +20,9 @@ * */ +#include <string> #include <vector> #include <stdint.h> -#include "utils/StdString.h" class CEdl { @@ -45,12 +45,12 @@ public: Action action; }; - bool ReadEditDecisionLists(const CStdString& strMovie, const float fFramesPerSecond, const int iHeight); + bool ReadEditDecisionLists(const std::string& strMovie, const float fFramesPerSecond, const int iHeight); void Clear(); bool HasCut(); bool HasSceneMarker(); - CStdString GetInfo(); + std::string GetInfo(); int64_t GetTotalCutTime(); int64_t RemoveCutTime(int64_t iSeek); int64_t RestoreCutTime(int64_t iClock); @@ -59,9 +59,9 @@ public: bool GetNextSceneMarker(bool bPlus, const int64_t iClock, int64_t *iSceneMarker); - static CStdString GetMPlayerEdl(); + static std::string GetMPlayerEdl(); - static CStdString MillisecondsToTimeString(const int64_t iMilliseconds); + static std::string MillisecondsToTimeString(const int64_t iMilliseconds); protected: private: @@ -69,13 +69,13 @@ private: std::vector<Cut> m_vecCuts; std::vector<int64_t> m_vecSceneMarkers; - bool ReadEdl(const CStdString& strMovie, const float fFramesPerSecond); - bool ReadComskip(const CStdString& strMovie, const float fFramesPerSecond); - bool ReadVideoReDo(const CStdString& strMovie); - bool ReadBeyondTV(const CStdString& strMovie); - bool ReadPvr(const CStdString& strMovie); - bool ReadMythCommBreakList(const CStdString& strMovie, const float fFramesPerSecond); - bool ReadMythCutList(const CStdString& strMovie, const float fFramesPerSecond); + bool ReadEdl(const std::string& strMovie, const float fFramesPerSecond); + bool ReadComskip(const std::string& strMovie, const float fFramesPerSecond); + bool ReadVideoReDo(const std::string& strMovie); + bool ReadBeyondTV(const std::string& strMovie); + bool ReadPvr(const std::string& strMovie); + bool ReadMythCommBreakList(const std::string& strMovie, const float fFramesPerSecond); + bool ReadMythCutList(const std::string& strMovie, const float fFramesPerSecond); bool AddCut(Cut& NewCut); bool AddSceneMarker(const int64_t sceneMarker); diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp index 6e20ead81b..5889365440 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp @@ -86,7 +86,7 @@ void COMXImage::Deinitialize() } bool COMXImage::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const CStdString& destFile) + unsigned int format, unsigned int pitch, const std::string& destFile) { COMXImageEnc omxImageEnc; bool ret = omxImageEnc.CreateThumbnailFromSurface(buffer, width, height, format, pitch, destFile); @@ -95,7 +95,7 @@ bool COMXImage::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int w return ret; } -COMXImageFile *COMXImage::LoadJpeg(const CStdString& texturePath) +COMXImageFile *COMXImage::LoadJpeg(const std::string& texturePath) { COMXImageFile *file = new COMXImageFile(); if (!file->ReadFile(texturePath)) @@ -177,7 +177,7 @@ bool COMXImage::ClampLimits(unsigned int &width, unsigned int &height, unsigned return clamped; } -bool COMXImage::CreateThumb(const CStdString& srcFile, unsigned int maxHeight, unsigned int maxWidth, std::string &additional_info, const CStdString& destFile) +bool COMXImage::CreateThumb(const std::string& srcFile, unsigned int maxHeight, unsigned int maxWidth, std::string &additional_info, const std::string& destFile) { bool okay = false; COMXImageFile file; @@ -854,7 +854,7 @@ OMX_IMAGE_CODINGTYPE COMXImageFile::GetCodingType(unsigned int &width, unsigned } -bool COMXImageFile::ReadFile(const CStdString& inputFile) +bool COMXImageFile::ReadFile(const std::string& inputFile) { XFILE::CFile m_pFile; m_filename = inputFile.c_str(); @@ -1387,7 +1387,7 @@ bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsig } bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const CStdString& destFile) + unsigned int format, unsigned int pitch, const std::string& destFile) { if(format != XB_FMT_A8R8G8B8 || !buffer) { diff --git a/xbmc/cores/omxplayer/OMXImage.h b/xbmc/cores/omxplayer/OMXImage.h index 3b30741158..95181903f4 100644 --- a/xbmc/cores/omxplayer/OMXImage.h +++ b/xbmc/cores/omxplayer/OMXImage.h @@ -65,14 +65,14 @@ public: virtual ~COMXImage(); void Initialize(); void Deinitialize(); - static COMXImageFile *LoadJpeg(const CStdString& texturePath); + static COMXImageFile *LoadJpeg(const std::string& texturePath); static void CloseJpeg(COMXImageFile *file); static bool DecodeJpeg(COMXImageFile *file, unsigned int maxWidth, unsigned int maxHeight, unsigned int stride, void *pixels); static bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const CStdString& destFile); + unsigned int format, unsigned int pitch, const std::string& destFile); static bool ClampLimits(unsigned int &width, unsigned int &height, unsigned int m_width, unsigned int m_height, bool transposed = false); - static bool CreateThumb(const CStdString& srcFile, unsigned int width, unsigned int height, std::string &additional_info, const CStdString& destFile); + static bool CreateThumb(const std::string& srcFile, unsigned int width, unsigned int height, std::string &additional_info, const std::string& destFile); bool SendMessage(bool (*callback)(EGLDisplay egl_display, EGLContext egl_context, void *cookie), void *cookie); bool DecodeJpegToTexture(COMXImageFile *file, unsigned int width, unsigned int height, void **userdata); void DestroyTexture(void *userdata); @@ -94,7 +94,7 @@ class COMXImageFile public: COMXImageFile(); virtual ~COMXImageFile(); - bool ReadFile(const CStdString& inputFile); + bool ReadFile(const std::string& inputFile); int GetOrientation() { return m_orientation; }; unsigned int GetWidth() { return m_width; }; unsigned int GetHeight() { return m_height; }; @@ -142,7 +142,7 @@ public: // Required overrides bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, - unsigned int format, unsigned int pitch, const CStdString& destFile); + unsigned int format, unsigned int pitch, const std::string& destFile); protected: bool Encode(unsigned char *buffer, int size, unsigned int width, unsigned int height, unsigned int pitch); // Components diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp index e854d6c759..ab651b9494 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp @@ -234,7 +234,7 @@ static bool PredicateAudioPriority(const OMXSelectionStream& lh, const OMXSelect if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.audiolanguage"), "original")) { - CStdString audio_language = g_langInfo.GetAudioLanguage(); + std::string audio_language = g_langInfo.GetAudioLanguage(); PREDICATE_RETURN(g_LangCodeExpander.CompareLangCodes(audio_language, lh.language) , g_LangCodeExpander.CompareLangCodes(audio_language, rh.language)); } @@ -306,7 +306,7 @@ public: , rh.flags & CDemuxStream::FLAG_FORCED); } - CStdString subtitle_language = g_langInfo.GetSubtitleLanguage(); + std::string subtitle_language = g_langInfo.GetSubtitleLanguage(); if(!original) { PREDICATE_RETURN((STREAM_SOURCE_MASK(lh.source) == STREAM_SOURCE_DEMUX_SUB || STREAM_SOURCE_MASK(lh.source) == STREAM_SOURCE_TEXT) && g_LangCodeExpander.CompareLangCodes(subtitle_language, lh.language) @@ -506,7 +506,7 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer) s.flags = stream->flags; s.filename = demuxer->GetFileName(); stream->GetStreamName(s.name); - CStdString codec; + std::string codec; demuxer->GetStreamCodecName(stream->iId, codec); s.codec = codec; s.channels = 0; // Default to 0. Overwrite if STREAM_AUDIO below. @@ -682,8 +682,8 @@ bool COMXPlayer::OpenInputStream() CLog::Log(LOGNOTICE, "Creating InputStream"); // correct the filename if needed - CStdString filename(m_filename); - if (StringUtils::StartsWith(filename, "dvd://") + std::string filename(m_filename); + if (URIUtils::IsProtocol(filename, "dvd") || StringUtils::EqualsNoCase(filename, "iso9660://video_ts/video_ts.ifo")) { m_filename = g_mediaManager.TranslateDevicePath(""); @@ -721,7 +721,7 @@ bool COMXPlayer::OpenInputStream() CUtil::ScanForExternalSubtitles( m_filename, filenames ); // find any upnp subtitles - CStdString key("upnp:subtitle:1"); + std::string key("upnp:subtitle:1"); for(unsigned s = 1; m_item.HasProperty(key); key = StringUtils::Format("upnp:subtitle:%u", ++s)) filenames.push_back(m_item.GetProperty(key).asString()); @@ -730,7 +730,7 @@ bool COMXPlayer::OpenInputStream() // if vobsub subtitle: if (URIUtils::HasExtension(filenames[i], ".idx")) { - CStdString strSubFile; + std::string strSubFile; if ( CUtil::FindVobSubPair( filenames, filenames[i], strSubFile ) ) AddSubtitleFile(filenames[i], strSubFile); } @@ -2900,7 +2900,7 @@ bool COMXPlayer::SeekScene(bool bPlus) return false; } -void COMXPlayer::GetAudioInfo(CStdString &strAudioInfo) +void COMXPlayer::GetAudioInfo(std::string &strAudioInfo) { { CSingleLock lock(m_StateSection); strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str()); @@ -2908,7 +2908,7 @@ void COMXPlayer::GetAudioInfo(CStdString &strAudioInfo) strAudioInfo += StringUtils::Format("\nP(%s)", m_omxPlayerAudio.GetPlayerInfo().c_str()); } -void COMXPlayer::GetVideoInfo(CStdString &strVideoInfo) +void COMXPlayer::GetVideoInfo(std::string &strVideoInfo) { { CSingleLock lock(m_StateSection); strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str()); @@ -2916,7 +2916,7 @@ void COMXPlayer::GetVideoInfo(CStdString &strVideoInfo) strVideoInfo += StringUtils::Format("\nP(%s)", m_omxPlayerVideo.GetPlayerInfo().c_str()); } -void COMXPlayer::GetGeneralInfo(CStdString& strGeneralInfo) +void COMXPlayer::GetGeneralInfo(std::string& strGeneralInfo) { if (!m_bStop) { @@ -2927,9 +2927,9 @@ void COMXPlayer::GetGeneralInfo(CStdString& strGeneralInfo) if( apts != DVD_NOPTS_VALUE && vpts != DVD_NOPTS_VALUE ) dDiff = (apts - vpts) / DVD_TIME_BASE; - CStdString strEDL = StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str()); + std::string strEDL = StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str()); - CStdString strBuf; + std::string strBuf; CSingleLock lock(m_StateSection); if(m_StateInput.cache_bytes >= 0) { @@ -4106,13 +4106,13 @@ bool COMXPlayer::HasMenu() return false; } -CStdString COMXPlayer::GetPlayerState() +std::string COMXPlayer::GetPlayerState() { CSingleLock lock(m_StateSection); return m_State.player_state; } -bool COMXPlayer::SetPlayerState(CStdString state) +bool COMXPlayer::SetPlayerState(std::string state) { m_messenger.Put(new CDVDMsgPlayerSetState(state)); return true; @@ -4130,7 +4130,7 @@ int COMXPlayer::GetChapter() return m_State.chapter; } -void COMXPlayer::GetChapterName(CStdString& strChapterName) +void COMXPlayer::GetChapterName(std::string& strChapterName) { CSingleLock lock(m_StateSection); strChapterName = m_State.chapter_name; @@ -4153,7 +4153,7 @@ int COMXPlayer::SeekChapter(int iChapter) return 0; } -int COMXPlayer::AddSubtitle(const CStdString& strSubPath) +int COMXPlayer::AddSubtitle(const std::string& strSubPath) { return AddSubtitleFile(strSubPath); } @@ -4175,7 +4175,7 @@ void COMXPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info) { info.bitrate = m_omxPlayerVideo.GetVideoBitrate(); - CStdString retVal; + std::string retVal; if (m_pDemuxer && (m_CurrentVideo.id != -1)) { m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal); @@ -4232,7 +4232,7 @@ void COMXPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info) if (stream) { info.channels = stream->iChannels; - CStdString codecName; + std::string codecName; m_pDemuxer->GetStreamCodecName(stream->iId, codecName); info.audioCodecName = codecName; } @@ -4512,7 +4512,7 @@ bool COMXPlayer::GetStreamDetails(CStreamDetails &details) return false; } -CStdString COMXPlayer::GetPlayingTitle() +std::string COMXPlayer::GetPlayingTitle() { /* Currently we support only Title Name from Teletext line 30 */ TextCacheStruct_t* ttcache = m_dvdPlayerTeletext.GetTeletextCache(); diff --git a/xbmc/cores/omxplayer/OMXPlayer.h b/xbmc/cores/omxplayer/OMXPlayer.h index 778aa123f3..05d91dc82c 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.h +++ b/xbmc/cores/omxplayer/OMXPlayer.h @@ -189,9 +189,9 @@ public: virtual void SetMute(bool bOnOff) { m_omxPlayerAudio.SetMute(bOnOff); } virtual void SetDynamicRangeCompression(long drc) { m_omxPlayerAudio.SetDynamicRangeCompression(drc); } virtual bool ControlsVolume() {return true;} - virtual void GetAudioInfo(CStdString &strAudioInfo); - virtual void GetVideoInfo(CStdString &strVideoInfo); - virtual void GetGeneralInfo(CStdString &strVideoInfo); + virtual void GetAudioInfo(std::string &strAudioInfo); + virtual void GetVideoInfo(std::string &strVideoInfo); + virtual void GetGeneralInfo(std::string &strVideoInfo); virtual bool CanRecord(); virtual bool IsRecording(); virtual bool CanPause(); @@ -207,7 +207,7 @@ public: virtual void SetSubtitle(int iStream); virtual bool GetSubtitleVisible(); virtual void SetSubtitleVisible(bool bVisible); - virtual int AddSubtitle(const CStdString& strSubPath); + virtual int AddSubtitle(const std::string& strSubPath); virtual int GetAudioStreamCount(); virtual int GetAudioStream(); @@ -218,7 +218,7 @@ public: virtual int GetChapterCount(); virtual int GetChapter(); - virtual void GetChapterName(CStdString& strChapterName); + virtual void GetChapterName(std::string& strChapterName); virtual int SeekChapter(int iChapter); virtual void SeekTime(int64_t iTime); @@ -233,10 +233,10 @@ public: virtual bool GetStreamDetails(CStreamDetails &details); virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info); - virtual CStdString GetPlayerState(); - virtual bool SetPlayerState(CStdString state); + virtual std::string GetPlayerState(); + virtual bool SetPlayerState(std::string state); - virtual CStdString GetPlayingTitle(); + virtual std::string GetPlayingTitle(); virtual bool SwitchChannel(const PVR::CPVRChannel &channel); virtual bool CachePVRStream(void) const; @@ -390,7 +390,7 @@ protected: CDVDDemux* m_pDemuxer; // demuxer for current playing file CDVDDemux* m_pSubtitleDemuxer; - CStdString m_lastSub; + std::string m_lastSub; struct SDVDInfo { diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.h b/xbmc/cores/omxplayer/OMXPlayerAudio.h index 57af63ccec..795e91f671 100644 --- a/xbmc/cores/omxplayer/OMXPlayerAudio.h +++ b/xbmc/cores/omxplayer/OMXPlayerAudio.h @@ -24,8 +24,6 @@ #include <deque> #include <sys/types.h> -#include "utils/StdString.h" - #include "OMXClock.h" #include "DVDStreamInfo.h" #include "OMXAudio.h" diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.h b/xbmc/cores/omxplayer/OMXPlayerVideo.h index 0e5d488f6c..9a74ccc85a 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.h +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.h @@ -24,8 +24,6 @@ #include <deque> #include <sys/types.h> -#include "utils/StdString.h" - #include "OMXClock.h" #include "DVDStreamInfo.h" #include "OMXVideo.h" diff --git a/xbmc/cores/paplayer/ASAPCodec.cpp b/xbmc/cores/paplayer/ASAPCodec.cpp index 1a696cf308..977869223c 100644 --- a/xbmc/cores/paplayer/ASAPCodec.cpp +++ b/xbmc/cores/paplayer/ASAPCodec.cpp @@ -32,16 +32,16 @@ ASAPCodec::~ASAPCodec() { } -bool ASAPCodec::Init(const CStdString &strFile, unsigned int filecache) +bool ASAPCodec::Init(const std::string &strFile, unsigned int filecache) { if (!m_dll.Load()) return false; - CStdString strFileToLoad = strFile; + std::string strFileToLoad = strFile; int song = -1; if (URIUtils::HasExtension(strFile, ".asapstream")) { - CStdString strFileName = URIUtils::GetFileName(strFile); + std::string strFileName = URIUtils::GetFileName(strFile); size_t iStart = strFileName.rfind('-') + 1; song = atoi(strFileName.substr(iStart, strFileName.size() - iStart - 11).c_str()) - 1; strFileToLoad = URIUtils::GetDirectory(strFile); @@ -81,11 +81,11 @@ bool ASAPCodec::CanInit() return m_dll.CanLoad(); } -bool ASAPCodec::IsSupportedFormat(const CStdString &strExt) +bool ASAPCodec::IsSupportedFormat(const std::string &strExt) { if(strExt.empty()) return false; - CStdString ext = strExt; + std::string ext = strExt; if (ext[0] == '.') ext.erase(0, 1); return ext == "sap" diff --git a/xbmc/cores/paplayer/ASAPCodec.h b/xbmc/cores/paplayer/ASAPCodec.h index 5e2feb8bfe..bf4e126043 100644 --- a/xbmc/cores/paplayer/ASAPCodec.h +++ b/xbmc/cores/paplayer/ASAPCodec.h @@ -30,13 +30,13 @@ public: ASAPCodec(); virtual ~ASAPCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); virtual bool CanInit(); - static bool IsSupportedFormat(const CStdString &strExt); + static bool IsSupportedFormat(const std::string &strExt); private: DllASAP m_dll; diff --git a/xbmc/cores/paplayer/CodecFactory.cpp b/xbmc/cores/paplayer/CodecFactory.cpp index 7b3e840613..e4c8a2b309 100644 --- a/xbmc/cores/paplayer/CodecFactory.cpp +++ b/xbmc/cores/paplayer/CodecFactory.cpp @@ -38,118 +38,124 @@ #include "PCMCodec.h" #include "utils/StringUtils.h" -ICodec* CodecFactory::CreateCodec(const CStdString& strFileType) +ICodec* CodecFactory::CreateCodec(const std::string& strFileType) { - if (strFileType.Equals("mp3") || strFileType.Equals("mp2")) + std::string fileType = strFileType; + StringUtils::ToLower(fileType); + if (fileType == "mp3" || fileType == "mp2") return new DVDPlayerCodec(); - else if (strFileType.Equals("pcm") || strFileType.Equals("l16")) + else if (fileType == "pcm" || fileType == "l16") return new PCMCodec(); - else if (strFileType.Equals("ape") || strFileType.Equals("mac")) + else if (fileType == "ape" || fileType == "mac") return new DVDPlayerCodec(); - else if (strFileType.Equals("cdda")) + else if (fileType == "cdda") return new DVDPlayerCodec(); - else if (strFileType.Equals("mpc") || strFileType.Equals("mp+") || strFileType.Equals("mpp")) + else if (fileType == "mpc" || fileType == "mp+" || fileType == "mpp") return new DVDPlayerCodec(); - else if (strFileType.Equals("shn")) + else if (fileType == "shn") return new DVDPlayerCodec(); - else if (strFileType.Equals("mka")) + else if (fileType == "mka") return new DVDPlayerCodec(); - else if (strFileType.Equals("flac")) + else if (fileType == "flac") return new DVDPlayerCodec(); - else if (strFileType.Equals("wav")) + else if (fileType == "wav") return new DVDPlayerCodec(); - else if (strFileType.Equals("dts") || strFileType.Equals("ac3") || - strFileType.Equals("m4a") || strFileType.Equals("aac") || - strFileType.Equals("pvr")) + else if (fileType == "dts" || fileType == "ac3" || + fileType == "m4a" || fileType == "aac" || + fileType == "pvr") return new DVDPlayerCodec(); - else if (strFileType.Equals("wv")) + else if (fileType == "wv") return new DVDPlayerCodec(); - else if (strFileType.Equals("669") || strFileType.Equals("abc") || - strFileType.Equals("amf") || strFileType.Equals("ams") || - strFileType.Equals("dbm") || strFileType.Equals("dmf") || - strFileType.Equals("dsm") || strFileType.Equals("far") || - strFileType.Equals("it") || strFileType.Equals("j2b") || - strFileType.Equals("mdl") || strFileType.Equals("med") || - strFileType.Equals("mod") || strFileType.Equals("itgz")|| - strFileType.Equals("mt2") || strFileType.Equals("mtm") || - strFileType.Equals("okt") || strFileType.Equals("pat") || - strFileType.Equals("psm") || strFileType.Equals("ptm") || - strFileType.Equals("s3m") || strFileType.Equals("stm") || - strFileType.Equals("ult") || strFileType.Equals("umx") || - strFileType.Equals("xm") || strFileType.Equals("mdgz") || - strFileType.Equals("s3gz") || strFileType.Equals("xmgz")) + else if (fileType == "669" || fileType == "abc" || + fileType == "amf" || fileType == "ams" || + fileType == "dbm" || fileType == "dmf" || + fileType == "dsm" || fileType == "far" || + fileType == "it" || fileType == "j2b" || + fileType == "mdl" || fileType == "med" || + fileType == "mod" || fileType == "itgz"|| + fileType == "mt2" || fileType == "mtm" || + fileType == "okt" || fileType == "pat" || + fileType == "psm" || fileType == "ptm" || + fileType == "s3m" || fileType == "stm" || + fileType == "ult" || fileType == "umx" || + fileType == "xm" || fileType == "mdgz" || + fileType == "s3gz" || fileType == "xmgz") return new ModplugCodec(); - else if (strFileType.Equals("nsf") || strFileType.Equals("nsfstream")) + else if (fileType == "nsf" || fileType == "nsfstream") return new NSFCodec(); #ifdef HAS_SPC_CODEC - else if (strFileType.Equals("spc")) + else if (fileType == "spc") return new SPCCodec(); #endif - else if (strFileType.Equals("sid") || strFileType.Equals("sidstream")) + else if (fileType == "sid" || fileType == "sidstream") return new SIDCodec(); else if (VGMCodec::IsSupportedFormat(strFileType)) return new VGMCodec(); - else if (strFileType.Equals("ym")) + else if (fileType == "ym") return new YMCodec(); - else if (strFileType.Equals("wma")) + else if (fileType == "wma") return new DVDPlayerCodec(); - else if (strFileType.Equals("aiff") || strFileType.Equals("aif")) + else if (fileType == "aiff" || fileType == "aif") return new DVDPlayerCodec(); - else if (strFileType.Equals("xwav")) + else if (fileType == "xwav") return new DVDPlayerCodec(); else if (TimidityCodec::IsSupportedFormat(strFileType)) return new TimidityCodec(); #ifdef HAS_ASAP_CODEC - else if (ASAPCodec::IsSupportedFormat(strFileType) || strFileType.Equals("asapstream")) + else if (ASAPCodec::IsSupportedFormat(strFileType) || fileType == "asapstream") return new ASAPCodec(); #endif - else if (strFileType.Equals("tta")) + else if (fileType == "tta") return new DVDPlayerCodec(); - else if (strFileType.Equals("tak")) + else if (fileType == "tak") return new DVDPlayerCodec(); return NULL; } -ICodec* CodecFactory::CreateCodecDemux(const CStdString& strFile, const CStdString& strContent, unsigned int filecache) +ICodec* CodecFactory::CreateCodecDemux(const std::string& strFile, const std::string& strContent, unsigned int filecache) { CURL urlFile(strFile); - if( strContent.Equals("audio/mpeg") - || strContent.Equals("audio/mpeg3") - || strContent.Equals("audio/mp3") ) + std::string content = strContent; + StringUtils::ToLower(content); + if( content == "audio/mpeg" + || content == "audio/mpeg3" + || content == "audio/mp3" ) { DVDPlayerCodec *dvdcodec = new DVDPlayerCodec(); - dvdcodec->SetContentType(strContent); + dvdcodec->SetContentType(content); return dvdcodec; } - else if (StringUtils::StartsWithNoCase(strContent, "audio/l16")) + else if (StringUtils::StartsWith(content, "audio/l16")) { PCMCodec * pcm_codec = new PCMCodec(); pcm_codec->SetMimeParams(strContent); return pcm_codec; } - else if( strContent.Equals("audio/aac") || strContent.Equals("audio/aacp") || - strContent.Equals("audio/x-ms-wma") || - strContent.Equals("audio/x-ape") || strContent.Equals("audio/ape")) + else if(content == "audio/aac" || + content == "audio/aacp" || + content == "audio/x-ms-wma" || + content == "audio/x-ape" || + content == "audio/ape") { DVDPlayerCodec *pCodec = new DVDPlayerCodec; - pCodec->SetContentType(strContent); + pCodec->SetContentType(content); return pCodec; } - else if( strContent.Equals("application/ogg") || strContent.Equals("audio/ogg")) + else if( content == "application/ogg" || content == "audio/ogg") return CreateOGGCodec(strFile,filecache); - else if (strContent.Equals("audio/x-xbmc-pcm")) + else if (content == "audio/x-xbmc-pcm") { // audio/x-xbmc-pcm this is the used codec for AirTunes // (apples audio only streaming) DVDPlayerCodec *dvdcodec = new DVDPlayerCodec(); - dvdcodec->SetContentType(strContent); + dvdcodec->SetContentType(content); return dvdcodec; } - else if (strContent.Equals("audio/flac") || strContent.Equals("audio/x-flac") || strContent.Equals("application/x-flac")) + else if (content == "audio/flac" || content == "audio/x-flac" || content == "application/x-flac") { DVDPlayerCodec *dvdcodec = new DVDPlayerCodec(); - dvdcodec->SetContentType(strContent); + dvdcodec->SetContentType(content); return dvdcodec; } @@ -160,7 +166,9 @@ ICodec* CodecFactory::CreateCodecDemux(const CStdString& strFile, const CStdStri return dvdcodec; // if we got this far with internet radio - content-type was wrong. gamble on mp3. } - if (urlFile.IsFileType("wav") || strContent.Equals("audio/wav") || strContent.Equals("audio/x-wav")) + if (urlFile.IsFileType("wav") || + content == "audio/wav" || + content == "audio/x-wav") { //lets see what it contains... //this kinda sucks 'cause if it's a plain wav file the file @@ -174,7 +182,7 @@ ICodec* CodecFactory::CreateCodecDemux(const CStdString& strFile, const CStdStri } dvdcodec = new DVDPlayerCodec(); - dvdcodec->SetContentType(strContent); + dvdcodec->SetContentType(content); return dvdcodec; } @@ -185,7 +193,7 @@ ICodec* CodecFactory::CreateCodecDemux(const CStdString& strFile, const CStdStri return CreateCodec(urlFile.GetFileType()); } -ICodec* CodecFactory::CreateOGGCodec(const CStdString& strFile, +ICodec* CodecFactory::CreateOGGCodec(const std::string& strFile, unsigned int filecache) { // oldnemesis: we want to use OGGCodec() for OGG music since unlike DVDCodec diff --git a/xbmc/cores/paplayer/CodecFactory.h b/xbmc/cores/paplayer/CodecFactory.h index 50a1d5d0d4..77cad13eb4 100644 --- a/xbmc/cores/paplayer/CodecFactory.h +++ b/xbmc/cores/paplayer/CodecFactory.h @@ -28,9 +28,9 @@ public: CodecFactory() {} virtual ~CodecFactory() {} - static ICodec* CreateCodec(const CStdString& strFileType); - static ICodec* CreateCodecDemux(const CStdString& strFile, const CStdString& strContent,unsigned int filecache); + static ICodec* CreateCodec(const std::string& strFileType); + static ICodec* CreateCodecDemux(const std::string& strFile, const std::string& strContent,unsigned int filecache); private: - static ICodec* CreateOGGCodec(const CStdString& strFile, unsigned int filecache); + static ICodec* CreateOGGCodec(const std::string& strFile, unsigned int filecache); }; diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.cpp b/xbmc/cores/paplayer/DVDPlayerCodec.cpp index 31bc974f2f..ee43091916 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.cpp +++ b/xbmc/cores/paplayer/DVDPlayerCodec.cpp @@ -31,6 +31,7 @@ #include "utils/log.h" #include "settings/Settings.h" #include "URL.h" +#include "utils/StringUtils.h" #include "AudioDecoder.h" @@ -56,12 +57,13 @@ DVDPlayerCodec::~DVDPlayerCodec() DeInit(); } -void DVDPlayerCodec::SetContentType(const CStdString &strContent) +void DVDPlayerCodec::SetContentType(const std::string &strContent) { m_strContentType = strContent; + StringUtils::ToLower(m_strContentType); } -bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache) +bool DVDPlayerCodec::Init(const std::string &strFile, unsigned int filecache) { // take precaution if Init()ialized earlier if (m_bInited) @@ -76,7 +78,7 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache) m_nDecodedLen = 0; - CStdString strFileToOpen = strFile; + std::string strFileToOpen = strFile; CURL urlFile(strFile); if (urlFile.GetProtocol() == "shout" ) @@ -161,12 +163,14 @@ bool DVDPlayerCodec::Init(const CStdString &strFile, unsigned int filecache) // Extract ReplayGain info // tagLoaderTagLib.Load will try to determine tag type by file extension, so set fallback by contentType - CStdString strFallbackFileExtension = ""; - if (m_strContentType.Equals("audio/aacp") || m_strContentType.Equals("audio/aacp" "audio/aac")) + std::string strFallbackFileExtension = ""; + if (m_strContentType == "audio/aacp" || + m_strContentType == "audio/aac") strFallbackFileExtension = "m4a"; - else if (m_strContentType.Equals("audio/x-ms-wma")) + else if (m_strContentType == "audio/x-ms-wma") strFallbackFileExtension = "wma"; - else if (m_strContentType.Equals("audio/x-ape") || m_strContentType.Equals("audio/ape")) + else if (m_strContentType == "audio/x-ape" || + m_strContentType == "audio/ape") strFallbackFileExtension = "ape"; CTagLoaderTagLib tagLoaderTagLib; tagLoaderTagLib.Load(strFile, m_tag, strFallbackFileExtension); diff --git a/xbmc/cores/paplayer/DVDPlayerCodec.h b/xbmc/cores/paplayer/DVDPlayerCodec.h index 8b594f8746..469e2ffaa1 100644 --- a/xbmc/cores/paplayer/DVDPlayerCodec.h +++ b/xbmc/cores/paplayer/DVDPlayerCodec.h @@ -38,7 +38,7 @@ public: DVDPlayerCodec(); virtual ~DVDPlayerCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); @@ -46,7 +46,7 @@ public: virtual bool CanSeek(); virtual CAEChannelInfo GetChannelInfo() {return m_ChannelInfo;} - void SetContentType(const CStdString &strContent); + void SetContentType(const std::string &strContent); bool NeedConvert(AEDataFormat fmt); @@ -55,7 +55,7 @@ private: CDVDInputStream* m_pInputStream; CDVDAudioCodec* m_pAudioCodec; - CStdString m_strContentType; + std::string m_strContentType; std::string m_strFileName; diff --git a/xbmc/cores/paplayer/ICodec.h b/xbmc/cores/paplayer/ICodec.h index eee7d86cbd..e5755bb094 100644 --- a/xbmc/cores/paplayer/ICodec.h +++ b/xbmc/cores/paplayer/ICodec.h @@ -20,12 +20,13 @@ * */ -#include "utils/StdString.h" #include "filesystem/File.h" #include "music/tags/MusicInfoTag.h" #include "cores/AudioEngine/Utils/AEAudioFormat.h" +#include <string> + #define READ_EOF -1 #define READ_SUCCESS 0 #define READ_ERROR 1 @@ -57,7 +58,7 @@ public: // 2. If it's using a filereader, initialize it with the appropriate cache size. // 3. Load the file (or at least attempt to load it) // 4. Fill in the m_TotalTime, m_SampleRate, m_BitsPerSample and m_Channels parameters. - virtual bool Init(const CStdString &strFile, unsigned int filecache)=0; + virtual bool Init(const std::string &strFile, unsigned int filecache)=0; // DeInit() // Should just cleanup anything as necessary. No need to free buffers here if they @@ -105,7 +106,7 @@ public: int m_BitsPerCodedSample; enum AEDataFormat m_DataFormat; int m_Bitrate; - CStdString m_CodecName; + std::string m_CodecName; MUSIC_INFO::CMusicInfoTag m_tag; XFILE::CFile m_file; diff --git a/xbmc/cores/paplayer/ModplugCodec.cpp b/xbmc/cores/paplayer/ModplugCodec.cpp index dfb6dd5b61..6d790c988f 100644 --- a/xbmc/cores/paplayer/ModplugCodec.cpp +++ b/xbmc/cores/paplayer/ModplugCodec.cpp @@ -39,7 +39,7 @@ ModplugCodec::~ModplugCodec() DeInit(); } -bool ModplugCodec::Init(const CStdString &strFile, unsigned int filecache) +bool ModplugCodec::Init(const std::string &strFile, unsigned int filecache) { DeInit(); diff --git a/xbmc/cores/paplayer/ModplugCodec.h b/xbmc/cores/paplayer/ModplugCodec.h index b2f7496c56..9bea4a089e 100644 --- a/xbmc/cores/paplayer/ModplugCodec.h +++ b/xbmc/cores/paplayer/ModplugCodec.h @@ -29,7 +29,7 @@ public: ModplugCodec(); virtual ~ModplugCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/paplayer/NSFCodec.cpp b/xbmc/cores/paplayer/NSFCodec.cpp index 25e530d103..9ced1f1b88 100644 --- a/xbmc/cores/paplayer/NSFCodec.cpp +++ b/xbmc/cores/paplayer/NSFCodec.cpp @@ -40,19 +40,19 @@ NSFCodec::~NSFCodec() DeInit(); } -bool NSFCodec::Init(const CStdString &strFile, unsigned int filecache) +bool NSFCodec::Init(const std::string &strFile, unsigned int filecache) { DeInit(); if (!m_dll.Load()) return false; // error logged previously - CStdString strFileToLoad = strFile; + std::string strFileToLoad = strFile; m_iTrack = 0; if (URIUtils::HasExtension(strFile, ".nsfstream")) { // Extract the track to play - CStdString strFileName=URIUtils::GetFileName(strFile); + std::string strFileName=URIUtils::GetFileName(strFile); size_t iStart=strFileName.rfind('-') + 1; m_iTrack = atoi(strFileName.substr(iStart, strFileName.size()-iStart-10).c_str()); // The directory we are in, is the file diff --git a/xbmc/cores/paplayer/NSFCodec.h b/xbmc/cores/paplayer/NSFCodec.h index bd381647d5..c81197e914 100644 --- a/xbmc/cores/paplayer/NSFCodec.h +++ b/xbmc/cores/paplayer/NSFCodec.h @@ -30,7 +30,7 @@ public: NSFCodec(); virtual ~NSFCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/paplayer/OGGcodec.cpp b/xbmc/cores/paplayer/OGGcodec.cpp index 630078e7c5..bccd28c98c 100644 --- a/xbmc/cores/paplayer/OGGcodec.cpp +++ b/xbmc/cores/paplayer/OGGcodec.cpp @@ -45,11 +45,11 @@ OGGCodec::~OGGCodec() DeInit(); } -bool OGGCodec::Init(const CStdString &strFile1, unsigned int filecache) +bool OGGCodec::Init(const std::string &strFile1, unsigned int filecache) { if (m_inited) return true; - CStdString strFile=strFile1; + std::string strFile=strFile1; if (!m_dll.Load()) return false; @@ -59,7 +59,7 @@ bool OGGCodec::Init(const CStdString &strFile1, unsigned int filecache) if (URIUtils::HasExtension(strFile, ".oggstream")) { // Extract the bitstream to play - CStdString strFileName=URIUtils::GetFileName(strFile); + std::string strFileName=URIUtils::GetFileName(strFile); size_t iStart = strFileName.rfind('-') + 1; m_CurrentStream = atoi(strFileName.substr(iStart, strFileName.size()-iStart-10).c_str())-1; // The directory we are in, is the file diff --git a/xbmc/cores/paplayer/OGGcodec.h b/xbmc/cores/paplayer/OGGcodec.h index a5064af1b0..392079140b 100644 --- a/xbmc/cores/paplayer/OGGcodec.h +++ b/xbmc/cores/paplayer/OGGcodec.h @@ -30,7 +30,7 @@ public: OGGCodec(); virtual ~OGGCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/paplayer/OggCallback.cpp b/xbmc/cores/paplayer/OggCallback.cpp index cab1d3a71a..6b26008e79 100644 --- a/xbmc/cores/paplayer/OggCallback.cpp +++ b/xbmc/cores/paplayer/OggCallback.cpp @@ -25,7 +25,7 @@ COggCallback::COggCallback(XFILE::CFile& file) : m_file(file) { } -ov_callbacks COggCallback::Get(const CStdString& strFile) +ov_callbacks COggCallback::Get(const std::string& strFile) { // libvorbis requires that a non-seekable stream would always return -1 from seek actions. // so for network streams - tweak the seek method to a static one that always return -1. diff --git a/xbmc/cores/paplayer/OggCallback.h b/xbmc/cores/paplayer/OggCallback.h index 254dacc54e..8e42bd60c3 100644 --- a/xbmc/cores/paplayer/OggCallback.h +++ b/xbmc/cores/paplayer/OggCallback.h @@ -28,7 +28,7 @@ class COggCallback public: COggCallback(XFILE::CFile& file); - static ov_callbacks Get(const CStdString& strFile); + static ov_callbacks Get(const std::string& strFile); static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *datasource); static int SeekCallback(void *datasource, ogg_int64_t offset, int whence); diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp index d19c8ba891..3802173bc7 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -87,7 +87,7 @@ PAPlayer::~PAPlayer() delete m_FileItem; } -bool PAPlayer::HandlesType(const CStdString &type) +bool PAPlayer::HandlesType(const std::string &type) { ICodec* codec = CodecFactory::CreateCodec(type); if (codec && codec->CanInit()) @@ -1055,7 +1055,7 @@ void PAPlayer::UpdateGUIData(StreamInfo *si) const ICodec* codec = si->m_decoder.GetCodec(); m_playerGUIData.m_audioBitrate = codec ? codec->m_Bitrate : 0; - strncpy(m_playerGUIData.m_codec,codec ? codec->m_CodecName : "",20); + strncpy(m_playerGUIData.m_codec,codec ? codec->m_CodecName.c_str() : "",20); m_playerGUIData.m_cacheLevel = codec ? codec->GetCacheLevel() : 0; m_playerGUIData.m_bitsPerSample = (codec && codec->m_BitsPerCodedSample) ? codec->m_BitsPerCodedSample : si->m_bytesPerSample << 3; diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h index dd67ca0a8d..82412a3346 100644 --- a/xbmc/cores/paplayer/PAPlayer.h +++ b/xbmc/cores/paplayer/PAPlayer.h @@ -58,9 +58,9 @@ public: virtual float GetPercentage(); virtual void SetVolume(float volume); virtual void SetDynamicRangeCompression(long drc); - virtual void GetAudioInfo( CStdString& strAudioInfo) {} - virtual void GetVideoInfo( CStdString& strVideoInfo) {} - virtual void GetGeneralInfo( CStdString& strVideoInfo) {} + virtual void GetAudioInfo( std::string& strAudioInfo) {} + virtual void GetVideoInfo( std::string& strVideoInfo) {} + virtual void GetGeneralInfo( std::string& strVideoInfo) {} virtual void ToFFRW(int iSpeed = 0); virtual int GetCacheLevel() const; virtual int64_t GetTotalTime(); @@ -70,7 +70,7 @@ public: virtual bool SkipNext(); virtual void GetAudioCapabilities(std::vector<int> &audioCaps) {} - static bool HandlesType(const CStdString &type); + static bool HandlesType(const std::string &type); virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); diff --git a/xbmc/cores/paplayer/PCMCodec.cpp b/xbmc/cores/paplayer/PCMCodec.cpp index d1eeab39cb..719d30e5e4 100644 --- a/xbmc/cores/paplayer/PCMCodec.cpp +++ b/xbmc/cores/paplayer/PCMCodec.cpp @@ -39,7 +39,7 @@ PCMCodec::~PCMCodec() DeInit(); } -bool PCMCodec::Init(const CStdString &strFile, unsigned int filecache) +bool PCMCodec::Init(const std::string &strFile, unsigned int filecache) { m_file.Close(); if (!m_file.Open(strFile, READ_CACHED)) @@ -95,7 +95,7 @@ bool PCMCodec::CanInit() return true; } -void PCMCodec::SetMimeParams(const CStdString& strMimeParams) +void PCMCodec::SetMimeParams(const std::string& strMimeParams) { // if there are no parameters, the default is 2 channels, 44100 samples/sec m_Channels = 2; diff --git a/xbmc/cores/paplayer/PCMCodec.h b/xbmc/cores/paplayer/PCMCodec.h index 7df475188e..04e8d9b05a 100644 --- a/xbmc/cores/paplayer/PCMCodec.h +++ b/xbmc/cores/paplayer/PCMCodec.h @@ -26,11 +26,11 @@ class PCMCodec : public CachingCodec public: PCMCodec(void); virtual ~PCMCodec(void); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); virtual bool CanInit(); - virtual void SetMimeParams(const CStdString& strMimeParams); + virtual void SetMimeParams(const std::string& strMimeParams); }; diff --git a/xbmc/cores/paplayer/SIDCodec.cpp b/xbmc/cores/paplayer/SIDCodec.cpp index 2ab400c702..b1a1a2b719 100644 --- a/xbmc/cores/paplayer/SIDCodec.cpp +++ b/xbmc/cores/paplayer/SIDCodec.cpp @@ -38,19 +38,19 @@ SIDCodec::~SIDCodec() DeInit(); } -bool SIDCodec::Init(const CStdString &strFile, unsigned int filecache) +bool SIDCodec::Init(const std::string &strFile, unsigned int filecache) { if (!m_dll.Load()) return false; // error logged previously m_dll.Init(); - CStdString strFileToLoad = strFile; + std::string strFileToLoad = strFile; m_iTrack = 0; if (URIUtils::HasExtension(strFile, ".sidstream")) { // Extract the track to play - CStdString strFileName=URIUtils::GetFileName(strFile); + std::string strFileName=URIUtils::GetFileName(strFile); size_t iStart = strFileName.rfind('-') + 1; m_iTrack = atoi(strFileName.substr(iStart, strFileName.size()-iStart-10).c_str()); // The directory we are in, is the file diff --git a/xbmc/cores/paplayer/SIDCodec.h b/xbmc/cores/paplayer/SIDCodec.h index f9ededaf75..2433d9178f 100644 --- a/xbmc/cores/paplayer/SIDCodec.h +++ b/xbmc/cores/paplayer/SIDCodec.h @@ -30,7 +30,7 @@ public: SIDCodec(); virtual ~SIDCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/paplayer/SPCCodec.cpp b/xbmc/cores/paplayer/SPCCodec.cpp index aa64fc3887..7fad97c81e 100644 --- a/xbmc/cores/paplayer/SPCCodec.cpp +++ b/xbmc/cores/paplayer/SPCCodec.cpp @@ -55,7 +55,7 @@ SPCCodec::~SPCCodec() DeInit(); } -bool SPCCodec::Init(const CStdString &strFile, unsigned int filecache) +bool SPCCodec::Init(const std::string &strFile, unsigned int filecache) { // SNESAPU can ONLY be opened and used by one instance (lot's of statics). // So to work around this problem with SNESAPU, we need to make sure that diff --git a/xbmc/cores/paplayer/SPCCodec.h b/xbmc/cores/paplayer/SPCCodec.h index f8cf3cc7a0..6945dc91a7 100644 --- a/xbmc/cores/paplayer/SPCCodec.h +++ b/xbmc/cores/paplayer/SPCCodec.h @@ -31,7 +31,7 @@ public: SPCCodec(); virtual ~SPCCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); @@ -60,7 +60,7 @@ private: } m_dll; LibraryLoader* m_loader; - CStdString m_loader_name; + std::string m_loader_name; char* m_szBuffer; u8* m_pApuRAM; diff --git a/xbmc/cores/paplayer/TimidityCodec.cpp b/xbmc/cores/paplayer/TimidityCodec.cpp index 42275c6ff6..fd7ebcd0b2 100644 --- a/xbmc/cores/paplayer/TimidityCodec.cpp +++ b/xbmc/cores/paplayer/TimidityCodec.cpp @@ -47,7 +47,7 @@ TimidityCodec::~TimidityCodec() DeInit(); } -bool TimidityCodec::Init(const CStdString &strFile, unsigned int filecache) +bool TimidityCodec::Init(const std::string &strFile, unsigned int filecache) { // We do not need to init/load Timidity more than once // @@ -106,11 +106,10 @@ bool TimidityCodec::Init(const CStdString &strFile, unsigned int filecache) if ( m_mid ) m_dll.FreeMID( m_mid ); - CStdString file = strFile; CURL url(strFile); if (!url.IsLocal()) { - CStdString file = CUtil::GetNextFilename("special://temp/midi%03d.mid",999); + std::string file = CUtil::GetNextFilename("special://temp/midi%03d.mid",999); XFILE::CFile::Copy(strFile,file); url.Parse(file); } @@ -180,7 +179,7 @@ bool TimidityCodec::CanInit() || XFILE::CFile::Exists( DEFAULT_SOUNDFONT_FILE ); } -bool TimidityCodec::IsSupportedFormat(const CStdString& strExt) +bool TimidityCodec::IsSupportedFormat(const std::string& strExt) { if (strExt == "mid" || strExt == "kar") return true; diff --git a/xbmc/cores/paplayer/TimidityCodec.h b/xbmc/cores/paplayer/TimidityCodec.h index 9736f17afb..2751d15e79 100644 --- a/xbmc/cores/paplayer/TimidityCodec.h +++ b/xbmc/cores/paplayer/TimidityCodec.h @@ -30,16 +30,16 @@ public: TimidityCodec(); virtual ~TimidityCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); virtual bool CanInit(); - static bool IsSupportedFormat(const CStdString& strExt); + static bool IsSupportedFormat(const std::string& strExt); private: LibraryLoader* m_loader; - CStdString m_loader_name; + std::string m_loader_name; typedef int (__cdecl *InitMethod) ( const char * soundfont ); typedef void* (__cdecl *LoadMethod) ( const char* p1); diff --git a/xbmc/cores/paplayer/VGMCodec.cpp b/xbmc/cores/paplayer/VGMCodec.cpp index 6c092cdd2b..b87efb784c 100644 --- a/xbmc/cores/paplayer/VGMCodec.cpp +++ b/xbmc/cores/paplayer/VGMCodec.cpp @@ -35,18 +35,18 @@ VGMCodec::~VGMCodec() DeInit(); } -bool VGMCodec::Init(const CStdString &strFile, unsigned int filecache) +bool VGMCodec::Init(const std::string &strFile, unsigned int filecache) { if (!m_dll.Load()) return false; // error logged previously m_dll.Init(); - //CStdString strFileToLoad = "filereader://"+strFile; - XFILE::CFile::Copy(strFile,"special://temp/"+URIUtils::GetFileName(strFile)); + //std::string strFileToLoad = "filereader://"+strFile; + std::string strFileToLoad = "special://temp/" + URIUtils::GetFileName(strFile); + XFILE::CFile::Copy(strFile, strFileToLoad); - //m_vgm = m_dll.LoadVGM(strFileToLoad.c_str(),&m_SampleRate,&m_BitsPerSample,&m_Channels); - m_vgm = m_dll.LoadVGM("special://temp/"+URIUtils::GetFileName(strFile),&m_SampleRate,&m_BitsPerSample,&m_Channels); + m_vgm = m_dll.LoadVGM(strFileToLoad.c_str(), &m_SampleRate, &m_BitsPerSample, &m_Channels); if (!m_vgm) { CLog::Log(LOGERROR,"%s: error opening file %s!",__FUNCTION__,strFile.c_str()); @@ -106,7 +106,7 @@ bool VGMCodec::CanInit() return m_dll.CanLoad(); } -bool VGMCodec::IsSupportedFormat(const CStdString& strExt) +bool VGMCodec::IsSupportedFormat(const std::string& strExt) { if (strExt == "aax" || strExt == "acm" || diff --git a/xbmc/cores/paplayer/VGMCodec.h b/xbmc/cores/paplayer/VGMCodec.h index 0094da32f0..f65ba2eedc 100644 --- a/xbmc/cores/paplayer/VGMCodec.h +++ b/xbmc/cores/paplayer/VGMCodec.h @@ -30,12 +30,12 @@ public: VGMCodec(); virtual ~VGMCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); virtual bool CanInit(); - static bool IsSupportedFormat(const CStdString& strExt); + static bool IsSupportedFormat(const std::string& strExt); private: DllVGM m_dll; diff --git a/xbmc/cores/paplayer/WAVcodec.cpp b/xbmc/cores/paplayer/WAVcodec.cpp index 141a6bdc0f..767915af2e 100644 --- a/xbmc/cores/paplayer/WAVcodec.cpp +++ b/xbmc/cores/paplayer/WAVcodec.cpp @@ -61,7 +61,7 @@ WAVCodec::~WAVCodec() DeInit(); } -bool WAVCodec::Init(const CStdString &strFile, unsigned int filecache) +bool WAVCodec::Init(const std::string &strFile, unsigned int filecache) { m_file.Close(); if (!m_file.Open(strFile, READ_CACHED)) diff --git a/xbmc/cores/paplayer/WAVcodec.h b/xbmc/cores/paplayer/WAVcodec.h index 2c1a57d912..6e4e6240d7 100644 --- a/xbmc/cores/paplayer/WAVcodec.h +++ b/xbmc/cores/paplayer/WAVcodec.h @@ -29,7 +29,7 @@ public: WAVCodec(); virtual ~WAVCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/paplayer/YMCodec.cpp b/xbmc/cores/paplayer/YMCodec.cpp index d32b87c099..d67cb0c5d5 100644 --- a/xbmc/cores/paplayer/YMCodec.cpp +++ b/xbmc/cores/paplayer/YMCodec.cpp @@ -34,7 +34,7 @@ YMCodec::~YMCodec() DeInit(); } -bool YMCodec::Init(const CStdString &strFile, unsigned int filecache) +bool YMCodec::Init(const std::string &strFile, unsigned int filecache) { if (!m_dll.Load()) return false; // error logged previously diff --git a/xbmc/cores/paplayer/YMCodec.h b/xbmc/cores/paplayer/YMCodec.h index 90e8239248..ec05413ecb 100644 --- a/xbmc/cores/paplayer/YMCodec.h +++ b/xbmc/cores/paplayer/YMCodec.h @@ -30,7 +30,7 @@ public: YMCodec(); virtual ~YMCodec(); - virtual bool Init(const CStdString &strFile, unsigned int filecache); + virtual bool Init(const std::string &strFile, unsigned int filecache); virtual void DeInit(); virtual int64_t Seek(int64_t iSeekTime); virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); diff --git a/xbmc/cores/playercorefactory/PlayerCoreConfig.h b/xbmc/cores/playercorefactory/PlayerCoreConfig.h index 27f0beca5f..9524f947bd 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreConfig.h +++ b/xbmc/cores/playercorefactory/PlayerCoreConfig.h @@ -38,7 +38,7 @@ class CPlayerCoreConfig friend class CPlayerCoreFactory; public: - CPlayerCoreConfig(CStdString name, const EPLAYERCORES eCore, const TiXmlElement* pConfig, const CStdString& id = "") + CPlayerCoreConfig(std::string name, const EPLAYERCORES eCore, const TiXmlElement* pConfig, const std::string& id = "") { m_name = name; m_id = id; @@ -66,12 +66,12 @@ public: SAFE_DELETE(m_config); } - const CStdString& GetName() const + const std::string& GetName() const { return m_name; } - const CStdString& GetId() const + const std::string& GetId() const { return m_id; } @@ -119,8 +119,8 @@ public: } private: - CStdString m_name; - CStdString m_id; + std::string m_name; + std::string m_id; bool m_bPlaysAudio; bool m_bPlaysVideo; EPLAYERCORES m_eCore; diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp index 05444fa6ba..685e606d94 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp @@ -82,7 +82,7 @@ template<typename T> void unique (T &con) con.erase (end, con.end()); } -IPlayer* CPlayerCoreFactory::CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const +IPlayer* CPlayerCoreFactory::CreatePlayer(const std::string& strCore, IPlayerCallback& callback) const { return CreatePlayer(GetPlayerCore(strCore), callback ); } @@ -96,21 +96,21 @@ IPlayer* CPlayerCoreFactory::CreatePlayer(const PLAYERCOREID eCore, IPlayerCallb return m_vecCoreConfigs[eCore-1]->CreatePlayer(callback); } -PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName) const +PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const std::string& strCoreName) const { CSingleLock lock(m_section); if (!strCoreName.empty()) { // Dereference "*default*player" aliases - CStdString strRealCoreName; - if (strCoreName.Equals("audiodefaultplayer", false)) strRealCoreName = g_advancedSettings.m_audioDefaultPlayer; - else if (strCoreName.Equals("videodefaultplayer", false)) strRealCoreName = g_advancedSettings.m_videoDefaultPlayer; - else if (strCoreName.Equals("videodefaultdvdplayer", false)) strRealCoreName = g_advancedSettings.m_videoDefaultDVDPlayer; + std::string strRealCoreName; + if (StringUtils::EqualsNoCase(strCoreName, "audiodefaultplayer")) strRealCoreName = g_advancedSettings.m_audioDefaultPlayer; + else if (StringUtils::EqualsNoCase(strCoreName, "videodefaultplayer")) strRealCoreName = g_advancedSettings.m_videoDefaultPlayer; + else if (StringUtils::EqualsNoCase(strCoreName, "videodefaultdvdplayer")) strRealCoreName = g_advancedSettings.m_videoDefaultDVDPlayer; else strRealCoreName = strCoreName; for(PLAYERCOREID i = 0; i < m_vecCoreConfigs.size(); i++) { - if (m_vecCoreConfigs[i]->GetName().Equals(strRealCoreName, false)) + if (StringUtils::EqualsNoCase(m_vecCoreConfigs[i]->GetName(), strRealCoreName)) return i+1; } CLog::Log(LOGWARNING, "CPlayerCoreFactory::GetPlayerCore(%s): no such core: %s", strCoreName.c_str(), strRealCoreName.c_str()); @@ -118,13 +118,13 @@ PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName) co return EPC_NONE; } -CStdString CPlayerCoreFactory::GetPlayerName(const PLAYERCOREID eCore) const +std::string CPlayerCoreFactory::GetPlayerName(const PLAYERCOREID eCore) const { CSingleLock lock(m_section); return m_vecCoreConfigs[eCore-1]->GetName(); } -CPlayerCoreConfig* CPlayerCoreFactory::GetPlayerConfig(const CStdString& strCoreName) const +CPlayerCoreConfig* CPlayerCoreFactory::GetPlayerConfig(const std::string& strCoreName) const { CSingleLock lock(m_section); PLAYERCOREID id = GetPlayerCore(strCoreName); @@ -269,7 +269,7 @@ PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, fl if (vecCores.size()) { //Add default player - CStdString strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[0]); + std::string strCaption = CPlayerCoreFactory::GetPlayerName(vecCores[0]); strCaption += " ("; strCaption += g_localizeStrings.Get(13278); strCaption += ")"; @@ -360,8 +360,8 @@ bool CPlayerCoreFactory::LoadConfiguration(const std::string &file, bool clear) TiXmlElement* pPlayer = pPlayers->FirstChildElement("player"); while (pPlayer) { - CStdString name = XMLUtils::GetAttribute(pPlayer, "name"); - CStdString type = XMLUtils::GetAttribute(pPlayer, "type"); + std::string name = XMLUtils::GetAttribute(pPlayer, "name"); + std::string type = XMLUtils::GetAttribute(pPlayer, "type"); if (type.empty()) type = name; StringUtils::ToLower(type); @@ -413,7 +413,7 @@ bool CPlayerCoreFactory::LoadConfiguration(const std::string &file, bool clear) return true; } -void CPlayerCoreFactory::OnPlayerDiscovered(const CStdString& id, const CStdString& name, EPLAYERCORES core) +void CPlayerCoreFactory::OnPlayerDiscovered(const std::string& id, const std::string& name, EPLAYERCORES core) { CSingleLock lock(m_section); std::vector<CPlayerCoreConfig *>::iterator it; @@ -435,7 +435,7 @@ void CPlayerCoreFactory::OnPlayerDiscovered(const CStdString& id, const CStdStri m_vecCoreConfigs.push_back(player); } -void CPlayerCoreFactory::OnPlayerRemoved(const CStdString& id) +void CPlayerCoreFactory::OnPlayerRemoved(const std::string& id) { CSingleLock lock(m_section); std::vector<CPlayerCoreConfig *>::iterator it; diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.h b/xbmc/cores/playercorefactory/PlayerCoreFactory.h index 3c17dd361b..c85590f723 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.h +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.h @@ -26,7 +26,7 @@ #include "cores/IPlayerCallback.h" #include "settings/lib/ISettingsHandler.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" +#include <string> /*---------------------------------------------------------------------- | forward references @@ -68,12 +68,12 @@ public: virtual void OnSettingsLoaded(); - PLAYERCOREID GetPlayerCore(const CStdString& strCoreName) const; - CPlayerCoreConfig* GetPlayerConfig(const CStdString& strCoreName) const; - CStdString GetPlayerName(const PLAYERCOREID eCore) const; + PLAYERCOREID GetPlayerCore(const std::string& strCoreName) const; + CPlayerCoreConfig* GetPlayerConfig(const std::string& strCoreName) const; + std::string GetPlayerName(const PLAYERCOREID eCore) const; IPlayer* CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback) const; - IPlayer* CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const; + IPlayer* CreatePlayer(const std::string& strCore, IPlayerCallback& callback) const; void GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores) const; //Players supporting the specified file void GetPlayers( VECPLAYERCORES &vecCores, bool audio, bool video ) const; //All audio players and/or video players void GetPlayers( VECPLAYERCORES &vecCores ) const; //All players @@ -85,8 +85,8 @@ public: PLAYERCOREID SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX = 0, float posY = 0) const; PLAYERCOREID SelectPlayerDialog(float posX, float posY) const; - void OnPlayerDiscovered(const CStdString& id, const CStdString& name, EPLAYERCORES core); - void OnPlayerRemoved(const CStdString& id); + void OnPlayerDiscovered(const std::string& id, const std::string& name, EPLAYERCORES core); + void OnPlayerRemoved(const std::string& id); protected: CPlayerCoreFactory(); diff --git a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp index de48d8d738..818deb033d 100644 --- a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp +++ b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp @@ -94,12 +94,12 @@ int CPlayerSelectionRule::GetTristate(const char* szValue) return -1; } -bool CPlayerSelectionRule::CompileRegExp(const CStdString& str, CRegExp& regExp) +bool CPlayerSelectionRule::CompileRegExp(const std::string& str, CRegExp& regExp) { - return str.length() > 0 && regExp.RegComp(str.c_str()); + return !str.empty() > 0 && regExp.RegComp(str.c_str()); } -bool CPlayerSelectionRule::MatchesRegExp(const CStdString& str, CRegExp& regExp) +bool CPlayerSelectionRule::MatchesRegExp(const std::string& str, CRegExp& regExp) { return regExp.RegFind(str, 0) == 0; } @@ -135,7 +135,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, VECPLAYERCORES &vec std::stringstream itoa; itoa << streamDetails.GetAudioChannels(); - CStdString audioChannelsstr = itoa.str(); + std::string audioChannelsstr = itoa.str(); if (CompileRegExp(m_audioChannels, regExp) && !MatchesRegExp(audioChannelsstr, regExp)) return; diff --git a/xbmc/cores/playercorefactory/PlayerSelectionRule.h b/xbmc/cores/playercorefactory/PlayerSelectionRule.h index 3078f9a89e..1927697e33 100644 --- a/xbmc/cores/playercorefactory/PlayerSelectionRule.h +++ b/xbmc/cores/playercorefactory/PlayerSelectionRule.h @@ -32,17 +32,17 @@ public: virtual ~CPlayerSelectionRule(); //bool Matches(const CFileItem& item) const; - //CStdString GetPlayerName() const; + //std::string GetPlayerName() const; void GetPlayers(const CFileItem& item, VECPLAYERCORES &vecCores); private: static int GetTristate(const char* szValue); - static bool CompileRegExp(const CStdString& str, CRegExp& regExp); - static bool MatchesRegExp(const CStdString& str, CRegExp& regExp); + static bool CompileRegExp(const std::string& str, CRegExp& regExp); + static bool MatchesRegExp(const std::string& str, CRegExp& regExp); void Initialize(TiXmlElement* pRule); PLAYERCOREID GetPlayerCore(); - CStdString m_name; + std::string m_name; int m_tAudio; int m_tVideo; @@ -54,19 +54,19 @@ private: int m_tDVDFile; int m_tDVDImage; - CStdString m_protocols; - CStdString m_fileTypes; - CStdString m_mimeTypes; - CStdString m_fileName; + std::string m_protocols; + std::string m_fileTypes; + std::string m_mimeTypes; + std::string m_fileName; bool m_bStreamDetails; - CStdString m_audioCodec; - CStdString m_audioChannels; - CStdString m_videoCodec; - CStdString m_videoResolution; - CStdString m_videoAspect; + std::string m_audioCodec; + std::string m_audioChannels; + std::string m_videoCodec; + std::string m_videoResolution; + std::string m_videoAspect; - CStdString m_playerName; + std::string m_playerName; PLAYERCOREID m_playerCoreId; std::vector<CPlayerSelectionRule *> vecSubRules; diff --git a/xbmc/dbwrappers/Database.cpp b/xbmc/dbwrappers/Database.cpp index 8b9ad439f7..0044e64e23 100644 --- a/xbmc/dbwrappers/Database.cpp +++ b/xbmc/dbwrappers/Database.cpp @@ -113,7 +113,7 @@ CDatabase::~CDatabase(void) Close(); } -void CDatabase::Split(const CStdString& strFileNameAndPath, CStdString& strPath, CStdString& strFileName) +void CDatabase::Split(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName) { strFileName = ""; strPath = ""; @@ -128,9 +128,9 @@ void CDatabase::Split(const CStdString& strFileNameAndPath, CStdString& strPath, strFileName = strFileNameAndPath.substr(i); } -CStdString CDatabase::PrepareSQL(CStdString strStmt, ...) const +std::string CDatabase::PrepareSQL(std::string strStmt, ...) const { - CStdString strResult = ""; + std::string strResult = ""; if (NULL != m_pDB.get()) { @@ -163,9 +163,9 @@ std::string CDatabase::GetSingleValue(const std::string &query, std::auto_ptr<Da return ret; } -CStdString CDatabase::GetSingleValue(const CStdString &strTable, const CStdString &strColumn, const CStdString &strWhereClause /* = CStdString() */, const CStdString &strOrderBy /* = CStdString() */) +std::string CDatabase::GetSingleValue(const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause /* = std::string() */, const std::string &strOrderBy /* = std::string() */) { - CStdString query = PrepareSQL("SELECT %s FROM %s", strColumn.c_str(), strTable.c_str()); + std::string query = PrepareSQL("SELECT %s FROM %s", strColumn.c_str(), strTable.c_str()); if (!strWhereClause.empty()) query += " WHERE " + strWhereClause; if (!strOrderBy.empty()) @@ -174,14 +174,14 @@ CStdString CDatabase::GetSingleValue(const CStdString &strTable, const CStdStrin return GetSingleValue(query, m_pDS); } -CStdString CDatabase::GetSingleValue(const CStdString &query) +std::string CDatabase::GetSingleValue(const std::string &query) { return GetSingleValue(query, m_pDS); } -bool CDatabase::DeleteValues(const CStdString &strTable, const Filter &filter /* = Filter() */) +bool CDatabase::DeleteValues(const std::string &strTable, const Filter &filter /* = Filter() */) { - CStdString strQuery; + std::string strQuery; BuildSQL(PrepareSQL("DELETE FROM %s ", strTable.c_str()), filter, strQuery); return ExecuteQuery(strQuery); } @@ -208,7 +208,7 @@ bool CDatabase::CommitMultipleExecute() return true; } -bool CDatabase::ExecuteQuery(const CStdString &strQuery) +bool CDatabase::ExecuteQuery(const std::string &strQuery) { if (m_multipleExecute) { @@ -234,7 +234,7 @@ bool CDatabase::ExecuteQuery(const CStdString &strQuery) return bReturn; } -bool CDatabase::ResultQuery(const CStdString &strQuery) +bool CDatabase::ResultQuery(const std::string &strQuery) { bool bReturn = false; @@ -243,7 +243,7 @@ bool CDatabase::ResultQuery(const CStdString &strQuery) if (NULL == m_pDB.get()) return bReturn; if (NULL == m_pDS.get()) return bReturn; - CStdString strPreparedQuery = PrepareSQL(strQuery.c_str()); + std::string strPreparedQuery = PrepareSQL(strQuery.c_str()); bReturn = m_pDS->query(strPreparedQuery.c_str()); } @@ -256,7 +256,7 @@ bool CDatabase::ResultQuery(const CStdString &strQuery) return bReturn; } -bool CDatabase::QueueInsertQuery(const CStdString &strQuery) +bool CDatabase::QueueInsertQuery(const std::string &strQuery) { if (strQuery.empty()) return false; @@ -319,7 +319,7 @@ bool CDatabase::Open(const DatabaseSettings &settings) DatabaseSettings dbSettings = settings; InitSettings(dbSettings); - CStdString dbName = dbSettings.name; + std::string dbName = dbSettings.name; dbName += StringUtils::Format("%d", GetSchemaVersion()); return Connect(dbName, dbSettings, false); } @@ -360,12 +360,12 @@ bool CDatabase::Update(const DatabaseSettings &settings) InitSettings(dbSettings); int version = GetSchemaVersion(); - CStdString latestDb = dbSettings.name; + std::string latestDb = dbSettings.name; latestDb += StringUtils::Format("%d", version); while (version >= GetMinSchemaVersion()) { - CStdString dbName = dbSettings.name; + std::string dbName = dbSettings.name; if (version) dbName += StringUtils::Format("%d", version); @@ -380,7 +380,7 @@ bool CDatabase::Update(const DatabaseSettings &settings) try { - m_pDB->copy(latestDb); + m_pDB->copy(latestDb.c_str()); } catch(...) { @@ -421,7 +421,7 @@ bool CDatabase::Update(const DatabaseSettings &settings) return false; } -bool CDatabase::Connect(const CStdString &dbName, const DatabaseSettings &dbSettings, bool create) +bool CDatabase::Connect(const std::string &dbName, const DatabaseSettings &dbSettings, bool create) { // create the appropriate database structure if (dbSettings.type.Equals("sqlite3")) @@ -513,7 +513,7 @@ int CDatabase::GetDBVersion() return 0; } -bool CDatabase::UpdateVersion(const CStdString &dbName) +bool CDatabase::UpdateVersion(const std::string &dbName) { int version = GetDBVersion(); if (version < GetMinSchemaVersion()) @@ -603,7 +603,7 @@ bool CDatabase::Compress(bool bForce /* =true */) if (iCount > MAX_COMPRESS_COUNT) iCount = -1; m_pDS->close(); - CStdString strSQL=PrepareSQL("update version set iCompressCount=%i\n",++iCount); + std::string strSQL=PrepareSQL("update version set iCompressCount=%i\n",++iCount); m_pDS->exec(strSQL.c_str()); if (iCount != 0) return true; @@ -680,7 +680,7 @@ bool CDatabase::CreateDatabase() { CLog::Log(LOGINFO, "creating version table"); m_pDS->exec("CREATE TABLE version (idVersion integer, iCompressCount integer)\n"); - CStdString strSQL=PrepareSQL("INSERT INTO version (idVersion,iCompressCount) values(%i,0)\n", GetSchemaVersion()); + std::string strSQL=PrepareSQL("INSERT INTO version (idVersion,iCompressCount) values(%i,0)\n", GetSchemaVersion()); m_pDS->exec(strSQL.c_str()); CreateTables(); @@ -698,11 +698,11 @@ bool CDatabase::CreateDatabase() void CDatabase::UpdateVersionNumber() { - CStdString strSQL=PrepareSQL("UPDATE version SET idVersion=%i\n", GetSchemaVersion()); + std::string strSQL=PrepareSQL("UPDATE version SET idVersion=%i\n", GetSchemaVersion()); m_pDS->exec(strSQL.c_str()); } -bool CDatabase::BuildSQL(const CStdString &strQuery, const Filter &filter, CStdString &strSQL) +bool CDatabase::BuildSQL(const std::string &strQuery, const Filter &filter, std::string &strSQL) { strSQL = strQuery; @@ -720,13 +720,13 @@ bool CDatabase::BuildSQL(const CStdString &strQuery, const Filter &filter, CStdS return true; } -bool CDatabase::BuildSQL(const CStdString &strBaseDir, const CStdString &strQuery, Filter &filter, CStdString &strSQL, CDbUrl &dbUrl) +bool CDatabase::BuildSQL(const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl) { SortDescription sorting; return BuildSQL(strBaseDir, strQuery, filter, strSQL, dbUrl, sorting); } -bool CDatabase::BuildSQL(const CStdString &strBaseDir, const CStdString &strQuery, Filter &filter, CStdString &strSQL, CDbUrl &dbUrl, SortDescription &sorting /* = SortDescription() */) +bool CDatabase::BuildSQL(const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl, SortDescription &sorting /* = SortDescription() */) { // parse the base path to get additional filters dbUrl.Reset(); diff --git a/xbmc/dbwrappers/Database.h b/xbmc/dbwrappers/Database.h index 5cd5eb7676..5d19749f3e 100644 --- a/xbmc/dbwrappers/Database.h +++ b/xbmc/dbwrappers/Database.h @@ -20,14 +20,14 @@ * */ -#include "utils/StdString.h" - namespace dbiplus { class Database; class Dataset; } #include <memory> +#include <string> +#include <vector> class DatabaseSettings; // forward class CDbUrl; @@ -71,7 +71,7 @@ public: void RollbackTransaction(); bool InTransaction(); - CStdString PrepareSQL(CStdString strStmt, ...) const; + std::string PrepareSQL(std::string strStmt, ...) const; /*! * @brief Get a single value from a table. @@ -82,8 +82,8 @@ public: * @param strOrderBy If set, use this ORDER BY clause. * @return The requested value or an empty string if it wasn't found. */ - CStdString GetSingleValue(const CStdString &strTable, const CStdString &strColumn, const CStdString &strWhereClause = CStdString(), const CStdString &strOrderBy = CStdString()); - CStdString GetSingleValue(const CStdString &query); + std::string GetSingleValue(const std::string &strTable, const std::string &strColumn, const std::string &strWhereClause = std::string(), const std::string &strOrderBy = std::string()); + std::string GetSingleValue(const std::string &query); /*! \brief Get a single value from a query on a dataset. \param query the query in question. @@ -98,7 +98,7 @@ public: * @param filter The Filter to apply to this query. * @return True if the query was executed successfully, false otherwise. */ - bool DeleteValues(const CStdString &strTable, const Filter &filter = Filter()); + bool DeleteValues(const std::string &strTable, const Filter &filter = Filter()); /*! * @brief Execute a query that does not return any result. @@ -108,7 +108,7 @@ public: * @return True if the query was executed successfully, false otherwise. * @sa BeginMultipleExecute, CommitMultipleExecute */ - bool ExecuteQuery(const CStdString &strQuery); + bool ExecuteQuery(const std::string &strQuery); /*! * @brief Execute a query that returns a result. @@ -116,7 +116,7 @@ public: * @param strQuery The query to execute. * @return True if the query was executed successfully, false otherwise. */ - bool ResultQuery(const CStdString &strQuery); + bool ResultQuery(const std::string &strQuery); /*! * @brief Start a multiple execution queue. Any ExecuteQuery() function @@ -149,7 +149,7 @@ public: * @param strQuery The query to queue. * @return True if the query was added successfully, false otherwise. */ - bool QueueInsertQuery(const CStdString &strQuery); + bool QueueInsertQuery(const std::string &strQuery); /*! * @brief Commit all queries in the queue. @@ -158,14 +158,14 @@ public: bool CommitInsertQueries(); virtual bool GetFilter(CDbUrl &dbUrl, Filter &filter, SortDescription &sorting) { return true; } - virtual bool BuildSQL(const CStdString &strBaseDir, const CStdString &strQuery, Filter &filter, CStdString &strSQL, CDbUrl &dbUrl); - virtual bool BuildSQL(const CStdString &strBaseDir, const CStdString &strQuery, Filter &filter, CStdString &strSQL, CDbUrl &dbUrl, SortDescription &sorting); + virtual bool BuildSQL(const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl); + virtual bool BuildSQL(const std::string &strBaseDir, const std::string &strQuery, Filter &filter, std::string &strSQL, CDbUrl &dbUrl, SortDescription &sorting); protected: friend class CDatabaseManager; bool Update(const DatabaseSettings &db); - void Split(const CStdString& strFileNameAndPath, CStdString& strPath, CStdString& strFileName); + void Split(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName); virtual bool Open(); @@ -200,9 +200,9 @@ protected: virtual const char *GetBaseDBName() const=0; int GetDBVersion(); - bool UpdateVersion(const CStdString &dbName); + bool UpdateVersion(const std::string &dbName); - bool BuildSQL(const CStdString &strQuery, const Filter &filter, CStdString &strSQL); + bool BuildSQL(const std::string &strQuery, const Filter &filter, std::string &strSQL); bool m_sqlite; ///< \brief whether we use sqlite (defaults to true) @@ -212,7 +212,7 @@ protected: private: void InitSettings(DatabaseSettings &dbSettings); - bool Connect(const CStdString &dbName, const DatabaseSettings &db, bool create); + bool Connect(const std::string &dbName, const DatabaseSettings &db, bool create); void UpdateVersionNumber(); bool m_bMultiWrite; /*!< True if there are any queries in the queue, false otherwise */ diff --git a/xbmc/dbwrappers/DatabaseQuery.cpp b/xbmc/dbwrappers/DatabaseQuery.cpp index 94a0dac87e..28ea3dce71 100644 --- a/xbmc/dbwrappers/DatabaseQuery.cpp +++ b/xbmc/dbwrappers/DatabaseQuery.cpp @@ -92,7 +92,7 @@ bool CDatabaseQueryRule::Load(const TiXmlNode *node, const std::string &encoding if (parameter->Type() == TiXmlNode::TINYXML_TEXT) { - CStdString utf8Parameter; + std::string utf8Parameter; if (encoding.empty()) // utf8 utf8Parameter = parameter->ValueStr(); else @@ -109,7 +109,7 @@ bool CDatabaseQueryRule::Load(const TiXmlNode *node, const std::string &encoding const TiXmlNode *value = valueNode->FirstChild(); if (value != NULL && value->Type() == TiXmlNode::TINYXML_TEXT) { - CStdString utf8Parameter; + std::string utf8Parameter; if (encoding.empty()) // utf8 utf8Parameter = value->ValueStr(); else @@ -204,14 +204,14 @@ CDatabaseQueryRule::SEARCH_OPERATOR CDatabaseQueryRule::TranslateOperator(const return OPERATOR_CONTAINS; } -CStdString CDatabaseQueryRule::TranslateOperator(SEARCH_OPERATOR oper) +std::string CDatabaseQueryRule::TranslateOperator(SEARCH_OPERATOR oper) { for (unsigned int i = 0; i < NUM_OPERATORS; i++) if (oper == operators[i].op) return operators[i].string; return "contains"; } -CStdString CDatabaseQueryRule::GetLocalizedOperator(SEARCH_OPERATOR oper) +std::string CDatabaseQueryRule::GetLocalizedOperator(SEARCH_OPERATOR oper) { for (unsigned int i = 0; i < NUM_OPERATORS; i++) if (oper == operators[i].op) return g_localizeStrings.Get(operators[i].localizedString); @@ -224,12 +224,12 @@ void CDatabaseQueryRule::GetAvailableOperators(std::vector<std::string> &operato operatorList.push_back(operators[index].string); } -CStdString CDatabaseQueryRule::GetParameter() const +std::string CDatabaseQueryRule::GetParameter() const { return StringUtils::Join(m_parameter, DATABASEQUERY_RULE_VALUE_SEPARATOR); } -void CDatabaseQueryRule::SetParameter(const CStdString &value) +void CDatabaseQueryRule::SetParameter(const std::string &value) { m_parameter = StringUtils::Split(value, DATABASEQUERY_RULE_VALUE_SEPARATOR); } @@ -239,7 +239,7 @@ void CDatabaseQueryRule::SetParameter(const std::vector<std::string> &values) m_parameter.assign(values.begin(), values.end()); } -CStdString CDatabaseQueryRule::ValidateParameter(const CStdString ¶meter) const +std::string CDatabaseQueryRule::ValidateParameter(const std::string ¶meter) const { if ((GetFieldType(m_field) == NUMERIC_FIELD || GetFieldType(m_field) == SECONDS_FIELD) && parameter.empty()) @@ -247,9 +247,9 @@ CStdString CDatabaseQueryRule::ValidateParameter(const CStdString ¶meter) co return parameter; } -CStdString CDatabaseQueryRule::FormatParameter(const CStdString &operatorString, const CStdString ¶m, const CDatabase &db, const CStdString &strType) const +std::string CDatabaseQueryRule::FormatParameter(const std::string &operatorString, const std::string ¶m, const CDatabase &db, const std::string &strType) const { - CStdString parameter; + std::string parameter; if (GetFieldType(m_field) == TEXTIN_FIELD) { vector<string> split = StringUtils::Split(param, ","); @@ -278,9 +278,9 @@ CStdString CDatabaseQueryRule::FormatParameter(const CStdString &operatorString, return parameter; } -CStdString CDatabaseQueryRule::GetOperatorString(SEARCH_OPERATOR op) const +std::string CDatabaseQueryRule::GetOperatorString(SEARCH_OPERATOR op) const { - CStdString operatorString; + std::string operatorString; if (GetFieldType(m_field) != TEXTIN_FIELD) { // the comparison piece @@ -335,12 +335,12 @@ CStdString CDatabaseQueryRule::GetOperatorString(SEARCH_OPERATOR op) const return operatorString; } -CStdString CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const CStdString& strType) const +std::string CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const std::string& strType) const { SEARCH_OPERATOR op = GetOperator(strType); - CStdString operatorString = GetOperatorString(op); - CStdString negate; + std::string operatorString = GetOperatorString(op); + std::string negate; if (op == OPERATOR_DOES_NOT_CONTAIN || op == OPERATOR_FALSE || (op == OPERATOR_DOES_NOT_EQUAL && GetFieldType(m_field) != NUMERIC_FIELD && GetFieldType(m_field) != SECONDS_FIELD)) negate = " NOT"; @@ -365,10 +365,10 @@ CStdString CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const CStdStr } // now the query parameter - CStdString wholeQuery; + std::string wholeQuery; for (vector<string>::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) { - CStdString query = "(" + FormatWhereClause(negate, operatorString, *it, db, strType) + ")"; + std::string query = '(' + FormatWhereClause(negate, operatorString, *it, db, strType) + ')'; if (it+1 != m_parameter.end()) query += " OR "; @@ -379,12 +379,12 @@ CStdString CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const CStdStr return wholeQuery; } -CStdString CDatabaseQueryRule::FormatWhereClause(const CStdString &negate, const CStdString &oper, const CStdString ¶m, - const CDatabase &db, const CStdString &strType) const +std::string CDatabaseQueryRule::FormatWhereClause(const std::string &negate, const std::string &oper, const std::string ¶m, + const CDatabase &db, const std::string &strType) const { - CStdString parameter = FormatParameter(oper, param, db, strType); + std::string parameter = FormatParameter(oper, param, db, strType); - CStdString query; + std::string query; if (m_field != 0) { string fmt = "%s"; @@ -402,7 +402,7 @@ CStdString CDatabaseQueryRule::FormatWhereClause(const CStdString &negate, const query += " OR " + GetField(m_field,strType) + " IS NULL"; } - if (query.Equals(negate + parameter)) + if (query == negate + parameter) query = "1"; return query; } @@ -418,9 +418,9 @@ void CDatabaseQueryRuleCombination::clear() m_type = CombinationAnd; } -CStdString CDatabaseQueryRuleCombination::GetWhereClause(const CDatabase &db, const CStdString& strType) const +std::string CDatabaseQueryRuleCombination::GetWhereClause(const CDatabase &db, const std::string& strType) const { - CStdString rule, currentRule; + std::string rule, currentRule; // translate the combinations into SQL for (CDatabaseQueryRuleCombinations::const_iterator it = m_combinations.begin(); it != m_combinations.end(); ++it) @@ -436,7 +436,7 @@ CStdString CDatabaseQueryRuleCombination::GetWhereClause(const CDatabase &db, co if (!rule.empty()) rule += m_type == CombinationAnd ? " AND " : " OR "; rule += "("; - CStdString currentRule = (*it)->GetWhereClause(db, strType); + std::string currentRule = (*it)->GetWhereClause(db, strType); // if we don't get a rule, we add '1' or '0' so the query is still valid and doesn't fail if (currentRule.empty()) currentRule = m_type == CombinationAnd ? "'1'" : "'0'"; diff --git a/xbmc/dbwrappers/DatabaseQuery.h b/xbmc/dbwrappers/DatabaseQuery.h index 526711f89a..d3eec3274e 100644 --- a/xbmc/dbwrappers/DatabaseQuery.h +++ b/xbmc/dbwrappers/DatabaseQuery.h @@ -20,11 +20,10 @@ */ #include <set> +#include <string> #include <vector> #include <boost/shared_ptr.hpp> -#include "utils/StdString.h" - #define DATABASEQUERY_RULE_VALUE_SEPARATOR " / " class CDatabase; @@ -70,34 +69,34 @@ public: virtual bool Save(TiXmlNode *parent) const; virtual bool Save(CVariant &obj) const; - static CStdString GetLocalizedOperator(SEARCH_OPERATOR oper); + static std::string GetLocalizedOperator(SEARCH_OPERATOR oper); static void GetAvailableOperators(std::vector<std::string> &operatorList); - CStdString GetParameter() const; - void SetParameter(const CStdString &value); + std::string GetParameter() const; + void SetParameter(const std::string &value); void SetParameter(const std::vector<std::string> &values); - virtual CStdString GetWhereClause(const CDatabase &db, const CStdString& strType) const; + virtual std::string GetWhereClause(const CDatabase &db, const std::string& strType) const; int m_field; SEARCH_OPERATOR m_operator; std::vector<std::string> m_parameter; protected: - virtual CStdString GetField(int field, const CStdString& type) const=0; + virtual std::string GetField(int field, const std::string& type) const=0; virtual FIELD_TYPE GetFieldType(int field) const=0; virtual int TranslateField(const char *field) const=0; - virtual CStdString TranslateField(int field) const=0; - CStdString ValidateParameter(const CStdString ¶meter) const; - virtual CStdString FormatParameter(const CStdString &negate, const CStdString &oper, const CDatabase &db, const CStdString &type) const; - virtual CStdString FormatWhereClause(const CStdString &negate, const CStdString &oper, const CStdString ¶m, - const CDatabase &db, const CStdString &type) const; - virtual SEARCH_OPERATOR GetOperator(const CStdString &type) const { return m_operator; }; - virtual CStdString GetOperatorString(SEARCH_OPERATOR op) const; - virtual CStdString GetBooleanQuery(const CStdString &negate, const CStdString &strType) const { return ""; } + virtual std::string TranslateField(int field) const=0; + std::string ValidateParameter(const std::string ¶meter) const; + virtual std::string FormatParameter(const std::string &negate, const std::string &oper, const CDatabase &db, const std::string &type) const; + virtual std::string FormatWhereClause(const std::string &negate, const std::string &oper, const std::string ¶m, + const CDatabase &db, const std::string &type) const; + virtual SEARCH_OPERATOR GetOperator(const std::string &type) const { return m_operator; }; + virtual std::string GetOperatorString(SEARCH_OPERATOR op) const; + virtual std::string GetBooleanQuery(const std::string &negate, const std::string &strType) const { return ""; } static SEARCH_OPERATOR TranslateOperator(const char *oper); - static CStdString TranslateOperator(SEARCH_OPERATOR oper); + static std::string TranslateOperator(SEARCH_OPERATOR oper); }; class CDatabaseQueryRuleCombination; @@ -129,7 +128,7 @@ public: virtual bool Save(TiXmlNode *parent) const; virtual bool Save(CVariant &obj) const; - CStdString GetWhereClause(const CDatabase &db, const CStdString& strType) const; + std::string GetWhereClause(const CDatabase &db, const std::string& strType) const; std::string TranslateCombinationType() const; Combination GetType() const { return m_type; } diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp index 1e2dc71da8..505c3a4ff0 100644 --- a/xbmc/dbwrappers/sqlitedataset.cpp +++ b/xbmc/dbwrappers/sqlitedataset.cpp @@ -211,7 +211,7 @@ int SqliteDatabase::connect(bool create) { //CLog::Log(LOGDEBUG, "Connecting to sqlite:%s:%s", host.c_str(), db.c_str()); - CStdString db_fullpath = URIUtils::AddFileToFolder(host, db); + std::string db_fullpath = URIUtils::AddFileToFolder(host, db); try { diff --git a/xbmc/dialogs/GUIDialogBoxBase.cpp b/xbmc/dialogs/GUIDialogBoxBase.cpp index 4e6f36fb9c..297672e9f5 100644 --- a/xbmc/dialogs/GUIDialogBoxBase.cpp +++ b/xbmc/dialogs/GUIDialogBoxBase.cpp @@ -31,7 +31,7 @@ using namespace std; #define CONTROL_TEXTBOX 9 #define CONTROL_CHOICES_START 10 -CGUIDialogBoxBase::CGUIDialogBoxBase(int id, const CStdString &xmlFile) +CGUIDialogBoxBase::CGUIDialogBoxBase(int id, const std::string &xmlFile) : CGUIDialog(id, xmlFile) { m_bConfirmed = false; @@ -180,7 +180,7 @@ void CGUIDialogBoxBase::OnDeinitWindow(int nextWindowID) CGUIDialog::OnDeinitWindow(nextWindowID); } -CStdString CGUIDialogBoxBase::GetLocalized(const CVariant &var) const +std::string CGUIDialogBoxBase::GetLocalized(const CVariant &var) const { if (var.isString()) return var.asString(); @@ -189,7 +189,7 @@ CStdString CGUIDialogBoxBase::GetLocalized(const CVariant &var) const return ""; } -CStdString CGUIDialogBoxBase::GetDefaultLabel(int controlId) const +std::string CGUIDialogBoxBase::GetDefaultLabel(int controlId) const { int labelId = GetDefaultLabelID(controlId); return labelId != -1 ? g_localizeStrings.Get(labelId) : ""; diff --git a/xbmc/dialogs/GUIDialogBoxBase.h b/xbmc/dialogs/GUIDialogBoxBase.h index 7979b41246..94e76b4171 100644 --- a/xbmc/dialogs/GUIDialogBoxBase.h +++ b/xbmc/dialogs/GUIDialogBoxBase.h @@ -33,7 +33,7 @@ class CGUIDialogBoxBase : public CGUIDialog { public: - CGUIDialogBoxBase(int id, const CStdString &xmlFile); + CGUIDialogBoxBase(int id, const std::string &xmlFile); virtual ~CGUIDialogBoxBase(void); virtual bool OnMessage(CGUIMessage& message); bool IsConfirmed() const; @@ -42,14 +42,14 @@ public: void SetHeading(const CVariant &heading); void SetChoice(int iButton, const CVariant &choice); protected: - CStdString GetDefaultLabel(int controlId) const; + std::string GetDefaultLabel(int controlId) const; virtual int GetDefaultLabelID(int controlId) const; /*! \brief Get a localized string from a variant If the varaint is already a string we return directly, else if it's an integer we return the corresponding localized string. \param var the variant to localize. */ - CStdString GetLocalized(const CVariant &var) const; + std::string GetLocalized(const CVariant &var) const; virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions); virtual void OnInitWindow(); diff --git a/xbmc/dialogs/GUIDialogButtonMenu.cpp b/xbmc/dialogs/GUIDialogButtonMenu.cpp index 2a286b438f..613b25fafc 100644 --- a/xbmc/dialogs/GUIDialogButtonMenu.cpp +++ b/xbmc/dialogs/GUIDialogButtonMenu.cpp @@ -22,8 +22,8 @@ #define CONTROL_BUTTON_LABEL 3100 -CGUIDialogButtonMenu::CGUIDialogButtonMenu(int id, const CStdString &xmlFile) -: CGUIDialog(id, xmlFile) +CGUIDialogButtonMenu::CGUIDialogButtonMenu(int id, const std::string &xmlFile) +: CGUIDialog(id, xmlFile.c_str()) { m_loadType = KEEP_IN_MEMORY; } diff --git a/xbmc/dialogs/GUIDialogButtonMenu.h b/xbmc/dialogs/GUIDialogButtonMenu.h index 7342b2d7ba..921011e678 100644 --- a/xbmc/dialogs/GUIDialogButtonMenu.h +++ b/xbmc/dialogs/GUIDialogButtonMenu.h @@ -26,7 +26,7 @@ class CGUIDialogButtonMenu : public CGUIDialog { public: - CGUIDialogButtonMenu(int id = WINDOW_DIALOG_BUTTON_MENU, const CStdString &xmlFile = "DialogButtonMenu.xml"); + CGUIDialogButtonMenu(int id = WINDOW_DIALOG_BUTTON_MENU, const std::string &xmlFile = "DialogButtonMenu.xml"); virtual ~CGUIDialogButtonMenu(void); virtual bool OnMessage(CGUIMessage &message); virtual void FrameMove(); diff --git a/xbmc/dialogs/GUIDialogCache.cpp b/xbmc/dialogs/GUIDialogCache.cpp index 1a7d043168..4049074c7b 100644 --- a/xbmc/dialogs/GUIDialogCache.cpp +++ b/xbmc/dialogs/GUIDialogCache.cpp @@ -28,7 +28,7 @@ #include "threads/SingleLock.h" #include "utils/TimeUtils.h" -CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const CStdString& strHeader, const CStdString& strMsg) : CThread("GUIDialogCache") +CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const std::string& strHeader, const std::string& strMsg) : CThread("GUIDialogCache") { m_strHeader = strHeader; m_strLinePrev = strMsg; @@ -85,7 +85,7 @@ void CGUIDialogCache::OpenDialog() bSentCancel = false; } -void CGUIDialogCache::SetHeader(const CStdString& strHeader) +void CGUIDialogCache::SetHeader(const std::string& strHeader) { m_strHeader = strHeader; } @@ -95,7 +95,7 @@ void CGUIDialogCache::SetHeader(int nHeader) SetHeader(g_localizeStrings.Get(nHeader)); } -void CGUIDialogCache::SetMessage(const CStdString& strMessage) +void CGUIDialogCache::SetMessage(const std::string& strMessage) { if (m_pDlg) { diff --git a/xbmc/dialogs/GUIDialogCache.h b/xbmc/dialogs/GUIDialogCache.h index 4944c113a7..cd585bc187 100644 --- a/xbmc/dialogs/GUIDialogCache.h +++ b/xbmc/dialogs/GUIDialogCache.h @@ -23,17 +23,18 @@ #include "filesystem/File.h" #include "threads/Thread.h" #include "threads/SystemClock.h" +#include <string> class CGUIDialogProgress; class CGUIDialogCache : public CThread, public XFILE::IFileCallback { public: - CGUIDialogCache(DWORD dwDelay = 0, const CStdString& strHeader="", const CStdString& strMsg=""); + CGUIDialogCache(DWORD dwDelay = 0, const std::string& strHeader="", const std::string& strMsg=""); virtual ~CGUIDialogCache(); - void SetHeader(const CStdString& strHeader); + void SetHeader(const std::string& strHeader); void SetHeader(int nHeader); - void SetMessage(const CStdString& strMessage); + void SetMessage(const std::string& strMessage); bool IsCanceled() const; void ShowProgressBar(bool bOnOff); void SetPercentage(int iPercentage); @@ -49,9 +50,9 @@ protected: XbmcThreads::EndTime m_endtime; CGUIDialogProgress* m_pDlg; - CStdString m_strLinePrev; - CStdString m_strLinePrev2; - CStdString m_strHeader; + std::string m_strLinePrev; + std::string m_strLinePrev2; + std::string m_strHeader; bool bSentCancel; bool m_bOpenTried; }; diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp index 2b24df488f..5049a35d63 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.cpp +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp @@ -58,14 +58,14 @@ using namespace std; #define BUTTON_START 1001 #define BUTTON_END (BUTTON_START + (int)m_buttons.size() - 1) -void CContextButtons::Add(unsigned int button, const CStdString &label) +void CContextButtons::Add(unsigned int button, const std::string &label) { - push_back(pair<unsigned int, CStdString>(button, label)); + push_back(pair<unsigned int, std::string>(button, label)); } void CContextButtons::Add(unsigned int button, int label) { - push_back(pair<unsigned int, CStdString>(button, g_localizeStrings.Get(label))); + push_back(pair<unsigned int, std::string>(button, g_localizeStrings.Get(label))); } CGUIDialogContextMenu::CGUIDialogContextMenu(void) @@ -202,7 +202,7 @@ float CGUIDialogContextMenu::GetWidth() const return CGUIDialog::GetWidth(); } -bool CGUIDialogContextMenu::SourcesMenu(const CStdString &strType, const CFileItemPtr item, float posX, float posY) +bool CGUIDialogContextMenu::SourcesMenu(const std::string &strType, const CFileItemPtr item, float posX, float posY) { // TODO: This should be callable even if we don't have any valid items if (!item) @@ -218,7 +218,7 @@ bool CGUIDialogContextMenu::SourcesMenu(const CStdString &strType, const CFileIt return false; } -void CGUIDialogContextMenu::GetContextButtons(const CStdString &type, const CFileItemPtr item, CContextButtons &buttons) +void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFileItemPtr item, CContextButtons &buttons) { // Add buttons to the ContextMenu that should be visible for both sources and autosourced items if (item && item->IsRemovable()) @@ -297,7 +297,7 @@ void CGUIDialogContextMenu::GetContextButtons(const CStdString &type, const CFil buttons.Add(CONTEXT_BUTTON_REACTIVATE_LOCK, 12353); } -bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileItemPtr item, CONTEXT_BUTTON button) +bool CGUIDialogContextMenu::OnContextButton(const std::string &type, const CFileItemPtr item, CONTEXT_BUTTON button) { // Add Source doesn't require a valid share if (button == CONTEXT_BUTTON_ADD_SOURCE) @@ -369,10 +369,10 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI // prompt user if they want to really delete the source if (CGUIDialogYesNo::ShowAndGetInput(751, 0, 750, 0)) { // check default before we delete, as deletion will kill the share object - CStdString defaultSource(GetDefaultShareNameByType(type)); + std::string defaultSource(GetDefaultShareNameByType(type)); if (!defaultSource.empty()) { - if (share->strName.Equals(defaultSource)) + if (share->strName == defaultSource) ClearDefault(type); } CMediaSourceSettings::Get().DeleteSource(type, share->strName, share->strPath); @@ -424,7 +424,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI items.Add(current); } // see if there's a local thumb for this item - CStdString folderThumb = item->GetFolderThumb(); + std::string folderThumb = item->GetFolderThumb(); if (XFILE::CFile::Exists(folderThumb)) { CFileItemPtr local(new CFileItem("thumb://Local", false)); @@ -438,7 +438,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI nothumb->SetLabel(g_localizeStrings.Get(20018)); items.Add(nothumb); - CStdString strThumb; + std::string strThumb; VECSOURCES shares; g_mediaManager.GetLocalDrives(shares); if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb)) @@ -539,7 +539,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI return false; std::string strNewPW; - CStdString strNewLockMode; + std::string strNewLockMode; if (CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPW)) strNewLockMode = StringUtils::Format("%i",share->m_iLockMode); else @@ -559,7 +559,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI return false; } -CMediaSource *CGUIDialogContextMenu::GetShare(const CStdString &type, const CFileItem *item) +CMediaSource *CGUIDialogContextMenu::GetShare(const std::string &type, const CFileItem *item) { VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(type); if (!shares || !item) return NULL; @@ -619,10 +619,10 @@ void CGUIDialogContextMenu::OnDeinitWindow(int nextWindowID) CGUIDialog::OnDeinitWindow(nextWindowID); } -CStdString CGUIDialogContextMenu::GetDefaultShareNameByType(const CStdString &strType) +std::string CGUIDialogContextMenu::GetDefaultShareNameByType(const std::string &strType) { VECSOURCES *pShares = CMediaSourceSettings::Get().GetSources(strType); - CStdString strDefault = CMediaSourceSettings::Get().GetDefaultSource(strType); + std::string strDefault = CMediaSourceSettings::Get().GetDefaultSource(strType); if (!pShares) return ""; @@ -634,28 +634,28 @@ CStdString CGUIDialogContextMenu::GetDefaultShareNameByType(const CStdString &st return pShares->at(iIndex).strName; } -void CGUIDialogContextMenu::SetDefault(const CStdString &strType, const CStdString &strDefault) +void CGUIDialogContextMenu::SetDefault(const std::string &strType, const std::string &strDefault) { CMediaSourceSettings::Get().SetDefaultSource(strType, strDefault); CMediaSourceSettings::Get().Save(); } -void CGUIDialogContextMenu::ClearDefault(const CStdString &strType) +void CGUIDialogContextMenu::ClearDefault(const std::string &strType) { SetDefault(strType, ""); } -void CGUIDialogContextMenu::SwitchMedia(const CStdString& strType, const CStdString& strPath) +void CGUIDialogContextMenu::SwitchMedia(const std::string& strType, const std::string& strPath) { // create menu CContextButtons choices; - if (!strType.Equals("music")) + if (strType != "music") choices.Add(WINDOW_MUSIC_FILES, 2); - if (!strType.Equals("video")) + if (strType != "video") choices.Add(WINDOW_VIDEO_FILES, 3); - if (!strType.Equals("pictures")) + if (strType != "pictures") choices.Add(WINDOW_PICTURES, 1); - if (!strType.Equals("files")) + if (strType != "files") choices.Add(WINDOW_FILES, 7); int window = ShowAndGetChoice(choices); diff --git a/xbmc/dialogs/GUIDialogContextMenu.h b/xbmc/dialogs/GUIDialogContextMenu.h index f0c614b648..b96d56743d 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.h +++ b/xbmc/dialogs/GUIDialogContextMenu.h @@ -141,10 +141,10 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0, CONTEXT_BUTTON_USER10 }; -class CContextButtons : public std::vector< std::pair<unsigned int, CStdString> > +class CContextButtons : public std::vector< std::pair<unsigned int, std::string> > { public: - void Add(unsigned int, const CStdString &label); + void Add(unsigned int, const std::string &label); void Add(unsigned int, int label); }; @@ -158,11 +158,11 @@ public: virtual bool OnAction(const CAction& action); virtual void SetPosition(float posX, float posY); - static bool SourcesMenu(const CStdString &strType, const CFileItemPtr item, float posX, float posY); - static void SwitchMedia(const CStdString& strType, const CStdString& strPath); + static bool SourcesMenu(const std::string &strType, const CFileItemPtr item, float posX, float posY); + static void SwitchMedia(const std::string& strType, const std::string& strPath); - static void GetContextButtons(const CStdString &type, const CFileItemPtr item, CContextButtons &buttons); - static bool OnContextButton(const CStdString &type, const CFileItemPtr item, CONTEXT_BUTTON button); + static void GetContextButtons(const std::string &type, const CFileItemPtr item, CContextButtons &buttons); + static bool OnContextButton(const std::string &type, const CFileItemPtr item, CONTEXT_BUTTON button); /*! \brief Show the context menu with the given choices \param choices the choices available for the user. @@ -183,10 +183,10 @@ protected: virtual void OnInitWindow(); virtual void OnWindowLoaded(); virtual void OnDeinitWindow(int nextWindowID); - static CStdString GetDefaultShareNameByType(const CStdString &strType); - static void SetDefault(const CStdString &strType, const CStdString &strDefault); - static void ClearDefault(const CStdString &strType); - static CMediaSource *GetShare(const CStdString &type, const CFileItem *item); + static std::string GetDefaultShareNameByType(const std::string &strType); + static void SetDefault(const std::string &strType, const std::string &strDefault); + static void ClearDefault(const std::string &strType); + static CMediaSource *GetShare(const std::string &type, const CFileItem *item); private: float m_coordX, m_coordY; diff --git a/xbmc/dialogs/GUIDialogFavourites.cpp b/xbmc/dialogs/GUIDialogFavourites.cpp index 8df3aa4a03..a22703976b 100644 --- a/xbmc/dialogs/GUIDialogFavourites.cpp +++ b/xbmc/dialogs/GUIDialogFavourites.cpp @@ -103,7 +103,7 @@ void CGUIDialogFavourites::OnClick(int item) // grab our message, close the dialog, and send CFileItemPtr pItem = (*m_favourites)[item]; - CStdString execute(pItem->GetPath()); + std::string execute(pItem->GetPath()); Close(); @@ -181,7 +181,7 @@ void CGUIDialogFavourites::OnRename(int item) if (item < 0 || item >= m_favourites->Size()) return; - CStdString label((*m_favourites)[item]->GetLabel()); + std::string label((*m_favourites)[item]->GetLabel()); if (CGUIKeyboardFactory::ShowAndGetInput(label, g_localizeStrings.Get(16008), false)) (*m_favourites)[item]->SetLabel(label); @@ -214,7 +214,7 @@ void CGUIDialogFavourites::OnSetThumb(int item) none->SetLabel(g_localizeStrings.Get(20018)); items.Add(none); - CStdString thumb; + std::string thumb; VECSOURCES sources; g_mediaManager.GetLocalDrives(sources); if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(1030), thumb)) diff --git a/xbmc/dialogs/GUIDialogFileBrowser.cpp b/xbmc/dialogs/GUIDialogFileBrowser.cpp index 16c7791bb7..02860e4cca 100644 --- a/xbmc/dialogs/GUIDialogFileBrowser.cpp +++ b/xbmc/dialogs/GUIDialogFileBrowser.cpp @@ -155,7 +155,7 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message) bFool = true; if (iSource > -1 && iSource < (int)m_shares.size()) { - if (m_shares[iSource].strPath.Equals(m_selectedPath)) + if (URIUtils::PathEquals(m_shares[iSource].strPath, m_selectedPath)) bFool = false; } @@ -207,13 +207,13 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message) { int iItem = m_viewControl.GetSelectedItem(); - CStdString strPath; + std::string strPath; if (iItem == 0) strPath = m_selectedPath; else strPath = (*m_vecItems)[iItem]->GetPath(); - CStdString strTest = URIUtils::AddFileToFolder(strPath, "1"); + std::string strTest = URIUtils::AddFileToFolder(strPath, "1"); CFile file; if (file.OpenForWrite(strTest,true)) { @@ -248,10 +248,10 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message) } else if (message.GetSenderId() == CONTROL_NEWFOLDER) { - CStdString strInput; + std::string strInput; if (CGUIKeyboardFactory::ShowAndGetInput(strInput,g_localizeStrings.Get(119),false)) { - CStdString strPath = URIUtils::AddFileToFolder(m_vecItems->GetPath(), strInput); + std::string strPath = URIUtils::AddFileToFolder(m_vecItems->GetPath(), strInput); if (CDirectory::Create(strPath)) Update(m_vecItems->GetPath()); else @@ -337,7 +337,7 @@ void CGUIDialogFileBrowser::OnSort() m_vecItems->Sort(SortByLabel, SortOrderAscending); } -void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) +void CGUIDialogFileBrowser::Update(const std::string &strDirectory) { const CURL pathToUrl(strDirectory); @@ -345,7 +345,7 @@ void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) m_thumbLoader.StopThread(); // get selected item int iItem = m_viewControl.GetSelectedItem(); - CStdString strSelectedItem = ""; + std::string strSelectedItem; if (iItem >= 0 && iItem < m_vecItems->Size()) { CFileItemPtr pItem = (*m_vecItems)[iItem]; @@ -360,7 +360,7 @@ void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) if (!m_singleList) { CFileItemList items; - CStdString strParentPath; + std::string strParentPath; if (!m_rootDir.GetDirectory(pathToUrl, items, m_useFileDirectories)) { @@ -368,7 +368,7 @@ void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) // We assume, we can get the parent // directory again - CStdString strParentPath = m_history.GetParentPath(); + std::string strParentPath = m_history.GetParentPath(); m_history.RemoveParentPath(); Update(strParentPath); return; @@ -446,7 +446,7 @@ void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) m_viewControl.SetItems(*m_vecItems); m_viewControl.SetCurrentView((m_browsingForImages && CAutoSwitch::ByFileCount(*m_vecItems)) ? DEFAULT_VIEW_ICONS : DEFAULT_VIEW_LIST); - CStdString strPath2 = m_Directory->GetPath(); + std::string strPath2 = m_Directory->GetPath(); URIUtils::RemoveSlashAtEnd(strPath2); strSelectedItem = m_history.GetSelectedItem(strPath2==""?"empty":strPath2); @@ -493,7 +493,7 @@ void CGUIDialogFileBrowser::FrameMove() { // Update the current path label CURL url(m_selectedPath); - CStdString safePath = url.GetWithoutUserDetails(); + std::string safePath = url.GetWithoutUserDetails(); SET_CONTROL_LABEL(CONTROL_LABEL_PATH, safePath); } if ((!m_browsingForFolders && (*m_vecItems)[item]->m_bIsFolder) || ((*m_vecItems)[item]->GetPath() == "image://Browse")) @@ -528,7 +528,7 @@ void CGUIDialogFileBrowser::OnClick(int iItem) { if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return ; CFileItemPtr pItem = (*m_vecItems)[iItem]; - CStdString strPath = pItem->GetPath(); + std::string strPath = pItem->GetPath(); if (pItem->m_bIsFolder) { @@ -587,7 +587,7 @@ bool CGUIDialogFileBrowser::HaveDiscOrConnection( int iDriveType ) void CGUIDialogFileBrowser::GoParentFolder() { - CStdString strPath(m_strParentPath), strOldPath(m_Directory->GetPath()); + std::string strPath(m_strParentPath), strOldPath(m_Directory->GetPath()); if (strPath.size() == 2) if (strPath[1] == ':') URIUtils::AddSlashAtEnd(strPath); @@ -609,9 +609,9 @@ void CGUIDialogFileBrowser::OnWindowUnload() m_viewControl.Reset(); } -bool CGUIDialogFileBrowser::ShowAndGetImage(const CFileItemList &items, const VECSOURCES &shares, const CStdString &heading, CStdString &result, bool* flip, int label) +bool CGUIDialogFileBrowser::ShowAndGetImage(const CFileItemList &items, const VECSOURCES &shares, const std::string &heading, std::string &result, bool* flip, int label) { - CStdString mask = ".png|.jpg|.bmp|.gif|.dds"; + std::string mask = ".png|.jpg|.bmp|.gif|.dds"; CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) return false; @@ -652,17 +652,17 @@ bool CGUIDialogFileBrowser::ShowAndGetImage(const CFileItemList &items, const VE return confirmed; } -bool CGUIDialogFileBrowser::ShowAndGetImage(const VECSOURCES &shares, const CStdString &heading, CStdString &path) +bool CGUIDialogFileBrowser::ShowAndGetImage(const VECSOURCES &shares, const std::string &heading, std::string &path) { return ShowAndGetFile(shares, ".png|.jpg|.bmp|.gif|.tbn|.dds", heading, path, true); // true for use thumbs } -bool CGUIDialogFileBrowser::ShowAndGetImageList(const VECSOURCES &shares, const CStdString &heading, std::vector<std::string> &path) +bool CGUIDialogFileBrowser::ShowAndGetImageList(const VECSOURCES &shares, const std::string &heading, std::vector<std::string> &path) { return ShowAndGetFileList(shares, ".png|.jpg|.bmp|.gif|.tbn|.dds", heading, path, true); // true for use thumbs } -bool CGUIDialogFileBrowser::ShowAndGetDirectory(const VECSOURCES &shares, const CStdString &heading, CStdString &path, bool bWriteOnly) +bool CGUIDialogFileBrowser::ShowAndGetDirectory(const VECSOURCES &shares, const std::string &heading, std::string &path, bool bWriteOnly) { // an extension mask of "/" ensures that no files are shown if (bWriteOnly) @@ -680,7 +680,7 @@ bool CGUIDialogFileBrowser::ShowAndGetDirectory(const VECSOURCES &shares, const return ShowAndGetFile(shares, "/", heading, path); } -bool CGUIDialogFileBrowser::ShowAndGetFile(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) +bool CGUIDialogFileBrowser::ShowAndGetFile(const VECSOURCES &shares, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) { CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) @@ -692,7 +692,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const VECSOURCES &shares, const CStdS browser->m_browsingForImages = useThumbs; browser->SetHeading(heading); browser->SetSources(shares); - CStdString strMask = mask; + std::string strMask = mask; if (mask == "/") browser->m_browsingForFolders=1; else @@ -717,7 +717,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const VECSOURCES &shares, const CStdS } // same as above, starting in a single directory -bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */, bool singleList /* = false */) +bool CGUIDialogFileBrowser::ShowAndGetFile(const std::string &directory, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */, bool singleList /* = false */) { CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) @@ -748,7 +748,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CS browser->m_vecItems->Add(item); browser->m_singleList = true; } - CStdString strMask = mask; + std::string strMask = mask; if (mask == "/") browser->m_browsingForFolders=1; else @@ -781,7 +781,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CS return confirmed; } -bool CGUIDialogFileBrowser::ShowAndGetFileList(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, std::vector<std::string> &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) +bool CGUIDialogFileBrowser::ShowAndGetFileList(const VECSOURCES &shares, const std::string &mask, const std::string &heading, std::vector<std::string> &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) { CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) @@ -810,13 +810,13 @@ bool CGUIDialogFileBrowser::ShowAndGetFileList(const VECSOURCES &shares, const C return confirmed; } -void CGUIDialogFileBrowser::SetHeading(const CStdString &heading) +void CGUIDialogFileBrowser::SetHeading(const std::string &heading) { Initialize(); SET_CONTROL_LABEL(CONTROL_HEADING_LABEL, heading); } -bool CGUIDialogFileBrowser::ShowAndGetSource(CStdString &path, bool allowNetworkShares, VECSOURCES* additionalShare /* = NULL */, const CStdString& strType /* = "" */) +bool CGUIDialogFileBrowser::ShowAndGetSource(std::string &path, bool allowNetworkShares, VECSOURCES* additionalShare /* = NULL */, const std::string& strType /* = "" */) { // Technique is // 1. Show Filebrowser with currently defined local, and optionally the network locations. @@ -892,7 +892,7 @@ void CGUIDialogFileBrowser::SetSources(const VECSOURCES &shares) void CGUIDialogFileBrowser::OnAddNetworkLocation() { // ok, fire up the network location dialog - CStdString path; + std::string path; if (CGUIDialogNetworkSetup::ShowAndGetNetworkAddress(path)) { // verify the path by doing a GetDirectory. @@ -942,7 +942,7 @@ bool CGUIDialogFileBrowser::OnPopupMenu(int iItem) { if (m_addNetworkShareEnabled) { - CStdString strOldPath=m_selectedPath,newPath=m_selectedPath; + std::string strOldPath=m_selectedPath,newPath=m_selectedPath; VECSOURCES shares=m_shares; if (CGUIDialogNetworkSetup::ShowAndGetNetworkAddress(newPath)) { diff --git a/xbmc/dialogs/GUIDialogFileBrowser.h b/xbmc/dialogs/GUIDialogFileBrowser.h index 3636beb5d0..d4788e0f09 100644 --- a/xbmc/dialogs/GUIDialogFileBrowser.h +++ b/xbmc/dialogs/GUIDialogFileBrowser.h @@ -41,16 +41,16 @@ public: virtual void OnWindowLoaded(); virtual void OnWindowUnload(); bool IsConfirmed() { return m_bConfirmed; }; - void SetHeading(const CStdString &heading); + void SetHeading(const std::string &heading); - static bool ShowAndGetDirectory(const VECSOURCES &shares, const CStdString &heading, CStdString &path, bool bWriteOnly=false); - static bool ShowAndGetFile(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs = false, bool useFileDirectories = false); - static bool ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false); - static bool ShowAndGetSource(CStdString &path, bool allowNetworkShares, VECSOURCES* additionalShare = NULL, const CStdString& strType=""); - static bool ShowAndGetFileList(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, std::vector<std::string> &path, bool useThumbs = false, bool useFileDirectories = false); - static bool ShowAndGetImage(const VECSOURCES &shares, const CStdString &heading, CStdString &path); - static bool ShowAndGetImage(const CFileItemList &items, const VECSOURCES &shares, const CStdString &heading, CStdString &path, bool* flip=NULL, int label=21371); - static bool ShowAndGetImageList(const VECSOURCES &shares, const CStdString &heading, std::vector<std::string> &path); + static bool ShowAndGetDirectory(const VECSOURCES &shares, const std::string &heading, std::string &path, bool bWriteOnly=false); + static bool ShowAndGetFile(const VECSOURCES &shares, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs = false, bool useFileDirectories = false); + static bool ShowAndGetFile(const std::string &directory, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false); + static bool ShowAndGetSource(std::string &path, bool allowNetworkShares, VECSOURCES* additionalShare = NULL, const std::string& strType=""); + static bool ShowAndGetFileList(const VECSOURCES &shares, const std::string &mask, const std::string &heading, std::vector<std::string> &path, bool useThumbs = false, bool useFileDirectories = false); + static bool ShowAndGetImage(const VECSOURCES &shares, const std::string &heading, std::string &path); + static bool ShowAndGetImage(const CFileItemList &items, const VECSOURCES &shares, const std::string &heading, std::string &path, bool* flip=NULL, int label=21371); + static bool ShowAndGetImageList(const VECSOURCES &shares, const std::string &heading, std::vector<std::string> &path); void SetSources(const VECSOURCES &shares); @@ -65,7 +65,7 @@ protected: void OnClick(int iItem); void OnSort(); void ClearFileItems(); - void Update(const CStdString &strDirectory); + void Update(const std::string &strDirectory); bool HaveDiscOrConnection( int iDriveType ); bool OnPopupMenu(int iItem); void OnAddNetworkLocation(); @@ -77,15 +77,15 @@ protected: XFILE::CVirtualDirectory m_rootDir; CFileItemList* m_vecItems; CFileItem* m_Directory; - CStdString m_strParentPath; - CStdString m_selectedPath; + std::string m_strParentPath; + std::string m_selectedPath; CDirectoryHistory m_history; int m_browsingForFolders; // 0 - no, 1 - yes, 2 - yes, only writable bool m_bConfirmed; int m_bFlip; bool m_addNetworkShareEnabled; bool m_flipEnabled; - CStdString m_addSourceType; + std::string m_addSourceType; bool m_browsingForImages; bool m_useFileDirectories; bool m_singleList; // if true, we have no shares or anything diff --git a/xbmc/dialogs/GUIDialogGamepad.cpp b/xbmc/dialogs/GUIDialogGamepad.cpp index 8845c1181c..c43959d9aa 100644 --- a/xbmc/dialogs/GUIDialogGamepad.cpp +++ b/xbmc/dialogs/GUIDialogGamepad.cpp @@ -80,7 +80,7 @@ bool CGUIDialogGamepad::OnAction(const CAction &action) break; } - CStdString strHiddenInput(m_strUserInput); + std::string strHiddenInput(m_strUserInput); for (int i = 0; i < (int)strHiddenInput.size(); i++) { strHiddenInput[i] = m_cHideInputChar; @@ -102,9 +102,9 @@ bool CGUIDialogGamepad::OnAction(const CAction &action) m_bConfirmed = false; m_bCanceled = false; - CStdString md5pword2 = XBMC::XBMC_MD5::GetMD5(m_strUserInput); + std::string md5pword2 = XBMC::XBMC_MD5::GetMD5(m_strUserInput); - if (!m_strPassword.Equals(md5pword2)) + if (!StringUtils::EqualsNoCase(m_strPassword, md5pword2)) { // incorrect password entered m_iRetries--; @@ -167,10 +167,10 @@ bool CGUIDialogGamepad::OnMessage(CGUIMessage& message) // \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer. // \param bHideUserInput Masks user input as asterisks if set as true. Currently not yet implemented. // \return true if successful display and user input. false if unsuccessful display, no user input, or canceled editing. -bool CGUIDialogGamepad::ShowAndGetInput(CStdString& aTextString, const CStdString &dlgHeading, bool bHideUserInput) +bool CGUIDialogGamepad::ShowAndGetInput(std::string& aTextString, const std::string &dlgHeading, bool bHideUserInput) { // Prompt user for input - CStdString strUserInput = ""; + std::string strUserInput; if (ShowAndVerifyInput(strUserInput, dlgHeading, aTextString, "", "", true, bHideUserInput)) { // user entry was blank @@ -190,10 +190,10 @@ bool CGUIDialogGamepad::ShowAndGetInput(CStdString& aTextString, const CStdStrin // \brief Show gamepad keypad twice to get and confirm a user-entered password string. // \param strNewPassword String to preload into the keyboard accumulator. Overwritten with user input if return=true. // \return true if successful display and user input entry/re-entry. false if unsuccessful display, no user input, or canceled editing. -bool CGUIDialogGamepad::ShowAndVerifyNewPassword(CStdString& strNewPassword) +bool CGUIDialogGamepad::ShowAndVerifyNewPassword(std::string& strNewPassword) { // Prompt user for password input - CStdString strUserInput = ""; + std::string strUserInput; if (ShowAndVerifyInput(strUserInput, "12340", "12330", "12331", "", true, true)) { // TODO: Show error to user saying the password entry was blank @@ -223,9 +223,9 @@ bool CGUIDialogGamepad::ShowAndVerifyNewPassword(CStdString& strNewPassword) // \param dlgHeading String shown on dialog title. Converts to localized string if contains a positive integer. // \param iRetries If greater than 0, shows "Incorrect password, %d retries left" on dialog line 2, else line 2 is blank. // \return 0 if successful display and user input. 1 if unsuccessful input. -1 if no user input or canceled editing. -int CGUIDialogGamepad::ShowAndVerifyPassword(CStdString& strPassword, const CStdString& dlgHeading, int iRetries) +int CGUIDialogGamepad::ShowAndVerifyPassword(std::string& strPassword, const std::string& dlgHeading, int iRetries) { - CStdString strLine2 = ""; + std::string strLine2; if (0 < iRetries) { // Show a string telling user they have iRetries retries left @@ -233,7 +233,7 @@ int CGUIDialogGamepad::ShowAndVerifyPassword(CStdString& strPassword, const CStd } // make a copy of strPassword to prevent from overwriting it later - CStdString strPassTemp = strPassword; + std::string strPassTemp = strPassword; if (ShowAndVerifyInput(strPassTemp, dlgHeading, g_localizeStrings.Get(12330), g_localizeStrings.Get(12331), strLine2, true, true)) { // user entered correct password @@ -257,9 +257,9 @@ int CGUIDialogGamepad::ShowAndVerifyPassword(CStdString& strPassword, const CStd // \param bGetUserInput If set as true and return=true, strToVerify is overwritten with user input string. // \param bHideInputChars Masks user input as asterisks if set as true. Currently not yet implemented. // \return true if successful display and user input. false if unsuccessful display, no user input, or canceled editing. -bool CGUIDialogGamepad::ShowAndVerifyInput(CStdString& strToVerify, const CStdString& dlgHeading, - const CStdString& dlgLine0, const CStdString& dlgLine1, - const CStdString& dlgLine2, bool bGetUserInput, bool bHideInputChars) +bool CGUIDialogGamepad::ShowAndVerifyInput(std::string& strToVerify, const std::string& dlgHeading, + const std::string& dlgLine0, const std::string& dlgLine1, + const std::string& dlgLine2, bool bGetUserInput, bool bHideInputChars) { // Prompt user for password input CGUIDialogGamepad *pDialog = (CGUIDialogGamepad *)g_windowManager.GetWindow(WINDOW_DIALOG_GAMEPAD); diff --git a/xbmc/dialogs/GUIDialogGamepad.h b/xbmc/dialogs/GUIDialogGamepad.h index 888c72d733..27c17e81c7 100644 --- a/xbmc/dialogs/GUIDialogGamepad.h +++ b/xbmc/dialogs/GUIDialogGamepad.h @@ -30,15 +30,15 @@ public: virtual ~CGUIDialogGamepad(void); virtual bool OnMessage(CGUIMessage& message); bool IsCanceled() const; - CStdString m_strUserInput; - CStdString m_strPassword; + std::string m_strUserInput; + std::string m_strPassword; int m_iRetries; bool m_bUserInputCleanup; bool m_bHideInputChars; - static bool ShowAndGetInput(CStdString& aTextString, const CStdString& dlgHeading, bool bHideUserInput); - static bool ShowAndVerifyNewPassword(CStdString& strNewPassword); - static int ShowAndVerifyPassword(CStdString& strPassword, const CStdString& dlgHeading, int iRetries); - static bool ShowAndVerifyInput(CStdString& strPassword, const CStdString& dlgHeading, const CStdString& dlgLine0, const CStdString& dlgLine1, const CStdString& dlgLine2, bool bGetUserInput, bool bHideInputChars); + static bool ShowAndGetInput(std::string& aTextString, const std::string& dlgHeading, bool bHideUserInput); + static bool ShowAndVerifyNewPassword(std::string& strNewPassword); + static int ShowAndVerifyPassword(std::string& strPassword, const std::string& dlgHeading, int iRetries); + static bool ShowAndVerifyInput(std::string& strPassword, const std::string& dlgHeading, const std::string& dlgLine0, const std::string& dlgLine1, const std::string& dlgLine2, bool bGetUserInput, bool bHideInputChars); protected: virtual bool OnAction(const CAction &action); bool m_bCanceled; diff --git a/xbmc/dialogs/GUIDialogKaiToast.cpp b/xbmc/dialogs/GUIDialogKaiToast.cpp index ddbab9d16a..97b0ccd473 100644 --- a/xbmc/dialogs/GUIDialogKaiToast.cpp +++ b/xbmc/dialogs/GUIDialogKaiToast.cpp @@ -75,22 +75,22 @@ void CGUIDialogKaiToast::OnWindowLoaded() m_defaultIcon = msg.GetLabel(); } -void CGUIDialogKaiToast::QueueNotification(eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) +void CGUIDialogKaiToast::QueueNotification(eMessageType eType, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) { AddToQueue("", eType, aCaption, aDescription, displayTime, withSound, messageTime); } -void CGUIDialogKaiToast::QueueNotification(const CStdString& aCaption, const CStdString& aDescription) +void CGUIDialogKaiToast::QueueNotification(const std::string& aCaption, const std::string& aDescription) { QueueNotification("", aCaption, aDescription); } -void CGUIDialogKaiToast::QueueNotification(const CStdString& aImageFile, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) +void CGUIDialogKaiToast::QueueNotification(const std::string& aImageFile, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) { AddToQueue(aImageFile, Default, aCaption, aDescription, displayTime, withSound, messageTime); } -void CGUIDialogKaiToast::AddToQueue(const CStdString& aImageFile, const eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) +void CGUIDialogKaiToast::AddToQueue(const std::string& aImageFile, const eMessageType eType, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime /*= TOAST_DISPLAY_TIME*/, bool withSound /*= true*/, unsigned int messageTime /*= TOAST_MESSAGE_TIME*/) { CSingleLock lock(m_critical); diff --git a/xbmc/dialogs/GUIDialogKaiToast.h b/xbmc/dialogs/GUIDialogKaiToast.h index d0f36efc51..443083acc7 100644 --- a/xbmc/dialogs/GUIDialogKaiToast.h +++ b/xbmc/dialogs/GUIDialogKaiToast.h @@ -37,9 +37,9 @@ public: struct Notification { - CStdString caption; - CStdString description; - CStdString imagefile; + std::string caption; + std::string description; + std::string imagefile; eMessageType eType; unsigned int displayTime; unsigned int messageTime; @@ -48,9 +48,9 @@ public: typedef std::queue<Notification> TOASTQUEUE; - static void QueueNotification(eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME); - static void QueueNotification(const CStdString& aCaption, const CStdString& aDescription); - static void QueueNotification(const CStdString& aImageFile, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME); + static void QueueNotification(eMessageType eType, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME); + static void QueueNotification(const std::string& aCaption, const std::string& aDescription); + static void QueueNotification(const std::string& aImageFile, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime = TOAST_DISPLAY_TIME, bool withSound = true, unsigned int messageTime = TOAST_MESSAGE_TIME); bool DoWork(); virtual bool OnMessage(CGUIMessage& message); @@ -59,14 +59,14 @@ public: void ResetTimer(); protected: - static void AddToQueue(const CStdString& aImageFile, const eMessageType eType, const CStdString& aCaption, const CStdString& aDescription, unsigned int displayTime, bool withSound, unsigned int messageTime); + static void AddToQueue(const std::string& aImageFile, const eMessageType eType, const std::string& aCaption, const std::string& aDescription, unsigned int displayTime, bool withSound, unsigned int messageTime); unsigned int m_timer; unsigned int m_toastDisplayTime; unsigned int m_toastMessageTime; - CStdString m_defaultIcon; + std::string m_defaultIcon; static TOASTQUEUE m_notifications; static CCriticalSection m_critical; diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index 57e46ae7ad..f8cd48ddc8 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -309,7 +309,7 @@ bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message) return true; } -void CGUIDialogKeyboardGeneric::SetText(const CStdString& aTextString) +void CGUIDialogKeyboardGeneric::SetText(const std::string& aTextString) { m_strEdit.clear(); m_strEditing.clear(); @@ -319,9 +319,9 @@ void CGUIDialogKeyboardGeneric::SetText(const CStdString& aTextString) SetCursorPos(m_strEdit.size()); } -void CGUIDialogKeyboardGeneric::InputText(const CStdString& aTextString) +void CGUIDialogKeyboardGeneric::InputText(const std::string& aTextString) { - CStdStringW newStr; + std::wstring newStr; g_charsetConverter.utf8ToW(aTextString, newStr); if (!newStr.empty()) { @@ -333,7 +333,7 @@ void CGUIDialogKeyboardGeneric::InputText(const CStdString& aTextString) } } -void CGUIDialogKeyboardGeneric::InputTextEditing(const CStdString& aTextString, int start, int length) +void CGUIDialogKeyboardGeneric::InputTextEditing(const std::string& aTextString, int start, int length) { m_strEditing.clear(); m_iEditingOffset = start; @@ -344,9 +344,9 @@ void CGUIDialogKeyboardGeneric::InputTextEditing(const CStdString& aTextString, SetCursorPos(GetCursorPos()); } -CStdString CGUIDialogKeyboardGeneric::GetText() const +std::string CGUIDialogKeyboardGeneric::GetText() const { - CStdString utf8String; + std::string utf8String; g_charsetConverter.wToUTF8(m_strEdit, utf8String); return utf8String; } @@ -379,7 +379,7 @@ void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice CGUILabelControl* pEdit = dynamic_cast<CGUILabelControl*>(GetControl(CTL_LABEL_EDIT)); if (pEdit) { - CStdStringW edit = m_strEdit; + std::wstring edit = m_strEdit; pEdit->SetHighlight(0, 0); pEdit->SetSelection(0, 0); if (m_hiddenInput) @@ -401,7 +401,7 @@ void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice pEdit->SetSelection(m_iCursorPos + m_iEditingOffset, m_iCursorPos + m_iEditingOffset + m_iEditingLength); } // convert back to utf8 - CStdString utf8Edit; + std::string utf8Edit; g_charsetConverter.wToUTF8(edit, utf8Edit); pEdit->SetLabel(utf8Edit); // Send off a search message @@ -533,7 +533,7 @@ void CGUIDialogKeyboardGeneric::UpdateButtons() char szLabel[2]; szLabel[0] = 32; szLabel[1] = 0; - CStdString aLabel = szLabel; + std::string aLabel = szLabel; // set numerals for (int iButton = 48; iButton <= 57; iButton++) @@ -628,9 +628,9 @@ void CGUIDialogKeyboardGeneric::OnIPAddress() { // find any IP address in the current string if there is any // We match to #.#.#.# - CStdString utf8String; + std::string utf8String; g_charsetConverter.wToUTF8(m_strEdit, utf8String); - CStdString ip; + std::string ip; CRegExp reg; reg.RegComp("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); int start = reg.RegFind(utf8String.c_str()); @@ -662,7 +662,7 @@ void CGUIDialogKeyboardGeneric::ResetShiftAndSymbols() const char* CGUIDialogKeyboardGeneric::s_charsSeries[10] = { " 0!@#$%^&*()[]{}<>/\\|", ".,1;:\'\"-+_=?`~", "ABC2", "DEF3", "GHI4", "JKL5", "MNO6", "PQRS7", "TUV8", "WXYZ9" }; -void CGUIDialogKeyboardGeneric::SetControlLabel(int id, const CStdString &label) +void CGUIDialogKeyboardGeneric::SetControlLabel(int id, const std::string &label) { // find all controls with this id, and set all their labels CGUIMessage message(GUI_MSG_LABEL_SET, GetID(), id); message.SetLabel(label); @@ -724,8 +724,8 @@ bool CGUIDialogKeyboardGeneric::ShowAndGetInput(char_callback_t pCallback, const void CGUIDialogKeyboardGeneric::OnPasteClipboard(void) { - CStdStringW unicode_text; - CStdStringA utf8_text; + std::wstring unicode_text; + std::string utf8_text; // Get text from the clipboard utf8_text = g_Windowing.GetClipboardText(); @@ -738,8 +738,8 @@ void CGUIDialogKeyboardGeneric::OnPasteClipboard(void) size_t i = GetCursorPos(); if (i > m_strEdit.size()) i = m_strEdit.size(); - CStdStringW left_end = m_strEdit.substr(0, i); - CStdStringW right_end = m_strEdit.substr(i); + std::wstring left_end = m_strEdit.substr(0, i); + std::wstring right_end = m_strEdit.substr(i); m_strEdit = left_end; m_strEdit.append(unicode_text); diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.h b/xbmc/dialogs/GUIDialogKeyboardGeneric.h index 47df71fa05..f3236b9d7e 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.h +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.h @@ -39,10 +39,10 @@ class CGUIDialogKeyboardGeneric : public CGUIDialog, public CGUIKeyboard //CGUIDialog Interface virtual void FrameMove(); void SetHeading(const std::string& heading); - void SetText(const CStdString& aTextString); - void InputText(const CStdString& aTextString); - void InputTextEditing(const CStdString& aTextString, int start, int length); - CStdString GetText() const; + void SetText(const std::string& aTextString); + void InputText(const std::string& aTextString); + void InputTextEditing(const std::string& aTextString, int start, int length); + std::string GetText() const; bool IsConfirmed() { return m_bIsConfirmed; }; void SetHiddenInput(bool hiddenInput) { m_hiddenInput = hiddenInput; }; void Character(WCHAR wch); @@ -53,7 +53,7 @@ class CGUIDialogKeyboardGeneric : public CGUIDialog, public CGUIKeyboard virtual bool OnAction(const CAction &action); virtual bool OnMessage(CGUIMessage& message); virtual void OnDeinitWindow(int nextWindowID); - void SetControlLabel(int id, const CStdString &label); + void SetControlLabel(int id, const std::string &label); void OnShift(); void MoveCursor(int iAmount); void SetCursorPos(int iPos); @@ -72,11 +72,11 @@ class CGUIDialogKeyboardGeneric : public CGUIDialog, public CGUIKeyboard void Backspace(); void SendSearchMessage(); - CStdStringW m_strEdit; + std::wstring m_strEdit; int m_iCursorPos; // holds the spelling region of keystrokes/text generated from 'input method' - CStdStringW m_strEditing; + std::wstring m_strEditing; int m_iEditingOffset; int m_iEditingLength; diff --git a/xbmc/dialogs/GUIDialogMediaFilter.cpp b/xbmc/dialogs/GUIDialogMediaFilter.cpp index 0685eb72e6..651e04d8ad 100644 --- a/xbmc/dialogs/GUIDialogMediaFilter.cpp +++ b/xbmc/dialogs/GUIDialogMediaFilter.cpp @@ -633,7 +633,7 @@ int CGUIDialogMediaFilter::GetItems(const Filter &filter, std::vector<std::strin if (!videodb.Open()) return -1; - std::set<CStdString> playlists; + std::set<std::string> playlists; CDatabase::Filter dbfilter; dbfilter.where = tmpFilter.GetWhereClause(videodb, playlists); @@ -664,7 +664,7 @@ int CGUIDialogMediaFilter::GetItems(const Filter &filter, std::vector<std::strin if (!musicdb.Open()) return -1; - std::set<CStdString> playlists; + std::set<std::string> playlists; CDatabase::Filter dbfilter; dbfilter.where = tmpFilter.GetWhereClause(musicdb, playlists); @@ -758,8 +758,8 @@ void CGUIDialogMediaFilter::GetRange(const Filter &filter, int &min, int &interv if (m_mediaType == "movies" || m_mediaType == "tvshows" || m_mediaType == "musicvideos") { - CStdString table; - CStdString year; + std::string table; + std::string year; if (m_mediaType == "movies") { table = "movieview"; @@ -782,7 +782,7 @@ void CGUIDialogMediaFilter::GetRange(const Filter &filter, int &min, int &interv } else if (m_mediaType == "albums" || m_mediaType == "songs") { - CStdString table; + std::string table; if (m_mediaType == "albums") table = "albumview"; else if (m_mediaType == "songs") @@ -803,7 +803,7 @@ void CGUIDialogMediaFilter::GetRange(const Filter &filter, int &min, int &interv if (m_mediaType == "episodes") { - CStdString field = StringUtils::Format("CAST(strftime(\"%%s\", c%02d) AS INTEGER)", VIDEODB_ID_EPISODE_AIRED); + std::string 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 @@ -880,7 +880,7 @@ bool CGUIDialogMediaFilter::GetMinMax(const std::string &table, const std::strin } CDatabase::Filter extFilter = filter; - CStdString strSQLExtra; + std::string strSQLExtra; if (!db->BuildSQL(m_dbUrl->ToString(), strSQLExtra, extFilter, strSQLExtra, *dbUrl)) { delete db; @@ -888,10 +888,10 @@ bool CGUIDialogMediaFilter::GetMinMax(const std::string &table, const std::strin return false; } - CStdString strSQL = "SELECT %s FROM %s "; + std::string strSQL = "SELECT %s FROM %s "; - min = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, CStdString("MIN(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0)); - max = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, CStdString("MAX(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0)); + min = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MIN(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0)); + max = static_cast<int>(strtol(db->GetSingleValue(db->PrepareSQL(strSQL, std::string("MAX(" + field + ")").c_str(), table.c_str()) + strSQLExtra).c_str(), NULL, 0)); db->Close(); delete db; diff --git a/xbmc/dialogs/GUIDialogMediaSource.cpp b/xbmc/dialogs/GUIDialogMediaSource.cpp index 428111033b..f7075af9ec 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.cpp +++ b/xbmc/dialogs/GUIDialogMediaSource.cpp @@ -128,7 +128,7 @@ bool CGUIDialogMediaSource::OnMessage(CGUIMessage& message) // \brief Show CGUIDialogMediaSource dialog and prompt for a new media source. // \return True if the media source is added, false otherwise. -bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type) +bool CGUIDialogMediaSource::ShowAndAddMediaSource(const std::string &type) { CGUIDialogMediaSource *dialog = (CGUIDialogMediaSource *)g_windowManager.GetWindow(WINDOW_DIALOG_MEDIA_SOURCE); if (!dialog) return false; @@ -143,12 +143,12 @@ bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type) unsigned int i,j=2; bool bConfirmed=false; VECSOURCES* pShares = CMediaSourceSettings::Get().GetSources(type); - CStdString strName = dialog->m_name; + std::string strName = dialog->m_name; while (!bConfirmed) { for (i=0;i<pShares->size();++i) { - if ((*pShares)[i].strName.Equals(strName)) + if (StringUtils::EqualsNoCase((*pShares)[i].strName, strName)) break; } if (i < pShares->size()) // found a match - try next @@ -166,23 +166,23 @@ bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type) return confirmed; } -bool CGUIDialogMediaSource::ShowAndEditMediaSource(const CStdString &type, const CStdString&share) +bool CGUIDialogMediaSource::ShowAndEditMediaSource(const std::string &type, const std::string&share) { VECSOURCES* pShares = CMediaSourceSettings::Get().GetSources(type); if (pShares) { for (unsigned int i=0;i<pShares->size();++i) { - if ((*pShares)[i].strName.Equals(share)) + if (StringUtils::EqualsNoCase((*pShares)[i].strName, share)) return ShowAndEditMediaSource(type,(*pShares)[i]); } } return false; } -bool CGUIDialogMediaSource::ShowAndEditMediaSource(const CStdString &type, const CMediaSource &share) +bool CGUIDialogMediaSource::ShowAndEditMediaSource(const std::string &type, const CMediaSource &share) { - CStdString strOldName = share.strName; + std::string strOldName = share.strName; CGUIDialogMediaSource *dialog = (CGUIDialogMediaSource *)g_windowManager.GetWindow(WINDOW_DIALOG_MEDIA_SOURCE); if (!dialog) return false; dialog->Initialize(); @@ -195,12 +195,12 @@ bool CGUIDialogMediaSource::ShowAndEditMediaSource(const CStdString &type, const unsigned int i,j=2; bool bConfirmed=false; VECSOURCES* pShares = CMediaSourceSettings::Get().GetSources(type); - CStdString strName = dialog->m_name; + std::string strName = dialog->m_name; while (!bConfirmed) { for (i=0;i<pShares->size();++i) { - if ((*pShares)[i].strName.Equals(strName)) + if (StringUtils::EqualsNoCase((*pShares)[i].strName, strName)) break; } if (i < pShares->size() && (*pShares)[i].strName != strOldName) // found a match - try next @@ -222,7 +222,7 @@ void CGUIDialogMediaSource::OnPathBrowse(int item) if (item < 0 || item > m_paths->Size()) return; // Browse is called. Open the filebrowser dialog. // Ignore current path is best at this stage?? - CStdString path; + std::string path; bool allowNetworkShares(m_type != "programs"); VECSOURCES extraShares; @@ -360,7 +360,7 @@ void CGUIDialogMediaSource::OnPath(int item) if (m_name != CUtil::GetTitleFromPath(m_paths->Get(item)->GetPath())) m_bNameChanged=true; - CStdString path(m_paths->Get(item)->GetPath()); + std::string path(m_paths->Get(item)->GetPath()); CGUIKeyboardFactory::ShowAndGetInput(path, g_localizeStrings.Get(1021), false); m_paths->Get(item)->SetPath(path); @@ -425,7 +425,7 @@ void CGUIDialogMediaSource::UpdateButtons() for (int i = 0; i < m_paths->Size(); i++) { CFileItemPtr item = m_paths->Get(i); - CStdString path; + std::string path; CURL url(item->GetPath()); path = url.GetWithoutUserDetails(); if (path.empty()) path = "<"+g_localizeStrings.Get(231)+">"; // <None> @@ -455,7 +455,7 @@ void CGUIDialogMediaSource::SetShare(const CMediaSource &share) UpdateButtons(); } -void CGUIDialogMediaSource::SetTypeOfMedia(const CStdString &type, bool editNotAdd) +void CGUIDialogMediaSource::SetTypeOfMedia(const std::string &type, bool editNotAdd) { m_type = type; int typeStringID = -1; @@ -469,7 +469,7 @@ void CGUIDialogMediaSource::SetTypeOfMedia(const CStdString &type, bool editNotA typeStringID = 1213; // "Pictures" else // if (type == "files"); typeStringID = 744; // "Files" - CStdString format; + std::string format; format = StringUtils::Format(g_localizeStrings.Get(editNotAdd ? 1028 : 1020).c_str(), g_localizeStrings.Get(typeStringID).c_str()); SET_CONTROL_LABEL(CONTROL_HEADING, format); } diff --git a/xbmc/dialogs/GUIDialogMediaSource.h b/xbmc/dialogs/GUIDialogMediaSource.h index 54a4140912..66ec95a1ab 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.h +++ b/xbmc/dialogs/GUIDialogMediaSource.h @@ -34,14 +34,14 @@ public: virtual bool OnMessage(CGUIMessage& message); virtual void OnDeinitWindow(int nextWindowID); virtual bool OnBack(int actionID); - static bool ShowAndAddMediaSource(const CStdString &type); - static bool ShowAndEditMediaSource(const CStdString &type, const CMediaSource &share); - static bool ShowAndEditMediaSource(const CStdString &type, const CStdString &share); + static bool ShowAndAddMediaSource(const std::string &type); + static bool ShowAndEditMediaSource(const std::string &type, const CMediaSource &share); + static bool ShowAndEditMediaSource(const std::string &type, const std::string &share); bool IsConfirmed() const { return m_confirmed; }; void SetShare(const CMediaSource &share); - void SetTypeOfMedia(const CStdString &type, bool editNotAdd = false); + void SetTypeOfMedia(const std::string &type, bool editNotAdd = false); protected: void OnPathBrowse(int item); void OnPath(int item); @@ -55,8 +55,8 @@ protected: std::vector<std::string> GetPaths() const; - CStdString m_type; - CStdString m_name; + std::string m_type; + std::string m_name; CFileItemList* m_paths; bool m_confirmed; bool m_bNameChanged; diff --git a/xbmc/dialogs/GUIDialogNumeric.cpp b/xbmc/dialogs/GUIDialogNumeric.cpp index f630692050..7610b8892e 100644 --- a/xbmc/dialogs/GUIDialogNumeric.cpp +++ b/xbmc/dialogs/GUIDialogNumeric.cpp @@ -300,7 +300,7 @@ void CGUIDialogNumeric::OnNext() void CGUIDialogNumeric::FrameMove() { - CStdString strLabel; + std::string strLabel; unsigned int start = 0; unsigned int end = 0; if (m_mode == INPUT_PASSWORD) @@ -556,7 +556,7 @@ void CGUIDialogNumeric::SetMode(INPUT_MODE mode, void *initial) m_lastblock = 3; m_ip[0] = m_ip[1] = m_ip[2] = m_ip[3] = 0; // copy ip string into numeric form - CStdString ip = *(CStdString *)initial; + std::string ip = *(std::string *)initial; unsigned int block = 0; for (unsigned int i=0; i < ip.size(); i++) { @@ -574,10 +574,10 @@ void CGUIDialogNumeric::SetMode(INPUT_MODE mode, void *initial) } } else if (m_mode == INPUT_NUMBER || m_mode == INPUT_PASSWORD) - m_number = *(CStdString *)initial; + m_number = *(std::string *)initial; } -void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const CStdString &initial) +void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const std::string &initial) { m_mode = mode; m_block = 0; @@ -595,7 +595,7 @@ void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const CStdString &initial) } else { - CStdString tmp = initial; + std::string tmp = initial; // if we are handling seconds and if the string only contains // "mm:ss" we need to add dummy "hh:" to get "hh:mm:ss" if (m_mode == INPUT_TIME_SECONDS && tmp.size() <= 5) @@ -605,7 +605,7 @@ void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const CStdString &initial) } else if (m_mode == INPUT_DATE) { - CStdString tmp = initial; + std::string tmp = initial; StringUtils::Replace(tmp, '/', '.'); dateTime.SetFromDBDate(tmp); } @@ -626,14 +626,14 @@ void CGUIDialogNumeric::GetOutput(void *output) const 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 *)output = StringUtils::Format("%d.%d.%d.%d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]); + *(std::string *)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 *)output = m_number; + *(std::string *)output = m_number; } -CStdString CGUIDialogNumeric::GetOutput() const +std::string CGUIDialogNumeric::GetOutput() const { - CStdString output; + std::string output; if (m_mode == INPUT_DATE) output = StringUtils::Format("%02i/%02i/%04i", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear); else if (m_mode == INPUT_TIME) @@ -645,7 +645,7 @@ CStdString CGUIDialogNumeric::GetOutput() const return output; } -bool CGUIDialogNumeric::ShowAndGetSeconds(CStdString &timeString, const CStdString &heading) +bool CGUIDialogNumeric::ShowAndGetSeconds(std::string &timeString, const std::string &heading) { CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); if (!pDialog) return false; @@ -665,7 +665,7 @@ bool CGUIDialogNumeric::ShowAndGetSeconds(CStdString &timeString, const CStdStri return true; } -bool CGUIDialogNumeric::ShowAndGetTime(SYSTEMTIME &time, const CStdString &heading) +bool CGUIDialogNumeric::ShowAndGetTime(SYSTEMTIME &time, const std::string &heading) { CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); if (!pDialog) return false; @@ -678,7 +678,7 @@ bool CGUIDialogNumeric::ShowAndGetTime(SYSTEMTIME &time, const CStdString &headi return true; } -bool CGUIDialogNumeric::ShowAndGetDate(SYSTEMTIME &date, const CStdString &heading) +bool CGUIDialogNumeric::ShowAndGetDate(SYSTEMTIME &date, const std::string &heading) { CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); if (!pDialog) return false; @@ -691,10 +691,10 @@ bool CGUIDialogNumeric::ShowAndGetDate(SYSTEMTIME &date, const CStdString &headi return true; } -bool CGUIDialogNumeric::ShowAndGetIPAddress(CStdString &IPAddress, const CStdString &heading) +bool CGUIDialogNumeric::ShowAndGetIPAddress(std::string &IPAddress, const std::string &heading) { CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); - if (!pDialog || !IPAddress) return false; + if (!pDialog || IPAddress.empty()) return false; pDialog->SetMode(INPUT_IP_ADDRESS, (void *)&IPAddress); pDialog->SetHeading(heading); pDialog->DoModal(); @@ -704,7 +704,7 @@ bool CGUIDialogNumeric::ShowAndGetIPAddress(CStdString &IPAddress, const CStdStr return true; } -bool CGUIDialogNumeric::ShowAndGetNumber(CStdString& strInput, const CStdString &strHeading, unsigned int iAutoCloseTimeoutMs /* = 0 */) +bool CGUIDialogNumeric::ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs /* = 0 */) { // Prompt user for password input CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); @@ -725,10 +725,10 @@ bool CGUIDialogNumeric::ShowAndGetNumber(CStdString& strInput, const CStdString // \brief Show numeric keypad twice to get and confirm a user-entered password string. // \param strNewPassword String to preload into the keyboard accumulator. Overwritten with user input if return=true. // \return true if successful display and user input entry/re-entry. false if unsuccessful display, no user input, or canceled editing. -bool CGUIDialogNumeric::ShowAndVerifyNewPassword(CStdString& strNewPassword) +bool CGUIDialogNumeric::ShowAndVerifyNewPassword(std::string& strNewPassword) { // Prompt user for password input - CStdString strUserInput = ""; + std::string strUserInput; if (!ShowAndVerifyInput(strUserInput, g_localizeStrings.Get(12340), false)) { // Show error to user saying the password entry was blank @@ -758,16 +758,16 @@ bool CGUIDialogNumeric::ShowAndVerifyNewPassword(CStdString& strNewPassword) // \param strHeading String shown on dialog title. Converts to localized string if contains a positive integer. // \param iRetries If greater than 0, shows "Incorrect password, %d retries left" on dialog line 2, else line 2 is blank. // \return 0 if successful display and user input. 1 if unsuccessful input. -1 if no user input or canceled editing. -int CGUIDialogNumeric::ShowAndVerifyPassword(CStdString& strPassword, const CStdString& strHeading, int iRetries) +int CGUIDialogNumeric::ShowAndVerifyPassword(std::string& strPassword, const std::string& strHeading, int iRetries) { - CStdString strTempHeading = strHeading; + std::string strTempHeading = strHeading; if (0 < iRetries) { // Show a string telling user they have iRetries retries left 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; + std::string strPassTemp = strPassword; if (ShowAndVerifyInput(strPassTemp, strTempHeading, true)) return 0; // user entered correct password if (strPassTemp.empty()) return -1; // user canceled out @@ -779,13 +779,13 @@ int CGUIDialogNumeric::ShowAndVerifyPassword(CStdString& strPassword, const CStd // \param dlgHeading String shown on dialog title. // \param bVerifyInput If set as true we verify the users input versus strToVerify. // \return true if successful display and user input. false if unsuccessful display, no user input, or canceled editing. -bool CGUIDialogNumeric::ShowAndVerifyInput(CStdString& strToVerify, const CStdString& dlgHeading, bool bVerifyInput) +bool CGUIDialogNumeric::ShowAndVerifyInput(std::string& strToVerify, const std::string& dlgHeading, bool bVerifyInput) { // Prompt user for password input CGUIDialogNumeric *pDialog = (CGUIDialogNumeric *)g_windowManager.GetWindow(WINDOW_DIALOG_NUMERIC); pDialog->SetHeading( dlgHeading ); - CStdString strInput = ""; + std::string strInput; if (!bVerifyInput) strInput = strToVerify; pDialog->SetMode(INPUT_PASSWORD, (void *)&strInput); @@ -800,7 +800,7 @@ bool CGUIDialogNumeric::ShowAndVerifyInput(CStdString& strToVerify, const CStdSt return false; } - CStdString md5pword2 = XBMC::XBMC_MD5::GetMD5(strInput); + std::string md5pword2 = XBMC::XBMC_MD5::GetMD5(strInput); if (!bVerifyInput) { @@ -809,7 +809,7 @@ bool CGUIDialogNumeric::ShowAndVerifyInput(CStdString& strToVerify, const CStdSt return true; } - if (strToVerify.Equals(md5pword2)) + if (StringUtils::EqualsNoCase(strToVerify, md5pword2)) return true; // entered correct password // incorrect password @@ -826,7 +826,7 @@ bool CGUIDialogNumeric::IsCanceled() const return m_bCanceled; } -void CGUIDialogNumeric::SetHeading(const CStdString& strHeading) +void CGUIDialogNumeric::SetHeading(const std::string& strHeading) { Initialize(); CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), CONTROL_HEADING_LABEL); diff --git a/xbmc/dialogs/GUIDialogNumeric.h b/xbmc/dialogs/GUIDialogNumeric.h index c1870eb136..00da800ee1 100644 --- a/xbmc/dialogs/GUIDialogNumeric.h +++ b/xbmc/dialogs/GUIDialogNumeric.h @@ -37,21 +37,21 @@ public: bool IsConfirmed() const; bool IsCanceled() const; - static bool ShowAndVerifyNewPassword(CStdString& strNewPassword); - static int ShowAndVerifyPassword(CStdString& strPassword, const CStdString& strHeading, int iRetries); - static bool ShowAndVerifyInput(CStdString& strPassword, const CStdString& strHeading, bool bGetUserInput); + static bool ShowAndVerifyNewPassword(std::string& strNewPassword); + static int ShowAndVerifyPassword(std::string& strPassword, const std::string& strHeading, int iRetries); + static bool ShowAndVerifyInput(std::string& strPassword, const std::string& strHeading, bool bGetUserInput); - void SetHeading(const CStdString &strHeading); + void SetHeading(const std::string &strHeading); void SetMode(INPUT_MODE mode, void *initial); - void SetMode(INPUT_MODE mode, const CStdString &initial); + void SetMode(INPUT_MODE mode, const std::string &initial); void GetOutput(void *output) const; - CStdString GetOutput() const; + std::string GetOutput() const; - static bool ShowAndGetTime(SYSTEMTIME &time, const CStdString &heading); - static bool ShowAndGetDate(SYSTEMTIME &date, const CStdString &heading); - static bool ShowAndGetIPAddress(CStdString &IPAddress, const CStdString &heading); - static bool ShowAndGetNumber(CStdString& strInput, const CStdString &strHeading, unsigned int iAutoCloseTimeoutMs = 0); - static bool ShowAndGetSeconds(CStdString& timeString, const CStdString &heading); + static bool ShowAndGetTime(SYSTEMTIME &time, const std::string &heading); + static bool ShowAndGetDate(SYSTEMTIME &date, const std::string &heading); + static bool ShowAndGetIPAddress(std::string &IPAddress, const std::string &heading); + static bool ShowAndGetNumber(std::string& strInput, const std::string &strHeading, unsigned int iAutoCloseTimeoutMs = 0); + static bool ShowAndGetSeconds(std::string& timeString, const std::string &heading); protected: virtual void OnInitWindow(); @@ -74,5 +74,5 @@ protected: unsigned int m_block; // for time, date, and IP methods. unsigned int m_lastblock; bool m_dirty; // true if the current block has been changed. - CStdString m_number; ///< for number or password input + std::string m_number; ///< for number or password input }; diff --git a/xbmc/dialogs/GUIDialogPlayEject.cpp b/xbmc/dialogs/GUIDialogPlayEject.cpp index a7e49d157c..51dffec094 100644 --- a/xbmc/dialogs/GUIDialogPlayEject.cpp +++ b/xbmc/dialogs/GUIDialogPlayEject.cpp @@ -100,7 +100,7 @@ bool CGUIDialogPlayEject::ShowAndGetInput(const CFileItem & item, return false; // Figure out Lines 1 and 2 of the dialog - CStdString strLine1, strLine2; + std::string strLine1, strLine2; CXBMCTinyXML discStubXML; if (discStubXML.LoadFile(item.GetPath())) { diff --git a/xbmc/dialogs/GUIDialogSelect.cpp b/xbmc/dialogs/GUIDialogSelect.cpp index 1447c76d1a..a31660ebe0 100644 --- a/xbmc/dialogs/GUIDialogSelect.cpp +++ b/xbmc/dialogs/GUIDialogSelect.cpp @@ -170,7 +170,7 @@ void CGUIDialogSelect::Reset() m_selectedItems->Clear(); } -int CGUIDialogSelect::Add(const CStdString& strLabel) +int CGUIDialogSelect::Add(const std::string& strLabel) { CFileItemPtr pItem(new CFileItem(strLabel)); m_vecList->Add(pItem); @@ -256,7 +256,7 @@ void CGUIDialogSelect::SetSelected(int iSelected) m_selectedItems->Add(m_vecList->Get(iSelected)); } -void CGUIDialogSelect::SetSelected(const CStdString &strSelectedLabel) +void CGUIDialogSelect::SetSelected(const std::string &strSelectedLabel) { if (strSelectedLabel.empty()) return; @@ -332,7 +332,7 @@ void CGUIDialogSelect::OnInitWindow() } m_viewControl.SetCurrentView(m_useDetails ? CONTROL_DETAILS : CONTROL_LIST); - CStdString items = StringUtils::Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str()); + std::string items = StringUtils::Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_NUMBEROFFILES, items); if (m_multiSelection) diff --git a/xbmc/dialogs/GUIDialogSelect.h b/xbmc/dialogs/GUIDialogSelect.h index 9fd7a4a579..3b2dd6fe11 100644 --- a/xbmc/dialogs/GUIDialogSelect.h +++ b/xbmc/dialogs/GUIDialogSelect.h @@ -37,7 +37,7 @@ public: virtual bool OnBack(int actionID); void Reset(); - int Add(const CStdString& strLabel); + int Add(const std::string& strLabel); int Add(const CFileItem* pItem); void Add(const CFileItemList& items); void SetItems(CFileItemList* items); @@ -49,7 +49,7 @@ public: bool IsButtonPressed(); void Sort(bool bSortOrder = true); void SetSelected(int iSelected); - void SetSelected(const CStdString &strSelectedLabel); + void SetSelected(const std::string &strSelectedLabel); void SetSelected(std::vector<int> selectedIndexes); void SetSelected(const std::vector<std::string> &selectedLabels); void SetUseDetails(bool useDetails); diff --git a/xbmc/dialogs/GUIDialogSlider.cpp b/xbmc/dialogs/GUIDialogSlider.cpp index 168c213263..15d8cadfa7 100644 --- a/xbmc/dialogs/GUIDialogSlider.cpp +++ b/xbmc/dialogs/GUIDialogSlider.cpp @@ -73,7 +73,7 @@ bool CGUIDialogSlider::OnMessage(CGUIMessage& message) return CGUIDialog::OnMessage(message); } -void CGUIDialogSlider::SetSlider(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData) +void CGUIDialogSlider::SetSlider(const std::string &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData) { SET_CONTROL_LABEL(CONTROL_HEADING, label); CGUISliderControl *slider = dynamic_cast<CGUISliderControl *>(GetControl(CONTROL_SLIDER)); @@ -101,7 +101,7 @@ void CGUIDialogSlider::OnWindowLoaded() CGUIDialog::OnWindowLoaded(); } -void CGUIDialogSlider::ShowAndGetInput(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData) +void CGUIDialogSlider::ShowAndGetInput(const std::string &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData) { // grab the slider dialog CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER); diff --git a/xbmc/dialogs/GUIDialogSlider.h b/xbmc/dialogs/GUIDialogSlider.h index b5cee2fb7e..c1ac8d0dc9 100644 --- a/xbmc/dialogs/GUIDialogSlider.h +++ b/xbmc/dialogs/GUIDialogSlider.h @@ -43,7 +43,7 @@ public: \param callbackData pointer to callback-specific data (defaults to NULL) \sa ISliderCallback, Display */ - static void ShowAndGetInput(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData = NULL); + static void ShowAndGetInput(const std::string &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData = NULL); /*! \brief Show the slider dialog as a response to user input Shows the slider with the given values for a short period of time, used for UI feedback of a set user action. @@ -58,7 +58,7 @@ public: */ static void Display(int label, float value, float min, float delta, float max, ISliderCallback *callback); protected: - void SetSlider(const CStdString &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData); + void SetSlider(const std::string &label, float value, float min, float delta, float max, ISliderCallback *callback, void *callbackData); virtual void OnWindowLoaded(); ISliderCallback *m_callback; diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp index da20ed0f2a..2fc4e41a83 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp @@ -164,8 +164,8 @@ void CGUIDialogSmartPlaylistEditor::OnOK() // save our playlist if (m_path.empty()) { - CStdString filename(CUtil::MakeLegalFileName(m_playlist.m_playlistName)); - CStdString path; + std::string filename(CUtil::MakeLegalFileName(m_playlist.m_playlistName)); + std::string path; if (CGUIKeyboardFactory::ShowAndGetInput(filename, g_localizeStrings.Get(16013), false)) { path = URIUtils::AddFileToFolder(systemPlaylistsPath, m_playlist.GetSaveLocation()); @@ -185,8 +185,8 @@ void CGUIDialogSmartPlaylistEditor::OnOK() // this occurs if the user switches from music video <> songs <> mixed if (StringUtils::StartsWith(m_path, systemPlaylistsPath)) { - CStdString filename = URIUtils::GetFileName(m_path); - CStdString strFolder = m_path.substr(systemPlaylistsPath.size(), m_path.size() - filename.size() - systemPlaylistsPath.size() - 1); + std::string filename = URIUtils::GetFileName(m_path); + std::string strFolder = m_path.substr(systemPlaylistsPath.size(), m_path.size() - filename.size() - systemPlaylistsPath.size() - 1); if (strFolder != m_playlist.GetSaveLocation()) { // move to the correct folder XFILE::CFile::Delete(m_path); @@ -324,7 +324,7 @@ void CGUIDialogSmartPlaylistEditor::UpdateButtons() // setup groups labels.clear(); vector<Field> groups = CSmartPlaylistRule::GetGroups(m_playlist.GetType()); - Field currentGroup = CSmartPlaylistRule::TranslateGroup(m_playlist.GetGroup()); + Field currentGroup = CSmartPlaylistRule::TranslateGroup(m_playlist.GetGroup().c_str()); for (unsigned int i = 0; i < groups.size(); i++) labels.push_back(make_pair(CSmartPlaylistRule::GetLocalizedGroup(groups[i]), groups[i])); SET_CONTROL_LABELS(CONTROL_GROUP_BY, currentGroup, &labels); @@ -387,24 +387,24 @@ void CGUIDialogSmartPlaylistEditor::OnInitWindow() SendMessage(GUI_MSG_ITEM_SELECT, CONTROL_LIMIT, m_playlist.m_limit); vector<PLAYLIST_TYPE> allowedTypes; - if (m_mode.Equals("partymusic")) + if (m_mode == "partymusic") { allowedTypes.push_back(TYPE_SONGS); allowedTypes.push_back(TYPE_MIXED); } - else if (m_mode.Equals("partyvideo")) + else if (m_mode == "partyvideo") { allowedTypes.push_back(TYPE_MUSICVIDEOS); allowedTypes.push_back(TYPE_MIXED); } - else if (m_mode.Equals("music")) + else if (m_mode == "music") { // music types + mixed allowedTypes.push_back(TYPE_SONGS); allowedTypes.push_back(TYPE_ALBUMS); allowedTypes.push_back(TYPE_ARTISTS); allowedTypes.push_back(TYPE_MIXED); } - else if (m_mode.Equals("video")) + else if (m_mode == "video") { // general category for videos allowedTypes.push_back(TYPE_MOVIES); allowedTypes.push_back(TYPE_TVSHOWS); @@ -440,10 +440,10 @@ void CGUIDialogSmartPlaylistEditor::OnDeinitWindow(int nextWindowID) m_ruleLabels->Clear(); } -CGUIDialogSmartPlaylistEditor::PLAYLIST_TYPE CGUIDialogSmartPlaylistEditor::ConvertType(const CStdString &type) +CGUIDialogSmartPlaylistEditor::PLAYLIST_TYPE CGUIDialogSmartPlaylistEditor::ConvertType(const std::string &type) { for (unsigned int i = 0; i < NUM_TYPES; i++) - if (type.Equals(types[i].string)) + if (type == types[i].string) return types[i].type; assert(false); return TYPE_SONGS; @@ -458,7 +458,7 @@ std::string CGUIDialogSmartPlaylistEditor::GetLocalizedType(PLAYLIST_TYPE type) return ""; } -CStdString CGUIDialogSmartPlaylistEditor::ConvertType(PLAYLIST_TYPE type) +std::string CGUIDialogSmartPlaylistEditor::ConvertType(PLAYLIST_TYPE type) { for (unsigned int i = 0; i < NUM_TYPES; i++) if (types[i].type == type) @@ -513,7 +513,7 @@ void CGUIDialogSmartPlaylistEditor::OnRuleAdd() UpdateButtons(); } -bool CGUIDialogSmartPlaylistEditor::NewPlaylist(const CStdString &type) +bool CGUIDialogSmartPlaylistEditor::NewPlaylist(const std::string &type) { CGUIDialogSmartPlaylistEditor *editor = (CGUIDialogSmartPlaylistEditor *)g_windowManager.GetWindow(WINDOW_DIALOG_SMART_PLAYLIST_EDITOR); if (!editor) return false; @@ -526,15 +526,15 @@ bool CGUIDialogSmartPlaylistEditor::NewPlaylist(const CStdString &type) return !editor->m_cancelled; } -bool CGUIDialogSmartPlaylistEditor::EditPlaylist(const CStdString &path, const CStdString &type) +bool CGUIDialogSmartPlaylistEditor::EditPlaylist(const std::string &path, const std::string &type) { CGUIDialogSmartPlaylistEditor *editor = (CGUIDialogSmartPlaylistEditor *)g_windowManager.GetWindow(WINDOW_DIALOG_SMART_PLAYLIST_EDITOR); if (!editor) return false; editor->m_mode = type; - if (path.Equals(CProfilesManager::Get().GetUserDataItem("PartyMode.xsp").c_str())) + if (URIUtils::PathEquals(path, CProfilesManager::Get().GetUserDataItem("PartyMode.xsp"))) editor->m_mode = "partymusic"; - if (path.Equals(CProfilesManager::Get().GetUserDataItem("PartyMode-Video.xsp").c_str())) + if (URIUtils::PathEquals(path, CProfilesManager::Get().GetUserDataItem("PartyMode-Video.xsp"))) editor->m_mode = "partyvideo"; CSmartPlaylist playlist; diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.h b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.h index 7c948b76e8..861ef69977 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.h +++ b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.h @@ -39,8 +39,8 @@ public: virtual void OnInitWindow(); virtual void OnDeinitWindow(int nextWindowID); - static bool EditPlaylist(const CStdString &path, const CStdString &type = ""); - static bool NewPlaylist(const CStdString &type); + static bool EditPlaylist(const std::string &path, const std::string &type = ""); + static bool NewPlaylist(const std::string &type); protected: void OnRuleList(int item); @@ -59,8 +59,8 @@ protected: void UpdateRuleControlButtons(); int GetSelectedItem(); void HighlightItem(int item); - PLAYLIST_TYPE ConvertType(const CStdString &type); - CStdString ConvertType(PLAYLIST_TYPE type); + PLAYLIST_TYPE ConvertType(const std::string &type); + std::string ConvertType(PLAYLIST_TYPE type); std::string GetLocalizedType(PLAYLIST_TYPE type); CSmartPlaylist m_playlist; @@ -68,7 +68,7 @@ protected: // our list of rules for display purposes CFileItemList* m_ruleLabels; - CStdString m_path; + std::string m_path; bool m_cancelled; - CStdString m_mode; // mode we're in (partymode etc.) + std::string m_mode; // mode we're in (partymode etc.) }; diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp index 2dfabd3875..0130f2b5de 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp @@ -72,7 +72,7 @@ bool CGUIDialogSmartPlaylistRule::OnMessage(CGUIMessage& message) OnCancel(); else if (iControl == CONTROL_VALUE) { - CStdString parameter; + std::string parameter; OnEditChanged(iControl, parameter); m_rule.SetParameter(parameter); } @@ -114,19 +114,19 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() basePath = "videodb://"; VIDEODB_CONTENT_TYPE type = VIDEODB_CONTENT_MOVIES; - if (m_type.Equals("movies")) + if (m_type == "movies") basePath += "movies/"; - else if (m_type.Equals("tvshows")) + else if (m_type == "tvshows") { type = VIDEODB_CONTENT_TVSHOWS; basePath += "tvshows/"; } - else if (m_type.Equals("musicvideos")) + else if (m_type == "musicvideos") { type = VIDEODB_CONTENT_MUSICVIDEOS; basePath += "musicvideos/"; } - else if (m_type.Equals("episodes")) + else if (m_type == "episodes") { if (m_rule.m_field == FieldGenre || m_rule.m_field == FieldYear || m_rule.m_field == FieldStudio) @@ -139,11 +139,17 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() int iLabel = 0; if (m_rule.m_field == FieldGenre) { - if (m_type.Equals("tvshows") || m_type.Equals("episodes") || m_type.Equals("movies")) + if (m_type == "tvshows" || + m_type == "episodes" || + m_type == "movies") videodatabase.GetGenresNav(basePath + "genres/", items, type); - else if (m_type.Equals("songs") || m_type.Equals("albums") || m_type.Equals("artists") || m_type.Equals("mixed")) + else if (m_type == "songs" || + m_type == "albums" || + m_type == "artists" || + m_type == "mixed") database.GetGenresNav("musicdb://genres/",items); - if (m_type.Equals("musicvideos") || m_type.Equals("mixed")) + if (m_type == "musicvideos" || + m_type == "mixed") { CFileItemList items2; videodatabase.GetGenresNav("videodb://musicvideos/genres/",items2,VIDEODB_CONTENT_MUSICVIDEOS); @@ -160,7 +166,8 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() { if (CSmartPlaylist::IsMusicType(m_type)) database.GetArtistsNav("musicdb://artists/", items, m_rule.m_field == FieldAlbumArtist, -1); - if (m_type.Equals("musicvideos") || m_type.Equals("mixed")) + if (m_type == "musicvideos" || + m_type == "mixed") { CFileItemList items2; videodatabase.GetMusicVideoArtistsByName("", items2); @@ -172,7 +179,8 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() { if (CSmartPlaylist::IsMusicType(m_type)) database.GetAlbumsNav("musicdb://albums/", items); - if (m_type.Equals("musicvideos") || m_type.Equals("mixed")) + if (m_type == "musicvideos" || + m_type == "mixed") { CFileItemList items2; videodatabase.GetMusicVideoAlbumsByName("", items2); @@ -189,7 +197,9 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() { if (CSmartPlaylist::IsMusicType(m_type)) database.GetYearsNav("musicdb://years/", items); - if (!m_type.Equals("songs") && !m_type.Equals("albums") && !m_type.Equals("artists")) + if (m_type != "songs" && + m_type != "albums" && + m_type != "artists") { CFileItemList items2; videodatabase.GetYearsNav(basePath + "years/", items2, type); @@ -213,24 +223,24 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() iLabel = 20417; } else if (m_rule.m_field == FieldTvShowTitle || - (m_type.Equals("tvshows") && m_rule.m_field == FieldTitle)) + (m_type == "tvshows" && m_rule.m_field == FieldTitle)) { videodatabase.GetTvShowsNav(basePath + "titles/", items); iLabel = 20343; } else if (m_rule.m_field == FieldTitle) { - if (m_type.Equals("songs")) + if (m_type == "songs") { database.GetSongsNav("musicdb://songs/", items, -1, -1, -1); iLabel = 134; } - else if (m_type.Equals("movies")) + else if (m_type == "movies") { videodatabase.GetMoviesNav(basePath + "titles/", items); iLabel = 20342; } - else if (m_type.Equals("episodes")) + else if (m_type == "episodes") { videodatabase.GetEpisodesNav(basePath + "titles/-1/-1/", items); // we need to replace the db label (<season>x<episode> <title>) with the title only @@ -239,7 +249,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() format.FormatLabel(items[i].get()); iLabel = 20360; } - else if (m_type.Equals("musicvideos")) + else if (m_type == "musicvideos") { videodatabase.GetMusicVideosNav(basePath + "titles/", items); iLabel = 20389; @@ -254,8 +264,10 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() // Note: This can cause infinite loops (playlist that refers to the same playlist) but I don't // think there's any decent way to deal with this, as the infinite loop may be an arbitrary // number of playlists deep, eg playlist1 -> playlist2 -> playlist3 ... -> playlistn -> playlist1 - CStdString path = "special://videoplaylists/"; - if (m_type.Equals("songs") || m_type.Equals("albums") || m_type.Equals("artists")) + std::string path = "special://videoplaylists/"; + if (m_type == "songs" || + m_type == "albums" || + m_type == "artists") path = "special://musicplaylists/"; XFILE::CDirectory::GetDirectory(path, items, ".xsp", XFILE::DIR_FLAG_NO_FILE_DIRS); for (int i = 0; i < items.Size(); i++) @@ -264,7 +276,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() CSmartPlaylist playlist; // don't list unloadable smartplaylists or any referencable smartplaylists // which do not match the type of the current smartplaylist - if (!playlist.Load((CStdString)item->GetPath()) || + if (!playlist.Load(item->GetPath()) || (m_rule.m_field == FieldPlaylist && (!CSmartPlaylist::CheckTypeCompatibility(m_type, playlist.GetType()) || (!playlist.GetGroup().empty() || playlist.IsGroupMixed())))) @@ -291,7 +303,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } g_mediaManager.GetLocalDrives(sources); - CStdString path = m_rule.GetParameter(); + std::string path = m_rule.GetParameter(); CGUIDialogFileBrowser::ShowAndGetDirectory(sources, g_localizeStrings.Get(657), path, false); if (m_rule.m_parameter.size() > 0) m_rule.m_parameter.clear(); @@ -330,7 +342,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetItems(&items); - CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(13401).c_str(), g_localizeStrings.Get(iLabel).c_str()); + std::string 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); @@ -509,7 +521,7 @@ void CGUIDialogSmartPlaylistRule::OnDeinitWindow(int nextWindowID) SendMessage(GUI_MSG_LABEL_RESET, CONTROL_OPERATOR); } -bool CGUIDialogSmartPlaylistRule::EditRule(CSmartPlaylistRule &rule, const CStdString& type) +bool CGUIDialogSmartPlaylistRule::EditRule(CSmartPlaylistRule &rule, const std::string& type) { CGUIDialogSmartPlaylistRule *editor = (CGUIDialogSmartPlaylistRule *)g_windowManager.GetWindow(WINDOW_DIALOG_SMART_PLAYLIST_RULE); if (!editor) return false; diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistRule.h b/xbmc/dialogs/GUIDialogSmartPlaylistRule.h index 31dee2ac95..b3b935623d 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistRule.h +++ b/xbmc/dialogs/GUIDialogSmartPlaylistRule.h @@ -34,7 +34,7 @@ public: virtual void OnInitWindow(); virtual void OnDeinitWindow(int nextWindowID); - static bool EditRule(CSmartPlaylistRule &rule, const CStdString& type="songs"); + static bool EditRule(CSmartPlaylistRule &rule, const std::string& type="songs"); protected: void OnField(); @@ -46,5 +46,5 @@ protected: CSmartPlaylistRule m_rule; bool m_cancelled; - CStdString m_type; + std::string m_type; }; diff --git a/xbmc/dialogs/GUIDialogSubMenu.cpp b/xbmc/dialogs/GUIDialogSubMenu.cpp index 70030524ed..8b143c6d30 100644 --- a/xbmc/dialogs/GUIDialogSubMenu.cpp +++ b/xbmc/dialogs/GUIDialogSubMenu.cpp @@ -20,8 +20,8 @@ #include "GUIDialogSubMenu.h" -CGUIDialogSubMenu::CGUIDialogSubMenu(int id, const CStdString &xmlFile) - : CGUIDialog(id, xmlFile) +CGUIDialogSubMenu::CGUIDialogSubMenu(int id, const std::string &xmlFile) + : CGUIDialog(id, xmlFile.c_str()) { } diff --git a/xbmc/dialogs/GUIDialogSubMenu.h b/xbmc/dialogs/GUIDialogSubMenu.h index eaf1acca42..e8965027f0 100644 --- a/xbmc/dialogs/GUIDialogSubMenu.h +++ b/xbmc/dialogs/GUIDialogSubMenu.h @@ -26,7 +26,7 @@ class CGUIDialogSubMenu : public CGUIDialog { public: - CGUIDialogSubMenu(int id = WINDOW_DIALOG_SUB_MENU, const CStdString &xmlFile = "DialogSubMenu.xml"); + CGUIDialogSubMenu(int id = WINDOW_DIALOG_SUB_MENU, const std::string &xmlFile = "DialogSubMenu.xml"); virtual ~CGUIDialogSubMenu(void); virtual bool OnMessage(CGUIMessage &message); }; diff --git a/xbmc/dialogs/GUIDialogTextViewer.h b/xbmc/dialogs/GUIDialogTextViewer.h index 60def1d238..6fbd19097b 100644 --- a/xbmc/dialogs/GUIDialogTextViewer.h +++ b/xbmc/dialogs/GUIDialogTextViewer.h @@ -30,13 +30,13 @@ public: virtual ~CGUIDialogTextViewer(void); virtual bool OnMessage(CGUIMessage& message); virtual bool OnAction(const CAction &action); - void SetText(const CStdString& strText) { m_strText = strText; } - void SetHeading(const CStdString& strHeading) { m_strHeading = strHeading; } + void SetText(const std::string& strText) { m_strText = strText; } + void SetHeading(const std::string& strHeading) { m_strHeading = strHeading; } protected: virtual void OnDeinitWindow(int nextWindowID); - CStdString m_strText; - CStdString m_strHeading; + std::string m_strText; + std::string m_strHeading; void SetText(); void SetHeading(); diff --git a/xbmc/dialogs/GUIDialogYesNo.cpp b/xbmc/dialogs/GUIDialogYesNo.cpp index 5143ecde25..cb963c8211 100644 --- a/xbmc/dialogs/GUIDialogYesNo.cpp +++ b/xbmc/dialogs/GUIDialogYesNo.cpp @@ -108,7 +108,7 @@ bool CGUIDialogYesNo::ShowAndGetInput(int heading, int line0, int line1, int lin return (dialog->IsConfirmed()) ? true : false; } -bool CGUIDialogYesNo::ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, const CStdString& noLabel, const CStdString& yesLabel) +bool CGUIDialogYesNo::ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2, const std::string& noLabel, const std::string& yesLabel) { bool bDummy; return ShowAndGetInput(heading,line0,line1,line2,bDummy,noLabel,yesLabel); @@ -134,7 +134,7 @@ bool CGUIDialogYesNo::ShowAndGetInput(const std::string& heading, const std::str return (dialog->IsConfirmed()) ? true : false; } -bool CGUIDialogYesNo::ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, bool& bCanceled, const CStdString& noLabel, const CStdString& yesLabel) +bool CGUIDialogYesNo::ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2, bool& bCanceled, const std::string& noLabel, const std::string& yesLabel) { std::string text = line0 + "\n" + line1 + "\n" + line2; return ShowAndGetInput(heading, text, bCanceled, noLabel, yesLabel); diff --git a/xbmc/dialogs/GUIDialogYesNo.h b/xbmc/dialogs/GUIDialogYesNo.h index e222c12ae5..770c6c9639 100644 --- a/xbmc/dialogs/GUIDialogYesNo.h +++ b/xbmc/dialogs/GUIDialogYesNo.h @@ -35,9 +35,9 @@ public: static bool ShowAndGetInput(int heading, int line0, int line1, int line2, int iNoLabel=-1, int iYesLabel=-1); static bool ShowAndGetInput(int heading, int line0, int line1, int line2, bool& bCanceled); static bool ShowAndGetInput(int heading, int line0, int line1, int line2, int iNoLabel, int iYesLabel, bool& bCanceled, unsigned int autoCloseTime = 0); - static bool ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, const CStdString& noLabel="", const CStdString& yesLabel=""); + static bool ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2, const std::string& noLabel="", const std::string& yesLabel=""); static bool ShowAndGetInput(const std::string& heading, const std::string& text, bool& bCanceled, const std::string& noLabel, const std::string& yesLabel); - static bool ShowAndGetInput(const CStdString& heading, const CStdString& line0, const CStdString& line1, const CStdString& line2, bool &bCanceled, const CStdString& noLabel="", const CStdString& yesLabel=""); + static bool ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2, bool &bCanceled, const std::string& noLabel="", const std::string& yesLabel=""); protected: virtual int GetDefaultLabelID(int controlId) const; diff --git a/xbmc/epg/Epg.cpp b/xbmc/epg/Epg.cpp index c69cc864d4..c6df189f78 100644 --- a/xbmc/epg/Epg.cpp +++ b/xbmc/epg/Epg.cpp @@ -38,7 +38,7 @@ using namespace PVR; using namespace EPG; using namespace std; -CEpg::CEpg(int iEpgID, const CStdString &strName /* = "" */, const CStdString &strScraperName /* = "" */, bool bLoadedFromDb /* = false */) : +CEpg::CEpg(int iEpgID, const std::string &strName /* = "" */, const std::string &strScraperName /* = "" */, bool bLoadedFromDb /* = false */) : m_bChanged(!bLoadedFromDb), m_bTagsChanged(false), m_bLoaded(false), @@ -107,22 +107,22 @@ CEpg &CEpg::operator =(const CEpg &right) /** @name Public methods */ //@{ -void CEpg::SetName(const CStdString &strName) +void CEpg::SetName(const std::string &strName) { CSingleLock lock(m_critSection); - if (!m_strName.Equals(strName)) + if (m_strName != strName) { m_bChanged = true; m_strName = strName; } } -void CEpg::SetScraperName(const CStdString &strScraperName) +void CEpg::SetScraperName(const std::string &strScraperName) { CSingleLock lock(m_critSection); - if (!m_strScraperName.Equals(strScraperName)) + if (m_strScraperName != strScraperName) { m_bChanged = true; m_strScraperName = strScraperName; diff --git a/xbmc/epg/Epg.h b/xbmc/epg/Epg.h index 1e091447e5..e91db4abed 100644 --- a/xbmc/epg/Epg.h +++ b/xbmc/epg/Epg.h @@ -50,7 +50,7 @@ namespace EPG * @param strScraperName The name of the scraper to use. * @param bLoadedFromDb True if this table was loaded from the database, false otherwise. */ - CEpg(int iEpgID, const CStdString &strName = "", const CStdString &strScraperName = "", bool bLoadedFromDb = false); + CEpg(int iEpgID, const std::string &strName = "", const std::string &strScraperName = "", bool bLoadedFromDb = false); /*! * @brief Create a new EPG instance for a channel. @@ -91,13 +91,13 @@ namespace EPG * @brief Get the name of the scraper to use for this table. * @return The name of the scraper to use for this table. */ - const CStdString &ScraperName(void) const { return m_strScraperName; } + const std::string &ScraperName(void) const { return m_strScraperName; } /*! * @brief Change the name of the scraper to use. * @param strScraperName The new scraper. */ - void SetScraperName(const CStdString &strScraperName); + void SetScraperName(const std::string &strScraperName); /*! * @brief Specify if EPG should be manually updated on the next cycle @@ -120,13 +120,13 @@ namespace EPG * @brief Get the name of this table. * @return The name of this table. */ - const CStdString &Name(void) const { return m_strName; } + const std::string &Name(void) const { return m_strName; } /*! * @brief Changed the name of this table. * @param strName The new name. */ - void SetName(const CStdString &strName); + void SetName(const std::string &strName); /*! * @brief Get the database ID of this table. @@ -349,8 +349,8 @@ namespace EPG bool m_bLoaded; /*!< true when the initial entries have been loaded */ bool m_bUpdatePending; /*!< true if manual update is pending */ int m_iEpgID; /*!< the database ID of this table */ - CStdString m_strName; /*!< the name of this table */ - CStdString m_strScraperName; /*!< the name of the scraper to use */ + std::string m_strName; /*!< the name of this table */ + std::string m_strScraperName; /*!< the name of the scraper to use */ CDateTime m_nowActiveStart; /*!< the start time of the tag that is currently active */ CDateTime m_lastScanTime; /*!< the last time the EPG has been updated */ diff --git a/xbmc/epg/EpgContainer.cpp b/xbmc/epg/EpgContainer.cpp index cc9afeb250..e672ee5999 100644 --- a/xbmc/epg/EpgContainer.cpp +++ b/xbmc/epg/EpgContainer.cpp @@ -324,13 +324,13 @@ CEpg *CEpgContainer::GetByChannel(const CPVRChannel &channel) const return NULL; } -void CEpgContainer::InsertFromDatabase(int iEpgID, const CStdString &strName, const CStdString &strScraperName) +void CEpgContainer::InsertFromDatabase(int iEpgID, const std::string &strName, const std::string &strScraperName) { // table might already have been created when pvr channels were loaded CEpg* epg = GetById(iEpgID); if (epg) { - if (!epg->Name().Equals(strName) || !epg->ScraperName().Equals(strScraperName)) + if (epg->Name() != strName || epg->ScraperName() != strScraperName) { // current table data differs from the info in the db epg->SetChanged(); @@ -456,7 +456,7 @@ void CEpgContainer::ShowProgressDialog(bool bUpdating /* = true */) } } -void CEpgContainer::UpdateProgressDialog(int iCurrent, int iMax, const CStdString &strText) +void CEpgContainer::UpdateProgressDialog(int iCurrent, int iMax, const std::string &strText) { if (!m_progressHandle) ShowProgressDialog(); diff --git a/xbmc/epg/EpgContainer.h b/xbmc/epg/EpgContainer.h index b6d00ab1d8..5f00319921 100644 --- a/xbmc/epg/EpgContainer.h +++ b/xbmc/epg/EpgContainer.h @@ -189,7 +189,7 @@ namespace EPG * @param iMax The maximum position. * @param strText The text to display. */ - virtual void UpdateProgressDialog(int iCurrent, int iMax, const CStdString &strText); + virtual void UpdateProgressDialog(int iCurrent, int iMax, const std::string &strText); /*! * @return True to not to store EPG entries in the database. @@ -262,7 +262,7 @@ namespace EPG */ void LoadFromDB(void); - void InsertFromDatabase(int iEpgID, const CStdString &strName, const CStdString &strScraperName); + void InsertFromDatabase(int iEpgID, const std::string &strName, const std::string &strScraperName); typedef std::map<unsigned int, CEpg*> EPGMAP; typedef EPGMAP::iterator EPGMAP_ITR; diff --git a/xbmc/epg/EpgDatabase.cpp b/xbmc/epg/EpgDatabase.cpp index b464b5ae60..c9c74765f2 100644 --- a/xbmc/epg/EpgDatabase.cpp +++ b/xbmc/epg/EpgDatabase.cpp @@ -22,6 +22,7 @@ #include "settings/AdvancedSettings.h" #include "settings/VideoSettings.h" #include "utils/log.h" +#include "utils/StringUtils.h" #include "addons/include/xbmc_pvr_types.h" #include "EpgDatabase.h" @@ -155,7 +156,7 @@ int CEpgDatabase::Get(CEpgContainer &container) { int iReturn(-1); - CStdString strQuery = PrepareSQL("SELECT idEpg, sName, sScraperName FROM epg;"); + std::string strQuery = PrepareSQL("SELECT idEpg, sName, sScraperName FROM epg;"); if (ResultQuery(strQuery)) { iReturn = 0; @@ -164,9 +165,9 @@ int CEpgDatabase::Get(CEpgContainer &container) { while (!m_pDS->eof()) { - int iEpgID = m_pDS->fv("idEpg").get_asInt(); - CStdString strName = m_pDS->fv("sName").get_asString().c_str(); - CStdString strScraperName = m_pDS->fv("sScraperName").get_asString().c_str(); + int iEpgID = m_pDS->fv("idEpg").get_asInt(); + std::string strName = m_pDS->fv("sName").get_asString().c_str(); + std::string strScraperName = m_pDS->fv("sScraperName").get_asString().c_str(); container.InsertFromDatabase(iEpgID, strName, strScraperName); ++iReturn; @@ -187,7 +188,7 @@ int CEpgDatabase::Get(CEpg &epg) { int iReturn(-1); - CStdString strQuery = PrepareSQL("SELECT * FROM epgtags WHERE idEpg = %u;", epg.EpgID()); + std::string strQuery = PrepareSQL("SELECT * FROM epgtags WHERE idEpg = %u;", epg.EpgID()); if (ResultQuery(strQuery)) { iReturn = 0; @@ -245,8 +246,8 @@ int CEpgDatabase::Get(CEpg &epg) bool CEpgDatabase::GetLastEpgScanTime(int iEpgId, CDateTime *lastScan) { bool bReturn = false; - CStdString strWhereClause = PrepareSQL("idEpg = %u", iEpgId); - CStdString strValue = GetSingleValue("lastepgscan", "sLastScan", strWhereClause); + std::string strWhereClause = PrepareSQL("idEpg = %u", iEpgId); + std::string strValue = GetSingleValue("lastepgscan", "sLastScan", strWhereClause); if (!strValue.empty()) { @@ -263,7 +264,7 @@ bool CEpgDatabase::GetLastEpgScanTime(int iEpgId, CDateTime *lastScan) bool CEpgDatabase::PersistLastEpgScanTime(int iEpgId /* = 0 */, bool bQueueWrite /* = false */) { - CStdString strQuery = PrepareSQL("REPLACE INTO lastepgscan(idEpg, sLastScan) VALUES (%u, '%s');", + std::string strQuery = PrepareSQL("REPLACE INTO lastepgscan(idEpg, sLastScan) VALUES (%u, '%s');", iEpgId, CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsDBDateTime().c_str()); return bQueueWrite ? QueueInsertQuery(strQuery) : ExecuteQuery(strQuery); @@ -285,7 +286,7 @@ int CEpgDatabase::Persist(const CEpg &epg, bool bQueueWrite /* = false */) { int iReturn(-1); - CStdString strQuery; + std::string strQuery; if (epg.EpgID() > 0) strQuery = PrepareSQL("REPLACE INTO epg (idEpg, sName, sScraperName) " "VALUES (%u, '%s', '%s');", epg.EpgID(), epg.Name().c_str(), epg.ScraperName().c_str()); @@ -323,10 +324,10 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true * tag.FirstAiredAsUTC().GetAsTime(iFirstAired); int iBroadcastId = tag.BroadcastId(); - CStdString strQuery; + std::string strQuery; /* Only store the genre string when needed */ - CStdString strGenre = (tag.GenreType() == EPG_GENRE_USE_STRING) ? StringUtils::Join(tag.Genre(), g_advancedSettings.m_videoItemSeparator) : ""; + std::string strGenre = (tag.GenreType() == EPG_GENRE_USE_STRING) ? StringUtils::Join(tag.Genre(), g_advancedSettings.m_videoItemSeparator) : ""; if (iBroadcastId < 0) { @@ -371,8 +372,8 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true * int CEpgDatabase::GetLastEPGId(void) { - CStdString strQuery = PrepareSQL("SELECT MAX(idEpg) FROM epg"); - CStdString strValue = GetSingleValue(strQuery); + std::string strQuery = PrepareSQL("SELECT MAX(idEpg) FROM epg"); + std::string strValue = GetSingleValue(strQuery); if (!strValue.empty()) return atoi(strValue.c_str()); return 0; diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index 253f4bdabc..4b23ec9706 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -29,6 +29,7 @@ #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "utils/log.h" +#include "utils/StringUtils.h" #include "utils/Variant.h" #include "addons/include/xbmc_pvr_types.h" @@ -57,7 +58,7 @@ CEpgInfoTag::CEpgInfoTag(void) : m_timer = emptyTimer; } -CEpgInfoTag::CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const CStdString &strTableName /* = StringUtils::EmptyString */, const CStdString &strIconPath /* = StringUtils::EmptyString */) : +CEpgInfoTag::CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const std::string &strTableName /* = "" */, const std::string &strIconPath /* = "" */) : m_bNotify(false), m_bChanged(false), m_iBroadcastId(-1), @@ -432,7 +433,7 @@ int CEpgInfoTag::GetDuration(void) const return end - start > 0 ? end - start : 3600; } -void CEpgInfoTag::SetTitle(const CStdString &strTitle) +void CEpgInfoTag::SetTitle(const std::string &strTitle) { bool bUpdate(false); { @@ -448,9 +449,9 @@ void CEpgInfoTag::SetTitle(const CStdString &strTitle) UpdatePath(); } -CStdString CEpgInfoTag::Title(bool bOverrideParental /* = false */) const +std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const { - CStdString strTitle; + std::string strTitle; bool bParentalLocked(false); { @@ -468,7 +469,7 @@ CStdString CEpgInfoTag::Title(bool bOverrideParental /* = false */) const return strTitle; } -void CEpgInfoTag::SetPlotOutline(const CStdString &strPlotOutline) +void CEpgInfoTag::SetPlotOutline(const std::string &strPlotOutline) { bool bUpdate(false); { @@ -484,9 +485,9 @@ void CEpgInfoTag::SetPlotOutline(const CStdString &strPlotOutline) UpdatePath(); } -CStdString CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const +std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const { - CStdString retVal; + std::string retVal; CSingleLock lock(m_critSection); if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel)) retVal = m_strPlotOutline; @@ -494,12 +495,12 @@ CStdString CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const return retVal; } -void CEpgInfoTag::SetPlot(const CStdString &strPlot) +void CEpgInfoTag::SetPlot(const std::string &strPlot) { bool bUpdate(false); { CSingleLock lock(m_critSection); - bUpdate = !m_strPlot.Equals(strPlot); + bUpdate = m_strPlot != strPlot; m_bChanged |= bUpdate; m_strPlot = strPlot; } @@ -507,9 +508,9 @@ void CEpgInfoTag::SetPlot(const CStdString &strPlot) UpdatePath(); } -CStdString CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const +std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const { - CStdString retVal; + std::string retVal; CSingleLock lock(m_critSection); if (bOverrideParental || !m_pvrChannel || !g_PVRManager.IsParentalLocked(*m_pvrChannel)) retVal = m_strPlot; @@ -735,7 +736,7 @@ int CEpgInfoTag::EpisodePart(void) const return m_iEpisodePart; } -void CEpgInfoTag::SetEpisodeName(const CStdString &strEpisodeName) +void CEpgInfoTag::SetEpisodeName(const std::string &strEpisodeName) { bool bUpdate(false); { @@ -751,15 +752,15 @@ void CEpgInfoTag::SetEpisodeName(const CStdString &strEpisodeName) UpdatePath(); } -CStdString CEpgInfoTag::EpisodeName(void) const +std::string CEpgInfoTag::EpisodeName(void) const { - CStdString retVal; + std::string retVal; CSingleLock lock(m_critSection); retVal = m_strEpisodeName; return retVal; } -void CEpgInfoTag::SetIcon(const CStdString &strIconPath) +void CEpgInfoTag::SetIcon(const std::string &strIconPath) { bool bUpdate(false); { @@ -775,16 +776,16 @@ void CEpgInfoTag::SetIcon(const CStdString &strIconPath) UpdatePath(); } -CStdString CEpgInfoTag::Icon(void) const +std::string CEpgInfoTag::Icon(void) const { - CStdString retVal; + std::string retVal; CSingleLock lock(m_critSection); retVal = m_strIconPath; return retVal; } -void CEpgInfoTag::SetPath(const CStdString &strFileNameAndPath) +void CEpgInfoTag::SetPath(const std::string &strFileNameAndPath) { CSingleLock lock(m_critSection); if (m_strFileNameAndPath != strFileNameAndPath) @@ -794,7 +795,7 @@ void CEpgInfoTag::SetPath(const CStdString &strFileNameAndPath) } } -CStdString CEpgInfoTag::Path(void) const +std::string CEpgInfoTag::Path(void) const { string retVal; CSingleLock lock(m_critSection); @@ -867,9 +868,9 @@ int CEpgInfoTag::PVRChannelNumber(void) const return m_pvrChannel ? m_pvrChannel->ChannelNumber() : -1; } -CStdString CEpgInfoTag::PVRChannelName(void) const +std::string CEpgInfoTag::PVRChannelName(void) const { - CStdString strReturn; + std::string strReturn; CSingleLock lock(m_critSection); if (m_pvrChannel) strReturn = m_pvrChannel->ChannelName(); @@ -1012,7 +1013,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) void CEpgInfoTag::UpdatePath(void) { - CStdString path; + std::string path; { CSingleLock lock(m_critSection); path = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str()); diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index 462a428cd2..8e3f98fd6b 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -23,12 +23,12 @@ #include "addons/include/xbmc_pvr_types.h" #include "XBDateTime.h" #include "utils/ISerializable.h" -#include "utils/StringUtils.h" #include "pvr/channels/PVRChannel.h" #include "pvr/timers/PVRTimerInfoTag.h" #include "pvr/recordings/PVRRecording.h" #include <boost/shared_ptr.hpp> +#include <string> #define EPG_DEBUGGING 0 @@ -52,7 +52,7 @@ namespace EPG /*! * @brief Create a new empty event without a unique ID. */ - CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const CStdString &strTableName = StringUtils::EmptyString, const CStdString &strIconPath = StringUtils::EmptyString); + CEpgInfoTag(CEpg *epg, PVR::CPVRChannelPtr pvrChannel, const std::string &strTableName = "", const std::string &strIconPath = ""); /*! * @brief Create a new EPG infotag with 'data' as content. @@ -187,40 +187,40 @@ namespace EPG * @brief Change the title of this event. * @param strTitle The new title. */ - void SetTitle(const CStdString &strTitle); + void SetTitle(const std::string &strTitle); /*! * @brief Get the title of this event. * @param bOverrideParental True to override parental control, false check it. * @return The title. */ - CStdString Title(bool bOverrideParental = false) const; + std::string Title(bool bOverrideParental = false) const; /*! * @brief Change the plot outline of this event. * @param strPlotOutline The new plot outline. */ - void SetPlotOutline(const CStdString &strPlotOutline); + void SetPlotOutline(const std::string &strPlotOutline); /*! * @brief Get the plot outline of this event. * @param bOverrideParental True to override parental control, false check it. * @return The plot outline. */ - CStdString PlotOutline(bool bOverrideParental = false) const; + std::string PlotOutline(bool bOverrideParental = false) const; /*! * @brief Change the plot of this event. * @param strPlot The new plot. */ - void SetPlot(const CStdString &strPlot); + void SetPlot(const std::string &strPlot); /*! * @brief Get the plot of this event. * @param bOverrideParental True to override parental control, false check it. * @return The plot. */ - CStdString Plot(bool bOverrideParental = false) const; + std::string Plot(bool bOverrideParental = false) const; /*! * @brief Change the genre of this event. @@ -337,37 +337,37 @@ namespace EPG * @brief Change the episode name of this event. * @param strEpisodeName The new episode name. */ - void SetEpisodeName(const CStdString &strEpisodeName); + void SetEpisodeName(const std::string &strEpisodeName); /*! * @brief The episode name of this event. * @return The episode name. */ - CStdString EpisodeName(void) const; + std::string EpisodeName(void) const; /*! * @brief Change the path to the icon for this event. * @param strIconPath The new path. */ - void SetIcon(const CStdString &strIconPath); + void SetIcon(const std::string &strIconPath); /*! * @brief Get the path to the icon for this event. * @return The path to the icon */ - CStdString Icon(void) const; + std::string Icon(void) const; /*! * @brief Change the path to this event. * @param strFileNameAndPath The new path. */ - void SetPath(const CStdString &strFileNameAndPath); + void SetPath(const std::string &strFileNameAndPath); /*! * @brief The path to this event. * @return The path. */ - CStdString Path(void) const; + std::string Path(void) const; /*! * @brief Change the recording ID to this event. @@ -442,7 +442,7 @@ namespace EPG int PVRChannelNumber(void) const; - CStdString PVRChannelName(void) const; + std::string PVRChannelName(void) const; /*! * @brief Get the channel that plays this event. @@ -488,13 +488,13 @@ namespace EPG int m_iEpisodeNumber; /*!< episode number */ int m_iEpisodePart; /*!< episode part number */ int m_iUniqueBroadcastID; /*!< unique broadcast ID */ - CStdString m_strTitle; /*!< title */ - CStdString m_strPlotOutline; /*!< plot outline */ - CStdString m_strPlot; /*!< plot */ + std::string m_strTitle; /*!< title */ + std::string m_strPlotOutline; /*!< plot outline */ + std::string m_strPlot; /*!< plot */ std::vector<std::string> m_genre; /*!< genre */ - CStdString m_strEpisodeName; /*!< episode name */ - CStdString m_strIconPath; /*!< the path to the icon */ - CStdString m_strFileNameAndPath; /*!< the filename and path */ + std::string m_strEpisodeName; /*!< episode name */ + std::string m_strIconPath; /*!< the path to the icon */ + std::string m_strFileNameAndPath; /*!< the filename and path */ CDateTime m_startTime; /*!< event start time */ CDateTime m_endTime; /*!< event end time */ CDateTime m_firstAired; /*!< first airdate */ diff --git a/xbmc/epg/EpgSearchFilter.h b/xbmc/epg/EpgSearchFilter.h index d906b76394..803e79bc30 100644 --- a/xbmc/epg/EpgSearchFilter.h +++ b/xbmc/epg/EpgSearchFilter.h @@ -60,7 +60,7 @@ namespace EPG static int RemoveDuplicates(CFileItemList &results); - CStdString m_strSearchTerm; /*!< The term to search for */ + std::string m_strSearchTerm; /*!< The term to search for */ bool m_bIsCaseSensitive; /*!< Do a case sensitive search */ bool m_bSearchInDescription; /*!< Search for strSearchTerm in the description too */ int m_iGenreType; /*!< The genre type for an entry */ diff --git a/xbmc/epg/GUIEPGGridContainer.cpp b/xbmc/epg/GUIEPGGridContainer.cpp index 04b5aa346d..e63e02da8a 100644 --- a/xbmc/epg/GUIEPGGridContainer.cpp +++ b/xbmc/epg/GUIEPGGridContainer.cpp @@ -26,6 +26,7 @@ #include <tinyxml.h> #include "utils/log.h" #include "utils/MathUtils.h" +#include "utils/StringUtils.h" #include "utils/Variant.h" #include "threads/SystemClock.h" #include "GUIInfoManager.h" @@ -1065,12 +1066,12 @@ void CGUIEPGGridContainer::OnRight() CGUIControl::OnRight(); } -void CGUIEPGGridContainer::SetChannel(const CStdString &channel) +void CGUIEPGGridContainer::SetChannel(const std::string &channel) { int iChannelIndex(-1); for (unsigned int iIndex = 0; iIndex < m_channelItems.size(); iIndex++) { - CStdString strPath = m_channelItems[iIndex]->GetProperty("path").asString(StringUtils::EmptyString); + std::string strPath = m_channelItems[iIndex]->GetProperty("path").asString(); if (strPath == channel) { iChannelIndex = iIndex; diff --git a/xbmc/epg/GUIEPGGridContainer.h b/xbmc/epg/GUIEPGGridContainer.h index e00ea1b21c..c2c6d341c3 100644 --- a/xbmc/epg/GUIEPGGridContainer.h +++ b/xbmc/epg/GUIEPGGridContainer.h @@ -89,7 +89,7 @@ namespace EPG void GoToNow(); void SetStartEnd(CDateTime start, CDateTime end); void SetChannel(const PVR::CPVRChannel &channel); - void SetChannel(const CStdString &channel); + void SetChannel(const std::string &channel); protected: bool OnClick(int actionID); diff --git a/xbmc/filesystem/AFPDirectory.cpp b/xbmc/filesystem/AFPDirectory.cpp index ba61eccf07..254773b7d5 100644 --- a/xbmc/filesystem/AFPDirectory.cpp +++ b/xbmc/filesystem/AFPDirectory.cpp @@ -38,7 +38,7 @@ struct CachedDirEntry { unsigned int type; - CStdString name; + std::string name; }; using namespace XFILE; @@ -54,14 +54,14 @@ CAFPDirectory::~CAFPDirectory(void) gAfpConnection.AddIdleConnection(); } -bool CAFPDirectory::ResolveSymlink( const CStdString &dirName, const CStdString &fileName, +bool CAFPDirectory::ResolveSymlink( const std::string &dirName, const std::string &fileName, struct stat *stat, CURL &resolvedUrl) { CSingleLock lock(gAfpConnection); int ret = 0; bool retVal = true; char resolvedLink[MAX_PATH]; - CStdString fullpath = dirName; + std::string fullpath = dirName; URIUtils::AddSlashAtEnd(fullpath); fullpath += fileName; @@ -136,7 +136,7 @@ bool CAFPDirectory::GetDirectory(const CURL& url, CFileItemList &items) } return false; } - CStdString strDirName = gAfpConnection.GetPath(url); + std::string strDirName = gAfpConnection.GetPath(url); vector<CachedDirEntry> vecEntries; struct afp_file_info *dirEnt = NULL; @@ -177,16 +177,16 @@ bool CAFPDirectory::GetDirectory(const CURL& url, CFileItemList &items) gAfpConnection.GetImpl()->afp_ml_filebase_free(&dirEnt); } - CStdString myStrPath(url.Get()); + std::string myStrPath(url.Get()); URIUtils::AddSlashAtEnd(myStrPath); //be sure the dir ends with a slash for (size_t i = 0; i < vecEntries.size(); i++) { CachedDirEntry aDir = vecEntries[i]; // We use UTF-8 internally, as does AFP - CStdString strFile = aDir.name; - CStdString path(myStrPath + strFile); + std::string strFile = aDir.name; + std::string path(myStrPath + strFile); - if (!strFile.Equals(".") && !strFile.Equals("..") && !strFile.Equals("lost+found")) + if (strFile != "." && strFile != ".." && strFile != "lost+found") { int64_t iSize = 0; bool bIsDir = aDir.type; @@ -200,7 +200,7 @@ bool CAFPDirectory::GetDirectory(const CURL& url, CFileItemList &items) if ((m_flags & DIR_FLAG_NO_FILE_INFO)==0 && g_advancedSettings.m_sambastatfiles) { // make sure we use the authenticated path wich contains any default username - CStdString strFullName = strDirName + strFile; + std::string strFullName = strDirName + strFile; lock.Enter(); @@ -276,7 +276,7 @@ bool CAFPDirectory::Create(const CURL& url) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return false; - CStdString strFilename = gAfpConnection.GetPath(url); + std::string strFilename = gAfpConnection.GetPath(url); int result = gAfpConnection.GetImpl()->afp_wrap_mkdir(gAfpConnection.GetVolume(), strFilename.c_str(), 0); @@ -293,7 +293,7 @@ bool CAFPDirectory::Remove(const CURL& url) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return false; - CStdString strFileName = gAfpConnection.GetPath(url); + std::string strFileName = gAfpConnection.GetPath(url); int result = gAfpConnection.GetImpl()->afp_wrap_rmdir(gAfpConnection.GetVolume(), strFileName.c_str()); @@ -313,7 +313,7 @@ bool CAFPDirectory::Exists(const CURL& url) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return false; - CStdString strFileName(gAfpConnection.GetPath(url)); + std::string strFileName(gAfpConnection.GetPath(url)); struct stat info; if (gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), strFileName.c_str(), &info) != 0) diff --git a/xbmc/filesystem/AFPDirectory.h b/xbmc/filesystem/AFPDirectory.h index b989820fd8..7fa3734118 100644 --- a/xbmc/filesystem/AFPDirectory.h +++ b/xbmc/filesystem/AFPDirectory.h @@ -40,8 +40,8 @@ public: afp_file_info *Open(const CURL &url); private: - afp_file_info *OpenDir(const CURL &url, CStdString& strAuth); - bool ResolveSymlink( const CStdString &dirName, const CStdString &fileName, + afp_file_info *OpenDir(const CURL &url, std::string& strAuth); + bool ResolveSymlink( const std::string &dirName, const std::string &fileName, struct stat *stat, CURL &resolvedUrl); }; } diff --git a/xbmc/filesystem/AFPFile.cpp b/xbmc/filesystem/AFPFile.cpp index 0a6616c119..cb4ff7ca0d 100644 --- a/xbmc/filesystem/AFPFile.cpp +++ b/xbmc/filesystem/AFPFile.cpp @@ -41,7 +41,7 @@ using namespace XFILE; void AfpConnectionLog(void *priv, enum loglevels loglevel, int logtype, const char *message) { if (!message) return; - CStdString msg = "LIBAFPCLIENT: " + CStdString(message); + std::string msg = "LIBAFPCLIENT: " + std::string(message); switch(logtype) { @@ -170,13 +170,11 @@ bool CAfpConnection::connectVolume(const char *volumename, struct afp_volume *&p return ret; } -CStdString CAfpConnection::getAuthenticatedPath(const CURL &url) +CURL CAfpConnection::getAuthenticatedPath(const CURL &url) { CURL authURL(url); - CStdString ret; CPasswordManager::GetInstance().AuthenticateURL(authURL); - ret = authURL.Get(); - return ret; + return authURL; } CAfpConnection::afpConnnectError CAfpConnection::Connect(const CURL& url) @@ -297,7 +295,7 @@ CAfpConnection::afpConnnectError CAfpConnection::Connect(const CURL& url) int CAfpConnection::stat(const CURL &url, struct stat *statbuff) { CSingleLock lock(*this); - CStdString strPath = gAfpConnection.GetPath(url); + std::string strPath = gAfpConnection.GetPath(url); struct afp_volume *pTmpVol = NULL; struct afp_url tmpurl; int iResult = -1; @@ -390,10 +388,10 @@ void CAfpConnection::AddIdleConnection() m_IdleTimeout = 180; } -CStdString CAfpConnection::GetPath(const CURL &url) +std::string CAfpConnection::GetPath(const CURL &url) { struct afp_url tmpurl; - CStdString ret = ""; + std::string ret; m_pLibAfp->afp_default_url(&tmpurl); @@ -405,7 +403,7 @@ CStdString CAfpConnection::GetPath(const CURL &url) } else { - ret = CStdString(tmpurl.path); + ret = tmpurl.path; } return ret; } @@ -455,7 +453,7 @@ bool CAFPFile::Open(const CURL& url) return false; m_pAfpVol = gAfpConnection.GetVolume(); - CStdString strPath = gAfpConnection.GetPath(url); + std::string strPath = gAfpConnection.GetPath(url); if (gAfpConnection.GetImpl()->afp_wrap_open(m_pAfpVol, strPath.c_str(), O_RDONLY, &m_pFp)) { @@ -508,7 +506,7 @@ int CAFPFile::Stat(const CURL& url, struct __stat64* buffer) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return -1; - CStdString strPath = gAfpConnection.GetPath(url); + std::string strPath = gAfpConnection.GetPath(url); struct stat tmpBuffer = {0}; int iResult = gAfpConnection.GetImpl()->afp_wrap_getattr(gAfpConnection.GetVolume(), strPath.c_str(), &tmpBuffer); @@ -644,7 +642,7 @@ bool CAFPFile::Delete(const CURL& url) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return false; - CStdString strPath = gAfpConnection.GetPath(url); + std::string strPath = gAfpConnection.GetPath(url); int result = gAfpConnection.GetImpl()->afp_wrap_unlink(gAfpConnection.GetVolume(), strPath.c_str()); @@ -660,8 +658,8 @@ bool CAFPFile::Rename(const CURL& url, const CURL& urlnew) if (gAfpConnection.Connect(url) != CAfpConnection::AfpOk || !gAfpConnection.GetVolume()) return false; - CStdString strFile = gAfpConnection.GetPath(url); - CStdString strFileNew = gAfpConnection.GetPath(urlnew); + std::string strFile = gAfpConnection.GetPath(url); + std::string strFileNew = gAfpConnection.GetPath(urlnew); int result = gAfpConnection.GetImpl()->afp_wrap_rename(gAfpConnection.GetVolume(), strFile.c_str(), strFileNew.c_str()); @@ -690,7 +688,7 @@ bool CAFPFile::OpenForWrite(const CURL& url, bool bOverWrite) m_pAfpVol = gAfpConnection.GetVolume(); - CStdString strPath = gAfpConnection.GetPath(url); + std::string strPath = gAfpConnection.GetPath(url); if (bOverWrite) { @@ -711,7 +709,7 @@ bool CAFPFile::OpenForWrite(const CURL& url, bool bOverWrite) return true; } -bool CAFPFile::IsValidFile(const CStdString& strFileName) +bool CAFPFile::IsValidFile(const std::string& strFileName) { if (strFileName.find('/') == std::string::npos || // doesn't have sharename StringUtils::EndsWith(strFileName, "/.") || // not current folder diff --git a/xbmc/filesystem/AFPFile.h b/xbmc/filesystem/AFPFile.h index fa5be3cc1d..1a7e8d2bac 100644 --- a/xbmc/filesystem/AFPFile.h +++ b/xbmc/filesystem/AFPFile.h @@ -57,7 +57,7 @@ public: struct afp_server *GetServer() {return m_pAfpServer;} struct afp_volume *GetVolume() {return m_pAfpVol;}; struct afp_url *GetUrl() {return m_pAfpUrl;}; - CStdString GetPath(const CURL &url); + std::string GetPath(const CURL &url); DllLibAfp *GetImpl() {return m_pLibAfp;} const char *GetConnectedIp() const { if(m_pAfpUrl) return m_pAfpUrl->servername;else return "";} @@ -77,7 +77,7 @@ private: bool initLib(void); bool connectVolume(const char *volumename, struct afp_volume *&pVolume); void disconnectVolume(void); - CStdString getAuthenticatedPath(const CURL &url); + CURL getAuthenticatedPath(const CURL &url); int m_OpenConnections; int m_IdleTimeout; @@ -121,7 +121,7 @@ public: }; protected: - bool IsValidFile(const CStdString& strFileName); + bool IsValidFile(const std::string& strFileName); CURL m_url; int64_t m_fileSize; diff --git a/xbmc/filesystem/APKDirectory.cpp b/xbmc/filesystem/APKDirectory.cpp index 0263c98ea9..c2a133bd7a 100644 --- a/xbmc/filesystem/APKDirectory.cpp +++ b/xbmc/filesystem/APKDirectory.cpp @@ -37,8 +37,8 @@ using namespace XFILE; bool CAPKDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // uses a <fully qualified path>/filename.apk/... - CStdString path = url.GetFileName(); - CStdString host = url.GetHostName(); + std::string path = url.GetFileName(); + std::string host = url.GetHostName(); URIUtils::AddSlashAtEnd(path); int zip_flags = 0, zip_error = 0; @@ -51,7 +51,7 @@ bool CAPKDirectory::GetDirectory(const CURL& url, CFileItemList &items) return false; } - CStdString test_name; + std::string test_name; int numFiles = zip_get_num_files(zip_archive); for (int zip_index = 0; zip_index < numFiles; zip_index++) { diff --git a/xbmc/filesystem/APKFile.cpp b/xbmc/filesystem/APKFile.cpp index 4668456812..dafbdf1fd0 100644 --- a/xbmc/filesystem/APKFile.cpp +++ b/xbmc/filesystem/APKFile.cpp @@ -51,8 +51,8 @@ bool CAPKFile::Open(const CURL& url) Close(); m_url = url; - CStdString path = url.GetFileName(); - CStdString host = url.GetHostName(); + std::string path = url.GetFileName(); + std::string host = url.GetHostName(); int zip_flags = 0, zip_error = 0; m_zip_archive = zip_open(host.c_str(), zip_flags, &zip_error); @@ -205,8 +205,8 @@ int CAPKFile::Stat(const CURL& url, struct __stat64* buffer) // do not use interal member vars here, // we might be called without opening - CStdString path = url.GetFileName(); - CStdString host = url.GetHostName(); + std::string path = url.GetFileName(); + std::string host = url.GetHostName(); struct zip *zip_archive; int zip_flags = 0, zip_error = 0; @@ -247,7 +247,7 @@ int CAPKFile::Stat(const CURL& url, struct __stat64* buffer) int numFiles = zip_get_num_files(zip_archive); for (int i = 0; i < numFiles; i++) { - CStdString name = zip_get_name(zip_archive, i, zip_flags); + std::string name = zip_get_name(zip_archive, i, zip_flags); if (!name.empty() && StringUtils::StartsWith(name, path)) { buffer->st_gid = 0; diff --git a/xbmc/filesystem/ASAPFileDirectory.cpp b/xbmc/filesystem/ASAPFileDirectory.cpp index 27bedca991..185ccd2802 100644 --- a/xbmc/filesystem/ASAPFileDirectory.cpp +++ b/xbmc/filesystem/ASAPFileDirectory.cpp @@ -33,7 +33,7 @@ CASAPFileDirectory::~CASAPFileDirectory() { } -int CASAPFileDirectory::GetTrackCount(const CStdString &strPath) +int CASAPFileDirectory::GetTrackCount(const std::string &strPath) { if (!m_dll.Load()) return 0; diff --git a/xbmc/filesystem/ASAPFileDirectory.h b/xbmc/filesystem/ASAPFileDirectory.h index f0d596dd83..b154ca583e 100644 --- a/xbmc/filesystem/ASAPFileDirectory.h +++ b/xbmc/filesystem/ASAPFileDirectory.h @@ -32,6 +32,6 @@ namespace XFILE virtual ~CASAPFileDirectory(void); private: DllASAP m_dll; - virtual int GetTrackCount(const CStdString& strPath); + virtual int GetTrackCount(const std::string& strPath); }; } diff --git a/xbmc/filesystem/AddonsDirectory.cpp b/xbmc/filesystem/AddonsDirectory.cpp index ff01d63d0f..12974be30c 100644 --- a/xbmc/filesystem/AddonsDirectory.cpp +++ b/xbmc/filesystem/AddonsDirectory.cpp @@ -49,8 +49,8 @@ CAddonsDirectory::~CAddonsDirectory(void) bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - const CStdString strPath(url.Get()); - CStdString path1(strPath); + const std::string strPath(url.Get()); + std::string path1(strPath); URIUtils::RemoveSlashAtEnd(path1); CURL path(path1); items.ClearProperties(); @@ -116,7 +116,7 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) } else if (path.GetHostName() == "search") { - CStdString search(path.GetFileName()); + std::string search(path.GetFileName()); if (search.empty() && !GetKeyboardInput(16017, search)) return false; @@ -162,7 +162,7 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) CFileItemPtr item(new CFileItem(TranslateType((TYPE)i,true))); item->SetPath(URIUtils::AddFileToFolder(strPath,TranslateType((TYPE)i,false))); item->m_bIsFolder = true; - CStdString thumb = GetIcon((TYPE)i); + std::string thumb = GetIcon((TYPE)i); if (!thumb.empty() && g_TextureManager.HasTexture(thumb)) item->SetArt("thumb", thumb); items.Add(item); @@ -228,7 +228,7 @@ bool CAddonsDirectory::GetDirectory(const CURL& url, CFileItemList &items) void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders) { - CStdString xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons"); + std::string xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons"); items.ClearItems(); for (unsigned i=0; i < addons.size(); i++) { @@ -258,7 +258,7 @@ void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemL } } -CFileItemPtr CAddonsDirectory::FileItemFromAddon(const AddonPtr &addon, const CStdString &basePath, bool folder) +CFileItemPtr CAddonsDirectory::FileItemFromAddon(const AddonPtr &addon, const std::string &basePath, bool folder) { if (!addon) return CFileItemPtr(); @@ -266,19 +266,19 @@ CFileItemPtr CAddonsDirectory::FileItemFromAddon(const AddonPtr &addon, const CS // TODO: This can probably be done more efficiently CURL url(basePath); url.SetFileName(addon->ID()); - CStdString path(url.Get()); + std::string path(url.Get()); if (folder) URIUtils::AddSlashAtEnd(path); CFileItemPtr item(new CFileItem(path, folder)); - CStdString strLabel(addon->Name()); + std::string strLabel(addon->Name()); if (url.GetHostName() == "search") strLabel = StringUtils::Format("%s - %s", TranslateType(addon->Type(), true).c_str(), addon->Name().c_str()); item->SetLabel(strLabel); - if (!(basePath.Equals("addons://") && addon->Type() == ADDON_REPOSITORY)) + if (!URIUtils::PathEquals(basePath, "addons://") && addon->Type() == ADDON_REPOSITORY) item->SetLabel2(addon->Version().asString()); item->SetArt("thumb", addon->Icon()); item->SetLabelPreformated(true); @@ -289,7 +289,7 @@ CFileItemPtr CAddonsDirectory::FileItemFromAddon(const AddonPtr &addon, const CS return item; } -bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, VECADDONS &addons) +bool CAddonsDirectory::GetScriptsAndPlugins(const std::string &content, VECADDONS &addons) { CPluginSource::Content type = CPluginSource::Translate(content); if (type == CPluginSource::UNKNOWN) @@ -314,7 +314,7 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, VECADDONS return true; } -bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items) +bool CAddonsDirectory::GetScriptsAndPlugins(const std::string &content, CFileItemList &items) { items.Clear(); @@ -331,7 +331,7 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItem if (plugin->ProvidesSeveral()) { CURL url = item->GetAsUrl(); - CStdString opt = StringUtils::Format("?content_type=%s",content.c_str()); + std::string opt = StringUtils::Format("?content_type=%s",content.c_str()); url.SetOptions(opt); item->SetPath(url.Get()); } @@ -346,7 +346,7 @@ bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItem return items.Size() > 0; } -CFileItemPtr CAddonsDirectory::GetMoreItem(const CStdString &content) +CFileItemPtr CAddonsDirectory::GetMoreItem(const std::string &content) { CFileItemPtr item(new CFileItem("addons://more/"+content,false)); item->SetLabelPreformated(true); diff --git a/xbmc/filesystem/AddonsDirectory.h b/xbmc/filesystem/AddonsDirectory.h index 4fc7458c4a..d4a23e8b84 100644 --- a/xbmc/filesystem/AddonsDirectory.h +++ b/xbmc/filesystem/AddonsDirectory.h @@ -47,22 +47,22 @@ namespace XFILE \param addons the list of addons to fill with scripts and plugin content \return true if content is valid, false if it's invalid. */ - static bool GetScriptsAndPlugins(const CStdString &content, ADDON::VECADDONS &addons); + static bool GetScriptsAndPlugins(const std::string &content, ADDON::VECADDONS &addons); /*! \brief Fetch scripts and plugins of a given content type \param content the content type to fetch \param items the list to fill with scripts and content \return true if more than one item is found, false otherwise. */ - static bool GetScriptsAndPlugins(const CStdString &content, CFileItemList &items); + static bool GetScriptsAndPlugins(const std::string &content, CFileItemList &items); /*! \brief return the "Get More..." link item for the current content type \param content the content type for the link item \return a CFileItemPtr to a new item for the link. */ - static CFileItemPtr GetMoreItem(const CStdString &content); + static CFileItemPtr GetMoreItem(const std::string &content); static void GenerateListing(CURL &path, ADDON::VECADDONS& addons, CFileItemList &items, bool reposAsFolders = true); - static CFileItemPtr FileItemFromAddon(const ADDON::AddonPtr &addon, const CStdString &basePath, bool folder = false); + static CFileItemPtr FileItemFromAddon(const ADDON::AddonPtr &addon, const std::string &basePath, bool folder = false); }; } diff --git a/xbmc/filesystem/AndroidAppDirectory.cpp b/xbmc/filesystem/AndroidAppDirectory.cpp index f93b0626a3..c72a6a829e 100644 --- a/xbmc/filesystem/AndroidAppDirectory.cpp +++ b/xbmc/filesystem/AndroidAppDirectory.cpp @@ -44,7 +44,7 @@ CAndroidAppDirectory::~CAndroidAppDirectory(void) bool CAndroidAppDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString dirname = url.GetFileName(); + std::string dirname = url.GetFileName(); URIUtils::RemoveSlashAtEnd(dirname); CLog::Log(LOGDEBUG, "CAndroidAppDirectory::GetDirectory: %s",dirname.c_str()); if (dirname == "apps") @@ -62,7 +62,7 @@ bool CAndroidAppDirectory::GetDirectory(const CURL& url, CFileItemList &items) continue; CFileItemPtr pItem(new CFileItem(applications[i].packageName)); pItem->m_bIsFolder = false; - CStdString path = StringUtils::Format("androidapp://%s/%s/%s", url.GetHostName().c_str(), dirname.c_str(), applications[i].packageName.c_str()); + std::string 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"); diff --git a/xbmc/filesystem/AndroidAppFile.h b/xbmc/filesystem/AndroidAppFile.h index 18385901f5..17d0300dec 100644 --- a/xbmc/filesystem/AndroidAppFile.h +++ b/xbmc/filesystem/AndroidAppFile.h @@ -24,7 +24,6 @@ #if defined(TARGET_ANDROID) #include "IFile.h" #include "URL.h" -#include "utils/StdString.h" namespace XFILE { class CFileAndroidApp : public IFile @@ -56,7 +55,7 @@ protected: private: CURL m_url; - CStdString m_appname; + std::string m_appname; int m_iconWidth; int m_iconHeight; }; diff --git a/xbmc/filesystem/BlurayDirectory.cpp b/xbmc/filesystem/BlurayDirectory.cpp index 9a76933a79..f4796701e8 100644 --- a/xbmc/filesystem/BlurayDirectory.cpp +++ b/xbmc/filesystem/BlurayDirectory.cpp @@ -56,10 +56,10 @@ void CBlurayDirectory::Dispose() m_dll = NULL; } -CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label) +CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const std::string& label) { - CStdString buf; - CStdString chap; + std::string buf; + std::string chap; CFileItemPtr item(new CFileItem("", false)); CURL path(m_url); buf = StringUtils::Format("BDMV/PLAYLIST/%05d.mpls", title->playlist); @@ -84,7 +84,7 @@ CFileItemPtr CBlurayDirectory::GetTitle(const BLURAY_TITLE_INFO* title, const CS void CBlurayDirectory::GetTitles(bool main, CFileItemList &items) { unsigned titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0); - CStdString buf; + std::string buf; std::vector<BLURAY_TITLE_INFO*> buffer; @@ -149,8 +149,8 @@ bool CBlurayDirectory::GetDirectory(const CURL& url, CFileItemList &items) { Dispose(); m_url = url; - CStdString root = m_url.GetHostName(); - CStdString file = m_url.GetFileName(); + std::string root = m_url.GetHostName(); + std::string file = m_url.GetFileName(); URIUtils::RemoveSlashAtEnd(file); URIUtils::RemoveSlashAtEnd(root); @@ -189,4 +189,4 @@ bool CBlurayDirectory::GetDirectory(const CURL& url, CFileItemList &items) } /* namespace XFILE */ -#endif
\ No newline at end of file +#endif diff --git a/xbmc/filesystem/BlurayDirectory.h b/xbmc/filesystem/BlurayDirectory.h index 3bee534973..b593adf60e 100644 --- a/xbmc/filesystem/BlurayDirectory.h +++ b/xbmc/filesystem/BlurayDirectory.h @@ -43,7 +43,7 @@ private: void Dispose(); void GetRoot (CFileItemList &items); void GetTitles(bool main, CFileItemList &items); - CFileItemPtr GetTitle(const BLURAY_TITLE_INFO* title, const CStdString& label); + CFileItemPtr GetTitle(const BLURAY_TITLE_INFO* title, const std::string& label); CURL m_url; DllLibbluray* m_dll; BLURAY* m_bd; diff --git a/xbmc/filesystem/CDDADirectory.cpp b/xbmc/filesystem/CDDADirectory.cpp index 74d9256441..e99127daf6 100644 --- a/xbmc/filesystem/CDDADirectory.cpp +++ b/xbmc/filesystem/CDDADirectory.cpp @@ -44,7 +44,7 @@ CCDDADirectory::~CCDDADirectory(void) bool CCDDADirectory::GetDirectory(const CURL& url, CFileItemList &items) { // Reads the tracks from an audio cd - CStdString strPath = url.Get(); + std::string strPath = url.Get(); if (!g_mediaManager.IsDiscInDrive(strPath)) return false; @@ -72,11 +72,11 @@ bool CCDDADirectory::GetDirectory(const CURL& url, CFileItemList &items) continue; // Format standard cdda item label - CStdString strLabel = StringUtils::Format("Track %02.2i", i); + std::string strLabel = StringUtils::Format("Track %02.2i", i); CFileItemPtr pItem(new CFileItem(strLabel)); pItem->m_bIsFolder = false; - CStdString path = StringUtils::Format("cdda://local/%02.2i.cdda", i); + std::string path = StringUtils::Format("cdda://local/%02.2i.cdda", i); pItem->SetPath(path); struct __stat64 s64; diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp index c2b86d82fe..5e3970f18c 100644 --- a/xbmc/filesystem/CDDAFile.cpp +++ b/xbmc/filesystem/CDDAFile.cpp @@ -50,16 +50,16 @@ CFileCDDA::~CFileCDDA(void) bool CFileCDDA::Open(const CURL& url) { - CStdString strURL = url.GetWithoutFilename(); + std::string strURL = url.GetWithoutFilename(); if (!g_mediaManager.IsDiscInDrive(strURL) || !IsValidFile(url)) return false; // Open the dvd drive #ifdef TARGET_POSIX - m_pCdIo = m_cdio->cdio_open(g_mediaManager.TranslateDevicePath(strURL), DRIVER_UNKNOWN); + m_pCdIo = m_cdio->cdio_open(g_mediaManager.TranslateDevicePath(strURL).c_str(), DRIVER_UNKNOWN); #elif defined(TARGET_WINDOWS) - m_pCdIo = m_cdio->cdio_open_win32(g_mediaManager.TranslateDevicePath(strURL, true)); + m_pCdIo = m_cdio->cdio_open_win32(g_mediaManager.TranslateDevicePath(strURL, true).c_str()); #endif if (!m_pCdIo) { @@ -221,7 +221,7 @@ bool CFileCDDA::IsValidFile(const CURL& url) int CFileCDDA::GetTrackNum(const CURL& url) { - CStdString strFileName = url.Get(); + std::string strFileName = url.Get(); // get track number from "cdda://local/01.cdda" return atoi(strFileName.substr(13, strFileName.size() - 13 - 5).c_str()); diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp index a9aa45984e..095d3fb25f 100644 --- a/xbmc/filesystem/CacheStrategy.cpp +++ b/xbmc/filesystem/CacheStrategy.cpp @@ -77,7 +77,7 @@ int CSimpleFileCache::Open() m_hDataAvailEvent = new CEvent; - CStdString fileName = CSpecialProtocol::TranslatePath(CUtil::GetNextFilename("special://temp/filecache%03d.cache", 999)); + std::string fileName = CSpecialProtocol::TranslatePath(CUtil::GetNextFilename("special://temp/filecache%03d.cache", 999)); if(fileName.empty()) { CLog::Log(LOGERROR, "%s - Unable to generate a new filename", __FUNCTION__); diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp index dec0c8c071..07bd760274 100644 --- a/xbmc/filesystem/CurlFile.cpp +++ b/xbmc/filesystem/CurlFile.cpp @@ -68,7 +68,7 @@ extern "C" int debug_callback(CURL_HANDLE *handle, curl_infotype info, char *out if (!g_advancedSettings.CanLogComponent(LOGCURL)) return 0; - CStdString strLine; + std::string strLine; strLine.append(output, size); std::vector<std::string> vecLines; StringUtils::Tokenize(strLine, vecLines, "\r\n"); @@ -448,7 +448,7 @@ void CCurlFile::SetCommonOptions(CReadState* state) // set username and password for current handle if (m_username.length() > 0 && m_password.length() > 0) { - CStdString userpwd = m_username + ":" + m_password; + std::string userpwd = m_username + ':' + m_password; g_curlInterface.easy_setopt(h, CURLOPT_USERPWD, userpwd.c_str()); } @@ -464,8 +464,8 @@ void CCurlFile::SetCommonOptions(CReadState* state) g_curlInterface.easy_setopt(h, CURLOPT_MAXREDIRS, 5); // Enable cookie engine for current handle to re-use them in future requests - CStdString strCookieFile; - CStdString strTempPath = CSpecialProtocol::TranslatePath(g_advancedSettings.m_cachePath); + std::string strCookieFile; + std::string strTempPath = CSpecialProtocol::TranslatePath(g_advancedSettings.m_cachePath); strCookieFile = URIUtils::AddFileToFolder(strTempPath, "cookies.dat"); g_curlInterface.easy_setopt(h, CURLOPT_COOKIEFILE, strCookieFile.c_str()); @@ -519,27 +519,27 @@ void CCurlFile::SetCommonOptions(CReadState* state) } // setup any requested authentication - if( m_ftpauth.length() > 0 ) + if( !m_ftpauth.empty() ) { g_curlInterface.easy_setopt(h, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); - if( m_ftpauth.Equals("any") ) + if( m_ftpauth == "any" ) g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_DEFAULT); - else if( m_ftpauth.Equals("ssl") ) + else if( m_ftpauth == "ssl" ) g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_SSL); - else if( m_ftpauth.Equals("tls") ) + else if( m_ftpauth == "tls" ) g_curlInterface.easy_setopt(h, CURLOPT_FTPSSLAUTH, CURLFTPAUTH_TLS); } // setup requested http authentication method - if(m_httpauth.length() > 0) + if(!m_httpauth.empty()) { - if( m_httpauth.Equals("any") ) + if( m_httpauth == "any" ) g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - else if( m_httpauth.Equals("anysafe") ) + else if( m_httpauth == "anysafe" ) g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE); - else if( m_httpauth.Equals("digest") ) + else if( m_httpauth == "digest" ) g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - else if( m_httpauth.Equals("ntlm") ) + else if( m_httpauth == "ntlm" ) g_curlInterface.easy_setopt(h, CURLOPT_HTTPAUTH, CURLAUTH_NTLM); } @@ -622,7 +622,7 @@ void CCurlFile::SetRequestHeaders(CReadState* state) MAPHTTPHEADERS::iterator it; for(it = m_requestheaders.begin(); it != m_requestheaders.end(); it++) { - CStdString buffer = it->first + ": " + it->second; + std::string buffer = it->first + ": " + it->second; state->m_curlHeaderList = g_curlInterface.slist_append(state->m_curlHeaderList, buffer.c_str()); } @@ -647,7 +647,7 @@ void CCurlFile::SetCorrectHeaders(CReadState* state) if (StringUtils::EqualsNoCase(h.GetMimeType(),"text/html") && !h.GetValue("Content-Disposition").empty() ) { - CStdString strValue = h.GetValue("Content-Disposition"); + std::string strValue = h.GetValue("Content-Disposition"); if (strValue.find("filename=") != std::string::npos && strValue.find(".flv") != std::string::npos) h.AddParam("Content-Type", "video/flv"); @@ -656,11 +656,11 @@ void CCurlFile::SetCorrectHeaders(CReadState* state) void CCurlFile::ParseAndCorrectUrl(CURL &url2) { - CStdString strProtocol = url2.GetTranslatedProtocol(); + std::string strProtocol = url2.GetTranslatedProtocol(); url2.SetProtocol(strProtocol); - if( strProtocol.Equals("ftp") - || strProtocol.Equals("ftps") ) + if( url2.IsProtocol("ftp") + || url2.IsProtocol("ftps") ) { // we was using url optons for urls, keep the old code work and warning if (!url2.GetOptions().empty()) @@ -676,7 +676,7 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) /* url encoded. if handed from ftpdirectory */ /* it won't be so let's handle that case */ - CStdString filename(url2.GetFileName()); + std::string filename(url2.GetFileName()); std::vector<std::string> array; // if server sent us the filename in non-utf8, we need send back with same encoding. @@ -700,10 +700,11 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) url2.SetFileName(filename); - m_ftpauth = ""; + m_ftpauth.clear(); if (url2.HasProtocolOption("auth")) { m_ftpauth = url2.GetProtocolOption("auth"); + StringUtils::ToLower(m_ftpauth); if(m_ftpauth.empty()) m_ftpauth = "any"; } @@ -716,8 +717,8 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) } m_ftppasvip = url2.HasProtocolOption("pasvip") && url2.GetProtocolOption("pasvip") != "0"; } - else if( strProtocol.Equals("http") - || strProtocol.Equals("https")) + else if( url2.IsProtocol("http") + || url2.IsProtocol("https")) { if (CSettings::Get().GetBool("network.usehttpproxy") && !CSettings::Get().GetString("network.httpproxyserver").empty() @@ -755,6 +756,7 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) if (name == "auth") { m_httpauth = value; + StringUtils::ToLower(m_httpauth); if(m_httpauth.empty()) m_httpauth = "any"; } @@ -788,7 +790,7 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) m_url = url2.Get(); } -void CCurlFile::SetStreamProxy(const CStdString &proxy, ProxyType type) +void CCurlFile::SetStreamProxy(const std::string &proxy, ProxyType type) { CURL url(proxy); m_proxy = url.GetWithoutUserDetails(); @@ -845,11 +847,11 @@ bool CCurlFile::ReadData(std::string& strHTML) return true; } -bool CCurlFile::Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize) +bool CCurlFile::Download(const std::string& strURL, const std::string& strFileName, LPDWORD pdwSize) { CLog::Log(LOGINFO, "CCurlFile::Download - %s->%s", strURL.c_str(), strFileName.c_str()); - CStdString strData; + std::string strData; if (!Get(strURL, strData)) return false; @@ -905,7 +907,7 @@ bool CCurlFile::Open(const CURL& url) std::string redactPath = CURL::GetRedacted(m_url); CLog::Log(LOGDEBUG, "CurlFile::Open(%p) %s", (void*)this, redactPath.c_str()); - ASSERT(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle)); + assert(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle)); if( m_state->m_easyHandle == NULL ) g_curlInterface.easy_aquire(url2.GetProtocol().c_str(), url2.GetHostName().c_str(), @@ -986,7 +988,7 @@ bool CCurlFile::OpenForWrite(const CURL& url, bool bOverWrite) CLog::Log(LOGDEBUG, "CCurlFile::OpenForWrite(%p) %s", (void*)this, CURL::GetRedacted(m_url).c_str()); - ASSERT(m_state->m_easyHandle == NULL); + assert(m_state->m_easyHandle == NULL); g_curlInterface.easy_aquire(url2.GetProtocol().c_str(), url2.GetHostName().c_str(), &m_state->m_easyHandle, @@ -1005,7 +1007,7 @@ bool CCurlFile::OpenForWrite(const CURL& url, bool bOverWrite) m_inError = false; m_writeOffset = 0; - ASSERT(m_state->m_multiHandle); + assert(m_state->m_multiHandle); SetCommonOptions(m_state); g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_UPLOAD, 1); @@ -1022,7 +1024,7 @@ int CCurlFile::Write(const void* lpBuf, int64_t uiBufSize) if (!(m_opened && m_forWrite) || m_inError) return -1; - ASSERT(m_state->m_multiHandle); + assert(m_state->m_multiHandle); m_state->SetReadBuffer(lpBuf, uiBufSize); m_state->m_isPaused = false; @@ -1096,7 +1098,7 @@ bool CCurlFile::Exists(const CURL& url) CURL url2(url); ParseAndCorrectUrl(url2); - ASSERT(m_state->m_easyHandle == NULL); + assert(m_state->m_easyHandle == NULL); g_curlInterface.easy_aquire(url2.GetProtocol().c_str(), url2.GetHostName().c_str(), &m_state->m_easyHandle, NULL); @@ -1264,7 +1266,7 @@ int CCurlFile::Stat(const CURL& url, struct __stat64* buffer) CURL url2(url); ParseAndCorrectUrl(url2); - ASSERT(m_state->m_easyHandle == NULL); + assert(m_state->m_easyHandle == NULL); g_curlInterface.easy_aquire(url2.GetProtocol().c_str(), url2.GetHostName().c_str(), &m_state->m_easyHandle, NULL); @@ -1597,12 +1599,12 @@ void CCurlFile::ClearRequestHeaders() m_requestheaders.clear(); } -void CCurlFile::SetRequestHeader(CStdString header, CStdString value) +void CCurlFile::SetRequestHeader(const std::string& header, const std::string& value) { m_requestheaders[header] = value; } -void CCurlFile::SetRequestHeader(CStdString header, long value) +void CCurlFile::SetRequestHeader(const std::string& header, long value) { m_requestheaders[header] = StringUtils::Format("%ld", value); } diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h index 73874b0bc4..123dae6dff 100644 --- a/xbmc/filesystem/CurlFile.h +++ b/xbmc/filesystem/CurlFile.h @@ -22,6 +22,7 @@ #include "IFile.h" #include "utils/RingBuffer.h" #include <map> +#include <string> #include "utils/HttpHeader.h" namespace XCURL @@ -58,35 +59,35 @@ namespace XFILE virtual bool ReadString(char *szLine, int iLineLength) { return m_state->ReadString(szLine, iLineLength); } virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) { return m_state->Read(lpBuf, uiBufSize); } virtual int Write(const void* lpBuf, int64_t uiBufSize); - virtual CStdString GetMimeType() { return m_state->m_httpheader.GetMimeType(); } - virtual CStdString GetContent() { return GetMimeType(); } + virtual std::string GetMimeType() { return m_state->m_httpheader.GetMimeType(); } + virtual std::string GetContent() { return GetMimeType(); } virtual int IoControl(EIoControl request, void* param); virtual std::string GetContentCharset(void) { return GetServerReportedCharset(); } bool Post(const std::string& strURL, const std::string& strPostData, std::string& strHTML); bool Get(const std::string& strURL, std::string& strHTML); bool ReadData(std::string& strHTML); - bool Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize = NULL); + bool Download(const std::string& strURL, const std::string& strFileName, LPDWORD pdwSize = NULL); bool IsInternet(); void Cancel(); void Reset(); - void SetUserAgent(CStdString sUserAgent) { m_userAgent = sUserAgent; } - void SetProxy(CStdString &proxy) { m_proxy = proxy; } - void SetProxyUserPass(CStdString &proxyuserpass) { m_proxyuserpass = proxyuserpass; } + void SetUserAgent(const std::string& sUserAgent) { m_userAgent = sUserAgent; } + void SetProxy(const std::string &proxy) { m_proxy = proxy; } + void SetProxyUserPass(const std::string &proxyuserpass) { m_proxyuserpass = proxyuserpass; } void SetProxyType(ProxyType proxytype) { m_proxytype = proxytype; } - void SetStreamProxy(const CStdString &proxy, ProxyType type); - void SetCustomRequest(CStdString &request) { m_customrequest = request; } + void SetStreamProxy(const std::string &proxy, ProxyType type); + void SetCustomRequest(const std::string &request) { m_customrequest = request; } void UseOldHttpVersion(bool bUse) { m_useOldHttpVersion = bUse; } - void SetContentEncoding(CStdString encoding) { m_contentencoding = encoding; } + void SetContentEncoding(const std::string& encoding) { m_contentencoding = encoding; } void SetAcceptCharset(const std::string& charset) { m_acceptCharset = charset; } void SetTimeout(int connecttimeout) { m_connecttimeout = connecttimeout; } void SetLowSpeedTime(int lowspeedtime) { m_lowspeedtime = lowspeedtime; } - void SetPostData(CStdString postdata) { m_postdata = postdata; } - void SetReferer(CStdString referer) { m_referer = referer; } - void SetCookie(CStdString cookie) { m_cookie = cookie; } - void SetMimeType(CStdString mimetype) { SetRequestHeader("Content-Type", mimetype); } - void SetRequestHeader(CStdString header, CStdString value); - void SetRequestHeader(CStdString header, long value); + void SetPostData(const std::string& postdata) { m_postdata = postdata; } + void SetReferer(const std::string& referer) { m_referer = referer; } + void SetCookie(const std::string& cookie) { m_cookie = cookie; } + void SetMimeType(std::string mimetype) { SetRequestHeader("Content-Type", mimetype); } + void SetRequestHeader(const std::string& header, const std::string& value); + void SetRequestHeader(const std::string& header, long value); void ClearRequestHeaders(); void SetBufferSize(unsigned int size); @@ -160,23 +161,24 @@ namespace XFILE unsigned int m_bufferSize; int64_t m_writeOffset; - CStdString m_url; - CStdString m_userAgent; - CStdString m_proxy; - CStdString m_proxyuserpass; + std::string m_url; + std::string m_userAgent; + std::string m_proxy; + std::string m_proxyuserpass; ProxyType m_proxytype; - CStdString m_customrequest; - CStdString m_contentencoding; + std::string m_customrequest; + std::string m_contentencoding; std::string m_acceptCharset; - CStdString m_ftpauth; - CStdString m_ftpport; - CStdString m_postdata; - CStdString m_referer; - CStdString m_cookie; - CStdString m_username; - CStdString m_password; - CStdString m_httpauth; - CStdString m_cipherlist; + std::string m_ftpauth; + std::string m_ftpport; + std::string m_binary; + std::string m_postdata; + std::string m_referer; + std::string m_cookie; + std::string m_username; + std::string m_password; + std::string m_httpauth; + std::string m_cipherlist; bool m_ftppasvip; int m_connecttimeout; int m_lowspeedtime; @@ -195,7 +197,7 @@ namespace XFILE int m_stillRunning; // Is background url fetch still in progress? - typedef std::map<CStdString, CStdString> MAPHTTPHEADERS; + typedef std::map<std::string, std::string> MAPHTTPHEADERS; MAPHTTPHEADERS m_requestheaders; long m_httpresponse; diff --git a/xbmc/filesystem/DAAPDirectory.cpp b/xbmc/filesystem/DAAPDirectory.cpp index 5ac00157d3..3279241ec3 100644 --- a/xbmc/filesystem/DAAPDirectory.cpp +++ b/xbmc/filesystem/DAAPDirectory.cpp @@ -61,10 +61,10 @@ CDAAPDirectory::~CDAAPDirectory(void) bool CDAAPDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString strRoot = url.Get(); + std::string strRoot = url.Get(); URIUtils::AddSlashAtEnd(strRoot); - CStdString host = url.GetHostName(); + std::string host = url.GetHostName(); if (url.HasPort()) host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort()); m_thisHost = g_DaapClient.GetHost(host); @@ -101,7 +101,7 @@ bool CDAAPDirectory::GetDirectory(const CURL& url, CFileItemList &items) { for (int c = 0; c < m_thisHost->dbplaylists->nPlaylists; c++) { - CStdString strFile; + std::string strFile; //size_t strLen; // we use UTF-8 internally, so no need to convert @@ -136,7 +136,7 @@ bool CDAAPDirectory::GetDirectory(const CURL& url, CFileItemList &items) // if selected playlist name == d/b name then show in artist/album/song formation if (strcmp(m_thisHost->databases[0].name, m_thisHost->dbplaylists->playlists[c].itemname) == 0) { - CStdString strBuffer; + std::string strBuffer; artistPTR *cur = m_artisthead; while (cur) { @@ -175,7 +175,7 @@ bool CDAAPDirectory::GetDirectory(const CURL& url, CFileItemList &items) CLog::Log(LOGDEBUG, "DAAPDirectory: Adding item %s", m_currentSongItems[idx].itemname); CFileItemPtr pItem(new CFileItem(m_currentSongItems[idx].itemname)); - CStdString path; + std::string path; if( m_thisHost->version_major != 3 ) { path = StringUtils::Format(REQUEST42, @@ -263,7 +263,7 @@ bool CDAAPDirectory::GetDirectory(const CURL& url, CFileItemList &items) CLog::Log(LOGDEBUG, "DAAPDirectory: Adding item %s", m_currentSongItems[c].itemname); CFileItemPtr pItem(new CFileItem(m_currentSongItems[c].itemname)); - CStdString path; + std::string path; if( m_thisHost->version_major != 3 ) { path = StringUtils::Format(REQUEST42, @@ -404,7 +404,7 @@ int CDAAPDirectory::GetCurrLevel(const std::string &strPath) size_t intEPos; int intLevel; int intCnt; - CStdString strJustPath; + std::string strJustPath; intSPos = strPath.find("://"); if (intSPos != std::string::npos) diff --git a/xbmc/filesystem/DAAPFile.cpp b/xbmc/filesystem/DAAPFile.cpp index 98d41d3044..65e66ce7dd 100644 --- a/xbmc/filesystem/DAAPFile.cpp +++ b/xbmc/filesystem/DAAPFile.cpp @@ -80,7 +80,7 @@ void CDaapClient::Release() } } -DAAP_SClientHost* CDaapClient::GetHost(const CStdString &strHost) +DAAP_SClientHost* CDaapClient::GetHost(const std::string &strHost) { try { @@ -168,7 +168,7 @@ bool CDAAPFile::Open(const CURL& url) m_url = url; CLog::Log(LOGDEBUG, "CDAAPFile::Open(%s)", url.GetFileName().c_str()); - CStdString host = url.GetHostName(); + std::string host = url.GetHostName(); if (url.HasPort()) host = StringUtils::Format("%s:%i", url.GetHostName().c_str(), url.GetPort()); m_thisHost = g_DaapClient.GetHost(host); @@ -188,7 +188,7 @@ bool CDAAPFile::Open(const CURL& url) //m_curl.SetRequestHeader(HEADER_VERSION, "3.0"); m_curl.SetRequestHeader(HEADER_REQUESTID, requestid); - m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash)); + m_curl.SetRequestHeader(HEADER_VALIDATE, std::string(hash)); m_curl.SetRequestHeader(HEADER_ACCESS_INDEX, 2); m_url.SetProtocol("http"); @@ -226,7 +226,7 @@ int64_t CDAAPFile::Seek(int64_t iFilePosition, int iWhence) GenerateHash(m_thisHost->version_major, (unsigned char*)(m_hashurl.c_str()), 2, (unsigned char*)hash, requestid); m_curl.SetRequestHeader(HEADER_REQUESTID, requestid); - m_curl.SetRequestHeader(HEADER_VALIDATE, CStdString(hash)); + m_curl.SetRequestHeader(HEADER_VALIDATE, std::string(hash)); return m_curl.Seek(iFilePosition, iWhence); } diff --git a/xbmc/filesystem/DAAPFile.h b/xbmc/filesystem/DAAPFile.h index c9ebb89a61..3fd2daafe0 100644 --- a/xbmc/filesystem/DAAPFile.h +++ b/xbmc/filesystem/DAAPFile.h @@ -34,7 +34,6 @@ #include "CurlFile.h" #include "URL.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" class CDaapClient : public CCriticalSection { @@ -44,9 +43,9 @@ public: ~CDaapClient(); DAAP_SClient *m_pClient; - DAAP_SClientHost* GetHost(const CStdString &srtHost); - std::map<CStdString, DAAP_SClientHost*> m_mapHosts; - typedef std::map<CStdString, DAAP_SClientHost*>::iterator ITHOST; + DAAP_SClientHost* GetHost(const std::string &srtHost); + std::map<std::string, DAAP_SClientHost*> m_mapHosts; + typedef std::map<std::string, DAAP_SClientHost*>::iterator ITHOST; DAAP_Status m_Status; @@ -97,7 +96,7 @@ protected: bool m_bOpened; - CStdString m_hashurl; // the url that should be used in hash calculation + std::string m_hashurl; // the url that should be used in hash calculation CURL m_url; // the complete url we have connected too CCurlFile m_curl; }; diff --git a/xbmc/filesystem/DAVDirectory.cpp b/xbmc/filesystem/DAVDirectory.cpp index 9fd11cdc3e..a0d40181b5 100644 --- a/xbmc/filesystem/DAVDirectory.cpp +++ b/xbmc/filesystem/DAVDirectory.cpp @@ -53,7 +53,7 @@ void CDAVDirectory::ParseResponse(const TiXmlElement *pElement, CFileItem &item) { if (CDAVCommon::ValueWithoutNamespace(pResponseChild, "href")) { - CStdString path(pResponseChild->ToElement()->GetText()); + std::string path(pResponseChild->ToElement()->GetText()); URIUtils::RemoveSlashAtEnd(path); item.SetPath(path); } @@ -112,7 +112,7 @@ void CDAVDirectory::ParseResponse(const TiXmlElement *pElement, CFileItem &item) bool CDAVDirectory::GetDirectory(const CURL& url, CFileItemList &items) { CCurlFile dav; - CStdString strRequest = "PROPFIND"; + std::string strRequest = "PROPFIND"; dav.SetCustomRequest(strRequest); dav.SetMimeType("text/xml; charset=\"utf-8\""); @@ -135,7 +135,7 @@ bool CDAVDirectory::GetDirectory(const CURL& url, CFileItemList &items) return false; } - CStdString strResponse; + std::string strResponse; dav.ReadData(strResponse); std::string fileCharset(dav.GetServerReportedCharset()); @@ -160,11 +160,11 @@ bool CDAVDirectory::GetDirectory(const CURL& url, CFileItemList &items) CURL url2(url); CURL url3(item.GetPath()); - CStdString itemPath(URIUtils::AddFileToFolder(url2.GetWithoutFilename(), url3.GetFileName())); + std::string itemPath(URIUtils::AddFileToFolder(url2.GetWithoutFilename(), url3.GetFileName())); if (item.GetLabel().empty()) { - CStdString name(itemPath); + std::string name(itemPath); URIUtils::RemoveSlashAtEnd(name); item.SetLabel(URIUtils::GetFileName(CURL::Decode(name))); } @@ -193,7 +193,7 @@ bool CDAVDirectory::GetDirectory(const CURL& url, CFileItemList &items) bool CDAVDirectory::Create(const CURL& url) { CDAVFile dav; - CStdString strRequest = "MKCOL"; + std::string strRequest = "MKCOL"; dav.SetCustomRequest(strRequest); @@ -214,7 +214,7 @@ bool CDAVDirectory::Exists(const CURL& url) // Set the PROPFIND custom request else we may not find folders, depending // on the server's configuration - CStdString strRequest = "PROPFIND"; + std::string strRequest = "PROPFIND"; dav.SetCustomRequest(strRequest); dav.SetRequestHeader("depth", 0); @@ -224,7 +224,7 @@ bool CDAVDirectory::Exists(const CURL& url) bool CDAVDirectory::Remove(const CURL& url) { CDAVFile dav; - CStdString strRequest = "DELETE"; + std::string strRequest = "DELETE"; dav.SetCustomRequest(strRequest); diff --git a/xbmc/filesystem/DAVFile.cpp b/xbmc/filesystem/DAVFile.cpp index ac87557968..4e89a9e652 100644 --- a/xbmc/filesystem/DAVFile.cpp +++ b/xbmc/filesystem/DAVFile.cpp @@ -70,7 +70,7 @@ bool CDAVFile::Execute(const CURL& url) if (lastResponseCode == 207) { - CStdString strResponse; + std::string strResponse; ReadData(strResponse); CXBMCTinyXML davResponse; @@ -89,7 +89,7 @@ bool CDAVFile::Execute(const CURL& url) { if (CDAVCommon::ValueWithoutNamespace(pChild, "response")) { - CStdString sRetCode = CDAVCommon::GetStatusTag(pChild->ToElement()); + std::string sRetCode = CDAVCommon::GetStatusTag(pChild->ToElement()); CRegExp rxCode; rxCode.RegComp("HTTP/1\\.1\\s(\\d+)\\s.*"); if (rxCode.RegFind(sRetCode) >= 0) @@ -115,7 +115,7 @@ bool CDAVFile::Delete(const CURL& url) return false; CDAVFile dav; - CStdString strRequest = "DELETE"; + std::string strRequest = "DELETE"; dav.SetCustomRequest(strRequest); @@ -138,10 +138,10 @@ bool CDAVFile::Rename(const CURL& url, const CURL& urlnew) CDAVFile dav; CURL url2(urlnew); - CStdString strProtocol = url2.GetTranslatedProtocol(); + std::string strProtocol = url2.GetTranslatedProtocol(); url2.SetProtocol(strProtocol); - CStdString strRequest = "MOVE"; + std::string strRequest = "MOVE"; dav.SetCustomRequest(strRequest); dav.SetRequestHeader("Destination", url2.GetWithoutUserDetails()); diff --git a/xbmc/filesystem/Directory.cpp b/xbmc/filesystem/Directory.cpp index a718beccb6..d1413d43e3 100644 --- a/xbmc/filesystem/Directory.cpp +++ b/xbmc/filesystem/Directory.cpp @@ -117,7 +117,7 @@ CDirectory::CDirectory() CDirectory::~CDirectory() {} -bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, const CStdString &strMask /*=""*/, int flags /*=DIR_FLAG_DEFAULTS*/, bool allowThreads /* = false */) +bool CDirectory::GetDirectory(const std::string& strPath, CFileItemList &items, const std::string &strMask /*=""*/, int flags /*=DIR_FLAG_DEFAULTS*/, bool allowThreads /* = false */) { CHints hints; hints.flags = flags; @@ -125,13 +125,13 @@ bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, c return GetDirectory(strPath, items, hints, allowThreads); } -bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, const CHints &hints, bool allowThreads) +bool CDirectory::GetDirectory(const std::string& strPath, CFileItemList &items, const CHints &hints, bool allowThreads) { const CURL pathToUrl(strPath); return GetDirectory(pathToUrl, items, hints, allowThreads); } -bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CStdString &strMask /*=""*/, int flags /*=DIR_FLAG_DEFAULTS*/, bool allowThreads /* = false */) +bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const std::string &strMask /*=""*/, int flags /*=DIR_FLAG_DEFAULTS*/, bool allowThreads /* = false */) { CHints hints; hints.flags = flags; @@ -163,7 +163,7 @@ bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CHint bool result = false, cancel = false; while (!result && !cancel) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); if (g_application.IsCurrentThread() && allowThreads && !URIUtils::IsSpecial(pathToUrl)) { CSingleExit ex(g_graphicsContext); @@ -252,8 +252,8 @@ bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CHint FilterFileDirectories(items, hints.mask); // Correct items for path substitution - const CStdString pathToUrl(url.Get()); - const CStdString pathToUrl2(realURL.Get()); + const std::string pathToUrl(url.Get()); + const std::string pathToUrl2(realURL.Get()); if (pathToUrl != pathToUrl2) { for (int i = 0; i < items.Size(); ++i) @@ -274,7 +274,7 @@ bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CHint return false; } -bool CDirectory::Create(const CStdString& strPath) +bool CDirectory::Create(const std::string& strPath) { const CURL pathToUrl(strPath); return Create(pathToUrl); @@ -299,7 +299,7 @@ bool CDirectory::Create(const CURL& url) return false; } -bool CDirectory::Exists(const CStdString& strPath, bool bUseCache /* = true */) +bool CDirectory::Exists(const std::string& strPath, bool bUseCache /* = true */) { const CURL pathToUrl(strPath); return Exists(pathToUrl, bUseCache); @@ -313,7 +313,7 @@ bool CDirectory::Exists(const CURL& url, bool bUseCache /* = true */) if (bUseCache) { bool bPathInCache; - CStdString realPath(realURL.Get()); + std::string realPath(realURL.Get()); URIUtils::AddSlashAtEnd(realPath); if (g_directoryCache.FileExists(realPath, bPathInCache)) return true; @@ -333,7 +333,7 @@ bool CDirectory::Exists(const CURL& url, bool bUseCache /* = true */) return false; } -bool CDirectory::Remove(const CStdString& strPath) +bool CDirectory::Remove(const std::string& strPath) { const CURL pathToUrl(strPath); return Remove(pathToUrl); @@ -361,7 +361,7 @@ bool CDirectory::Remove(const CURL& url) return false; } -void CDirectory::FilterFileDirectories(CFileItemList &items, const CStdString &mask) +void CDirectory::FilterFileDirectories(CFileItemList &items, const std::string &mask) { for (int i=0; i< items.Size(); ++i) { diff --git a/xbmc/filesystem/Directory.h b/xbmc/filesystem/Directory.h index a45efd5b7d..bb06f326fb 100644 --- a/xbmc/filesystem/Directory.h +++ b/xbmc/filesystem/Directory.h @@ -20,7 +20,7 @@ */ #include "IDirectory.h" -#include "utils/StdString.h" +#include <string> namespace XFILE { @@ -40,13 +40,13 @@ public: CHints() : flags(DIR_FLAG_DEFAULTS) { }; - CStdString mask; + std::string mask; int flags; }; static bool GetDirectory(const CURL& url , CFileItemList &items - , const CStdString &strMask="" + , const std::string &strMask="" , int flags=DIR_FLAG_DEFAULTS , bool allowThreads=false); @@ -59,24 +59,24 @@ public: static bool Exists(const CURL& url, bool bUseCache = true); static bool Remove(const CURL& url); - static bool GetDirectory(const CStdString& strPath + static bool GetDirectory(const std::string& strPath , CFileItemList &items - , const CStdString &strMask="" + , const std::string &strMask="" , int flags=DIR_FLAG_DEFAULTS , bool allowThreads=false); - static bool GetDirectory(const CStdString& strPath + static bool GetDirectory(const std::string& strPath , CFileItemList &items , const CHints &hints , bool allowThreads=false); - static bool Create(const CStdString& strPath); - static bool Exists(const CStdString& strPath, bool bUseCache = true); - static bool Remove(const CStdString& strPath); + static bool Create(const std::string& strPath); + static bool Exists(const std::string& strPath, bool bUseCache = true); + static bool Remove(const std::string& strPath); /*! \brief Filter files that act like directories from the list, replacing them with their directory counterparts \param items The item list to filter \param mask The mask to apply when filtering files */ - static void FilterFileDirectories(CFileItemList &items, const CStdString &mask); + static void FilterFileDirectories(CFileItemList &items, const std::string &mask); }; } diff --git a/xbmc/filesystem/DirectoryCache.cpp b/xbmc/filesystem/DirectoryCache.cpp index 2f0cafacdd..76ea5540fd 100644 --- a/xbmc/filesystem/DirectoryCache.cpp +++ b/xbmc/filesystem/DirectoryCache.cpp @@ -60,11 +60,11 @@ CDirectoryCache::~CDirectoryCache(void) { } -bool CDirectoryCache::GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll) +bool CDirectoryCache::GetDirectory(const std::string& strPath, CFileItemList &items, bool retrieveAll) { CSingleLock lock (m_cs); - CStdString storedPath = strPath; + std::string storedPath = strPath; URIUtils::RemoveSlashAtEnd(storedPath); ciCache i = m_cache.find(storedPath); @@ -85,7 +85,7 @@ bool CDirectoryCache::GetDirectory(const CStdString& strPath, CFileItemList &ite return false; } -void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType) +void CDirectoryCache::SetDirectory(const std::string& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType) { if (cacheType == DIR_CACHE_NEVER) return; // nothing to do @@ -103,7 +103,7 @@ void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemLis // this is the best solution for now. CSingleLock lock (m_cs); - CStdString storedPath = strPath; + std::string storedPath = strPath; URIUtils::RemoveSlashAtEnd(storedPath); ClearDirectory(storedPath); @@ -113,19 +113,19 @@ void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemLis CDir* dir = new CDir(cacheType); dir->m_Items->Copy(items); dir->SetLastAccess(m_accessCounter); - m_cache.insert(pair<CStdString, CDir*>(storedPath, dir)); + m_cache.insert(pair<std::string, CDir*>(storedPath, dir)); } -void CDirectoryCache::ClearFile(const CStdString& strFile) +void CDirectoryCache::ClearFile(const std::string& strFile) { ClearDirectory(URIUtils::GetDirectory(strFile)); } -void CDirectoryCache::ClearDirectory(const CStdString& strPath) +void CDirectoryCache::ClearDirectory(const std::string& strPath) { CSingleLock lock (m_cs); - CStdString storedPath = strPath; + std::string storedPath = strPath; URIUtils::RemoveSlashAtEnd(storedPath); iCache i = m_cache.find(storedPath); @@ -133,11 +133,11 @@ void CDirectoryCache::ClearDirectory(const CStdString& strPath) Delete(i); } -void CDirectoryCache::ClearSubPaths(const CStdString& strPath) +void CDirectoryCache::ClearSubPaths(const std::string& strPath) { CSingleLock lock (m_cs); - CStdString storedPath = strPath; + std::string storedPath = strPath; URIUtils::RemoveSlashAtEnd(storedPath); iCache i = m_cache.begin(); @@ -150,11 +150,11 @@ void CDirectoryCache::ClearSubPaths(const CStdString& strPath) } } -void CDirectoryCache::AddFile(const CStdString& strFile) +void CDirectoryCache::AddFile(const std::string& strFile) { CSingleLock lock (m_cs); - CStdString strPath = URIUtils::GetDirectory(strFile); + std::string strPath = URIUtils::GetDirectory(strFile); URIUtils::RemoveSlashAtEnd(strPath); ciCache i = m_cache.find(strPath); @@ -167,14 +167,14 @@ void CDirectoryCache::AddFile(const CStdString& strFile) } } -bool CDirectoryCache::FileExists(const CStdString& strFile, bool& bInCache) +bool CDirectoryCache::FileExists(const std::string& strFile, bool& bInCache) { CSingleLock lock (m_cs); bInCache = false; - CStdString strPath(strFile); + std::string strPath(strFile); URIUtils::RemoveSlashAtEnd(strPath); - CStdString storedPath = URIUtils::GetDirectory(strPath); + std::string storedPath = URIUtils::GetDirectory(strPath); URIUtils::RemoveSlashAtEnd(storedPath); ciCache i = m_cache.find(storedPath); @@ -186,7 +186,7 @@ bool CDirectoryCache::FileExists(const CStdString& strFile, bool& bInCache) #ifdef _DEBUG m_cacheHits++; #endif - return (strPath.Equals(storedPath) || dir->m_Items->Contains(strFile)); + return (URIUtils::PathEquals(strPath, storedPath) || dir->m_Items->Contains(strFile)); } #ifdef _DEBUG m_cacheMisses++; @@ -204,19 +204,19 @@ void CDirectoryCache::Clear() Delete(i++); } -void CDirectoryCache::InitCache(set<CStdString>& dirs) +void CDirectoryCache::InitCache(set<std::string>& dirs) { - set<CStdString>::iterator it; + set<std::string>::iterator it; for (it = dirs.begin(); it != dirs.end(); ++it) { - const CStdString& strDir = *it; + const std::string& strDir = *it; CFileItemList items; CDirectory::GetDirectory(strDir, items, "", DIR_FLAG_NO_FILE_DIRS); items.Clear(); } } -void CDirectoryCache::ClearCache(set<CStdString>& dirs) +void CDirectoryCache::ClearCache(set<std::string>& dirs) { iCache i = m_cache.begin(); while (i != m_cache.end()) diff --git a/xbmc/filesystem/DirectoryCache.h b/xbmc/filesystem/DirectoryCache.h index fe633331c7..d59f1bb1fd 100644 --- a/xbmc/filesystem/DirectoryCache.h +++ b/xbmc/filesystem/DirectoryCache.h @@ -49,25 +49,25 @@ namespace XFILE public: CDirectoryCache(void); virtual ~CDirectoryCache(void); - bool GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll = false); - void SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType); - void ClearDirectory(const CStdString& strPath); - void ClearFile(const CStdString& strFile); - void ClearSubPaths(const CStdString& strPath); + bool GetDirectory(const std::string& strPath, CFileItemList &items, bool retrieveAll = false); + void SetDirectory(const std::string& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType); + void ClearDirectory(const std::string& strPath); + void ClearFile(const std::string& strFile); + void ClearSubPaths(const std::string& strPath); void Clear(); - void AddFile(const CStdString& strFile); - bool FileExists(const CStdString& strPath, bool& bInCache); + void AddFile(const std::string& strFile); + bool FileExists(const std::string& strPath, bool& bInCache); #ifdef _DEBUG void PrintStats() const; #endif protected: - void InitCache(std::set<CStdString>& dirs); - void ClearCache(std::set<CStdString>& dirs); + void InitCache(std::set<std::string>& dirs); + void ClearCache(std::set<std::string>& dirs); void CheckIfFull(); - std::map<CStdString, CDir*> m_cache; - typedef std::map<CStdString, CDir*>::iterator iCache; - typedef std::map<CStdString, CDir*>::const_iterator ciCache; + std::map<std::string, CDir*> m_cache; + typedef std::map<std::string, CDir*>::iterator iCache; + typedef std::map<std::string, CDir*>::const_iterator ciCache; void Delete(iCache i); CCriticalSection m_cs; diff --git a/xbmc/filesystem/DirectoryFactory.cpp b/xbmc/filesystem/DirectoryFactory.cpp index dc35b451cf..12fff33bd8 100644 --- a/xbmc/filesystem/DirectoryFactory.cpp +++ b/xbmc/filesystem/DirectoryFactory.cpp @@ -21,6 +21,7 @@ #if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS) #include "config.h" #endif +#include <stdlib.h> #include "network/Network.h" #include "system.h" #include "DirectoryFactory.h" @@ -136,31 +137,29 @@ IDirectory* CDirectoryFactory::Create(const CURL& url) if (pDir) return pDir; - const CStdString &strProtocol = url.GetProtocol(); - #ifdef TARGET_POSIX - if (strProtocol.empty() || strProtocol == "file") return new CPosixDirectory(); + if (url.GetProtocol().empty() || url.IsProtocol("file")) return new CPosixDirectory(); #elif defined(TARGET_WINDOWS) - if (strProtocol.empty() || strProtocol == "file") return new CWin32Directory(); + if (url.GetProtocol().empty() || url.IsProtocol("file")) return new CWin32Directory(); #else #error Local directory access is not implemented for this platform #endif - if (strProtocol == "special") return new CSpecialProtocolDirectory(); - if (strProtocol == "sources") return new CSourcesDirectory(); - if (strProtocol == "addons") return new CAddonsDirectory(); + if (url.IsProtocol("special")) return new CSpecialProtocolDirectory(); + if (url.IsProtocol("sources")) return new CSourcesDirectory(); + if (url.IsProtocol("addons")) return new CAddonsDirectory(); #if defined(HAS_FILESYSTEM_CDDA) && defined(HAS_DVD_DRIVE) - if (strProtocol == "cdda") return new CCDDADirectory(); + if (url.IsProtocol("cdda")) return new CCDDADirectory(); #endif #ifdef HAS_FILESYSTEM - if (strProtocol == "iso9660") return new CISO9660Directory(); + if (url.IsProtocol("iso9660")) return new CISO9660Directory(); #endif - if (strProtocol == "udf") return new CUDFDirectory(); - if (strProtocol == "plugin") return new CPluginDirectory(); + if (url.IsProtocol("udf")) return new CUDFDirectory(); + if (url.IsProtocol("plugin")) return new CPluginDirectory(); #if defined(TARGET_ANDROID) - if (strProtocol == "apk") return new CAPKDirectory(); + if (url.IsProtocol("apk")) return new CAPKDirectory(); #endif - if (strProtocol == "zip") return new CZipDirectory(); - if (strProtocol == "rar") + if (url.IsProtocol("zip")) return new CZipDirectory(); + if (url.IsProtocol("rar")) { #ifdef HAS_FILESYSTEM_RAR return new CRarDirectory(); @@ -168,84 +167,84 @@ IDirectory* CDirectoryFactory::Create(const CURL& url) CLog::Log(LOGWARNING, "%s - Compiled without non-free, rar support is disabled", __FUNCTION__); #endif } - if (strProtocol == "multipath") return new CMultiPathDirectory(); - if (strProtocol == "stack") return new CStackDirectory(); - if (strProtocol == "playlistmusic") return new CPlaylistDirectory(); - if (strProtocol == "playlistvideo") return new CPlaylistDirectory(); - if (strProtocol == "musicdb") return new CMusicDatabaseDirectory(); - if (strProtocol == "musicsearch") return new CMusicSearchDirectory(); - if (strProtocol == "videodb") return new CVideoDatabaseDirectory(); - if (strProtocol == "library") return new CLibraryDirectory(); - if (strProtocol == "favourites") return new CFavouritesDirectory(); - if (strProtocol == "filereader") + if (url.IsProtocol("multipath")) return new CMultiPathDirectory(); + if (url.IsProtocol("stack")) return new CStackDirectory(); + if (url.IsProtocol("playlistmusic")) return new CPlaylistDirectory(); + if (url.IsProtocol("playlistvideo")) return new CPlaylistDirectory(); + if (url.IsProtocol("musicdb")) return new CMusicDatabaseDirectory(); + if (url.IsProtocol("musicsearch")) return new CMusicSearchDirectory(); + if (url.IsProtocol("videodb")) return new CVideoDatabaseDirectory(); + if (url.IsProtocol("library")) return new CLibraryDirectory(); + if (url.IsProtocol("favourites")) return new CFavouritesDirectory(); + if (url.IsProtocol("filereader")) { CURL url2(url.GetFileName()); return CDirectoryFactory::Create(url2); } #if defined(TARGET_ANDROID) - if (strProtocol == "androidapp") return new CAndroidAppDirectory(); + if (url.IsProtocol("androidapp")) return new CAndroidAppDirectory(); #endif bool networkAvailable = g_application.getNetwork().IsAvailable(true); // true to wait for the network (if possible) if (networkAvailable) { - if (strProtocol == "tuxbox") return new CTuxBoxDirectory(); - if (strProtocol == "ftp" || strProtocol == "ftps") return new CFTPDirectory(); - if (strProtocol == "http" || strProtocol == "https") return new CHTTPDirectory(); - if (strProtocol == "dav" || strProtocol == "davs") return new CDAVDirectory(); + if (url.IsProtocol("tuxbox")) return new CTuxBoxDirectory(); + if (url.IsProtocol("ftp") || url.IsProtocol("ftps")) return new CFTPDirectory(); + if (url.IsProtocol("http") || url.IsProtocol("https")) return new CHTTPDirectory(); + if (url.IsProtocol("dav") || url.IsProtocol("davs")) return new CDAVDirectory(); #ifdef HAS_FILESYSTEM_SFTP - if (strProtocol == "sftp" || strProtocol == "ssh") return new CSFTPDirectory(); + if (url.IsProtocol("sftp") || url.IsProtocol("ssh")) return new CSFTPDirectory(); #endif #ifdef HAS_FILESYSTEM_SMB #ifdef TARGET_WINDOWS - if (strProtocol == "smb") return new CWin32SMBDirectory(); + if (url.IsProtocol("smb")) return new CWin32SMBDirectory(); #else - if (strProtocol == "smb") return new CSMBDirectory(); + if (url.IsProtocol("smb")) return new CSMBDirectory(); #endif #endif #ifdef HAS_FILESYSTEM #ifdef HAS_FILESYSTEM_DAAP - if (strProtocol == "daap") return new CDAAPDirectory(); + if (url.IsProtocol("daap")) return new CDAAPDirectory(); #endif #ifdef HAS_FILESYSTEM_RTV - if (strProtocol == "rtv") return new CRTVDirectory(); + if (url.IsProtocol("rtv")) return new CRTVDirectory(); #endif #endif #ifdef HAS_UPNP - if (strProtocol == "upnp") return new CUPnPDirectory(); + if (url.IsProtocol("upnp")) return new CUPnPDirectory(); #endif - if (strProtocol == "hdhomerun") return new CHomeRunDirectory(); - if (strProtocol == "sling") return new CSlingboxDirectory(); - if (strProtocol == "myth") return new CMythDirectory(); - if (strProtocol == "cmyth") return new CMythDirectory(); - if (strProtocol == "rss") return new CRSSDirectory(); + if (url.IsProtocol("hdhomerun")) return new CHomeRunDirectory(); + if (url.IsProtocol("sling")) return new CSlingboxDirectory(); + if (url.IsProtocol("myth")) return new CMythDirectory(); + if (url.IsProtocol("cmyth")) return new CMythDirectory(); + if (url.IsProtocol("rss")) return new CRSSDirectory(); #ifdef HAS_FILESYSTEM_SAP - if (strProtocol == "sap") return new CSAPDirectory(); + if (url.IsProtocol("sap")) return new CSAPDirectory(); #endif #ifdef HAS_FILESYSTEM_VTP - if (strProtocol == "vtp") return new CVTPDirectory(); + if (url.IsProtocol("vtp")) return new CVTPDirectory(); #endif #ifdef HAS_FILESYSTEM_HTSP - if (strProtocol == "htsp") return new CHTSPDirectory(); + if (url.IsProtocol("htsp")) return new CHTSPDirectory(); #endif #ifdef HAS_PVRCLIENTS - if (strProtocol == "pvr") return new CPVRDirectory(); + if (url.IsProtocol("pvr")) return new CPVRDirectory(); #endif #ifdef HAS_ZEROCONF - if (strProtocol == "zeroconf") return new CZeroconfDirectory(); + if (url.IsProtocol("zeroconf")) return new CZeroconfDirectory(); #endif #ifdef HAS_FILESYSTEM_NFS - if (strProtocol == "nfs") return new CNFSDirectory(); + if (url.IsProtocol("nfs")) return new CNFSDirectory(); #endif #ifdef HAS_FILESYSTEM_AFP - if (strProtocol == "afp") return new CAFPDirectory(); + if (url.IsProtocol("afp")) return new CAFPDirectory(); #endif #ifdef HAVE_LIBBLURAY - if (strProtocol == "bluray") return new CBlurayDirectory(); + if (url.IsProtocol("bluray")) return new CBlurayDirectory(); #endif } - CLog::Log(LOGWARNING, "%s - %sunsupported protocol(%s) in %s", __FUNCTION__, networkAvailable ? "" : "Network down or ", strProtocol.c_str(), url.GetRedacted().c_str() ); + CLog::Log(LOGWARNING, "%s - %sunsupported protocol(%s) in %s", __FUNCTION__, networkAvailable ? "" : "Network down or ", url.GetProtocol().c_str(), url.GetRedacted().c_str() ); return NULL; } diff --git a/xbmc/filesystem/DirectoryFactory.h b/xbmc/filesystem/DirectoryFactory.h index 5a050395aa..76914fc367 100644 --- a/xbmc/filesystem/DirectoryFactory.h +++ b/xbmc/filesystem/DirectoryFactory.h @@ -33,7 +33,7 @@ namespace XFILE Example: \verbatim - CStdString strShare="iso9660://"; + std::string strShare="iso9660://"; IDirectory* pDir=CDirectoryFactory::Create(strShare); \endverbatim diff --git a/xbmc/filesystem/DirectoryHistory.cpp b/xbmc/filesystem/DirectoryHistory.cpp index a22eb3baed..319e20bc09 100644 --- a/xbmc/filesystem/DirectoryHistory.cpp +++ b/xbmc/filesystem/DirectoryHistory.cpp @@ -25,7 +25,7 @@ using namespace std; -const CStdString& CDirectoryHistory::CPathHistoryItem::GetPath(bool filter /* = false */) const +const std::string& CDirectoryHistory::CPathHistoryItem::GetPath(bool filter /* = false */) const { if (filter && !m_strFilterPath.empty()) return m_strFilterPath; @@ -39,20 +39,20 @@ CDirectoryHistory::~CDirectoryHistory() m_vecPathHistory.clear(); } -void CDirectoryHistory::RemoveSelectedItem(const CStdString& strDirectory) +void CDirectoryHistory::RemoveSelectedItem(const std::string& strDirectory) { HistoryMap::iterator iter = m_vecHistory.find(preparePath(strDirectory)); if (iter != m_vecHistory.end()) m_vecHistory.erase(iter); } -void CDirectoryHistory::SetSelectedItem(const CStdString& strSelectedItem, const CStdString& strDirectory) +void CDirectoryHistory::SetSelectedItem(const std::string& strSelectedItem, const std::string& strDirectory) { if (strSelectedItem.empty()) return; - CStdString strDir = preparePath(strDirectory); - CStdString strItem = preparePath(strSelectedItem, false); + std::string strDir = preparePath(strDirectory); + std::string strItem = preparePath(strSelectedItem, false); HistoryMap::iterator iter = m_vecHistory.find(strDir); if (iter != m_vecHistory.end()) @@ -67,16 +67,16 @@ void CDirectoryHistory::SetSelectedItem(const CStdString& strSelectedItem, const m_vecHistory[strDir] = item; } -const CStdString& CDirectoryHistory::GetSelectedItem(const CStdString& strDirectory) const +const std::string& CDirectoryHistory::GetSelectedItem(const std::string& strDirectory) const { HistoryMap::const_iterator iter = m_vecHistory.find(preparePath(strDirectory)); if (iter != m_vecHistory.end()) return iter->second.m_strItem; - return StringUtils::EmptyString; + return StringUtils::Empty; } -void CDirectoryHistory::AddPath(const CStdString& strPath, const CStdString &strFilterPath /* = "" */) +void CDirectoryHistory::AddPath(const std::string& strPath, const std::string &strFilterPath /* = "" */) { if (!m_vecPathHistory.empty() && m_vecPathHistory.back().m_strPath == strPath) return; @@ -87,7 +87,7 @@ void CDirectoryHistory::AddPath(const CStdString& strPath, const CStdString &str m_vecPathHistory.push_back(item); } -void CDirectoryHistory::AddPathFront(const CStdString& strPath, const CStdString &strFilterPath /* = "" */) +void CDirectoryHistory::AddPathFront(const std::string& strPath, const std::string &strFilterPath /* = "" */) { CPathHistoryItem item; item.m_strPath = strPath; @@ -95,10 +95,10 @@ void CDirectoryHistory::AddPathFront(const CStdString& strPath, const CStdString m_vecPathHistory.insert(m_vecPathHistory.begin(), item); } -CStdString CDirectoryHistory::GetParentPath(bool filter /* = false */) +std::string CDirectoryHistory::GetParentPath(bool filter /* = false */) { if (m_vecPathHistory.empty()) - return StringUtils::EmptyString; + return ""; return m_vecPathHistory.back().GetPath(filter); } @@ -117,12 +117,12 @@ bool CDirectoryHistory::IsInHistory(const std::string &path) const return false; } -CStdString CDirectoryHistory::RemoveParentPath(bool filter /* = false */) +std::string CDirectoryHistory::RemoveParentPath(bool filter /* = false */) { if (m_vecPathHistory.empty()) - return StringUtils::EmptyString; + return ""; - CStdString strParent = GetParentPath(filter); + std::string strParent = GetParentPath(filter); m_vecPathHistory.pop_back(); return strParent; } @@ -150,9 +150,9 @@ void CDirectoryHistory::DumpPathHistory() CLog::Log(LOGDEBUG, " %02i.[%s; %s]", i, m_vecPathHistory[i].m_strPath.c_str(), m_vecPathHistory[i].m_strFilterPath.c_str()); } -CStdString CDirectoryHistory::preparePath(const CStdString &strDirectory, bool tolower /* = true */) +std::string CDirectoryHistory::preparePath(const std::string &strDirectory, bool tolower /* = true */) { - CStdString strDir = strDirectory; + std::string strDir = strDirectory; if (tolower) StringUtils::ToLower(strDir); diff --git a/xbmc/filesystem/DirectoryHistory.h b/xbmc/filesystem/DirectoryHistory.h index e220e2bd2f..20ced3e0c4 100644 --- a/xbmc/filesystem/DirectoryHistory.h +++ b/xbmc/filesystem/DirectoryHistory.h @@ -20,8 +20,8 @@ */ #include <map> - -#include "utils/StdString.h" +#include <string> +#include <vector> class CDirectoryHistory { @@ -31,8 +31,8 @@ public: public: CHistoryItem(){}; virtual ~CHistoryItem(){}; - CStdString m_strItem; - CStdString m_strDirectory; + std::string m_strItem; + std::string m_strDirectory; }; class CPathHistoryItem @@ -41,23 +41,23 @@ public: CPathHistoryItem() { } virtual ~CPathHistoryItem() { } - const CStdString& GetPath(bool filter = false) const; + const std::string& GetPath(bool filter = false) const; - CStdString m_strPath; - CStdString m_strFilterPath; + std::string m_strPath; + std::string m_strFilterPath; }; CDirectoryHistory() { } virtual ~CDirectoryHistory(); - void SetSelectedItem(const CStdString& strSelectedItem, const CStdString& strDirectory); - const CStdString& GetSelectedItem(const CStdString& strDirectory) const; - void RemoveSelectedItem(const CStdString& strDirectory); + void SetSelectedItem(const std::string& strSelectedItem, const std::string& strDirectory); + const std::string& GetSelectedItem(const std::string& strDirectory) const; + void RemoveSelectedItem(const std::string& strDirectory); - void AddPath(const CStdString& strPath, const CStdString &m_strFilterPath = ""); - void AddPathFront(const CStdString& strPath, const CStdString &m_strFilterPath = ""); - CStdString GetParentPath(bool filter = false); - CStdString RemoveParentPath(bool filter = false); + void AddPath(const std::string& strPath, const std::string &m_strFilterPath = ""); + void AddPathFront(const std::string& strPath, const std::string &m_strFilterPath = ""); + std::string GetParentPath(bool filter = false); + std::string RemoveParentPath(bool filter = false); void ClearPathHistory(); void ClearSearchHistory(); void DumpPathHistory(); @@ -69,9 +69,9 @@ public: bool IsInHistory(const std::string &path) const; private: - static CStdString preparePath(const CStdString &strDirectory, bool tolower = true); + static std::string preparePath(const std::string &strDirectory, bool tolower = true); - typedef std::map<CStdString, CHistoryItem> HistoryMap; + typedef std::map<std::string, CHistoryItem> HistoryMap; HistoryMap m_vecHistory; std::vector<CPathHistoryItem> m_vecPathHistory; ///< History of traversed directories static bool IsMusicSearchUrl(CPathHistoryItem &i); diff --git a/xbmc/filesystem/DllLibCurl.h b/xbmc/filesystem/DllLibCurl.h index 05c3cff555..304459f655 100644 --- a/xbmc/filesystem/DllLibCurl.h +++ b/xbmc/filesystem/DllLibCurl.h @@ -131,8 +131,8 @@ namespace XCURL typedef struct SSession { unsigned int m_idletimestamp; // timestamp of when this object when idle - CStdString m_protocol; - CStdString m_hostname; + std::string m_protocol; + std::string m_hostname; bool m_busy; CURL_HANDLE* m_easy; CURLM* m_multi; diff --git a/xbmc/filesystem/FTPDirectory.cpp b/xbmc/filesystem/FTPDirectory.cpp index 092961c84a..236f23b04b 100644 --- a/xbmc/filesystem/FTPDirectory.cpp +++ b/xbmc/filesystem/FTPDirectory.cpp @@ -39,7 +39,7 @@ bool CFTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items) CURL url(url2); - CStdString path = url.GetFileName(); + std::string path = url.GetFileName(); if( !path.empty() && !StringUtils::EndsWith(path, "/") ) { path += "/"; @@ -54,7 +54,7 @@ bool CFTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items) char buffer[MAX_PATH + 1024]; while( reader.ReadString(buffer, sizeof(buffer)) ) { - CStdString strBuffer = buffer; + std::string strBuffer = buffer; StringUtils::RemoveCRLF(strBuffer); @@ -68,10 +68,10 @@ bool CFTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items) continue; /* buffer name */ - CStdString name; + std::string name; name.assign(parse.getName()); - if( name.Equals("..") || name.Equals(".") ) + if( name == ".." || name == "." ) continue; // server returned filename could in utf8 or non-utf8 encoding @@ -92,7 +92,7 @@ bool CFTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items) CFileItemPtr pItem(new CFileItem(name)); pItem->m_bIsFolder = (bool)(parse.getFlagtrycwd() != 0); - CStdString filePath = path + name; + std::string filePath = path + name; if (pItem->m_bIsFolder) URIUtils::AddSlashAtEnd(filePath); @@ -114,7 +114,7 @@ bool CFTPDirectory::Exists(const CURL& url) { // make sure ftp dir ends with slash, // curl need to known it's a dir to check ftp directory existence. - CStdString file = url.Get(); + std::string file = url.Get(); URIUtils::AddSlashAtEnd(file); CCurlFile ftp; diff --git a/xbmc/filesystem/FavouritesDirectory.cpp b/xbmc/filesystem/FavouritesDirectory.cpp index 7533d0e87c..4008e1786f 100644 --- a/xbmc/filesystem/FavouritesDirectory.cpp +++ b/xbmc/filesystem/FavouritesDirectory.cpp @@ -59,7 +59,7 @@ bool CFavouritesDirectory::Exists(const CURL& url) bool CFavouritesDirectory::Load(CFileItemList &items) { items.Clear(); - CStdString favourites; + std::string favourites; favourites = "special://xbmc/system/favourites.xml"; if(XFILE::CFile::Exists(favourites)) @@ -75,7 +75,7 @@ bool CFavouritesDirectory::Load(CFileItemList &items) return true; } -bool CFavouritesDirectory::LoadFavourites(const CStdString& strPath, CFileItemList& items) +bool CFavouritesDirectory::LoadFavourites(const std::string& strPath, CFileItemList& items) { CXBMCTinyXML doc; if (!doc.LoadFile(strPath)) @@ -116,7 +116,7 @@ bool CFavouritesDirectory::LoadFavourites(const CStdString& strPath, CFileItemLi bool CFavouritesDirectory::Save(const CFileItemList &items) { - CStdString favourites; + std::string favourites; CXBMCTinyXML doc; TiXmlElement xmlRootElement("favourites"); TiXmlNode *rootNode = doc.InsertEndChild(xmlRootElement); @@ -146,7 +146,7 @@ bool CFavouritesDirectory::AddOrRemove(CFileItem *item, int contextWindow) CFileItemList items; Load(items); - CStdString executePath(GetExecutePath(*item, contextWindow)); + std::string executePath(GetExecutePath(*item, contextWindow)); CFileItemPtr match = items.Get(executePath); if (match) @@ -175,14 +175,14 @@ bool CFavouritesDirectory::IsFavourite(CFileItem *item, int contextWindow) return items.Contains(GetExecutePath(*item, contextWindow)); } -CStdString CFavouritesDirectory::GetExecutePath(const CFileItem &item, int contextWindow) +std::string CFavouritesDirectory::GetExecutePath(const CFileItem &item, int contextWindow) { return GetExecutePath(item, StringUtils::Format("%i", contextWindow)); } -CStdString CFavouritesDirectory::GetExecutePath(const CFileItem &item, const std::string &contextWindow) +std::string CFavouritesDirectory::GetExecutePath(const CFileItem &item, const std::string &contextWindow) { - CStdString execute; + std::string execute; if (item.m_bIsFolder && (g_advancedSettings.m_playlistAsFolders || !(item.IsSmartPlayList() || item.IsPlayList()))) { diff --git a/xbmc/filesystem/FavouritesDirectory.h b/xbmc/filesystem/FavouritesDirectory.h index f4d1519801..ed4d533e45 100644 --- a/xbmc/filesystem/FavouritesDirectory.h +++ b/xbmc/filesystem/FavouritesDirectory.h @@ -20,7 +20,6 @@ * */ -#include "utils/StdString.h" #include "IDirectory.h" class CFileItemList; @@ -35,14 +34,14 @@ namespace XFILE virtual bool GetDirectory(const CURL& url, CFileItemList &items); virtual bool Exists(const CURL& url); static bool Load(CFileItemList &items); - static bool LoadFavourites(const CStdString& strPath, CFileItemList& items); + static bool LoadFavourites(const std::string& strPath, CFileItemList& items); static bool AddOrRemove(CFileItem *item, int contextWindow); static bool Save(const CFileItemList& items); static bool IsFavourite(CFileItem *item, int contextWindow); - static CStdString GetExecutePath(const CFileItem &item, int contextWindow); - static CStdString GetExecutePath(const CFileItem &item, const std::string &contextWindow); + static std::string GetExecutePath(const CFileItem &item, int contextWindow); + static std::string GetExecutePath(const CFileItem &item, const std::string &contextWindow); private: }; diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp index f2bb7f2e4f..65dd293cc6 100644 --- a/xbmc/filesystem/File.cpp +++ b/xbmc/filesystem/File.cpp @@ -69,7 +69,7 @@ CFile::~CFile() //********************************************************************************************* -bool CFile::Copy(const CStdString& strFileName, const CStdString& strDest, XFILE::IFileCallback* pCallback, void* pContext) +bool CFile::Copy(const std::string& strFileName, const std::string& strDest, XFILE::IFileCallback* pCallback, void* pContext) { const CURL pathToUrl(strFileName); const CURL pathToUrlDest(strDest); @@ -80,7 +80,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall { CFile file; - const CStdString pathToUrl(dest.Get()); + const std::string pathToUrl(dest.Get()); if (pathToUrl.empty()) return false; @@ -95,7 +95,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall if (URIUtils::IsHD(pathToUrl)) // create possible missing dirs { vector<std::string> tokens; - CStdString strDirectory = URIUtils::GetDirectory(pathToUrl); + std::string strDirectory = URIUtils::GetDirectory(pathToUrl); URIUtils::RemoveSlashAtEnd(strDirectory); // for the test below if (!(strDirectory.size() == 2 && strDirectory[1] == ':')) { @@ -107,7 +107,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall pathsep = "/"; #endif StringUtils::Tokenize(url.GetFileName(),tokens,pathsep.c_str()); - CStdString strCurrPath; + std::string strCurrPath; // Handle special if (!url.GetProtocol().empty()) { pathsep = "/"; @@ -210,7 +210,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall } //********************************************************************************************* -bool CFile::Open(const CStdString& strFileName, const unsigned int flags) +bool CFile::Open(const std::string& strFileName, const unsigned int flags) { const CURL pathToUrl(strFileName); return Open(pathToUrl, flags); @@ -237,7 +237,7 @@ bool CFile::Open(const CURL& file, const unsigned int flags) if (!(m_flags & READ_NO_CACHE)) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); if (URIUtils::IsInternetStream(url, true) && !CUtil::IsPicture(pathToUrl) ) m_flags |= READ_CACHED; @@ -321,7 +321,7 @@ bool CFile::Open(const CURL& file, const unsigned int flags) return false; } -bool CFile::OpenForWrite(const CStdString& strFileName, bool bOverWrite) +bool CFile::OpenForWrite(const std::string& strFileName, bool bOverWrite) { const CURL pathToUrl(strFileName); return OpenForWrite(pathToUrl, bOverWrite); @@ -351,7 +351,7 @@ bool CFile::OpenForWrite(const CURL& file, bool bOverWrite) return false; } -bool CFile::Exists(const CStdString& strFileName, bool bUseCache /* = true */) +bool CFile::Exists(const std::string& strFileName, bool bUseCache /* = true */) { const CURL pathToUrl(strFileName); return Exists(pathToUrl, bUseCache); @@ -439,7 +439,7 @@ bool CFile::SkipNext() return false; } -int CFile::Stat(const CStdString& strFileName, struct __stat64* buffer) +int CFile::Stat(const std::string& strFileName, struct __stat64* buffer) { const CURL pathToUrl(strFileName); return Stat(pathToUrl, buffer); @@ -750,7 +750,7 @@ int CFile::Write(const void* lpBuf, int64_t uiBufSize) return -1; } -bool CFile::Delete(const CStdString& strFileName) +bool CFile::Delete(const std::string& strFileName) { const CURL pathToUrl(strFileName); return Delete(pathToUrl); @@ -782,7 +782,7 @@ bool CFile::Delete(const CURL& file) return false; } -bool CFile::Rename(const CStdString& strFileName, const CStdString& strNewFileName) +bool CFile::Rename(const std::string& strFileName, const std::string& strNewFileName) { const CURL pathToUrl(strFileName); const CURL pathToUrlNew(strNewFileName); @@ -816,7 +816,7 @@ bool CFile::Rename(const CURL& file, const CURL& newFile) return false; } -bool CFile::SetHidden(const CStdString& fileName, bool hidden) +bool CFile::SetHidden(const std::string& fileName, bool hidden) { const CURL pathToUrl(fileName); return SetHidden(pathToUrl, hidden); @@ -1114,7 +1114,7 @@ void CFileStream::Close() SAFE_DELETE(m_file); } -bool CFileStream::Open(const CStdString& filename) +bool CFileStream::Open(const std::string& filename) { const CURL pathToUrl(filename); return Open(pathToUrl); diff --git a/xbmc/filesystem/File.h b/xbmc/filesystem/File.h index a1ebbc7814..bd9e2cb8e9 100644 --- a/xbmc/filesystem/File.h +++ b/xbmc/filesystem/File.h @@ -30,8 +30,9 @@ #pragma once #include <iostream> +#include <stdio.h> +#include <string> #include "utils/auto_buffer.h" -#include "utils/StdString.h" #include "IFileTypes.h" #include "PlatformDefs.h" @@ -81,8 +82,8 @@ public: bool OpenForWrite(const CURL& file, bool bOverWrite = false); ssize_t LoadFile(const CURL &file, auto_buffer& outputBuffer); - bool Open(const CStdString& strFileName, const unsigned int flags = 0); - bool OpenForWrite(const CStdString& strFileName, bool bOverWrite = false); + bool Open(const std::string& strFileName, const unsigned int flags = 0); + bool OpenForWrite(const std::string& strFileName, bool bOverWrite = false); unsigned int Read(void* lpBuf, int64_t uiBufSize); bool ReadString(char *szLine, int iLineLength); int Write(const void* lpBuf, int64_t uiBufSize); @@ -124,13 +125,13 @@ public: static bool SetHidden(const CURL& file, bool hidden); // string interface - static bool Exists(const CStdString& strFileName, bool bUseCache = true); - static int Stat(const CStdString& strFileName, struct __stat64* buffer); + static bool Exists(const std::string& strFileName, bool bUseCache = true); + static int Stat(const std::string& strFileName, struct __stat64* buffer); int Stat(struct __stat64 *buffer); - static bool Delete(const CStdString& strFileName); - static bool Rename(const CStdString& strFileName, const CStdString& strNewFileName); - static bool Copy(const CStdString& strFileName, const CStdString& strDest, XFILE::IFileCallback* pCallback = NULL, void* pContext = NULL); - static bool SetHidden(const CStdString& fileName, bool hidden); + static bool Delete(const std::string& strFileName); + static bool Rename(const std::string& strFileName, const std::string& strNewFileName); + static bool Copy(const std::string& strFileName, const std::string& strDest, XFILE::IFileCallback* pCallback = NULL, void* pContext = NULL); + static bool SetHidden(const std::string& fileName, bool hidden); private: unsigned int m_flags; @@ -170,7 +171,7 @@ public: CFileStream(int backsize = 0); ~CFileStream(); - bool Open(const CStdString& filename); + bool Open(const std::string& filename); bool Open(const CURL& filename); void Close(); diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp index 52559a7583..ab7d114c8a 100644 --- a/xbmc/filesystem/FileCache.cpp +++ b/xbmc/filesystem/FileCache.cpp @@ -475,7 +475,7 @@ void CFileCache::StopThread(bool bWait /*= true*/) CThread::StopThread(bWait); } -CStdString CFileCache::GetContent() +std::string CFileCache::GetContent() { if (!m_source.GetImplemenation()) return IFile::GetContent(); diff --git a/xbmc/filesystem/FileCache.h b/xbmc/filesystem/FileCache.h index 5413f8cd2b..2d298dd3c0 100644 --- a/xbmc/filesystem/FileCache.h +++ b/xbmc/filesystem/FileCache.h @@ -58,7 +58,7 @@ namespace XFILE IFile *GetFileImp(); - virtual CStdString GetContent(); + virtual std::string GetContent(); virtual std::string GetContentCharset(void); private: @@ -66,7 +66,7 @@ namespace XFILE bool m_bDeleteCache; int m_seekPossible; CFile m_source; - CStdString m_sourcePath; + std::string m_sourcePath; CEvent m_seekEvent; CEvent m_seekEnded; int64_t m_nSeekResult; diff --git a/xbmc/filesystem/FileDirectoryFactory.cpp b/xbmc/filesystem/FileDirectoryFactory.cpp index 5ad010df93..844c2bc665 100644 --- a/xbmc/filesystem/FileDirectoryFactory.cpp +++ b/xbmc/filesystem/FileDirectoryFactory.cpp @@ -62,16 +62,13 @@ CFileDirectoryFactory::~CFileDirectoryFactory(void) {} // return NULL + set pItem->m_bIsFolder to remove it completely from list. -IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, const CStdString& strMask) +IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, const std::string& strMask) { if (url.GetProtocol() == "stack") // disqualify stack as we need to work with each of the parts instead return NULL; - CStdString strExtension=URIUtils::GetExtension(url); - StringUtils::ToLower(strExtension); - #ifdef HAS_FILESYSTEM - if ((strExtension.Equals(".ogg") || strExtension.Equals(".oga")) && CFile::Exists(url)) + if ((url.IsFileType("ogg") || url.IsFileType("oga")) && CFile::Exists(url)) { IFileDirectory* pDir=new COGGFileDirectory; // Has the ogg file more than one bitstream? @@ -83,7 +80,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, delete pDir; return NULL; } - if (strExtension.Equals(".nsf") && CFile::Exists(url)) + if (url.IsFileType("nsf") && CFile::Exists(url)) { IFileDirectory* pDir=new CNSFFileDirectory; // Has the nsf file more than one track? @@ -93,7 +90,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, delete pDir; return NULL; } - if (strExtension.Equals(".sid") && CFile::Exists(url)) + if (url.IsFileType("sid") && CFile::Exists(url)) { IFileDirectory* pDir=new CSIDFileDirectory; // Has the sid file more than one track? @@ -104,7 +101,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, return NULL; } #ifdef HAS_ASAP_CODEC - if (ASAPCodec::IsSupportedFormat(strExtension) && CFile::Exists(url)) + if (ASAPCodec::IsSupportedFormat(url.GetFileType()) && CFile::Exists(url)) { IFileDirectory* pDir=new CASAPFileDirectory; // Has the asap file more than one track? @@ -124,7 +121,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, #endif #if defined(TARGET_ANDROID) - if (strExtension.Equals(".apk")) + if (url.IsFileType("apk")) { CURL zipURL = URIUtils::CreateArchivePath("apk", url); @@ -145,7 +142,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, return NULL; } #endif - if (strExtension.Equals(".zip")) + if (url.IsFileType("zip")) { CURL zipURL = URIUtils::CreateArchivePath("zip", url); @@ -165,27 +162,27 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, } return NULL; } - if (strExtension.Equals(".rar") || strExtension.Equals(".001")) + if (url.IsFileType("rar") || url.IsFileType("001")) { vector<std::string> tokens; - const CStdString strPath = url.Get(); + const std::string strPath = url.Get(); StringUtils::Tokenize(strPath,tokens,"."); if (tokens.size() > 2) { - if (strExtension.Equals(".001")) + if (url.IsFileType("001")) { if (StringUtils::EqualsNoCase(tokens[tokens.size()-2], "ts")) // .ts.001 - treat as a movie file to scratch some users itch return NULL; } - CStdString token = tokens[tokens.size()-2]; - if (StringUtils::StartsWithNoCase(token, "part")) // only list '.part01.rar' + std::string token = tokens[tokens.size()-2]; + if (StringUtils::StartsWith(token, "part")) // only list '.part01.rar' { // need this crap to avoid making mistakes - yeyh for the new rar naming scheme :/ struct __stat64 stat; int digits = token.size()-4; - CStdString strFormat = StringUtils::Format("part%%0%ii", digits); - CStdString strNumber = StringUtils::Format(strFormat.c_str(), 1); - CStdString strPath2 = strPath; + std::string strFormat = StringUtils::Format("part%%0%ii", digits); + std::string strNumber = StringUtils::Format(strFormat.c_str(), 1); + std::string strPath2 = strPath; StringUtils::Replace(strPath2,token,strNumber); if (atoi(token.substr(4).c_str()) > 1 && CFile::Stat(strPath2,&stat) == 0) { @@ -218,7 +215,7 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, } return NULL; } - if (strExtension.Equals(".xsp")) + if (url.IsFileType("xsp")) { // XBMC Smart playlist - just XML renamed to XSP // read the name of the playlist in CSmartPlaylist playlist; diff --git a/xbmc/filesystem/FileDirectoryFactory.h b/xbmc/filesystem/FileDirectoryFactory.h index e7337fb734..5678f3e241 100644 --- a/xbmc/filesystem/FileDirectoryFactory.h +++ b/xbmc/filesystem/FileDirectoryFactory.h @@ -20,6 +20,7 @@ */ #include "IFileDirectory.h" +#include <string> class CFileItem; @@ -30,6 +31,6 @@ class CFileDirectoryFactory public: CFileDirectoryFactory(void); virtual ~CFileDirectoryFactory(void); - static IFileDirectory* Create(const CURL& url, CFileItem* pItem, const CStdString& strMask=""); + static IFileDirectory* Create(const CURL& url, CFileItem* pItem, const std::string& strMask=""); }; } diff --git a/xbmc/filesystem/FileFactory.cpp b/xbmc/filesystem/FileFactory.cpp index b50b3583db..3dfbd589ad 100644 --- a/xbmc/filesystem/FileFactory.cpp +++ b/xbmc/filesystem/FileFactory.cpp @@ -107,7 +107,7 @@ CFileFactory::~CFileFactory() { } -IFile* CFileFactory::CreateLoader(const CStdString& strFileName) +IFile* CFileFactory::CreateLoader(const std::string& strFileName) { CURL url(strFileName); return CreateLoader(url); @@ -118,7 +118,7 @@ IFile* CFileFactory::CreateLoader(const CURL& url) if (!CWakeOnAccess::Get().WakeUpHost(url)) return NULL; - CStdString strProtocol = url.GetProtocol(); + std::string strProtocol = url.GetProtocol(); StringUtils::ToLower(strProtocol); #if defined(TARGET_ANDROID) diff --git a/xbmc/filesystem/FileFactory.h b/xbmc/filesystem/FileFactory.h index 6b658ba3e8..6e97acc724 100644 --- a/xbmc/filesystem/FileFactory.h +++ b/xbmc/filesystem/FileFactory.h @@ -28,7 +28,7 @@ #pragma once #include "IFile.h" -#include "utils/StdString.h" +#include <string> namespace XFILE { @@ -37,7 +37,7 @@ class CFileFactory public: CFileFactory(); virtual ~CFileFactory(); - static IFile* CreateLoader(const CStdString& strFileName); + static IFile* CreateLoader(const std::string& strFileName); static IFile* CreateLoader(const CURL& url); }; } diff --git a/xbmc/filesystem/FileReaderFile.cpp b/xbmc/filesystem/FileReaderFile.cpp index 3cb3af0da4..e4405e2987 100644 --- a/xbmc/filesystem/FileReaderFile.cpp +++ b/xbmc/filesystem/FileReaderFile.cpp @@ -44,7 +44,7 @@ CFileReaderFile::~CFileReaderFile() bool CFileReaderFile::Open(const CURL& url) { // URL is of the form filereader://<foo> - CStdString strURL = url.Get(); + std::string strURL = url.Get(); strURL = strURL.substr(13); return m_reader.Open(strURL,READ_CACHED); } diff --git a/xbmc/filesystem/HDHomeRunDirectory.cpp b/xbmc/filesystem/HDHomeRunDirectory.cpp index 01a10b661b..b52a44f58f 100644 --- a/xbmc/filesystem/HDHomeRunDirectory.cpp +++ b/xbmc/filesystem/HDHomeRunDirectory.cpp @@ -63,8 +63,8 @@ bool CHomeRunDirectory::GetDirectory(const CURL& url, CFileItemList &items) CFileItemPtr item; unsigned int ip_addr = result_list[i].ip_addr; - CStdString device = StringUtils::Format("%x", result_list[i].device_id); - CStdString ip = StringUtils::Format("%u.%u.%u.%u", + std::string device = StringUtils::Format("%x", result_list[i].device_id); + std::string 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); @@ -95,13 +95,13 @@ bool CHomeRunDirectory::GetDirectory(const CURL& url, CFileItemList &items) return true; } - CStdString label; + std::string label; if(status.signal_present) label = StringUtils::Format("Current Stream: N/A"); else label = StringUtils::Format("Current Stream: Channel %s, SNR %d", status.channel, status.signal_to_noise_quality); - CStdString path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName(); + std::string path = "hdhomerun://" + url.GetHostName() + "/" + url.GetFileName(); URIUtils::RemoveSlashAtEnd(path); CFileItemPtr item(new CFileItem(path, false)); item->SetLabel(label); diff --git a/xbmc/filesystem/HDHomeRunFile.cpp b/xbmc/filesystem/HDHomeRunFile.cpp index 326cb99b25..0bd2a162fc 100644 --- a/xbmc/filesystem/HDHomeRunFile.cpp +++ b/xbmc/filesystem/HDHomeRunFile.cpp @@ -22,12 +22,12 @@ #include "system.h" #include "URL.h" #include "FileItem.h" -#include "DllHDHomeRun.h" #include "HDHomeRunFile.h" #include "utils/TimeUtils.h" #include "utils/log.h" #include "utils/URIUtils.h" #include "Util.h" +#include "DllHDHomeRun.h" using namespace XFILE; using namespace std; @@ -50,7 +50,7 @@ CHomeRunFile::~CHomeRunFile() bool CHomeRunFile::Exists(const CURL& url) { - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); /* * HDHomeRun URLs are of the form hdhomerun://1014F6D1/tuner0?channel=qam:108&program=10 diff --git a/xbmc/filesystem/HDHomeRunFile.h b/xbmc/filesystem/HDHomeRunFile.h index d9aec47cc3..2d74549f23 100644 --- a/xbmc/filesystem/HDHomeRunFile.h +++ b/xbmc/filesystem/HDHomeRunFile.h @@ -21,7 +21,7 @@ #include "IFile.h" -struct hdhomerun_device; +struct hdhomerun_device_t; class DllHdHomeRun; namespace XFILE diff --git a/xbmc/filesystem/HTSPDirectory.cpp b/xbmc/filesystem/HTSPDirectory.cpp index e77a243ad3..7a32250d35 100644 --- a/xbmc/filesystem/HTSPDirectory.cpp +++ b/xbmc/filesystem/HTSPDirectory.cpp @@ -139,7 +139,7 @@ void CHTSPDirectorySession::Release(CHTSPDirectorySession* &session) } } CLog::Log(LOGERROR, "CHTSPDirectorySession::Release - release of invalid session"); - ASSERT(0); + assert(0); } void CHTSPDirectorySession::CheckIdle(DWORD idle) @@ -438,7 +438,7 @@ bool CHTSPDirectory::GetDirectory(const CURL& url, CFileItemList &items) items.Add(item); STags tags = m_session->GetTags(); - CStdString filename, label; + std::string filename, label; for(STags::iterator it = tags.begin(); it != tags.end(); it++) { filename = StringUtils::Format("tags/%d/", it->second.id); diff --git a/xbmc/filesystem/HTSPSession.cpp b/xbmc/filesystem/HTSPSession.cpp index 84292b7393..1abd50e9d7 100644 --- a/xbmc/filesystem/HTSPSession.cpp +++ b/xbmc/filesystem/HTSPSession.cpp @@ -622,7 +622,7 @@ bool CHTSPSession::ParseItem(const SChannel& channel, int tagid, const SEvent& e CVideoInfoTag* tag = item.GetVideoInfoTag(); CURL url(item.GetPath()); - CStdString temp = StringUtils::Format("tags/%d/%d.ts", tagid, channel.id); + std::string temp = StringUtils::Format("tags/%d/%d.ts", tagid, channel.id); url.SetFileName(temp); tag->m_iSeason = 0; diff --git a/xbmc/filesystem/HTTPDirectory.cpp b/xbmc/filesystem/HTTPDirectory.cpp index 35ee6a874a..f9af557b75 100644 --- a/xbmc/filesystem/HTTPDirectory.cpp +++ b/xbmc/filesystem/HTTPDirectory.cpp @@ -40,8 +40,8 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) { CCurlFile http; - CStdString strName, strLink; - CStdString strBasePath = url.GetFileName(); + std::string strName, strLink; + std::string strBasePath = url.GetFileName(); if(!http.Open(url)) { @@ -74,7 +74,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) char buffer[MAX_PATH + 1024]; while(http.ReadString(buffer, sizeof(buffer)-1)) { - CStdString strBuffer = buffer; + std::string strBuffer = buffer; std::string fileCharset(http.GetServerReportedCharset()); if (!fileCharset.empty() && fileCharset != "UTF-8") { @@ -93,9 +93,9 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) if(strLink[0] == '/') strLink = strLink.substr(1); - CStdString strNameTemp = StringUtils::Trim(strName); + std::string strNameTemp = StringUtils::Trim(strName); - CStdStringW wName, wLink, wConverted; + std::wstring wName, wLink, wConverted; if (fileCharset.empty()) g_charsetConverter.unknownToUTF8(strNameTemp); g_charsetConverter.utf8ToW(strNameTemp, wName, false); @@ -103,8 +103,8 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) g_charsetConverter.wToUTF8(wConverted, strNameTemp); URIUtils::RemoveSlashAtEnd(strNameTemp); - CStdString strLinkBase = strLink; - CStdString strLinkOptions; + std::string strLinkBase = strLink; + std::string strLinkOptions; // split link with url options size_t pos = strLinkBase.find('?'); @@ -112,7 +112,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) strLinkOptions = strLinkBase.substr(pos); strLinkBase.erase(pos); } - CStdString strLinkTemp = strLinkBase; + std::string strLinkTemp = strLinkBase; URIUtils::RemoveSlashAtEnd(strLinkTemp); strLinkTemp = CURL::Decode(strLinkTemp); @@ -140,7 +140,7 @@ bool CHTTPDirectory::GetDirectory(const CURL& url, CFileItemList &items) if(URIUtils::HasSlashAtEnd(pItem->GetPath(), true)) pItem->m_bIsFolder = true; - CStdString day, month, year, hour, minute; + std::string day, month, year, hour, minute; int monthNum = 0; if (reDateTime.RegFind(strBuffer.c_str()) >= 0) diff --git a/xbmc/filesystem/HTTPFile.cpp b/xbmc/filesystem/HTTPFile.cpp index 57d15aea66..6e0b209c57 100644 --- a/xbmc/filesystem/HTTPFile.cpp +++ b/xbmc/filesystem/HTTPFile.cpp @@ -19,7 +19,6 @@ */ #include "HTTPFile.h" -#include "utils/StdString.h" using namespace XFILE; @@ -47,7 +46,7 @@ int CHTTPFile::Write(const void* lpBuf, int64_t uiBufSize) if (!m_openedforwrite) return -1; - CStdString myPostData((char*) lpBuf); + std::string myPostData((char*) lpBuf); if ((int64_t)myPostData.length() != uiBufSize) return -1; diff --git a/xbmc/filesystem/IDirectory.cpp b/xbmc/filesystem/IDirectory.cpp index 34411d013e..c013778dbf 100644 --- a/xbmc/filesystem/IDirectory.cpp +++ b/xbmc/filesystem/IDirectory.cpp @@ -56,7 +56,7 @@ bool IDirectory::IsAllowed(const CURL& url) const // We should ignore all non dvd/vcd related ifo and dat files. if (URIUtils::HasExtension(url, ".ifo")) { - CStdString fileName = URIUtils::GetFileName(url); + std::string fileName = URIUtils::GetFileName(url); // Allow filenames of the form video_ts.ifo or vts_##_0.ifo @@ -68,7 +68,7 @@ bool IDirectory::IsAllowed(const CURL& url) const if (URIUtils::HasExtension(url, ".dat")) { - CStdString fileName = URIUtils::GetFileName(url); + std::string fileName = URIUtils::GetFileName(url); // Allow filenames of the form AVSEQ##(#).DAT, ITEM###(#).DAT // and MUSIC##(#).DAT @@ -111,10 +111,10 @@ void IDirectory::SetFlags(int flags) bool IDirectory::ProcessRequirements() { - CStdString type = m_requirements["type"].asString(); + std::string type = m_requirements["type"].asString(); if (type == "keyboard") { - CStdString input; + std::string input; if (CGUIKeyboardFactory::ShowAndGetInput(input, m_requirements["heading"], false)) { m_requirements["input"] = input; diff --git a/xbmc/filesystem/IFile.h b/xbmc/filesystem/IFile.h index 6c80601ce1..7386263f14 100644 --- a/xbmc/filesystem/IFile.h +++ b/xbmc/filesystem/IFile.h @@ -36,8 +36,8 @@ #include <stdio.h> #include <stdint.h> #include <sys/stat.h> +#include <string> -#include "utils/StdString.h" #include "IFileTypes.h" class CURL; @@ -82,7 +82,7 @@ public: virtual int IoControl(EIoControl request, void* param) { return -1; } - virtual CStdString GetContent() { return "application/octet-stream"; } + virtual std::string GetContent() { return "application/octet-stream"; } virtual std::string GetContentCharset(void) { return ""; } }; diff --git a/xbmc/filesystem/IFileTypes.h b/xbmc/filesystem/IFileTypes.h index 31528857a8..8bb1e7907e 100644 --- a/xbmc/filesystem/IFileTypes.h +++ b/xbmc/filesystem/IFileTypes.h @@ -20,6 +20,8 @@ #pragma once +#include <stdint.h> + namespace XFILE { diff --git a/xbmc/filesystem/ISO9660Directory.cpp b/xbmc/filesystem/ISO9660Directory.cpp index 08d071104b..6ad70562dd 100644 --- a/xbmc/filesystem/ISO9660Directory.cpp +++ b/xbmc/filesystem/ISO9660Directory.cpp @@ -36,7 +36,7 @@ CISO9660Directory::~CISO9660Directory(void) bool CISO9660Directory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString strRoot = url.Get(); + std::string strRoot = url.Get(); URIUtils::AddSlashAtEnd(strRoot); // Scan active disc if not done before @@ -48,8 +48,8 @@ bool CISO9660Directory::GetDirectory(const CURL& url, CFileItemList &items) memset(&wfd, 0, sizeof(wfd)); - CStdString strSearchMask; - CStdString strDirectory = url.GetFileName(); + std::string strSearchMask; + std::string strDirectory = url.GetFileName(); if (strDirectory != "") { strSearchMask = StringUtils::Format("\\%s", strDirectory.c_str()); @@ -73,11 +73,11 @@ bool CISO9660Directory::GetDirectory(const CURL& url, CFileItemList &items) { if ( (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { - CStdString strDir = wfd.cFileName; + std::string strDir = wfd.cFileName; if (strDir != "." && strDir != "..") { CFileItemPtr pItem(new CFileItem(wfd.cFileName)); - CStdString path = strRoot + wfd.cFileName; + std::string path = strRoot + wfd.cFileName; URIUtils::AddSlashAtEnd(path); pItem->SetPath(path); pItem->m_bIsFolder = true; diff --git a/xbmc/filesystem/ImageFile.cpp b/xbmc/filesystem/ImageFile.cpp index 96f3c38969..95dd488527 100644 --- a/xbmc/filesystem/ImageFile.cpp +++ b/xbmc/filesystem/ImageFile.cpp @@ -37,9 +37,9 @@ CImageFile::~CImageFile(void) bool CImageFile::Open(const CURL& url) { - CStdString file = url.Get(); + std::string file = url.Get(); bool needsRecaching = false; - CStdString cachedFile = CTextureCache::Get().CheckCachedImage(file, false, needsRecaching); + std::string cachedFile = CTextureCache::Get().CheckCachedImage(file, false, needsRecaching); if (cachedFile.empty()) { // not in the cache, so cache it cachedFile = CTextureCache::Get().CacheImage(file); @@ -55,7 +55,7 @@ bool CImageFile::Open(const CURL& url) bool CImageFile::Exists(const CURL& url) { bool needsRecaching = false; - CStdString cachedFile = CTextureCache::Get().CheckCachedImage(url.Get(), false, needsRecaching); + std::string cachedFile = CTextureCache::Get().CheckCachedImage(url.Get(), false, needsRecaching); if (!cachedFile.empty()) return CFile::Exists(cachedFile); @@ -69,7 +69,7 @@ bool CImageFile::Exists(const CURL& url) int CImageFile::Stat(const CURL& url, struct __stat64* buffer) { bool needsRecaching = false; - CStdString cachedFile = CTextureCache::Get().CheckCachedImage(url.Get(), false, needsRecaching); + std::string cachedFile = CTextureCache::Get().CheckCachedImage(url.Get(), false, needsRecaching); if (!cachedFile.empty()) return CFile::Stat(cachedFile, buffer); diff --git a/xbmc/filesystem/LibraryDirectory.cpp b/xbmc/filesystem/LibraryDirectory.cpp index b33ececc13..75bf7cdbab 100644 --- a/xbmc/filesystem/LibraryDirectory.cpp +++ b/xbmc/filesystem/LibraryDirectory.cpp @@ -56,11 +56,11 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items) TiXmlElement *node = LoadXML(libNode); if (node) { - CStdString type = XMLUtils::GetAttribute(node, "type"); + std::string type = XMLUtils::GetAttribute(node, "type"); if (type == "filter") { CSmartPlaylist playlist; - CStdString type, label; + std::string type, label; XMLUtils::GetString(node, "content", type); if (type.empty()) { @@ -81,7 +81,7 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items) } else if (type == "folder") { - CStdString path; + std::string path; XMLUtils::GetPath(node, "path", path); if (!path.empty()) { @@ -103,15 +103,15 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items) for (int i = 0; i < nodes.Size(); i++) { const TiXmlElement *node = NULL; - CStdString xml = nodes[i]->GetPath(); + std::string xml = nodes[i]->GetPath(); if (nodes[i]->m_bIsFolder) node = LoadXML(URIUtils::AddFileToFolder(xml, "index.xml")); else { node = LoadXML(xml); - if (node && URIUtils::GetFileName(xml).Equals("index.xml")) + if (node && URIUtils::GetFileName(xml) == "index.xml") { // set the label on our items - CStdString label; + std::string label; if (XMLUtils::GetString(node, "label", label)) label = CGUIControlFactory::FilterLabel(label); items.SetLabel(label); @@ -120,7 +120,7 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items) } if (node) { - CStdString label, icon; + std::string label, icon; if (XMLUtils::GetString(node, "label", label)) label = CGUIControlFactory::FilterLabel(label); XMLUtils::GetString(node, "icon", icon); @@ -129,7 +129,7 @@ bool CLibraryDirectory::GetDirectory(const CURL& url, CFileItemList &items) // create item URIUtils::RemoveSlashAtEnd(xml); - CStdString folder = URIUtils::GetFileName(xml); + std::string folder = URIUtils::GetFileName(xml); CFileItemPtr item(new CFileItem(URIUtils::AddFileToFolder(basePath, folder), true)); item->SetLabel(label); @@ -170,7 +170,7 @@ bool CLibraryDirectory::Exists(const CURL& url) std::string CLibraryDirectory::GetNode(const CURL& url) { - CStdString libDir = URIUtils::AddFileToFolder(CProfilesManager::Get().GetLibraryFolder(), url.GetHostName() + "/"); + std::string libDir = URIUtils::AddFileToFolder(CProfilesManager::Get().GetLibraryFolder(), url.GetHostName() + "/"); if (!CDirectory::Exists(libDir)) libDir = URIUtils::AddFileToFolder("special://xbmc/system/library/", url.GetHostName() + "/"); @@ -181,7 +181,7 @@ std::string CLibraryDirectory::GetNode(const CURL& url) return libDir; // maybe it's an XML node? - CStdString xmlNode = libDir; + std::string xmlNode = libDir; URIUtils::RemoveSlashAtEnd(xmlNode); if (CFile::Exists(xmlNode)) diff --git a/xbmc/filesystem/MusicDatabaseDirectory.cpp b/xbmc/filesystem/MusicDatabaseDirectory.cpp index 01db567f5b..169dbf7915 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory.cpp @@ -45,7 +45,7 @@ CMusicDatabaseDirectory::~CMusicDatabaseDirectory(void) bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(url); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(url); items.SetPath(path); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); @@ -58,7 +58,7 @@ bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items CFileItemPtr item = items[i]; if (item->m_bIsFolder && !item->HasIcon() && !item->HasArt("thumb")) { - CStdString strImage = GetIcon(item->GetPath()); + std::string strImage = GetIcon(item->GetPath()); if (!strImage.empty() && g_TextureManager.HasTexture(strImage)) item->SetIconImage(strImage); } @@ -68,9 +68,9 @@ bool CMusicDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items return bResult; } -NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const CStdString& strPath) +NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -79,9 +79,9 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryChildType(const CStdString& strPa return pNode->GetChildType(); } -NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const CStdString& strPath) +NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -90,9 +90,9 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryType(const CStdString& strPath) return pNode->GetType(); } -NODE_TYPE CMusicDatabaseDirectory::GetDirectoryParentType(const CStdString& strPath) +NODE_TYPE CMusicDatabaseDirectory::GetDirectoryParentType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -106,43 +106,43 @@ NODE_TYPE CMusicDatabaseDirectory::GetDirectoryParentType(const CStdString& strP return pParentNode->GetChildType(); } -bool CMusicDatabaseDirectory::IsArtistDir(const CStdString& strDirectory) +bool CMusicDatabaseDirectory::IsArtistDir(const std::string& strDirectory) { NODE_TYPE node=GetDirectoryType(strDirectory); return (node==NODE_TYPE_ARTIST); } -bool CMusicDatabaseDirectory::HasAlbumInfo(const CStdString& strDirectory) +bool CMusicDatabaseDirectory::HasAlbumInfo(const std::string& strDirectory) { NODE_TYPE node=GetDirectoryType(strDirectory); return (node!=NODE_TYPE_OVERVIEW && node!=NODE_TYPE_TOP100 && node!=NODE_TYPE_GENRE && node!=NODE_TYPE_ARTIST && node!=NODE_TYPE_YEAR); } -void CMusicDatabaseDirectory::ClearDirectoryCache(const CStdString& strDirectory) +void CMusicDatabaseDirectory::ClearDirectoryCache(const std::string& strDirectory) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); URIUtils::RemoveSlashAtEnd(path); Crc32 crc; crc.ComputeFromLowerCase(path); - CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc); + std::string strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc); CFile::Delete(strFileName); } -bool CMusicDatabaseDirectory::IsAllItem(const CStdString& strDirectory) +bool CMusicDatabaseDirectory::IsAllItem(const std::string& strDirectory) { if (StringUtils::EndsWith(strDirectory, "/-1/")) return true; return false; } -bool CMusicDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdString& strLabel) +bool CMusicDatabaseDirectory::GetLabel(const std::string& strDirectory, std::string& strLabel) { strLabel = ""; - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; @@ -232,7 +232,7 @@ bool CMusicDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdStrin return true; } -bool CMusicDatabaseDirectory::ContainsSongs(const CStdString &path) +bool CMusicDatabaseDirectory::ContainsSongs(const std::string &path) { MUSICDATABASEDIRECTORY::NODE_TYPE type = GetDirectoryChildType(path); if (type == MUSICDATABASEDIRECTORY::NODE_TYPE_SONG) return true; @@ -248,7 +248,7 @@ bool CMusicDatabaseDirectory::ContainsSongs(const CStdString &path) bool CMusicDatabaseDirectory::Exists(const CURL& url) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(url); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(url); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -260,16 +260,16 @@ bool CMusicDatabaseDirectory::Exists(const CURL& url) return true; } -bool CMusicDatabaseDirectory::CanCache(const CStdString& strPath) +bool CMusicDatabaseDirectory::CanCache(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateMusicDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; return pNode->CanCache(); } -CStdString CMusicDatabaseDirectory::GetIcon(const CStdString &strDirectory) +std::string CMusicDatabaseDirectory::GetIcon(const std::string &strDirectory) { switch (GetDirectoryChildType(strDirectory)) { diff --git a/xbmc/filesystem/MusicDatabaseDirectory.h b/xbmc/filesystem/MusicDatabaseDirectory.h index c5ec1f7b52..d3b692f1f4 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory.h +++ b/xbmc/filesystem/MusicDatabaseDirectory.h @@ -33,16 +33,16 @@ namespace XFILE virtual bool GetDirectory(const CURL& url, CFileItemList &items); virtual bool AllowAll() const { return true; } virtual bool Exists(const CURL& url); - static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryChildType(const CStdString& strPath); - static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryType(const CStdString& strPath); - static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryParentType(const CStdString& strPath); - bool IsArtistDir(const CStdString& strDirectory); - bool HasAlbumInfo(const CStdString& strDirectory); - void ClearDirectoryCache(const CStdString& strDirectory); - static bool IsAllItem(const CStdString& strDirectory); - static bool GetLabel(const CStdString& strDirectory, CStdString& strLabel); - bool ContainsSongs(const CStdString &path); - static bool CanCache(const CStdString& strPath); - static CStdString GetIcon(const CStdString& strDirectory); + static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryChildType(const std::string& strPath); + static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryType(const std::string& strPath); + static MUSICDATABASEDIRECTORY::NODE_TYPE GetDirectoryParentType(const std::string& strPath); + bool IsArtistDir(const std::string& strDirectory); + bool HasAlbumInfo(const std::string& strDirectory); + void ClearDirectoryCache(const std::string& strDirectory); + static bool IsAllItem(const std::string& strDirectory); + static bool GetLabel(const std::string& strDirectory, std::string& strLabel); + bool ContainsSongs(const std::string &path); + static bool CanCache(const std::string& strPath); + static std::string GetIcon(const std::string& strDirectory); }; } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp index 0eb999bfcb..44a5ec132f 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp @@ -51,7 +51,7 @@ using namespace std; using namespace XFILE::MUSICDATABASEDIRECTORY; // Constructor is protected use ParseURL() -CDirectoryNode::CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNode::CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent) { m_Type=Type; m_strName=strName; @@ -64,11 +64,11 @@ CDirectoryNode::~CDirectoryNode() } // Parses a given path and returns the current node of the path -CDirectoryNode* CDirectoryNode::ParseURL(const CStdString& strPath) +CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) { CURL url(strPath); - CStdString strDirectory=url.GetFileName(); + std::string strDirectory=url.GetFileName(); URIUtils::RemoveSlashAtEnd(strDirectory); vector<string> Path = StringUtils::Split(strDirectory, "/"); @@ -93,7 +93,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const CStdString& strPath) } // returns the database ids of the path, -void CDirectoryNode::GetDatabaseInfo(const CStdString& strPath, CQueryParams& params) +void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& params) { auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath)); @@ -104,7 +104,7 @@ void CDirectoryNode::GetDatabaseInfo(const CStdString& strPath, CQueryParams& pa } // Create a node object -CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent) { switch (Type) { @@ -155,7 +155,7 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& str } // Current node name -const CStdString& CDirectoryNode::GetName() const +const std::string& CDirectoryNode::GetName() const { return m_strName; } @@ -165,7 +165,7 @@ int CDirectoryNode::GetID() const return atoi(m_strName.c_str()); } -CStdString CDirectoryNode::GetLocalizedName() const +std::string CDirectoryNode::GetLocalizedName() const { return ""; } @@ -196,7 +196,7 @@ bool CDirectoryNode::GetContent(CFileItemList& items) const } // Creates a musicdb url -CStdString CDirectoryNode::BuildPath() const +std::string CDirectoryNode::BuildPath() const { vector<string> array; @@ -206,14 +206,14 @@ CStdString CDirectoryNode::BuildPath() const CDirectoryNode* pParent=m_pParent; while (pParent!=NULL) { - const CStdString& strNodeName=pParent->GetName(); + const std::string& strNodeName=pParent->GetName(); if (!strNodeName.empty()) array.insert(array.begin(), strNodeName); pParent=pParent->GetParent(); } - CStdString strPath="musicdb://"; + std::string strPath="musicdb://"; for (int i=0; i<(int)array.size(); ++i) strPath+=array[i]+"/"; @@ -224,7 +224,7 @@ CStdString CDirectoryNode::BuildPath() const return strPath; } -void CDirectoryNode::AddOptions(const CStdString &options) +void CDirectoryNode::AddOptions(const std::string &options) { if (options.empty()) return; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.h index c5eb5da79c..3d3b4e3c80 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "utils/UrlOptions.h" class CFileItemList; @@ -64,40 +63,40 @@ namespace XFILE class CDirectoryNode { public: - static CDirectoryNode* ParseURL(const CStdString& strPath); - static void GetDatabaseInfo(const CStdString& strPath, CQueryParams& params); + static CDirectoryNode* ParseURL(const std::string& strPath); + static void GetDatabaseInfo(const std::string& strPath, CQueryParams& params); virtual ~CDirectoryNode(); NODE_TYPE GetType() const; bool GetChilds(CFileItemList& items); virtual NODE_TYPE GetChildType() const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; CDirectoryNode* GetParent() const; bool CanCache() const; protected: - CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent); - static CDirectoryNode* CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); + static CDirectoryNode* CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); - void AddOptions(const CStdString &options); + void AddOptions(const std::string &options); void CollectQueryParams(CQueryParams& params) const; - const CStdString& GetName() const; + const std::string& GetName() const; int GetID() const; void RemoveParent(); virtual bool GetContent(CFileItemList& items) const; - CStdString BuildPath() const; + std::string BuildPath() const; private: void AddQueuingFolder(CFileItemList& items) const; private: NODE_TYPE m_Type; - CStdString m_strName; + std::string m_strName; CDirectoryNode* m_pParent; CUrlOptions m_options; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.cpp index fb37a25559..b44df6e439 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbum::CDirectoryNodeAlbum(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbum::CDirectoryNodeAlbum(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM, strName, pParent) { @@ -35,7 +35,7 @@ NODE_TYPE CDirectoryNodeAlbum::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeAlbum::GetLocalizedName() const +std::string CDirectoryNodeAlbum::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15102); // All Albums diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.h index 3d312f39d7..ff59158f71 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbum.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeAlbum : public CDirectoryNode { public: - CDirectoryNodeAlbum(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbum(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.cpp index 721cc8268c..1b5f38ceab 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumCompilations::CDirectoryNodeAlbumCompilations(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumCompilations::CDirectoryNodeAlbumCompilations(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_COMPILATIONS, strName, pParent) { @@ -38,7 +38,7 @@ NODE_TYPE CDirectoryNodeAlbumCompilations::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeAlbumCompilations::GetLocalizedName() const +std::string CDirectoryNodeAlbumCompilations::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15102); // All Albums diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.h index 20e724c57a..dd621b68d2 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilations.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeAlbumCompilations : public CDirectoryNode { public: - CDirectoryNodeAlbumCompilations(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumCompilations(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.cpp index 6eb2bc641d..5c4087c8c6 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumCompilationsSongs::CDirectoryNodeAlbumCompilationsSongs(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumCompilationsSongs::CDirectoryNodeAlbumCompilationsSongs(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_COMPILATIONS_SONGS, strName, pParent) { diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.h index e3180b6de7..d60668d7f0 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumCompilationsSongs.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeAlbumCompilationsSongs : public CDirectoryNode { public: - CDirectoryNodeAlbumCompilationsSongs(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumCompilationsSongs(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.cpp index 5fc75d7cda..8b40209bb5 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.cpp @@ -25,7 +25,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumRecentlyAdded::CDirectoryNodeAlbumRecentlyAdded(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumRecentlyAdded::CDirectoryNodeAlbumRecentlyAdded(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_RECENTLY_ADDED, strName, pParent) { @@ -39,7 +39,7 @@ NODE_TYPE CDirectoryNodeAlbumRecentlyAdded::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeAlbumRecentlyAdded::GetLocalizedName() const +std::string CDirectoryNodeAlbumRecentlyAdded::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15102); // All Albums @@ -65,7 +65,7 @@ bool CDirectoryNodeAlbumRecentlyAdded::GetContent(CFileItemList& items) const for (int i=0; i<(int)albums.size(); ++i) { CAlbum& album=albums[i]; - CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); + std::string strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); CFileItemPtr pItem(new CFileItem(strDir, album)); items.Add(pItem); } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.h index 09bbe15278..856993e78a 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAdded.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeAlbumRecentlyAdded : public CDirectoryNode { public: - CDirectoryNodeAlbumRecentlyAdded(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumRecentlyAdded(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.cpp index 4cac3cc9ce..30f21a0cf3 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.cpp @@ -23,7 +23,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumRecentlyAddedSong::CDirectoryNodeAlbumRecentlyAddedSong(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumRecentlyAddedSong::CDirectoryNodeAlbumRecentlyAddedSong(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS, strName, pParent) { @@ -35,7 +35,7 @@ bool CDirectoryNodeAlbumRecentlyAddedSong::GetContent(CFileItemList& items) cons if (!musicdatabase.Open()) return false; - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetRecentlyAddedAlbumSongs(strBaseDir, items); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.h index d9459f6bae..fda8df4338 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyAddedSong.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeAlbumRecentlyAddedSong : public CDirectoryNode { public: - CDirectoryNodeAlbumRecentlyAddedSong(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumRecentlyAddedSong(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.cpp index 80b6ae4865..8d6408e8ab 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.cpp @@ -25,7 +25,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumRecentlyPlayed::CDirectoryNodeAlbumRecentlyPlayed(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumRecentlyPlayed::CDirectoryNodeAlbumRecentlyPlayed(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_RECENTLY_PLAYED, strName, pParent) { @@ -39,7 +39,7 @@ NODE_TYPE CDirectoryNodeAlbumRecentlyPlayed::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeAlbumRecentlyPlayed::GetLocalizedName() const +std::string CDirectoryNodeAlbumRecentlyPlayed::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15102); // All Albums @@ -65,7 +65,7 @@ bool CDirectoryNodeAlbumRecentlyPlayed::GetContent(CFileItemList& items) const for (int i=0; i<(int)albums.size(); ++i) { CAlbum& album=albums[i]; - CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); + std::string strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); CFileItemPtr pItem(new CFileItem(strDir, album)); items.Add(pItem); } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.h index c6159607bb..aefc8362d4 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayed.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeAlbumRecentlyPlayed : public CDirectoryNode { public: - CDirectoryNodeAlbumRecentlyPlayed(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumRecentlyPlayed(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.cpp index dab4894a4b..6b65b108a4 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.cpp @@ -23,7 +23,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumRecentlyPlayedSong::CDirectoryNodeAlbumRecentlyPlayedSong(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumRecentlyPlayedSong::CDirectoryNodeAlbumRecentlyPlayedSong(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS, strName, pParent) { @@ -35,7 +35,7 @@ bool CDirectoryNodeAlbumRecentlyPlayedSong::GetContent(CFileItemList& items) con if (!musicdatabase.Open()) return false; - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetRecentlyPlayedAlbumSongs(strBaseDir, items); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.h index a011d8dcf7..f624138870 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumRecentlyPlayedSong.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeAlbumRecentlyPlayedSong : public CDirectoryNode { public: - CDirectoryNodeAlbumRecentlyPlayedSong(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumRecentlyPlayedSong(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.cpp index 003f4928d5..adae9724d1 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.cpp @@ -25,7 +25,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumTop100::CDirectoryNodeAlbumTop100(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumTop100::CDirectoryNodeAlbumTop100(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_TOP100, strName, pParent) { @@ -39,7 +39,7 @@ NODE_TYPE CDirectoryNodeAlbumTop100::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeAlbumTop100::GetLocalizedName() const +std::string CDirectoryNodeAlbumTop100::GetLocalizedName() const { CMusicDatabase db; if (db.Open()) @@ -63,7 +63,7 @@ bool CDirectoryNodeAlbumTop100::GetContent(CFileItemList& items) const for (int i=0; i<(int)albums.size(); ++i) { CAlbum& album=albums[i]; - CStdString strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); + std::string strDir = StringUtils::Format("%s%ld/", BuildPath().c_str(), album.idAlbum); CFileItemPtr pItem(new CFileItem(strDir, album)); items.Add(pItem); } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.h index feacd022ea..9c58882ff8 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeAlbumTop100 : public CDirectoryNode { public: - CDirectoryNodeAlbumTop100(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumTop100(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.cpp index a932d96d50..a27599b068 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.cpp @@ -23,7 +23,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeAlbumTop100Song::CDirectoryNodeAlbumTop100Song(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeAlbumTop100Song::CDirectoryNodeAlbumTop100Song(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ALBUM_TOP100_SONGS, strName, pParent) { @@ -35,7 +35,7 @@ bool CDirectoryNodeAlbumTop100Song::GetContent(CFileItemList& items) const if (!musicdatabase.Open()) return false; - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetTop100AlbumSongs(strBaseDir, items); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.h index ef5dddbdf3..08e7342510 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeAlbumTop100Song.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeAlbumTop100Song : public CDirectoryNode { public: - CDirectoryNodeAlbumTop100Song(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeAlbumTop100Song(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp index ddd8ca863a..66917c36a8 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.cpp @@ -25,7 +25,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeArtist::CDirectoryNodeArtist(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeArtist::CDirectoryNodeArtist(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ARTIST, strName, pParent) { @@ -36,7 +36,7 @@ NODE_TYPE CDirectoryNodeArtist::GetChildType() const return NODE_TYPE_ALBUM; } -CStdString CDirectoryNodeArtist::GetLocalizedName() const +std::string CDirectoryNodeArtist::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15103); // All Artists diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.h index f66e0ddc00..930c3d0f12 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeArtist.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeArtist : public CDirectoryNode { public: - CDirectoryNodeArtist(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeArtist(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.cpp index 5bf7089bbb..f985333c12 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeGrouped::CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeGrouped::CDirectoryNodeGrouped(NODE_TYPE type, const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(type, strName, pParent) { } @@ -36,7 +36,7 @@ NODE_TYPE CDirectoryNodeGrouped::GetChildType() const return NODE_TYPE_ARTIST; } -CStdString CDirectoryNodeGrouped::GetLocalizedName() const +std::string CDirectoryNodeGrouped::GetLocalizedName() const { CMusicDatabase db; if (db.Open()) diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.h index 279777d916..c35960b3e2 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeGrouped.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeGrouped : public CDirectoryNode { public: - CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeGrouped(NODE_TYPE type, const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; private: std::string GetContentType() const; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp index 600f6d9dae..020513506e 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.cpp @@ -46,7 +46,7 @@ namespace XFILE using namespace std; using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeOverview::CDirectoryNodeOverview(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_OVERVIEW, strName, pParent) { @@ -55,15 +55,15 @@ CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirec NODE_TYPE CDirectoryNodeOverview::GetChildType() const { for (unsigned int i = 0; i < sizeof(OverviewChildren) / sizeof(Node); ++i) - if (GetName().Equals(OverviewChildren[i].id.c_str())) + if (GetName() == OverviewChildren[i].id) return OverviewChildren[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeOverview::GetLocalizedName() const +std::string CDirectoryNodeOverview::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(OverviewChildren) / sizeof(Node); ++i) - if (GetName().Equals(OverviewChildren[i].id.c_str())) + if (GetName() == OverviewChildren[i].id) return g_localizeStrings.Get(OverviewChildren[i].label); return ""; } @@ -87,7 +87,7 @@ bool CDirectoryNodeOverview::GetContent(CFileItemList& items) const continue; CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(OverviewChildren[i].label))); - CStdString strDir = StringUtils::Format("%s/", OverviewChildren[i].id.c_str()); + std::string strDir = StringUtils::Format("%s/", OverviewChildren[i].id.c_str()); pItem->SetPath(BuildPath() + strDir); pItem->m_bIsFolder = true; pItem->SetCanQueue(false); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.h index bd3d1f453b..c00decff62 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeOverview.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeOverview : public CDirectoryNode { public: - CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeOverview(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.cpp index 091a080199..938a47ccae 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.cpp @@ -22,7 +22,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeRoot::CDirectoryNodeRoot(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeRoot::CDirectoryNodeRoot(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ROOT, strName, pParent) { diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.h index ecf8b49aa4..627fa4f5a5 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeRoot.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeRoot : public CDirectoryNode { public: - CDirectoryNodeRoot(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeRoot(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.cpp index ce79c852c7..6900350168 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeSingles::CDirectoryNodeSingles(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeSingles::CDirectoryNodeSingles(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_SINGLES, strName, pParent) { diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.h index ecde5de8ea..d3298dff79 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSingles.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeSingles : public CDirectoryNode { public: - CDirectoryNodeSingles(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeSingles(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.cpp index 6a79e68758..124aab7802 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeSong::CDirectoryNodeSong(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeSong::CDirectoryNodeSong(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_SONG, strName, pParent) { @@ -39,7 +39,7 @@ bool CDirectoryNodeSong::GetContent(CFileItemList& items) const CQueryParams params; CollectQueryParams(params); - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetSongsNav(strBaseDir, items, params.GetGenreId(), params.GetArtistId(), params.GetAlbumId()); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.h index 321efd8b5d..c017f344a9 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSong.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeSong : public CDirectoryNode { public: - CDirectoryNodeSong(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeSong(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.cpp index 117923468d..24a35800c7 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.cpp @@ -23,7 +23,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeSongTop100::CDirectoryNodeSongTop100(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeSongTop100::CDirectoryNodeSongTop100(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_SONG_TOP100, strName, pParent) { @@ -35,7 +35,7 @@ bool CDirectoryNodeSongTop100::GetContent(CFileItemList& items) const if (!musicdatabase.Open()) return false; - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetTop100(strBaseDir, items); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.h index 0f00e5743d..76630c2d94 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeSongTop100.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeSongTop100 : public CDirectoryNode { public: - CDirectoryNodeSongTop100(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeSongTop100(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp index 0499832f4c..f8e1d3de0a 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.cpp @@ -31,7 +31,7 @@ Node Top100Children[] = { { NODE_TYPE_ALBUM_TOP100, "albums", 10505 }, }; -CDirectoryNodeTop100::CDirectoryNodeTop100(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeTop100::CDirectoryNodeTop100(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_TOP100, strName, pParent) { @@ -40,16 +40,16 @@ CDirectoryNodeTop100::CDirectoryNodeTop100(const CStdString& strName, CDirectory NODE_TYPE CDirectoryNodeTop100::GetChildType() const { for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i) - if (GetName().Equals(Top100Children[i].id.c_str())) + if (GetName() == Top100Children[i].id) return Top100Children[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeTop100::GetLocalizedName() const +std::string CDirectoryNodeTop100::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i) - if (GetName().Equals(Top100Children[i].id.c_str())) + if (GetName() == Top100Children[i].id) return g_localizeStrings.Get(Top100Children[i].label); return ""; } @@ -59,7 +59,7 @@ bool CDirectoryNodeTop100::GetContent(CFileItemList& items) const for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i) { CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(Top100Children[i].label))); - CStdString strDir = StringUtils::Format("%s/", Top100Children[i].id.c_str()); + std::string strDir = StringUtils::Format("%s/", Top100Children[i].id.c_str()); pItem->SetPath(BuildPath() + strDir); pItem->m_bIsFolder = true; items.Add(pItem); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.h index addda36b2a..d734d9bfe1 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeTop100.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeTop100 : public CDirectoryNode { public: - CDirectoryNodeTop100(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeTop100(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.cpp index 1c28081b35..bc8eb77e8a 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeYearAlbum::CDirectoryNodeYearAlbum(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeYearAlbum::CDirectoryNodeYearAlbum(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_YEAR_ALBUM, strName, pParent) { @@ -38,7 +38,7 @@ NODE_TYPE CDirectoryNodeYearAlbum::GetChildType() const return NODE_TYPE_SONG; } -CStdString CDirectoryNodeYearAlbum::GetLocalizedName() const +std::string CDirectoryNodeYearAlbum::GetLocalizedName() const { if (GetID() == -1) return g_localizeStrings.Get(15102); // All Albums diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.h index c001ce836c..b41d25763b 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearAlbum.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeYearAlbum : public CDirectoryNode { public: - CDirectoryNodeYearAlbum(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeYearAlbum(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.cpp index 405c69c703..d506fa95dc 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.cpp @@ -24,7 +24,7 @@ using namespace XFILE::MUSICDATABASEDIRECTORY; -CDirectoryNodeYearSong::CDirectoryNodeYearSong(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeYearSong::CDirectoryNodeYearSong(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_YEAR_SONG, strName, pParent) { @@ -39,7 +39,7 @@ bool CDirectoryNodeYearSong::GetContent(CFileItemList& items) const CQueryParams params; CollectQueryParams(params); - CStdString strBaseDir=BuildPath(); + std::string strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetSongsByYear(strBaseDir, items, params.GetYear()); musicdatabase.Close(); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.h b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.h index 49bb69f0d2..0e32fe9602 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYearSong.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeYearSong : public CDirectoryNode { public: - CDirectoryNodeYearSong(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeYearSong(const std::string& strName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.cpp b/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.cpp index 790fe73eee..36b73e76ab 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.cpp @@ -19,6 +19,7 @@ */ #include "QueryParams.h" +#include <stdlib.h> using namespace XFILE::MUSICDATABASEDIRECTORY; @@ -31,7 +32,7 @@ CQueryParams::CQueryParams() m_year=-1; } -void CQueryParams::SetQueryParam(NODE_TYPE NodeType, const CStdString& strNodeName) +void CQueryParams::SetQueryParam(NODE_TYPE NodeType, const std::string& strNodeName) { long idDb=atol(strNodeName.c_str()); diff --git a/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.h b/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.h index 1899f309cb..571ee74965 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.h +++ b/xbmc/filesystem/MusicDatabaseDirectory/QueryParams.h @@ -36,7 +36,7 @@ namespace XFILE long GetYear() { return m_year; } protected: - void SetQueryParam(NODE_TYPE NodeType, const CStdString& strNodeName); + void SetQueryParam(NODE_TYPE NodeType, const std::string& strNodeName); friend class CDirectoryNode; private: diff --git a/xbmc/filesystem/MusicDatabaseFile.cpp b/xbmc/filesystem/MusicDatabaseFile.cpp index 5dc9105c3c..20fdf666e7 100644 --- a/xbmc/filesystem/MusicDatabaseFile.cpp +++ b/xbmc/filesystem/MusicDatabaseFile.cpp @@ -37,14 +37,14 @@ CMusicDatabaseFile::~CMusicDatabaseFile(void) Close(); } -CStdString CMusicDatabaseFile::TranslateUrl(const CURL& url) +std::string CMusicDatabaseFile::TranslateUrl(const CURL& url) { CMusicDatabase musicDatabase; if (!musicDatabase.Open()) return ""; - CStdString strFileName=URIUtils::GetFileName(url.Get()); - CStdString strExtension = URIUtils::GetExtension(strFileName); + std::string strFileName=URIUtils::GetFileName(url.Get()); + std::string strExtension = URIUtils::GetExtension(strFileName); URIUtils::RemoveExtension(strFileName); if (!StringUtils::IsNaturalNumber(strFileName)) diff --git a/xbmc/filesystem/MusicDatabaseFile.h b/xbmc/filesystem/MusicDatabaseFile.h index facd24b31f..165a7f21db 100644 --- a/xbmc/filesystem/MusicDatabaseFile.h +++ b/xbmc/filesystem/MusicDatabaseFile.h @@ -39,7 +39,7 @@ public: virtual int64_t GetPosition(); virtual int64_t GetLength(); - static CStdString TranslateUrl(const CURL& url); + static std::string TranslateUrl(const CURL& url); protected: CFile m_file; }; diff --git a/xbmc/filesystem/MusicFileDirectory.cpp b/xbmc/filesystem/MusicFileDirectory.cpp index 03c6d0b300..dd5040c81e 100644 --- a/xbmc/filesystem/MusicFileDirectory.cpp +++ b/xbmc/filesystem/MusicFileDirectory.cpp @@ -38,9 +38,9 @@ CMusicFileDirectory::~CMusicFileDirectory(void) bool CMusicFileDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString strPath=url.Get(); + std::string strPath=url.Get(); - CStdString strFileName; + std::string strFileName; strFileName = URIUtils::GetFileName(strPath); URIUtils::RemoveExtension(strFileName); @@ -50,7 +50,7 @@ bool CMusicFileDirectory::GetDirectory(const CURL& url, CFileItemList &items) for (int i=0; i<iStreams; ++i) { - CStdString strLabel = StringUtils::Format("%s - %s %02.2i", strFileName.c_str(), g_localizeStrings.Get(554).c_str(), i+1); + std::string strLabel = StringUtils::Format("%s - %s %02.2i", strFileName.c_str(), g_localizeStrings.Get(554).c_str(), i+1); CFileItemPtr pItem(new CFileItem(strLabel)); strLabel = StringUtils::Format("%s%s-%i.%s", strPath.c_str(), strFileName.c_str(), i+1, m_strExt.c_str()); pItem->SetPath(strLabel); @@ -72,7 +72,7 @@ bool CMusicFileDirectory::Exists(const CURL& url) bool CMusicFileDirectory::ContainsFiles(const CURL &url) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); if (GetTrackCount(pathToUrl) > 1) return true; diff --git a/xbmc/filesystem/MusicFileDirectory.h b/xbmc/filesystem/MusicFileDirectory.h index f73f66410f..871100a3ba 100644 --- a/xbmc/filesystem/MusicFileDirectory.h +++ b/xbmc/filesystem/MusicFileDirectory.h @@ -35,8 +35,8 @@ namespace XFILE virtual bool ContainsFiles(const CURL& url); virtual bool AllowAll() const { return true; } protected: - virtual int GetTrackCount(const CStdString& strPath) = 0; - CStdString m_strExt; + virtual int GetTrackCount(const std::string& strPath) = 0; + std::string m_strExt; MUSIC_INFO::CMusicInfoTag m_tag; }; } diff --git a/xbmc/filesystem/MusicSearchDirectory.cpp b/xbmc/filesystem/MusicSearchDirectory.cpp index 43234b9968..1619d5a242 100644 --- a/xbmc/filesystem/MusicSearchDirectory.cpp +++ b/xbmc/filesystem/MusicSearchDirectory.cpp @@ -41,7 +41,7 @@ bool CMusicSearchDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // break up our path // format is: musicsearch://<url encoded search string> - CStdString search(url.GetHostName()); + std::string search(url.GetHostName()); if (search.empty()) return false; diff --git a/xbmc/filesystem/MythDirectory.cpp b/xbmc/filesystem/MythDirectory.cpp index 7da053a22f..dbda721a86 100644 --- a/xbmc/filesystem/MythDirectory.cpp +++ b/xbmc/filesystem/MythDirectory.cpp @@ -57,7 +57,7 @@ CMythDirectory::~CMythDirectory() DIR_CACHE_TYPE CMythDirectory::GetCacheType(const CURL& url) const { - CStdString fileName = url.GetFileName(); + std::string fileName = url.GetFileName(); URIUtils::RemoveSlashAtEnd(fileName); /* @@ -91,7 +91,7 @@ void CMythDirectory::Release() m_dll = NULL; } -bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items) +bool CMythDirectory::GetGuide(const std::string& base, CFileItemList &items) { cmyth_database_t db = m_session->GetDatabase(); if (!db) @@ -118,7 +118,7 @@ bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items) } int channum = m_dll->channel_channum(channel); // e.g. 3 - CStdString name = GetValue(m_dll->channel_name(channel)); // e.g. TV3 + std::string name = GetValue(m_dll->channel_name(channel)); // e.g. TV3 if (channum <= 0) { CLog::Log(LOGDEBUG, "%s - Skipping channel number %d as <= 0: %s", __FUNCTION__, channum, name.c_str()); @@ -128,14 +128,14 @@ bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items) CLog::Log(LOGDEBUG, "%s - Adding channel number %d: %s", __FUNCTION__, channum, name.c_str()); - CStdString number = StringUtils::Format("%d", channum); // CStdString easier for string manipulation than int. + std::string number = StringUtils::Format("%d", channum); // std::string easier for string manipulation than int. url.SetFileName("guide/" + number); CFileItemPtr item(new CFileItem(url.Get(), true)); item->m_strTitle = number; if (!name.empty()) item->m_strTitle += " - " + name; // e.g. 3 - TV3 - CStdString icon = GetValue(m_dll->channel_icon(channel)); + std::string icon = GetValue(m_dll->channel_icon(channel)); if (!icon.empty()) { url.SetFileName("files/channels/" + URIUtils::GetFileName(icon)); // e.g. files/channels/tv3.jpg @@ -154,7 +154,7 @@ bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items) return true; } -bool CMythDirectory::GetGuideForChannel(const CStdString& base, CFileItemList &items, int channelNumber) +bool CMythDirectory::GetGuideForChannel(const std::string& base, CFileItemList &items, int channelNumber) { cmyth_database_t database = m_session->GetDatabase(); if (!database) @@ -183,8 +183,8 @@ bool CMythDirectory::GetGuideForChannel(const CStdString& base, CFileItemList &i /* * Set the FileItem meta data. */ - CStdString title = program[i].title; // e.g. Mythbusters - CStdString subtitle = program[i].subtitle; // e.g. The Pirate Special + std::string title = program[i].title; // e.g. Mythbusters + std::string subtitle = program[i].subtitle; // e.g. The Pirate Special CDateTime localstart; if (program[i].starttime) localstart = CTimeUtils::GetLocalTime(program[i].starttime); @@ -233,8 +233,8 @@ bool CMythDirectory::GetGuideForChannel(const CStdString& base, CFileItemList &i return true; } -bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items, enum FilterType type, - const CStdString& filter) +bool CMythDirectory::GetRecordings(const std::string& base, CFileItemList &items, enum FilterType type, + const std::string& filter) { cmyth_proglist_t list = m_session->GetAllRecordedPrograms(); if (!list) @@ -265,8 +265,8 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items, */ url.SetHostName(GetValue(m_dll->proginfo_host(program))); - CStdString path = URIUtils::GetFileName(GetValue(m_dll->proginfo_pathname(program))); - CStdString name = GetValue(m_dll->proginfo_title(program)); + std::string path = URIUtils::GetFileName(GetValue(m_dll->proginfo_pathname(program))); + std::string name = GetValue(m_dll->proginfo_title(program)); switch (type) { @@ -305,7 +305,7 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items, * Adding the production year, if available, to the label for Movies to aid in scraper * lookups. */ - CStdString label(item->m_strTitle); + std::string label(item->m_strTitle); unsigned short year = m_dll->proginfo_year(program); if (year > 0) label += StringUtils::Format(" (%d)", year); @@ -334,7 +334,7 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items, /** * \brief Gets a list of folders for recorded TV shows */ -bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &items) +bool CMythDirectory::GetTvShowFolders(const std::string& base, CFileItemList &items) { cmyth_proglist_t list = m_session->GetAllRecordedPrograms(); if (!list) @@ -361,8 +361,8 @@ bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &ite continue; } - CStdString title = GetValue(m_dll->proginfo_title(program)); - CStdString path = base + "/" + title + "/"; + std::string title = GetValue(m_dll->proginfo_title(program)); + std::string path = base + "/" + title + "/"; /* * Only add each TV show once. If the TV show is already in the list, update the date for the @@ -393,7 +393,7 @@ bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &ite return true; } -bool CMythDirectory::GetChannels(const CStdString& base, CFileItemList &items) +bool CMythDirectory::GetChannels(const std::string& base, CFileItemList &items) { cmyth_conn_t control = m_session->GetControl(); if (!control) @@ -476,10 +476,10 @@ bool CMythDirectory::GetDirectory(const CURL& url, CFileItemList &items) if (!m_dll) return false; - CStdString base(url.Get()); + std::string base(url.Get()); URIUtils::RemoveSlashAtEnd(base); - CStdString fileName = url.GetFileName(); + std::string fileName = url.GetFileName(); URIUtils::RemoveSlashAtEnd(fileName); if (fileName == "") @@ -549,7 +549,7 @@ bool CMythDirectory::Exists(const CURL& url) * existence using GetDirectory() as most methods will return true with empty content due to the * way they are implemented - by iterating over all programs and filtering out content. */ - CStdString fileName = url.GetFileName(); + std::string fileName = url.GetFileName(); URIUtils::RemoveSlashAtEnd(fileName); if (fileName == "" @@ -567,7 +567,7 @@ bool CMythDirectory::Exists(const CURL& url) bool CMythDirectory::IsVisible(const cmyth_proginfo_t program) { - CStdString group = GetValue(m_dll->proginfo_recgroup(program)); + std::string group = GetValue(m_dll->proginfo_recgroup(program)); unsigned long flags = m_dll->proginfo_flags(program); /* @@ -581,7 +581,8 @@ bool CMythDirectory::IsVisible(const cmyth_proginfo_t program) * Recordings that are "pending delete" will have a program flag mask that matches * FL_DELETEPENDING = 0x00000080. */ - return !(group.Equals("LiveTV") || group.Equals("Deleted") || flags & 0x00000080); + return !(StringUtils::EqualsNoCase(group, "LiveTV") || + StringUtils::EqualsNoCase(group, "Deleted") || flags & 0x00000080); } bool CMythDirectory::IsMovie(const cmyth_proginfo_t program) @@ -623,10 +624,10 @@ bool CMythDirectory::IsTvShow(const cmyth_proginfo_t program) return !IsMovie(program); } -bool CMythDirectory::SupportsWriteFileOperations(const CStdString& strPath) +bool CMythDirectory::SupportsWriteFileOperations(const std::string& strPath) { CURL url(strPath); - CStdString filename = url.GetFileName(); + std::string filename = url.GetFileName(); URIUtils::RemoveSlashAtEnd(filename); /* * TV Shows directory has sub-folders so extra check is included so only files get the file @@ -637,7 +638,7 @@ bool CMythDirectory::SupportsWriteFileOperations(const CStdString& strPath) (StringUtils::StartsWith(filename, "tvshows/") && URIUtils::HasExtension(filename)); } -bool CMythDirectory::IsLiveTV(const CStdString& strPath) +bool CMythDirectory::IsLiveTV(const std::string& strPath) { CURL url(strPath); return StringUtils::StartsWith(url.GetFileName(), "channels/"); diff --git a/xbmc/filesystem/MythDirectory.h b/xbmc/filesystem/MythDirectory.h index e38a5cf919..14bd263ad4 100644 --- a/xbmc/filesystem/MythDirectory.h +++ b/xbmc/filesystem/MythDirectory.h @@ -22,7 +22,6 @@ #include "IDirectory.h" #include "MythSession.h" #include "XBDateTime.h" -#include "utils/StdString.h" namespace XFILE { @@ -46,16 +45,16 @@ public: virtual bool AllowAll() const { return true; } virtual DIR_CACHE_TYPE GetCacheType(const CURL& url) const; - static bool SupportsWriteFileOperations(const CStdString& strPath); - static bool IsLiveTV(const CStdString& strPath); + static bool SupportsWriteFileOperations(const std::string& strPath); + static bool IsLiveTV(const std::string& strPath); private: void Release(); - bool GetGuide(const CStdString& base, CFileItemList &items); - bool GetGuideForChannel(const CStdString& base, CFileItemList &items, const int channelNumber); - bool GetRecordings(const CStdString& base, CFileItemList &items, enum FilterType type = ALL, const CStdString& filter = ""); - bool GetTvShowFolders(const CStdString& base, CFileItemList &items); - bool GetChannels(const CStdString& base, CFileItemList &items); + bool GetGuide(const std::string& base, CFileItemList &items); + bool GetGuideForChannel(const std::string& base, CFileItemList &items, const int channelNumber); + bool GetRecordings(const std::string& base, CFileItemList &items, enum FilterType type = ALL, const std::string& filter = ""); + bool GetTvShowFolders(const std::string& base, CFileItemList &items); + bool GetChannels(const std::string& base, CFileItemList &items); std::string GetValue(char* str) { return m_session->GetValue(str); } CDateTime GetValue(cmyth_timestamp_t t) { return m_session->GetValue(t); } diff --git a/xbmc/filesystem/MythFile.cpp b/xbmc/filesystem/MythFile.cpp index a96079ca14..947faf9715 100644 --- a/xbmc/filesystem/MythFile.cpp +++ b/xbmc/filesystem/MythFile.cpp @@ -195,7 +195,7 @@ bool CMythFile::SetupLiveTV(const CURL& url) if(!SetupConnection(url, true, true, true)) return false; - CStdString channel = url.GetFileNameWithoutPath(); + std::string channel = url.GetFileNameWithoutPath(); if(!URIUtils::HasExtension(channel, ".ts")) { CLog::Log(LOGERROR, "%s - invalid channel url %s", __FUNCTION__, channel.c_str()); @@ -300,7 +300,7 @@ bool CMythFile::Open(const CURL& url) { Close(); - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); if (StringUtils::StartsWith(path, "recordings/") || StringUtils::StartsWith(path, "movies/") || @@ -388,7 +388,7 @@ CMythFile::~CMythFile() bool CMythFile::Exists(const CURL& url) { - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); /* * mythbackend provides access to the .mpg or .nuv recordings. The associated thumbnails @@ -420,7 +420,7 @@ bool CMythFile::Exists(const CURL& url) bool CMythFile::Delete(const CURL& url) { - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); if (StringUtils::StartsWith(path, "recordings/") || StringUtils::StartsWith(path, "movies/") || @@ -539,7 +539,7 @@ bool CMythFile::UpdateItem(CFileItem& item) if (!m_program || !m_session) return false; - CStdString title = item.m_strTitle; + std::string title = item.m_strTitle; m_session->SetFileItemMetaData(item, m_program); return title != item.m_strTitle; } @@ -579,7 +579,7 @@ int CMythFile::GetStartTime() return 0; } -bool CMythFile::ChangeChannel(int direction, const CStdString &channel) +bool CMythFile::ChangeChannel(int direction, const std::string &channel) { CLog::Log(LOGDEBUG, "%s - channel change started", __FUNCTION__); diff --git a/xbmc/filesystem/MythFile.h b/xbmc/filesystem/MythFile.h index 9ad2e1a3b6..d5f707477d 100644 --- a/xbmc/filesystem/MythFile.h +++ b/xbmc/filesystem/MythFile.h @@ -52,7 +52,7 @@ public: virtual int Stat(const CURL& url, struct __stat64* buffer) { return -1; } virtual void Close(); virtual unsigned int Read(void* buffer, int64_t size); - virtual CStdString GetContent() { return ""; } + virtual std::string GetContent() { return ""; } virtual bool SkipNext(); virtual bool Delete(const CURL& url); @@ -84,14 +84,14 @@ protected: virtual void OnEvent(int event, const std::string& data); bool HandleEvents(); - bool ChangeChannel(int direction, const CStdString &channel); + bool ChangeChannel(int direction, const std::string &channel); bool SetupConnection(const CURL& url, bool control, bool event, bool database); bool SetupRecording(const CURL& url); bool SetupLiveTV(const CURL& url); bool SetupFile(const CURL& url); - CStdString GetValue(char* str) { return m_session->GetValue(str); } + std::string GetValue(char* str) { return m_session->GetValue(str); } CDateTime GetValue(const cmyth_timestamp_t t) { return m_session->GetValue(t); } CMythSession* m_session; @@ -101,7 +101,7 @@ protected: cmyth_recorder_t m_recorder; cmyth_proginfo_t m_program; cmyth_file_t m_file; - CStdString m_filename; + std::string m_filename; CVideoInfoTag m_infotag; CCriticalSection m_section; diff --git a/xbmc/filesystem/MythSession.cpp b/xbmc/filesystem/MythSession.cpp index 46b3963d1d..19bef8b949 100644 --- a/xbmc/filesystem/MythSession.cpp +++ b/xbmc/filesystem/MythSession.cpp @@ -140,8 +140,8 @@ void CMythSession::SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program /* * Set the FileItem meta-data. */ - CStdString title = GetValue(m_dll->proginfo_title(program)); // e.g. Mythbusters - CStdString subtitle = GetValue(m_dll->proginfo_subtitle(program)); // e.g. The Pirate Special + std::string title = GetValue(m_dll->proginfo_title(program)); // e.g. Mythbusters + std::string subtitle = GetValue(m_dll->proginfo_subtitle(program)); // e.g. The Pirate Special item.m_strTitle = title; if (!subtitle.empty()) item.m_strTitle += " - \"" + subtitle + "\""; // e.g. Mythbusters - "The Pirate Special" @@ -175,7 +175,7 @@ void CMythSession::SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program * Original air date is used by the VideoInfoScanner to scrape the TV Show information into the * Video Library. If the original air date is empty the date returned will be the epoch. */ - CStdString originalairdate = GetValue(m_dll->proginfo_originalairdate(program)).GetAsDBDate(); + std::string originalairdate = GetValue(m_dll->proginfo_originalairdate(program)).GetAsDBDate(); if (originalairdate != "1970-01-01" && originalairdate != "1969-12-31") tag->m_firstAired.SetFromDateString(originalairdate); @@ -187,7 +187,7 @@ void CMythSession::SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program * would cause it to be shown in a different position if it was indeed strictly sorting by * what is displayed in the list). */ - tag->m_strSortTitle = title + " " + (CStdString)item.m_dateTime.GetAsDBDateTime(); // e.g. Mythbusters 2009-12-13 12:23:14 + tag->m_strSortTitle = title + " " + item.m_dateTime.GetAsDBDateTime(); // e.g. Mythbusters 2009-12-13 12:23:14 /* * Set further FileItem and VideoInfoTag meta-data based on whether it is LiveTV or not. @@ -208,7 +208,7 @@ void CMythSession::SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program * to the end so sorting by title will work, and it's not really as important as the title * within the OSD. */ - CStdString name = GetValue(m_dll->proginfo_chansign(program)); + std::string name = GetValue(m_dll->proginfo_chansign(program)); if (!name.empty()) tag->m_strTitle += " - " + name; @@ -231,7 +231,7 @@ void CMythSession::SetFileItemMetaData(CFileItem &item, cmyth_proginfo_t program url.SetFileName("channels/" + number + ".ts"); // e.g. channels/3.ts item.SetPath(url.Get()); } - CStdString chanicon = GetValue(m_dll->proginfo_chanicon(program)); + std::string chanicon = GetValue(m_dll->proginfo_chanicon(program)); if (!chanicon.empty()) { url.SetFileName("files/channels/" + URIUtils::GetFileName(chanicon)); // e.g. files/channels/tv3.jpg @@ -266,8 +266,8 @@ void CMythSession::SetSeasonAndEpisode(const cmyth_proginfo_t &program, int *sea * original air date though, so if we identify a SchedulesDirect programid, leave the season and * episode as 0. */ - CStdString programid = GetValue(m_dll->proginfo_programid(program)); - CStdString seriesid = GetValue(m_dll->proginfo_seriesid(program)); + std::string programid = GetValue(m_dll->proginfo_programid(program)); + std::string seriesid = GetValue(m_dll->proginfo_seriesid(program)); /* * Default the season and episode to 0 so XBMC treats the content as an episode and displays tag @@ -281,7 +281,7 @@ void CMythSession::SetSeasonAndEpisode(const cmyth_proginfo_t &program, int *sea || seriesid.empty()) // Can't figure out the end parsing if the series ID is empty { return; - CStdString category = programid.substr(0, 2); // Valid for both XMLTV and SchedulesDirect sources + std::string category = programid.substr(0, 2); // Valid for both XMLTV and SchedulesDirect sources if (category != "MV" // Movie && category != "EP" // Series && category != "SH" // TV Show @@ -291,7 +291,7 @@ void CMythSession::SetSeasonAndEpisode(const cmyth_proginfo_t &program, int *sea if (programid.substr(category.length(), seriesid.length()) != seriesid) // Series ID does not follow the category return; - CStdString remainder = programid.substr(category.length() + seriesid.length()); // Whatever is after series ID + std::string remainder = programid.substr(category.length() + seriesid.length()); // Whatever is after series ID /* * All SchedulesDirect remainders appear to be 4 characters and start with a 0. If the assumption diff --git a/xbmc/filesystem/NFSDirectory.cpp b/xbmc/filesystem/NFSDirectory.cpp index d5bd79340d..50c9a87dff 100644 --- a/xbmc/filesystem/NFSDirectory.cpp +++ b/xbmc/filesystem/NFSDirectory.cpp @@ -90,10 +90,10 @@ bool CNFSDirectory::GetServerList(CFileItemList &items) for (srv=srvrs; srv; srv = srv->next) { - CStdString currentExport(srv->addr); + std::string currentExport(srv->addr); CFileItemPtr pItem(new CFileItem(currentExport)); - CStdString path("nfs://" + currentExport); + std::string path("nfs://" + currentExport); URIUtils::AddSlashAtEnd(path); pItem->m_dateTime=0; @@ -107,12 +107,12 @@ bool CNFSDirectory::GetServerList(CFileItemList &items) return ret; } -bool CNFSDirectory::ResolveSymlink( const CStdString &dirName, struct nfsdirent *dirent, CURL &resolvedUrl) +bool CNFSDirectory::ResolveSymlink( const std::string &dirName, struct nfsdirent *dirent, CURL &resolvedUrl) { CSingleLock lock(gNfsConnection); int ret = 0; bool retVal = true; - CStdString fullpath = dirName; + std::string fullpath = dirName; char resolvedLink[MAX_PATH]; URIUtils::AddSlashAtEnd(fullpath); @@ -188,7 +188,7 @@ bool CNFSDirectory::GetDirectory(const CURL& url, CFileItemList &items) int ret = 0; FILETIME fileTime, localTime; CSingleLock lock(gNfsConnection); - CStdString strDirName=""; + std::string strDirName=""; std::string myStrPath(url.Get()); URIUtils::AddSlashAtEnd(myStrPath); //be sure the dir ends with a slash @@ -297,7 +297,7 @@ bool CNFSDirectory::Create(const CURL& url2) bool success=true; CSingleLock lock(gNfsConnection); - CStdString folderName(url2.Get()); + std::string folderName(url2.Get()); URIUtils::RemoveSlashAtEnd(folderName);//mkdir fails if a slash is at the end!!! CURL url(folderName); folderName = ""; @@ -318,7 +318,7 @@ bool CNFSDirectory::Remove(const CURL& url2) int ret = 0; CSingleLock lock(gNfsConnection); - CStdString folderName(url2.Get()); + std::string folderName(url2.Get()); URIUtils::RemoveSlashAtEnd(folderName);//rmdir fails if a slash is at the end!!! CURL url(folderName); folderName = ""; @@ -341,7 +341,7 @@ bool CNFSDirectory::Exists(const CURL& url2) int ret = 0; CSingleLock lock(gNfsConnection); - CStdString folderName(url2.Get()); + std::string folderName(url2.Get()); URIUtils::RemoveSlashAtEnd(folderName);//remove slash at end or URIUtils::GetFileName won't return what we want... CURL url(folderName); folderName = ""; diff --git a/xbmc/filesystem/NFSDirectory.h b/xbmc/filesystem/NFSDirectory.h index 4406d76c48..34d312da30 100644 --- a/xbmc/filesystem/NFSDirectory.h +++ b/xbmc/filesystem/NFSDirectory.h @@ -37,7 +37,7 @@ namespace XFILE private: bool GetServerList(CFileItemList &items); bool GetDirectoryFromExportList(const std::string& strPath, CFileItemList &items); - bool ResolveSymlink( const CStdString &dirName, struct nfsdirent *dirent, CURL &resolvedUrl); + bool ResolveSymlink( const std::string &dirName, struct nfsdirent *dirent, CURL &resolvedUrl); }; } diff --git a/xbmc/filesystem/NFSFile.cpp b/xbmc/filesystem/NFSFile.cpp index b904a92832..6a375257c6 100644 --- a/xbmc/filesystem/NFSFile.cpp +++ b/xbmc/filesystem/NFSFile.cpp @@ -88,7 +88,7 @@ std::list<std::string> CNfsConnection::GetExportList(const CURL &url) if(HandleDyLoad()) { struct exportnode *exportlist, *tmp; - exportlist = m_pLibNfs->mount_getexports(m_resolvedHostName); + exportlist = m_pLibNfs->mount_getexports(m_resolvedHostName.c_str()); tmp = exportlist; for(tmp = exportlist; tmp!=NULL; tmp=tmp->ex_next) @@ -144,7 +144,7 @@ void CNfsConnection::destroyOpenContexts() m_openContextMap.clear(); } -void CNfsConnection::destroyContext(const CStdString &exportName) +void CNfsConnection::destroyContext(const std::string &exportName) { CSingleLock lock(openContextLock); tOpenContextMap::iterator it = m_openContextMap.find(exportName.c_str()); @@ -155,7 +155,7 @@ void CNfsConnection::destroyContext(const CStdString &exportName) } } -struct nfs_context *CNfsConnection::getContextFromMap(const CStdString &exportname, bool forceCacheHit/* = false*/) +struct nfs_context *CNfsConnection::getContextFromMap(const std::string &exportname, bool forceCacheHit/* = false*/) { struct nfs_context *pRet = NULL; CSingleLock lock(openContextLock); @@ -187,7 +187,7 @@ struct nfs_context *CNfsConnection::getContextFromMap(const CStdString &exportna return pRet; } -int CNfsConnection::getContextForExport(const CStdString &exportname) +int CNfsConnection::getContextForExport(const std::string &exportname) { int ret = CONTEXT_INVALID; @@ -226,7 +226,7 @@ int CNfsConnection::getContextForExport(const CStdString &exportname) return ret; } -bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath) +bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url, std::string &exportPath, std::string &relativePath) { //refresh exportlist if empty or hostname change if(m_exportList.empty() || !StringUtils::EqualsNoCase(url.GetHostName(), m_hostName)) @@ -237,7 +237,7 @@ bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url, CStdString &expo return splitUrlIntoExportAndPath(url, exportPath, relativePath, m_exportList); } -bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,CStdString &exportPath, CStdString &relativePath, std::list<std::string> &exportList) +bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,std::string &exportPath, std::string &relativePath, std::list<std::string> &exportList) { bool ret = false; @@ -246,7 +246,7 @@ bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,CStdString &expor relativePath = ""; exportPath = ""; - CStdString path = url.GetFileName(); + std::string path = url.GetFileName(); //GetFileName returns path without leading "/" //but we need it because the export paths start with "/" @@ -288,21 +288,21 @@ bool CNfsConnection::splitUrlIntoExportAndPath(const CURL& url,CStdString &expor return ret; } -bool CNfsConnection::Connect(const CURL& url, CStdString &relativePath) +bool CNfsConnection::Connect(const CURL& url, std::string &relativePath) { CSingleLock lock(*this); bool ret = false; int nfsRet = 0; - CStdString exportPath = ""; + std::string exportPath; resolveHost(url); ret = splitUrlIntoExportAndPath(url, exportPath, relativePath); - if( (ret && (!exportPath.Equals(m_exportPath,true) || + if( (ret && (exportPath != m_exportPath || url.GetHostName() != m_hostName)) || (XbmcThreads::SystemClockMillis() - m_lastAccessedTime) > CONTEXT_TIMEOUT ) { - int contextRet = getContextForExport((CStdString)url.GetHostName() + exportPath); + int contextRet = getContextForExport(url.GetHostName() + exportPath); if(contextRet == CONTEXT_INVALID)//we need a new context because sharename or hostname has changed { @@ -318,7 +318,7 @@ bool CNfsConnection::Connect(const CURL& url, CStdString &relativePath) if(nfsRet != 0) { CLog::Log(LOGERROR,"NFS: Failed to mount nfs share: %s (%s)\n", exportPath.c_str(), m_pLibNfs->nfs_get_error(m_pNfsContext)); - destroyContext((CStdString)url.GetHostName() + exportPath); + destroyContext(url.GetHostName() + exportPath); return false; } CLog::Log(LOGDEBUG,"NFS: Connected to server %s and export %s\n", url.GetHostName().c_str(), exportPath.c_str()); @@ -435,8 +435,8 @@ int CNfsConnection::stat(const CURL &url, NFSSTAT *statbuff) { CSingleLock lock(*this); int nfsRet = 0; - CStdString exportPath; - CStdString relativePath; + std::string exportPath; + std::string relativePath; struct nfs_context *pTmpContext = NULL; if(!HandleDyLoad()) @@ -540,7 +540,7 @@ bool CNFSFile::Open(const CURL& url) return false; } - CStdString filename = ""; + std::string filename; CSingleLock lock(gNfsConnection); @@ -593,7 +593,7 @@ int CNFSFile::Stat(const CURL& url, struct __stat64* buffer) { int ret = 0; CSingleLock lock(gNfsConnection); - CStdString filename = ""; + std::string filename; if(!gNfsConnection.Connect(url,filename)) return -1; @@ -763,7 +763,7 @@ bool CNFSFile::Delete(const CURL& url) { int ret = 0; CSingleLock lock(gNfsConnection); - CStdString filename = ""; + std::string filename; if(!gNfsConnection.Connect(url, filename)) return false; @@ -782,13 +782,13 @@ bool CNFSFile::Rename(const CURL& url, const CURL& urlnew) { int ret = 0; CSingleLock lock(gNfsConnection); - CStdString strFile = ""; + std::string strFile; if(!gNfsConnection.Connect(url,strFile)) return false; - CStdString strFileNew; - CStdString strDummy; + std::string strFileNew; + std::string strDummy; gNfsConnection.splitUrlIntoExportAndPath(urlnew, strDummy, strFileNew); ret = gNfsConnection.GetImpl()->nfs_rename(gNfsConnection.GetNfsContext() , strFile.c_str(), strFileNew.c_str()); @@ -809,7 +809,7 @@ bool CNFSFile::OpenForWrite(const CURL& url, bool bOverWrite) Close(); CSingleLock lock(gNfsConnection); - CStdString filename = ""; + std::string filename; if(!gNfsConnection.Connect(url,filename)) return false; @@ -864,7 +864,7 @@ bool CNFSFile::OpenForWrite(const CURL& url, bool bOverWrite) return true; } -bool CNFSFile::IsValidFile(const CStdString& strFileName) +bool CNFSFile::IsValidFile(const std::string& strFileName) { if (strFileName.find('/') == std::string::npos || /* doesn't have sharename */ StringUtils::EndsWith(strFileName, "/.") || /* not current folder */ diff --git a/xbmc/filesystem/NFSFile.h b/xbmc/filesystem/NFSFile.h index 35f358a37a..279248e950 100644 --- a/xbmc/filesystem/NFSFile.h +++ b/xbmc/filesystem/NFSFile.h @@ -68,7 +68,7 @@ public: CNfsConnection(); ~CNfsConnection(); - bool Connect(const CURL &url, CStdString &relativePath); + bool Connect(const CURL &url, std::string &relativePath); struct nfs_context *GetNfsContext(){return m_pNfsContext;} uint64_t GetMaxReadChunkSize(){return m_readChunkSize;} uint64_t GetMaxWriteChunkSize(){return m_writeChunkSize;} @@ -76,8 +76,8 @@ public: std::list<std::string> GetExportList(const CURL &url); //this functions splits the url into the exportpath (feed to mount) and the rest of the path //relative to the mounted export - bool splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath, std::list<std::string> &exportList); - bool splitUrlIntoExportAndPath(const CURL& url, CStdString &exportPath, CStdString &relativePath); + bool splitUrlIntoExportAndPath(const CURL& url, std::string &exportPath, std::string &relativePath, std::list<std::string> &exportList); + bool splitUrlIntoExportAndPath(const CURL& url, std::string &exportPath, std::string &relativePath); //special stat which uses its own context //needed for getting intervolume symlinks to work @@ -94,15 +94,15 @@ public: //removes file handle from keep alive list void removeFromKeepAliveList(struct nfsfh *_pFileHandle); - const CStdString& GetConnectedIp() const {return m_resolvedHostName;} - const CStdString& GetConnectedExport() const {return m_exportPath;} - const CStdString GetContextMapId() const {return m_hostName + m_exportPath;} + const std::string& GetConnectedIp() const {return m_resolvedHostName;} + const std::string& GetConnectedExport() const {return m_exportPath;} + const std::string GetContextMapId() const {return m_hostName + m_exportPath;} private: struct nfs_context *m_pNfsContext;//current nfs context - CStdString m_exportPath;//current connected export path - CStdString m_hostName;//current connected host - CStdString m_resolvedHostName;//current connected host - as ip + std::string m_exportPath;//current connected export path + std::string m_hostName;//current connected host + std::string m_resolvedHostName;//current connected host - as ip uint64_t m_readChunkSize;//current read chunksize of connected server uint64_t m_writeChunkSize;//current write chunksize of connected server int m_OpenConnections;//number of open connections @@ -116,10 +116,10 @@ private: CCriticalSection openContextLock; void clearMembers(); - struct nfs_context *getContextFromMap(const CStdString &exportname, bool forceCacheHit = false); - int getContextForExport(const CStdString &exportname);//get context for given export and add to open contexts map - sets m_pNfsContext (my return a already mounted cached context) + struct nfs_context *getContextFromMap(const std::string &exportname, bool forceCacheHit = false); + int getContextForExport(const std::string &exportname);//get context for given export and add to open contexts map - sets m_pNfsContext (my return a already mounted cached context) void destroyOpenContexts(); - void destroyContext(const CStdString &exportName); + void destroyContext(const std::string &exportName); void resolveHost(const CURL &url);//resolve hostname by dnslookup void keepAlive(std::string _exportPath, struct nfsfh *_pFileHandle); }; @@ -155,7 +155,7 @@ namespace XFILE virtual bool Rename(const CURL& url, const CURL& urlnew); protected: CURL m_url; - bool IsValidFile(const CStdString& strFileName); + bool IsValidFile(const std::string& strFileName); int64_t m_fileSize; struct nfsfh *m_pFileHandle; struct nfs_context *m_pNfsContext;//current nfs context diff --git a/xbmc/filesystem/NSFFileDirectory.cpp b/xbmc/filesystem/NSFFileDirectory.cpp index 43b60aee4d..b1dd4d7576 100644 --- a/xbmc/filesystem/NSFFileDirectory.cpp +++ b/xbmc/filesystem/NSFFileDirectory.cpp @@ -34,7 +34,7 @@ CNSFFileDirectory::~CNSFFileDirectory(void) { } -int CNSFFileDirectory::GetTrackCount(const CStdString& strPath) +int CNSFFileDirectory::GetTrackCount(const std::string& strPath) { CMusicInfoTagLoaderNSF nsf; nsf.Load(strPath,m_tag); diff --git a/xbmc/filesystem/NSFFileDirectory.h b/xbmc/filesystem/NSFFileDirectory.h index 85dc3a25a4..1015651528 100644 --- a/xbmc/filesystem/NSFFileDirectory.h +++ b/xbmc/filesystem/NSFFileDirectory.h @@ -29,7 +29,7 @@ namespace XFILE CNSFFileDirectory(void); virtual ~CNSFFileDirectory(void); protected: - virtual int GetTrackCount(const CStdString& strPath); + virtual int GetTrackCount(const std::string& strPath); }; } diff --git a/xbmc/filesystem/OGGFileDirectory.cpp b/xbmc/filesystem/OGGFileDirectory.cpp index c840781b82..b791e431ca 100644 --- a/xbmc/filesystem/OGGFileDirectory.cpp +++ b/xbmc/filesystem/OGGFileDirectory.cpp @@ -34,7 +34,7 @@ COGGFileDirectory::~COGGFileDirectory(void) { } -int COGGFileDirectory::GetTrackCount(const CStdString& strPath) +int COGGFileDirectory::GetTrackCount(const std::string& strPath) { if (!m_dll.Load()) return 0; diff --git a/xbmc/filesystem/OGGFileDirectory.h b/xbmc/filesystem/OGGFileDirectory.h index bfe34b0183..275bc38a77 100644 --- a/xbmc/filesystem/OGGFileDirectory.h +++ b/xbmc/filesystem/OGGFileDirectory.h @@ -31,7 +31,7 @@ namespace XFILE COGGFileDirectory(void); virtual ~COGGFileDirectory(void); protected: - virtual int GetTrackCount(const CStdString& strPath); + virtual int GetTrackCount(const std::string& strPath); private: DllVorbisfile m_dll; }; diff --git a/xbmc/filesystem/PVRDirectory.cpp b/xbmc/filesystem/PVRDirectory.cpp index 4894d080be..e6b10785c6 100644 --- a/xbmc/filesystem/PVRDirectory.cpp +++ b/xbmc/filesystem/PVRDirectory.cpp @@ -51,10 +51,10 @@ bool CPVRDirectory::Exists(const CURL& url) bool CPVRDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString base(url.Get()); + std::string base(url.Get()); URIUtils::RemoveSlashAtEnd(base); - CStdString fileName = url.GetFileName(); + std::string fileName = url.GetFileName(); URIUtils::RemoveSlashAtEnd(fileName); CLog::Log(LOGDEBUG, "CPVRDirectory::GetDirectory(%s)", base.c_str()); items.SetCacheToDisc(CFileItemList::CACHE_NEVER); @@ -93,35 +93,35 @@ bool CPVRDirectory::GetDirectory(const CURL& url, CFileItemList &items) } else if (StringUtils::StartsWith(fileName, "recordings")) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); return g_PVRRecordings->GetDirectory(pathToUrl, items); } else if (StringUtils::StartsWith(fileName, "channels")) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); return g_PVRChannelGroups->GetDirectory(pathToUrl, items); } else if (StringUtils::StartsWith(fileName, "timers")) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); return g_PVRTimers->GetDirectory(pathToUrl, items); } return false; } -bool CPVRDirectory::SupportsWriteFileOperations(const CStdString& strPath) +bool CPVRDirectory::SupportsWriteFileOperations(const std::string& strPath) { CURL url(strPath); - CStdString filename = url.GetFileName(); + std::string filename = url.GetFileName(); return URIUtils::IsPVRRecording(filename); } -bool CPVRDirectory::IsLiveTV(const CStdString& strPath) +bool CPVRDirectory::IsLiveTV(const std::string& strPath) { CURL url(strPath); - CStdString filename = url.GetFileName(); + std::string filename = url.GetFileName(); return URIUtils::IsLiveTV(filename); } diff --git a/xbmc/filesystem/PVRDirectory.h b/xbmc/filesystem/PVRDirectory.h index 138caecf52..5df52899a7 100644 --- a/xbmc/filesystem/PVRDirectory.h +++ b/xbmc/filesystem/PVRDirectory.h @@ -20,7 +20,6 @@ */ #include "IDirectory.h" -#include "utils/StdString.h" class CPVRSession; @@ -36,8 +35,8 @@ public: virtual bool GetDirectory(const CURL& url, CFileItemList &items); virtual bool AllowAll() const { return true; } - static bool SupportsWriteFileOperations(const CStdString& strPath); - static bool IsLiveTV(const CStdString& strPath); + static bool SupportsWriteFileOperations(const std::string& strPath); + static bool IsLiveTV(const std::string& strPath); static bool HasRecordings(); virtual bool Exists(const CURL& url); diff --git a/xbmc/filesystem/PVRFile.cpp b/xbmc/filesystem/PVRFile.cpp index 4fe1a1d368..b9af336fc1 100644 --- a/xbmc/filesystem/PVRFile.cpp +++ b/xbmc/filesystem/PVRFile.cpp @@ -50,7 +50,7 @@ bool CPVRFile::Open(const CURL& url) if (!g_PVRManager.IsStarted()) return false; - CStdString strURL = url.Get(); + std::string strURL = url.Get(); if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") || StringUtils::StartsWith(strURL, "pvr://channels/radio/")) @@ -209,18 +209,18 @@ bool CPVRFile::UpdateItem(CFileItem& item) return g_PVRManager.UpdateItem(item); } -CStdString CPVRFile::TranslatePVRFilename(const CStdString& pathFile) +std::string CPVRFile::TranslatePVRFilename(const std::string& pathFile) { if (!g_PVRManager.IsStarted()) - return StringUtils::EmptyString; + return ""; - CStdString FileName = pathFile; + std::string FileName = pathFile; if (FileName.substr(0, 14) == "pvr://channels") { CFileItemPtr channel = g_PVRChannelGroups->GetByPath(FileName); if (channel && channel->HasPVRChannelInfoTag()) { - CStdString stream = channel->GetPVRChannelInfoTag()->StreamURL(); + std::string stream = channel->GetPVRChannelInfoTag()->StreamURL(); if(!stream.empty()) { if (stream.compare(6, 7, "stream/") == 0) @@ -264,10 +264,10 @@ bool CPVRFile::Delete(const CURL& url) if (!g_PVRManager.IsStarted()) return false; - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/') { - CStdString strURL = url.Get(); + std::string strURL = url.Get(); CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL); if (tag && tag->HasPVRRecordingInfoTag()) return tag->GetPVRRecordingInfoTag()->Delete(); @@ -280,16 +280,16 @@ bool CPVRFile::Rename(const CURL& url, const CURL& urlnew) if (!g_PVRManager.IsStarted()) return false; - CStdString path(url.GetFileName()); - CStdString newname(urlnew.GetFileName()); + std::string path(url.GetFileName()); + std::string newname(urlnew.GetFileName()); size_t found = newname.find_last_of("/"); - if (found != CStdString::npos) + if (found != std::string::npos) newname = newname.substr(found+1); if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/') { - CStdString strURL = url.Get(); + std::string strURL = url.Get(); CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL); if (tag && tag->HasPVRRecordingInfoTag()) return tag->GetPVRRecordingInfoTag()->Rename(newname); diff --git a/xbmc/filesystem/PVRFile.h b/xbmc/filesystem/PVRFile.h index 4e564d62bc..6cba5e34c3 100644 --- a/xbmc/filesystem/PVRFile.h +++ b/xbmc/filesystem/PVRFile.h @@ -43,7 +43,7 @@ public: virtual int Stat(const CURL& url, struct __stat64* buffer) { return -1; } virtual void Close(); virtual unsigned int Read(void* buffer, int64_t size); - virtual CStdString GetContent() { return ""; } + virtual std::string GetContent() { return ""; } virtual bool SkipNext() { return !m_isPlayRecording; } virtual bool Delete(const CURL& url); @@ -68,7 +68,7 @@ public: virtual int IoControl(EIoControl request, void *param); - static CStdString TranslatePVRFilename(const CStdString& pathFile); + static std::string TranslatePVRFilename(const std::string& pathFile); protected: bool m_isPlayRecording; diff --git a/xbmc/filesystem/PipeFile.cpp b/xbmc/filesystem/PipeFile.cpp index 1dab1f38c8..69c31de403 100644 --- a/xbmc/filesystem/PipeFile.cpp +++ b/xbmc/filesystem/PipeFile.cpp @@ -52,7 +52,7 @@ void CPipeFile::SetLength(int64_t len) bool CPipeFile::Open(const CURL& url) { - CStdString name = url.Get(); + std::string name = url.Get(); m_pipe = PipesManager::GetInstance().OpenPipe(name); if (m_pipe) m_pipe->AddListener(this); @@ -61,7 +61,7 @@ bool CPipeFile::Open(const CURL& url) bool CPipeFile::Exists(const CURL& url) { - CStdString name = url.Get(); + std::string name = url.Get(); return PipesManager::GetInstance().Exists(name); } @@ -143,7 +143,7 @@ void CPipeFile::Flush() bool CPipeFile::OpenForWrite(const CURL& url, bool bOverWrite) { - CStdString name = url.Get(); + std::string name = url.Get(); m_pipe = PipesManager::GetInstance().CreatePipe(name); if (m_pipe) @@ -166,10 +166,10 @@ int CPipeFile::IoControl(int request, void* param) return -1; } -CStdString CPipeFile::GetName() const +std::string CPipeFile::GetName() const { if (!m_pipe) - return StringUtils::EmptyString; + return ""; return m_pipe->GetName(); } diff --git a/xbmc/filesystem/PipeFile.h b/xbmc/filesystem/PipeFile.h index e95934e184..540a646312 100644 --- a/xbmc/filesystem/PipeFile.h +++ b/xbmc/filesystem/PipeFile.h @@ -30,8 +30,6 @@ #pragma once #include "IFile.h" -#include "utils/AutoPtrHandle.h" -#include "utils/StdString.h" #include "threads/Event.h" #include "threads/CriticalSection.h" #include "utils/RingBuffer.h" @@ -65,7 +63,7 @@ public: virtual bool Rename(const CURL& url, const CURL& urlnew); virtual int IoControl(int request, void* param); - CStdString GetName() const; + std::string GetName() const; virtual void OnPipeOverFlow(); virtual void OnPipeUnderFlow(); diff --git a/xbmc/filesystem/PipesManager.cpp b/xbmc/filesystem/PipesManager.cpp index d17fac6b82..7389abf2be 100644 --- a/xbmc/filesystem/PipesManager.cpp +++ b/xbmc/filesystem/PipesManager.cpp @@ -29,7 +29,7 @@ using namespace XFILE; -Pipe::Pipe(const CStdString &name, int nMaxSize) +Pipe::Pipe(const std::string &name, int nMaxSize) { m_buffer.Create(nMaxSize); m_nRefCount = 1; @@ -51,7 +51,7 @@ void Pipe::SetOpenThreashold(int threashold) m_nOpenThreashold = threashold; } -const CStdString &Pipe::GetName() +const std::string &Pipe::GetName() { return m_strPipeName; } @@ -281,15 +281,15 @@ PipesManager &PipesManager::GetInstance() return instance; } -CStdString PipesManager::GetUniquePipeName() +std::string PipesManager::GetUniquePipeName() { CSingleLock lock(m_lock); return StringUtils::Format("pipe://%d/", m_nGenIdHelper++); } -XFILE::Pipe *PipesManager::CreatePipe(const CStdString &name, int nMaxPipeSize) +XFILE::Pipe *PipesManager::CreatePipe(const std::string &name, int nMaxPipeSize) { - CStdString pName = name; + std::string pName = name; if (pName.empty()) pName = GetUniquePipeName(); @@ -302,7 +302,7 @@ XFILE::Pipe *PipesManager::CreatePipe(const CStdString &name, int nMaxPipeSize) return p; } -XFILE::Pipe *PipesManager::OpenPipe(const CStdString &name) +XFILE::Pipe *PipesManager::OpenPipe(const std::string &name) { CSingleLock lock(m_lock); if (m_pipes.find(name) == m_pipes.end()) @@ -326,7 +326,7 @@ void PipesManager::ClosePipe(XFILE::Pipe *pipe) } } -bool PipesManager::Exists(const CStdString &name) +bool PipesManager::Exists(const std::string &name) { CSingleLock lock(m_lock); return (m_pipes.find(name) != m_pipes.end()); diff --git a/xbmc/filesystem/PipesManager.h b/xbmc/filesystem/PipesManager.h index 1f6d2e7195..22a7bfaeb8 100644 --- a/xbmc/filesystem/PipesManager.h +++ b/xbmc/filesystem/PipesManager.h @@ -26,10 +26,11 @@ #include "threads/CriticalSection.h" #include "threads/Event.h" -#include "utils/StdString.h" #include "utils/RingBuffer.h" #include <map> +#include <string> +#include <vector> #define PIPE_DEFAULT_MAX_SIZE (6 * 1024 * 1024) @@ -47,9 +48,9 @@ public: class Pipe { public: - Pipe(const CStdString &name, int nMaxSize = PIPE_DEFAULT_MAX_SIZE ); + Pipe(const std::string &name, int nMaxSize = PIPE_DEFAULT_MAX_SIZE ); virtual ~Pipe(); - const CStdString &GetName(); + const std::string &GetName(); void AddRef(); void DecRef(); // a pipe does NOT delete itself with ref-count 0. @@ -96,7 +97,7 @@ class Pipe bool m_bEof; CRingBuffer m_buffer; - CStdString m_strPipeName; + std::string m_strPipeName; int m_nRefCount; int m_nOpenThreashold; @@ -115,16 +116,16 @@ public: virtual ~PipesManager(); static PipesManager &GetInstance(); - CStdString GetUniquePipeName(); - XFILE::Pipe *CreatePipe(const CStdString &name="", int nMaxPipeSize = PIPE_DEFAULT_MAX_SIZE); - XFILE::Pipe *OpenPipe(const CStdString &name); + std::string GetUniquePipeName(); + XFILE::Pipe *CreatePipe(const std::string &name="", int nMaxPipeSize = PIPE_DEFAULT_MAX_SIZE); + XFILE::Pipe *OpenPipe(const std::string &name); void ClosePipe(XFILE::Pipe *pipe); - bool Exists(const CStdString &name); + bool Exists(const std::string &name); protected: PipesManager(); int m_nGenIdHelper; - std::map<CStdString, XFILE::Pipe *> m_pipes; + std::map<std::string, XFILE::Pipe *> m_pipes; CCriticalSection m_lock; }; diff --git a/xbmc/filesystem/PlaylistFileDirectory.cpp b/xbmc/filesystem/PlaylistFileDirectory.cpp index ddffed5e13..0756edb7c7 100644 --- a/xbmc/filesystem/PlaylistFileDirectory.cpp +++ b/xbmc/filesystem/PlaylistFileDirectory.cpp @@ -40,7 +40,7 @@ namespace XFILE bool CPlaylistFileDirectory::GetDirectory(const CURL& url, CFileItemList& items) { - const CStdString pathToUrl = url.Get(); + const std::string pathToUrl = url.Get(); auto_ptr<CPlayList> pPlayList (CPlayListFactory::Create(pathToUrl)); if ( NULL != pPlayList.get()) { @@ -62,7 +62,7 @@ namespace XFILE bool CPlaylistFileDirectory::ContainsFiles(const CURL& url) { - const CStdString pathToUrl = url.Get(); + const std::string pathToUrl = url.Get(); auto_ptr<CPlayList> pPlayList (CPlayListFactory::Create(pathToUrl)); if ( NULL != pPlayList.get()) { diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp index 9309f1322a..4730f81cd4 100644 --- a/xbmc/filesystem/PluginDirectory.cpp +++ b/xbmc/filesystem/PluginDirectory.cpp @@ -86,7 +86,7 @@ CPluginDirectory *CPluginDirectory::dirFromHandle(int handle) return NULL; } -bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir) +bool CPluginDirectory::StartScript(const std::string& strPath, bool retrievingDir) { CURL url(strPath); @@ -100,13 +100,13 @@ bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir } // get options - CStdString options = url.GetOptions(); + std::string options = url.GetOptions(); URIUtils::RemoveSlashAtEnd(options); // This MAY kill some scripts (eg though with a URL ending with a slash), but // is needed for all others, as XBMC adds slashes to "folders" url.SetOptions(""); // do this because we can then use the url to generate the basepath // which is passed to the plugin (and represents the share) - CStdString basePath(url.Get()); + std::string basePath(url.Get()); // reset our wait event, and grab a new handle m_fetchComplete.Reset(); int handle = getNewHandle(this); @@ -121,7 +121,7 @@ bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir m_totalItems = 0; // setup our parameters to send the script - CStdString strHandle = StringUtils::Format("%i", handle); + std::string strHandle = StringUtils::Format("%i", handle); vector<string> argv; argv.push_back(basePath); argv.push_back(strHandle); @@ -130,11 +130,11 @@ bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir // run the script CLog::Log(LOGDEBUG, "%s - calling plugin %s('%s','%s','%s')", __FUNCTION__, m_addon->Name().c_str(), argv[0].c_str(), argv[1].c_str(), argv[2].c_str()); bool success = false; - CStdString file = m_addon->LibPath(); + std::string file = m_addon->LibPath(); int id = CScriptInvocationManager::Get().Execute(file, m_addon, argv); if (id >= 0) { // wait for our script to finish - CStdString scriptName = m_addon->Name(); + std::string scriptName = m_addon->Name(); success = WaitOnScriptResult(file, id, scriptName, retrievingDir); } else @@ -146,7 +146,7 @@ bool CPluginDirectory::StartScript(const CStdString& strPath, bool retrievingDir return success; } -bool CPluginDirectory::GetPluginResult(const CStdString& strPath, CFileItem &resultItem) +bool CPluginDirectory::GetPluginResult(const std::string& strPath, CFileItem &resultItem) { CURL url(strPath); CPluginDirectory* newDir = new CPluginDirectory(); @@ -217,7 +217,7 @@ void CPluginDirectory::EndOfDirectory(int handle, bool success, bool replaceList dir->m_fetchComplete.Set(); } -void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const CStdString &label2Mask) +void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const std::string &label2Mask) { CSingleLock lock(m_handleLock); CPluginDirectory *dir = dirFromHandle(handle); @@ -347,8 +347,8 @@ void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const C } case SORT_METHOD_PLAYLIST_ORDER: { - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); dir->m_listItems->AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight)); break; @@ -407,7 +407,7 @@ void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const C bool CPluginDirectory::GetDirectory(const CURL& url, CFileItemList& items) { - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); bool success = StartScript(pathToUrl, true); // append the items to the list @@ -416,7 +416,7 @@ bool CPluginDirectory::GetDirectory(const CURL& url, CFileItemList& items) return success; } -bool CPluginDirectory::RunScriptWithParams(const CStdString& strPath) +bool CPluginDirectory::RunScriptWithParams(const std::string& strPath) { CURL url(strPath); if (url.GetHostName().empty()) // called with no script - should never happen @@ -430,16 +430,16 @@ bool CPluginDirectory::RunScriptWithParams(const CStdString& strPath) } // options - CStdString options = url.GetOptions(); + std::string options = url.GetOptions(); URIUtils::RemoveSlashAtEnd(options); // This MAY kill some scripts (eg though with a URL ending with a slash), but // is needed for all others, as XBMC adds slashes to "folders" url.SetOptions(""); // do this because we can then use the url to generate the basepath // which is passed to the plugin (and represents the share) - CStdString basePath(url.Get()); + std::string basePath(url.Get()); // setup our parameters to send the script - CStdString strHandle = StringUtils::Format("%i", -1); + std::string strHandle = StringUtils::Format("%i", -1); vector<string> argv; argv.push_back(basePath); argv.push_back(strHandle); @@ -455,7 +455,7 @@ bool CPluginDirectory::RunScriptWithParams(const CStdString& strPath) return false; } -bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, int scriptId, const CStdString &scriptName, bool retrievingDir) +bool CPluginDirectory::WaitOnScriptResult(const std::string &scriptPath, int scriptId, const std::string &scriptName, bool retrievingDir) { const unsigned int timeBeforeProgressBar = 1500; const unsigned int timeToKillScript = 1000; @@ -560,7 +560,7 @@ void CPluginDirectory::SetResolvedUrl(int handle, bool success, const CFileItem dir->m_fetchComplete.Set(); } -CStdString CPluginDirectory::GetSetting(int handle, const CStdString &strID) +std::string CPluginDirectory::GetSetting(int handle, const std::string &strID) { CSingleLock lock(m_handleLock); CPluginDirectory *dir = dirFromHandle(handle); @@ -570,7 +570,7 @@ CStdString CPluginDirectory::GetSetting(int handle, const CStdString &strID) return ""; } -void CPluginDirectory::SetSetting(int handle, const CStdString &strID, const CStdString &value) +void CPluginDirectory::SetSetting(int handle, const std::string &strID, const std::string &value) { CSingleLock lock(m_handleLock); CPluginDirectory *dir = dirFromHandle(handle); @@ -578,7 +578,7 @@ void CPluginDirectory::SetSetting(int handle, const CStdString &strID, const CSt dir->m_addon->UpdateSetting(strID, value); } -void CPluginDirectory::SetContent(int handle, const CStdString &strContent) +void CPluginDirectory::SetContent(int handle, const std::string &strContent) { CSingleLock lock(m_handleLock); CPluginDirectory *dir = dirFromHandle(handle); @@ -586,7 +586,7 @@ void CPluginDirectory::SetContent(int handle, const CStdString &strContent) dir->m_listItems->SetContent(strContent); } -void CPluginDirectory::SetProperty(int handle, const CStdString &strProperty, const CStdString &strValue) +void CPluginDirectory::SetProperty(int handle, const std::string &strProperty, const std::string &strValue) { CSingleLock lock(m_handleLock); CPluginDirectory *dir = dirFromHandle(handle); diff --git a/xbmc/filesystem/PluginDirectory.h b/xbmc/filesystem/PluginDirectory.h index cc2e58f1e3..60b39adba7 100644 --- a/xbmc/filesystem/PluginDirectory.h +++ b/xbmc/filesystem/PluginDirectory.h @@ -21,7 +21,6 @@ #include "IDirectory.h" #include "Directory.h" -#include "utils/StdString.h" #include "SortFileItem.h" #include <string> @@ -49,25 +48,25 @@ public: virtual bool Exists(const CURL& url) { return true; } virtual float GetProgress() const; virtual void CancelDirectory(); - static bool RunScriptWithParams(const CStdString& strPath); - static bool GetPluginResult(const CStdString& strPath, CFileItem &resultItem); + static bool RunScriptWithParams(const std::string& strPath); + static bool GetPluginResult(const std::string& strPath, CFileItem &resultItem); // callbacks from python static bool AddItem(int handle, const CFileItem *item, int totalItems); static bool AddItems(int handle, const CFileItemList *items, int totalItems); static void EndOfDirectory(int handle, bool success, bool replaceListing, bool cacheToDisc); - static void AddSortMethod(int handle, SORT_METHOD sortMethod, const CStdString &label2Mask); - static CStdString GetSetting(int handle, const CStdString &key); - static void SetSetting(int handle, const CStdString &key, const CStdString &value); - static void SetContent(int handle, const CStdString &strContent); - static void SetProperty(int handle, const CStdString &strProperty, const CStdString &strValue); + static void AddSortMethod(int handle, SORT_METHOD sortMethod, const std::string &label2Mask); + static std::string GetSetting(int handle, const std::string &key); + static void SetSetting(int handle, const std::string &key, const std::string &value); + static void SetContent(int handle, const std::string &strContent); + static void SetProperty(int handle, const std::string &strProperty, const std::string &strValue); static void SetResolvedUrl(int handle, bool success, const CFileItem* resultItem); - static void SetLabel2(int handle, const CStdString& ident); + static void SetLabel2(int handle, const std::string& ident); private: ADDON::AddonPtr m_addon; - bool StartScript(const CStdString& strPath, bool retrievingDir); - bool WaitOnScriptResult(const CStdString &scriptPath, int scriptId, const CStdString &scriptName, bool retrievingDir); + bool StartScript(const std::string& strPath, bool retrievingDir); + bool WaitOnScriptResult(const std::string &scriptPath, int scriptId, const std::string &scriptName, bool retrievingDir); static std::map<int,CPluginDirectory*> globalHandles; static int getNewHandle(CPluginDirectory *cp); diff --git a/xbmc/filesystem/RSSDirectory.cpp b/xbmc/filesystem/RSSDirectory.cpp index 82daf39a06..bd74709161 100644 --- a/xbmc/filesystem/RSSDirectory.cpp +++ b/xbmc/filesystem/RSSDirectory.cpp @@ -52,10 +52,10 @@ namespace { , size(0) {} - CStdString tag; - CStdString path; - CStdString mime; - CStdString lang; + std::string tag; + std::string path; + std::string mime; + std::string lang; int width; int height; int bitrate; @@ -67,7 +67,7 @@ namespace { } -std::map<CStdString,CDateTime> CRSSDirectory::m_cache; +std::map<std::string,CDateTime> CRSSDirectory::m_cache; CCriticalSection CRSSDirectory::m_section; CRSSDirectory::CRSSDirectory() @@ -87,7 +87,7 @@ bool CRSSDirectory::ContainsFiles(const CURL& url) return items.Size() > 0; } -static bool IsPathToMedia(const CStdString& strPath ) +static bool IsPathToMedia(const std::string& strPath ) { return URIUtils::HasExtension(strPath, g_advancedSettings.m_videoExtensions + '|' + @@ -95,7 +95,7 @@ static bool IsPathToMedia(const CStdString& strPath ) g_advancedSettings.m_pictureExtensions); } -static bool IsPathToThumbnail(const CStdString& strPath ) +static bool IsPathToThumbnail(const std::string& strPath ) { // Currently just check if this is an image, maybe we will add some // other checks later @@ -103,7 +103,7 @@ static bool IsPathToThumbnail(const CStdString& strPath ) g_advancedSettings.m_pictureExtensions); } -static time_t ParseDate(const CStdString & strDate) +static time_t ParseDate(const std::string & strDate) { struct tm pubDate = {0}; // TODO: Handle time zone @@ -111,12 +111,12 @@ static time_t ParseDate(const CStdString & strDate) // Check the difference between the time of last check and time of the item return mktime(&pubDate); } -static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const CStdString& path); +static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const std::string& path); -static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); - CStdString text = item_child->GetText(); + std::string text = item_child->GetText(); if(name == "content") { @@ -162,7 +162,7 @@ static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* if(text.empty()) return; - CStdString description = text; + std::string description = text; if(XMLUtils::GetAttribute(item_child, "type") == "html") HTML::CHTMLUtil::RemoveTags(description); item->SetProperty("description", description); @@ -172,7 +172,7 @@ static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* if(text.empty()) return; - CStdString scheme = XMLUtils::GetAttribute(item_child, "scheme"); + std::string scheme = XMLUtils::GetAttribute(item_child, "scheme"); /* okey this is silly, boxee what did you think?? */ if (scheme == "urn:boxee:genre") @@ -199,7 +199,7 @@ static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* } else if(name == "rating") { - CStdString scheme = XMLUtils::GetAttribute(item_child, "scheme"); + std::string scheme = XMLUtils::GetAttribute(item_child, "scheme"); if(scheme == "urn:user") vtag->m_fRating = (float)atof(text.c_str()); else @@ -207,7 +207,7 @@ static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* } else if(name == "credit") { - CStdString role = XMLUtils::GetAttribute(item_child, "role"); + std::string role = XMLUtils::GetAttribute(item_child, "role"); if (role == "director") vtag->m_director.push_back(text); else if(role == "author" @@ -227,10 +227,10 @@ static void ParseItemMRSS(CFileItem* item, SResources& resources, TiXmlElement* } -static void ParseItemItunes(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemItunes(CFileItem* item, SResources& resources, TiXmlElement* item_child, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); - CStdString text = item_child->GetText(); + std::string text = item_child->GetText(); if(name == "image") { @@ -252,9 +252,9 @@ static void ParseItemItunes(CFileItem* item, SResources& resources, TiXmlElement item->SetProperty("keywords", text); } -static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* item_child, const std::string& name, const std::string& xmlns, const std::string& path) { - CStdString text = item_child->GetText(); + std::string text = item_child->GetText(); if (name == "title") { if(text.length() > item->m_strTitle.length()) @@ -287,7 +287,7 @@ static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* i } else if(name == "description") { - CStdString description = text; + std::string description = text; HTML::CHTMLUtil::RemoveTags(description); item->SetProperty("description", description); } @@ -303,10 +303,10 @@ static void ParseItemRSS(CFileItem* item, SResources& resources, TiXmlElement* i } } -static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); - CStdString text = element->GetText(); + std::string text = element->GetText(); if(name == "trailer") { @@ -319,9 +319,9 @@ static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElemen resources.push_back(res); } else if(name == "year") - vtag->m_iYear = atoi(text); + vtag->m_iYear = atoi(text.c_str()); else if(name == "rating") - vtag->m_fRating = (float)atof(text); + vtag->m_fRating = (float)atof(text.c_str()); else if(name == "tagline") vtag->m_strTagLine = text; else if(name == "posterwall") @@ -334,10 +334,10 @@ static void ParseItemVoddler(CFileItem* item, SResources& resources, TiXmlElemen } } -static void ParseItemBoxee(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemBoxee(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); - CStdString text = element->GetText(); + std::string text = element->GetText(); if (name == "image") item->SetArt("thumb", text); @@ -348,38 +348,38 @@ static void ParseItemBoxee(CFileItem* item, SResources& resources, TiXmlElement* else if(name == "runtime") vtag->m_duration = StringUtils::TimeStringToSeconds(text); else if(name == "episode") - vtag->m_iEpisode = atoi(text); + vtag->m_iEpisode = atoi(text.c_str()); else if(name == "season") - vtag->m_iSeason = atoi(text); + vtag->m_iSeason = atoi(text.c_str()); else if(name == "view-count") - vtag->m_playCount = atoi(text); + vtag->m_playCount = atoi(text.c_str()); else if(name == "tv-show-title") vtag->m_strShowTitle = text; else if(name == "release-date") item->SetProperty("boxee:releasedate", text); } -static void ParseItemZink(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemZink(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { CVideoInfoTag* vtag = item->GetVideoInfoTag(); - CStdString text = element->GetText(); + std::string text = element->GetText(); if (name == "episode") - vtag->m_iEpisode = atoi(text); + vtag->m_iEpisode = atoi(text.c_str()); else if(name == "season") - vtag->m_iSeason = atoi(text); + vtag->m_iSeason = atoi(text.c_str()); else if(name == "views") - vtag->m_playCount = atoi(text); + vtag->m_playCount = atoi(text.c_str()); else if(name == "airdate") vtag->m_firstAired.SetFromDateString(text); else if(name == "userrating") vtag->m_fRating = (float)atof(text.c_str()); else if(name == "duration") - vtag->m_duration = atoi(text); + vtag->m_duration = atoi(text.c_str()); else if(name == "durationstr") vtag->m_duration = StringUtils::TimeStringToSeconds(text); } -static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* element, const CStdString& name, const CStdString& xmlns, const CStdString& path) +static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* element, const std::string& name, const std::string& xmlns, const std::string& path) { std::string text = element->GetText(); if (name == "xmllink") @@ -404,12 +404,12 @@ static void ParseItemSVT(CFileItem* item, SResources& resources, TiXmlElement* e } } -static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const CStdString& path) +static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const std::string& path) { for (TiXmlElement* child = root->FirstChildElement(); child; child = child->NextSiblingElement()) { - CStdString name = child->Value(); - CStdString xmlns; + std::string name = child->Value(); + std::string xmlns; size_t pos = name.find(':'); if(pos != std::string::npos) { @@ -434,7 +434,7 @@ static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root } } -static bool FindMime(SResources resources, CStdString mime) +static bool FindMime(SResources resources, std::string mime) { for(SResources::iterator it = resources.begin(); it != resources.end(); it++) { @@ -444,14 +444,14 @@ static bool FindMime(SResources resources, CStdString mime) return false; } -static void ParseItem(CFileItem* item, TiXmlElement* root, const CStdString& path) +static void ParseItem(CFileItem* item, TiXmlElement* root, const std::string& path) { SResources resources; ParseItem(item, resources, root, path); const char* prio[] = { "media:content", "voddler:trailer", "rss:enclosure", "svtplay:broadcasts", "svtplay:xmllink", "rss:link", "rss:guid", NULL }; - CStdString mime; + std::string mime; if (FindMime(resources, "video/")) mime = "video/"; else if(FindMime(resources, "audio/")) @@ -552,10 +552,10 @@ static void ParseItem(CFileItem* item, TiXmlElement* root, const CStdString& pat bool CRSSDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - const CStdString pathToUrl(url.Get()); - CStdString strPath(pathToUrl); + const std::string pathToUrl(url.Get()); + std::string strPath(pathToUrl); URIUtils::RemoveSlashAtEnd(strPath); - std::map<CStdString,CDateTime>::iterator it; + std::map<std::string,CDateTime>::iterator it; items.SetPath(strPath); CSingleLock lock(m_section); if ((it=m_cache.find(strPath)) != m_cache.end()) diff --git a/xbmc/filesystem/RSSDirectory.h b/xbmc/filesystem/RSSDirectory.h index 63946c8859..09b7d9257d 100644 --- a/xbmc/filesystem/RSSDirectory.h +++ b/xbmc/filesystem/RSSDirectory.h @@ -38,7 +38,7 @@ namespace XFILE virtual DIR_CACHE_TYPE GetCacheType(const CURL& url) const { return DIR_CACHE_ONCE; }; protected: // key is path, value is cache invalidation date - static std::map<CStdString,CDateTime> m_cache; + static std::map<std::string,CDateTime> m_cache; static CCriticalSection m_section; }; } diff --git a/xbmc/filesystem/RTVDirectory.cpp b/xbmc/filesystem/RTVDirectory.cpp index 4fd2c41c11..b8a895a090 100644 --- a/xbmc/filesystem/RTVDirectory.cpp +++ b/xbmc/filesystem/RTVDirectory.cpp @@ -52,7 +52,7 @@ CRTVDirectory::~CRTVDirectory(void) bool CRTVDirectory::GetDirectory(const CURL& url2, CFileItemList &items) { CURL url(url2); - CStdString strRoot = url.Get(); + std::string strRoot = url.Get(); URIUtils::AddSlashAtEnd(strRoot); // Host name is "*" so we try to discover all ReplayTVs. This requires some trickery but works. @@ -93,7 +93,7 @@ bool CRTVDirectory::GetDirectory(const CURL& url2, CFileItemList &items) } else { - CStdString strURL, strRTV; + std::string strURL, strRTV; size_t pos; // Isolate the IP from the URL and replace the "*" with the real IP @@ -113,8 +113,7 @@ bool CRTVDirectory::GetDirectory(const CURL& url2, CFileItemList &items) } // Allow for ReplayTVs on ports other than 80 - CStdString strHostAndPort; - strHostAndPort = url.GetHostName(); + std::string strHostAndPort = url.GetHostName(); if (url.HasPort()) { char buffer[10]; @@ -149,7 +148,7 @@ bool CRTVDirectory::GetDirectory(const CURL& url2, CFileItemList &items) const TiXmlNode *pChild = pRootElement->FirstChild(); while (pChild > 0) { - CStdString strTagName = pChild->Value(); + std::string strTagName = pChild->ValueStr(); if ( !strcmpi(strTagName.c_str(), "ITEM") ) { @@ -186,9 +185,9 @@ bool CRTVDirectory::GetDirectory(const CURL& url2, CFileItemList &items) // } // RECORDED - if (recordedNode) + if (recordedNode && recordedNode->FirstChild()) { - CStdString strRecorded = recordedNode->FirstChild()->Value(); + std::string strRecorded = recordedNode->FirstChild()->ValueStr(); if (strRecorded.size() >= 19) { diff --git a/xbmc/filesystem/RTVFile.cpp b/xbmc/filesystem/RTVFile.cpp index a4b41508c4..833a40c9b0 100644 --- a/xbmc/filesystem/RTVFile.cpp +++ b/xbmc/filesystem/RTVFile.cpp @@ -30,7 +30,6 @@ #ifdef TARGET_WINDOWS #include "PlatformDefs.h" //for PRIdS #endif -#include "utils/StdString.h" extern "C" { #include "lib/libRTV/interface.h" @@ -57,7 +56,7 @@ CRTVFile::~CRTVFile() } //********************************************************************************************* -bool CRTVFile::Open(const char* strHostName, const char* strFileName, int iport) +bool CRTVFile::Open(const std::string& strHostName, const std::string& strFileName, int iport) { // Close any existing connection if (m_bOpened) Close(); @@ -67,13 +66,12 @@ bool CRTVFile::Open(const char* strHostName, const char* strFileName, int iport) // Set up global variables. Don't set m_filePos to 0 because we use it to SEEK! m_fileSize = 0; m_rtvd = NULL; - strcpy(m_hostName, strHostName); - strcpy(m_fileName, strFileName); + m_hostName = strHostName; + m_fileName = strFileName; m_iport = iport; // Allow for ReplayTVs on ports other than 80 - CStdString strHostAndPort; - strHostAndPort = strHostName; + std::string strHostAndPort = strHostName; if (iport) { char buffer[10]; @@ -84,31 +82,31 @@ bool CRTVFile::Open(const char* strHostName, const char* strFileName, int iport) // Get the file size of strFileName. If size is 0 or negative, file doesn't exist so exit. u64 size; - size = rtv_get_filesize(strHostAndPort.c_str(), strFileName); + size = rtv_get_filesize(strHostAndPort.c_str(), strFileName.c_str()); if (!size) { - CLog::Log(LOGERROR, "%s - Failed to get filesize of %s on %s", __FUNCTION__, strHostName, strFileName); + CLog::Log(LOGERROR, "%s - Failed to get filesize of %s on %s", __FUNCTION__, strHostName.c_str(), strFileName.c_str()); return false; } m_fileSize = size; // Open a connection to strFileName stating at position m_filePos // Store the handle to the connection in m_rtvd. Exit if handle invalid. - m_rtvd = rtv_open_file(strHostAndPort.c_str(), strFileName, m_filePos); + m_rtvd = rtv_open_file(strHostAndPort.c_str(), strFileName.c_str(), m_filePos); if (!m_rtvd) { - CLog::Log(LOGERROR, "%s - Failed to open %s on %s", __FUNCTION__, strHostName, strFileName); + CLog::Log(LOGERROR, "%s - Failed to open %s on %s", __FUNCTION__, strHostName.c_str(), strFileName.c_str()); return false; } m_bOpened = true; - CLog::Log(LOGDEBUG, "%s - Opened %s on %s, Size %" PRIu64", Position %" PRIu64"", __FUNCTION__, strHostName, strFileName, m_fileSize, m_filePos); + CLog::Log(LOGDEBUG, "%s - Opened %s on %s, Size %" PRIu64", Position %" PRIu64"", __FUNCTION__, strHostName.c_str(), strFileName.c_str(), m_fileSize, m_filePos); return true; } bool CRTVFile::Open(const CURL& url) { - return Open((CStdString)url.GetHostName(), (CStdString)url.GetFileName(), url.GetPort()); + return Open(url.GetHostName(), url.GetFileName(), url.GetPort()); } bool CRTVFile::Exists(const CURL& url) diff --git a/xbmc/filesystem/RTVFile.h b/xbmc/filesystem/RTVFile.h index ae2d405e6b..a1bed4e1c0 100644 --- a/xbmc/filesystem/RTVFile.h +++ b/xbmc/filesystem/RTVFile.h @@ -42,7 +42,7 @@ public: virtual int64_t GetPosition(); virtual int64_t GetLength(); virtual bool Open(const CURL& url); - bool Open(const char* strHostName, const char* strFileName, int iport); + bool Open(const std::string& strHostName, const std::string& strFileName, int iport); virtual bool Exists(const CURL& url); virtual int Stat(const CURL& url, struct __stat64* buffer); virtual unsigned int Read(void* lpBuf, int64_t uiBufSize); @@ -51,8 +51,8 @@ public: protected: uint64_t m_fileSize; uint64_t m_filePos; - char m_hostName[255]; - char m_fileName[255]; + std::string m_hostName; + std::string m_fileName; int m_iport; private: RTVD m_rtvd; diff --git a/xbmc/filesystem/RarDirectory.cpp b/xbmc/filesystem/RarDirectory.cpp index 329c1dc585..285155e6d4 100644 --- a/xbmc/filesystem/RarDirectory.cpp +++ b/xbmc/filesystem/RarDirectory.cpp @@ -44,12 +44,12 @@ namespace XFILE if (urlOrig.GetProtocol() != "rar") url = URIUtils::CreateArchivePath("rar", urlOrig); - CStdString strArchive = url.GetHostName(); - CStdString strOptions = url.GetOptions(); - CStdString strPathInArchive = url.GetFileName(); + std::string strArchive = url.GetHostName(); + std::string strOptions = url.GetOptions(); + std::string strPathInArchive = url.GetFileName(); url.SetOptions(""); - CStdString strSlashPath = url.Get(); + std::string strSlashPath = url.Get(); // the RAR code depends on things having a "\" at the end of the path URIUtils::AddSlashAtEnd(strSlashPath); @@ -61,7 +61,7 @@ namespace XFILE { if (items[iEntry]->IsParentFolder()) continue; - items[iEntry]->SetPath(URIUtils::AddFileToFolder(strSlashPath,(CStdString)items[iEntry]->GetPath()+strOptions)); + items[iEntry]->SetPath(URIUtils::AddFileToFolder(strSlashPath, items[iEntry]->GetPath() + strOptions)); items[iEntry]->m_iDriveType = 0; //CLog::Log(LOGDEBUG, "RarXFILE::GetDirectory() retrieved file: %s", items[iEntry]->m_strPath.c_str()); } @@ -86,7 +86,7 @@ namespace XFILE bool CRarDirectory::ContainsFiles(const CURL& url) { CFileItemList items; - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); if (g_RarManager.GetFilesInRar(items, pathToUrl)) { if (items.Size() > 1) diff --git a/xbmc/filesystem/RarFile.cpp b/xbmc/filesystem/RarFile.cpp index 077b905fa1..1b82b94b4c 100644 --- a/xbmc/filesystem/RarFile.cpp +++ b/xbmc/filesystem/RarFile.cpp @@ -200,7 +200,7 @@ bool CRarFile::Open(const CURL& url) if ((!info || !CFile::Exists(info->m_strCachedPath)) && m_bFileOptions & EXFILE_NOCACHE) return false; m_bUseFile = true; - CStdString strPathInCache; + std::string strPathInCache; if (!g_RarManager.CacheRarredFile(strPathInCache, m_strRarPath, m_strPathInRar, EXFILE_AUTODELETE | m_bFileOptions, m_strCacheDir, @@ -557,12 +557,12 @@ void CRarFile::InitFromUrl(const CURL& url) size_t iEqual = (*it).find('='); if(iEqual != std::string::npos) { - CStdString strOption = StringUtils::Left((*it), iEqual); - CStdString strValue = StringUtils::Mid((*it), iEqual+1); + std::string strOption = StringUtils::Left((*it), iEqual); + std::string strValue = StringUtils::Mid((*it), iEqual+1); - if( strOption.Equals("flags") ) + if( strOption == "flags" ) m_bFileOptions = atoi(strValue.c_str()); - else if( strOption.Equals("cache") ) + else if( strOption == "cache" ) m_strCacheDir = strValue; } } @@ -696,7 +696,7 @@ bool CRarFile::OpenInArchive() if (m_pArc->GetHeaderType() == FILE_HEAD) { - CStdString strFileName; + std::string strFileName; if (wcslen(m_pArc->NewLhd.FileNameW) > 0) { diff --git a/xbmc/filesystem/RarFile.h b/xbmc/filesystem/RarFile.h index 3e973a5754..cc1fea3d7e 100644 --- a/xbmc/filesystem/RarFile.h +++ b/xbmc/filesystem/RarFile.h @@ -81,10 +81,10 @@ namespace XFILE unsigned int Write(void *lpBuf, int64_t uiBufSize); protected: - CStdString m_strCacheDir; - CStdString m_strRarPath; - CStdString m_strPassword; - CStdString m_strPathInRar; + std::string m_strCacheDir; + std::string m_strRarPath; + std::string m_strPassword; + std::string m_strPathInRar; BYTE m_bFileOptions; void Init(); void InitFromUrl(const CURL& url); diff --git a/xbmc/filesystem/RarManager.cpp b/xbmc/filesystem/RarManager.cpp index 38fe12bc95..5043aeb3f0 100644 --- a/xbmc/filesystem/RarManager.cpp +++ b/xbmc/filesystem/RarManager.cpp @@ -64,14 +64,14 @@ CRarManager::~CRarManager() ClearCache(true); } -bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& strRarPath, const CStdString& strPathInRar, BYTE bOptions, const CStdString& strDir, const int64_t iSize) +bool CRarManager::CacheRarredFile(std::string& strPathInCache, const std::string& strRarPath, const std::string& strPathInRar, BYTE bOptions, const std::string& strDir, const int64_t iSize) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); //If file is listed in the cache, then use listed copy or cleanup before overwriting. bool bOverwrite = (bOptions & EXFILE_OVERWRITE) != 0; - map<CStdString, pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find( strRarPath ); + map<std::string, pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find( strRarPath ); CFileInfo* pFile=NULL; if( j != m_ExFiles.end() ) { @@ -132,12 +132,12 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& } } - CStdString strPath = strPathInRar; + std::string strPath = strPathInRar; #ifndef TARGET_POSIX StringUtils::Replace(strPath, '/', '\\'); #endif //g_charsetConverter.unknownToUTF8(strPath); - CStdString strCachedPath = URIUtils::AddFileToFolder(strDir + "rarfolder%04d", + std::string strCachedPath = URIUtils::AddFileToFolder(strDir + "rarfolder%04d", URIUtils::GetFileName(strPathInRar)); strCachedPath = CUtil::GetNextPathname(strCachedPath, 9999); if (strCachedPath.empty()) @@ -160,14 +160,14 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& { for( ArchiveList_struct* pIterator = j->second.first; pIterator ; pIterator ? pIterator = pIterator->next : NULL) { - CStdString strName; + std::string strName; /* convert to utf8 */ if( pIterator->item.NameW && wcslen(pIterator->item.NameW) > 0) g_charsetConverter.wToUTF8(pIterator->item.NameW, strName); else g_charsetConverter.unknownToUTF8(pIterator->item.Name, strName); - if (strName.Equals(strPath)) + if (strName == strPath) { iOffset = pIterator->item.iOffset; break; @@ -178,7 +178,7 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& if (iSize > 1024*1024 || iSize == -2) // 1MB bShowProgress=true; - CStdString strDir2 = URIUtils::GetDirectory(strCachedPath); + std::string strDir2 = URIUtils::GetDirectory(strCachedPath); URIUtils::RemoveSlashAtEnd(strDir2); if (!CDirectory::Exists(strDir2)) CDirectory::Create(strDir2); @@ -226,14 +226,14 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& } // NB: The rar manager expects paths in rars to be terminated with a "\". -bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const CStdString& strRarPath, - bool bMask, const CStdString& strPathInRar) +bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const std::string& strRarPath, + bool bMask, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); ArchiveList_struct* pFileList = NULL; - map<CStdString,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator it = m_ExFiles.find(strRarPath); + map<std::string,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator it = m_ExFiles.find(strRarPath); if (it == m_ExFiles.end()) { if( urarlib_list((char*) strRarPath.c_str(), &pFileList, NULL) ) @@ -249,18 +249,18 @@ bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const CStdString& strR CFileItemPtr pFileItem; vector<std::string> vec; - set<CStdString> dirSet; + set<std::string> dirSet; StringUtils::Tokenize(strPathInRar,vec,"/"); unsigned int iDepth = vec.size(); ArchiveList_struct* pIterator; - CStdString strCompare = strPathInRar; + std::string strCompare = strPathInRar; if (!URIUtils::HasSlashAtEnd(strCompare) && !strCompare.empty()) strCompare += '/'; for( pIterator = pFileList; pIterator ; pIterator ? pIterator = pIterator->next : NULL) { - CStdString strDirDelimiter = (pIterator->item.HostOS==3 ? "/":"\\"); // win32 or unix paths? - CStdString strName; + std::string strDirDelimiter = (pIterator->item.HostOS==3 ? "/":"\\"); // win32 or unix paths? + std::string strName; /* convert to utf8 */ if( pIterator->item.NameW && wcslen(pIterator->item.NameW) > 0) @@ -327,7 +327,7 @@ bool CRarManager::GetFilesInRar(CFileItemList& vecpItems, const CStdString& strR #endif } -bool CRarManager::ListArchive(const CStdString& strRarPath, ArchiveList_struct* &pArchiveList) +bool CRarManager::ListArchive(const std::string& strRarPath, ArchiveList_struct* &pArchiveList) { #ifdef HAS_FILESYSTEM_RAR return urarlib_list((char*) strRarPath.c_str(), &pArchiveList, NULL) == 1; @@ -336,10 +336,10 @@ bool CRarManager::ListArchive(const CStdString& strRarPath, ArchiveList_struct* #endif } -CFileInfo* CRarManager::GetFileInRar(const CStdString& strRarPath, const CStdString& strPathInRar) +CFileInfo* CRarManager::GetFileInRar(const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR - map<CStdString,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); + map<std::string,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) return NULL; @@ -350,10 +350,10 @@ CFileInfo* CRarManager::GetFileInRar(const CStdString& strRarPath, const CStdStr return NULL; } -bool CRarManager::GetPathInCache(CStdString& strPathInCache, const CStdString& strRarPath, const CStdString& strPathInRar) +bool CRarManager::GetPathInCache(std::string& strPathInCache, const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR - map<CStdString,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); + map<std::string,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) return false; @@ -364,7 +364,7 @@ bool CRarManager::GetPathInCache(CStdString& strPathInCache, const CStdString& s return false; } -bool CRarManager::IsFileInRar(bool& bResult, const CStdString& strRarPath, const CStdString& strPathInRar) +bool CRarManager::IsFileInRar(bool& bResult, const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR bResult = false; @@ -392,7 +392,7 @@ void CRarManager::ClearCache(bool force) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); - map<CStdString, pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j; + map<std::string, pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j; for (j = m_ExFiles.begin() ; j != m_ExFiles.end() ; j++) { @@ -409,12 +409,12 @@ void CRarManager::ClearCache(bool force) #endif } -void CRarManager::ClearCachedFile(const CStdString& strRarPath, const CStdString& strPathInRar) +void CRarManager::ClearCachedFile(const std::string& strRarPath, const std::string& strPathInRar) { #ifdef HAS_FILESYSTEM_RAR CSingleLock lock(m_CritSection); - map<CStdString,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); + map<std::string,pair<ArchiveList_struct*,vector<CFileInfo> > >::iterator j = m_ExFiles.find(strRarPath); if (j == m_ExFiles.end()) { return; // no such subpath @@ -432,10 +432,10 @@ void CRarManager::ClearCachedFile(const CStdString& strRarPath, const CStdString #endif } -void CRarManager::ExtractArchive(const CStdString& strArchive, const CStdString& strPath) +void CRarManager::ExtractArchive(const std::string& strArchive, const std::string& strPath) { #ifdef HAS_FILESYSTEM_RAR - CStdString strPath2(strPath); + std::string strPath2(strPath); URIUtils::RemoveSlashAtEnd(strPath2); if (!urarlib_get(const_cast<char*>(strArchive.c_str()), const_cast<char*>(strPath2.c_str()),NULL)) { @@ -445,7 +445,7 @@ void CRarManager::ExtractArchive(const CStdString& strArchive, const CStdString& #endif } -int64_t CRarManager::CheckFreeSpace(const CStdString& strDrive) +int64_t CRarManager::CheckFreeSpace(const std::string& strDrive) { ULARGE_INTEGER lTotalFreeBytes; if (GetDiskFreeSpaceEx(CSpecialProtocol::TranslatePath(strDrive).c_str(), NULL, NULL, &lTotalFreeBytes)) diff --git a/xbmc/filesystem/RarManager.h b/xbmc/filesystem/RarManager.h index 8aeef09d79..324c7badfe 100644 --- a/xbmc/filesystem/RarManager.h +++ b/xbmc/filesystem/RarManager.h @@ -22,7 +22,7 @@ * */ -#include "utils/StdString.h" +#include <string> #include "threads/CriticalSection.h" #include <map> #include "UnrarXLib/UnrarX.hpp" @@ -43,8 +43,8 @@ class CFileInfo{ public: CFileInfo(); ~CFileInfo(); - CStdString m_strCachedPath; - CStdString m_strPathInRar; + std::string m_strCachedPath; + std::string m_strPathInRar; bool m_bAutoDel; int m_iUsed; int64_t m_iOffset; @@ -67,25 +67,25 @@ class CRarManager public: CRarManager(); ~CRarManager(); - bool CacheRarredFile(CStdString& strPathInCache, const CStdString& strRarPath, - const CStdString& strPathInRar, uint8_t bOptions = EXFILE_AUTODELETE, - const CStdString& strDir =RAR_DEFAULT_CACHE, const int64_t iSize=-1); - bool GetPathInCache(CStdString& strPathInCache, const CStdString& strRarPath, - const CStdString& strPathInRar = ""); - bool GetFilesInRar(CFileItemList& vecpItems, const CStdString& strRarPath, - bool bMask=true, const CStdString& strPathInRar=""); - CFileInfo* GetFileInRar(const CStdString& strRarPath, const CStdString& strPathInRar); - bool IsFileInRar(bool& bResult, const CStdString& strRarPath, const CStdString& strPathInRar); + bool CacheRarredFile(std::string& strPathInCache, const std::string& strRarPath, + const std::string& strPathInRar, uint8_t bOptions = EXFILE_AUTODELETE, + const std::string& strDir =RAR_DEFAULT_CACHE, const int64_t iSize=-1); + bool GetPathInCache(std::string& strPathInCache, const std::string& strRarPath, + const std::string& strPathInRar = ""); + bool GetFilesInRar(CFileItemList& vecpItems, const std::string& strRarPath, + bool bMask=true, const std::string& strPathInRar=""); + CFileInfo* GetFileInRar(const std::string& strRarPath, const std::string& strPathInRar); + bool IsFileInRar(bool& bResult, const std::string& strRarPath, const std::string& strPathInRar); void ClearCache(bool force=false); - void ClearCachedFile(const CStdString& strRarPath, const CStdString& strPathInRar); - void ExtractArchive(const CStdString& strArchive, const CStdString& strPath); + void ClearCachedFile(const std::string& strRarPath, const std::string& strPathInRar); + void ExtractArchive(const std::string& strArchive, const std::string& strPath); protected: - bool ListArchive(const CStdString& strRarPath, ArchiveList_struct* &pArchiveList); - std::map<CStdString, std::pair<ArchiveList_struct*,std::vector<CFileInfo> > > m_ExFiles; + bool ListArchive(const std::string& strRarPath, ArchiveList_struct* &pArchiveList); + std::map<std::string, std::pair<ArchiveList_struct*,std::vector<CFileInfo> > > m_ExFiles; CCriticalSection m_CritSection; - int64_t CheckFreeSpace(const CStdString& strDrive); + int64_t CheckFreeSpace(const std::string& strDrive); }; extern CRarManager g_RarManager; diff --git a/xbmc/filesystem/SAPDirectory.cpp b/xbmc/filesystem/SAPDirectory.cpp index 2fa7147003..cb8fb96773 100644 --- a/xbmc/filesystem/SAPDirectory.cpp +++ b/xbmc/filesystem/SAPDirectory.cpp @@ -364,9 +364,9 @@ bool CSAPSessions::ParseAnnounce(char* data, int len) } // add a new session to our buffer - CStdString user = origin.username; + std::string user = origin.username; user = CURL::Encode(user); - CStdString path = StringUtils::Format("sap://%s/%s/0x%x.sdp", header.origin.c_str(), desc.origin.c_str(), header.msgid); + std::string 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; diff --git a/xbmc/filesystem/SAPFile.cpp b/xbmc/filesystem/SAPFile.cpp index f570c4383b..3cdc9a44ab 100644 --- a/xbmc/filesystem/SAPFile.cpp +++ b/xbmc/filesystem/SAPFile.cpp @@ -24,7 +24,6 @@ #include "SAPDirectory.h" #include "threads/SingleLock.h" #include "URL.h" -#include "utils/StdString.h" #include <sys/stat.h> #include <vector> @@ -45,7 +44,7 @@ CSAPFile::~CSAPFile() bool CSAPFile::Open(const CURL& url) { - CStdString path = url.Get(); + std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); for(vector<CSAPSessions::CSession>::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); it++) @@ -66,7 +65,7 @@ bool CSAPFile::Open(const CURL& url) bool CSAPFile::Exists(const CURL& url) { - CStdString path = url.Get(); + std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); for(vector<CSAPSessions::CSession>::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); it++) @@ -79,7 +78,7 @@ bool CSAPFile::Exists(const CURL& url) int CSAPFile::Stat(const CURL& url, struct __stat64* buffer) { - CStdString path = url.Get(); + std::string path = url.Get(); if(path == "smb://") { @@ -155,7 +154,7 @@ int64_t CSAPFile::GetPosition() bool CSAPFile::Delete(const CURL& url) { - CStdString path = url.Get(); + std::string path = url.Get(); CSingleLock lock(g_sapsessions.m_section); for(vector<CSAPSessions::CSession>::iterator it = g_sapsessions.m_sessions.begin(); it != g_sapsessions.m_sessions.end(); it++) diff --git a/xbmc/filesystem/SFTPFile.cpp b/xbmc/filesystem/SFTPFile.cpp index 84fce18b1f..0b166f4f02 100644 --- a/xbmc/filesystem/SFTPFile.cpp +++ b/xbmc/filesystem/SFTPFile.cpp @@ -48,7 +48,7 @@ using namespace XFILE; using namespace std; -static CStdString CorrectPath(const CStdString path) +static std::string CorrectPath(const std::string path) { if (path == "~") return "./"; @@ -98,7 +98,7 @@ static const char * SFTPErrorText(int sftp_error) -CSFTPSession::CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password) +CSFTPSession::CSFTPSession(const std::string &host, unsigned int port, const std::string &username, const std::string &password) { CLog::Log(LOGINFO, "SFTPSession: Creating new session on host '%s:%d' with user '%s'", host.c_str(), port, username.c_str()); CSingleLock lock(m_critSect); @@ -114,7 +114,7 @@ CSFTPSession::~CSFTPSession() Disconnect(); } -sftp_file CSFTPSession::CreateFileHande(const CStdString &file) +sftp_file CSFTPSession::CreateFileHande(const std::string &file) { if (m_connected) { @@ -141,7 +141,7 @@ void CSFTPSession::CloseFileHandle(sftp_file handle) sftp_close(handle); } -bool CSFTPSession::GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items) +bool CSFTPSession::GetDirectory(const std::string &base, const std::string &folder, CFileItemList &items) { int sftp_error = SSH_FX_OK; if (m_connected) @@ -184,8 +184,8 @@ bool CSFTPSession::GetDirectory(const CStdString &base, const CStdString &folder if (attributes) { - CStdString itemName = attributes->name; - CStdString localPath = folder; + std::string itemName = attributes->name; + std::string localPath = folder; localPath.append(itemName); if (attributes->type == SSH_FILEXFER_TYPE_SYMLINK) @@ -352,7 +352,7 @@ bool CSFTPSession::VerifyKnownHost(ssh_session session) return false; } -bool CSFTPSession::Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password) +bool CSFTPSession::Connect(const std::string &host, unsigned int port, const std::string &username, const std::string &password) { int timeout = SFTP_TIMEOUT; m_connected = false; @@ -527,7 +527,7 @@ bool CSFTPSession::GetItemPermissions(const char *path, uint32_t &permissions) } CCriticalSection CSFTPSessionManager::m_critSect; -map<CStdString, CSFTPSessionPtr> CSFTPSessionManager::sessions; +map<std::string, CSFTPSessionPtr> CSFTPSessionManager::sessions; CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url) { @@ -539,15 +539,15 @@ CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CURL &url) return CSFTPSessionManager::CreateSession(hostname, port, username, password); } -CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password) +CSFTPSessionPtr CSFTPSessionManager::CreateSession(const std::string &host, unsigned int port, const std::string &username, const std::string &password) { // Convert port number to string stringstream itoa; itoa << port; - CStdString portstr = itoa.str(); + std::string portstr = itoa.str(); CSingleLock lock(m_critSect); - CStdString key = username + ":" + password + "@" + host + ":" + portstr; + std::string key = username + ':' + password + '@' + host + ':' + portstr; CSFTPSessionPtr ptr = sessions[key]; if (ptr == NULL) { @@ -561,7 +561,7 @@ CSFTPSessionPtr CSFTPSessionManager::CreateSession(const CStdString &host, unsig void CSFTPSessionManager::ClearOutIdleSessions() { CSingleLock lock(m_critSect); - for(map<CStdString, CSFTPSessionPtr>::iterator iter = sessions.begin(); iter != sessions.end();) + for(map<std::string, CSFTPSessionPtr>::iterator iter = sessions.begin(); iter != sessions.end();) { if (iter->second->IsIdle()) sessions.erase(iter++); diff --git a/xbmc/filesystem/SFTPFile.h b/xbmc/filesystem/SFTPFile.h index 8ea4515716..b32b831b3c 100644 --- a/xbmc/filesystem/SFTPFile.h +++ b/xbmc/filesystem/SFTPFile.h @@ -58,12 +58,12 @@ class CURL; class CSFTPSession { public: - CSFTPSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password); + CSFTPSession(const std::string &host, unsigned int port, const std::string &username, const std::string &password); virtual ~CSFTPSession(); - sftp_file CreateFileHande(const CStdString &file); + sftp_file CreateFileHande(const std::string &file); void CloseFileHandle(sftp_file handle); - bool GetDirectory(const CStdString &base, const CStdString &folder, CFileItemList &items); + bool GetDirectory(const std::string &base, const std::string &folder, CFileItemList &items); bool DirectoryExists(const char *path); bool FileExists(const char *path); int Stat(const char *path, struct __stat64* buffer); @@ -73,7 +73,7 @@ public: bool IsIdle(); private: bool VerifyKnownHost(ssh_session session); - bool Connect(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password); + bool Connect(const std::string &host, unsigned int port, const std::string &username, const std::string &password); void Disconnect(); bool GetItemPermissions(const char *path, uint32_t &permissions); CCriticalSection m_critSect; @@ -90,12 +90,12 @@ class CSFTPSessionManager { public: static CSFTPSessionPtr CreateSession(const CURL &url); - static CSFTPSessionPtr CreateSession(const CStdString &host, unsigned int port, const CStdString &username, const CStdString &password); + static CSFTPSessionPtr CreateSession(const std::string &host, unsigned int port, const std::string &username, const std::string &password); static void ClearOutIdleSessions(); static void DisconnectAllSessions(); private: static CCriticalSection m_critSect; - static std::map<CStdString, CSFTPSessionPtr> sessions; + static std::map<std::string, CSFTPSessionPtr> sessions; }; namespace XFILE @@ -117,7 +117,7 @@ namespace XFILE virtual int GetChunkSize() {return 1;}; virtual int IoControl(EIoControl request, void* param); private: - CStdString m_file; + std::string m_file; CSFTPSessionPtr m_session; sftp_file m_sftp_handle; }; diff --git a/xbmc/filesystem/SIDFileDirectory.cpp b/xbmc/filesystem/SIDFileDirectory.cpp index 81b8ef973d..4dfe008840 100644 --- a/xbmc/filesystem/SIDFileDirectory.cpp +++ b/xbmc/filesystem/SIDFileDirectory.cpp @@ -32,7 +32,7 @@ CSIDFileDirectory::~CSIDFileDirectory(void) { } -int CSIDFileDirectory::GetTrackCount(const CStdString& strPath) +int CSIDFileDirectory::GetTrackCount(const std::string& strPath) { DllSidplay2 m_dll; if (!m_dll.Load()) diff --git a/xbmc/filesystem/SIDFileDirectory.h b/xbmc/filesystem/SIDFileDirectory.h index 9af6161226..102e7707f5 100644 --- a/xbmc/filesystem/SIDFileDirectory.h +++ b/xbmc/filesystem/SIDFileDirectory.h @@ -31,6 +31,6 @@ namespace XFILE virtual ~CSIDFileDirectory(void); private: DllSidplay2 m_dll; - virtual int GetTrackCount(const CStdString& strPath); + virtual int GetTrackCount(const std::string& strPath); }; } diff --git a/xbmc/filesystem/SMBDirectory.cpp b/xbmc/filesystem/SMBDirectory.cpp index a8629b3861..d5ea1d105d 100644 --- a/xbmc/filesystem/SMBDirectory.cpp +++ b/xbmc/filesystem/SMBDirectory.cpp @@ -53,7 +53,7 @@ struct CachedDirEntry { unsigned int type; - CStdString name; + std::string name; }; using namespace XFILE; @@ -79,8 +79,8 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) smb.Init(); //Separate roots for the authentication and the containing items to allow browsing to work correctly - CStdString strRoot = url.Get(); - CStdString strAuth; + std::string strRoot = url.Get(); + std::string strAuth; lock.Leave(); // OpenDir is locked int fd = OpenDir(url, strAuth); @@ -90,7 +90,7 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) URIUtils::AddSlashAtEnd(strRoot); URIUtils::AddSlashAtEnd(strAuth); - CStdString strFile; + std::string strFile; // need to keep the samba lock for as short as possible. // so we first cache all directory entries and then go over them again asking for stat @@ -116,8 +116,8 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) // We use UTF-8 internally, as does SMB strFile = aDir.name; - if (!strFile.Equals(".") && !strFile.Equals("..") - && !strFile.Equals("lost+found") && !strFile.empty() + if (!strFile.empty() && strFile != "." && strFile != ".." + && strFile != "lost+found" && aDir.type != SMBC_PRINTER_SHARE && aDir.type != SMBC_IPC_SHARE) { int64_t iSize = 0; @@ -139,7 +139,7 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) if ((m_flags & DIR_FLAG_NO_FILE_INFO)==0 && g_advancedSettings.m_sambastatfiles) { // make sure we use the authenticated path wich contains any default username - const CStdString strFullName = strAuth + smb.URLEncode(strFile); + const std::string strFullName = strAuth + smb.URLEncode(strFile); lock.Enter(); @@ -149,7 +149,7 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) char value[20]; // We poll for extended attributes which symbolizes bits but split up into a string. Where 0x02 is hidden and 0x12 is hidden directory. // According to the libsmbclient.h it's supposed to return 0 if ok, or the length of the string. It seems always to return the length wich is 4 - if (smbc_getxattr(strFullName, "system.dos_attr.mode", value, sizeof(value)) > 0) + if (smbc_getxattr(strFullName.c_str(), "system.dos_attr.mode", value, sizeof(value)) > 0) { long longvalue = strtol(value, NULL, 16); if (longvalue & SMBC_DOS_MODE_HIDDEN) @@ -180,7 +180,7 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) if (bIsDir) { CFileItemPtr pItem(new CFileItem(strFile)); - CStdString path(strRoot); + std::string path(strRoot); // needed for network / workgroup browsing // skip if root if we are given a server @@ -221,14 +221,14 @@ bool CSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) int CSMBDirectory::Open(const CURL &url) { smb.Init(); - CStdString strAuth; + std::string strAuth; return OpenDir(url, strAuth); } /// \brief Checks authentication against SAMBA share and prompts for username and password if needed /// \param strAuth The SMB style path /// \return SMB file descriptor -int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth) +int CSMBDirectory::OpenDir(const CURL& url, std::string& strAuth) { int fd = -1; @@ -255,7 +255,7 @@ int CSMBDirectory::OpenDir(const CURL& url, CStdString& strAuth) while (fd < 0) /* only to avoid goto in following code */ { - CStdString cError; + std::string cError; if (errno == EACCES) { @@ -291,7 +291,7 @@ bool CSMBDirectory::Create(const CURL& url2) CURL url(url2); CPasswordManager::GetInstance().AuthenticateURL(url); - CStdString strFileName = smb.URLEncode(url); + std::string strFileName = smb.URLEncode(url); int result = smbc_mkdir(strFileName.c_str(), 0); success = (result == 0 || EEXIST == errno); @@ -308,7 +308,7 @@ bool CSMBDirectory::Remove(const CURL& url2) CURL url(url2); CPasswordManager::GetInstance().AuthenticateURL(url); - CStdString strFileName = smb.URLEncode(url); + std::string strFileName = smb.URLEncode(url); int result = smbc_rmdir(strFileName.c_str()); @@ -328,7 +328,7 @@ bool CSMBDirectory::Exists(const CURL& url2) CURL url(url2); CPasswordManager::GetInstance().AuthenticateURL(url); - CStdString strFileName = smb.URLEncode(url); + std::string strFileName = smb.URLEncode(url); struct stat info; if (smbc_stat(strFileName.c_str(), &info) != 0) @@ -337,20 +337,20 @@ bool CSMBDirectory::Exists(const CURL& url2) return (info.st_mode & S_IFDIR) ? true : false; } -CStdString CSMBDirectory::MountShare(const CStdString &smbPath, const CStdString &strType, const CStdString &strName, - const CStdString &strUser, const CStdString &strPass) +std::string CSMBDirectory::MountShare(const std::string &smbPath, const std::string &strType, const std::string &strName, + const std::string &strUser, const std::string &strPass) { UnMountShare(strType, strName); - CStdString strMountPoint = GetMountPoint(strType, strName); + std::string strMountPoint = GetMountPoint(strType, strName); #if defined(TARGET_DARWIN) // Create the directory. strMountPoint = CURL::Decode(strMountPoint); - CreateDirectory(strMountPoint, NULL); + CreateDirectory(strMountPoint.c_str(), NULL); // Massage the path. - CStdString smbFullPath = "//"; + std::string smbFullPath = "//"; if (smbFullPath.length() > 0) { smbFullPath += strUser; @@ -360,7 +360,7 @@ CStdString CSMBDirectory::MountShare(const CStdString &smbPath, const CStdString smbFullPath += "@"; } - CStdString newPath = smbPath; + std::string newPath = smbPath; StringUtils::TrimLeft(newPath, "/"); smbFullPath += newPath; @@ -378,7 +378,7 @@ CStdString CSMBDirectory::MountShare(const CStdString &smbPath, const CStdString #else CUtil::SudoCommand("mkdir -p " + strMountPoint); - CStdString strCmd = "mount -t cifs " + smbPath + " " + strMountPoint + + std::string strCmd = "mount -t cifs " + smbPath + " " + strMountPoint + " -o rw,nobrl,directio"; if (!strUser.empty()) strCmd += ",user=" + strUser + ",password=" + strPass; @@ -388,14 +388,14 @@ CStdString CSMBDirectory::MountShare(const CStdString &smbPath, const CStdString if (CUtil::SudoCommand(strCmd)) return strMountPoint; #endif - return StringUtils::EmptyString; + return ""; } -void CSMBDirectory::UnMountShare(const CStdString &strType, const CStdString &strName) +void CSMBDirectory::UnMountShare(const std::string &strType, const std::string &strName) { #if defined(TARGET_DARWIN) // Decode the path. - CStdString strMountPoint(CURL::Decode(GetMountPoint(strType, strName))); + std::string strMountPoint(CURL::Decode(GetMountPoint(strType, strName))); // Make the unmount command. vector<string> args; @@ -405,17 +405,17 @@ void CSMBDirectory::UnMountShare(const CStdString &strType, const CStdString &st // Execute command. CUtil::Command(args); #else - CStdString strCmd = "umount " + GetMountPoint(strType, strName); + std::string strCmd = "umount " + GetMountPoint(strType, strName); CUtil::SudoCommand(strCmd); #endif } -CStdString CSMBDirectory::GetMountPoint(const CStdString &strType, const CStdString &strName) +std::string CSMBDirectory::GetMountPoint(const std::string &strType, const std::string &strName) { - CStdString strPath(CURL::Encode(strType + strName)); + std::string strPath(CURL::Encode(strType + strName)); #if defined(TARGET_DARWIN) - CStdString str = getenv("HOME"); + std::string str = getenv("HOME"); return str + "/" + XBMC_SMB_MOUNT_PATH + strPath; #else return XBMC_SMB_MOUNT_PATH + strPath; diff --git a/xbmc/filesystem/SMBDirectory.h b/xbmc/filesystem/SMBDirectory.h index 2399d3e074..7e30c2dd22 100644 --- a/xbmc/filesystem/SMBDirectory.h +++ b/xbmc/filesystem/SMBDirectory.h @@ -39,15 +39,15 @@ public: int Open(const CURL &url); //MountShare will try to mount the smb share and return the path to the mount point (or empty string if failed) - static CStdString MountShare(const CStdString &smbPath, const CStdString &strType, const CStdString &strName, - const CStdString &strUser, const CStdString &strPass); + static std::string MountShare(const std::string &smbPath, const std::string &strType, const std::string &strName, + const std::string &strUser, const std::string &strPass); - static void UnMountShare(const CStdString &strType, const CStdString &strName); - static CStdString GetMountPoint(const CStdString &strType, const CStdString &strName); + static void UnMountShare(const std::string &strType, const std::string &strName); + static std::string GetMountPoint(const std::string &strType, const std::string &strName); - static bool MountShare(const CStdString &strType, CMediaSource &share); + static bool MountShare(const std::string &strType, CMediaSource &share); private: - int OpenDir(const CURL &url, CStdString& strAuth); + int OpenDir(const CURL &url, std::string& strAuth); }; } diff --git a/xbmc/filesystem/ShoutcastFile.cpp b/xbmc/filesystem/ShoutcastFile.cpp index e150c5c818..068a7c646f 100644 --- a/xbmc/filesystem/ShoutcastFile.cpp +++ b/xbmc/filesystem/ShoutcastFile.cpp @@ -139,7 +139,7 @@ void CShoutcastFile::Close() bool CShoutcastFile::ExtractTagInfo(const char* buf) { - CStdString strBuffer = buf; + std::string strBuffer = buf; if (!m_fileCharset.empty()) { @@ -152,7 +152,7 @@ bool CShoutcastFile::ExtractTagInfo(const char* buf) bool result=false; - CStdStringW wBuffer, wConverted; + std::wstring wBuffer, wConverted; g_charsetConverter.utf8ToW(strBuffer, wBuffer, false); HTML::CHTMLUtil::ConvertHTMLToW(wBuffer, wConverted); g_charsetConverter.wToUTF8(wConverted, strBuffer); diff --git a/xbmc/filesystem/ShoutcastFile.h b/xbmc/filesystem/ShoutcastFile.h index 56d03cf590..f454589479 100644 --- a/xbmc/filesystem/ShoutcastFile.h +++ b/xbmc/filesystem/ShoutcastFile.h @@ -26,7 +26,6 @@ #include "IFile.h" #include "CurlFile.h" -#include "utils/StdString.h" #include "music/tags/MusicInfoTag.h" #include "threads/Thread.h" diff --git a/xbmc/filesystem/SlingboxDirectory.cpp b/xbmc/filesystem/SlingboxDirectory.cpp index b525f49e8d..e97dd4e814 100644 --- a/xbmc/filesystem/SlingboxDirectory.cpp +++ b/xbmc/filesystem/SlingboxDirectory.cpp @@ -36,7 +36,7 @@ CSlingboxDirectory::~CSlingboxDirectory() bool CSlingboxDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // Create generic Watch Slingbox item - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); CFileItemPtr item(new CFileItem(pathToUrl, false)); item->SetLabel("Watch Slingbox"); item->SetLabelPreformated(true); diff --git a/xbmc/filesystem/SlingboxFile.cpp b/xbmc/filesystem/SlingboxFile.cpp index 62a4449a0e..ad53844996 100644 --- a/xbmc/filesystem/SlingboxFile.cpp +++ b/xbmc/filesystem/SlingboxFile.cpp @@ -431,7 +431,7 @@ bool CSlingboxFile::SelectChannel(unsigned int uiChannel) else if (uiButtonsWithCode == 10) { // Prepare variables - CStdString strDigits = StringUtils::Format("%u", uiChannel); + std::string strDigits = StringUtils::Format("%u", uiChannel); size_t uiNumberOfDigits = strDigits.size(); // Change the channel using IR commands @@ -476,7 +476,7 @@ bool CSlingboxFile::SelectChannel(unsigned int uiChannel) return bSuccess; } -void CSlingboxFile::LoadSettings(const CStdString& strHostname) +void CSlingboxFile::LoadSettings(const std::string& strHostname) { // Load default settings m_sSlingboxSettings.strHostname = strHostname; @@ -494,7 +494,7 @@ void CSlingboxFile::LoadSettings(const CStdString& strHostname) m_sSlingboxSettings.uiCodeNumber[i] = 0; // Check if a SlingboxSettings.xml file exists - CStdString slingboxXMLFile = CProfilesManager::Get().GetUserDataItem("SlingboxSettings.xml"); + std::string slingboxXMLFile = CProfilesManager::Get().GetUserDataItem("SlingboxSettings.xml"); if (!CFile::Exists(slingboxXMLFile)) { CLog::Log(LOGNOTICE, "No SlingboxSettings.xml file (%s) found - using default settings", diff --git a/xbmc/filesystem/SlingboxFile.h b/xbmc/filesystem/SlingboxFile.h index db2348f682..17b402a5fd 100644 --- a/xbmc/filesystem/SlingboxFile.h +++ b/xbmc/filesystem/SlingboxFile.h @@ -56,7 +56,7 @@ namespace XFILE protected: struct { - CStdString strHostname; + std::string strHostname; int iVideoWidth; int iVideoHeight; int iVideoResolution; @@ -70,7 +70,7 @@ namespace XFILE unsigned int uiCodeNumber[10]; } m_sSlingboxSettings; - void LoadSettings(const CStdString& strSlingbox); + void LoadSettings(const std::string& strSlingbox); CSlingbox * m_pSlingbox; }; diff --git a/xbmc/filesystem/SmartPlaylistDirectory.cpp b/xbmc/filesystem/SmartPlaylistDirectory.cpp index cc3b7ec102..9e86466def 100644 --- a/xbmc/filesystem/SmartPlaylistDirectory.cpp +++ b/xbmc/filesystem/SmartPlaylistDirectory.cpp @@ -62,10 +62,10 @@ namespace XFILE return result; } - bool CSmartPlaylistDirectory::GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const CStdString &strBaseDir /* = "" */, bool filter /* = false */) + bool CSmartPlaylistDirectory::GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const std::string &strBaseDir /* = "" */, bool filter /* = false */) { bool success = false, success2 = false; - std::vector<CStdString> virtualFolders; + std::vector<std::string> virtualFolders; SortDescription sorting; sorting.limitEnd = playlist.GetLimit(); @@ -77,12 +77,12 @@ namespace XFILE items.SetSortIgnoreFolders((sorting.sortAttributes & SortAttributeIgnoreFolders) == SortAttributeIgnoreFolders); std::string option = !filter ? "xsp" : "filter"; - const CStdString& group = playlist.GetGroup(); + const std::string& group = playlist.GetGroup(); bool isGrouped = !group.empty() && !StringUtils::EqualsNoCase(group, "none") && !playlist.IsGroupMixed(); // get all virtual folders and add them to the item list playlist.GetVirtualFolders(virtualFolders); - for (std::vector<CStdString>::const_iterator virtualFolder = virtualFolders.begin(); virtualFolder != virtualFolders.end(); virtualFolder++) + for (std::vector<std::string>::const_iterator virtualFolder = virtualFolders.begin(); virtualFolder != virtualFolders.end(); virtualFolder++) { CFileItemPtr pItem = CFileItemPtr(new CFileItem(*virtualFolder, true)); IFileDirectory *dir = CFileDirectoryFactory::Create(pItem->GetURL(), pItem.get()); @@ -95,16 +95,16 @@ namespace XFILE } } - if (playlist.GetType().Equals("movies") || - playlist.GetType().Equals("tvshows") || - playlist.GetType().Equals("episodes")) + if (playlist.GetType() == "movies" || + playlist.GetType() == "tvshows" || + playlist.GetType() == "episodes") { CVideoDatabase db; if (db.Open()) { MediaType mediaType = MediaTypes::FromString(playlist.GetType()); - CStdString baseDir = strBaseDir; + std::string baseDir = strBaseDir; if (strBaseDir.empty()) { if (mediaType == MediaTypeTvShow || mediaType == MediaTypeEpisode) @@ -129,7 +129,7 @@ namespace XFILE return false; // store the smartplaylist as JSON in the URL as well - CStdString xsp; + std::string xsp; if (!playlist.IsEmpty(filter)) { if (!playlist.SaveAsJson(xsp, !filter)) @@ -158,12 +158,12 @@ namespace XFILE if (db.Open()) { CSmartPlaylist plist(playlist); - if (playlist.GetType().Equals("mixed") || playlist.GetType().empty()) + if (playlist.GetType() == "mixed" || playlist.GetType().empty()) plist.SetType("songs"); MediaType mediaType = MediaTypes::FromString(plist.GetType()); - CStdString baseDir = strBaseDir; + std::string baseDir = strBaseDir; if (strBaseDir.empty()) { baseDir = "musicdb://"; @@ -189,7 +189,7 @@ namespace XFILE return false; // store the smartplaylist as JSON in the URL as well - CStdString xsp; + std::string xsp; if (!plist.IsEmpty(filter)) { if (!plist.SaveAsJson(xsp, !filter)) @@ -209,16 +209,16 @@ namespace XFILE } } - if (playlist.GetType().Equals("musicvideos") || playlist.GetType().Equals("mixed")) + if (playlist.GetType() == "musicvideos" || playlist.GetType() == "mixed") { CVideoDatabase db; if (db.Open()) { CSmartPlaylist mvidPlaylist(playlist); - if (playlist.GetType().Equals("mixed")) + if (playlist.GetType() == "mixed") mvidPlaylist.SetType("musicvideos"); - CStdString baseDir = strBaseDir; + std::string baseDir = strBaseDir; if (baseDir.empty()) { baseDir = "videodb://musicvideos/"; @@ -235,7 +235,7 @@ namespace XFILE return false; // store the smartplaylist as JSON in the URL as well - CStdString xsp; + std::string xsp; if (!mvidPlaylist.IsEmpty(filter)) { if (!mvidPlaylist.SaveAsJson(xsp, !filter)) @@ -292,9 +292,9 @@ namespace XFILE item->m_iprogramCount = i; // hack for playlist order } - if (playlist.GetType().Equals("mixed")) + if (playlist.GetType() == "mixed") return success || success2; - else if (playlist.GetType().Equals("musicvideos")) + else if (playlist.GetType() == "musicvideos") return success2; else return success; @@ -306,7 +306,7 @@ namespace XFILE return true; } - CStdString CSmartPlaylistDirectory::GetPlaylistByName(const CStdString& name, const CStdString& playlistType) + std::string CSmartPlaylistDirectory::GetPlaylistByName(const std::string& name, const std::string& playlistType) { CFileItemList list; bool filesExist = false; diff --git a/xbmc/filesystem/SmartPlaylistDirectory.h b/xbmc/filesystem/SmartPlaylistDirectory.h index e5a08bc302..229d9b5b21 100644 --- a/xbmc/filesystem/SmartPlaylistDirectory.h +++ b/xbmc/filesystem/SmartPlaylistDirectory.h @@ -21,6 +21,7 @@ #include "IFileDirectory.h" #include "utils/SortUtils.h" +#include <string> class CSmartPlaylist; @@ -36,8 +37,8 @@ namespace XFILE virtual bool ContainsFiles(const CURL& url); virtual bool Remove(const CURL& url); - static bool GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const CStdString &strBaseDir = "", bool filter = false); + static bool GetDirectory(const CSmartPlaylist &playlist, CFileItemList& items, const std::string &strBaseDir = "", bool filter = false); - static CStdString GetPlaylistByName(const CStdString& name, const CStdString& playlistType); + static std::string GetPlaylistByName(const std::string& name, const std::string& playlistType); }; } diff --git a/xbmc/filesystem/SmbFile.cpp b/xbmc/filesystem/SmbFile.cpp index 3e22152f85..197ba76309 100644 --- a/xbmc/filesystem/SmbFile.cpp +++ b/xbmc/filesystem/SmbFile.cpp @@ -198,17 +198,17 @@ void CSMB::Purge() void CSMB::PurgeEx(const CURL& url) { CSingleLock lock(*this); - CStdString strShare = url.GetFileName().substr(0, url.GetFileName().find('/')); + std::string strShare = url.GetFileName().substr(0, url.GetFileName().find('/')); m_strLastShare = strShare; m_strLastHost = url.GetHostName(); } -CStdString CSMB::URLEncode(const CURL &url) +std::string CSMB::URLEncode(const CURL &url) { /* due to smb wanting encoded urls we have to build it manually */ - CStdString flat = "smb://"; + std::string flat = "smb://"; if(url.GetDomain().length() > 0) { @@ -242,7 +242,7 @@ CStdString CSMB::URLEncode(const CURL &url) return flat; } -CStdString CSMB::URLEncode(const CStdString &value) +std::string CSMB::URLEncode(const std::string &value) { return CURL::Encode(value); } @@ -342,7 +342,7 @@ bool CSmbFile::Open(const CURL& url) // when opening smb://server xbms will try to find folder.jpg in all shares // listed, which will create lot's of open sessions. - CStdString strFileName; + std::string strFileName; m_fd = OpenFile(url, strFileName); CLog::Log(LOGDEBUG,"CSmbFile::Open - opened %s, fd=%d",url.GetFileName().c_str(), m_fd); @@ -355,7 +355,7 @@ bool CSmbFile::Open(const CURL& url) CSingleLock lock(smb); struct stat tmpBuffer; - if (smbc_stat(strFileName, &tmpBuffer) < 0) + if (smbc_stat(strFileName.c_str(), &tmpBuffer) < 0) { smbc_close(m_fd); m_fd = -1; @@ -380,11 +380,11 @@ bool CSmbFile::Open(const CURL& url) /// \param strAuth The SMB style path /// \return SMB file descriptor /* -int CSmbFile::OpenFile(CStdString& strAuth) +int CSmbFile::OpenFile(std::string& strAuth) { int fd = -1; - CStdString strPath = g_passwordManager.GetSMBAuthFilename(strAuth); + std::string strPath = g_passwordManager.GetSMBAuthFilename(strAuth); fd = smbc_open(strPath.c_str(), O_RDONLY, 0); // TODO: Run a loop here that prompts for our username/password as appropriate? @@ -401,13 +401,13 @@ int CSmbFile::OpenFile(CStdString& strAuth) } */ -int CSmbFile::OpenFile(const CURL &url, CStdString& strAuth) +int CSmbFile::OpenFile(const CURL &url, std::string& strAuth) { int fd = -1; smb.Init(); strAuth = GetAuthenticatedPath(url); - CStdString strPath = strAuth; + std::string strPath = strAuth; { CSingleLock lock(smb); @@ -427,12 +427,12 @@ bool CSmbFile::Exists(const CURL& url) if (!IsValidFile(url.GetFileName())) return false; smb.Init(); - CStdString strFileName = GetAuthenticatedPath(url); + std::string strFileName = GetAuthenticatedPath(url); struct stat info; CSingleLock lock(smb); - int iResult = smbc_stat(strFileName, &info); + int iResult = smbc_stat(strFileName.c_str(), &info); if (iResult < 0) return false; return true; @@ -467,11 +467,11 @@ int CSmbFile::Stat(struct __stat64* buffer) int CSmbFile::Stat(const CURL& url, struct __stat64* buffer) { smb.Init(); - CStdString strFileName = GetAuthenticatedPath(url); + std::string strFileName = GetAuthenticatedPath(url); CSingleLock lock(smb); struct stat tmpBuffer = {0}; - int iResult = smbc_stat(strFileName, &tmpBuffer); + int iResult = smbc_stat(strFileName.c_str(), &tmpBuffer); memset(buffer, 0, sizeof(struct __stat64)); buffer->st_dev = tmpBuffer.st_dev; @@ -584,7 +584,7 @@ int CSmbFile::Write(const void* lpBuf, int64_t uiBufSize) bool CSmbFile::Delete(const CURL& url) { smb.Init(); - CStdString strFile = GetAuthenticatedPath(url); + std::string strFile = GetAuthenticatedPath(url); CSingleLock lock(smb); @@ -599,8 +599,8 @@ bool CSmbFile::Delete(const CURL& url) bool CSmbFile::Rename(const CURL& url, const CURL& urlnew) { smb.Init(); - CStdString strFile = GetAuthenticatedPath(url); - CStdString strFileNew = GetAuthenticatedPath(urlnew); + std::string strFile = GetAuthenticatedPath(url); + std::string strFileNew = GetAuthenticatedPath(urlnew); CSingleLock lock(smb); int result = smbc_rename(strFile.c_str(), strFileNew.c_str()); @@ -621,7 +621,7 @@ bool CSmbFile::OpenForWrite(const CURL& url, bool bOverWrite) // if a file matches the if below return false, it can't exist on a samba share. if (!IsValidFile(url.GetFileName())) return false; - CStdString strFileName = GetAuthenticatedPath(url); + std::string strFileName = GetAuthenticatedPath(url); CSingleLock lock(smb); if (bOverWrite) @@ -645,7 +645,7 @@ bool CSmbFile::OpenForWrite(const CURL& url, bool bOverWrite) return true; } -bool CSmbFile::IsValidFile(const CStdString& strFileName) +bool CSmbFile::IsValidFile(const std::string& strFileName) { if (strFileName.find('/') == std::string::npos || /* doesn't have sharename */ StringUtils::EndsWith(strFileName, "/.") || /* not current folder */ @@ -654,7 +654,7 @@ bool CSmbFile::IsValidFile(const CStdString& strFileName) return true; } -CStdString CSmbFile::GetAuthenticatedPath(const CURL &url) +std::string CSmbFile::GetAuthenticatedPath(const CURL &url) { CURL authURL(url); CPasswordManager::GetInstance().AuthenticateURL(authURL); diff --git a/xbmc/filesystem/SmbFile.h b/xbmc/filesystem/SmbFile.h index dae5185b12..d19377e95c 100644 --- a/xbmc/filesystem/SmbFile.h +++ b/xbmc/filesystem/SmbFile.h @@ -30,7 +30,6 @@ #include "IFile.h" #include "URL.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" #define NT_STATUS_CONNECTION_REFUSED long(0xC0000000 | 0x0236) #define NT_STATUS_INVALID_HANDLE long(0xC0000000 | 0x0008) @@ -54,14 +53,14 @@ public: void SetActivityTime(); void AddActiveConnection(); void AddIdleConnection(); - CStdString URLEncode(const CStdString &value); - CStdString URLEncode(const CURL &url); + std::string URLEncode(const std::string &value); + std::string URLEncode(const CURL &url); DWORD ConvertUnixToNT(int error); private: SMBCCTX *m_context; - CStdString m_strLastHost; - CStdString m_strLastShare; + std::string m_strLastHost; + std::string m_strLastShare; #ifdef TARGET_POSIX int m_OpenConnections; unsigned int m_IdleTimeout; @@ -76,7 +75,7 @@ class CSmbFile : public IFile { public: CSmbFile(); - int OpenFile(const CURL &url, CStdString& strAuth); + int OpenFile(const CURL &url, std::string& strAuth); virtual ~CSmbFile(); virtual void Close(); virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET); @@ -97,8 +96,8 @@ public: protected: CURL m_url; - bool IsValidFile(const CStdString& strFileName); - CStdString GetAuthenticatedPath(const CURL &url); + bool IsValidFile(const std::string& strFileName); + std::string GetAuthenticatedPath(const CURL &url); int64_t m_fileSize; int m_fd; }; diff --git a/xbmc/filesystem/SourcesDirectory.cpp b/xbmc/filesystem/SourcesDirectory.cpp index 134da4bd03..c03d297cfc 100644 --- a/xbmc/filesystem/SourcesDirectory.cpp +++ b/xbmc/filesystem/SourcesDirectory.cpp @@ -44,7 +44,7 @@ bool CSourcesDirectory::GetDirectory(const CURL& url, CFileItemList &items) { // break up our path // format is: sources://<type>/ - CStdString type(url.GetFileName()); + std::string type(url.GetFileName()); URIUtils::RemoveSlashAtEnd(type); VECSOURCES sources; @@ -65,27 +65,27 @@ bool CSourcesDirectory::GetDirectory(const VECSOURCES &sources, CFileItemList &i { const CMediaSource& share = sources[i]; CFileItemPtr pItem(new CFileItem(share)); - if (StringUtils::StartsWithNoCase(pItem->GetPath(), "musicsearch://")) + if (URIUtils::IsProtocol(pItem->GetPath(), "musicsearch")) pItem->SetCanQueue(false); - CStdString strIcon; + std::string strIcon; // We have the real DVD-ROM, set icon on disktype if (share.m_iDriveType == CMediaSource::SOURCE_TYPE_DVD && share.m_strThumbnailImage.empty()) { CUtil::GetDVDDriveIcon( pItem->GetPath(), strIcon ); // CDetectDVDMedia::SetNewDVDShareUrl() caches disc thumb as special://temp/dvdicon.tbn - CStdString strThumb = "special://temp/dvdicon.tbn"; + std::string strThumb = "special://temp/dvdicon.tbn"; if (XFILE::CFile::Exists(strThumb)) pItem->SetArt("thumb", strThumb); } - else if (StringUtils::StartsWith(pItem->GetPath(), "addons://")) + else if (URIUtils::IsProtocol(pItem->GetPath(), "addons")) strIcon = "DefaultHardDisk.png"; else if ( pItem->IsVideoDb() || pItem->IsMusicDb() || pItem->IsPlugin() - || pItem->GetPath() == "special://musicplaylists/" - || pItem->GetPath() == "special://videoplaylists/" - || pItem->GetPath() == "musicsearch://") + || pItem->IsPath("special://musicplaylists/") + || pItem->IsPath("special://videoplaylists/") + || pItem->IsPath("musicsearch://")) strIcon = "DefaultFolder.png"; else if (pItem->IsRemote()) strIcon = "DefaultNetwork.png"; diff --git a/xbmc/filesystem/SpecialProtocolDirectory.cpp b/xbmc/filesystem/SpecialProtocolDirectory.cpp index daf4bbfdf7..31c924e434 100644 --- a/xbmc/filesystem/SpecialProtocolDirectory.cpp +++ b/xbmc/filesystem/SpecialProtocolDirectory.cpp @@ -38,8 +38,8 @@ CSpecialProtocolDirectory::~CSpecialProtocolDirectory(void) bool CSpecialProtocolDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - const CStdString pathToUrl(url.Get()); - CStdString translatedPath = CSpecialProtocol::TranslatePath(url); + const std::string pathToUrl(url.Get()); + std::string translatedPath = CSpecialProtocol::TranslatePath(url); if (CDirectory::GetDirectory(translatedPath, items, m_strFileMask, m_flags | DIR_FLAG_GET_HIDDEN)) { // replace our paths as necessary items.SetURL(url); @@ -56,18 +56,18 @@ bool CSpecialProtocolDirectory::GetDirectory(const CURL& url, CFileItemList &ite bool CSpecialProtocolDirectory::Create(const CURL& url) { - CStdString translatedPath = CSpecialProtocol::TranslatePath(url); + std::string translatedPath = CSpecialProtocol::TranslatePath(url); return CDirectory::Create(translatedPath.c_str()); } bool CSpecialProtocolDirectory::Remove(const CURL& url) { - CStdString translatedPath = CSpecialProtocol::TranslatePath(url); + std::string translatedPath = CSpecialProtocol::TranslatePath(url); return CDirectory::Remove(translatedPath.c_str()); } bool CSpecialProtocolDirectory::Exists(const CURL& url) { - CStdString translatedPath = CSpecialProtocol::TranslatePath(url); + std::string translatedPath = CSpecialProtocol::TranslatePath(url); return CDirectory::Exists(translatedPath.c_str()); } diff --git a/xbmc/filesystem/SpecialProtocolFile.cpp b/xbmc/filesystem/SpecialProtocolFile.cpp index 82d236c231..6366714ef0 100644 --- a/xbmc/filesystem/SpecialProtocolFile.cpp +++ b/xbmc/filesystem/SpecialProtocolFile.cpp @@ -37,43 +37,43 @@ CSpecialProtocolFile::~CSpecialProtocolFile(void) bool CSpecialProtocolFile::Open(const CURL& url) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName=CSpecialProtocol::TranslatePath(url); return m_file.Open(strFileName); } bool CSpecialProtocolFile::OpenForWrite(const CURL& url, bool bOverWrite /*=false */) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName=CSpecialProtocol::TranslatePath(url); return m_file.OpenForWrite(strFileName,bOverWrite); } bool CSpecialProtocolFile::Delete(const CURL& url) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName=CSpecialProtocol::TranslatePath(url); return m_file.Delete(strFileName); } bool CSpecialProtocolFile::Exists(const CURL& url) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName=CSpecialProtocol::TranslatePath(url); return m_file.Exists(strFileName); } int CSpecialProtocolFile::Stat(const CURL& url, struct __stat64* buffer) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName=CSpecialProtocol::TranslatePath(url); return m_file.Stat(strFileName, buffer); } bool CSpecialProtocolFile::Rename(const CURL& url, const CURL& urlnew) { - CStdString strFileName=CSpecialProtocol::TranslatePath(url); - CStdString strFileName2=CSpecialProtocol::TranslatePath(urlnew); + std::string strFileName=CSpecialProtocol::TranslatePath(url); + std::string strFileName2=CSpecialProtocol::TranslatePath(urlnew); return m_file.Rename(strFileName,strFileName2); } diff --git a/xbmc/filesystem/StackDirectory.cpp b/xbmc/filesystem/StackDirectory.cpp index 0724071227..e3a5056718 100644 --- a/xbmc/filesystem/StackDirectory.cpp +++ b/xbmc/filesystem/StackDirectory.cpp @@ -18,6 +18,7 @@ * */ +#include <stdlib.h> #include "StackDirectory.h" #include "utils/log.h" #include "utils/URIUtils.h" @@ -41,7 +42,7 @@ namespace XFILE { items.Clear(); vector<std::string> files; - const CStdString pathToUrl(url.Get()); + const std::string pathToUrl(url.Get()); if (!GetPaths(pathToUrl, files)) return false; // error in path @@ -55,14 +56,14 @@ namespace XFILE return true; } - CStdString CStackDirectory::GetStackedTitlePath(const CStdString &strPath) + std::string CStackDirectory::GetStackedTitlePath(const std::string &strPath) { // Load up our REs VECCREGEXP RegExps; CRegExp tempRE(true, CRegExp::autoUtf8); const vector<std::string>& strRegExps = g_advancedSettings.m_videoStackRegExps; vector<std::string>::const_iterator itRegExp = strRegExps.begin(); - vector<pair<int, CStdString> > badStacks; + vector<pair<int, std::string> > badStacks; while (itRegExp != strRegExps.end()) { tempRE.RegComp(*itRegExp); @@ -75,11 +76,11 @@ namespace XFILE return GetStackedTitlePath(strPath, RegExps); } - CStdString CStackDirectory::GetStackedTitlePath(const CStdString &strPath, VECCREGEXP& RegExps) + std::string CStackDirectory::GetStackedTitlePath(const std::string &strPath, VECCREGEXP& RegExps) { CStackDirectory stack; CFileItemList files; - CStdString strStackTitlePath, + std::string strStackTitlePath, strCommonDir = URIUtils::GetParentPath(strPath); const CURL pathToUrl(strPath); @@ -87,10 +88,10 @@ namespace XFILE if (files.Size() > 1) { - CStdString strStackTitle; + std::string strStackTitle; - CStdString File1 = URIUtils::GetFileName(files[0]->GetPath()); - CStdString File2 = URIUtils::GetFileName(files[1]->GetPath()); + std::string File1 = URIUtils::GetFileName(files[0]->GetPath()); + std::string File2 = URIUtils::GetFileName(files[1]->GetPath()); // Check if source path uses URL encoding if (URIUtils::HasEncodedFilename(CURL(strCommonDir))) { @@ -105,7 +106,7 @@ namespace XFILE { if (itRegExp->RegFind(File1, offset) != -1) { - CStdString Title1 = itRegExp->GetMatch(1), + std::string Title1 = itRegExp->GetMatch(1), Volume1 = itRegExp->GetMatch(2), Ignore1 = itRegExp->GetMatch(3), Extension1 = itRegExp->GetMatch(4); @@ -113,17 +114,18 @@ namespace XFILE Title1 = File1.substr(0, itRegExp->GetSubStart(2)); if (itRegExp->RegFind(File2, offset) != -1) { - CStdString Title2 = itRegExp->GetMatch(1), + std::string Title2 = itRegExp->GetMatch(1), Volume2 = itRegExp->GetMatch(2), Ignore2 = itRegExp->GetMatch(3), Extension2 = itRegExp->GetMatch(4); if (offset) Title2 = File2.substr(0, itRegExp->GetSubStart(2)); - if (Title1.Equals(Title2)) + if (StringUtils::EqualsNoCase(Title1, Title2)) { - if (!Volume1.Equals(Volume2)) + if (!StringUtils::EqualsNoCase(Volume1, Volume2)) { - if (Ignore1.Equals(Ignore2) && Extension1.Equals(Extension2)) + if (StringUtils::EqualsNoCase(Ignore1, Ignore2) && + StringUtils::EqualsNoCase(Extension1, Extension2)) { // got it strStackTitle = Title1 + Ignore1 + Extension1; @@ -155,14 +157,14 @@ namespace XFILE return strStackTitlePath; } - CStdString CStackDirectory::GetFirstStackedFile(const CStdString &strPath) + std::string CStackDirectory::GetFirstStackedFile(const std::string &strPath) { // the stacked files are always in volume order, so just get up to the first filename // occurence of " , " - CStdString file, folder; + std::string file, folder; size_t pos = strPath.find(" , "); if (pos != std::string::npos) - URIUtils::Split((CStdString)strPath.substr(0, pos), folder, file); + URIUtils::Split(strPath.substr(0, pos), folder, file); else URIUtils::Split(strPath, folder, file); // single filed stacks - should really not happen @@ -173,12 +175,12 @@ namespace XFILE return URIUtils::AddFileToFolder(folder, file); } - bool CStackDirectory::GetPaths(const CStdString& strPath, vector<std::string>& vecPaths) + bool CStackDirectory::GetPaths(const std::string& strPath, vector<std::string>& vecPaths) { // format is: // stack://file1 , file2 , file3 , file4 // filenames with commas are double escaped (ie replaced with ,,), thus the " , " separator used. - CStdString path = strPath; + std::string path = strPath; // remove stack:// from the beginning path = path.substr(8); @@ -193,13 +195,13 @@ namespace XFILE return true; } - CStdString CStackDirectory::ConstructStackPath(const CFileItemList &items, const vector<int> &stack) + std::string CStackDirectory::ConstructStackPath(const CFileItemList &items, const vector<int> &stack) { // no checks on the range of stack here. // we replace all instances of comma's with double comma's, then separate // the files using " , ". - CStdString stackedPath = "stack://"; - CStdString folder, file; + std::string stackedPath = "stack://"; + std::string folder, file; URIUtils::Split(items[stack[0]]->GetPath(), folder, file); stackedPath += folder; // double escape any occurence of commas @@ -217,21 +219,6 @@ namespace XFILE return stackedPath; } - bool CStackDirectory::ConstructStackPath(const vector<CStdString> &paths, CStdString& stackedPath) - { - vector<string> pathsT; - pathsT.reserve(paths.size()); - for (vector<CStdString>::const_iterator path = paths.begin(); - path != paths.end(); ++path) - { - pathsT.push_back(*path); - } - std::string stackedPathT = stackedPath; - bool retVal = ConstructStackPath(pathsT, stackedPathT); - stackedPath = stackedPathT; - return retVal; - } - bool CStackDirectory::ConstructStackPath(const vector<std::string> &paths, std::string& stackedPath) { if (paths.size() < 2) diff --git a/xbmc/filesystem/StackDirectory.h b/xbmc/filesystem/StackDirectory.h index 89fb1d07d4..e3697f5ca9 100644 --- a/xbmc/filesystem/StackDirectory.h +++ b/xbmc/filesystem/StackDirectory.h @@ -20,8 +20,8 @@ */ #include "IDirectory.h" -#include "utils/StdString.h" #include "utils/RegExp.h" +#include <string> namespace XFILE { @@ -32,12 +32,11 @@ namespace XFILE ~CStackDirectory(); virtual bool GetDirectory(const CURL& url, CFileItemList& items); virtual bool AllowAll() const { return true; } - static CStdString GetStackedTitlePath(const CStdString &strPath); - static CStdString GetStackedTitlePath(const CStdString &strPath, VECCREGEXP& RegExps); - static CStdString GetFirstStackedFile(const CStdString &strPath); - static bool GetPaths(const CStdString& strPath, std::vector<std::string>& vecPaths); - static CStdString ConstructStackPath(const CFileItemList& items, const std::vector<int> &stack); - static bool ConstructStackPath(const std::vector<CStdString> &paths, CStdString &stackedPath); + static std::string GetStackedTitlePath(const std::string &strPath); + static std::string GetStackedTitlePath(const std::string &strPath, VECCREGEXP& RegExps); + static std::string GetFirstStackedFile(const std::string &strPath); + static bool GetPaths(const std::string& strPath, std::vector<std::string>& vecPaths); + static std::string ConstructStackPath(const CFileItemList& items, const std::vector<int> &stack); static bool ConstructStackPath(const std::vector<std::string> &paths, std::string &stackedPath); }; } diff --git a/xbmc/filesystem/TuxBoxDirectory.cpp b/xbmc/filesystem/TuxBoxDirectory.cpp index dd15104a0a..c86e3a28c4 100644 --- a/xbmc/filesystem/TuxBoxDirectory.cpp +++ b/xbmc/filesystem/TuxBoxDirectory.cpp @@ -43,24 +43,24 @@ CTuxBoxDirectory::~CTuxBoxDirectory(void) bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) { - const CStdString strPath = url2.Get(); + const std::string strPath = url2.Get(); // so we know that we have enigma2 static bool enigma2 = false; // Detect and delete slash at end - CStdString strRoot = strPath; + std::string strRoot = strPath; URIUtils::RemoveSlashAtEnd(strRoot); //Get the request strings - CStdString strBQRequest; - CStdString strXMLRootString; - CStdString strXMLChildString; + std::string strBQRequest; + std::string strXMLRootString; + std::string strXMLChildString; if(!GetRootAndChildString(strRoot, strBQRequest, strXMLRootString, strXMLChildString)) return false; //Set url Protocol CURL url(strRoot); - CStdString strFilter; - CStdString protocol = url.GetProtocol(); + std::string strFilter; + std::string protocol = url.GetProtocol(); url.SetProtocol("http"); bool bIsBouquet=false; @@ -78,7 +78,7 @@ bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) bIsBouquet = false; //On Empty is Bouquet if (enigma2) { - CStdString strPort = StringUtils::Format(":%i",url.GetPort()); + std::string strPort = StringUtils::Format(":%i",url.GetPort()); if (!StringUtils::EndsWith(strRoot, strPort)) // If not root dir, enable Channels strFilter = "e2"; // Disable Bouquets for Enigma2 @@ -114,7 +114,7 @@ bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) int size_read = 0; int size_total = (int)http.GetLength(); int data_size = 0; - CStdString data; + std::string data; data.reserve(size_total); // read response from server into string buffer @@ -138,7 +138,7 @@ bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) CLog::Log(LOGERROR, "%s - Sample follows...\n%s", __FUNCTION__, data.c_str()); return false; } - if( strXMLRootString.Equals(root->Value()) && bIsBouquet) + if(strXMLRootString == root->Value() && bIsBouquet) { data.clear(); if (enigma2) @@ -146,7 +146,7 @@ bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) else result = g_tuxbox.ParseBouquets(root, items, url, strFilter, strXMLChildString); } - else if( strXMLRootString.Equals(root->Value()) && !strFilter.empty() ) + else if( strXMLRootString == root->Value() && !strFilter.empty() ) { data.clear(); if (enigma2) @@ -186,7 +186,7 @@ bool CTuxBoxDirectory::GetDirectory(const CURL& url2, CFileItemList &items) return result; } -void CTuxBoxDirectory::GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString ) +void CTuxBoxDirectory::GetRootAndChildStringEnigma2(std::string& strBQRequest, std::string& strXMLRootString, std::string& strXMLChildString ) { // Allways take getallservices for Enigma2 strBQRequest = "web/getallservices"; //Bouquets and Channels @@ -194,7 +194,7 @@ void CTuxBoxDirectory::GetRootAndChildStringEnigma2(CStdString& strBQRequest, CS strXMLChildString = StringUtils::Format("e2bouquet"); } -bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString ) +bool CTuxBoxDirectory::GetRootAndChildString(const std::string strPath, std::string& strBQRequest, std::string& strXMLRootString, std::string& strXMLChildString ) { //Advanced Settings: RootMode! Movies: if(g_advancedSettings.m_iTuxBoxDefaultRootMenu == 3) //Movies! Fixed-> mode=3&submode=4 @@ -222,7 +222,7 @@ bool CTuxBoxDirectory::GetRootAndChildString(const CStdString strPath, CStdStrin // Detect the RootMode ! if (strPath.find("?mode=") != std::string::npos) { - CStdString strMode; + std::string strMode; bReqMoRe=false; strMode = g_tuxbox.DetectSubMode(strPath, strXMLRootString, strXMLChildString); } diff --git a/xbmc/filesystem/TuxBoxDirectory.h b/xbmc/filesystem/TuxBoxDirectory.h index 45c44a602a..9ef62c707f 100644 --- a/xbmc/filesystem/TuxBoxDirectory.h +++ b/xbmc/filesystem/TuxBoxDirectory.h @@ -20,7 +20,7 @@ */ #include "IDirectory.h" -#include "utils/StdString.h" +#include <string> class CURL; class TiXmlElement; @@ -36,8 +36,8 @@ namespace XFILE virtual bool AllowAll() const { return true; } virtual DIR_CACHE_TYPE GetCacheType(const CURL& url) const { return DIR_CACHE_ALWAYS; }; private: - bool GetRootAndChildString(const CStdString strPath, CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString ); - void GetRootAndChildStringEnigma2(CStdString& strBQRequest, CStdString& strXMLRootString, CStdString& strXMLChildString ); + bool GetRootAndChildString(const std::string strPath, std::string& strBQRequest, std::string& strXMLRootString, std::string& strXMLChildString ); + void GetRootAndChildStringEnigma2(std::string& strBQRequest, std::string& strXMLRootString, std::string& strXMLChildString ); }; } diff --git a/xbmc/filesystem/UDFDirectory.cpp b/xbmc/filesystem/UDFDirectory.cpp index b84e13144e..4d7872ca98 100644 --- a/xbmc/filesystem/UDFDirectory.cpp +++ b/xbmc/filesystem/UDFDirectory.cpp @@ -40,9 +40,9 @@ CUDFDirectory::~CUDFDirectory(void) bool CUDFDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString strRoot, strSub; + std::string strRoot, strSub; CURL url2(url); - if (url2.GetProtocol() != "udf") + if (!url2.IsProtocol("udf")) { // path to an image url2.SetProtocol("udf"); url2.SetHostName(url.Get()); @@ -57,7 +57,7 @@ bool CUDFDirectory::GetDirectory(const CURL& url, if(!udfIsoReader.Open(url.GetHostName().c_str())) return false; - udf_dir_t *dirp = udfIsoReader.OpenDir(strSub); + udf_dir_t *dirp = udfIsoReader.OpenDir(strSub.c_str()); if (dirp == NULL) return false; @@ -67,7 +67,7 @@ bool CUDFDirectory::GetDirectory(const CURL& url, { if (dp->d_type == DVD_DT_DIR) { - CStdString strDir = (char*)dp->d_name; + std::string strDir = (char*)dp->d_name; if (strDir != "." && strDir != "..") { CFileItemPtr pItem(new CFileItem((char*)dp->d_name)); diff --git a/xbmc/filesystem/UPnPDirectory.cpp b/xbmc/filesystem/UPnPDirectory.cpp index 25d765e8af..baec883212 100644 --- a/xbmc/filesystem/UPnPDirectory.cpp +++ b/xbmc/filesystem/UPnPDirectory.cpp @@ -42,7 +42,7 @@ using namespace UPNP; namespace XFILE { -static CStdString GetContentMapping(NPT_String& objectClass) +static std::string GetContentMapping(NPT_String& objectClass) { struct SClassMapping { @@ -150,8 +150,8 @@ bool CUPnPDirectory::GetResource(const CURL& path, CFileItem &item) if(!upnp) return false; - CStdString uuid = path.GetHostName(); - CStdString object = path.GetFileName(); + std::string uuid = path.GetHostName(); + std::string object = path.GetFileName(); StringUtils::TrimRight(object, "/"); object = CURL::Decode(object); @@ -208,7 +208,7 @@ CUPnPDirectory::GetDirectory(const CURL& url, CFileItemList &items) NPT_String uuid = (*device)->GetUUID(); CFileItemPtr pItem(new CFileItem((const char*)name)); - pItem->SetPath(CStdString((const char*) "upnp://" + uuid + "/")); + pItem->SetPath(std::string((const char*) "upnp://" + uuid + "/")); pItem->m_bIsFolder = true; pItem->SetArt("thumb", (const char*)(*device)->GetIconUrl("image/png")); @@ -226,7 +226,7 @@ CUPnPDirectory::GetDirectory(const CURL& url, CFileItemList &items) NPT_String object_id = (next_slash==-1)?"":path.SubString(next_slash+1); object_id.TrimRight("/"); if (object_id.GetLength()) { - object_id = CStdString(CURL::Decode((char*)object_id)); + object_id = CURL::Decode((char*)object_id).c_str(); } // try to find the device with wait on startup @@ -326,7 +326,7 @@ CUPnPDirectory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CStdString id; + std::string id; if ((*entry)->m_ReferenceID.IsEmpty()) id = (const char*) (*entry)->m_ObjectID; else @@ -334,7 +334,7 @@ CUPnPDirectory::GetDirectory(const CURL& url, CFileItemList &items) id = CURL::Encode(id); URIUtils::AddSlashAtEnd(id); - pItem->SetPath(CStdString((const char*) "upnp://" + uuid + "/" + id.c_str())); + pItem->SetPath(std::string((const char*) "upnp://" + uuid + "/" + id.c_str())); items.Add(pItem); diff --git a/xbmc/filesystem/VTPDirectory.cpp b/xbmc/filesystem/VTPDirectory.cpp index b063315b40..c67f3fe0e6 100644 --- a/xbmc/filesystem/VTPDirectory.cpp +++ b/xbmc/filesystem/VTPDirectory.cpp @@ -50,7 +50,7 @@ bool CVTPDirectory::GetChannels(const std::string& base, CFileItemList &items) { CFileItemPtr item(new CFileItem("", false)); - CStdString buffer = StringUtils::Format("%s/%d.ts", base.c_str(), it->index); + std::string buffer = StringUtils::Format("%s/%d.ts", base.c_str(), it->index); item->SetPath(buffer); item->m_strTitle = it->name; buffer = StringUtils::Format("%d - %s", it->index, it->name.c_str()); @@ -68,7 +68,7 @@ bool CVTPDirectory::GetDirectory(const CURL& url2, CFileItemList &items) if(url.GetHostName() == "") url.SetHostName("localhost"); - CStdString base = url.Get(); + std::string base = url.Get(); URIUtils::RemoveSlashAtEnd(base); // add port after, it changes the structure diff --git a/xbmc/filesystem/VTPFile.cpp b/xbmc/filesystem/VTPFile.cpp index 04086955f5..64a8bd9ee1 100644 --- a/xbmc/filesystem/VTPFile.cpp +++ b/xbmc/filesystem/VTPFile.cpp @@ -64,12 +64,12 @@ bool CVTPFile::Open(const CURL& url2) if(url.GetPort() == 0) url.SetPort(2004); - CStdString path(url.GetFileName()); + std::string path(url.GetFileName()); if (StringUtils::StartsWith(path, "channels/")) { - CStdString channel = path.substr(9); + std::string channel = path.substr(9); if(!URIUtils::HasExtension(channel, ".ts")) { CLog::Log(LOGERROR, "%s - invalid channel url %s", __FUNCTION__, channel.c_str()); diff --git a/xbmc/filesystem/VTPFile.h b/xbmc/filesystem/VTPFile.h index 55473dcd3b..f84dc5015a 100644 --- a/xbmc/filesystem/VTPFile.h +++ b/xbmc/filesystem/VTPFile.h @@ -42,7 +42,7 @@ public: virtual int Stat(const CURL& url, struct __stat64* buffer) { return -1; } virtual void Close(); virtual unsigned int Read(void* buffer, int64_t size); - virtual CStdString GetContent() { return ""; } + virtual std::string GetContent() { return ""; } virtual bool SkipNext() { return m_socket ? true : false; } virtual bool Delete(const CURL& url) { return false; } diff --git a/xbmc/filesystem/VideoDatabaseDirectory.cpp b/xbmc/filesystem/VideoDatabaseDirectory.cpp index 48febf073e..5eae9eee09 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory.cpp @@ -46,7 +46,7 @@ CVideoDatabaseDirectory::~CVideoDatabaseDirectory(void) bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(url); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url); items.SetPath(path); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); @@ -59,7 +59,7 @@ bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items CFileItemPtr item = items[i]; if (item->m_bIsFolder && !item->HasIcon() && !item->HasArt("thumb")) { - CStdString strImage = GetIcon(item->GetPath()); + std::string strImage = GetIcon(item->GetPath()); if (!strImage.empty() && g_TextureManager.HasTexture(strImage)) item->SetIconImage(strImage); } @@ -69,9 +69,9 @@ bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items return bResult; } -NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const CStdString& strPath) +NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -80,9 +80,9 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryChildType(const CStdString& strPa return pNode->GetChildType(); } -NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const CStdString& strPath) +NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -91,9 +91,9 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryType(const CStdString& strPath) return pNode->GetType(); } -NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const CStdString& strPath) +NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -107,9 +107,9 @@ NODE_TYPE CVideoDatabaseDirectory::GetDirectoryParentType(const CStdString& strP return pParentNode->GetChildType(); } -bool CVideoDatabaseDirectory::GetQueryParams(const CStdString& strPath, CQueryParams& params) +bool CVideoDatabaseDirectory::GetQueryParams(const std::string& strPath, CQueryParams& params) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -119,30 +119,30 @@ bool CVideoDatabaseDirectory::GetQueryParams(const CStdString& strPath, CQueryPa return true; } -void CVideoDatabaseDirectory::ClearDirectoryCache(const CStdString& strDirectory) +void CVideoDatabaseDirectory::ClearDirectoryCache(const std::string& strDirectory) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); URIUtils::RemoveSlashAtEnd(path); Crc32 crc; crc.ComputeFromLowerCase(path); - CStdString strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc); + std::string strFileName = StringUtils::Format("special://temp/%08x.fi", (unsigned __int32) crc); CFile::Delete(strFileName); } -bool CVideoDatabaseDirectory::IsAllItem(const CStdString& strDirectory) +bool CVideoDatabaseDirectory::IsAllItem(const std::string& strDirectory) { if (StringUtils::EndsWith(strDirectory, "/-1/")) return true; return false; } -bool CVideoDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdString& strLabel) +bool CVideoDatabaseDirectory::GetLabel(const std::string& strDirectory, std::string& strLabel) { strLabel = ""; - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get() || path.empty()) return false; @@ -174,7 +174,7 @@ bool CVideoDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdStrin // get year if (params.GetYear() != -1) { - CStdString strTemp = StringUtils::Format("%i",params.GetYear()); + std::string strTemp = StringUtils::Format("%i",params.GetYear()); if (!strLabel.empty()) strLabel += " / "; strLabel += strTemp; @@ -228,13 +228,13 @@ bool CVideoDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdStrin return true; } -CStdString CVideoDatabaseDirectory::GetIcon(const CStdString &strDirectory) +std::string CVideoDatabaseDirectory::GetIcon(const std::string &strDirectory) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); switch (GetDirectoryChildType(path)) { case NODE_TYPE_TITLE_MOVIES: - if (path.Equals("videodb://movies/titles/")) + if (URIUtils::PathEquals(path, "videodb://movies/titles/")) { if (CSettings::Get().GetBool("myvideos.flatten")) return "DefaultMovies.png"; @@ -242,7 +242,7 @@ CStdString CVideoDatabaseDirectory::GetIcon(const CStdString &strDirectory) } return ""; case NODE_TYPE_TITLE_TVSHOWS: - if (path.Equals("videodb://tvshows/titles/")) + if (URIUtils::PathEquals(path, "videodb://tvshows/titles/")) { if (CSettings::Get().GetBool("myvideos.flatten")) return "DefaultTVShows.png"; @@ -250,7 +250,7 @@ CStdString CVideoDatabaseDirectory::GetIcon(const CStdString &strDirectory) } return ""; case NODE_TYPE_TITLE_MUSICVIDEOS: - if (path.Equals("videodb://musicvideos/titles/")) + if (URIUtils::PathEquals(path, "videodb://musicvideos/titles/")) { if (CSettings::Get().GetBool("myvideos.flatten")) return "DefaultMusicVideos.png"; @@ -294,7 +294,7 @@ CStdString CVideoDatabaseDirectory::GetIcon(const CStdString &strDirectory) return ""; } -bool CVideoDatabaseDirectory::ContainsMovies(const CStdString &path) +bool CVideoDatabaseDirectory::ContainsMovies(const std::string &path) { VIDEODATABASEDIRECTORY::NODE_TYPE type = GetDirectoryChildType(path); if (type == VIDEODATABASEDIRECTORY::NODE_TYPE_TITLE_MOVIES || type == VIDEODATABASEDIRECTORY::NODE_TYPE_EPISODES || type == VIDEODATABASEDIRECTORY::NODE_TYPE_TITLE_MUSICVIDEOS) return true; @@ -303,7 +303,7 @@ bool CVideoDatabaseDirectory::ContainsMovies(const CStdString &path) bool CVideoDatabaseDirectory::Exists(const CURL& url) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(url); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) @@ -315,9 +315,9 @@ bool CVideoDatabaseDirectory::Exists(const CURL& url) return true; } -bool CVideoDatabaseDirectory::CanCache(const CStdString& strPath) +bool CVideoDatabaseDirectory::CanCache(const std::string& strPath) { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; diff --git a/xbmc/filesystem/VideoDatabaseDirectory.h b/xbmc/filesystem/VideoDatabaseDirectory.h index 69598d17a4..5ec0e429ad 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory.h +++ b/xbmc/filesystem/VideoDatabaseDirectory.h @@ -33,15 +33,15 @@ namespace XFILE virtual bool GetDirectory(const CURL& url, CFileItemList &items); virtual bool Exists(const CURL& url); virtual bool AllowAll() const { return true; } - static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryChildType(const CStdString& strPath); - static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryType(const CStdString& strPath); - static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryParentType(const CStdString& strPath); - static bool GetQueryParams(const CStdString& strPath, VIDEODATABASEDIRECTORY::CQueryParams& params); - void ClearDirectoryCache(const CStdString& strDirectory); - static bool IsAllItem(const CStdString& strDirectory); - static bool GetLabel(const CStdString& strDirectory, CStdString& strLabel); - static CStdString GetIcon(const CStdString& strDirectory); - bool ContainsMovies(const CStdString &path); - static bool CanCache(const CStdString &path); + static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryChildType(const std::string& strPath); + static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryType(const std::string& strPath); + static VIDEODATABASEDIRECTORY::NODE_TYPE GetDirectoryParentType(const std::string& strPath); + static bool GetQueryParams(const std::string& strPath, VIDEODATABASEDIRECTORY::CQueryParams& params); + void ClearDirectoryCache(const std::string& strDirectory); + static bool IsAllItem(const std::string& strDirectory); + static bool GetLabel(const std::string& strDirectory, std::string& strLabel); + static std::string GetIcon(const std::string& strDirectory); + bool ContainsMovies(const std::string &path); + static bool CanCache(const std::string &path); }; } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp index 917f22a322..55b60d99e4 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp @@ -49,7 +49,7 @@ using namespace std; using namespace XFILE::VIDEODATABASEDIRECTORY; // Constructor is protected use ParseURL() -CDirectoryNode::CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNode::CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent) { m_Type=Type; m_strName=strName; @@ -62,11 +62,11 @@ CDirectoryNode::~CDirectoryNode() } // Parses a given path and returns the current node of the path -CDirectoryNode* CDirectoryNode::ParseURL(const CStdString& strPath) +CDirectoryNode* CDirectoryNode::ParseURL(const std::string& strPath) { CURL url(strPath); - CStdString strDirectory=url.GetFileName(); + std::string strDirectory=url.GetFileName(); URIUtils::RemoveSlashAtEnd(strDirectory); vector<string> Path = StringUtils::Split(strDirectory, "/"); @@ -91,7 +91,7 @@ CDirectoryNode* CDirectoryNode::ParseURL(const CStdString& strPath) } // returns the database ids of the path, -void CDirectoryNode::GetDatabaseInfo(const CStdString& strPath, CQueryParams& params) +void CDirectoryNode::GetDatabaseInfo(const std::string& strPath, CQueryParams& params) { auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath)); @@ -102,7 +102,7 @@ void CDirectoryNode::GetDatabaseInfo(const CStdString& strPath, CQueryParams& pa } // Create a node object -CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent) { switch (Type) { @@ -150,7 +150,7 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& str } // Current node name -const CStdString& CDirectoryNode::GetName() const +const std::string& CDirectoryNode::GetName() const { return m_strName; } @@ -160,7 +160,7 @@ int CDirectoryNode::GetID() const return atoi(m_strName.c_str()); } -CStdString CDirectoryNode::GetLocalizedName() const +std::string CDirectoryNode::GetLocalizedName() const { return ""; } @@ -191,7 +191,7 @@ bool CDirectoryNode::GetContent(CFileItemList& items) const } // Creates a videodb url -CStdString CDirectoryNode::BuildPath() const +std::string CDirectoryNode::BuildPath() const { vector<string> array; @@ -201,14 +201,14 @@ CStdString CDirectoryNode::BuildPath() const CDirectoryNode* pParent=m_pParent; while (pParent!=NULL) { - const CStdString& strNodeName=pParent->GetName(); + const std::string& strNodeName=pParent->GetName(); if (!strNodeName.empty()) array.insert(array.begin(), strNodeName); pParent=pParent->GetParent(); } - CStdString strPath="videodb://"; + std::string strPath="videodb://"; for (int i=0; i<(int)array.size(); ++i) strPath+=array[i]+"/"; @@ -219,7 +219,7 @@ CStdString CDirectoryNode::BuildPath() const return strPath; } -void CDirectoryNode::AddOptions(const CStdString &options) +void CDirectoryNode::AddOptions(const std::string &options) { if (options.empty()) return; @@ -302,7 +302,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) const { case NODE_TYPE_SEASONS: { - CStdString strLabel = g_localizeStrings.Get(20366); + std::string strLabel = g_localizeStrings.Get(20366); pItem.reset(new CFileItem(strLabel)); // "All Seasons" videoUrl.AppendPath("-1/"); pItem->SetPath(videoUrl.ToString()); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.h index edc8511ae8..ff5125e005 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.h @@ -19,8 +19,8 @@ * */ -#include "utils/StdString.h" #include "utils/UrlOptions.h" +#include <string> class CFileItemList; @@ -66,40 +66,40 @@ namespace XFILE class CDirectoryNode { public: - static CDirectoryNode* ParseURL(const CStdString& strPath); - static void GetDatabaseInfo(const CStdString& strPath, CQueryParams& params); + static CDirectoryNode* ParseURL(const std::string& strPath); + static void GetDatabaseInfo(const std::string& strPath, CQueryParams& params); virtual ~CDirectoryNode(); NODE_TYPE GetType() const; bool GetChilds(CFileItemList& items); virtual NODE_TYPE GetChildType() const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; CDirectoryNode* GetParent() const; bool CanCache() const; protected: - CDirectoryNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent); - static CDirectoryNode* CreateNode(NODE_TYPE Type, const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); + static CDirectoryNode* CreateNode(NODE_TYPE Type, const std::string& strName, CDirectoryNode* pParent); - void AddOptions(const CStdString &options); + void AddOptions(const std::string &options); void CollectQueryParams(CQueryParams& params) const; - const CStdString& GetName() const; + const std::string& GetName() const; int GetID() const; void RemoveParent(); virtual bool GetContent(CFileItemList& items) const; - CStdString BuildPath() const; + std::string BuildPath() const; private: void AddQueuingFolder(CFileItemList& items) const; private: NODE_TYPE m_Type; - CStdString m_strName; + std::string m_strName; CDirectoryNode* m_pParent; CUrlOptions m_options; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.cpp index 7a25d5eea7..4f91e6856b 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.cpp @@ -24,7 +24,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeEpisodes::CDirectoryNodeEpisodes(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeEpisodes::CDirectoryNodeEpisodes(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_EPISODES, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.h index 0663fe3855..7afb8ebb8a 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeEpisodes.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeEpisodes : public CDirectoryNode { public: - CDirectoryNodeEpisodes(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeEpisodes(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp index bb62dc7b04..3750d5a7b1 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.cpp @@ -25,7 +25,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeGrouped::CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeGrouped::CDirectoryNodeGrouped(NODE_TYPE type, const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(type, strName, pParent) { } @@ -47,7 +47,7 @@ NODE_TYPE CDirectoryNodeGrouped::GetChildType() const return NODE_TYPE_TITLE_TVSHOWS; } -CStdString CDirectoryNodeGrouped::GetLocalizedName() const +std::string CDirectoryNodeGrouped::GetLocalizedName() const { CVideoDatabase db; if (db.Open()) diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.h index 2ed556188b..40890d092c 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeGrouped.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeGrouped : public CDirectoryNode { public: - CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeGrouped(NODE_TYPE type, const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; private: std::string GetContentType() const; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp index 0dd63996db..a2e1564bb3 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp @@ -40,7 +40,7 @@ Node MovieChildren[] = { { NODE_TYPE_TAGS, "tags", 20459 } }; -CDirectoryNodeMoviesOverview::CDirectoryNodeMoviesOverview(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeMoviesOverview::CDirectoryNodeMoviesOverview(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_MOVIES_OVERVIEW, strName, pParent) { @@ -49,16 +49,16 @@ CDirectoryNodeMoviesOverview::CDirectoryNodeMoviesOverview(const CStdString& str NODE_TYPE CDirectoryNodeMoviesOverview::GetChildType() const { for (unsigned int i = 0; i < sizeof(MovieChildren) / sizeof(Node); ++i) - if (GetName().Equals(MovieChildren[i].id.c_str())) + if (GetName() == MovieChildren[i].id) return MovieChildren[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeMoviesOverview::GetLocalizedName() const +std::string CDirectoryNodeMoviesOverview::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(MovieChildren) / sizeof(Node); ++i) - if (GetName().Equals(MovieChildren[i].id.c_str())) + if (GetName() == MovieChildren[i].id) return g_localizeStrings.Get(MovieChildren[i].label); return ""; } @@ -79,7 +79,7 @@ bool CDirectoryNodeMoviesOverview::GetContent(CFileItemList& items) const } CVideoDbUrl itemUrl = videoUrl; - CStdString strDir = StringUtils::Format("%s/", MovieChildren[i].id.c_str()); + std::string strDir = StringUtils::Format("%s/", MovieChildren[i].id.c_str()); itemUrl.AppendPath(strDir); CFileItemPtr pItem(new CFileItem(itemUrl.ToString(), true)); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.h index 579e879f6e..62a3876719 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeMoviesOverview : public CDirectoryNode { public: - CDirectoryNodeMoviesOverview(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeMoviesOverview(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp index 6a4734a021..d4605a94cb 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.cpp @@ -37,7 +37,7 @@ Node MusicVideoChildren[] = { { NODE_TYPE_TAGS, "tags", 20459 } }; -CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_MUSICVIDEOS_OVERVIEW, strName, pParent) { @@ -46,16 +46,16 @@ CDirectoryNodeMusicVideosOverview::CDirectoryNodeMusicVideosOverview(const CStdS NODE_TYPE CDirectoryNodeMusicVideosOverview::GetChildType() const { for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i) - if (GetName().Equals(MusicVideoChildren[i].id.c_str())) + if (GetName() == MusicVideoChildren[i].id) return MusicVideoChildren[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeMusicVideosOverview::GetLocalizedName() const +std::string CDirectoryNodeMusicVideosOverview::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(MusicVideoChildren) / sizeof(Node); ++i) - if (GetName().Equals(MusicVideoChildren[i].id.c_str())) + if (GetName() == MusicVideoChildren[i].id) return g_localizeStrings.Get(MusicVideoChildren[i].label); return ""; } @@ -71,7 +71,7 @@ bool CDirectoryNodeMusicVideosOverview::GetContent(CFileItemList& items) const CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(MusicVideoChildren[i].label))); CVideoDbUrl itemUrl = videoUrl; - CStdString strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str()); + std::string strDir = StringUtils::Format("%s/", MusicVideoChildren[i].id.c_str()); itemUrl.AppendPath(strDir); pItem->SetPath(itemUrl.ToString()); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.h index 81eb501cff..df12b1567e 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMusicVideosOverview.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeMusicVideosOverview : public CDirectoryNode { public: - CDirectoryNodeMusicVideosOverview(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeMusicVideosOverview(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp index 563fcfa8a6..a2f4a7e576 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.cpp @@ -24,6 +24,7 @@ #include "FileItem.h" #include "guilib/LocalizeStrings.h" #include "video/VideoDbUrl.h" +#include "utils/StringUtils.h" using namespace XFILE::VIDEODATABASEDIRECTORY; using namespace std; @@ -38,7 +39,7 @@ Node OverviewChildren[] = { { NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS, "recentlyaddedmusicvideos", 20390 }, }; -CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeOverview::CDirectoryNodeOverview(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_OVERVIEW, strName, pParent) { @@ -47,16 +48,16 @@ CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirec NODE_TYPE CDirectoryNodeOverview::GetChildType() const { for (unsigned int i = 0; i < sizeof(OverviewChildren) / sizeof(Node); ++i) - if (GetName().Equals(OverviewChildren[i].id.c_str())) + if (GetName() == OverviewChildren[i].id) return OverviewChildren[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeOverview::GetLocalizedName() const +std::string CDirectoryNodeOverview::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(OverviewChildren) / sizeof(Node); ++i) - if (GetName().Equals(OverviewChildren[i].id.c_str())) + if (GetName() == OverviewChildren[i].id) return g_localizeStrings.Get(OverviewChildren[i].label); return ""; } @@ -98,7 +99,7 @@ bool CDirectoryNodeOverview::GetContent(CFileItemList& items) const if (hasMusicVideos) vec.push_back(make_pair("recentlyaddedmusicvideos", 20390)); // Recently Added Music Videos } - CStdString path = BuildPath(); + std::string path = BuildPath(); for (unsigned int i = 0; i < vec.size(); ++i) { CFileItemPtr pItem(new CFileItem(path + vec[i].first + "/", true)); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.h index 848a9fddc5..426542d10a 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeOverview.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeOverview : public CDirectoryNode { public: - CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeOverview(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.cpp index ddf8416cc1..f3d4b1b170 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.cpp @@ -23,7 +23,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeRecentlyAddedEpisodes::CDirectoryNodeRecentlyAddedEpisodes(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeRecentlyAddedEpisodes::CDirectoryNodeRecentlyAddedEpisodes(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_RECENTLY_ADDED_EPISODES, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.h index d5a19cdfd0..eba7a4dc0f 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedEpisodes.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeRecentlyAddedEpisodes : public CDirectoryNode { public: - CDirectoryNodeRecentlyAddedEpisodes(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeRecentlyAddedEpisodes(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.cpp index 500bf590eb..e73e9922b1 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.cpp @@ -23,7 +23,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeRecentlyAddedMovies::CDirectoryNodeRecentlyAddedMovies(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeRecentlyAddedMovies::CDirectoryNodeRecentlyAddedMovies(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_RECENTLY_ADDED_MOVIES, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.h index fa84f1309d..02fdf24599 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMovies.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeRecentlyAddedMovies : public CDirectoryNode { public: - CDirectoryNodeRecentlyAddedMovies(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeRecentlyAddedMovies(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.cpp index 8e2e9919a1..7ea50599f4 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.cpp @@ -23,7 +23,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeRecentlyAddedMusicVideos::CDirectoryNodeRecentlyAddedMusicVideos(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeRecentlyAddedMusicVideos::CDirectoryNodeRecentlyAddedMusicVideos(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.h index d03c7b0789..e9bc6427fb 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRecentlyAddedMusicVideos.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeRecentlyAddedMusicVideos : public CDirectoryNode { public: - CDirectoryNodeRecentlyAddedMusicVideos(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeRecentlyAddedMusicVideos(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.cpp index d156637d04..1c13098f14 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.cpp @@ -22,7 +22,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeRoot::CDirectoryNodeRoot(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeRoot::CDirectoryNodeRoot(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_ROOT, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.h index 053de8781a..159abff6f9 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeRoot.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeRoot : public CDirectoryNode { public: - CDirectoryNodeRoot(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeRoot(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp index 6629f1c9da..cd3054bb17 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp @@ -30,7 +30,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeSeasons::CDirectoryNodeSeasons(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeSeasons::CDirectoryNodeSeasons(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_SEASONS, strName, pParent) { @@ -41,7 +41,7 @@ NODE_TYPE CDirectoryNodeSeasons::GetChildType() const return NODE_TYPE_EPISODES; } -CStdString CDirectoryNodeSeasons::GetLocalizedName() const +std::string CDirectoryNodeSeasons::GetLocalizedName() const { switch (GetID()) { @@ -57,7 +57,7 @@ CStdString CDirectoryNodeSeasons::GetLocalizedName() const return ""; } default: - CStdString season = StringUtils::Format(g_localizeStrings.Get(20358).c_str(), GetID()); // Season <season> + std::string season = StringUtils::Format(g_localizeStrings.Get(20358).c_str(), GetID()); // Season <season> return season; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.h index 4370aed7d6..9eb8f9304c 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeSeasons.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeSeasons : public CDirectoryNode { public: - CDirectoryNodeSeasons(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeSeasons(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.cpp index 36d191e1b0..7f44793180 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.cpp @@ -24,7 +24,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeTitleMovies::CDirectoryNodeTitleMovies(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeTitleMovies::CDirectoryNodeTitleMovies(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_TITLE_MOVIES, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.h index 03cbb19852..cfcd82004b 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMovies.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeTitleMovies : public CDirectoryNode { public: - CDirectoryNodeTitleMovies(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeTitleMovies(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& items) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.cpp index 5a385f3aed..20ae2c0e30 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.cpp @@ -24,7 +24,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeTitleMusicVideos::CDirectoryNodeTitleMusicVideos(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeTitleMusicVideos::CDirectoryNodeTitleMusicVideos(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_TITLE_MUSICVIDEOS, strName, pParent) { diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.h index 29288454f5..58c7761bba 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleMusicVideos.h @@ -28,7 +28,7 @@ namespace XFILE class CDirectoryNodeTitleMusicVideos : public CDirectoryNode { public: - CDirectoryNodeTitleMusicVideos(const CStdString& strEntryName, CDirectoryNode* pParent); + CDirectoryNodeTitleMusicVideos(const std::string& strEntryName, CDirectoryNode* pParent); protected: virtual bool GetContent(CFileItemList& item) const; }; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.cpp index eb8c19af40..929a23a530 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.cpp @@ -24,7 +24,7 @@ using namespace XFILE::VIDEODATABASEDIRECTORY; -CDirectoryNodeTitleTvShows::CDirectoryNodeTitleTvShows(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeTitleTvShows::CDirectoryNodeTitleTvShows(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_TITLE_TVSHOWS, strName, pParent) { @@ -35,7 +35,7 @@ NODE_TYPE CDirectoryNodeTitleTvShows::GetChildType() const return NODE_TYPE_SEASONS; } -CStdString CDirectoryNodeTitleTvShows::GetLocalizedName() const +std::string CDirectoryNodeTitleTvShows::GetLocalizedName() const { CVideoDatabase db; if (db.Open()) diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.h index e330eb0a39..9df8201f8e 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTitleTvShows.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeTitleTvShows : public CDirectoryNode { public: - CDirectoryNodeTitleTvShows(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeTitleTvShows(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.cpp index 6e5e4ecc3f..ee494b1b75 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.cpp @@ -35,7 +35,7 @@ Node TvShowChildren[] = { { NODE_TYPE_TAGS, "tags", 20459 } }; -CDirectoryNodeTvShowsOverview::CDirectoryNodeTvShowsOverview(const CStdString& strName, CDirectoryNode* pParent) +CDirectoryNodeTvShowsOverview::CDirectoryNodeTvShowsOverview(const std::string& strName, CDirectoryNode* pParent) : CDirectoryNode(NODE_TYPE_TVSHOWS_OVERVIEW, strName, pParent) { @@ -47,16 +47,16 @@ NODE_TYPE CDirectoryNodeTvShowsOverview::GetChildType() const return NODE_TYPE_EPISODES; for (unsigned int i = 0; i < sizeof(TvShowChildren) / sizeof(Node); ++i) - if (GetName().Equals(TvShowChildren[i].id.c_str())) + if (GetName() == TvShowChildren[i].id) return TvShowChildren[i].node; return NODE_TYPE_NONE; } -CStdString CDirectoryNodeTvShowsOverview::GetLocalizedName() const +std::string CDirectoryNodeTvShowsOverview::GetLocalizedName() const { for (unsigned int i = 0; i < sizeof(TvShowChildren) / sizeof(Node); ++i) - if (GetName().Equals(TvShowChildren[i].id.c_str())) + if (GetName() == TvShowChildren[i].id) return g_localizeStrings.Get(TvShowChildren[i].label); return ""; } @@ -72,7 +72,7 @@ bool CDirectoryNodeTvShowsOverview::GetContent(CFileItemList& items) const CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(TvShowChildren[i].label))); CVideoDbUrl itemUrl = videoUrl; - CStdString strDir = StringUtils::Format("%s/", TvShowChildren[i].id.c_str()); + std::string strDir = StringUtils::Format("%s/", TvShowChildren[i].id.c_str()); itemUrl.AppendPath(strDir); pItem->SetPath(itemUrl.ToString()); diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.h b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.h index d5d4e915b4..133ed976d4 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeTvShowsOverview.h @@ -28,11 +28,11 @@ namespace XFILE class CDirectoryNodeTvShowsOverview : public CDirectoryNode { public: - CDirectoryNodeTvShowsOverview(const CStdString& strName, CDirectoryNode* pParent); + CDirectoryNodeTvShowsOverview(const std::string& strName, CDirectoryNode* pParent); protected: virtual NODE_TYPE GetChildType() const; virtual bool GetContent(CFileItemList& items) const; - virtual CStdString GetLocalizedName() const; + virtual std::string GetLocalizedName() const; }; } } diff --git a/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.cpp b/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.cpp index bdbee252ff..86c25bdd7e 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.cpp @@ -20,6 +20,7 @@ #include "QueryParams.h" #include "video/VideoDatabase.h" +#include "utils/StringUtils.h" using namespace XFILE::VIDEODATABASEDIRECTORY; @@ -42,16 +43,16 @@ CQueryParams::CQueryParams() m_idTag = -1; } -void CQueryParams::SetQueryParam(NODE_TYPE NodeType, const CStdString& strNodeName) +void CQueryParams::SetQueryParam(NODE_TYPE NodeType, const std::string& strNodeName) { long idDb=atol(strNodeName.c_str()); switch (NodeType) { case NODE_TYPE_OVERVIEW: - if (strNodeName.Equals("tvshows")) + if (strNodeName == "tvshows") m_idContent = VIDEODB_CONTENT_TVSHOWS; - else if (strNodeName.Equals("musicvideos")) + else if (strNodeName == "musicvideos") m_idContent = VIDEODB_CONTENT_MUSICVIDEOS; else m_idContent = VIDEODB_CONTENT_MOVIES; diff --git a/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.h b/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.h index f1fd5ec67a..b30462daa2 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.h +++ b/xbmc/filesystem/VideoDatabaseDirectory/QueryParams.h @@ -46,7 +46,7 @@ namespace XFILE long GetTagId() const { return m_idTag; } protected: - void SetQueryParam(NODE_TYPE NodeType, const CStdString& strNodeName); + void SetQueryParam(NODE_TYPE NodeType, const std::string& strNodeName); friend class CDirectoryNode; private: diff --git a/xbmc/filesystem/VirtualDirectory.cpp b/xbmc/filesystem/VirtualDirectory.cpp index 4b431fc543..088007a9b7 100644 --- a/xbmc/filesystem/VirtualDirectory.cpp +++ b/xbmc/filesystem/VirtualDirectory.cpp @@ -75,7 +75,7 @@ bool CVirtualDirectory::GetDirectory(const CURL& url, CFileItemList &items) } bool CVirtualDirectory::GetDirectory(const CURL& url, CFileItemList &items, bool bUseFileDirectories) { - CStdString strPath = url.Get(); + std::string strPath = url.Get(); int flags = m_flags; if (!bUseFileDirectories) flags |= DIR_FLAG_NO_FILE_DIRS; @@ -103,9 +103,9 @@ bool CVirtualDirectory::GetDirectory(const CURL& url, CFileItemList &items, bool \note The parameter \e strPath can not be a share with directory. Eg. "iso9660://dir" will return \e false. It must be "iso9660://". */ -bool CVirtualDirectory::IsSource(const CStdString& strPath, VECSOURCES *sources, CStdString *name) const +bool CVirtualDirectory::IsSource(const std::string& strPath, VECSOURCES *sources, std::string *name) const { - CStdString strPathCpy = strPath; + std::string strPathCpy = strPath; StringUtils::TrimRight(strPathCpy, "/\\"); // just to make sure there's no mixed slashing in share/default defines @@ -122,7 +122,7 @@ bool CVirtualDirectory::IsSource(const CStdString& strPath, VECSOURCES *sources, for (int i = 0; i < (int)shares.size(); ++i) { const CMediaSource& share = shares.at(i); - CStdString strShare = share.strPath; + std::string strShare = share.strPath; StringUtils::TrimRight(strShare, "/\\"); if(URIUtils::IsDOSPath(strShare)) StringUtils::Replace(strShare, '/', '\\'); @@ -143,7 +143,7 @@ bool CVirtualDirectory::IsSource(const CStdString& strPath, VECSOURCES *sources, \note The parameter \e path CAN be a share with directory. Eg. "iso9660://dir" will return the same as "iso9660://". */ -bool CVirtualDirectory::IsInSource(const CStdString &path) const +bool CVirtualDirectory::IsInSource(const std::string &path) const { bool isSourceName; VECSOURCES shares; diff --git a/xbmc/filesystem/VirtualDirectory.h b/xbmc/filesystem/VirtualDirectory.h index cd87635c73..9a1a8d8723 100644 --- a/xbmc/filesystem/VirtualDirectory.h +++ b/xbmc/filesystem/VirtualDirectory.h @@ -42,8 +42,8 @@ namespace XFILE return m_vecSources.size(); } - bool IsSource(const CStdString& strPath, VECSOURCES *sources = NULL, CStdString *name = NULL) const; - bool IsInSource(const CStdString& strPath) const; + bool IsSource(const std::string& strPath, VECSOURCES *sources = NULL, std::string *name = NULL) const; + bool IsInSource(const std::string& strPath) const; inline const CMediaSource& operator [](const int index) const { diff --git a/xbmc/filesystem/ZeroconfDirectory.cpp b/xbmc/filesystem/ZeroconfDirectory.cpp index 8a5a3ddd44..7bacbd31db 100644 --- a/xbmc/filesystem/ZeroconfDirectory.cpp +++ b/xbmc/filesystem/ZeroconfDirectory.cpp @@ -41,7 +41,7 @@ CZeroconfDirectory::~CZeroconfDirectory() namespace { - CStdString GetHumanReadableProtocol(std::string const& fcr_service_type) + std::string GetHumanReadableProtocol(std::string const& fcr_service_type) { if(fcr_service_type == "_smb._tcp.") return "SAMBA"; @@ -62,7 +62,7 @@ namespace //fallback, just return the received type return fcr_service_type; } - bool GetXBMCProtocol(std::string const& fcr_service_type, CStdString& fr_protocol) + bool GetXBMCProtocol(std::string const& fcr_service_type, std::string& fr_protocol) { if(fcr_service_type == "_smb._tcp.") fr_protocol = "smb"; @@ -96,9 +96,9 @@ bool GetDirectoryFromTxtRecords(CZeroconfBrowser::ZeroconfService zeroconf_servi //if we have some records if(!txtRecords.empty()) { - CStdString path; - CStdString username; - CStdString password; + std::string path; + std::string username; + std::string password; //search for a path key entry CZeroconfBrowser::ZeroconfService::tTxtRecordMap::iterator it = txtRecords.find(TXT_RECORD_PATH_KEY); @@ -135,7 +135,7 @@ bool GetDirectoryFromTxtRecords(CZeroconfBrowser::ZeroconfService zeroconf_servi if( !path.empty()) { CFileItemPtr item(new CFileItem("", true)); - CStdString urlStr(url.Get()); + std::string urlStr(url.Get()); //if path has a leading slash (sure it should have one) if( path.at(0) == '/' ) { @@ -172,8 +172,8 @@ bool GetDirectoryFromTxtRecords(CZeroconfBrowser::ZeroconfService zeroconf_servi bool CZeroconfDirectory::GetDirectory(const CURL& url, CFileItemList &items) { assert(url.GetProtocol() == "zeroconf"); - CStdString strPath = url.Get(); - CStdString path = strPath.substr(11, strPath.length()); + std::string strPath = url.Get(); + std::string path = strPath.substr(11, strPath.length()); URIUtils::RemoveSlashAtEnd(path); if(path.empty()) { @@ -181,18 +181,18 @@ bool CZeroconfDirectory::GetDirectory(const CURL& url, CFileItemList &items) for(std::vector<CZeroconfBrowser::ZeroconfService>::iterator it = found_services.begin(); it != found_services.end(); ++it) { //only use discovered services we can connect to through directory - CStdString tmp; + std::string tmp; if(GetXBMCProtocol(it->GetType(), tmp)) { CFileItemPtr item(new CFileItem("", true)); CURL url; url.SetProtocol("zeroconf"); - CStdString service_path(CURL::Encode(CZeroconfBrowser::ZeroconfService::toPath(*it))); + std::string service_path(CURL::Encode(CZeroconfBrowser::ZeroconfService::toPath(*it))); url.SetFileName(service_path); item->SetPath(url.Get()); //now do the formatting - CStdString protocol = GetHumanReadableProtocol(it->GetType()); + std::string protocol = GetHumanReadableProtocol(it->GetType()); item->SetLabel(it->GetName() + " (" + protocol + ")"); item->SetLabelPreformated(true); //just set the default folder icon @@ -205,7 +205,7 @@ bool CZeroconfDirectory::GetDirectory(const CURL& url, CFileItemList &items) else { //decode the path first - CStdString decoded(CURL::Decode(path)); + std::string decoded(CURL::Decode(path)); try { CZeroconfBrowser::ZeroconfService zeroconf_service = CZeroconfBrowser::ZeroconfService::fromPath(decoded); @@ -223,7 +223,7 @@ bool CZeroconfDirectory::GetDirectory(const CURL& url, CFileItemList &items) service.SetHostName(zeroconf_service.GetIP()); //do protocol conversion (_smb._tcp -> smb) //ToDo: try automatic conversion -> remove leading '_' and '._tcp'? - CStdString protocol; + std::string protocol; if(!GetXBMCProtocol(zeroconf_service.GetType(), protocol)) { CLog::Log(LOGERROR, "CZeroconfDirectory::GetDirectory Unknown service type (%s), skipping; ", zeroconf_service.GetType().c_str()); diff --git a/xbmc/filesystem/ZipDirectory.cpp b/xbmc/filesystem/ZipDirectory.cpp index 2b982e4644..94206f0837 100644 --- a/xbmc/filesystem/ZipDirectory.cpp +++ b/xbmc/filesystem/ZipDirectory.cpp @@ -50,16 +50,16 @@ namespace XFILE urlZip = URIUtils::CreateArchivePath("zip", urlOrig); CURL url(urlZip); - CStdString strArchive = url.GetHostName(); - CStdString strOptions = url.GetOptions(); - CStdString strPathInZip = url.GetFileName(); + std::string strArchive = url.GetHostName(); + std::string strOptions = url.GetOptions(); + std::string strPathInZip = url.GetFileName(); url.SetOptions(""); // delete options to have a clean path to add stuff too url.SetFileName(""); // delete filename too as our names later will contain it - CStdString strSlashPath = url.Get(); + std::string strSlashPath = url.Get(); - CStdString strBuffer; + std::string strBuffer; // the RAR code depends on things having a "/" at the end of the path URIUtils::AddSlashAtEnd(strSlashPath); @@ -77,7 +77,7 @@ namespace XFILE for (vector<SZipEntry>::iterator ze=entries.begin();ze!=entries.end();++ze) { - CStdString strEntryName(ze->name); + std::string strEntryName(ze->name); StringUtils::Replace(strEntryName, '\\','/'); if (strEntryName == strPathInZip) // skip the listed dir continue; diff --git a/xbmc/filesystem/ZipFile.cpp b/xbmc/filesystem/ZipFile.cpp index 105c561d46..709d00dd7b 100644 --- a/xbmc/filesystem/ZipFile.cpp +++ b/xbmc/filesystem/ZipFile.cpp @@ -46,7 +46,7 @@ CZipFile::~CZipFile() bool CZipFile::Open(const CURL&url) { - CStdString strOpts = url.GetOptions(); + std::string strOpts = url.GetOptions(); CURL url2(url); url2.SetOptions(""); if (!g_ZipManager.GetZipEntry(url2,mZipItem)) diff --git a/xbmc/filesystem/ZipManager.cpp b/xbmc/filesystem/ZipManager.cpp index 11d48a24fb..7364cc7348 100644 --- a/xbmc/filesystem/ZipManager.cpp +++ b/xbmc/filesystem/ZipManager.cpp @@ -51,7 +51,7 @@ bool CZipManager::GetZipList(const CURL& url, vector<SZipEntry>& items) struct __stat64 m_StatData = {}; - CStdString strFile = url.GetHostName(); + std::string strFile = url.GetHostName(); if (CFile::Stat(strFile,&m_StatData)) { @@ -59,10 +59,10 @@ bool CZipManager::GetZipList(const CURL& url, vector<SZipEntry>& items) return false; } - map<CStdString,vector<SZipEntry> >::iterator it = mZipMap.find(strFile); + map<std::string,vector<SZipEntry> >::iterator it = mZipMap.find(strFile); if (it != mZipMap.end()) // already listed, just return it if not changed, else release and reread { - map<CStdString,int64_t>::iterator it2=mZipDate.find(strFile); + map<std::string,int64_t>::iterator it2=mZipDate.find(strFile); CLog::Log(LOGDEBUG,"statdata: %" PRId64" new: %" PRIu64, it2->second, (uint64_t)m_StatData.st_mtime); if (m_StatData.st_mtime == it2->second) @@ -177,9 +177,9 @@ bool CZipManager::GetZipList(const CURL& url, vector<SZipEntry>& items) } // Get the filename just after the central file header - CStdString strName; - mFile.Read(strName.GetBuffer(ze.flength), ze.flength); - strName.ReleaseBuffer(); + std::string strName; + strName.resize(ze.flength); + mFile.Read(&strName[0], ze.flength); g_charsetConverter.unknownToUTF8(strName); ZeroMemory(ze.name, 255); strncpy(ze.name, strName.c_str(), strName.size()>254 ? 254 : strName.size()); @@ -212,9 +212,9 @@ bool CZipManager::GetZipList(const CURL& url, vector<SZipEntry>& items) bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) { - CStdString strFile = url.GetHostName(); + std::string strFile = url.GetHostName(); - map<CStdString,vector<SZipEntry> >::iterator it = mZipMap.find(strFile); + map<std::string,vector<SZipEntry> >::iterator it = mZipMap.find(strFile); vector<SZipEntry> items; if (it == mZipMap.end()) // we need to list the zip { @@ -225,10 +225,10 @@ bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) items = it->second; } - CStdString strFileName = url.GetFileName(); + std::string strFileName = url.GetFileName(); for (vector<SZipEntry>::iterator it2=items.begin();it2 != items.end();++it2) { - if (CStdString(it2->name) == strFileName) + if (std::string(it2->name) == strFileName) { memcpy(&item,&(*it2),sizeof(SZipEntry)); return true; @@ -237,13 +237,13 @@ bool CZipManager::GetZipEntry(const CURL& url, SZipEntry& item) return false; } -bool CZipManager::ExtractArchive(const CStdString& strArchive, const CStdString& strPath) +bool CZipManager::ExtractArchive(const std::string& strArchive, const std::string& strPath) { const CURL pathToUrl(strArchive); return ExtractArchive(pathToUrl, strPath); } -bool CZipManager::ExtractArchive(const CURL& archive, const CStdString& strPath) +bool CZipManager::ExtractArchive(const CURL& archive, const std::string& strPath) { vector<SZipEntry> entry; CURL url = URIUtils::CreateArchivePath("zip", archive); @@ -252,7 +252,7 @@ bool CZipManager::ExtractArchive(const CURL& archive, const CStdString& strPath) { if (it->name[strlen(it->name)-1] == '/') // skip dirs continue; - CStdString strFilePath(it->name); + std::string strFilePath(it->name); CURL zipPath = URIUtils::CreateArchivePath("zip", archive, strFilePath); const CURL pathToUrl(strPath + strFilePath); @@ -299,13 +299,13 @@ void CZipManager::readCHeader(const char* buffer, SZipEntry& info) } -void CZipManager::release(const CStdString& strPath) +void CZipManager::release(const std::string& strPath) { CURL url(strPath); - map<CStdString,vector<SZipEntry> >::iterator it= mZipMap.find(url.GetHostName()); + map<std::string,vector<SZipEntry> >::iterator it= mZipMap.find(url.GetHostName()); if (it != mZipMap.end()) { - map<CStdString,int64_t>::iterator it2=mZipDate.find(url.GetHostName()); + map<std::string,int64_t>::iterator it2=mZipDate.find(url.GetHostName()); mZipMap.erase(it); mZipDate.erase(it2); } diff --git a/xbmc/filesystem/ZipManager.h b/xbmc/filesystem/ZipManager.h index c813c384f0..2ea14dc63b 100644 --- a/xbmc/filesystem/ZipManager.h +++ b/xbmc/filesystem/ZipManager.h @@ -29,9 +29,8 @@ #define CHDR_SIZE 46 #define ECDREC_SIZE 22 -#include "utils/StdString.h" - #include <memory.h> +#include <string> #include <vector> #include <map> @@ -104,14 +103,14 @@ public: bool GetZipList(const CURL& url, std::vector<SZipEntry>& items); bool GetZipEntry(const CURL& url, SZipEntry& item); - bool ExtractArchive(const CStdString& strArchive, const CStdString& strPath); - bool ExtractArchive(const CURL& archive, const CStdString& strPath); - void release(const CStdString& strPath); // release resources used by list zip + bool ExtractArchive(const std::string& strArchive, const std::string& strPath); + bool ExtractArchive(const CURL& archive, const std::string& strPath); + void release(const std::string& strPath); // release resources used by list zip static void readHeader(const char* buffer, SZipEntry& info); static void readCHeader(const char* buffer, SZipEntry& info); private: - std::map<CStdString,std::vector<SZipEntry> > mZipMap; - std::map<CStdString,int64_t> mZipDate; + std::map<std::string,std::vector<SZipEntry> > mZipMap; + std::map<std::string,int64_t> mZipDate; }; extern CZipManager g_ZipManager; diff --git a/xbmc/filesystem/iso9660.cpp b/xbmc/filesystem/iso9660.cpp index 5a5f66ddbd..91c8608396 100644 --- a/xbmc/filesystem/iso9660.cpp +++ b/xbmc/filesystem/iso9660.cpp @@ -152,7 +152,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha #ifdef _DEBUG_OUTPUT - CStdString strTmp; + std::string strTmp; strTmp = StringUtils::Format("****************** Adding dir : %s\r", path); OutputDebugString( strTmp.c_str() ); #endif @@ -322,7 +322,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha strcpy( pFile_Pointer->name , temp_text.c_str()); #ifdef _DEBUG_OUTPUT - //CStdString strTmp; + //std::string strTmp; //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 @@ -416,7 +416,7 @@ struct iso_dirtree *iso9660::ReadRecursiveDirFromSector( DWORD sector, const cha DWORD dwFileLocation = from_733(isodir.extent); #ifdef _DEBUG_OUTPUT - CStdString strTmp; + std::string strTmp; 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 @@ -702,7 +702,7 @@ string iso9660::GetThinText(BYTE* strTxt, int iLen ) { // convert from "fat" text (UTF-16BE) to "thin" text (UTF-8) std::u16string strTxtUnicode((char16_t*)strTxt, iLen / 2); - CStdString utf8String; + std::string utf8String; g_charsetConverter.utf16BEtoUTF8(strTxtUnicode, utf8String); diff --git a/xbmc/filesystem/test/TestDirectory.cpp b/xbmc/filesystem/test/TestDirectory.cpp index 4bd3669bd1..1cb0003d05 100644 --- a/xbmc/filesystem/test/TestDirectory.cpp +++ b/xbmc/filesystem/test/TestDirectory.cpp @@ -28,7 +28,7 @@ TEST(TestDirectory, General) { - CStdString tmppath1, tmppath2, tmppath3; + std::string tmppath1, tmppath2, tmppath3; CFileItemList items; CFileItemPtr itemptr; tmppath1 = CSpecialProtocol::TranslatePath("special://temp/"); diff --git a/xbmc/filesystem/test/TestFile.cpp b/xbmc/filesystem/test/TestFile.cpp index bca6f1867c..ccb704b41d 100644 --- a/xbmc/filesystem/test/TestFile.cpp +++ b/xbmc/filesystem/test/TestFile.cpp @@ -151,7 +151,7 @@ TEST(TestFile, Stat) TEST(TestFile, Delete) { XFILE::CFile *file; - CStdString path; + std::string path; ASSERT_TRUE((file = XBMC_CREATETEMPFILE("")) != NULL); file->Close(); @@ -164,7 +164,7 @@ TEST(TestFile, Delete) TEST(TestFile, Rename) { XFILE::CFile *file; - CStdString path1, path2; + std::string path1, path2; ASSERT_TRUE((file = XBMC_CREATETEMPFILE("")) != NULL); file->Close(); @@ -184,7 +184,7 @@ TEST(TestFile, Rename) TEST(TestFile, Copy) { XFILE::CFile *file; - CStdString path1, path2; + std::string path1, path2; ASSERT_TRUE((file = XBMC_CREATETEMPFILE("")) != NULL); file->Close(); diff --git a/xbmc/filesystem/test/TestFileFactory.cpp b/xbmc/filesystem/test/TestFileFactory.cpp index e2d5aec69a..b1619715d8 100644 --- a/xbmc/filesystem/test/TestFileFactory.cpp +++ b/xbmc/filesystem/test/TestFileFactory.cpp @@ -33,12 +33,12 @@ protected: { if (CSettings::Get().Initialize()) { - std::vector<CStdString> advancedsettings = + std::vector<std::string> advancedsettings = CXBMCTestUtils::Instance().getAdvancedSettingsFiles(); - std::vector<CStdString> guisettings = + std::vector<std::string> guisettings = CXBMCTestUtils::Instance().getGUISettingsFiles(); - std::vector<CStdString>::iterator it; + std::vector<std::string>::iterator it; for (it = guisettings.begin(); it < guisettings.end(); it++) CSettings::Get().Load(*it); @@ -65,15 +65,15 @@ protected: TEST_F(TestFileFactory, Read) { XFILE::CFile file; - CStdString str; + std::string str; unsigned int size, i; unsigned char buf[16]; int64_t count = 0; - std::vector<CStdString> urls = + std::vector<std::string> urls = CXBMCTestUtils::Instance().getTestFileFactoryReadUrls(); - std::vector<CStdString>::iterator it; + std::vector<std::string>::iterator it; for (it = urls.begin(); it < urls.end(); it++) { std::cout << "Testing URL: " << *it << std::endl; @@ -116,7 +116,7 @@ TEST_F(TestFileFactory, Read) TEST_F(TestFileFactory, Write) { XFILE::CFile file, inputfile; - CStdString str; + std::string str; unsigned int size, i; unsigned char buf[16]; int64_t count = 0; @@ -124,10 +124,10 @@ TEST_F(TestFileFactory, Write) str = CXBMCTestUtils::Instance().getTestFileFactoryWriteInputFile(); ASSERT_TRUE(inputfile.Open(str)); - std::vector<CStdString> urls = + std::vector<std::string> urls = CXBMCTestUtils::Instance().getTestFileFactoryWriteUrls(); - std::vector<CStdString>::iterator it; + std::vector<std::string>::iterator it; for (it = urls.begin(); it < urls.end(); it++) { std::cout << "Testing URL: " << *it << std::endl; diff --git a/xbmc/filesystem/test/TestNfsFile.cpp b/xbmc/filesystem/test/TestNfsFile.cpp index e5886fcb60..733f86b9a2 100644 --- a/xbmc/filesystem/test/TestNfsFile.cpp +++ b/xbmc/filesystem/test/TestNfsFile.cpp @@ -34,8 +34,8 @@ using ::testing::ValuesIn; struct SplitPath { std::string url; - CStdString exportPath; - CStdString relativePath; + std::string exportPath; + std::string relativePath; bool expectedResultExport; bool expectedResultPath; } g_TestData[] = { @@ -78,19 +78,19 @@ static ExportList exportList; TEST_P(TestNfs, splitUrlIntoExportAndPath) { CURL url(GetParam().url); - CStdString exportPath; - CStdString relativePath; + std::string exportPath; + std::string relativePath; gNfsConnection.splitUrlIntoExportAndPath(url, exportPath, relativePath, exportList.data); - if (GetParam().expectedResultExport) - EXPECT_STREQ(GetParam().exportPath, exportPath); + if (GetParam().expectedResultExport) + EXPECT_STREQ(GetParam().exportPath.c_str(), exportPath.c_str()); else - EXPECT_STRNE(GetParam().exportPath, exportPath); + EXPECT_STRNE(GetParam().exportPath.c_str(), exportPath.c_str()); if (GetParam().expectedResultPath) - EXPECT_STREQ(GetParam().relativePath, relativePath); + EXPECT_STREQ(GetParam().relativePath.c_str(), relativePath.c_str()); else - EXPECT_STRNE(GetParam().relativePath, relativePath); + EXPECT_STRNE(GetParam().relativePath.c_str(), relativePath.c_str()); } INSTANTIATE_TEST_CASE_P(NfsFile, TestNfs, ValuesIn(g_TestData)); diff --git a/xbmc/filesystem/test/TestRarFile.cpp b/xbmc/filesystem/test/TestRarFile.cpp index b311d0b7fd..b6b3356bf0 100644 --- a/xbmc/filesystem/test/TestRarFile.cpp +++ b/xbmc/filesystem/test/TestRarFile.cpp @@ -37,7 +37,7 @@ TEST(TestRarFile, Read) XFILE::CFile file; char buf[20]; memset(&buf, 0, sizeof(buf)); - CStdString reffile, strpathinrar; + std::string reffile, strpathinrar; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.rar"); @@ -87,7 +87,7 @@ TEST(TestRarFile, Read) TEST(TestRarFile, Exists) { - CStdString reffile, strpathinrar; + std::string reffile, strpathinrar; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.rar"); @@ -102,7 +102,7 @@ TEST(TestRarFile, Exists) TEST(TestRarFile, Stat) { struct __stat64 buffer; - CStdString reffile, strpathinrar; + std::string reffile, strpathinrar; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.rar"); @@ -124,7 +124,7 @@ TEST(TestRarFile, CorruptedFile) XFILE::CFile *file; char buf[16]; memset(&buf, 0, sizeof(buf)); - CStdString reffilepath, strpathinrar, str; + std::string reffilepath, strpathinrar, str; CFileItemList itemlist; unsigned int size, i; int64_t count = 0; @@ -195,7 +195,7 @@ TEST(TestRarFile, StoredRAR) XFILE::CFile file; char buf[20]; memset(&buf, 0, sizeof(buf)); - CStdString reffile, strpathinrar; + std::string reffile, strpathinrar; CFileItemList itemlist, itemlistemptydir; struct __stat64 stat_buffer; @@ -417,7 +417,7 @@ TEST(TestRarFile, NormalRAR) XFILE::CFile file; char buf[20]; memset(&buf, 0, sizeof(buf)); - CStdString reffile, strpathinrar; + std::string reffile, strpathinrar; CFileItemList itemlist, itemlistemptydir; struct __stat64 stat_buffer; diff --git a/xbmc/filesystem/test/TestZipFile.cpp b/xbmc/filesystem/test/TestZipFile.cpp index c1f263052d..106ba5d4e9 100644 --- a/xbmc/filesystem/test/TestZipFile.cpp +++ b/xbmc/filesystem/test/TestZipFile.cpp @@ -62,7 +62,7 @@ TEST_F(TestZipFile, Read) XFILE::CFile file; char buf[20]; memset(&buf, 0, sizeof(buf)); - CStdString reffile, strpathinzip; + std::string reffile, strpathinzip; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.zip"); @@ -112,7 +112,7 @@ TEST_F(TestZipFile, Read) TEST_F(TestZipFile, Exists) { - CStdString reffile, strpathinzip; + std::string reffile, strpathinzip; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.zip"); @@ -127,7 +127,7 @@ TEST_F(TestZipFile, Exists) TEST_F(TestZipFile, Stat) { struct __stat64 buffer; - CStdString reffile, strpathinzip; + std::string reffile, strpathinzip; CFileItemList itemlist; reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/reffile.txt.zip"); @@ -149,7 +149,7 @@ TEST_F(TestZipFile, CorruptedFile) XFILE::CFile *file; char buf[16]; memset(&buf, 0, sizeof(buf)); - CStdString reffilepath, strpathinzip, str; + std::string reffilepath, strpathinzip, str; CFileItemList itemlist; unsigned int size, i; int64_t count = 0; diff --git a/xbmc/filesystem/windows/WINSMBDirectory.cpp b/xbmc/filesystem/windows/WINSMBDirectory.cpp index 142e16854b..96f75821b6 100644 --- a/xbmc/filesystem/windows/WINSMBDirectory.cpp +++ b/xbmc/filesystem/windows/WINSMBDirectory.cpp @@ -113,7 +113,7 @@ bool CWINSMBDirectory::GetDirectory(const CURL& url, CFileItemList &items) return Exists(url); } - CStdString strPath = url.Get(); + std::string strPath = url.Get(); if (hFind.isValid()) { do @@ -257,9 +257,9 @@ bool CWINSMBDirectory::EnumerateFunc(LPNETRESOURCEW lpnr, CFileItemList &items) ((dwDisplayType == RESOURCEDISPLAYTYPE_SHARE) && m_bHost)) && (dwType != RESOURCETYPE_PRINT)) { - CStdString strurl = "smb:"; - CStdStringW strRemoteNameW = lpnrLocal[i].lpRemoteName; - CStdString strName,strRemoteName; + std::string strurl = "smb:"; + std::wstring strRemoteNameW = lpnrLocal[i].lpRemoteName; + std::string strName,strRemoteName; g_charsetConverter.wToUTF8(strRemoteNameW,strRemoteName, true); CLog::Log(LOGDEBUG,"Found Server/Share: %s", strRemoteName.c_str()); @@ -327,11 +327,11 @@ bool CWINSMBDirectory::ConnectToShare(const CURL& url) NETRESOURCE nr; CURL urlIn(url); DWORD dwRet=-1; - CStdString strUNC("\\\\"+url.GetHostName()); + std::string strUNC("\\\\"+url.GetHostName()); if(!url.GetShareName().empty()) strUNC.append("\\"+url.GetShareName()); - CStdString strPath; + std::string strPath; memset(&nr,0,sizeof(nr)); nr.dwType = RESOURCETYPE_ANY; nr.lpRemoteName = (char*)strUNC.c_str(); @@ -339,7 +339,7 @@ bool CWINSMBDirectory::ConnectToShare(const CURL& url) // in general we shouldn't need the password manager as we won't disconnect from shares yet CPasswordManager::GetInstance().AuthenticateURL(urlIn); - CStdString strAuth = URLEncode(urlIn); + std::string strAuth = URLEncode(urlIn); while(dwRet != NO_ERROR) { @@ -362,13 +362,13 @@ bool CWINSMBDirectory::ConnectToShare(const CURL& url) else if(dwRet == ERROR_SESSION_CREDENTIAL_CONFLICT) { DWORD dwRet2=-1; - CStdString strRN = nr.lpRemoteName; + std::string strRN = nr.lpRemoteName; do { dwRet2 = WNetCancelConnection2((LPCSTR)strRN.c_str(), 0, false); - strRN.erase(strRN.find_last_of("\\"),CStdString::npos); + strRN.erase(strRN.find_last_of("\\"),std::string::npos); } - while(dwRet2 == ERROR_NOT_CONNECTED && !strRN.Equals("\\\\")); + while(dwRet2 == ERROR_NOT_CONNECTED && strRN != "\\\\"); } else if(dwRet != NO_ERROR) { diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index acf7352797..59453dc480 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -473,8 +473,8 @@ CButtonTranslator::CButtonTranslator() void CButtonTranslator::ClearLircButtonMapEntries() { vector<lircButtonMap*> maps; - for (map<CStdString,lircButtonMap*>::iterator it = lircRemotesMap.begin(); - it != lircRemotesMap.end();++it) + for (map<std::string,lircButtonMap*>::iterator it = lircRemotesMap.begin(); + it != lircRemotesMap.end();++it) maps.push_back(it->second); sort(maps.begin(),maps.end()); vector<lircButtonMap*>::iterator itend = unique(maps.begin(),maps.end()); @@ -491,10 +491,10 @@ CButtonTranslator::~CButtonTranslator() } // Add the supplied device name to the list of connected devices -void CButtonTranslator::AddDevice(CStdString& strDevice) +void CButtonTranslator::AddDevice(std::string& strDevice) { // Only add the device if it isn't already in the list - std::list<CStdString>::iterator it; + std::list<std::string>::iterator it; for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) if (*it == strDevice) return; @@ -507,10 +507,10 @@ void CButtonTranslator::AddDevice(CStdString& strDevice) Load(); } -void CButtonTranslator::RemoveDevice(CStdString& strDevice) +void CButtonTranslator::RemoveDevice(std::string& strDevice) { // Find the device - std::list<CStdString>::iterator it; + std::list<std::string>::iterator it; for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) if (*it == strDevice) break; @@ -552,10 +552,10 @@ bool CButtonTranslator::Load(bool AlwaysLoad) } // Load mappings for any HID devices we have connected - std::list<CStdString>::iterator it; + std::list<std::string>::iterator it; for (it = m_deviceList.begin(); it != m_deviceList.end(); it++) { - CStdString devicedir = DIRS_TO_CHECK[dirIndex]; + std::string devicedir = DIRS_TO_CHECK[dirIndex]; devicedir.append(*it); devicedir.append("/"); if( XFILE::CDirectory::Exists(devicedir) ) @@ -586,7 +586,7 @@ bool CButtonTranslator::Load(bool AlwaysLoad) #else #define REMOTEMAP "IRSSmap.xml" #endif - CStdString lircmapPath = URIUtils::AddFileToFolder("special://xbmc/system/", REMOTEMAP); + std::string lircmapPath = URIUtils::AddFileToFolder("special://xbmc/system/", REMOTEMAP); lircRemotesMap.clear(); if(CFile::Exists(lircmapPath)) success |= LoadLircMap(lircmapPath); @@ -609,7 +609,7 @@ bool CButtonTranslator::Load(bool AlwaysLoad) return true; } -bool CButtonTranslator::LoadKeymap(const CStdString &keymapPath) +bool CButtonTranslator::LoadKeymap(const std::string &keymapPath) { CXBMCTinyXML xmlDoc; @@ -625,7 +625,7 @@ bool CButtonTranslator::LoadKeymap(const CStdString &keymapPath) CLog::Log(LOGERROR, "Error getting keymap root: %s", keymapPath.c_str()); return false; } - CStdString strValue = pRoot->Value(); + std::string strValue = pRoot->Value(); if ( strValue != "keymap") { CLog::Log(LOGERROR, "%s Doesn't contain <keymap>", keymapPath.c_str()); @@ -655,7 +655,7 @@ bool CButtonTranslator::LoadKeymap(const CStdString &keymapPath) } #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) -bool CButtonTranslator::LoadLircMap(const CStdString &lircmapPath) +bool CButtonTranslator::LoadLircMap(const std::string &lircmapPath) { #ifdef TARGET_POSIX #define REMOTEMAPTAG "lircmap" @@ -674,7 +674,7 @@ bool CButtonTranslator::LoadLircMap(const CStdString &lircmapPath) } TiXmlElement* pRoot = xmlDoc.RootElement(); - CStdString strValue = pRoot->Value(); + std::string strValue = pRoot->Value(); if (strValue != REMOTEMAPTAG) { CLog::Log(LOGERROR, "%sl Doesn't contain <%s>", lircmapPath.c_str(), REMOTEMAPTAG); @@ -705,7 +705,7 @@ void CButtonTranslator::MapRemote(TiXmlNode *pRemote, const char* szDevice) { CLog::Log(LOGINFO, "* Adding remote mapping for device '%s'", szDevice); vector<string> RemoteNames; - map<CStdString, lircButtonMap*>::iterator it = lircRemotesMap.find(szDevice); + map<std::string, lircButtonMap*>::iterator it = lircRemotesMap.find(szDevice); if (it == lircRemotesMap.end()) lircRemotesMap[szDevice] = new lircButtonMap; lircButtonMap& buttons = *lircRemotesMap[szDevice]; @@ -734,7 +734,7 @@ void CButtonTranslator::MapRemote(TiXmlNode *pRemote, const char* szDevice) int CButtonTranslator::TranslateLircRemoteString(const char* szDevice, const char *szButton) { // Find the device - map<CStdString, lircButtonMap*>::iterator it = lircRemotesMap.find(szDevice); + map<std::string, lircButtonMap*>::iterator it = lircRemotesMap.find(szDevice); if (it == lircRemotesMap.end()) return 0; @@ -854,7 +854,7 @@ void CButtonTranslator::MapJoystickActions(int windowID, TiXmlNode *pJoystick) } } -bool CButtonTranslator::TranslateJoystickString(int window, const char* szDevice, int id, short inputType, int& action, CStdString& strAction, bool &fullrange) +bool CButtonTranslator::TranslateJoystickString(int window, const char* szDevice, int id, short inputType, int& action, std::string& strAction, bool &fullrange) { fullrange = false; @@ -931,7 +931,7 @@ int CButtonTranslator::GetActionCode(int window, int action) /* * Translates a joystick input to an action code */ -int CButtonTranslator::GetActionCode(int window, int id, const JoystickMap &wmap, CStdString &strAction, bool &fullrange) const +int CButtonTranslator::GetActionCode(int window, int id, const JoystickMap &wmap, std::string &strAction, bool &fullrange) const { int action = 0; bool found = false; @@ -1005,7 +1005,7 @@ int CButtonTranslator::GetFallbackWindow(int windowID) CAction CButtonTranslator::GetAction(int window, const CKey &key, bool fallback) { - CStdString strAction; + std::string strAction; // try to get the action from the current window int actionID = GetActionCode(window, key, strAction); // if it's invalid, try to get it from the global map @@ -1023,7 +1023,7 @@ CAction CButtonTranslator::GetAction(int window, const CKey &key, bool fallback) return action; } -int CButtonTranslator::GetActionCode(int window, const CKey &key, CStdString &strAction) const +int CButtonTranslator::GetActionCode(int window, const CKey &key, std::string &strAction) const { uint32_t code = key.GetButtonCode(); @@ -1078,7 +1078,7 @@ void CButtonTranslator::MapAction(uint32_t buttonCode, const char *szAction, but } } -bool CButtonTranslator::HasDeviceType(TiXmlNode *pWindow, CStdString type) +bool CButtonTranslator::HasDeviceType(TiXmlNode *pWindow, std::string type) { return pWindow->FirstChild(type) != NULL; } @@ -1093,7 +1093,7 @@ void CButtonTranslator::MapWindowActions(TiXmlNode *pWindow, int windowID) const char* types[] = {"gamepad", "remote", "universalremote", "keyboard", "mouse", "appcommand", NULL}; for (int i = 0; types[i]; ++i) { - CStdString type(types[i]); + std::string type(types[i]); if (HasDeviceType(pWindow, type)) { buttonMap map; @@ -1161,14 +1161,14 @@ void CButtonTranslator::MapWindowActions(TiXmlNode *pWindow, int windowID) bool CButtonTranslator::TranslateActionString(const char *szAction, int &action) { action = ACTION_NONE; - CStdString strAction = szAction; + std::string strAction = szAction; StringUtils::ToLower(strAction); if (CBuiltins::HasCommand(strAction)) action = ACTION_BUILT_IN_FUNCTION; for (unsigned int index=0;index < sizeof(actions)/sizeof(actions[0]);++index) { - if (strAction.Equals(actions[index].name)) + if (strAction == actions[index].name) { action = actions[index].action; break; @@ -1184,7 +1184,7 @@ bool CButtonTranslator::TranslateActionString(const char *szAction, int &action) return true; } -CStdString CButtonTranslator::TranslateWindow(int windowID) +std::string CButtonTranslator::TranslateWindow(int windowID) { for (unsigned int index = 0; index < sizeof(windows) / sizeof(windows[0]); ++index) { @@ -1194,9 +1194,9 @@ CStdString CButtonTranslator::TranslateWindow(int windowID) return ""; } -int CButtonTranslator::TranslateWindow(const CStdString &window) +int CButtonTranslator::TranslateWindow(const std::string &window) { - CStdString strWindow(window); + std::string strWindow(window); if (strWindow.empty()) return WINDOW_INVALID; StringUtils::ToLower(strWindow); @@ -1221,7 +1221,7 @@ int CButtonTranslator::TranslateWindow(const CStdString &window) // run through the window structure for (unsigned int index = 0; index < sizeof(windows) / sizeof(windows[0]); ++index) { - if (strWindow.Equals(windows[index].name)) + if (strWindow == windows[index].name) return windows[index].action; } @@ -1234,36 +1234,36 @@ uint32_t CButtonTranslator::TranslateGamepadString(const char *szButton) if (!szButton) return 0; uint32_t buttonCode = 0; - CStdString strButton = szButton; + std::string strButton = szButton; StringUtils::ToLower(strButton); - if (strButton.Equals("a")) buttonCode = KEY_BUTTON_A; - else if (strButton.Equals("b")) buttonCode = KEY_BUTTON_B; - else if (strButton.Equals("x")) buttonCode = KEY_BUTTON_X; - else if (strButton.Equals("y")) buttonCode = KEY_BUTTON_Y; - else if (strButton.Equals("white")) buttonCode = KEY_BUTTON_WHITE; - else if (strButton.Equals("black")) buttonCode = KEY_BUTTON_BLACK; - else if (strButton.Equals("start")) buttonCode = KEY_BUTTON_START; - else if (strButton.Equals("back")) buttonCode = KEY_BUTTON_BACK; - else if (strButton.Equals("leftthumbbutton")) buttonCode = KEY_BUTTON_LEFT_THUMB_BUTTON; - else if (strButton.Equals("rightthumbbutton")) buttonCode = KEY_BUTTON_RIGHT_THUMB_BUTTON; - else if (strButton.Equals("leftthumbstick")) buttonCode = KEY_BUTTON_LEFT_THUMB_STICK; - else if (strButton.Equals("leftthumbstickup")) buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_UP; - else if (strButton.Equals("leftthumbstickdown")) buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_DOWN; - else if (strButton.Equals("leftthumbstickleft")) buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_LEFT; - else if (strButton.Equals("leftthumbstickright")) buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_RIGHT; - else if (strButton.Equals("rightthumbstick")) buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK; - else if (strButton.Equals("rightthumbstickup")) buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_UP; - else if (strButton.Equals("rightthumbstickdown")) buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_DOWN; - else if (strButton.Equals("rightthumbstickleft")) buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_LEFT; - else if (strButton.Equals("rightthumbstickright")) buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_RIGHT; - else if (strButton.Equals("lefttrigger")) buttonCode = KEY_BUTTON_LEFT_TRIGGER; - else if (strButton.Equals("righttrigger")) buttonCode = KEY_BUTTON_RIGHT_TRIGGER; - else if (strButton.Equals("leftanalogtrigger")) buttonCode = KEY_BUTTON_LEFT_ANALOG_TRIGGER; - else if (strButton.Equals("rightanalogtrigger")) buttonCode = KEY_BUTTON_RIGHT_ANALOG_TRIGGER; - else if (strButton.Equals("dpadleft")) buttonCode = KEY_BUTTON_DPAD_LEFT; - else if (strButton.Equals("dpadright")) buttonCode = KEY_BUTTON_DPAD_RIGHT; - else if (strButton.Equals("dpadup")) buttonCode = KEY_BUTTON_DPAD_UP; - else if (strButton.Equals("dpaddown")) buttonCode = KEY_BUTTON_DPAD_DOWN; + if (strButton == "a") buttonCode = KEY_BUTTON_A; + else if (strButton == "b") buttonCode = KEY_BUTTON_B; + else if (strButton == "x") buttonCode = KEY_BUTTON_X; + else if (strButton == "y") buttonCode = KEY_BUTTON_Y; + else if (strButton == "white") buttonCode = KEY_BUTTON_WHITE; + else if (strButton == "black") buttonCode = KEY_BUTTON_BLACK; + else if (strButton == "start") buttonCode = KEY_BUTTON_START; + else if (strButton == "back") buttonCode = KEY_BUTTON_BACK; + else if (strButton == "leftthumbbutton") buttonCode = KEY_BUTTON_LEFT_THUMB_BUTTON; + else if (strButton == "rightthumbbutton") buttonCode = KEY_BUTTON_RIGHT_THUMB_BUTTON; + else if (strButton == "leftthumbstick") buttonCode = KEY_BUTTON_LEFT_THUMB_STICK; + else if (strButton == "leftthumbstickup") buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_UP; + else if (strButton == "leftthumbstickdown") buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_DOWN; + else if (strButton == "leftthumbstickleft") buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_LEFT; + else if (strButton == "leftthumbstickright") buttonCode = KEY_BUTTON_LEFT_THUMB_STICK_RIGHT; + else if (strButton == "rightthumbstick") buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK; + else if (strButton == "rightthumbstickup") buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_UP; + else if (strButton =="rightthumbstickdown") buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_DOWN; + else if (strButton == "rightthumbstickleft") buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_LEFT; + else if (strButton == "rightthumbstickright") buttonCode = KEY_BUTTON_RIGHT_THUMB_STICK_RIGHT; + else if (strButton == "lefttrigger") buttonCode = KEY_BUTTON_LEFT_TRIGGER; + else if (strButton == "righttrigger") buttonCode = KEY_BUTTON_RIGHT_TRIGGER; + else if (strButton == "leftanalogtrigger") buttonCode = KEY_BUTTON_LEFT_ANALOG_TRIGGER; + else if (strButton == "rightanalogtrigger") buttonCode = KEY_BUTTON_RIGHT_ANALOG_TRIGGER; + else if (strButton == "dpadleft") buttonCode = KEY_BUTTON_DPAD_LEFT; + else if (strButton == "dpadright") buttonCode = KEY_BUTTON_DPAD_RIGHT; + else if (strButton == "dpadup") buttonCode = KEY_BUTTON_DPAD_UP; + else if (strButton == "dpaddown") buttonCode = KEY_BUTTON_DPAD_DOWN; else CLog::Log(LOGERROR, "Gamepad Translator: Can't find button %s", strButton.c_str()); return buttonCode; } @@ -1273,70 +1273,70 @@ uint32_t CButtonTranslator::TranslateRemoteString(const char *szButton) if (!szButton) return 0; uint32_t buttonCode = 0; - CStdString strButton = szButton; + std::string strButton = szButton; StringUtils::ToLower(strButton); - if (strButton.Equals("left")) buttonCode = XINPUT_IR_REMOTE_LEFT; - else if (strButton.Equals("right")) buttonCode = XINPUT_IR_REMOTE_RIGHT; - else if (strButton.Equals("up")) buttonCode = XINPUT_IR_REMOTE_UP; - else if (strButton.Equals("down")) buttonCode = XINPUT_IR_REMOTE_DOWN; - else if (strButton.Equals("select")) buttonCode = XINPUT_IR_REMOTE_SELECT; - else if (strButton.Equals("back")) buttonCode = XINPUT_IR_REMOTE_BACK; - else if (strButton.Equals("menu")) buttonCode = XINPUT_IR_REMOTE_MENU; - else if (strButton.Equals("info")) buttonCode = XINPUT_IR_REMOTE_INFO; - else if (strButton.Equals("display")) buttonCode = XINPUT_IR_REMOTE_DISPLAY; - else if (strButton.Equals("title")) buttonCode = XINPUT_IR_REMOTE_TITLE; - else if (strButton.Equals("play")) buttonCode = XINPUT_IR_REMOTE_PLAY; - else if (strButton.Equals("pause")) buttonCode = XINPUT_IR_REMOTE_PAUSE; - else if (strButton.Equals("reverse")) buttonCode = XINPUT_IR_REMOTE_REVERSE; - else if (strButton.Equals("forward")) buttonCode = XINPUT_IR_REMOTE_FORWARD; - else if (strButton.Equals("skipplus")) buttonCode = XINPUT_IR_REMOTE_SKIP_PLUS; - else if (strButton.Equals("skipminus")) buttonCode = XINPUT_IR_REMOTE_SKIP_MINUS; - else if (strButton.Equals("stop")) buttonCode = XINPUT_IR_REMOTE_STOP; - else if (strButton.Equals("zero")) buttonCode = XINPUT_IR_REMOTE_0; - else if (strButton.Equals("one")) buttonCode = XINPUT_IR_REMOTE_1; - else if (strButton.Equals("two")) buttonCode = XINPUT_IR_REMOTE_2; - else if (strButton.Equals("three")) buttonCode = XINPUT_IR_REMOTE_3; - else if (strButton.Equals("four")) buttonCode = XINPUT_IR_REMOTE_4; - else if (strButton.Equals("five")) buttonCode = XINPUT_IR_REMOTE_5; - else if (strButton.Equals("six")) buttonCode = XINPUT_IR_REMOTE_6; - else if (strButton.Equals("seven")) buttonCode = XINPUT_IR_REMOTE_7; - else if (strButton.Equals("eight")) buttonCode = XINPUT_IR_REMOTE_8; - else if (strButton.Equals("nine")) buttonCode = XINPUT_IR_REMOTE_9; + if (strButton == "left") buttonCode = XINPUT_IR_REMOTE_LEFT; + else if (strButton =="right") buttonCode = XINPUT_IR_REMOTE_RIGHT; + else if (strButton =="up") buttonCode = XINPUT_IR_REMOTE_UP; + else if (strButton == "down") buttonCode = XINPUT_IR_REMOTE_DOWN; + else if (strButton == "select") buttonCode = XINPUT_IR_REMOTE_SELECT; + else if (strButton == "back") buttonCode = XINPUT_IR_REMOTE_BACK; + else if (strButton == "menu") buttonCode = XINPUT_IR_REMOTE_MENU; + else if (strButton == "info") buttonCode = XINPUT_IR_REMOTE_INFO; + else if (strButton == "display") buttonCode = XINPUT_IR_REMOTE_DISPLAY; + else if (strButton == "title") buttonCode = XINPUT_IR_REMOTE_TITLE; + else if (strButton == "play") buttonCode = XINPUT_IR_REMOTE_PLAY; + else if (strButton == "pause") buttonCode = XINPUT_IR_REMOTE_PAUSE; + else if (strButton == "reverse") buttonCode = XINPUT_IR_REMOTE_REVERSE; + else if (strButton == "forward") buttonCode = XINPUT_IR_REMOTE_FORWARD; + else if (strButton == "skipplus") buttonCode = XINPUT_IR_REMOTE_SKIP_PLUS; + else if (strButton == "skipminus") buttonCode = XINPUT_IR_REMOTE_SKIP_MINUS; + else if (strButton == "stop") buttonCode = XINPUT_IR_REMOTE_STOP; + else if (strButton == "zero") buttonCode = XINPUT_IR_REMOTE_0; + else if (strButton == "one") buttonCode = XINPUT_IR_REMOTE_1; + else if (strButton == "two") buttonCode = XINPUT_IR_REMOTE_2; + else if (strButton == "three") buttonCode = XINPUT_IR_REMOTE_3; + else if (strButton == "four") buttonCode = XINPUT_IR_REMOTE_4; + else if (strButton == "five") buttonCode = XINPUT_IR_REMOTE_5; + else if (strButton == "six") buttonCode = XINPUT_IR_REMOTE_6; + else if (strButton == "seven") buttonCode = XINPUT_IR_REMOTE_7; + else if (strButton == "eight") buttonCode = XINPUT_IR_REMOTE_8; + else if (strButton == "nine") buttonCode = XINPUT_IR_REMOTE_9; // additional keys from the media center extender for xbox remote - else if (strButton.Equals("power")) buttonCode = XINPUT_IR_REMOTE_POWER; - else if (strButton.Equals("mytv")) buttonCode = XINPUT_IR_REMOTE_MY_TV; - else if (strButton.Equals("mymusic")) buttonCode = XINPUT_IR_REMOTE_MY_MUSIC; - else if (strButton.Equals("mypictures")) buttonCode = XINPUT_IR_REMOTE_MY_PICTURES; - else if (strButton.Equals("myvideo")) buttonCode = XINPUT_IR_REMOTE_MY_VIDEOS; - else if (strButton.Equals("record")) buttonCode = XINPUT_IR_REMOTE_RECORD; - else if (strButton.Equals("start")) buttonCode = XINPUT_IR_REMOTE_START; - else if (strButton.Equals("volumeplus")) buttonCode = XINPUT_IR_REMOTE_VOLUME_PLUS; - else if (strButton.Equals("volumeminus")) buttonCode = XINPUT_IR_REMOTE_VOLUME_MINUS; - else if (strButton.Equals("channelplus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS; - else if (strButton.Equals("channelminus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS; - else if (strButton.Equals("pageplus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS; - else if (strButton.Equals("pageminus")) buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS; - else if (strButton.Equals("mute")) buttonCode = XINPUT_IR_REMOTE_MUTE; - else if (strButton.Equals("recordedtv")) buttonCode = XINPUT_IR_REMOTE_RECORDED_TV; - else if (strButton.Equals("guide")) buttonCode = XINPUT_IR_REMOTE_GUIDE; - else if (strButton.Equals("livetv")) buttonCode = XINPUT_IR_REMOTE_LIVE_TV; - else if (strButton.Equals("liveradio")) buttonCode = XINPUT_IR_REMOTE_LIVE_RADIO; - else if (strButton.Equals("epgsearch")) buttonCode = XINPUT_IR_REMOTE_EPG_SEARCH; - else if (strButton.Equals("star")) buttonCode = XINPUT_IR_REMOTE_STAR; - else if (strButton.Equals("hash")) buttonCode = XINPUT_IR_REMOTE_HASH; - else if (strButton.Equals("clear")) buttonCode = XINPUT_IR_REMOTE_CLEAR; - else if (strButton.Equals("enter")) buttonCode = XINPUT_IR_REMOTE_ENTER; - else if (strButton.Equals("xbox")) buttonCode = XINPUT_IR_REMOTE_DISPLAY; // same as display - else if (strButton.Equals("playlist")) buttonCode = XINPUT_IR_REMOTE_PLAYLIST; - else if (strButton.Equals("guide")) buttonCode = XINPUT_IR_REMOTE_GUIDE; - else if (strButton.Equals("teletext")) buttonCode = XINPUT_IR_REMOTE_TELETEXT; - else if (strButton.Equals("red")) buttonCode = XINPUT_IR_REMOTE_RED; - else if (strButton.Equals("green")) buttonCode = XINPUT_IR_REMOTE_GREEN; - else if (strButton.Equals("yellow")) buttonCode = XINPUT_IR_REMOTE_YELLOW; - else if (strButton.Equals("blue")) buttonCode = XINPUT_IR_REMOTE_BLUE; - else if (strButton.Equals("subtitle")) buttonCode = XINPUT_IR_REMOTE_SUBTITLE; - else if (strButton.Equals("language")) buttonCode = XINPUT_IR_REMOTE_LANGUAGE; - else if (strButton.Equals("eject")) buttonCode = XINPUT_IR_REMOTE_EJECT; + else if (strButton == "power") buttonCode = XINPUT_IR_REMOTE_POWER; + else if (strButton == "mytv") buttonCode = XINPUT_IR_REMOTE_MY_TV; + else if (strButton == "mymusic") buttonCode = XINPUT_IR_REMOTE_MY_MUSIC; + else if (strButton == "mypictures") buttonCode = XINPUT_IR_REMOTE_MY_PICTURES; + else if (strButton == "myvideo") buttonCode = XINPUT_IR_REMOTE_MY_VIDEOS; + else if (strButton == "record") buttonCode = XINPUT_IR_REMOTE_RECORD; + else if (strButton == "start") buttonCode = XINPUT_IR_REMOTE_START; + else if (strButton == "volumeplus") buttonCode = XINPUT_IR_REMOTE_VOLUME_PLUS; + else if (strButton == "volumeminus") buttonCode = XINPUT_IR_REMOTE_VOLUME_MINUS; + else if (strButton == "channelplus") buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS; + else if (strButton == "channelminus") buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS; + else if (strButton == "pageplus") buttonCode = XINPUT_IR_REMOTE_CHANNEL_PLUS; + else if (strButton == "pageminus") buttonCode = XINPUT_IR_REMOTE_CHANNEL_MINUS; + else if (strButton == "mute") buttonCode = XINPUT_IR_REMOTE_MUTE; + else if (strButton == "recordedtv") buttonCode = XINPUT_IR_REMOTE_RECORDED_TV; + else if (strButton == "guide") buttonCode = XINPUT_IR_REMOTE_GUIDE; + else if (strButton == "livetv") buttonCode = XINPUT_IR_REMOTE_LIVE_TV; + else if (strButton == "liveradio") buttonCode = XINPUT_IR_REMOTE_LIVE_RADIO; + else if (strButton == "epgsearch") buttonCode = XINPUT_IR_REMOTE_EPG_SEARCH; + else if (strButton == "star") buttonCode = XINPUT_IR_REMOTE_STAR; + else if (strButton == "hash") buttonCode = XINPUT_IR_REMOTE_HASH; + else if (strButton == "clear") buttonCode = XINPUT_IR_REMOTE_CLEAR; + else if (strButton == "enter") buttonCode = XINPUT_IR_REMOTE_ENTER; + else if (strButton == "xbox") buttonCode = XINPUT_IR_REMOTE_DISPLAY; // same as display + else if (strButton == "playlist") buttonCode = XINPUT_IR_REMOTE_PLAYLIST; + else if (strButton == "guide") buttonCode = XINPUT_IR_REMOTE_GUIDE; + else if (strButton == "teletext") buttonCode = XINPUT_IR_REMOTE_TELETEXT; + else if (strButton == "red") buttonCode = XINPUT_IR_REMOTE_RED; + else if (strButton == "green") buttonCode = XINPUT_IR_REMOTE_GREEN; + else if (strButton == "yellow") buttonCode = XINPUT_IR_REMOTE_YELLOW; + else if (strButton == "blue") buttonCode = XINPUT_IR_REMOTE_BLUE; + else if (strButton == "subtitle") buttonCode = XINPUT_IR_REMOTE_SUBTITLE; + else if (strButton == "language") buttonCode = XINPUT_IR_REMOTE_LANGUAGE; + else if (strButton == "eject") buttonCode = XINPUT_IR_REMOTE_EJECT; else CLog::Log(LOGERROR, "Remote Translator: Can't find button %s", strButton.c_str()); return buttonCode; } @@ -1382,8 +1382,8 @@ uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton) if (!szButton) return 0; - CStdString strKey = szButton; - if (strKey.Equals("key")) + const std::string strKey = szButton; + if (strKey == "key") { std::string strID; if (pButton->QueryValueAttribute("id", &strID) == TIXML_SUCCESS) @@ -1403,7 +1403,7 @@ uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton) button_id = TranslateKeyboardString(szButton); // Process the ctrl/shift/alt modifiers - CStdString strMod; + std::string strMod; if (pButton->QueryValueAttribute("mod", &strMod) == TIXML_SUCCESS) { StringUtils::ToLower(strMod); @@ -1435,11 +1435,11 @@ uint32_t CButtonTranslator::TranslateKeyboardButton(TiXmlElement *pButton) uint32_t CButtonTranslator::TranslateAppCommand(const char *szButton) { #ifdef TARGET_WINDOWS - CStdString strAppCommand = szButton; + std::string strAppCommand = szButton; StringUtils::ToLower(strAppCommand); for (int i = 0; i < sizeof(appcommands)/sizeof(appcommands[0]); i++) - if (strAppCommand.Equals(appcommands[i].name)) + if (strAppCommand == appcommands[i].name) return appcommands[i].action | KEY_APPCOMMAND; CLog::Log(LOGERROR, "%s: Can't find appcommand %s", __FUNCTION__, szButton); @@ -1450,11 +1450,11 @@ uint32_t CButtonTranslator::TranslateAppCommand(const char *szButton) uint32_t CButtonTranslator::TranslateMouseCommand(const char *szButton) { - CStdString strMouseCommand = szButton; + std::string strMouseCommand = szButton; StringUtils::ToLower(strMouseCommand); for (unsigned int i = 0; i < sizeof(mousecommands)/sizeof(mousecommands[0]); i++) - if (strMouseCommand.Equals(mousecommands[i].name)) + if (strMouseCommand == mousecommands[i].name) return mousecommands[i].action | KEY_MOUSE; CLog::Log(LOGERROR, "%s: Can't find mouse command %s", __FUNCTION__, szButton); @@ -1489,7 +1489,7 @@ uint32_t CButtonTranslator::TranslateTouchCommand(TiXmlElement *pButton, CButton if (szAction == NULL) return ACTION_NONE; - CStdString strTouchCommand = szButton; + std::string strTouchCommand = szButton; StringUtils::ToLower(strTouchCommand); const char *attrVal = pButton->Attribute("direction"); @@ -1499,7 +1499,7 @@ uint32_t CButtonTranslator::TranslateTouchCommand(TiXmlElement *pButton, CButton uint32_t actionId = ACTION_NONE; for (unsigned int i = 0; i < sizeof(touchcommands)/sizeof(touchcommands[0]); i++) { - if (strTouchCommand.Equals(touchcommands[i].name)) + if (strTouchCommand == touchcommands[i].name) { actionId = touchcommands[i].action; break; diff --git a/xbmc/input/ButtonTranslator.h b/xbmc/input/ButtonTranslator.h index 11ac033cc1..cfeae1d95e 100644 --- a/xbmc/input/ButtonTranslator.h +++ b/xbmc/input/ButtonTranslator.h @@ -24,13 +24,13 @@ #pragma once #include <map> +#include <string> #include <vector> #include "system.h" // for HAS_EVENT_SERVER, HAS_SDL_JOYSTICK, HAS_LIRC #ifdef HAS_EVENT_SERVER #include "network/EventClient.h" #endif -#include "utils/StdString.h" class CKey; class CAction; @@ -39,7 +39,7 @@ class TiXmlNode; struct CButtonAction { int id; - CStdString strID; // needed for "XBMC.ActivateWindow()" type actions + std::string strID; // needed for "XBMC.ActivateWindow()" type actions }; /// /// singleton class to map from buttons to actions @@ -56,14 +56,14 @@ private: CButtonTranslator(const CButtonTranslator&); CButtonTranslator const& operator=(CButtonTranslator const&); virtual ~CButtonTranslator(); - bool HasDeviceType(TiXmlNode *pWindow, CStdString type); + bool HasDeviceType(TiXmlNode *pWindow, std::string type); public: ///access to singleton static CButtonTranslator& GetInstance(); // Add/remove a HID device with custom mappings - void AddDevice(CStdString& strDevice); - void RemoveDevice(CStdString& strDevice); + void AddDevice(std::string& strDevice); + void RemoveDevice(std::string& strDevice); /// loads Lircmap.xml/IRSSmap.xml (if enabled) and Keymap.xml bool Load(bool AlwaysLoad = false); @@ -79,13 +79,13 @@ public: \param window name of the window \return id of the window, or WINDOW_INVALID if not found */ - static int TranslateWindow(const CStdString &window); + static int TranslateWindow(const std::string &window); /*! \brief Translate between a window id and it's name \param window id of the window \return name of the window, or an empty string if not found */ - static CStdString TranslateWindow(int window); + static std::string TranslateWindow(int window); static bool TranslateActionString(const char *szAction, int &action); @@ -94,7 +94,7 @@ public: #endif #if defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER) bool TranslateJoystickString(int window, const char* szDevice, int id, - short inputType, int& action, CStdString& strAction, + short inputType, int& action, std::string& strAction, bool &fullrange); #endif @@ -106,13 +106,13 @@ private: // m_translatorMap contains all mappings i.e. m_BaseMap + HID device mappings std::map<int, buttonMap> m_translatorMap; // m_deviceList contains the list of connected HID devices - std::list<CStdString> m_deviceList; + std::list<std::string> m_deviceList; int GetActionCode(int window, int action); - int GetActionCode(int window, const CKey &key, CStdString &strAction) const; + int GetActionCode(int window, const CKey &key, std::string &strAction) const; #if defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER) typedef std::map<int, std::map<int, std::string> > JoystickMap; // <window, <button/axis, action> > - int GetActionCode(int window, int id, const JoystickMap &wmap, CStdString &strAction, bool &fullrange) const; + int GetActionCode(int window, int id, const JoystickMap &wmap, std::string &strAction, bool &fullrange) const; #endif int GetFallbackWindow(int windowID); @@ -130,15 +130,15 @@ private: void MapWindowActions(TiXmlNode *pWindow, int wWindowID); void MapAction(uint32_t buttonCode, const char *szAction, buttonMap &map); - bool LoadKeymap(const CStdString &keymapPath); + bool LoadKeymap(const std::string &keymapPath); #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - bool LoadLircMap(const CStdString &lircmapPath); + bool LoadLircMap(const std::string &lircmapPath); void ClearLircButtonMapEntries(); void MapRemote(TiXmlNode *pRemote, const char* szDevice); - typedef std::map<CStdString, CStdString> lircButtonMap; - std::map<CStdString, lircButtonMap*> lircRemotesMap; + typedef std::map<std::string, std::string> lircButtonMap; + std::map<std::string, lircButtonMap*> lircRemotesMap; #endif #if defined(HAS_SDL_JOYSTICK) || defined(HAS_EVENT_SERVER) diff --git a/xbmc/input/KeyboardLayoutConfiguration.cpp b/xbmc/input/KeyboardLayoutConfiguration.cpp index 779c14f83c..916a2e559d 100644 --- a/xbmc/input/KeyboardLayoutConfiguration.cpp +++ b/xbmc/input/KeyboardLayoutConfiguration.cpp @@ -46,7 +46,7 @@ void CKeyboardLayoutConfiguration::SetDefaults() m_deriveXbmcCharFromVkeyWithRalt.clear(); } -bool CKeyboardLayoutConfiguration::Load(const CStdString& strFileName) +bool CKeyboardLayoutConfiguration::Load(const std::string& strFileName) { SetDefaults(); @@ -58,8 +58,8 @@ bool CKeyboardLayoutConfiguration::Load(const CStdString& strFileName) } TiXmlElement* pRootElement = xmlDoc.RootElement(); - CStdString strValue = pRootElement->Value(); - if (strValue != CStdString("keyboard_layout")) + std::string strValue = pRootElement->Value(); + if (strValue != "keyboard_layout") { CLog::Log(LOGERROR, "%s Doesn't contain <keyboard_layout>", strFileName.c_str()); return false; @@ -95,13 +95,13 @@ void CKeyboardLayoutConfiguration::readCharMapFromXML(const TiXmlElement* pXMLMa const TiXmlElement* pEntry = pXMLMap->FirstChildElement(); while (pEntry) { - CStdString strInChar = XMLUtils::GetAttribute(pEntry, "inchar"); - CStdString strOutChar = XMLUtils::GetAttribute(pEntry, "outchar"); + std::string strInChar = XMLUtils::GetAttribute(pEntry, "inchar"); + std::string strOutChar = XMLUtils::GetAttribute(pEntry, "outchar"); if (!strInChar.empty() && !strOutChar.empty()) { - CStdStringW fromStr; + std::wstring fromStr; g_charsetConverter.utf8ToW(strInChar, fromStr); - CStdStringW toStr; + std::wstring toStr; g_charsetConverter.utf8ToW(strOutChar, toStr); if (fromStr.size()==1 && toStr.size()==1) { @@ -133,12 +133,12 @@ void CKeyboardLayoutConfiguration::readByteMapFromXML(const TiXmlElement* pXMLMa const TiXmlElement* pEntry = pXMLMap->FirstChildElement(); while (pEntry) { - CStdString strInHex = XMLUtils::GetAttribute(pEntry, "inhex"); - CStdString strOutChar = XMLUtils::GetAttribute(pEntry, "outchar"); + std::string strInHex = XMLUtils::GetAttribute(pEntry, "inhex"); + std::string strOutChar = XMLUtils::GetAttribute(pEntry, "outchar"); if (!strInHex.empty() && !strOutChar.empty()) { - CStdString hexValue = strInHex; - CStdStringW toStr; + std::string hexValue = strInHex; + std::wstring toStr; g_charsetConverter.utf8ToW(strOutChar, toStr); int from; diff --git a/xbmc/input/KeyboardLayoutConfiguration.h b/xbmc/input/KeyboardLayoutConfiguration.h index fc59ae923e..decb0a6692 100644 --- a/xbmc/input/KeyboardLayoutConfiguration.h +++ b/xbmc/input/KeyboardLayoutConfiguration.h @@ -33,8 +33,8 @@ #endif #include <map> +#include <string> #include "utils/log.h" -#include "utils/StdString.h" class TiXmlElement; @@ -44,7 +44,7 @@ public: CKeyboardLayoutConfiguration(); ~CKeyboardLayoutConfiguration(); - bool Load(const CStdString& strFileName); + bool Load(const std::string& strFileName); bool containsChangeXbmcCharRegardlessModifiers(WCHAR key); bool containsChangeXbmcCharWithRalt(WCHAR key); diff --git a/xbmc/input/KeyboardStat.cpp b/xbmc/input/KeyboardStat.cpp index 222863b6fe..75f726521c 100644 --- a/xbmc/input/KeyboardStat.cpp +++ b/xbmc/input/KeyboardStat.cpp @@ -188,9 +188,9 @@ void CKeyboardStat::ProcessKeyUp(void) // Used to make the debug log more intelligable // The KeyID includes the flags for ctrl, alt etc -CStdString CKeyboardStat::GetKeyName(int KeyID) +std::string CKeyboardStat::GetKeyName(int KeyID) { int keyid; - CStdString keyname; + std::string keyname; XBMCKEYTABLE keytable; keyname.clear(); diff --git a/xbmc/input/KeyboardStat.h b/xbmc/input/KeyboardStat.h index 7e8eb4b882..73af94323d 100644 --- a/xbmc/input/KeyboardStat.h +++ b/xbmc/input/KeyboardStat.h @@ -51,7 +51,7 @@ public: const CKey ProcessKeyDown(XBMC_keysym& keysym); void ProcessKeyUp(void); - CStdString GetKeyName(int KeyID); + std::string GetKeyName(int KeyID); private: bool LookupSymAndUnicodePeripherals(XBMC_keysym &keysym, uint8_t *key, char *unicode); diff --git a/xbmc/input/XBMC_keytable.cpp b/xbmc/input/XBMC_keytable.cpp index 834cccbe88..a51ee0c552 100644 --- a/xbmc/input/XBMC_keytable.cpp +++ b/xbmc/input/XBMC_keytable.cpp @@ -19,7 +19,6 @@ */ #include "system.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" #include "input/XBMC_keysym.h" #include "input/XBMC_vkeys.h" @@ -245,7 +244,7 @@ bool KeyTableLookupName(const char* keyname, XBMCKEYTABLE* keytable) return false; // We need the button name to be in lowercase - CStdString lkeyname = keyname; + std::string lkeyname = keyname; StringUtils::ToLower(lkeyname); // Look up the key name in XBMCKeyTable diff --git a/xbmc/input/linux/LIRC.cpp b/xbmc/input/linux/LIRC.cpp index 3b3ebba2ac..04adc396f2 100644 --- a/xbmc/input/linux/LIRC.cpp +++ b/xbmc/input/linux/LIRC.cpp @@ -111,7 +111,7 @@ void CRemoteControl::Disconnect() } } -void CRemoteControl::setDeviceName(const CStdString& value) +void CRemoteControl::setDeviceName(const std::string& value) { if (value.length()>0) m_deviceName=value; @@ -346,7 +346,7 @@ unsigned int CRemoteControl::GetHoldTime() const return m_holdTime; } -void CRemoteControl::AddSendCommand(const CStdString& command) +void CRemoteControl::AddSendCommand(const std::string& command) { if (!m_bInitialized || !m_used) return; diff --git a/xbmc/input/linux/LIRC.h b/xbmc/input/linux/LIRC.h index d312e32bd8..386a353b8f 100644 --- a/xbmc/input/linux/LIRC.h +++ b/xbmc/input/linux/LIRC.h @@ -22,7 +22,7 @@ #define LIRC_H #include "system.h" -#include "utils/StdString.h" +#include <string> class CRemoteControl { @@ -38,11 +38,11 @@ public: \return time in milliseconds the button has been down */ unsigned int GetHoldTime() const; - void setDeviceName(const CStdString& value); + void setDeviceName(const std::string& value); void setUsed(bool value); bool IsInUse() const { return m_used; } bool IsInitialized() const { return m_bInitialized; } - void AddSendCommand(const CStdString& command); + void AddSendCommand(const std::string& command); private: int m_fd; @@ -58,9 +58,9 @@ private: bool m_used; bool m_bLogConnectFailure; uint32_t m_firstClickTime; - CStdString m_deviceName; + std::string m_deviceName; bool CheckDevice(); - CStdString m_sendData; + std::string m_sendData; bool m_inReply; int m_nrSending; }; diff --git a/xbmc/input/windows/IRServerSuite.h b/xbmc/input/windows/IRServerSuite.h index ac0447205e..a310665c3a 100644 --- a/xbmc/input/windows/IRServerSuite.h +++ b/xbmc/input/windows/IRServerSuite.h @@ -20,7 +20,6 @@ */ #include <winsock2.h> -#include "utils/StdString.h" #include "IrssMessage.h" #include "threads/Thread.h" @@ -40,7 +39,7 @@ public: //lirc stuff, not implemented bool IsInUse() {return false;} void setUsed(bool value); - void AddSendCommand(const CStdString& command) {} + void AddSendCommand(const std::string& command) {} protected: virtual void Process(); @@ -51,8 +50,8 @@ private: SOCKET m_socket; bool m_isConnecting; int m_iAttempt; - CStdString m_deviceName; - CStdString m_keyCode; + std::string m_deviceName; + std::string m_keyCode; bool SendPacket(CIrssMessage& message); bool ReadPacket(CIrssMessage& message); diff --git a/xbmc/input/windows/IrssMessage.cpp b/xbmc/input/windows/IrssMessage.cpp index 4a73ad26e2..18d133dc9a 100644 --- a/xbmc/input/windows/IrssMessage.cpp +++ b/xbmc/input/windows/IrssMessage.cpp @@ -43,7 +43,7 @@ CIrssMessage::CIrssMessage(IRSS_MessageType type, uint32_t flags, char* data, in SetDataAsBytes(data, size); } -CIrssMessage::CIrssMessage(IRSS_MessageType type, uint32_t flags, const CStdString& data) +CIrssMessage::CIrssMessage(IRSS_MessageType type, uint32_t flags, const std::string& data) { m_type = type; m_flags = flags; @@ -69,9 +69,9 @@ void CIrssMessage::SetDataAsBytes(char* data, int size) } } -void CIrssMessage::SetDataAsString(const CStdString& data) +void CIrssMessage::SetDataAsString(const std::string& data) { - if (!data || data.empty()) + if (data.empty()) { FreeData(); } diff --git a/xbmc/input/windows/IrssMessage.h b/xbmc/input/windows/IrssMessage.h index 6c1db7d18d..1018032182 100644 --- a/xbmc/input/windows/IrssMessage.h +++ b/xbmc/input/windows/IrssMessage.h @@ -19,7 +19,7 @@ * */ -#include "utils/StdString.h" +#include <string> /// <summary> /// Type of message. @@ -183,11 +183,11 @@ public: CIrssMessage(); CIrssMessage(IRSS_MessageType type, uint32_t flags); CIrssMessage(IRSS_MessageType type, uint32_t flags, char* data, int size); - CIrssMessage(IRSS_MessageType type, uint32_t flags, const CStdString& data); + CIrssMessage(IRSS_MessageType type, uint32_t flags, const std::string& data); ~CIrssMessage(); void SetDataAsBytes(char* data, int size); - void SetDataAsString(const CStdString& data); + void SetDataAsString(const std::string& data); char* ToBytes(int& size); void SetType(IRSS_MessageType type); void SetFlags(uint32_t flags); diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp index 9c9dcdde9e..4c09af164c 100644 --- a/xbmc/interfaces/AnnouncementManager.cpp +++ b/xbmc/interfaces/AnnouncementManager.cpp @@ -111,7 +111,7 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c // Extract db id of item CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject; - CStdString type; + std::string type; int id = 0; if(item->HasPVRChannelInfoTag()) @@ -137,8 +137,8 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c CVideoDatabase videodatabase; if (videodatabase.Open()) { - CStdString path = item->GetPath(); - CStdString videoInfoTagPath(item->GetVideoInfoTag()->m_strFileNameAndPath); + std::string path = item->GetPath(); + std::string videoInfoTagPath(item->GetVideoInfoTag()->m_strFileNameAndPath); if (StringUtils::StartsWith(videoInfoTagPath, "removable://")) path = videoInfoTagPath; if (videodatabase.LoadVideoInfo(path, *item->GetVideoInfoTag())) @@ -158,7 +158,7 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c // TODO: Can be removed once this is properly handled when starting playback of a file item->SetProperty(LOOKUP_PROPERTY, false); - CStdString title = item->GetVideoInfoTag()->m_strTitle; + std::string title = item->GetVideoInfoTag()->m_strTitle; if (title.empty()) title = item->GetLabel(); object["item"]["title"] = title; @@ -214,7 +214,7 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c // TODO: Can be removed once this is properly handled when starting playback of a file item->SetProperty(LOOKUP_PROPERTY, false); - CStdString title = item->GetMusicInfoTag()->GetTitle(); + std::string title = item->GetMusicInfoTag()->GetTitle(); if (title.empty()) title = item->GetLabel(); object["item"]["title"] = title; diff --git a/xbmc/interfaces/Builtins.cpp b/xbmc/interfaces/Builtins.cpp index 7251dee800..18168514a8 100644 --- a/xbmc/interfaces/Builtins.cpp +++ b/xbmc/interfaces/Builtins.cpp @@ -230,9 +230,9 @@ const BUILT_IN commands[] = { { "SetStereoMode", true, "Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, monoscopic)" } }; -bool CBuiltins::HasCommand(const CStdString& execString) +bool CBuiltins::HasCommand(const std::string& execString) { - CStdString function; + std::string function; vector<string> parameters; CUtil::SplitExecFunction(execString, function, parameters); for (unsigned int i = 0; i < sizeof(commands)/sizeof(BUILT_IN); i++) @@ -243,7 +243,7 @@ bool CBuiltins::HasCommand(const CStdString& execString) return false; } -void CBuiltins::GetHelp(CStdString &help) +void CBuiltins::GetHelp(std::string &help) { help.clear(); for (unsigned int i = 0; i < sizeof(commands)/sizeof(BUILT_IN); i++) @@ -255,58 +255,59 @@ void CBuiltins::GetHelp(CStdString &help) } } -int CBuiltins::Execute(const CStdString& execString) +int CBuiltins::Execute(const std::string& execString) { // Get the text after the "XBMC." - CStdString execute; + std::string execute; vector<string> params; CUtil::SplitExecFunction(execString, execute, params); StringUtils::ToLower(execute); - CStdString parameter = params.size() ? params[0] : ""; - CStdString strParameterCaseIntact = parameter; + std::string parameter = params.size() ? params[0] : ""; + std::string paramlow(parameter); + StringUtils::ToLower(paramlow); - if (execute.Equals("reboot") || execute.Equals("restart") || execute.Equals("reset")) //Will reboot the system + if (execute == "reboot" || execute == "restart" || execute == "reset") //Will reboot the system { CApplicationMessenger::Get().Restart(); } - else if (execute.Equals("shutdown")) + else if (execute == "shutdown") { CApplicationMessenger::Get().Shutdown(); } - else if (execute.Equals("powerdown")) + else if (execute == "powerdown") { CApplicationMessenger::Get().Powerdown(); } - else if (execute.Equals("restartapp")) + else if (execute == "restartapp") { CApplicationMessenger::Get().RestartApp(); } - else if (execute.Equals("hibernate")) + else if (execute == "hibernate") { CApplicationMessenger::Get().Hibernate(); } - else if (execute.Equals("suspend")) + else if (execute == "suspend") { CApplicationMessenger::Get().Suspend(); } - else if (execute.Equals("quit")) + else if (execute == "quit") { CApplicationMessenger::Get().Quit(); } - else if (execute.Equals("inhibitidleshutdown")) + else if (execute == "inhibitidleshutdown") { bool inhibit = (params.size() == 1 && StringUtils::EqualsNoCase(params[0], "true")); CApplicationMessenger::Get().InhibitIdleShutdown(inhibit); } - else if (execute.Equals("activatescreensaver")) + else if (execute == "activatescreensaver") { CApplicationMessenger::Get().ActivateScreensaver(); } - else if (execute.Equals("minimize")) + else if (execute == "minimize") { CApplicationMessenger::Get().Minimize(); } - else if (execute.Equals("loadprofile")) + else if (execute == "loadprofile") { int index = CProfilesManager::Get().GetProfileIndex(parameter); bool prompt = (params.size() == 2 && StringUtils::EqualsNoCase(params[1], "prompt")); @@ -318,7 +319,7 @@ int CBuiltins::Execute(const CStdString& execString) CApplicationMessenger::Get().LoadProfile(index); } } - else if (execute.Equals("mastermode")) + else if (execute == "mastermode") { if (g_passwordManager.bMasterUser) { @@ -337,19 +338,19 @@ int CBuiltins::Execute(const CStdString& execString) CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE); g_windowManager.SendMessage(msg); } - else if (execute.Equals("setguilanguage")) + else if (execute == "setguilanguage") { if (params.size()) { CApplicationMessenger::Get().SetGUILanguage(params[0]); } } - else if (execute.Equals("takescreenshot")) + else if (execute == "takescreenshot") { if (params.size()) { // get the parameters - CStdString strSaveToPath = params[0]; + std::string strSaveToPath = params[0]; bool sync = false; if (params.size() >= 2) sync = StringUtils::EqualsNoCase(params[1], "sync"); @@ -358,7 +359,7 @@ int CBuiltins::Execute(const CStdString& execString) { if (CDirectory::Exists(strSaveToPath)) { - CStdString file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(strSaveToPath, "screenshot%03d.png"), 999); + std::string file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(strSaveToPath, "screenshot%03d.png"), 999); if (!file.empty()) { @@ -376,10 +377,10 @@ int CBuiltins::Execute(const CStdString& execString) else CScreenShot::TakeScreenshot(); } - else if (execute.Equals("activatewindow") || execute.Equals("replacewindow")) + else if (execute == "activatewindow" || execute == "replacewindow") { // get the parameters - CStdString strWindow; + std::string strWindow; if (params.size()) { strWindow = params[0]; @@ -392,7 +393,7 @@ int CBuiltins::Execute(const CStdString& execString) { // disable the screensaver g_application.WakeUpScreenSaverAndDPMS(); - g_windowManager.ActivateWindow(iWindow, params, !execute.Equals("activatewindow")); + g_windowManager.ActivateWindow(iWindow, params, execute != "activatewindow"); } else { @@ -400,16 +401,16 @@ int CBuiltins::Execute(const CStdString& execString) return false; } } - else if ((execute.Equals("setfocus") || execute.Equals("control.setfocus")) && params.size()) + else if ((execute == "setfocus" || execute == "control.setfocus") && params.size()) { int controlID = atol(params[0].c_str()); int subItem = (params.size() > 1) ? atol(params[1].c_str())+1 : 0; CGUIMessage msg(GUI_MSG_SETFOCUS, g_windowManager.GetFocusedWindow(), controlID, subItem); g_windowManager.SendMessage(msg); } - else if ((execute.Equals("activatewindowandfocus") || execute.Equals("replacewindowandfocus")) && params.size()) + else if ((execute == "activatewindowandfocus" || execute == "replacewindowandfocus") && params.size()) { - CStdString strWindow = params[0]; + std::string strWindow = params[0]; // confirm the window destination is valid prior to switching int iWindow = CButtonTranslator::TranslateWindow(strWindow); @@ -418,7 +419,7 @@ int CBuiltins::Execute(const CStdString& execString) // disable the screensaver g_application.WakeUpScreenSaverAndDPMS(); vector<string> dummy; - g_windowManager.ActivateWindow(iWindow, dummy, !execute.Equals("activatewindowandfocus")); + g_windowManager.ActivateWindow(iWindow, dummy, execute != "activatewindowandfocus"); unsigned int iPtr = 1; while (params.size() > iPtr + 1) @@ -436,19 +437,19 @@ int CBuiltins::Execute(const CStdString& execString) return false; } } - else if (execute.Equals("runscript") && params.size()) + else if (execute == "runscript" && params.size()) { #if defined(TARGET_DARWIN_OSX) - if (URIUtils::HasExtension(strParameterCaseIntact, ".applescript|.scpt")) + if (URIUtils::HasExtension(parameter, ".applescript|.scpt")) { - CStdString osxPath = CSpecialProtocol::TranslatePath(strParameterCaseIntact); + std::string osxPath = CSpecialProtocol::TranslatePath(parameter); Cocoa_DoAppleScriptFile(osxPath.c_str()); } else #endif { AddonPtr script; - CStdString scriptpath(params[0]); + std::string scriptpath(params[0]); if (CAddonMgr::Get().GetAddon(params[0], script)) scriptpath = script->LibPath(); @@ -462,14 +463,14 @@ int CBuiltins::Execute(const CStdString& execString) } } #if defined(TARGET_DARWIN_OSX) - else if (execute.Equals("runapplescript")) + else if (execute == "runapplescript") { - Cocoa_DoAppleScript(strParameterCaseIntact.c_str()); + Cocoa_DoAppleScript(parameter.c_str()); } #endif - else if (execute.Equals("stopscript")) + else if (execute == "stopscript") { - CStdString scriptpath(params[0]); + std::string scriptpath(params[0]); // Test to see if the param is an addon ID AddonPtr script; @@ -478,39 +479,39 @@ int CBuiltins::Execute(const CStdString& execString) CScriptInvocationManager::Get().Stop(scriptpath); } - else if (execute.Equals("system.exec")) + else if (execute == "system.exec") { CApplicationMessenger::Get().Minimize(); CApplicationMessenger::Get().ExecOS(parameter, false); } - else if (execute.Equals("system.execwait")) + else if (execute == "system.execwait") { CApplicationMessenger::Get().Minimize(); CApplicationMessenger::Get().ExecOS(parameter, true); } - else if (execute.Equals("resolution")) + else if (execute == "resolution") { RESOLUTION res = RES_PAL_4x3; - if (parameter.Equals("pal")) res = RES_PAL_4x3; - else if (parameter.Equals("pal16x9")) res = RES_PAL_16x9; - else if (parameter.Equals("ntsc")) res = RES_NTSC_4x3; - else if (parameter.Equals("ntsc16x9")) res = RES_NTSC_16x9; - else if (parameter.Equals("720p")) res = RES_HDTV_720p; - else if (parameter.Equals("720pSBS")) res = RES_HDTV_720pSBS; - else if (parameter.Equals("720pTB")) res = RES_HDTV_720pTB; - else if (parameter.Equals("1080pSBS")) res = RES_HDTV_1080pSBS; - else if (parameter.Equals("1080pTB")) res = RES_HDTV_1080pTB; - else if (parameter.Equals("1080i")) res = RES_HDTV_1080i; + if (paramlow == "pal") res = RES_PAL_4x3; + else if (paramlow == "pal16x9") res = RES_PAL_16x9; + else if (paramlow == "ntsc") res = RES_NTSC_4x3; + else if (paramlow == "ntsc16x9") res = RES_NTSC_16x9; + else if (paramlow == "720p") res = RES_HDTV_720p; + else if (paramlow == "720psbs") res = RES_HDTV_720pSBS; + else if (paramlow == "720ptb") res = RES_HDTV_720pTB; + else if (paramlow == "1080psbs") res = RES_HDTV_1080pSBS; + else if (paramlow == "1080ptb") res = RES_HDTV_1080pTB; + else if (paramlow == "1080i") res = RES_HDTV_1080i; if (g_graphicsContext.IsValidResolution(res)) { CDisplaySettings::Get().SetCurrentResolution(res, true); g_application.ReloadSkin(); } } - else if (execute.Equals("extract") && params.size()) + else if (execute == "extract" && params.size()) { // Detects if file is zip or rar then extracts - CStdString strDestDirect; + std::string strDestDirect; if (params.size() < 2) strDestDirect = URIUtils::GetDirectory(params[0]); else @@ -527,7 +528,7 @@ int CBuiltins::Execute(const CStdString& execString) else CLog::Log(LOGERROR, "XBMC.Extract, No archive given"); } - else if (execute.Equals("runplugin")) + else if (execute == "runplugin") { if (params.size()) { @@ -543,17 +544,17 @@ int CBuiltins::Execute(const CStdString& execString) CLog::Log(LOGERROR, "XBMC.RunPlugin called with no arguments."); } } - else if (execute.Equals("runaddon")) + else if (execute == "runaddon") { if (params.size()) { AddonPtr addon; - CStdString cmd; + std::string cmd; if (CAddonMgr::Get().GetAddon(params[0],addon,ADDON_PLUGIN)) { PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addon); - CStdString addonid = params[0]; - CStdString urlParameters; + std::string addonid = params[0]; + std::string urlParameters; vector<string> parameters; if (params.size() == 2 && (StringUtils::StartsWith(params[1], "/") || StringUtils::StartsWith(params[1], "?"))) @@ -597,7 +598,7 @@ int CBuiltins::Execute(const CStdString& execString) CLog::Log(LOGERROR, "XBMC.RunAddon called with no arguments."); } } - else if (execute.Equals("notifyall")) + else if (execute == "notifyall") { if (params.size() > 1) { @@ -610,7 +611,7 @@ int CBuiltins::Execute(const CStdString& execString) else CLog::Log(LOGERROR, "XBMC.NotifyAll needs two parameters"); } - else if (execute.Equals("playmedia")) + else if (execute == "playmedia") { if (!params.size()) { @@ -669,7 +670,7 @@ int CBuiltins::Execute(const CStdString& execString) if (item.m_bIsFolder) { CFileItemList items; - CStdString extensions = g_advancedSettings.m_videoExtensions + "|" + g_advancedSettings.m_musicExtensions; + std::string extensions = g_advancedSettings.m_videoExtensions + "|" + g_advancedSettings.m_musicExtensions; CDirectory::GetDirectory(item.GetPath(),items,extensions); bool containsMusic = false, containsVideo = false; @@ -718,7 +719,7 @@ int CBuiltins::Execute(const CStdString& execString) } } } - else if (execute.Equals("showPicture")) + else if (execute == "showpicture") { if (!params.size()) { @@ -730,7 +731,7 @@ int CBuiltins::Execute(const CStdString& execString) CGUIWindow *pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW); if (pWindow) pWindow->OnMessage(msg); } - else if (execute.Equals("slideShow") || execute.Equals("recursiveslideShow")) + else if (execute == "slideshow" || execute == "recursiveslideshow") { if (!params.size()) { @@ -740,7 +741,7 @@ int CBuiltins::Execute(const CStdString& execString) std::string beginSlidePath; // leave RecursiveSlideShow command as-is unsigned int flags = 0; - if (execute.Equals("RecursiveSlideShow")) + if (execute == "recursiveslideshow") flags |= 1; // SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"]) @@ -771,20 +772,20 @@ int CBuiltins::Execute(const CStdString& execString) CGUIWindow *pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW); if (pWindow) pWindow->OnMessage(msg); } - else if (execute.Equals("reloadskin")) + else if (execute == "reloadskin") { // Reload the skin g_application.ReloadSkin(!params.empty() && StringUtils::EqualsNoCase(params[0], "confirm")); } - else if (execute.Equals("unloadskin")) + else if (execute == "unloadskin") { g_application.UnloadSkin(true); // we're reloading the skin after this } - else if (execute.Equals("refreshrss")) + else if (execute == "refreshrss") { CRssManager::Get().Reload(); } - else if (execute.Equals("playercontrol")) + else if (execute == "playercontrol") { g_application.ResetScreenSaver(); g_application.WakeUpScreenSaverAndDPMS(); @@ -793,7 +794,7 @@ int CBuiltins::Execute(const CStdString& execString) CLog::Log(LOGERROR, "XBMC.PlayerControl called with empty parameter"); return -3; } - if (parameter.Equals("play")) + if (paramlow == "play") { // play/pause // either resume playing, or pause if (g_application.m_pPlayer->IsPlaying()) @@ -804,20 +805,20 @@ int CBuiltins::Execute(const CStdString& execString) g_application.m_pPlayer->Pause(); } } - else if (parameter.Equals("stop")) + else if (paramlow == "stop") { g_application.StopPlaying(); } - else if (parameter.Equals("rewind") || parameter.Equals("forward")) + else if (paramlow =="rewind" || paramlow == "forward") { if (g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused()) { int iPlaySpeed = g_application.m_pPlayer->GetPlaySpeed(); - if (parameter.Equals("rewind") && iPlaySpeed == 1) // Enables Rewinding + if (paramlow == "rewind" && iPlaySpeed == 1) // Enables Rewinding iPlaySpeed *= -2; - else if (parameter.Equals("rewind") && iPlaySpeed > 1) //goes down a notch if you're FFing + else if (paramlow == "rewind" && iPlaySpeed > 1) //goes down a notch if you're FFing iPlaySpeed /= 2; - else if (parameter.Equals("forward") && iPlaySpeed < 1) //goes up a notch if you're RWing + else if (paramlow == "forward" && iPlaySpeed < 1) //goes up a notch if you're RWing { iPlaySpeed /= 2; if (iPlaySpeed == -1) iPlaySpeed = 1; @@ -831,37 +832,37 @@ int CBuiltins::Execute(const CStdString& execString) g_application.m_pPlayer->SetPlaySpeed(iPlaySpeed, g_application.IsMutedInternal()); } } - else if (parameter.Equals("next")) + else if (paramlow == "next") { g_application.OnAction(CAction(ACTION_NEXT_ITEM)); } - else if (parameter.Equals("previous")) + else if (paramlow == "previous") { g_application.OnAction(CAction(ACTION_PREV_ITEM)); } - else if (parameter.Equals("bigskipbackward")) + else if (paramlow == "bigskipbackward") { if (g_application.m_pPlayer->IsPlaying()) g_application.m_pPlayer->Seek(false, true); } - else if (parameter.Equals("bigskipforward")) + else if (paramlow == "bigskipforward") { if (g_application.m_pPlayer->IsPlaying()) g_application.m_pPlayer->Seek(true, true); } - else if (parameter.Equals("smallskipbackward")) + else if (paramlow == "smallskipbackward") { if (g_application.m_pPlayer->IsPlaying()) g_application.m_pPlayer->Seek(false, false); } - else if (parameter.Equals("smallskipforward")) + else if (paramlow == "smallskipforward") { if (g_application.m_pPlayer->IsPlaying()) g_application.m_pPlayer->Seek(true, false); } else if (StringUtils::StartsWithNoCase(parameter, "seekpercentage")) { - CStdString offset = ""; + std::string offset; if (parameter.size() == 14) CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) called with no argument"); else if (parameter.size() < 17) // arg must be at least "(N)" @@ -878,19 +879,19 @@ int CBuiltins::Execute(const CStdString& execString) g_application.SeekPercentage(offsetpercent); } } - else if( parameter.Equals("showvideomenu") ) + else if (paramlow == "showvideomenu") { if( g_application.m_pPlayer->IsPlaying() ) g_application.m_pPlayer->OnAction(CAction(ACTION_SHOW_VIDEOMENU)); } - else if( parameter.Equals("record") ) + else if (paramlow == "record") { if( g_application.m_pPlayer->IsPlaying() && g_application.m_pPlayer->CanRecord()) g_application.m_pPlayer->Record(!g_application.m_pPlayer->IsRecording()); } else if (StringUtils::StartsWithNoCase(parameter, "partymode")) { - CStdString strXspPath = ""; + std::string strXspPath; //empty param=music, "music"=music, "video"=video, else xsp path PartyModeContext context = PARTYMODECONTEXT_MUSIC; if (parameter.size() > 9) @@ -909,16 +910,14 @@ int CBuiltins::Execute(const CStdString& execString) else g_partyModeManager.Enable(context, strXspPath); } - else if (parameter.Equals("random") || - parameter.Equals("randomoff") || - parameter.Equals("randomon")) + else if (paramlow == "random" || paramlow == "randomoff" || paramlow == "randomon") { // get current playlist int iPlaylist = g_playlistPlayer.GetCurrentPlaylist(); // reverse the current setting bool shuffled = g_playlistPlayer.IsShuffled(iPlaylist); - if ((shuffled && parameter.Equals("randomon")) || (!shuffled && parameter.Equals("randomoff"))) + if ((shuffled && paramlow == "randomon") || (!shuffled && paramlow == "randomoff")) return 0; // check to see if we should notify the user @@ -949,11 +948,11 @@ int CBuiltins::Execute(const CStdString& execString) PLAYLIST::REPEAT_STATE previous_state = g_playlistPlayer.GetRepeat(iPlaylist); PLAYLIST::REPEAT_STATE state; - if (parameter.Equals("repeatall")) + if (paramlow == "repeatall") state = PLAYLIST::REPEAT_ALL; - else if (parameter.Equals("repeatone")) + else if (paramlow == "repeatone") state = PLAYLIST::REPEAT_ONE; - else if (parameter.Equals("repeatoff")) + else if (paramlow == "repeatoff") state = PLAYLIST::REPEAT_NONE; else if (previous_state == PLAYLIST::REPEAT_NONE) state = PLAYLIST::REPEAT_ALL; @@ -986,16 +985,16 @@ int CBuiltins::Execute(const CStdString& execString) g_windowManager.SendThreadMessage(msg); } } - else if (execute.Equals("playwith")) + else if (execute == "playwith") { g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().GetPlayerCore(parameter); g_application.OnAction(CAction(ACTION_PLAYER_PLAY)); } - else if (execute.Equals("mute")) + else if (execute == "mute") { g_application.ToggleMute(); } - else if (execute.Equals("setvolume")) + else if (execute == "setvolume") { float oldVolume = g_application.GetVolume(); float volume = (float)strtod(parameter.c_str(), NULL); @@ -1009,21 +1008,21 @@ int CBuiltins::Execute(const CStdString& execString) } } } - else if (execute.Equals("playlist.playoffset")) + else if (execute == "playlist.playoffset") { // playlist.playoffset(offset) // playlist.playoffset(music|video,offset) - CStdString strPos = parameter; + std::string strPos = parameter; if (params.size() > 1) { // ignore any other parameters if present - CStdString strPlaylist = params[0]; + std::string strPlaylist = params[0]; strPos = params[1]; int iPlaylist = PLAYLIST_NONE; - if (strPlaylist.Equals("music")) + if (paramlow == "music") iPlaylist = PLAYLIST_MUSIC; - else if (strPlaylist.Equals("video")) + else if (paramlow == "video") iPlaylist = PLAYLIST_VIDEO; // unknown playlist @@ -1050,17 +1049,17 @@ int CBuiltins::Execute(const CStdString& execString) else g_playlistPlayer.Play(pos); } - else if (execute.Equals("playlist.clear")) + else if (execute == "playlist.clear") { g_playlistPlayer.Clear(); } #ifdef HAS_DVD_DRIVE - else if (execute.Equals("ejecttray")) + else if (execute == "ejecttray") { g_mediaManager.ToggleTray(); } #endif - else if( execute.Equals("alarmclock") && params.size() > 1 ) + else if (execute == "alarmclock" && params.size() > 1) { // format is alarmclock(name,command[,seconds,true]); float seconds = 0; @@ -1073,12 +1072,12 @@ int CBuiltins::Execute(const CStdString& execString) } else { // check if shutdown is specified in particular, and get the time for it - CStdString strHeading; + std::string strHeading; if (StringUtils::EqualsNoCase(parameter, "shutdowntimer")) strHeading = g_localizeStrings.Get(20145); else strHeading = g_localizeStrings.Get(13209); - CStdString strTime; + std::string strTime; if( CGUIDialogNumeric::ShowAndGetNumber(strTime, strHeading) ) seconds = static_cast<float>(atoi(strTime.c_str())*60); else @@ -1102,7 +1101,7 @@ int CBuiltins::Execute(const CStdString& execString) return false; g_alarmClock.Start(params[0], seconds, params[1], silent, loop); } - else if (execute.Equals("notification")) + else if (execute == "notification") { if (params.size() < 2) return -1; @@ -1113,14 +1112,14 @@ int CBuiltins::Execute(const CStdString& execString) else CGUIDialogKaiToast::QueueNotification(params[0],params[1]); } - else if (execute.Equals("cancelalarm")) + else if (execute == "cancelalarm") { bool silent = false; if (params.size() > 1 && StringUtils::EqualsNoCase(params[1], "true")) silent = true; g_alarmClock.Stop(params[0],silent); } - else if (execute.Equals("playdvd")) + else if (execute == "playdvd") { #ifdef HAS_DVD_DRIVE bool restart = false; @@ -1129,19 +1128,19 @@ int CBuiltins::Execute(const CStdString& execString) CAutorun::PlayDisc(g_mediaManager.GetDiscPath(), true, restart); #endif } - else if (execute.Equals("ripcd")) + else if (execute == "ripcd") { #ifdef HAS_CDDA_RIPPER CCDDARipper::GetInstance().RipCD(); #endif } - else if (execute.Equals("skin.togglesetting")) + else if (execute == "skin.togglesetting") { int setting = CSkinSettings::Get().TranslateBool(parameter); CSkinSettings::Get().SetBool(setting, !CSkinSettings::Get().GetBool(setting)); CSettings::Get().Save(); } - else if (execute.Equals("skin.setbool") && params.size()) + else if (execute == "skin.setbool" && params.size()) { if (params.size() > 1) { @@ -1155,17 +1154,17 @@ int CBuiltins::Execute(const CStdString& execString) CSkinSettings::Get().SetBool(setting, true); CSettings::Get().Save(); } - else if (execute.Equals("skin.reset")) + else if (execute == "skin.reset") { CSkinSettings::Get().Reset(parameter); CSettings::Get().Save(); } - else if (execute.Equals("skin.resetsettings")) + else if (execute == "skin.resetsettings") { CSkinSettings::Get().Reset(); CSettings::Get().Save(); } - else if (execute.Equals("skin.theme")) + else if (execute == "skin.theme") { // enumerate themes vector<std::string> vecTheme; @@ -1178,7 +1177,7 @@ int CBuiltins::Execute(const CStdString& execString) { for (unsigned int i=0;i<vecTheme.size();++i) { - CStdString strTmpTheme(CSettings::Get().GetString("lookandfeel.skintheme")); + std::string strTmpTheme(CSettings::Get().GetString("lookandfeel.skintheme")); URIUtils::RemoveExtension(strTmpTheme); if (StringUtils::EqualsNoCase(vecTheme[i], strTmpTheme)) { @@ -1198,27 +1197,28 @@ int CBuiltins::Execute(const CStdString& execString) if (iTheme < -1) iTheme = vecTheme.size()-1; - CStdString strSkinTheme = "SKINDEFAULT"; + std::string strSkinTheme = "SKINDEFAULT"; if (iTheme != -1 && iTheme < (int)vecTheme.size()) strSkinTheme = vecTheme[iTheme]; CSettings::Get().SetString("lookandfeel.skintheme", strSkinTheme); // also set the default color theme - CStdString colorTheme(URIUtils::ReplaceExtension(strSkinTheme, ".xml")); - if (colorTheme.Equals("Textures.xml")) + std::string colorTheme(URIUtils::ReplaceExtension(strSkinTheme, ".xml")); + if (StringUtils::EqualsNoCase(colorTheme, "Textures.xml")) colorTheme = "defaults.xml"; CSettings::Get().SetString("lookandfeel.skincolors", colorTheme); g_application.ReloadSkin(); } - else if (execute.Equals("skin.setstring") || execute.Equals("skin.setimage") || execute.Equals("skin.setfile") || - execute.Equals("skin.setpath") || execute.Equals("skin.setnumeric") || execute.Equals("skin.setlargeimage")) + else if (execute == "skin.setstring" || execute == "skin.setimage" || + execute == "skin.setfile" || execute == "skin.setpath" || + execute == "skin.setnumeric" || execute == "skin.setlargeimage") { // break the parameter up if necessary int string = 0; if (params.size() > 1) { string = CSkinSettings::Get().TranslateString(params[0]); - if (execute.Equals("skin.setstring")) + if (execute == "skin.setstring") { CSkinSettings::Get().SetString(string, params[1]); CSettings::Get().Save(); @@ -1227,37 +1227,37 @@ int CBuiltins::Execute(const CStdString& execString) } else string = CSkinSettings::Get().TranslateString(params[0]); - CStdString value = CSkinSettings::Get().GetString(string); + std::string value = CSkinSettings::Get().GetString(string); VECSOURCES localShares; g_mediaManager.GetLocalDrives(localShares); - if (execute.Equals("skin.setstring")) + if (execute == "skin.setstring") { if (CGUIKeyboardFactory::ShowAndGetInput(value, g_localizeStrings.Get(1029), true)) CSkinSettings::Get().SetString(string, value); } - else if (execute.Equals("skin.setnumeric")) + else if (execute == "skin.setnumeric") { if (CGUIDialogNumeric::ShowAndGetNumber(value, g_localizeStrings.Get(611))) CSkinSettings::Get().SetString(string, value); } - else if (execute.Equals("skin.setimage")) + else if (execute == "skin.setimage") { if (CGUIDialogFileBrowser::ShowAndGetImage(localShares, g_localizeStrings.Get(1030), value)) CSkinSettings::Get().SetString(string, value); } - else if (execute.Equals("skin.setlargeimage")) + else if (execute == "skin.setlargeimage") { VECSOURCES *shares = CMediaSourceSettings::Get().GetSources("pictures"); if (!shares) shares = &localShares; if (CGUIDialogFileBrowser::ShowAndGetImage(*shares, g_localizeStrings.Get(1030), value)) CSkinSettings::Get().SetString(string, value); } - else if (execute.Equals("skin.setfile")) + else if (execute == "skin.setfile") { // Note. can only browse one addon type from here // if browsing for addons, required param[1] is addontype string, with optional param[2] // as contenttype string see IAddon.h & ADDON::TranslateXX - CStdString strMask = (params.size() > 1) ? params[1] : ""; + std::string strMask = (params.size() > 1) ? params[1] : ""; StringUtils::ToLower(strMask); ADDON::TYPE type; if ((type = TranslateType(strMask)) != ADDON_UNKNOWN) @@ -1267,13 +1267,13 @@ int CBuiltins::Execute(const CStdString& execString) url.SetHostName("enabled"); url.SetFileName(strMask+"/"); localShares.clear(); - CStdString content = (params.size() > 2) ? params[2] : ""; + std::string content = (params.size() > 2) ? params[2] : ""; StringUtils::ToLower(content); url.SetPassword(content); - CStdString strMask; + std::string strMask; if (type == ADDON_SCRIPT) strMask = ".py"; - CStdString replace; + std::string replace; if (CGUIDialogFileBrowser::ShowAndGetFile(url.Get(), strMask, TranslateType(type, true), replace, true, true, true)) { if (StringUtils::StartsWithNoCase(replace, "addons://")) @@ -1301,7 +1301,7 @@ int CBuiltins::Execute(const CStdString& execString) CSkinSettings::Get().SetString(string, value); } } - else // execute.Equals("skin.setpath")) + else // execute == "skin.setpath")) { g_mediaManager.GetNetworkLocations(localShares); if (params.size() > 1) @@ -1322,7 +1322,7 @@ int CBuiltins::Execute(const CStdString& execString) } CSettings::Get().Save(); } - else if (execute.Equals("skin.setaddon") && params.size() > 1) + else if (execute == "skin.setaddon" && params.size() > 1) { int string = CSkinSettings::Get().TranslateString(params[0]); vector<ADDON::TYPE> types; @@ -1332,14 +1332,14 @@ int CBuiltins::Execute(const CStdString& execString) if (type != ADDON_UNKNOWN) types.push_back(type); } - CStdString result; + std::string result; if (types.size() > 0 && CGUIWindowAddonBrowser::SelectAddonID(types, result, true) == 1) { CSkinSettings::Get().SetString(string, result); CSettings::Get().Save(); } } - else if (execute.Equals("dialog.close") && params.size()) + else if (execute == "dialog.close" && params.size()) { bool bForce = false; if (params.size() > 1 && StringUtils::EqualsNoCase(params[1], "true")) @@ -1356,7 +1356,7 @@ int CBuiltins::Execute(const CStdString& execString) ((CGUIDialog *)window)->Close(bForce); } } - else if (execute.Equals("system.logoff")) + else if (execute == "system.logoff") { // there was a commit from cptspiff here which was reverted // for keeping the behaviour from Eden in Frodo - see @@ -1380,19 +1380,19 @@ int CBuiltins::Execute(const CStdString& execString) if (!CNetworkServices::Get().StartEventServer()) // event server could be needed in some situations CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(33102), g_localizeStrings.Get(33100)); } - else if (execute.Equals("pagedown")) + else if (execute == "pagedown") { int id = atoi(parameter.c_str()); CGUIMessage message(GUI_MSG_PAGE_DOWN, g_windowManager.GetFocusedWindow(), id); g_windowManager.SendMessage(message); } - else if (execute.Equals("pageup")) + else if (execute == "pageup") { int id = atoi(parameter.c_str()); CGUIMessage message(GUI_MSG_PAGE_UP, g_windowManager.GetFocusedWindow(), id); g_windowManager.SendMessage(message); } - else if (execute.Equals("updatelibrary") && params.size()) + else if (execute == "updatelibrary" && !params.empty()) { if (StringUtils::EqualsNoCase(params[0], "music")) { @@ -1409,7 +1409,7 @@ int CBuiltins::Execute(const CStdString& execString) g_application.StartVideoScan(params.size() > 1 ? params[1] : ""); } } - else if (execute.Equals("cleanlibrary")) + else if (execute == "cleanlibrary") { if (!params.size() || StringUtils::EqualsNoCase(params[0], "video")) { @@ -1432,12 +1432,12 @@ int CBuiltins::Execute(const CStdString& execString) CLog::Log(LOGERROR, "XBMC.CleanLibrary is not possible while scanning for media info"); } } - else if (execute.Equals("exportlibrary") && !params.empty()) + else if (execute == "exportlibrary" && !params.empty()) { int iHeading = 647; if (StringUtils::EqualsNoCase(params[0], "music")) iHeading = 20196; - CStdString path; + std::string path; VECSOURCES shares; g_mediaManager.GetLocalDrives(shares); g_mediaManager.GetNetworkLocations(shares); @@ -1513,19 +1513,19 @@ int CBuiltins::Execute(const CStdString& execString) } } } - else if (execute.Equals("control.move") && params.size() > 1) + else if (execute == "control.move" && params.size() > 1) { CGUIMessage message(GUI_MSG_MOVE_OFFSET, g_windowManager.GetFocusedWindow(), atoi(params[0].c_str()), atoi(params[1].c_str())); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.refresh")) + else if (execute == "container.refresh") { // NOTE: These messages require a media window, thus they're sent to the current activewindow. // This shouldn't stop a dialog intercepting it though. CGUIMessage message(GUI_MSG_NOTIFY_ALL, g_windowManager.GetActiveWindow(), 0, GUI_MSG_UPDATE, 1); // 1 to reset the history message.SetStringParam(parameter); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.update") && params.size()) + else if (execute == "container.update" && !params.empty()) { CGUIMessage message(GUI_MSG_NOTIFY_ALL, g_windowManager.GetActiveWindow(), 0, GUI_MSG_UPDATE, 0); message.SetStringParam(params[0]); @@ -1533,42 +1533,42 @@ int CBuiltins::Execute(const CStdString& execString) message.SetParam2(1); // reset the history g_windowManager.SendMessage(message); } - else if (execute.Equals("container.nextviewmode")) + else if (execute == "container.nextviewmode") { CGUIMessage message(GUI_MSG_CHANGE_VIEW_MODE, g_windowManager.GetActiveWindow(), 0, 0, 1); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.previousviewmode")) + else if (execute == "container.previousviewmode") { CGUIMessage message(GUI_MSG_CHANGE_VIEW_MODE, g_windowManager.GetActiveWindow(), 0, 0, -1); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.setviewmode")) + else if (execute == "container.setviewmode") { CGUIMessage message(GUI_MSG_CHANGE_VIEW_MODE, g_windowManager.GetActiveWindow(), 0, atoi(parameter.c_str())); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.nextsortmethod")) + else if (execute == "container.nextsortmethod") { CGUIMessage message(GUI_MSG_CHANGE_SORT_METHOD, g_windowManager.GetActiveWindow(), 0, 0, 1); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.previoussortmethod")) + else if (execute == "container.previoussortmethod") { CGUIMessage message(GUI_MSG_CHANGE_SORT_METHOD, g_windowManager.GetActiveWindow(), 0, 0, -1); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.setsortmethod")) + else if (execute == "container.setsortmethod") { CGUIMessage message(GUI_MSG_CHANGE_SORT_METHOD, g_windowManager.GetActiveWindow(), 0, atoi(parameter.c_str())); g_windowManager.SendMessage(message); } - else if (execute.Equals("container.sortdirection")) + else if (execute == "container.sortdirection") { CGUIMessage message(GUI_MSG_CHANGE_SORT_DIRECTION, g_windowManager.GetActiveWindow(), 0, 0); g_windowManager.SendMessage(message); } - else if (execute.Equals("control.message") && params.size() >= 2) + else if (execute == "control.message" && params.size() >= 2) { int controlID = atoi(params[0].c_str()); int windowID = (params.size() == 3) ? CButtonTranslator::TranslateWindow(params[2]) : g_windowManager.GetActiveWindow(); @@ -1583,7 +1583,7 @@ int CBuiltins::Execute(const CStdString& execString) else if (params[1] == "click") g_windowManager.SendMessage(GUI_MSG_CLICKED, controlID, windowID); } - else if (execute.Equals("sendclick") && params.size()) + else if (execute == "sendclick" && !params.empty()) { if (params.size() == 2) { @@ -1598,7 +1598,7 @@ int CBuiltins::Execute(const CStdString& execString) g_windowManager.SendMessage(message); } } - else if (execute.Equals("action") && params.size()) + else if (execute == "action" && !params.empty()) { // try translating the action from our ButtonTranslator int actionID; @@ -1608,23 +1608,23 @@ int CBuiltins::Execute(const CStdString& execString) CApplicationMessenger::Get().SendAction(CAction(actionID), windowID); } } - else if (execute.Equals("setproperty") && params.size() >= 2) + else if (execute == "setproperty" && params.size() >= 2) { CGUIWindow *window = g_windowManager.GetWindow(params.size() > 2 ? CButtonTranslator::TranslateWindow(params[2]) : g_windowManager.GetFocusedWindow()); if (window) window->SetProperty(params[0],params[1]); } - else if (execute.Equals("clearproperty") && params.size()) + else if (execute == "clearproperty" && !params.empty()) { CGUIWindow *window = g_windowManager.GetWindow(params.size() > 1 ? CButtonTranslator::TranslateWindow(params[1]) : g_windowManager.GetFocusedWindow()); if (window) window->SetProperty(params[0],""); } - else if (execute.Equals("wakeonlan")) + else if (execute == "wakeonlan") { g_application.getNetwork().WakeOnLan((char*)params[0].c_str()); } - else if (execute.Equals("addon.default.opensettings") && params.size() == 1) + else if (execute == "addon.default.opensettings" && params.size() == 1) { AddonPtr addon; ADDON::TYPE type = TranslateType(params[0]); @@ -1635,9 +1635,9 @@ int CBuiltins::Execute(const CStdString& execString) g_windowManager.SendMessage(GUI_MSG_VISUALISATION_RELOAD, 0, 0); } } - else if (execute.Equals("addon.default.set") && params.size() == 1) + else if (execute == "addon.default.set" && params.size() == 1) { - CStdString addonID; + std::string addonID; TYPE type = TranslateType(params[0]); bool allowNone = false; if (type == ADDON_VIZ) @@ -1651,50 +1651,50 @@ int CBuiltins::Execute(const CStdString& execString) g_windowManager.SendMessage(GUI_MSG_VISUALISATION_RELOAD, 0, 0); } } - else if (execute.Equals("addon.opensettings") && params.size() == 1) + else if (execute == "addon.opensettings" && params.size() == 1) { AddonPtr addon; if (CAddonMgr::Get().GetAddon(params[0], addon)) CGUIDialogAddonSettings::ShowAndGetInput(addon); } - else if (execute.Equals("updateaddonrepos")) + else if (execute == "updateaddonrepos") { CAddonInstaller::Get().UpdateRepos(true); } - else if (execute.Equals("updatelocaladdons")) + else if (execute == "updatelocaladdons") { CAddonMgr::Get().FindAddons(); } - else if (execute.Equals("toggledpms")) + else if (execute == "toggledpms") { g_application.ToggleDPMS(true); } - else if (execute.Equals("cectogglestate")) + else if (execute == "cectogglestate") { CApplicationMessenger::Get().CECToggleState(); } - else if (execute.Equals("cecactivatesource")) + else if (execute == "cecactivatesource") { CApplicationMessenger::Get().CECActivateSource(); } - else if (execute.Equals("cecstandby")) + else if (execute == "cecstandby") { CApplicationMessenger::Get().CECStandby(); } #if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - else if (execute.Equals("lirc.stop")) + else if (execute == "lirc.stop") { g_RemoteControl.Disconnect(); g_RemoteControl.setUsed(false); } - else if (execute.Equals("lirc.start")) + else if (execute == "lirc.start") { g_RemoteControl.setUsed(true); g_RemoteControl.Initialize(); } - else if (execute.Equals("lirc.send")) + else if (execute == "lirc.send") { - CStdString command; + std::string command; for (int i = 0; i < (int)params.size(); i++) { command += params[i]; @@ -1704,51 +1704,51 @@ int CBuiltins::Execute(const CStdString& execString) g_RemoteControl.AddSendCommand(command); } #endif - else if (execute.Equals("weather.locationset") && !params.empty()) + else if (execute == "weather.locationset" && !params.empty()) { int loc = atoi(params[0].c_str()); CGUIMessage msg(GUI_MSG_ITEM_SELECT, 0, 0, loc); g_windowManager.SendMessage(msg, WINDOW_WEATHER); } - else if (execute.Equals("weather.locationnext")) + else if (execute == "weather.locationnext") { CGUIMessage msg(GUI_MSG_MOVE_OFFSET, 0, 0, 1); g_windowManager.SendMessage(msg, WINDOW_WEATHER); } - else if (execute.Equals("weather.locationprevious")) + else if (execute == "weather.locationprevious") { CGUIMessage msg(GUI_MSG_MOVE_OFFSET, 0, 0, -1); g_windowManager.SendMessage(msg, WINDOW_WEATHER); } - else if (execute.Equals("weather.refresh")) + else if (execute == "weather.refresh") { CGUIMessage msg(GUI_MSG_MOVE_OFFSET, 0, 0, 0); g_windowManager.SendMessage(msg, WINDOW_WEATHER); } - else if (execute.Equals("videolibrary.search")) + else if (execute == "videolibrary.search") { CGUIMessage msg(GUI_MSG_SEARCH, 0, 0, 0); g_windowManager.SendMessage(msg, WINDOW_VIDEO_NAV); } - else if (execute.Equals("toggledebug")) + else if (execute == "toggledebug") { bool debug = CSettings::Get().GetBool("debug.showloginfo"); CSettings::Get().SetBool("debug.showloginfo", !debug); g_advancedSettings.SetDebugMode(!debug); } - else if (execute.Equals("startpvrmanager")) + else if (execute == "startpvrmanager") { g_application.StartPVRManager(); } - else if (execute.Equals("stoppvrmanager")) + else if (execute == "stoppvrmanager") { g_application.StopPVRManager(); } - else if (execute.Equals("StartAndroidActivity") && params.size() > 0) + else if (execute == "startandroidactivity" && !params.empty()) { CApplicationMessenger::Get().StartAndroidActivity(params); } - else if (execute.Equals("SetStereoMode") && !parameter.empty()) + else if (execute == "setstereomode" && !parameter.empty()) { CAction action = CStereoscopicsManager::Get().ConvertActionCommandToAction(execute, parameter); if (action.GetID() != ACTION_NONE) diff --git a/xbmc/interfaces/Builtins.h b/xbmc/interfaces/Builtins.h index 70a7828c18..e30385c68c 100644 --- a/xbmc/interfaces/Builtins.h +++ b/xbmc/interfaces/Builtins.h @@ -20,13 +20,13 @@ * */ -#include "utils/StdString.h" +#include <string> class CBuiltins { public: - static bool HasCommand(const CStdString& execString); - static void GetHelp(CStdString &help); - static int Execute(const CStdString& execString); + static bool HasCommand(const std::string& execString); + static void GetHelp(std::string &help); + static int Execute(const std::string& execString); }; diff --git a/xbmc/interfaces/info/SkinVariable.cpp b/xbmc/interfaces/info/SkinVariable.cpp index c5c2df961f..496e8ef79c 100644 --- a/xbmc/interfaces/info/SkinVariable.cpp +++ b/xbmc/interfaces/info/SkinVariable.cpp @@ -66,12 +66,12 @@ int CSkinVariableString::GetContext() const return m_context; } -const CStdString& CSkinVariableString::GetName() const +const std::string& CSkinVariableString::GetName() const { return m_name; } -CStdString CSkinVariableString::GetValue(bool preferImage /* = false*/, const CGUIListItem *item /* = NULL */) +std::string CSkinVariableString::GetValue(bool preferImage /* = false*/, const CGUIListItem *item /* = NULL */) { for (VECCONDITIONLABELPAIR::const_iterator it = m_conditionLabelPairs.begin() ; it != m_conditionLabelPairs.end(); ++it) { diff --git a/xbmc/interfaces/info/SkinVariable.h b/xbmc/interfaces/info/SkinVariable.h index 0f99c5f657..0fa6c53a43 100644 --- a/xbmc/interfaces/info/SkinVariable.h +++ b/xbmc/interfaces/info/SkinVariable.h @@ -38,13 +38,13 @@ public: class CSkinVariableString { public: - const CStdString& GetName() const; + const std::string& GetName() const; int GetContext() const; - CStdString GetValue(bool preferImage = false, const CGUIListItem *item = NULL ); + std::string GetValue(bool preferImage = false, const CGUIListItem *item = NULL ); private: CSkinVariableString(); - CStdString m_name; + std::string m_name; int m_context; struct ConditionLabelPair diff --git a/xbmc/interfaces/json-rpc/AddonsOperations.cpp b/xbmc/interfaces/json-rpc/AddonsOperations.cpp index ef7f012ef4..bb3b0cea43 100644 --- a/xbmc/interfaces/json-rpc/AddonsOperations.cpp +++ b/xbmc/interfaces/json-rpc/AddonsOperations.cpp @@ -33,7 +33,7 @@ using namespace JSONRPC; using namespace ADDON; using namespace XFILE; -JSONRPC_STATUS CAddonsOperations::GetAddons(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAddonsOperations::GetAddons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { vector<TYPE> addonTypes; TYPE addonType = TranslateType(parameterObject["type"].asString()); @@ -126,7 +126,7 @@ JSONRPC_STATUS CAddonsOperations::GetAddons(const CStdString &method, ITransport return OK; } -JSONRPC_STATUS CAddonsOperations::GetAddonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAddonsOperations::GetAddonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string id = parameterObject["addonid"].asString(); AddonPtr addon; @@ -140,7 +140,7 @@ JSONRPC_STATUS CAddonsOperations::GetAddonDetails(const CStdString &method, ITra return OK; } -JSONRPC_STATUS CAddonsOperations::SetAddonEnabled(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAddonsOperations::SetAddonEnabled(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string id = parameterObject["addonid"].asString(); bool disabled = false; @@ -158,7 +158,7 @@ JSONRPC_STATUS CAddonsOperations::SetAddonEnabled(const CStdString &method, ITra return ACK; } -JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string id = parameterObject["addonid"].asString(); AddonPtr addon; @@ -192,7 +192,7 @@ JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const CStdString &method, ITransp argv = StringUtils::Paramify(params.asString()); } - CStdString cmd; + std::string cmd; if (params.size() == 0) cmd = StringUtils::Format("RunAddon(%s)", id.c_str()); else @@ -226,11 +226,11 @@ void CAddonsOperations::FillDetails(AddonPtr addon, const CVariant& fields, CVar } else if (field == "fanart" || field == "thumbnail") { - CStdString url = addonInfo[field].asString(); + std::string url = addonInfo[field].asString(); // We need to check the existence of fanart and thumbnails as the addon simply // holds where the art will be, not whether it exists. bool needsRecaching; - CStdString image = CTextureCache::Get().CheckCachedImage(url, false, needsRecaching); + std::string image = CTextureCache::Get().CheckCachedImage(url, false, needsRecaching); if (!image.empty() || CFile::Exists(url)) object[field] = CTextureUtils::GetWrappedImageURL(url); else diff --git a/xbmc/interfaces/json-rpc/AddonsOperations.h b/xbmc/interfaces/json-rpc/AddonsOperations.h index ad607f9b54..ff3dfa87cc 100644 --- a/xbmc/interfaces/json-rpc/AddonsOperations.h +++ b/xbmc/interfaces/json-rpc/AddonsOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "addons/IAddon.h" @@ -30,11 +29,11 @@ namespace JSONRPC class CAddonsOperations : public CJSONUtils { public: - static JSONRPC_STATUS GetAddons(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetAddonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetAddons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetAddonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetAddonEnabled(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ExecuteAddon(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetAddonEnabled(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ExecuteAddon(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: static void FillDetails(ADDON::AddonPtr addon, const CVariant& fields, CVariant &result, CAddonDatabase &addondb, bool append = false); diff --git a/xbmc/interfaces/json-rpc/ApplicationOperations.cpp b/xbmc/interfaces/json-rpc/ApplicationOperations.cpp index 0438e7a6b0..48117b9c1c 100644 --- a/xbmc/interfaces/json-rpc/ApplicationOperations.cpp +++ b/xbmc/interfaces/json-rpc/ApplicationOperations.cpp @@ -33,12 +33,12 @@ using namespace JSONRPC; -JSONRPC_STATUS CApplicationOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CApplicationOperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant properties = CVariant(CVariant::VariantTypeObject); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(propertyName, property)) != OK) @@ -52,7 +52,7 @@ JSONRPC_STATUS CApplicationOperations::GetProperties(const CStdString &method, I return OK; } -JSONRPC_STATUS CApplicationOperations::SetVolume(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CApplicationOperations::SetVolume(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { bool up = false; if (parameterObject["volume"].isInteger()) @@ -92,7 +92,7 @@ JSONRPC_STATUS CApplicationOperations::SetVolume(const CStdString &method, ITran return GetPropertyValue("volume", result); } -JSONRPC_STATUS CApplicationOperations::SetMute(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CApplicationOperations::SetMute(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if ((parameterObject["mute"].isString() && parameterObject["mute"].asString().compare("toggle") == 0) || (parameterObject["mute"].isBoolean() && parameterObject["mute"].asBoolean() != g_application.IsMuted())) @@ -103,21 +103,21 @@ JSONRPC_STATUS CApplicationOperations::SetMute(const CStdString &method, ITransp return GetPropertyValue("muted", result); } -JSONRPC_STATUS CApplicationOperations::Quit(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CApplicationOperations::Quit(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CApplicationMessenger::Get().Quit(); return ACK; } -JSONRPC_STATUS CApplicationOperations::GetPropertyValue(const CStdString &property, CVariant &result) +JSONRPC_STATUS CApplicationOperations::GetPropertyValue(const std::string &property, CVariant &result) { - if (property.Equals("volume")) + if (property == "volume") result = (int)g_application.GetVolume(); - else if (property.Equals("muted")) + else if (property == "muted") result = g_application.IsMuted(); - else if (property.Equals("name")) + else if (property == "name") result = "XBMC"; - else if (property.Equals("version")) + else if (property == "version") { result = CVariant(CVariant::VariantTypeObject); result["major"] = CCompileInfo::GetMajor(); diff --git a/xbmc/interfaces/json-rpc/ApplicationOperations.h b/xbmc/interfaces/json-rpc/ApplicationOperations.h index 02909fe003..b7b3ba3903 100644 --- a/xbmc/interfaces/json-rpc/ApplicationOperations.h +++ b/xbmc/interfaces/json-rpc/ApplicationOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -28,13 +27,13 @@ namespace JSONRPC class CApplicationOperations : CFileItemHandler { public: - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetVolume(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetMute(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetVolume(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetMute(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Quit(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Quit(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: - static JSONRPC_STATUS GetPropertyValue(const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(const std::string &property, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp index 6214d1d6e0..bd87624192 100644 --- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp +++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp @@ -38,7 +38,7 @@ using namespace MUSIC_INFO; using namespace JSONRPC; using namespace XFILE; -JSONRPC_STATUS CAudioLibrary::GetArtists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetArtists(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -60,7 +60,7 @@ JSONRPC_STATUS CAudioLibrary::GetArtists(const CStdString &method, ITransportLay songID = (int)filter["songid"].asInteger(); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("artists", filter, xsp)) return InvalidParams; @@ -93,7 +93,7 @@ JSONRPC_STATUS CAudioLibrary::GetArtists(const CStdString &method, ITransportLay return OK; } -JSONRPC_STATUS CAudioLibrary::GetArtistDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetArtistDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int artistID = (int)parameterObject["artistid"].asInteger(); @@ -122,7 +122,7 @@ JSONRPC_STATUS CAudioLibrary::GetArtistDetails(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CAudioLibrary::GetAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -142,7 +142,7 @@ JSONRPC_STATUS CAudioLibrary::GetAlbums(const CStdString &method, ITransportLaye musicUrl.AddOption("genre", filter["genre"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("albums", filter, xsp)) return InvalidParams; @@ -170,7 +170,7 @@ JSONRPC_STATUS CAudioLibrary::GetAlbums(const CStdString &method, ITransportLaye return OK; } -JSONRPC_STATUS CAudioLibrary::GetAlbumDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetAlbumDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int albumID = (int)parameterObject["albumid"].asInteger(); @@ -182,7 +182,7 @@ JSONRPC_STATUS CAudioLibrary::GetAlbumDetails(const CStdString &method, ITranspo if (!musicdatabase.GetAlbum(albumID, album, false)) return InvalidParams; - CStdString path; + std::string path; if (!musicdatabase.GetAlbumPath(albumID, path)) return InternalError; @@ -200,7 +200,7 @@ JSONRPC_STATUS CAudioLibrary::GetAlbumDetails(const CStdString &method, ITranspo return OK; } -JSONRPC_STATUS CAudioLibrary::GetSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -224,7 +224,7 @@ JSONRPC_STATUS CAudioLibrary::GetSongs(const CStdString &method, ITransportLayer musicUrl.AddOption("album", filter["album"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("songs", filter, xsp)) return InvalidParams; @@ -252,7 +252,7 @@ JSONRPC_STATUS CAudioLibrary::GetSongs(const CStdString &method, ITransportLayer return OK; } -JSONRPC_STATUS CAudioLibrary::GetSongDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetSongDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int idSong = (int)parameterObject["songid"].asInteger(); @@ -274,7 +274,7 @@ JSONRPC_STATUS CAudioLibrary::GetSongDetails(const CStdString &method, ITranspor return OK; } -JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -287,7 +287,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedAlbums(const CStdString &method, I CFileItemList items; for (unsigned int index = 0; index < albums.size(); index++) { - CStdString path = StringUtils::Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum); + std::string path = StringUtils::Format("musicdb://recentlyaddedalbums/%i/", albums[index].idAlbum); CFileItemPtr item; FillAlbumItem(albums[index], path, item); @@ -302,7 +302,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedAlbums(const CStdString &method, I return OK; } -JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -324,7 +324,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyAddedSongs(const CStdString &method, IT return OK; } -JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -337,7 +337,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedAlbums(const CStdString &method, CFileItemList items; for (unsigned int index = 0; index < albums.size(); index++) { - CStdString path = StringUtils::Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum); + std::string path = StringUtils::Format("musicdb://recentlyplayedalbums/%i/", albums[index].idAlbum); CFileItemPtr item; FillAlbumItem(albums[index], path, item); @@ -352,7 +352,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedAlbums(const CStdString &method, return OK; } -JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -370,7 +370,7 @@ JSONRPC_STATUS CAudioLibrary::GetRecentlyPlayedSongs(const CStdString &method, I return OK; } -JSONRPC_STATUS CAudioLibrary::GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::GetGenres(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) @@ -388,7 +388,7 @@ JSONRPC_STATUS CAudioLibrary::GetGenres(const CStdString &method, ITransportLaye return OK; } -JSONRPC_STATUS CAudioLibrary::SetArtistDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::SetArtistDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["artistid"].asInteger(); @@ -430,7 +430,7 @@ JSONRPC_STATUS CAudioLibrary::SetArtistDetails(const CStdString &method, ITransp return ACK; } -JSONRPC_STATUS CAudioLibrary::SetAlbumDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::SetAlbumDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["albumid"].asInteger(); @@ -472,7 +472,7 @@ JSONRPC_STATUS CAudioLibrary::SetAlbumDetails(const CStdString &method, ITranspo return ACK; } -JSONRPC_STATUS CAudioLibrary::SetSongDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::SetSongDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["songid"].asInteger(); @@ -516,10 +516,10 @@ JSONRPC_STATUS CAudioLibrary::SetSongDetails(const CStdString &method, ITranspor return ACK; } -JSONRPC_STATUS CAudioLibrary::Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::string directory = parameterObject["directory"].asString(); - CStdString cmd; + std::string cmd; if (directory.empty()) cmd = "updatelibrary(music)"; else @@ -529,9 +529,9 @@ JSONRPC_STATUS CAudioLibrary::Scan(const CStdString &method, ITransportLayer *tr return ACK; } -JSONRPC_STATUS CAudioLibrary::Export(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::Export(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString cmd; + std::string cmd; if (parameterObject["options"].isMember("path")) cmd = StringUtils::Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str()); else @@ -543,13 +543,13 @@ JSONRPC_STATUS CAudioLibrary::Export(const CStdString &method, ITransportLayer * return ACK; } -JSONRPC_STATUS CAudioLibrary::Clean(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CAudioLibrary::Clean(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CApplicationMessenger::Get().ExecBuiltIn("cleanlibrary(music)"); return ACK; } -bool CAudioLibrary::FillFileItem(const CStdString &strFilename, CFileItemPtr &item, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) +bool CAudioLibrary::FillFileItem(const std::string &strFilename, CFileItemPtr &item, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) { CMusicDatabase musicdatabase; if (strFilename.empty()) @@ -603,7 +603,7 @@ bool CAudioLibrary::FillFileItemList(const CVariant ¶meterObject, CFileItemL if (!musicdatabase.Open()) return false; - CStdString file = parameterObject["file"].asString(); + std::string file = parameterObject["file"].asString(); int artistID = (int)parameterObject["artistid"].asInteger(-1); int albumID = (int)parameterObject["albumid"].asInteger(-1); int genreID = (int)parameterObject["genreid"].asInteger(-1); @@ -649,7 +649,7 @@ bool CAudioLibrary::FillFileItemList(const CVariant ¶meterObject, CFileItemL return success; } -void CAudioLibrary::FillAlbumItem(const CAlbum &album, const CStdString &path, CFileItemPtr &item) +void CAudioLibrary::FillAlbumItem(const CAlbum &album, const std::string &path, CFileItemPtr &item) { item = CFileItemPtr(new CFileItem(path, album)); } diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.h b/xbmc/interfaces/json-rpc/AudioLibrary.h index 3d492d3ff2..5d6113f158 100644 --- a/xbmc/interfaces/json-rpc/AudioLibrary.h +++ b/xbmc/interfaces/json-rpc/AudioLibrary.h @@ -21,7 +21,6 @@ #include <set> -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -32,35 +31,35 @@ namespace JSONRPC class CAudioLibrary : public CFileItemHandler { public: - static JSONRPC_STATUS GetArtists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetArtistDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetAlbumDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSongDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetArtists(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetArtistDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetAlbumDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSongDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetGenres(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyAddedAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyAddedSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyPlayedAlbums(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyPlayedSongs(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyAddedAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyAddedSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyPlayedAlbums(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyPlayedSongs(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetArtistDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetAlbumDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetSongDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetArtistDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetAlbumDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetSongDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Export(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Clean(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Export(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Clean(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static bool FillFileItem(const CStdString &strFilename, CFileItemPtr &item, const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); + static bool FillFileItem(const std::string &strFilename, CFileItemPtr &item, const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); static bool FillFileItemList(const CVariant ¶meterObject, CFileItemList &list); static JSONRPC_STATUS GetAdditionalAlbumDetails(const CVariant ¶meterObject, CFileItemList &items, CMusicDatabase &musicdatabase); static JSONRPC_STATUS GetAdditionalSongDetails(const CVariant ¶meterObject, CFileItemList &items, CMusicDatabase &musicdatabase); private: - static void FillAlbumItem(const CAlbum &album, const CStdString &path, CFileItemPtr &item); + static void FillAlbumItem(const CAlbum &album, const std::string &path, CFileItemPtr &item); static bool CheckForAdditionalProperties(const CVariant &properties, const std::set<std::string> &checkProperties, std::set<std::string> &foundProperties); }; diff --git a/xbmc/interfaces/json-rpc/FavouritesOperations.cpp b/xbmc/interfaces/json-rpc/FavouritesOperations.cpp index 8aa2223790..a3afbbf1f3 100644 --- a/xbmc/interfaces/json-rpc/FavouritesOperations.cpp +++ b/xbmc/interfaces/json-rpc/FavouritesOperations.cpp @@ -32,7 +32,7 @@ using namespace std; using namespace JSONRPC; using namespace XFILE; -JSONRPC_STATUS CFavouritesOperations::GetFavourites(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFavouritesOperations::GetFavourites(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CFileItemList favourites; CFavouritesDirectory::Load(favourites); @@ -51,7 +51,7 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const CStdString &method, IT CVariant object; CFileItemPtr item = favourites.Get(i); - CStdString function; + std::string function; vector<string> parameters; CUtil::SplitExecFunction(item->GetPath(), function, parameters); if (parameters.size() == 0) @@ -104,7 +104,7 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const CStdString &method, IT return OK; } -JSONRPC_STATUS CFavouritesOperations::AddFavourite(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFavouritesOperations::AddFavourite(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string type = parameterObject["type"].asString(); diff --git a/xbmc/interfaces/json-rpc/FavouritesOperations.h b/xbmc/interfaces/json-rpc/FavouritesOperations.h index 406a223796..97b5463214 100644 --- a/xbmc/interfaces/json-rpc/FavouritesOperations.h +++ b/xbmc/interfaces/json-rpc/FavouritesOperations.h @@ -26,7 +26,7 @@ namespace JSONRPC class CFavouritesOperations : public CJSONUtils { public: - static JSONRPC_STATUS GetFavourites(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS AddFavourite(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetFavourites(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS AddFavourite(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.cpp b/xbmc/interfaces/json-rpc/FileItemHandler.cpp index b7fcfbb0ad..60fe6256ac 100644 --- a/xbmc/interfaces/json-rpc/FileItemHandler.cpp +++ b/xbmc/interfaces/json-rpc/FileItemHandler.cpp @@ -394,7 +394,7 @@ bool CFileItemHandler::FillFileItemList(const CVariant ¶meterObject, CFileIt CVideoLibrary::FillFileItemList(parameterObject, list); CFileOperations::FillFileItemList(parameterObject, list); - CStdString file = parameterObject["file"].asString(); + std::string file = parameterObject["file"].asString(); if (!file.empty() && (URIUtils::IsURL(file) || (CFile::Exists(file) && !CDirectory::Exists(file)))) { bool added = false; diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.h b/xbmc/interfaces/json-rpc/FileItemHandler.h index 1124b03434..b58ddfa63e 100644 --- a/xbmc/interfaces/json-rpc/FileItemHandler.h +++ b/xbmc/interfaces/json-rpc/FileItemHandler.h @@ -24,7 +24,6 @@ #include "JSONRPC.h" #include "JSONUtils.h" #include "FileItem.h" -#include "utils/StdString.h" class CThumbLoader; diff --git a/xbmc/interfaces/json-rpc/FileOperations.cpp b/xbmc/interfaces/json-rpc/FileOperations.cpp index 9c0c9c0729..50e74e1c19 100644 --- a/xbmc/interfaces/json-rpc/FileOperations.cpp +++ b/xbmc/interfaces/json-rpc/FileOperations.cpp @@ -35,9 +35,9 @@ using namespace XFILE; using namespace JSONRPC; -JSONRPC_STATUS CFileOperations::GetRootDirectory(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFileOperations::GetRootDirectory(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString media = parameterObject["media"].asString(); + std::string media = parameterObject["media"].asString(); StringUtils::ToLower(media); VECSOURCES *sources = CMediaSourceSettings::Get().GetSources(media); @@ -72,30 +72,30 @@ JSONRPC_STATUS CFileOperations::GetRootDirectory(const CStdString &method, ITran return OK; } -JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFileOperations::GetDirectory(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString media = parameterObject["media"].asString(); + std::string media = parameterObject["media"].asString(); StringUtils::ToLower(media); CFileItemList items; - CStdString strPath = parameterObject["directory"].asString(); + std::string strPath = parameterObject["directory"].asString(); if (!CFileUtils::RemoteAccessAllowed(strPath)) return InvalidParams; std::vector<std::string> regexps; - CStdString extensions = ""; - if (media.Equals("video")) + std::string extensions; + if (media == "video") { regexps = g_advancedSettings.m_videoExcludeFromListingRegExps; extensions = g_advancedSettings.m_videoExtensions; } - else if (media.Equals("music")) + else if (media == "music") { regexps = g_advancedSettings.m_audioExcludeFromListingRegExps; extensions = g_advancedSettings.m_musicExtensions; } - else if (media.Equals("pictures")) + else if (media == "pictures") { regexps = g_advancedSettings.m_pictureExcludeFromListingRegExps; extensions = g_advancedSettings.m_pictureExtensions; @@ -160,16 +160,16 @@ JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITranspor return InvalidParams; } -JSONRPC_STATUS CFileOperations::GetFileDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFileOperations::GetFileDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString file = parameterObject["file"].asString(); + std::string file = parameterObject["file"].asString(); if (!CFile::Exists(file)) return InvalidParams; if (!CFileUtils::RemoteAccessAllowed(file)) return InvalidParams; - CStdString path = URIUtils::GetDirectory(file); + std::string path = URIUtils::GetDirectory(file); CFileItemList items; if (path.empty() || !CDirectory::GetDirectory(path, items) || !items.Contains(file)) @@ -204,7 +204,7 @@ JSONRPC_STATUS CFileOperations::GetFileDetails(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CFileOperations::PrepareDownload(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFileOperations::PrepareDownload(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::string protocol; if (transport->PrepareDownload(parameterObject["path"].asString().c_str(), result["details"], protocol)) @@ -222,12 +222,12 @@ JSONRPC_STATUS CFileOperations::PrepareDownload(const CStdString &method, ITrans return InvalidParams; } -JSONRPC_STATUS CFileOperations::Download(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CFileOperations::Download(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return transport->Download(parameterObject["path"].asString().c_str(), result) ? OK : InvalidParams; } -bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItemPtr &item, CStdString media /* = "" */, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) +bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItemPtr &item, std::string media /* = "" */, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) { if (originalItem.get() == NULL) return false; @@ -236,17 +236,17 @@ bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItemPt *item = *originalItem; bool status = false; - CStdString strFilename = originalItem->GetPath(); + std::string strFilename = originalItem->GetPath(); if (!strFilename.empty() && (CDirectory::Exists(strFilename) || CFile::Exists(strFilename))) { - if (media.Equals("video")) + if (media == "video") status = CVideoLibrary::FillFileItem(strFilename, item, parameterObject); - else if (media.Equals("music")) + else if (media == "music") status = CAudioLibrary::FillFileItem(strFilename, item, parameterObject); if (status && item->GetLabel().empty()) { - CStdString label = originalItem->GetLabel(); + std::string label = originalItem->GetLabel(); if (label.empty()) { bool isDir = CDirectory::Exists(strFilename); @@ -262,7 +262,7 @@ bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItemPt if (originalItem->GetLabel().empty()) { bool isDir = CDirectory::Exists(strFilename); - CStdString label = CUtil::GetTitleFromPath(strFilename, isDir); + std::string label = CUtil::GetTitleFromPath(strFilename, isDir); if (label.empty()) return false; @@ -284,27 +284,27 @@ bool CFileOperations::FillFileItemList(const CVariant ¶meterObject, CFileIte { if (parameterObject.isMember("directory")) { - CStdString media = parameterObject["media"].asString(); + std::string media = parameterObject["media"].asString(); StringUtils::ToLower(media); - CStdString strPath = parameterObject["directory"].asString(); + std::string strPath = parameterObject["directory"].asString(); if (!strPath.empty()) { CFileItemList items; - CStdString extensions = ""; + std::string extensions; std::vector<std::string> regexps; - if (media.Equals("video")) + if (media == "video") { regexps = g_advancedSettings.m_videoExcludeFromListingRegExps; extensions = g_advancedSettings.m_videoExtensions; } - else if (media.Equals("music")) + else if (media == "music") { regexps = g_advancedSettings.m_audioExcludeFromListingRegExps; extensions = g_advancedSettings.m_musicExtensions; } - else if (media.Equals("pictures")) + else if (media == "pictures") { regexps = g_advancedSettings.m_pictureExcludeFromListingRegExps; extensions = g_advancedSettings.m_pictureExtensions; diff --git a/xbmc/interfaces/json-rpc/FileOperations.h b/xbmc/interfaces/json-rpc/FileOperations.h index f378550631..25f01b5e18 100644 --- a/xbmc/interfaces/json-rpc/FileOperations.h +++ b/xbmc/interfaces/json-rpc/FileOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -28,14 +27,14 @@ namespace JSONRPC class CFileOperations : public CFileItemHandler { public: - static JSONRPC_STATUS GetRootDirectory(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetDirectory(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetFileDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRootDirectory(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetDirectory(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetFileDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS PrepareDownload(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Download(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS PrepareDownload(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Download(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static bool FillFileItem(const CFileItemPtr &originalItem, CFileItemPtr &item, CStdString media = "", const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); + static bool FillFileItem(const CFileItemPtr &originalItem, CFileItemPtr &item, std::string media = "", const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); static bool FillFileItemList(const CVariant ¶meterObject, CFileItemList &list); }; } diff --git a/xbmc/interfaces/json-rpc/GUIOperations.cpp b/xbmc/interfaces/json-rpc/GUIOperations.cpp index 9072a9a0fc..33bd50510b 100644 --- a/xbmc/interfaces/json-rpc/GUIOperations.cpp +++ b/xbmc/interfaces/json-rpc/GUIOperations.cpp @@ -36,12 +36,12 @@ using namespace std; using namespace JSONRPC; using namespace ADDON; -JSONRPC_STATUS CGUIOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant properties = CVariant(CVariant::VariantTypeObject); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(propertyName, property)) != OK) @@ -55,7 +55,7 @@ JSONRPC_STATUS CGUIOperations::GetProperties(const CStdString &method, ITranspor return OK; } -JSONRPC_STATUS CGUIOperations::ActivateWindow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::ActivateWindow(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant params = parameterObject["parameters"]; std::string cmd = "ActivateWindow(" + parameterObject["window"].asString(); @@ -70,7 +70,7 @@ JSONRPC_STATUS CGUIOperations::ActivateWindow(const CStdString &method, ITranspo return ACK; } -JSONRPC_STATUS CGUIOperations::ShowNotification(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::ShowNotification(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string image = parameterObject["image"].asString(); string title = parameterObject["title"].asString(); @@ -89,7 +89,7 @@ JSONRPC_STATUS CGUIOperations::ShowNotification(const CStdString &method, ITrans return ACK; } -JSONRPC_STATUS CGUIOperations::SetFullscreen(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::SetFullscreen(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if ((parameterObject["fullscreen"].isString() && parameterObject["fullscreen"].asString().compare("toggle") == 0) || @@ -102,7 +102,7 @@ JSONRPC_STATUS CGUIOperations::SetFullscreen(const CStdString &method, ITranspor return GetPropertyValue("fullscreen", result); } -JSONRPC_STATUS CGUIOperations::SetStereoscopicMode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::SetStereoscopicMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CAction action = CStereoscopicsManager::Get().ConvertActionCommandToAction("SetStereoMode", parameterObject["mode"].asString()); if (action.GetID() != ACTION_NONE) @@ -114,7 +114,7 @@ JSONRPC_STATUS CGUIOperations::SetStereoscopicMode(const CStdString &method, ITr return InvalidParams; } -JSONRPC_STATUS CGUIOperations::GetStereoscopicModes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CGUIOperations::GetStereoscopicModes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { for (int i = RENDER_STEREO_MODE_OFF; i < RENDER_STEREO_MODE_COUNT; i++) { @@ -126,16 +126,16 @@ JSONRPC_STATUS CGUIOperations::GetStereoscopicModes(const CStdString &method, IT return OK; } -JSONRPC_STATUS CGUIOperations::GetPropertyValue(const CStdString &property, CVariant &result) +JSONRPC_STATUS CGUIOperations::GetPropertyValue(const std::string &property, CVariant &result) { - if (property.Equals("currentwindow")) + if (property == "currentwindow") { result["label"] = g_infoManager.GetLabel(g_infoManager.TranslateString("System.CurrentWindow")); result["id"] = g_windowManager.GetFocusedWindow(); } - else if (property.Equals("currentcontrol")) + else if (property == "currentcontrol") result["label"] = g_infoManager.GetLabel(g_infoManager.TranslateString("System.CurrentControl")); - else if (property.Equals("skin")) + else if (property == "skin") { CStdString skinId = CSettings::Get().GetString("lookandfeel.skin"); AddonPtr addon; @@ -145,9 +145,9 @@ JSONRPC_STATUS CGUIOperations::GetPropertyValue(const CStdString &property, CVar if (addon.get()) result["name"] = addon->Name(); } - else if (property.Equals("fullscreen")) + else if (property == "fullscreen") result = g_application.IsFullScreen(); - else if (property.Equals("stereoscopicmode")) + else if (property == "stereoscopicmode") result = GetStereoModeObjectFromGuiMode( CStereoscopicsManager::Get().GetStereoMode() ); else return InvalidParams; diff --git a/xbmc/interfaces/json-rpc/GUIOperations.h b/xbmc/interfaces/json-rpc/GUIOperations.h index b439c6326c..84fe2bad26 100644 --- a/xbmc/interfaces/json-rpc/GUIOperations.h +++ b/xbmc/interfaces/json-rpc/GUIOperations.h @@ -20,23 +20,22 @@ */ #include "JSONRPC.h" -#include "utils/StdString.h" namespace JSONRPC { class CGUIOperations { public: - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ActivateWindow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ActivateWindow(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ShowNotification(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetFullscreen(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetStereoscopicMode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetStereoscopicModes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ShowNotification(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetFullscreen(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetStereoscopicMode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetStereoscopicModes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: - static JSONRPC_STATUS GetPropertyValue(const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(const std::string &property, CVariant &result); static CVariant GetStereoModeObjectFromGuiMode(const RENDER_STEREO_MODE &mode); }; } diff --git a/xbmc/interfaces/json-rpc/InputOperations.cpp b/xbmc/interfaces/json-rpc/InputOperations.cpp index 37b42bfdb4..683a99ad6b 100644 --- a/xbmc/interfaces/json-rpc/InputOperations.cpp +++ b/xbmc/interfaces/json-rpc/InputOperations.cpp @@ -62,13 +62,13 @@ JSONRPC_STATUS CInputOperations::activateWindow(int windowID) return ACK; } -JSONRPC_STATUS CInputOperations::SendText(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::SendText(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CApplicationMessenger::Get().SendText(parameterObject["text"].asString(), parameterObject["done"].asBoolean()); return ACK; } -JSONRPC_STATUS CInputOperations::ExecuteAction(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::ExecuteAction(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int action; if (!CButtonTranslator::TranslateActionString(parameterObject["action"].asString().c_str(), action)) @@ -77,57 +77,57 @@ JSONRPC_STATUS CInputOperations::ExecuteAction(const CStdString &method, ITransp return SendAction(action); } -JSONRPC_STATUS CInputOperations::Left(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Left(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_MOVE_LEFT); } -JSONRPC_STATUS CInputOperations::Right(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Right(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_MOVE_RIGHT); } -JSONRPC_STATUS CInputOperations::Down(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Down(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_MOVE_DOWN); } -JSONRPC_STATUS CInputOperations::Up(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Up(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_MOVE_UP); } -JSONRPC_STATUS CInputOperations::Select(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Select(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_SELECT_ITEM); } -JSONRPC_STATUS CInputOperations::Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Back(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_NAV_BACK); } -JSONRPC_STATUS CInputOperations::ContextMenu(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::ContextMenu(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_CONTEXT_MENU); } -JSONRPC_STATUS CInputOperations::Info(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Info(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_SHOW_INFO); } -JSONRPC_STATUS CInputOperations::Home(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::Home(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return activateWindow(WINDOW_HOME); } -JSONRPC_STATUS CInputOperations::ShowCodec(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::ShowCodec(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_SHOW_CODEC); } -JSONRPC_STATUS CInputOperations::ShowOSD(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CInputOperations::ShowOSD(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return SendAction(ACTION_SHOW_OSD); } diff --git a/xbmc/interfaces/json-rpc/InputOperations.h b/xbmc/interfaces/json-rpc/InputOperations.h index 828f9eb2f2..c8e63de26f 100644 --- a/xbmc/interfaces/json-rpc/InputOperations.h +++ b/xbmc/interfaces/json-rpc/InputOperations.h @@ -22,29 +22,28 @@ #include "JSONRPC.h" #include "guilib/Key.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" namespace JSONRPC { class CInputOperations { public: - static JSONRPC_STATUS SendText(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ExecuteAction(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SendText(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ExecuteAction(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Left(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Right(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Down(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Up(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Left(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Right(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Down(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Up(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Select(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Back(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ContextMenu(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Info(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Home(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Select(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Back(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ContextMenu(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Info(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Home(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ShowCodec(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ShowOSD(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ShowCodec(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ShowOSD(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); static JSONRPC_STATUS SendAction(int actionID, bool wakeScreensaver = true, bool waitResult = false); diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp index 865bb38fb9..20d1229ece 100644 --- a/xbmc/interfaces/json-rpc/JSONRPC.cpp +++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp @@ -114,14 +114,14 @@ void CJSONRPC::Cleanup() m_initialized = false; } -JSONRPC_STATUS CJSONRPC::Introspect(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::Introspect(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { return CJSONServiceDescription::Print(result, transport, client, parameterObject["getdescriptions"].asBoolean(), parameterObject["getmetadata"].asBoolean(), parameterObject["filterbytransport"].asBoolean(), parameterObject["filter"]["id"].asString(), parameterObject["filter"]["type"].asString(), parameterObject["filter"]["getreferences"].asBoolean()); } -JSONRPC_STATUS CJSONRPC::Version(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::Version(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { result["version"]["major"] = 0; result["version"]["minor"] = 0; @@ -142,7 +142,7 @@ JSONRPC_STATUS CJSONRPC::Version(const CStdString &method, ITransportLayer *tran return OK; } -JSONRPC_STATUS CJSONRPC::Permission(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::Permission(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { int flags = client->GetPermissionFlags(); @@ -152,14 +152,14 @@ JSONRPC_STATUS CJSONRPC::Permission(const CStdString &method, ITransportLayer *t return OK; } -JSONRPC_STATUS CJSONRPC::Ping(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::Ping(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { CVariant temp = "pong"; result.swap(temp); return OK; } -JSONRPC_STATUS CJSONRPC::GetConfiguration(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::GetConfiguration(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { int flags = client->GetAnnouncementFlags(); @@ -169,7 +169,7 @@ JSONRPC_STATUS CJSONRPC::GetConfiguration(const CStdString &method, ITransportLa return OK; } -JSONRPC_STATUS CJSONRPC::SetConfiguration(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::SetConfiguration(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { int flags = 0; int oldFlags = client->GetAnnouncementFlags(); @@ -212,7 +212,7 @@ JSONRPC_STATUS CJSONRPC::SetConfiguration(const CStdString &method, ITransportLa return GetConfiguration(method, transport, client, parameterObject, result); } -JSONRPC_STATUS CJSONRPC::NotifyAll(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) +JSONRPC_STATUS CJSONRPC::NotifyAll(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) { if (parameterObject["data"].isNull()) CAnnouncementManager::Get().Announce(Other, parameterObject["sender"].asString().c_str(), @@ -227,7 +227,7 @@ JSONRPC_STATUS CJSONRPC::NotifyAll(const CStdString &method, ITransportLayer *tr return ACK; } -CStdString CJSONRPC::MethodCall(const CStdString &inputString, ITransportLayer *transport, IClient *client) +std::string CJSONRPC::MethodCall(const std::string &inputString, ITransportLayer *transport, IClient *client) { CVariant inputroot, outputroot, result; bool hasResponse = false; @@ -269,7 +269,7 @@ CStdString CJSONRPC::MethodCall(const CStdString &inputString, ITransportLayer * hasResponse = true; } - CStdString str = hasResponse ? CJSONVariantWriter::Write(outputroot, g_advancedSettings.m_jsonOutputCompact) : ""; + std::string str = hasResponse ? CJSONVariantWriter::Write(outputroot, g_advancedSettings.m_jsonOutputCompact) : ""; return str; } @@ -283,13 +283,13 @@ bool CJSONRPC::HandleMethodCall(const CVariant& request, CVariant& response, ITr { isNotification = !request.isMember("id"); - CStdString methodName = request["method"].asString(); + std::string methodName = request["method"].asString(); StringUtils::ToLower(methodName); JSONRPC::MethodCall method; CVariant params; - if ((errorCode = CJSONServiceDescription::CheckCall(methodName, request["params"], transport, client, isNotification, method, params)) == OK) + if ((errorCode = CJSONServiceDescription::CheckCall(methodName.c_str(), request["params"], transport, client, isNotification, method, params)) == OK) errorCode = method(methodName, transport, client, params, result); else result = params; diff --git a/xbmc/interfaces/json-rpc/JSONRPC.h b/xbmc/interfaces/json-rpc/JSONRPC.h index a8fb2775b8..c59b247502 100644 --- a/xbmc/interfaces/json-rpc/JSONRPC.h +++ b/xbmc/interfaces/json-rpc/JSONRPC.h @@ -27,7 +27,6 @@ #include "JSONRPCUtils.h" #include "JSONServiceDescription.h" #include "interfaces/IAnnouncer.h" -#include "utils/StdString.h" namespace JSONRPC { @@ -62,15 +61,15 @@ namespace JSONRPC in the request are checked for validity and completeness. If the request is valid and the requested method exists it is called and executed. */ - static CStdString MethodCall(const CStdString &inputString, ITransportLayer *transport, IClient *client); + static std::string MethodCall(const std::string &inputString, ITransportLayer *transport, IClient *client); - static JSONRPC_STATUS Introspect(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS Version(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS Permission(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS Ping(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS GetConfiguration(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS SetConfiguration(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); - static JSONRPC_STATUS NotifyAll(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS Introspect(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS Version(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS Permission(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS Ping(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS GetConfiguration(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS SetConfiguration(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + static JSONRPC_STATUS NotifyAll(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); private: static void setup(); diff --git a/xbmc/interfaces/json-rpc/JSONRPCUtils.h b/xbmc/interfaces/json-rpc/JSONRPCUtils.h index ae144d8fdb..6a66364f79 100644 --- a/xbmc/interfaces/json-rpc/JSONRPCUtils.h +++ b/xbmc/interfaces/json-rpc/JSONRPCUtils.h @@ -25,7 +25,6 @@ #include "GUIUserMessages.h" #include "guilib/GUIWindowManager.h" #include "interfaces/IAnnouncer.h" -#include "utils/StdString.h" #include "utils/Variant.h" namespace JSONRPC @@ -52,7 +51,7 @@ namespace JSONRPC /*! \brief Function pointer for JSON-RPC methods */ - typedef JSONRPC_STATUS (*MethodCall) (const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); + typedef JSONRPC_STATUS (*MethodCall) (const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result); /*! \ingroup jsonrpc diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp index c278bb197e..ba8f808a05 100644 --- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp +++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp @@ -21,7 +21,6 @@ #include "ServiceDescription.h" #include "JSONServiceDescription.h" #include "utils/log.h" -#include "utils/StdString.h" #include "utils/JSONVariantParser.h" #include "utils/StringUtils.h" #include "JSONRPC.h" @@ -620,7 +619,7 @@ JSONRPC_STATUS JSONSchemaTypeDefinition::Check(const CVariant &value, CVariant & if (!name.empty()) errorData["name"] = name; SchemaValueTypeToJson(type, errorData["type"]); - CStdString errorMessage; + std::string errorMessage; if (referencedType != NULL && !referencedTypeSet) Set(referencedType); @@ -1161,7 +1160,7 @@ JSONSchemaTypeDefinition::CJsonSchemaPropertiesMap::CJsonSchemaPropertiesMap() void JSONSchemaTypeDefinition::CJsonSchemaPropertiesMap::add(JSONSchemaTypeDefinitionPtr property) { - CStdString name = property->name; + std::string name = property->name; StringUtils::ToLower(name); m_propertiesmap[name] = property; } @@ -1697,7 +1696,7 @@ JSONRPC_STATUS CJSONServiceDescription::Print(CVariant &result, ITransportLayer if (filterByName.size() > 0) { - CStdString name = filterByName; + std::string name = filterByName; if (filterByType == "method") { @@ -2015,7 +2014,7 @@ void CJSONServiceDescription::CJsonRpcMethodMap::clear() void CJSONServiceDescription::CJsonRpcMethodMap::add(const JsonRpcMethod &method) { - CStdString name = method.name; + std::string name = method.name; StringUtils::ToLower(name); m_actionmap[name] = method; } diff --git a/xbmc/interfaces/json-rpc/JSONUtils.h b/xbmc/interfaces/json-rpc/JSONUtils.h index 5c8165c24d..c1b3f435fc 100644 --- a/xbmc/interfaces/json-rpc/JSONUtils.h +++ b/xbmc/interfaces/json-rpc/JSONUtils.h @@ -90,8 +90,8 @@ namespace JSONRPC static bool ParseSorting(const CVariant ¶meterObject, SortBy &sortBy, SortOrder &sortOrder, SortAttribute &sortAttributes) { - CStdString method = parameterObject["sort"]["method"].asString(); - CStdString order = parameterObject["sort"]["order"].asString(); + std::string method = parameterObject["sort"]["method"].asString(); + std::string order = parameterObject["sort"]["order"].asString(); StringUtils::ToLower(method); StringUtils::ToLower(order); @@ -101,86 +101,86 @@ namespace JSONRPC else sortAttributes = SortAttributeNone; - if (order.Equals("ascending")) + if (order == "ascending") sortOrder = SortOrderAscending; - else if (order.Equals("descending")) + else if (order == "descending") sortOrder = SortOrderDescending; else return false; - if (method.Equals("none")) + if (method == "none") sortBy = SortByNone; - else if (method.Equals("label")) + else if (method == "label") sortBy = SortByLabel; - else if (method.Equals("date")) + else if (method == "date") sortBy = SortByDate; - else if (method.Equals("size")) + else if (method == "size") sortBy = SortBySize; - else if (method.Equals("file")) + else if (method == "file") sortBy = SortByFile; - else if (method.Equals("path")) + else if (method == "path") sortBy = SortByPath; - else if (method.Equals("drivetype")) + else if (method == "drivetype") sortBy = SortByDriveType; - else if (method.Equals("title")) + else if (method == "title") sortBy = SortByTitle; - else if (method.Equals("track")) + else if (method == "track") sortBy = SortByTrackNumber; - else if (method.Equals("time")) + else if (method == "time") sortBy = SortByTime; - else if (method.Equals("artist")) + else if (method == "artist") sortBy = SortByArtist; - else if (method.Equals("album")) + else if (method == "album") sortBy = SortByAlbum; - else if (method.Equals("albumtype")) + else if (method == "albumtype") sortBy = SortByAlbumType; - else if (method.Equals("genre")) + else if (method == "genre") sortBy = SortByGenre; - else if (method.Equals("country")) + else if (method == "country") sortBy = SortByCountry; - else if (method.Equals("year")) + else if (method == "year") sortBy = SortByYear; - else if (method.Equals("rating")) + else if (method == "rating") sortBy = SortByRating; - else if (method.Equals("votes")) + else if (method == "votes") sortBy = SortByVotes; - else if (method.Equals("top250")) + else if (method == "top250") sortBy = SortByTop250; - else if (method.Equals("programcount")) + else if (method == "programcount") sortBy = SortByProgramCount; - else if (method.Equals("playlist")) + else if (method == "playlist") sortBy = SortByPlaylistOrder; - else if (method.Equals("episode")) + else if (method == "episode") sortBy = SortByEpisodeNumber; - else if (method.Equals("season")) + else if (method == "season") sortBy = SortBySeason; - else if (method.Equals("totalepisodes")) + else if (method == "totalepisodes") sortBy = SortByNumberOfEpisodes; - else if (method.Equals("watchedepisodes")) + else if (method == "watchedepisodes") sortBy = SortByNumberOfWatchedEpisodes; - else if (method.Equals("tvshowstatus")) + else if (method == "tvshowstatus") sortBy = SortByTvShowStatus; - else if (method.Equals("tvshowtitle")) + else if (method == "tvshowtitle") sortBy = SortByTvShowTitle; - else if (method.Equals("sorttitle")) + else if (method == "sorttitle") sortBy = SortBySortTitle; - else if (method.Equals("productioncode")) + else if (method == "productioncode") sortBy = SortByProductionCode; - else if (method.Equals("mpaa")) + else if (method == "mpaa") sortBy = SortByMPAA; - else if (method.Equals("studio")) + else if (method == "studio") sortBy = SortByStudio; - else if (method.Equals("dateadded")) + else if (method == "dateadded") sortBy = SortByDateAdded; - else if (method.Equals("lastplayed")) + else if (method == "lastplayed") sortBy = SortByLastPlayed; - else if (method.Equals("playcount")) + else if (method == "playcount") sortBy = SortByPlaycount; - else if (method.Equals("listeners")) + else if (method == "listeners") sortBy = SortByListeners; - else if (method.Equals("bitrate")) + else if (method == "bitrate") sortBy = SortByBitrate; - else if (method.Equals("random")) + else if (method == "random") sortBy = SortByRandom; else return false; @@ -542,7 +542,7 @@ namespace JSONRPC date.SetFromDBDateTime(jsonDate.asString()); } - static bool GetXspFiltering(const CStdString &type, const CVariant &filter, CStdString &xsp) + static bool GetXspFiltering(const std::string &type, const CVariant &filter, std::string &xsp) { if (type.empty() || !filter.isObject()) return false; diff --git a/xbmc/interfaces/json-rpc/PVROperations.cpp b/xbmc/interfaces/json-rpc/PVROperations.cpp index 81d72515f0..d9970152c1 100644 --- a/xbmc/interfaces/json-rpc/PVROperations.cpp +++ b/xbmc/interfaces/json-rpc/PVROperations.cpp @@ -37,7 +37,7 @@ using namespace JSONRPC; using namespace PVR; using namespace EPG; -JSONRPC_STATUS CPVROperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -45,7 +45,7 @@ JSONRPC_STATUS CPVROperations::GetProperties(const CStdString &method, ITranspor CVariant properties = CVariant(CVariant::VariantTypeObject); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(propertyName, property)) != OK) @@ -59,7 +59,7 @@ JSONRPC_STATUS CPVROperations::GetProperties(const CStdString &method, ITranspor return OK; } -JSONRPC_STATUS CPVROperations::GetChannelGroups(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetChannelGroups(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -82,7 +82,7 @@ JSONRPC_STATUS CPVROperations::GetChannelGroups(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -106,7 +106,7 @@ JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const CStdString &method, return OK; } -JSONRPC_STATUS CPVROperations::GetChannels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetChannels(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -134,7 +134,7 @@ JSONRPC_STATUS CPVROperations::GetChannels(const CStdString &method, ITransportL return OK; } -JSONRPC_STATUS CPVROperations::GetChannelDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetChannelDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -152,7 +152,7 @@ JSONRPC_STATUS CPVROperations::GetChannelDetails(const CStdString &method, ITran return OK; } -JSONRPC_STATUS CPVROperations::GetBroadcasts(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -177,7 +177,7 @@ JSONRPC_STATUS CPVROperations::GetBroadcasts(const CStdString &method, ITranspor return OK; } -JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -201,7 +201,7 @@ JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const CStdString &method, ITr } -JSONRPC_STATUS CPVROperations::Record(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::Record(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -243,7 +243,7 @@ JSONRPC_STATUS CPVROperations::Record(const CStdString &method, ITransportLayer return ACK; } -JSONRPC_STATUS CPVROperations::Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -254,20 +254,20 @@ JSONRPC_STATUS CPVROperations::Scan(const CStdString &method, ITransportLayer *t return ACK; } -JSONRPC_STATUS CPVROperations::GetPropertyValue(const CStdString &property, CVariant &result) +JSONRPC_STATUS CPVROperations::GetPropertyValue(const std::string &property, CVariant &result) { bool started = g_PVRManager.IsStarted(); - if (property.Equals("available")) + if (property == "available") result = started; - else if (property.Equals("recording")) + else if (property == "recording") { if (started) result = g_PVRManager.IsRecording(); else result = false; } - else if (property.Equals("scanning")) + else if (property == "scanning") { if (started) result = g_PVRManager.IsRunningChannelScan(); @@ -303,7 +303,7 @@ void CPVROperations::FillChannelGroupDetails(const CPVRChannelGroupPtr &channelG } } -JSONRPC_STATUS CPVROperations::GetTimers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetTimers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -320,7 +320,7 @@ JSONRPC_STATUS CPVROperations::GetTimers(const CStdString &method, ITransportLay return OK; } -JSONRPC_STATUS CPVROperations::GetTimerDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetTimerDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -338,7 +338,7 @@ JSONRPC_STATUS CPVROperations::GetTimerDetails(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CPVROperations::GetRecordings(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetRecordings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; @@ -355,7 +355,7 @@ JSONRPC_STATUS CPVROperations::GetRecordings(const CStdString &method, ITranspor return OK; } -JSONRPC_STATUS CPVROperations::GetRecordingDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPVROperations::GetRecordingDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) return FailedToExecute; diff --git a/xbmc/interfaces/json-rpc/PVROperations.h b/xbmc/interfaces/json-rpc/PVROperations.h index 415a77b174..7c9feb0549 100644 --- a/xbmc/interfaces/json-rpc/PVROperations.h +++ b/xbmc/interfaces/json-rpc/PVROperations.h @@ -20,7 +20,6 @@ */ #include "FileItemHandler.h" -#include "utils/StdString.h" #include "pvr/channels/PVRChannelGroup.h" namespace JSONRPC @@ -28,23 +27,23 @@ namespace JSONRPC class CPVROperations : public CFileItemHandler { public: - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetChannelGroups(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetChannelGroupDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetChannels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetChannelDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetBroadcasts(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetBroadcastDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetTimers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetTimerDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecordings(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecordingDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetChannelGroups(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetChannelGroupDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetChannels(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetChannelDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetBroadcastDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetTimers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetTimerDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecordings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecordingDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Record(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Record(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: - static JSONRPC_STATUS GetPropertyValue(const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(const std::string &property, CVariant &result); static void FillChannelGroupDetails(const PVR::CPVRChannelGroupPtr &channelGroup, const CVariant ¶meterObject, CVariant &result, bool append = false); }; } diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp index 1a7ca3be2f..2256170c7a 100644 --- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp @@ -49,7 +49,7 @@ using namespace JSONRPC; using namespace PLAYLIST; using namespace PVR; -JSONRPC_STATUS CPlayerOperations::GetActivePlayers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::GetActivePlayers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int activePlayers = GetActivePlayers(); result = CVariant(CVariant::VariantTypeArray); @@ -79,14 +79,14 @@ JSONRPC_STATUS CPlayerOperations::GetActivePlayers(const CStdString &method, ITr return OK; } -JSONRPC_STATUS CPlayerOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { PlayerType player = GetPlayer(parameterObject["playerid"]); CVariant properties = CVariant(CVariant::VariantTypeObject); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(player, propertyName, property)) != OK) @@ -100,7 +100,7 @@ JSONRPC_STATUS CPlayerOperations::GetProperties(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::GetItem(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { PlayerType player = GetPlayer(parameterObject["playerid"]); CFileItemPtr fileItem; @@ -124,7 +124,7 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa const CVideoInfoTag *currentVideoTag = g_infoManager.GetCurrentMovieTag(); if (currentVideoTag != NULL) { - CStdString originalLabel = fileItem->GetLabel(); + std::string originalLabel = fileItem->GetLabel(); fileItem->SetFromVideoInfoTag(*currentVideoTag); if (fileItem->GetLabel().empty()) fileItem->SetLabel(originalLabel); @@ -139,7 +139,7 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa const MUSIC_INFO::CMusicInfoTag *currentMusicTag = g_infoManager.GetCurrentSongTag(); if (currentMusicTag != NULL) { - CStdString originalLabel = fileItem->GetLabel(); + std::string originalLabel = fileItem->GetLabel(); fileItem = CFileItemPtr(new CFileItem(*currentMusicTag)); if (fileItem->GetLabel().empty()) fileItem->SetLabel(originalLabel); @@ -156,7 +156,7 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa bool additionalInfo = false; for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++) { - CStdString fieldValue = itr->asString(); + std::string fieldValue = itr->asString(); if (fieldValue == "cast" || fieldValue == "set" || fieldValue == "setid" || fieldValue == "showlink" || fieldValue == "resume" || (fieldValue == "streamdetails" && !fileItem->GetVideoInfoTag()->m_streamDetails.HasItems())) additionalInfo = true; @@ -226,7 +226,7 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa return OK; } -JSONRPC_STATUS CPlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::PlayPause(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CGUIWindowSlideShow *slideshow = NULL; switch (GetPlayer(parameterObject["playerid"])) @@ -272,7 +272,7 @@ JSONRPC_STATUS CPlayerOperations::PlayPause(const CStdString &method, ITransport } } -JSONRPC_STATUS CPlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Stop(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -291,7 +291,7 @@ JSONRPC_STATUS CPlayerOperations::Stop(const CStdString &method, ITransportLayer } } -JSONRPC_STATUS CPlayerOperations::SetSpeed(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetSpeed(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -330,7 +330,7 @@ JSONRPC_STATUS CPlayerOperations::SetSpeed(const CStdString &method, ITransportL } } -JSONRPC_STATUS CPlayerOperations::Seek(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Seek(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { PlayerType player = GetPlayer(parameterObject["playerid"]); switch (player) @@ -346,14 +346,14 @@ JSONRPC_STATUS CPlayerOperations::Seek(const CStdString &method, ITransportLayer g_application.SeekPercentage(parameterObject["value"].asFloat()); else if (parameterObject["value"].isString()) { - CStdString step = parameterObject["value"].asString(); - if (step.Equals("smallforward")) + std::string step = parameterObject["value"].asString(); + if (step == "smallforward") CBuiltins::Execute("playercontrol(smallskipforward)"); - else if (step.Equals("smallbackward")) + else if (step == "smallbackward") CBuiltins::Execute("playercontrol(smallskipbackward)"); - else if (step.Equals("bigforward")) + else if (step == "bigforward") CBuiltins::Execute("playercontrol(bigskipforward)"); - else if (step.Equals("bigbackward")) + else if (step == "bigbackward") CBuiltins::Execute("playercontrol(bigskipbackward)"); else return InvalidParams; @@ -373,7 +373,7 @@ JSONRPC_STATUS CPlayerOperations::Seek(const CStdString &method, ITransportLayer } } -JSONRPC_STATUS CPlayerOperations::Move(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Move(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::string direction = parameterObject["direction"].asString(); switch (GetPlayer(parameterObject["playerid"])) @@ -409,7 +409,7 @@ JSONRPC_STATUS CPlayerOperations::Move(const CStdString &method, ITransportLayer } } -JSONRPC_STATUS CPlayerOperations::Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Zoom(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant zoom = parameterObject["zoom"]; switch (GetPlayer(parameterObject["playerid"])) @@ -440,7 +440,7 @@ JSONRPC_STATUS CPlayerOperations::Zoom(const CStdString &method, ITransportLayer } } -JSONRPC_STATUS CPlayerOperations::Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Rotate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -459,7 +459,7 @@ JSONRPC_STATUS CPlayerOperations::Rotate(const CStdString &method, ITransportLay } } -JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::Open(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant optionShuffled = parameterObject["options"]["shuffled"]; CVariant optionRepeat = parameterObject["options"]["repeat"]; @@ -582,7 +582,7 @@ JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer return InvalidParams; } -JSONRPC_STATUS CPlayerOperations::GoTo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::GoTo(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant to = parameterObject["to"]; switch (GetPlayer(parameterObject["playerid"])) @@ -640,7 +640,7 @@ JSONRPC_STATUS CPlayerOperations::GoTo(const CStdString &method, ITransportLayer return ACK; } -JSONRPC_STATUS CPlayerOperations::SetShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetShuffle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CGUIWindowSlideShow *slideshow = NULL; CVariant shuffle = parameterObject["shuffle"]; @@ -698,7 +698,7 @@ JSONRPC_STATUS CPlayerOperations::SetShuffle(const CStdString &method, ITranspor return ACK; } -JSONRPC_STATUS CPlayerOperations::SetRepeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetRepeat(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -736,7 +736,7 @@ JSONRPC_STATUS CPlayerOperations::SetRepeat(const CStdString &method, ITransport return ACK; } -JSONRPC_STATUS CPlayerOperations::SetPartymode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetPartymode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { PlayerType player = GetPlayer(parameterObject["playerid"]); switch (player) @@ -789,7 +789,7 @@ JSONRPC_STATUS CPlayerOperations::SetPartymode(const CStdString &method, ITransp return ACK; } -JSONRPC_STATUS CPlayerOperations::SetAudioStream(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetAudioStream(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -836,7 +836,7 @@ JSONRPC_STATUS CPlayerOperations::SetAudioStream(const CStdString &method, ITran return ACK; } -JSONRPC_STATUS CPlayerOperations::SetSubtitle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlayerOperations::SetSubtitle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { switch (GetPlayer(parameterObject["playerid"])) { @@ -994,14 +994,14 @@ void CPlayerOperations::OnPlaylistChanged() g_windowManager.SendThreadMessage(msg); } -JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStdString &property, CVariant &result) +JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const std::string &property, CVariant &result) { if (player == None) return FailedToExecute; int playlist = GetPlaylist(player); - if (property.Equals("type")) + if (property == "type") { switch (player) { @@ -1021,7 +1021,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("partymode")) + else if (property == "partymode") { switch (player) { @@ -1044,7 +1044,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("speed")) + else if (property == "speed") { CGUIWindowSlideShow *slideshow = NULL; switch (player) @@ -1066,7 +1066,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("time")) + else if (property == "time") { switch (player) { @@ -1095,7 +1095,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("percentage")) + else if (property == "percentage") { CGUIWindowSlideShow *slideshow = NULL; switch (player) @@ -1128,7 +1128,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("totaltime")) + else if (property == "totaltime") { switch (player) { @@ -1157,11 +1157,11 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd return FailedToExecute; } } - else if (property.Equals("playlistid")) + else if (property == "playlistid") { result = playlist; } - else if (property.Equals("position")) + else if (property == "position") { CGUIWindowSlideShow *slideshow = NULL; switch (player) @@ -1187,7 +1187,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("repeat")) + else if (property == "repeat") { switch (player) { @@ -1219,7 +1219,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("shuffled")) + else if (property == "shuffled") { CGUIWindowSlideShow *slideshow = NULL; switch (player) @@ -1248,7 +1248,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canseek")) + else if (property == "canseek") { switch (player) { @@ -1263,7 +1263,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canchangespeed")) + else if (property == "canchangespeed") { switch (player) { @@ -1278,7 +1278,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canmove")) + else if (property == "canmove") { switch (player) { @@ -1293,7 +1293,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canzoom")) + else if (property == "canzoom") { switch (player) { @@ -1308,7 +1308,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canrotate")) + else if (property == "canrotate") { switch (player) { @@ -1323,7 +1323,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canshuffle")) + else if (property == "canshuffle") { switch (player) { @@ -1338,7 +1338,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("canrepeat")) + else if (property == "canrepeat") { switch (player) { @@ -1353,7 +1353,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("currentaudiostream")) + else if (property == "currentaudiostream") { switch (player) { @@ -1386,7 +1386,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("audiostreams")) + else if (property == "audiostreams") { result = CVariant(CVariant::VariantTypeArray); switch (player) @@ -1418,7 +1418,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("subtitleenabled")) + else if (property == "subtitleenabled") { switch (player) { @@ -1433,7 +1433,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("currentsubtitle")) + else if (property == "currentsubtitle") { switch (player) { @@ -1463,7 +1463,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("subtitles")) + else if (property == "subtitles") { result = CVariant(CVariant::VariantTypeArray); switch (player) @@ -1492,7 +1492,7 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd break; } } - else if (property.Equals("live")) + else if (property == "live") result = IsPVRChannel(); else return InvalidParams; diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.h b/xbmc/interfaces/json-rpc/PlayerOperations.h index ddecde869b..afdc2e0c05 100644 --- a/xbmc/interfaces/json-rpc/PlayerOperations.h +++ b/xbmc/interfaces/json-rpc/PlayerOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -43,27 +42,27 @@ namespace JSONRPC class CPlayerOperations : CFileItemHandler { public: - static JSONRPC_STATUS GetActivePlayers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetItem(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetActivePlayers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetItem(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetSpeed(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Seek(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS PlayPause(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Stop(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetSpeed(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Seek(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Move(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Move(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Zoom(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Rotate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GoTo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetRepeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetPartymode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Open(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GoTo(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetShuffle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetRepeat(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetPartymode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetAudioStream(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetSubtitle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetAudioStream(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetSubtitle(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: static int GetActivePlayers(); static PlayerType GetPlayer(const CVariant &player); @@ -71,7 +70,7 @@ namespace JSONRPC static JSONRPC_STATUS StartSlideshow(const std::string& path, bool recursive, bool random); static void SendSlideshowAction(int actionID); static void OnPlaylistChanged(); - static JSONRPC_STATUS GetPropertyValue(PlayerType player, const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(PlayerType player, const std::string &property, CVariant &result); static int ParseRepeatState(const CVariant &repeat); static double ParseTimeInSeconds(const CVariant &time); diff --git a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp index b8a398cf63..38e8b95a6e 100644 --- a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp @@ -33,7 +33,7 @@ using namespace JSONRPC; using namespace PLAYLIST; using namespace std; -JSONRPC_STATUS CPlaylistOperations::GetPlaylists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::GetPlaylists(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { result = CVariant(CVariant::VariantTypeArray); CVariant playlist = CVariant(CVariant::VariantTypeObject); @@ -53,12 +53,12 @@ JSONRPC_STATUS CPlaylistOperations::GetPlaylists(const CStdString &method, ITran return OK; } -JSONRPC_STATUS CPlaylistOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(playlist, propertyName, property)) != OK) @@ -70,7 +70,7 @@ JSONRPC_STATUS CPlaylistOperations::GetProperties(const CStdString &method, ITra return OK; } -JSONRPC_STATUS CPlaylistOperations::GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::GetItems(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CFileItemList list; int playlist = GetPlaylist(parameterObject["playlistid"]); @@ -109,7 +109,7 @@ bool CPlaylistOperations::CheckMediaParameter(int playlist, const CVariant &item return true; } -JSONRPC_STATUS CPlaylistOperations::Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::Add(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); @@ -152,7 +152,7 @@ JSONRPC_STATUS CPlaylistOperations::Add(const CStdString &method, ITransportLaye return ACK; } -JSONRPC_STATUS CPlaylistOperations::Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::Insert(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); if (playlist == PLAYLIST_PICTURE) @@ -168,7 +168,7 @@ JSONRPC_STATUS CPlaylistOperations::Insert(const CStdString &method, ITransportL return ACK; } -JSONRPC_STATUS CPlaylistOperations::Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::Remove(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); if (playlist == PLAYLIST_PICTURE) @@ -184,7 +184,7 @@ JSONRPC_STATUS CPlaylistOperations::Remove(const CStdString &method, ITransportL return ACK; } -JSONRPC_STATUS CPlaylistOperations::Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::Clear(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); CGUIWindowSlideShow *slideshow = NULL; @@ -208,7 +208,7 @@ JSONRPC_STATUS CPlaylistOperations::Clear(const CStdString &method, ITransportLa return ACK; } -JSONRPC_STATUS CPlaylistOperations::Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::Swap(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int playlist = GetPlaylist(parameterObject["playlistid"]); if (playlist == PLAYLIST_PICTURE) @@ -235,9 +235,9 @@ void CPlaylistOperations::NotifyAll() g_windowManager.SendThreadMessage(msg); } -JSONRPC_STATUS CPlaylistOperations::GetPropertyValue(int playlist, const CStdString &property, CVariant &result) +JSONRPC_STATUS CPlaylistOperations::GetPropertyValue(int playlist, const std::string &property, CVariant &result) { - if (property.Equals("type")) + if (property == "type") { switch (playlist) { @@ -258,7 +258,7 @@ JSONRPC_STATUS CPlaylistOperations::GetPropertyValue(int playlist, const CStdStr break; } } - else if (property.Equals("size")) + else if (property == "size") { CFileItemList list; CGUIWindowSlideShow *slideshow = NULL; diff --git a/xbmc/interfaces/json-rpc/PlaylistOperations.h b/xbmc/interfaces/json-rpc/PlaylistOperations.h index 54df4a1d99..2093e0d809 100644 --- a/xbmc/interfaces/json-rpc/PlaylistOperations.h +++ b/xbmc/interfaces/json-rpc/PlaylistOperations.h @@ -1,4 +1,3 @@ -#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org @@ -19,7 +18,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" #include "FileItem.h" @@ -29,19 +27,19 @@ namespace JSONRPC class CPlaylistOperations : public CFileItemHandler { public: - static JSONRPC_STATUS GetPlaylists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetPlaylists(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetItems(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Add(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Remove(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Insert(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Clear(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Swap(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: static int GetPlaylist(const CVariant &playlist); static inline void NotifyAll(); - static JSONRPC_STATUS GetPropertyValue(int playlist, const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(int playlist, const std::string &property, CVariant &result); static bool CheckMediaParameter(int playlist, const CVariant &itemObject); static bool HandleItemsParameter(int playlistid, const CVariant &itemParam, CFileItemList &items); }; diff --git a/xbmc/interfaces/json-rpc/ProfilesOperations.cpp b/xbmc/interfaces/json-rpc/ProfilesOperations.cpp index 973713fd48..540409e64f 100644 --- a/xbmc/interfaces/json-rpc/ProfilesOperations.cpp +++ b/xbmc/interfaces/json-rpc/ProfilesOperations.cpp @@ -26,7 +26,7 @@ using namespace JSONRPC; -JSONRPC_STATUS CProfilesOperations::GetProfiles(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CProfilesOperations::GetProfiles(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CFileItemList listItems; @@ -47,7 +47,7 @@ JSONRPC_STATUS CProfilesOperations::GetProfiles(const CStdString &method, ITrans { for (CVariant::iterator_array profileiter = result["profiles"].begin_array(); profileiter != result["profiles"].end_array(); ++profileiter) { - CStdString profilename = (*profileiter)["label"].asString(); + std::string profilename = (*profileiter)["label"].asString(); int index = CProfilesManager::Get().GetProfileIndex(profilename); const CProfile *profile = CProfilesManager::Get().GetProfile(index); LockType locktype = LOCK_MODE_UNKNOWN; @@ -63,7 +63,7 @@ JSONRPC_STATUS CProfilesOperations::GetProfiles(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CProfilesOperations::GetCurrentProfile(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CProfilesOperations::GetCurrentProfile(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { const CProfile& currentProfile = CProfilesManager::Get().GetCurrentProfile(); CVariant profileVariant = CVariant(CVariant::VariantTypeObject); @@ -84,9 +84,9 @@ JSONRPC_STATUS CProfilesOperations::GetCurrentProfile(const CStdString &method, return OK; } -JSONRPC_STATUS CProfilesOperations::LoadProfile(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CProfilesOperations::LoadProfile(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString profilename = parameterObject["profile"].asString(); + std::string profilename = parameterObject["profile"].asString(); int index = CProfilesManager::Get().GetProfileIndex(profilename); if (index < 0) @@ -105,7 +105,7 @@ JSONRPC_STATUS CProfilesOperations::LoadProfile(const CStdString &method, ITrans else if (!bCanceled && parameterObject.isMember("password")) // Password needed and user provided it { const CVariant &passwordObject = parameterObject["password"]; - CStdString strToVerify; // Holds user saved password hash + std::string strToVerify; // Holds user saved password hash if (index == 0) strToVerify = CProfilesManager::Get().GetMasterProfile().getLockCode(); else @@ -114,18 +114,18 @@ JSONRPC_STATUS CProfilesOperations::LoadProfile(const CStdString &method, ITrans strToVerify = profile->getLockCode(); } - CStdString password = passwordObject["value"].asString(); + std::string password = passwordObject["value"].asString(); // Create password hash from the provided password if md5 is not used - CStdString md5pword2; - CStdString encryption = passwordObject["encryption"].asString(); - if (encryption.Equals("none")) + std::string md5pword2; + std::string encryption = passwordObject["encryption"].asString(); + if (encryption == "none") md5pword2 = XBMC::XBMC_MD5::GetMD5(password); - else if (encryption.Equals("md5")) + else if (encryption == "md5") md5pword2 = password; // Verify profided password - if (strToVerify.Equals(md5pword2)) + if (strToVerify == md5pword2) bLoadProfile = true; } diff --git a/xbmc/interfaces/json-rpc/ProfilesOperations.h b/xbmc/interfaces/json-rpc/ProfilesOperations.h index 360a7472fa..b15ae621a8 100644 --- a/xbmc/interfaces/json-rpc/ProfilesOperations.h +++ b/xbmc/interfaces/json-rpc/ProfilesOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -28,8 +27,8 @@ namespace JSONRPC class CProfilesOperations : CFileItemHandler { public: - static JSONRPC_STATUS GetProfiles(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetCurrentProfile(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS LoadProfile(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProfiles(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetCurrentProfile(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS LoadProfile(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/SettingsOperations.cpp b/xbmc/interfaces/json-rpc/SettingsOperations.cpp index c5e1457939..5b0019e538 100644 --- a/xbmc/interfaces/json-rpc/SettingsOperations.cpp +++ b/xbmc/interfaces/json-rpc/SettingsOperations.cpp @@ -33,7 +33,7 @@ using namespace std; using namespace JSONRPC; -JSONRPC_STATUS CSettingsOperations::GetSections(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::GetSections(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { SettingLevel level = (SettingLevel)ParseSettingLevel(parameterObject["level"].asString()); bool listCategories = !parameterObject["properties"].empty() && parameterObject["properties"][0].asString() == "categories"; @@ -72,7 +72,7 @@ JSONRPC_STATUS CSettingsOperations::GetSections(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CSettingsOperations::GetCategories(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::GetCategories(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { SettingLevel level = (SettingLevel)ParseSettingLevel(parameterObject["level"].asString()); std::string strSection = parameterObject["section"].asString(); @@ -137,7 +137,7 @@ JSONRPC_STATUS CSettingsOperations::GetCategories(const CStdString &method, ITra return OK; } -JSONRPC_STATUS CSettingsOperations::GetSettings(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::GetSettings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { SettingLevel level = (SettingLevel)ParseSettingLevel(parameterObject["level"].asString()); const CVariant &filter = parameterObject["filter"]; @@ -202,7 +202,7 @@ JSONRPC_STATUS CSettingsOperations::GetSettings(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CSettingsOperations::GetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::GetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string settingId = parameterObject["setting"].asString(); @@ -247,7 +247,7 @@ JSONRPC_STATUS CSettingsOperations::GetSettingValue(const CStdString &method, IT return OK; } -JSONRPC_STATUS CSettingsOperations::SetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::SetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string settingId = parameterObject["setting"].asString(); CVariant value = parameterObject["value"]; @@ -309,7 +309,7 @@ JSONRPC_STATUS CSettingsOperations::SetSettingValue(const CStdString &method, IT return OK; } -JSONRPC_STATUS CSettingsOperations::ResetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSettingsOperations::ResetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { string settingId = parameterObject["setting"].asString(); diff --git a/xbmc/interfaces/json-rpc/SettingsOperations.h b/xbmc/interfaces/json-rpc/SettingsOperations.h index cee669cfc5..b9ab365278 100644 --- a/xbmc/interfaces/json-rpc/SettingsOperations.h +++ b/xbmc/interfaces/json-rpc/SettingsOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" class ISetting; @@ -42,13 +41,13 @@ namespace JSONRPC class CSettingsOperations { public: - static JSONRPC_STATUS GetSections(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetCategories(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSettings(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSections(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetCategories(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSettings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS ResetSettingValue(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS ResetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: static int ParseSettingLevel(const std::string &strLevel); diff --git a/xbmc/interfaces/json-rpc/SystemOperations.cpp b/xbmc/interfaces/json-rpc/SystemOperations.cpp index 3d9259a2a0..d6016d1405 100644 --- a/xbmc/interfaces/json-rpc/SystemOperations.cpp +++ b/xbmc/interfaces/json-rpc/SystemOperations.cpp @@ -26,12 +26,12 @@ using namespace JSONRPC; -JSONRPC_STATUS CSystemOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVariant properties = CVariant(CVariant::VariantTypeObject); for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CStdString propertyName = parameterObject["properties"][index].asString(); + std::string propertyName = parameterObject["properties"][index].asString(); CVariant property; JSONRPC_STATUS ret; if ((ret = GetPropertyValue(client->GetPermissionFlags(), propertyName, property)) != OK) @@ -45,12 +45,12 @@ JSONRPC_STATUS CSystemOperations::GetProperties(const CStdString &method, ITrans return OK; } -JSONRPC_STATUS CSystemOperations::EjectOpticalDrive(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::EjectOpticalDrive(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return CBuiltins::Execute("EjectTray") == 0 ? ACK : FailedToExecute; } -JSONRPC_STATUS CSystemOperations::Shutdown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::Shutdown(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (g_powerManager.CanPowerdown()) { @@ -61,7 +61,7 @@ JSONRPC_STATUS CSystemOperations::Shutdown(const CStdString &method, ITransportL return FailedToExecute; } -JSONRPC_STATUS CSystemOperations::Suspend(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::Suspend(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (g_powerManager.CanSuspend()) { @@ -72,7 +72,7 @@ JSONRPC_STATUS CSystemOperations::Suspend(const CStdString &method, ITransportLa return FailedToExecute; } -JSONRPC_STATUS CSystemOperations::Hibernate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::Hibernate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (g_powerManager.CanHibernate()) { @@ -83,7 +83,7 @@ JSONRPC_STATUS CSystemOperations::Hibernate(const CStdString &method, ITransport return FailedToExecute; } -JSONRPC_STATUS CSystemOperations::Reboot(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CSystemOperations::Reboot(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (g_powerManager.CanReboot()) { @@ -94,15 +94,15 @@ JSONRPC_STATUS CSystemOperations::Reboot(const CStdString &method, ITransportLay return FailedToExecute; } -JSONRPC_STATUS CSystemOperations::GetPropertyValue(int permissions, const CStdString &property, CVariant &result) +JSONRPC_STATUS CSystemOperations::GetPropertyValue(int permissions, const std::string &property, CVariant &result) { - if (property.Equals("canshutdown")) + if (property == "canshutdown") result = g_powerManager.CanPowerdown() && (permissions & ControlPower); - else if (property.Equals("cansuspend")) + else if (property == "cansuspend") result = g_powerManager.CanSuspend() && (permissions & ControlPower); - else if (property.Equals("canhibernate")) + else if (property == "canhibernate") result = g_powerManager.CanHibernate() && (permissions & ControlPower); - else if (property.Equals("canreboot")) + else if (property == "canreboot") result = g_powerManager.CanReboot() && (permissions & ControlPower); else return InvalidParams; diff --git a/xbmc/interfaces/json-rpc/SystemOperations.h b/xbmc/interfaces/json-rpc/SystemOperations.h index ab2d669465..161df7a078 100644 --- a/xbmc/interfaces/json-rpc/SystemOperations.h +++ b/xbmc/interfaces/json-rpc/SystemOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" namespace JSONRPC @@ -27,15 +26,15 @@ namespace JSONRPC class CSystemOperations { public: - static JSONRPC_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS EjectOpticalDrive(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS EjectOpticalDrive(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Shutdown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Suspend(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Hibernate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Reboot(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Shutdown(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Suspend(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Hibernate(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Reboot(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: - static JSONRPC_STATUS GetPropertyValue(int permissions, const CStdString &property, CVariant &result); + static JSONRPC_STATUS GetPropertyValue(int permissions, const std::string &property, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/TextureOperations.cpp b/xbmc/interfaces/json-rpc/TextureOperations.cpp index ca96272d19..3d7390812a 100644 --- a/xbmc/interfaces/json-rpc/TextureOperations.cpp +++ b/xbmc/interfaces/json-rpc/TextureOperations.cpp @@ -24,7 +24,7 @@ using namespace JSONRPC; -JSONRPC_STATUS CTextureOperations::GetTextures(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CTextureOperations::GetTextures(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CFileItemList listItems; @@ -92,7 +92,7 @@ JSONRPC_STATUS CTextureOperations::GetTextures(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CTextureOperations::RemoveTexture(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CTextureOperations::RemoveTexture(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["textureid"].asInteger(); diff --git a/xbmc/interfaces/json-rpc/TextureOperations.h b/xbmc/interfaces/json-rpc/TextureOperations.h index 4e849294ab..9f5a0c8c99 100644 --- a/xbmc/interfaces/json-rpc/TextureOperations.h +++ b/xbmc/interfaces/json-rpc/TextureOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" namespace JSONRPC @@ -27,7 +26,7 @@ namespace JSONRPC class CTextureOperations { public: - static JSONRPC_STATUS GetTextures(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS RemoveTexture(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetTextures(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveTexture(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.cpp b/xbmc/interfaces/json-rpc/VideoLibrary.cpp index 726f663d0a..972345a366 100644 --- a/xbmc/interfaces/json-rpc/VideoLibrary.cpp +++ b/xbmc/interfaces/json-rpc/VideoLibrary.cpp @@ -28,7 +28,7 @@ using namespace JSONRPC; -JSONRPC_STATUS CVideoLibrary::GetMovies(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMovies(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -65,7 +65,7 @@ JSONRPC_STATUS CVideoLibrary::GetMovies(const CStdString &method, ITransportLaye videoUrl.AddOption("tag", filter["tag"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("movies", filter, xsp)) return InvalidParams; @@ -83,7 +83,7 @@ JSONRPC_STATUS CVideoLibrary::GetMovies(const CStdString &method, ITransportLaye return GetAdditionalMovieDetails(parameterObject, items, result, videodatabase, false); } -JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["movieid"].asInteger(); @@ -99,7 +99,7 @@ JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const CStdString &method, ITranspo return OK; } -JSONRPC_STATUS CVideoLibrary::GetMovieSets(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMovieSets(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -113,7 +113,7 @@ JSONRPC_STATUS CVideoLibrary::GetMovieSets(const CStdString &method, ITransportL return OK; } -JSONRPC_STATUS CVideoLibrary::GetMovieSetDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMovieSetDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["setid"].asInteger(); @@ -136,7 +136,7 @@ JSONRPC_STATUS CVideoLibrary::GetMovieSetDetails(const CStdString &method, ITran return GetAdditionalMovieDetails(parameterObject["movies"], items, result["setdetails"], videodatabase, true); } -JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetTVShows(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -165,7 +165,7 @@ JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLay videoUrl.AddOption("tag", filter["tag"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("tvshows", filter, xsp)) return InvalidParams; @@ -179,7 +179,7 @@ JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLay bool additionalInfo = false; for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++) { - CStdString fieldValue = itr->asString(); + std::string fieldValue = itr->asString(); if (fieldValue == "cast" || fieldValue == "tag") additionalInfo = true; } @@ -198,7 +198,7 @@ JSONRPC_STATUS CVideoLibrary::GetTVShows(const CStdString &method, ITransportLay return OK; } -JSONRPC_STATUS CVideoLibrary::GetTVShowDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetTVShowDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -216,7 +216,7 @@ JSONRPC_STATUS CVideoLibrary::GetTVShowDetails(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CVideoLibrary::GetSeasons(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetSeasons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -224,7 +224,7 @@ JSONRPC_STATUS CVideoLibrary::GetSeasons(const CStdString &method, ITransportLay int tvshowID = (int)parameterObject["tvshowid"].asInteger(); - CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/", tvshowID); + std::string strPath = StringUtils::Format("videodb://tvshows/titles/%i/", tvshowID); CFileItemList items; if (!videodatabase.GetSeasonsNav(strPath, items, -1, -1, -1, -1, tvshowID, false)) return InternalError; @@ -233,7 +233,7 @@ JSONRPC_STATUS CVideoLibrary::GetSeasons(const CStdString &method, ITransportLay return OK; } -JSONRPC_STATUS CVideoLibrary::GetSeasonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetSeasonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -251,7 +251,7 @@ JSONRPC_STATUS CVideoLibrary::GetSeasonDetails(const CStdString &method, ITransp return OK; } -JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetEpisodes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -265,7 +265,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLa int tvshowID = (int)parameterObject["tvshowid"].asInteger(); int season = (int)parameterObject["season"].asInteger(); - CStdString strPath = StringUtils::Format("videodb://tvshows/titles/%i/%i/", tvshowID, season); + std::string strPath = StringUtils::Format("videodb://tvshows/titles/%i/%i/", tvshowID, season); CVideoDbUrl videoUrl; videoUrl.FromString(strPath); @@ -282,7 +282,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLa videoUrl.AddOption("director", filter["director"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("episodes", filter, xsp)) return InvalidParams; @@ -306,7 +306,7 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodes(const CStdString &method, ITransportLa return GetAdditionalEpisodeDetails(parameterObject, items, result, videodatabase, false); } -JSONRPC_STATUS CVideoLibrary::GetEpisodeDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetEpisodeDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -324,14 +324,14 @@ JSONRPC_STATUS CVideoLibrary::GetEpisodeDetails(const CStdString &method, ITrans if (tvshowid <= 0) tvshowid = videodatabase.GetTvShowForEpisode(id); - CStdString basePath = StringUtils::Format("videodb://tvshows/titles/%ld/%ld/%ld", tvshowid, infos.m_iSeason, id); + std::string 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); return OK; } -JSONRPC_STATUS CVideoLibrary::GetMusicVideos(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMusicVideos(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -362,7 +362,7 @@ JSONRPC_STATUS CVideoLibrary::GetMusicVideos(const CStdString &method, ITranspor videoUrl.AddOption("tag", filter["tag"].asString()); else if (filter.isObject()) { - CStdString xsp; + std::string xsp; if (!GetXspFiltering("musicvideos", filter, xsp)) return InvalidParams; @@ -376,7 +376,7 @@ JSONRPC_STATUS CVideoLibrary::GetMusicVideos(const CStdString &method, ITranspor return GetAdditionalMusicVideoDetails(parameterObject, items, result, videodatabase, false); } -JSONRPC_STATUS CVideoLibrary::GetMusicVideoDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetMusicVideoDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -392,7 +392,7 @@ JSONRPC_STATUS CVideoLibrary::GetMusicVideoDetails(const CStdString &method, ITr return OK; } -JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMovies(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMovies(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -405,7 +405,7 @@ JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMovies(const CStdString &method, I return GetAdditionalMovieDetails(parameterObject, items, result, videodatabase, true); } -JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedEpisodes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedEpisodes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -418,7 +418,7 @@ JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedEpisodes(const CStdString &method, return GetAdditionalEpisodeDetails(parameterObject, items, result, videodatabase, true); } -JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMusicVideos(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMusicVideos(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CVideoDatabase videodatabase; if (!videodatabase.Open()) @@ -431,25 +431,25 @@ JSONRPC_STATUS CVideoLibrary::GetRecentlyAddedMusicVideos(const CStdString &meth return GetAdditionalMusicVideoDetails(parameterObject, items, result, videodatabase, true); } -JSONRPC_STATUS CVideoLibrary::GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::GetGenres(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString media = parameterObject["type"].asString(); + std::string media = parameterObject["type"].asString(); StringUtils::ToLower(media); int idContent = -1; - CStdString strPath = "videodb://"; + std::string strPath = "videodb://"; /* select which video content to get genres from*/ - if (media.Equals(MediaTypeMovie)) + if (media == MediaTypeMovie) { idContent = VIDEODB_CONTENT_MOVIES; strPath += "movies"; } - else if (media.Equals(MediaTypeTvShow)) + else if (media == MediaTypeTvShow) { idContent = VIDEODB_CONTENT_TVSHOWS; strPath += "tvshows"; } - else if (media.Equals(MediaTypeMusicVideo)) + else if (media == MediaTypeMusicVideo) { idContent = VIDEODB_CONTENT_MUSICVIDEOS; strPath += "musicvideos"; @@ -472,7 +472,7 @@ JSONRPC_STATUS CVideoLibrary::GetGenres(const CStdString &method, ITransportLaye return OK; } -JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["movieid"].asInteger(); @@ -518,7 +518,7 @@ JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const CStdString &method, ITranspo return ACK; } -JSONRPC_STATUS CVideoLibrary::SetMovieSetDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetMovieSetDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["setid"].asInteger(); @@ -551,7 +551,7 @@ JSONRPC_STATUS CVideoLibrary::SetMovieSetDetails(const CStdString &method, ITran return ACK; } -JSONRPC_STATUS CVideoLibrary::SetTVShowDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetTVShowDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["tvshowid"].asInteger(); @@ -587,7 +587,7 @@ JSONRPC_STATUS CVideoLibrary::SetTVShowDetails(const CStdString &method, ITransp return ACK; } -JSONRPC_STATUS CVideoLibrary::SetSeasonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetSeasonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["seasonid"].asInteger(); @@ -620,7 +620,7 @@ JSONRPC_STATUS CVideoLibrary::SetSeasonDetails(const CStdString &method, ITransp return ACK; } -JSONRPC_STATUS CVideoLibrary::SetEpisodeDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetEpisodeDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["episodeid"].asInteger(); @@ -673,7 +673,7 @@ JSONRPC_STATUS CVideoLibrary::SetEpisodeDetails(const CStdString &method, ITrans return ACK; } -JSONRPC_STATUS CVideoLibrary::SetMusicVideoDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::SetMusicVideoDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { int id = (int)parameterObject["musicvideoid"].asInteger(); @@ -723,30 +723,30 @@ JSONRPC_STATUS CVideoLibrary::SetMusicVideoDetails(const CStdString &method, ITr return ACK; } -JSONRPC_STATUS CVideoLibrary::RemoveMovie(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::RemoveMovie(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return RemoveVideo(parameterObject); } -JSONRPC_STATUS CVideoLibrary::RemoveTVShow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::RemoveTVShow(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return RemoveVideo(parameterObject); } -JSONRPC_STATUS CVideoLibrary::RemoveEpisode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::RemoveEpisode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return RemoveVideo(parameterObject); } -JSONRPC_STATUS CVideoLibrary::RemoveMusicVideo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::RemoveMusicVideo(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { return RemoveVideo(parameterObject); } -JSONRPC_STATUS CVideoLibrary::Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::string directory = parameterObject["directory"].asString(); - CStdString cmd; + std::string cmd; if (directory.empty()) cmd = "updatelibrary(video)"; else @@ -756,9 +756,9 @@ JSONRPC_STATUS CVideoLibrary::Scan(const CStdString &method, ITransportLayer *tr return ACK; } -JSONRPC_STATUS CVideoLibrary::Export(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::Export(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString cmd; + std::string cmd; if (parameterObject["options"].isMember("path")) cmd = StringUtils::Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()).c_str()); else @@ -771,13 +771,13 @@ JSONRPC_STATUS CVideoLibrary::Export(const CStdString &method, ITransportLayer * return ACK; } -JSONRPC_STATUS CVideoLibrary::Clean(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CVideoLibrary::Clean(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { CApplicationMessenger::Get().ExecBuiltIn("cleanlibrary(video)"); return ACK; } -bool CVideoLibrary::FillFileItem(const CStdString &strFilename, CFileItemPtr &item, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) +bool CVideoLibrary::FillFileItem(const std::string &strFilename, CFileItemPtr &item, const CVariant ¶meterObject /* = CVariant(CVariant::VariantTypeArray) */) { CVideoDatabase videodatabase; if (strFilename.empty()) @@ -810,7 +810,7 @@ bool CVideoLibrary::FillFileItemList(const CVariant ¶meterObject, CFileItemL if (!videodatabase.Open()) return false; - CStdString file = parameterObject["file"].asString(); + std::string file = parameterObject["file"].asString(); int movieID = (int)parameterObject["movieid"].asInteger(-1); int episodeID = (int)parameterObject["episodeid"].asInteger(-1); int musicVideoID = (int)parameterObject["musicvideoid"].asInteger(-1); @@ -864,7 +864,7 @@ JSONRPC_STATUS CVideoLibrary::GetAdditionalMovieDetails(const CVariant ¶mete bool additionalInfo = false; for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++) { - CStdString fieldValue = itr->asString(); + std::string fieldValue = itr->asString(); if (fieldValue == "cast" || fieldValue == "showlink" || fieldValue == "tag" || fieldValue == "streamdetails") additionalInfo = true; } @@ -894,7 +894,7 @@ JSONRPC_STATUS CVideoLibrary::GetAdditionalEpisodeDetails(const CVariant ¶me bool additionalInfo = false; for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++) { - CStdString fieldValue = itr->asString(); + std::string fieldValue = itr->asString(); if (fieldValue == "cast" || fieldValue == "streamdetails") additionalInfo = true; } diff --git a/xbmc/interfaces/json-rpc/VideoLibrary.h b/xbmc/interfaces/json-rpc/VideoLibrary.h index 919f0f05e5..88aa4dd351 100644 --- a/xbmc/interfaces/json-rpc/VideoLibrary.h +++ b/xbmc/interfaces/json-rpc/VideoLibrary.h @@ -20,7 +20,6 @@ */ #include "utils/DatabaseUtils.h" -#include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" @@ -31,44 +30,44 @@ namespace JSONRPC class CVideoLibrary : public CFileItemHandler { public: - static JSONRPC_STATUS GetMovies(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetMovieDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetMovieSets(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetMovieSetDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMovies(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMovieDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMovieSets(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMovieSetDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetTVShows(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetTVShowDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSeasons(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetSeasonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetEpisodes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetEpisodeDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetTVShows(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetTVShowDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSeasons(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetSeasonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetEpisodes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetEpisodeDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetMusicVideos(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetMusicVideoDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMusicVideos(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetMusicVideoDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyAddedMovies(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyAddedEpisodes(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetRecentlyAddedMusicVideos(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyAddedMovies(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyAddedEpisodes(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetRecentlyAddedMusicVideos(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetGenres(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetGenres(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetMovieDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetMovieSetDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetTVShowDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetSeasonDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetEpisodeDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS SetMusicVideoDetails(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetMovieDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetMovieSetDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetTVShowDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetSeasonDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetEpisodeDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS SetMusicVideoDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS RemoveMovie(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS RemoveTVShow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS RemoveEpisode(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS RemoveMusicVideo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveMovie(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveTVShow(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveEpisode(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS RemoveMusicVideo(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Scan(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Export(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS Clean(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Export(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS Clean(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static bool FillFileItem(const CStdString &strFilename, CFileItemPtr &item, const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); + static bool FillFileItem(const std::string &strFilename, CFileItemPtr &item, const CVariant ¶meterObject = CVariant(CVariant::VariantTypeArray)); static bool FillFileItemList(const CVariant ¶meterObject, CFileItemList &list); private: diff --git a/xbmc/interfaces/json-rpc/XBMCOperations.cpp b/xbmc/interfaces/json-rpc/XBMCOperations.cpp index 87d5cc7be9..e6b2e93218 100644 --- a/xbmc/interfaces/json-rpc/XBMCOperations.cpp +++ b/xbmc/interfaces/json-rpc/XBMCOperations.cpp @@ -26,13 +26,13 @@ using namespace JSONRPC; -JSONRPC_STATUS CXBMCOperations::GetInfoLabels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CXBMCOperations::GetInfoLabels(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::vector<std::string> info; for (unsigned int i = 0; i < parameterObject["labels"].size(); i++) { - CStdString field = parameterObject["labels"][i].asString(); + std::string field = parameterObject["labels"][i].asString(); StringUtils::ToLower(field); info.push_back(parameterObject["labels"][i].asString()); @@ -52,7 +52,7 @@ JSONRPC_STATUS CXBMCOperations::GetInfoLabels(const CStdString &method, ITranspo return OK; } -JSONRPC_STATUS CXBMCOperations::GetInfoBooleans(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSONRPC_STATUS CXBMCOperations::GetInfoBooleans(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::vector<std::string> info; @@ -60,20 +60,20 @@ JSONRPC_STATUS CXBMCOperations::GetInfoBooleans(const CStdString &method, ITrans for (unsigned int i = 0; i < parameterObject["booleans"].size(); i++) { - CStdString field = parameterObject["booleans"][i].asString(); + std::string field = parameterObject["booleans"][i].asString(); StringUtils::ToLower(field); // Need to override power management of whats in infomanager since jsonrpc // have a security layer aswell. - if (field.Equals("system.canshutdown")) + if (field == "system.canshutdown") result[parameterObject["booleans"][i].asString()] = (g_powerManager.CanPowerdown() && CanControlPower); - else if (field.Equals("system.canpowerdown")) + else if (field == "system.canpowerdown") result[parameterObject["booleans"][i].asString()] = (g_powerManager.CanPowerdown() && CanControlPower); - else if (field.Equals("system.cansuspend")) + else if (field == "system.cansuspend") result[parameterObject["booleans"][i].asString()] = (g_powerManager.CanSuspend() && CanControlPower); - else if (field.Equals("system.canhibernate")) + else if (field == "system.canhibernate") result[parameterObject["booleans"][i].asString()] = (g_powerManager.CanHibernate() && CanControlPower); - else if (field.Equals("system.canreboot")) + else if (field == "system.canreboot") result[parameterObject["booleans"][i].asString()] = (g_powerManager.CanReboot() && CanControlPower); else info.push_back(parameterObject["booleans"][i].asString()); diff --git a/xbmc/interfaces/json-rpc/XBMCOperations.h b/xbmc/interfaces/json-rpc/XBMCOperations.h index c610a43ae6..85f22b55d7 100644 --- a/xbmc/interfaces/json-rpc/XBMCOperations.h +++ b/xbmc/interfaces/json-rpc/XBMCOperations.h @@ -19,7 +19,6 @@ * */ -#include "utils/StdString.h" #include "JSONRPC.h" namespace JSONRPC @@ -27,7 +26,7 @@ namespace JSONRPC class CXBMCOperations { public: - static JSONRPC_STATUS GetInfoLabels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSONRPC_STATUS GetInfoBooleans(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetInfoLabels(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSONRPC_STATUS GetInfoBooleans(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); }; } diff --git a/xbmc/interfaces/legacy/Control.cpp b/xbmc/interfaces/legacy/Control.cpp index 5a4137c75d..32202f17db 100644 --- a/xbmc/interfaces/legacy/Control.cpp +++ b/xbmc/interfaces/legacy/Control.cpp @@ -284,8 +284,8 @@ namespace XBMCAddon (float)dwPosY, (float)dwWidth, (float)dwHeight, - (CStdString)strTextureFocus, - (CStdString)strTextureNoFocus, + CTextureInfo(strTextureFocus), + CTextureInfo(strTextureNoFocus), label); CGUIButtonControl* pGuiButtonControl = @@ -449,7 +449,7 @@ namespace XBMCAddon { pGUIControl = new CGUIImage(iParentId, iControlId, (float)dwPosX, (float)dwPosY, (float)dwWidth, (float)dwHeight, - (CStdString)strFileName); + CTextureInfo(strFileName)); if (pGUIControl && aspectRatio <= CAspectRatio::AR_KEEP) ((CGUIImage *)pGUIControl)->SetAspectRatio((CAspectRatio::ASPECT_RATIO)aspectRatio); @@ -505,9 +505,9 @@ namespace XBMCAddon pGUIControl = new CGUIProgressControl(iParentId, iControlId, (float)dwPosX, (float)dwPosY, (float)dwWidth,(float)dwHeight, - (CStdString)strTextureBg,(CStdString)strTextureLeft, - (CStdString)strTextureMid,(CStdString)strTextureRight, - (CStdString)strTextureOverlay); + CTextureInfo(strTextureBg), CTextureInfo(strTextureLeft), + CTextureInfo(strTextureMid), CTextureInfo(strTextureRight), + CTextureInfo(strTextureOverlay)); if (pGUIControl && colorDiffuse) ((CGUIProgressControl *)pGUIControl)->SetColorDiffuse(colorDiffuse); @@ -553,8 +553,8 @@ namespace XBMCAddon { pGUIControl = new CGUISliderControl(iParentId, iControlId,(float)dwPosX, (float)dwPosY, (float)dwWidth,(float)dwHeight, - (CStdString)strTextureBack,(CStdString)strTexture, - (CStdString)strTextureFoc,0); + CTextureInfo(strTextureBack),CTextureInfo(strTexture), + CTextureInfo(strTextureFoc),0); return pGUIControl; } @@ -717,13 +717,13 @@ namespace XBMCAddon (float)dwPosY, (float)dwWidth, (float)dwHeight, - (CStdString)strTextureFocus, - (CStdString)strTextureNoFocus, + CTextureInfo(strTextureFocus), + CTextureInfo(strTextureNoFocus), label, - (CStdString)strTextureRadioOnFocus, - (CStdString)strTextureRadioOnNoFocus, - (CStdString)strTextureRadioOffFocus, - (CStdString)strTextureRadioOffNoFocus); + CTextureInfo(strTextureRadioOnFocus), + CTextureInfo(strTextureRadioOnNoFocus), + CTextureInfo(strTextureRadioOffFocus), + CTextureInfo(strTextureRadioOffNoFocus)); CGUIRadioButtonControl* pGuiButtonControl = (CGUIRadioButtonControl*)pGUIControl; @@ -1072,8 +1072,8 @@ namespace XBMCAddon (float)dwPosY, (float)dwWidth, (float)dwHeight, - (CStdString)strTextureFocus, - (CStdString)strTextureNoFocus, + CTextureInfo(strTextureFocus), + CTextureInfo(strTextureNoFocus), label, strText); @@ -1189,8 +1189,8 @@ namespace XBMCAddon (float)dwWidth, (float)dwHeight - pControlSpin->dwHeight - 5, label, label2, - (CStdString)strTextureButton, - (CStdString)strTextureButtonFocus, + CTextureInfo(strTextureButton), + CTextureInfo(strTextureButtonFocus), (float)itemHeight, (float)imageWidth, (float)imageHeight, (float)space); diff --git a/xbmc/interfaces/legacy/Dialog.cpp b/xbmc/interfaces/legacy/Dialog.cpp index ae67d7ea8e..b8884d5308 100644 --- a/xbmc/interfaces/legacy/Dialog.cpp +++ b/xbmc/interfaces/legacy/Dialog.cpp @@ -154,7 +154,7 @@ namespace XBMCAddon const String& defaultt ) throw (WindowException) { DelayedCallGuard dcguard(languageHook); - CStdString value; + std::string value; std::string mask = maskparam; VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(s_shares); if (!shares) @@ -200,7 +200,7 @@ namespace XBMCAddon String Dialog::numeric(int inputtype, const String& heading, const String& defaultt) { DelayedCallGuard dcguard(languageHook); - CStdString value; + std::string value; SYSTEMTIME timedate; GetLocalTime(&timedate); @@ -210,7 +210,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 10) { - CStdString sDefault = defaultt; + std::string sDefault = defaultt; timedate.wDay = atoi(sDefault.substr(0, 2).c_str()); timedate.wMonth = atoi(sDefault.substr(3, 4).c_str()); timedate.wYear = atoi(sDefault.substr(sDefault.size() - 4).c_str()); @@ -224,7 +224,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 5) { - CStdString sDefault = defaultt; + std::string sDefault = defaultt; timedate.wHour = atoi(sDefault.substr(0, 2).c_str()); timedate.wMinute = atoi(sDefault.substr(3, 2).c_str()); } @@ -253,7 +253,7 @@ namespace XBMCAddon { DelayedCallGuard dcguard(languageHook); - CStdString strIcon = getNOTIFICATION_INFO(); + std::string strIcon = getNOTIFICATION_INFO(); int iTime = TOAST_DISPLAY_TIME; if (time > 0) @@ -261,11 +261,11 @@ namespace XBMCAddon if (!icon.empty()) strIcon = icon; - if (strIcon.Equals(getNOTIFICATION_INFO())) + if (strIcon == getNOTIFICATION_INFO()) CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, iTime, sound); - else if (strIcon.Equals(getNOTIFICATION_WARNING())) + else if (strIcon == getNOTIFICATION_WARNING()) CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, heading, message, iTime, sound); - else if (strIcon.Equals(getNOTIFICATION_ERROR())) + else if (strIcon == getNOTIFICATION_ERROR()) CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, heading, message, iTime, sound); else CGUIDialogKaiToast::QueueNotification(strIcon, heading, message, iTime, sound); @@ -274,7 +274,7 @@ namespace XBMCAddon String Dialog::input(const String& heading, const String& defaultt, int type, int option, int autoclose) throw (WindowException) { DelayedCallGuard dcguard(languageHook); - CStdString value(defaultt); + std::string value(defaultt); SYSTEMTIME timedate; GetLocalTime(&timedate); @@ -297,7 +297,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 10) { - CStdString sDefault = defaultt; + std::string sDefault = defaultt; timedate.wDay = atoi(sDefault.substr(0, 2).c_str()); timedate.wMonth = atoi(sDefault.substr(3, 4).c_str()); timedate.wYear = atoi(sDefault.substr(sDefault.size() - 4).c_str()); @@ -312,7 +312,7 @@ namespace XBMCAddon { if (!defaultt.empty() && defaultt.size() == 5) { - CStdString sDefault = defaultt; + std::string sDefault = defaultt; timedate.wHour = atoi(sDefault.substr(0, 2).c_str()); timedate.wMinute = atoi(sDefault.substr(3, 2).c_str()); } diff --git a/xbmc/interfaces/legacy/Exception.h b/xbmc/interfaces/legacy/Exception.h index 5741c85ec0..dc2401ac3c 100644 --- a/xbmc/interfaces/legacy/Exception.h +++ b/xbmc/interfaces/legacy/Exception.h @@ -24,7 +24,6 @@ #include "swighelper.h" #include "utils/log.h" -#include "utils/StdString.h" #include "commons/Exception.h" #ifndef SWIG diff --git a/xbmc/interfaces/legacy/Keyboard.cpp b/xbmc/interfaces/legacy/Keyboard.cpp index be2d3528d1..c3fc339271 100644 --- a/xbmc/interfaces/legacy/Keyboard.cpp +++ b/xbmc/interfaces/legacy/Keyboard.cpp @@ -43,7 +43,7 @@ namespace XBMCAddon DelayedCallGuard dg(languageHook); // using keyboardfactory method to get native keyboard if there is. strText = strDefault; - CStdString text(strDefault); + std::string text(strDefault); bConfirmed = CGUIKeyboardFactory::ShowAndGetInput(text, strHeading, true, bHidden, autoclose * 1000); strText = text; } diff --git a/xbmc/interfaces/legacy/ListItem.cpp b/xbmc/interfaces/legacy/ListItem.cpp index 84c2b0caa9..76ac826b5b 100644 --- a/xbmc/interfaces/legacy/ListItem.cpp +++ b/xbmc/interfaces/legacy/ListItem.cpp @@ -136,9 +136,9 @@ namespace XBMCAddon LOCKGUI; for (Properties::const_iterator it = dictionary.begin(); it != dictionary.end(); ++it) { - CStdString artName = it->first; + std::string artName = it->first; StringUtils::ToLower(artName); - const CStdString artFilename(it->second.c_str()); + const std::string artFilename(it->second.c_str()); item->SetArt(artName, artFilename); } } @@ -203,7 +203,7 @@ namespace XBMCAddon LOCKGUI; String lowerKey = key; StringUtils::ToLower(lowerKey); - CStdString value; + std::string value; if (lowerKey == "startoffset") { // special case for start offset - don't actually store in a property, // we store it in item.m_lStartOffset instead diff --git a/xbmc/interfaces/legacy/ModuleXbmc.cpp b/xbmc/interfaces/legacy/ModuleXbmc.cpp index db54d79f55..dfdca99b4d 100644 --- a/xbmc/interfaces/legacy/ModuleXbmc.cpp +++ b/xbmc/interfaces/legacy/ModuleXbmc.cpp @@ -178,7 +178,7 @@ namespace XBMCAddon String getLanguage(int format /* = CLangCodeExpander::ENGLISH_NAME */, bool region /*= false*/) { XBMC_TRACE; - CStdString lang = CSettings::Get().GetString("locale.language"); + std::string lang = CSettings::Get().GetString("locale.language"); switch (format) { @@ -186,19 +186,19 @@ namespace XBMCAddon { if (region) { - CStdString region = "-" + g_langInfo.GetCurrentRegion(); + std::string region = "-" + g_langInfo.GetCurrentRegion(); return (lang += region); } return lang; } case CLangCodeExpander::ISO_639_1: { - CStdString langCode; + std::string langCode; g_LangCodeExpander.ConvertToTwoCharCode(langCode, lang); if (region) { - CStdString region = g_langInfo.GetRegionLocale(); - CStdString region2Code; + std::string region = g_langInfo.GetRegionLocale(); + std::string region2Code; g_LangCodeExpander.ConvertToTwoCharCode(region2Code, region); region2Code = "-" + region2Code; return (langCode += region2Code); @@ -207,12 +207,12 @@ namespace XBMCAddon } case CLangCodeExpander::ISO_639_2: { - CStdString langCode; + std::string langCode; g_LangCodeExpander.ConvertToThreeCharCode(langCode, lang); if (region) { - CStdString region = g_langInfo.GetRegionLocale(); - CStdString region3Code; + std::string region = g_langInfo.GetRegionLocale(); + std::string region3Code; g_LangCodeExpander.ConvertToThreeCharCode(region3Code, region); region3Code = "-" + region3Code; return (langCode += region3Code); @@ -389,11 +389,11 @@ namespace XBMCAddon { XBMC_TRACE; CFileItem item(path, false); - CStdString strName = item.GetMovieName(usefoldername); + std::string strName = item.GetMovieName(usefoldername); - CStdString strTitleAndYear; - CStdString strTitle; - CStdString strYear; + std::string strTitleAndYear; + std::string strTitle; + std::string strYear; CUtil::CleanString(strName, strTitle, strTitleAndYear, strYear, usefoldername); return Tuple<String,String>(strTitle,strYear); } @@ -407,7 +407,7 @@ namespace XBMCAddon String getRegion(const char* id) { XBMC_TRACE; - CStdString result; + std::string result; if (strcmpi(id, "datelong") == 0) { @@ -490,7 +490,7 @@ namespace XBMCAddon String convertLanguage(const char* language, int format) { - CStdString convertedLanguage; + std::string convertedLanguage; switch (format) { case CLangCodeExpander::ENGLISH_NAME: diff --git a/xbmc/interfaces/legacy/ModuleXbmc.h b/xbmc/interfaces/legacy/ModuleXbmc.h index c2e593f972..30620a7942 100644 --- a/xbmc/interfaces/legacy/ModuleXbmc.h +++ b/xbmc/interfaces/legacy/ModuleXbmc.h @@ -24,7 +24,6 @@ #include "utils/LangCodeExpander.h" #include "utils/log.h" -#include "utils/StdString.h" #include "swighelper.h" #include <vector> diff --git a/xbmc/interfaces/legacy/ModuleXbmcvfs.cpp b/xbmc/interfaces/legacy/ModuleXbmcvfs.cpp index 9210de233c..c97da91a41 100644 --- a/xbmc/interfaces/legacy/ModuleXbmcvfs.cpp +++ b/xbmc/interfaces/legacy/ModuleXbmcvfs.cpp @@ -83,7 +83,7 @@ namespace XBMCAddon Tuple<std::vector<String>, std::vector<String> > listdir(const String& path) { CFileItemList items; - CStdString strSource; + std::string strSource; strSource = path; XFILE::CDirectory::GetDirectory(strSource, items, "", XFILE::DIR_FLAG_NO_FILE_DIRS); @@ -93,17 +93,17 @@ namespace XBMCAddon for (int i=0; i < items.Size(); i++) { - CStdString itemPath = items[i]->GetPath(); + std::string itemPath = items[i]->GetPath(); if (URIUtils::HasSlashAtEnd(itemPath)) // folder { URIUtils::RemoveSlashAtEnd(itemPath); - CStdString strFileName = URIUtils::GetFileName(itemPath); + std::string strFileName = URIUtils::GetFileName(itemPath); ret.first().push_back(strFileName); } else // file { - CStdString strFileName = URIUtils::GetFileName(itemPath); + std::string strFileName = URIUtils::GetFileName(itemPath); ret.second().push_back(strFileName); } } diff --git a/xbmc/interfaces/legacy/Window.cpp b/xbmc/interfaces/legacy/Window.cpp index 23aa278124..a955364dcf 100644 --- a/xbmc/interfaces/legacy/Window.cpp +++ b/xbmc/interfaces/legacy/Window.cpp @@ -640,7 +640,7 @@ namespace XBMCAddon { XBMC_TRACE; SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook); - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); ref(window)->SetProperty(lowerKey, value); @@ -650,7 +650,7 @@ namespace XBMCAddon { XBMC_TRACE; SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook); - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); std::string value = ref(window)->GetProperty(lowerKey).asString(); return value; @@ -662,7 +662,7 @@ namespace XBMCAddon if (!key) return; SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook); - CStdString lowerKey = key; + std::string lowerKey = key; StringUtils::ToLower(lowerKey); ref(window)->SetProperty(lowerKey, ""); } diff --git a/xbmc/interfaces/legacy/WindowXML.cpp b/xbmc/interfaces/legacy/WindowXML.cpp index fbdc64f146..b3467de528 100644 --- a/xbmc/interfaces/legacy/WindowXML.cpp +++ b/xbmc/interfaces/legacy/WindowXML.cpp @@ -77,13 +77,13 @@ namespace XBMCAddon protected: // CGUIWindow - virtual bool LoadXML(const CStdString &strPath, const CStdString &strPathLower) + virtual bool LoadXML(const std::string &strPath, const std::string &strPathLower) { XBMC_TRACE; return up() ? CGUIMediaWindow::LoadXML(strPath,strPathLower) : xwin->LoadXML(strPath,strPathLower); } // CGUIMediaWindow virtual void GetContextButtons(int itemNumber, CContextButtons &buttons) { XBMC_TRACE; if (up()) CGUIMediaWindow::GetContextButtons(itemNumber,buttons); else xwin->GetContextButtons(itemNumber,buttons); } - virtual bool Update(const CStdString &strPath) + virtual bool Update(const std::string &strPath) { XBMC_TRACE; return up() ? CGUIMediaWindow::Update(strPath) : xwin->Update(strPath); } virtual void SetupShares() { XBMC_TRACE; if(up()) CGUIMediaWindow::SetupShares(); else checkedv(SetupShares()); } @@ -102,18 +102,18 @@ namespace XBMCAddon { XBMC_TRACE; RESOLUTION_INFO res; - CStdString strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res); + std::string strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res); if (!XFILE::CFile::Exists(strSkinPath)) { - CStdString str("none"); + std::string str("none"); ADDON::AddonProps props(str, ADDON::ADDON_SKIN, "", ""); ADDON::CSkinInfo::TranslateResolution(defaultRes, res); // Check for the matching folder for the skin in the fallback skins folder - CStdString fallbackPath = URIUtils::AddFileToFolder(scriptPath, "resources"); + std::string fallbackPath = URIUtils::AddFileToFolder(scriptPath, "resources"); fallbackPath = URIUtils::AddFileToFolder(fallbackPath, "skins"); - CStdString basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID()); + std::string basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID()); strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res, basePath); @@ -382,8 +382,8 @@ namespace XBMCAddon void WindowXML::AllocResources(bool forceLoad /*= FALSE */) { XBMC_TRACE; - CStdString tmpDir = URIUtils::GetDirectory(ref(window)->GetProperty("xmlfile").asString()); - CStdString fallbackMediaPath; + std::string tmpDir = URIUtils::GetDirectory(ref(window)->GetProperty("xmlfile").asString()); + std::string fallbackMediaPath; URIUtils::GetParentPath(tmpDir, fallbackMediaPath); URIUtils::RemoveSlashAtEnd(fallbackMediaPath); m_mediaDir = fallbackMediaPath; diff --git a/xbmc/interfaces/python/PythonInvoker.cpp b/xbmc/interfaces/python/PythonInvoker.cpp index ceb1b76028..19bb06b7c2 100644 --- a/xbmc/interfaces/python/PythonInvoker.cpp +++ b/xbmc/interfaces/python/PythonInvoker.cpp @@ -78,9 +78,9 @@ extern "C" CCriticalSection CPythonInvoker::s_critical; -static const CStdString getListOfAddonClassesAsString(XBMCAddon::AddonClass::Ref<XBMCAddon::Python::PythonLanguageHook>& languageHook) +static const std::string getListOfAddonClassesAsString(XBMCAddon::AddonClass::Ref<XBMCAddon::Python::PythonLanguageHook>& languageHook) { - CStdString message; + std::string message; CSingleLock l(*(languageHook.get())); std::set<XBMCAddon::AddonClass*>& acs = languageHook->GetRegisteredAddonClasses(); bool firstTime = true; @@ -184,7 +184,7 @@ bool CPythonInvoker::execute(const std::string &script, const std::vector<std::s // get path from script file name and add python path's // this is used for python so it will search modules from script path first - CStdString scriptDir = URIUtils::GetDirectory(realFilename); + std::string scriptDir = URIUtils::GetDirectory(realFilename); URIUtils::RemoveSlashAtEnd(scriptDir); addPath(scriptDir); @@ -559,17 +559,17 @@ void CPythonInvoker::onError() CGUIDialogKaiToast *pDlgToast = (CGUIDialogKaiToast*)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST); if (pDlgToast != NULL) { - CStdString desc; - CStdString script; + std::string desc; + std::string script; if (m_addon.get() != NULL) script = m_addon->Name(); else { - CStdString path; + std::string path; URIUtils::Split(m_sourceFile.c_str(), path, script); - if (script.Equals("default.py")) + if (script == "default.py") { - CStdString path2; + std::string path2; URIUtils::RemoveSlashAtEnd(path); URIUtils::Split(path, path2, script); } diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp index 0d6dabc36d..099c042bb3 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -273,7 +273,7 @@ void XBPython::UnregisterPythonMonitorCallBack(XBMCAddon::xbmc::Monitor* pCallba } } -void XBPython::OnSettingsChanged(const CStdString &ID) +void XBPython::OnSettingsChanged(const std::string &ID) { XBMC_TRACE; LOCK_AND_COPY(std::vector<XBMCAddon::xbmc::Monitor*>,tmp,m_vecMonitorCallbackList); @@ -350,7 +350,7 @@ void XBPython::OnScanFinished(const std::string &library) } } -void XBPython::OnAbortRequested(const CStdString &ID) +void XBPython::OnAbortRequested(const std::string &ID) { XBMC_TRACE; LOCK_AND_COPY(std::vector<XBMCAddon::xbmc::Monitor*>,tmp,m_vecMonitorCallbackList); @@ -489,7 +489,7 @@ bool XBPython::InitializeEngine() #elif defined(TARGET_WINDOWS) // because the third party build of python is compiled with vs2008 we need // a hack to set the PYTHONPATH - CStdString buf; + std::string buf; buf = "PYTHONPATH=" + CSpecialProtocol::TranslatePath("special://xbmc/system/python/DLLs") + ";" + CSpecialProtocol::TranslatePath("special://xbmc/system/python/Lib"); CEnvironment::putenv(buf); buf = "PYTHONOPTIMIZE=1"; @@ -500,7 +500,7 @@ bool XBPython::InitializeEngine() CEnvironment::putenv(buf); #elif defined(TARGET_ANDROID) - CStdString apkPath = getenv("XBMC_ANDROID_APK"); + std::string apkPath = getenv("XBMC_ANDROID_APK"); apkPath += "/assets/python2.6"; setenv("PYTHONHOME",apkPath.c_str(), 1); setenv("PYTHONPATH", "", 1); diff --git a/xbmc/interfaces/python/XBPython.h b/xbmc/interfaces/python/XBPython.h index 0cf550eb53..645015223c 100644 --- a/xbmc/interfaces/python/XBPython.h +++ b/xbmc/interfaces/python/XBPython.h @@ -80,14 +80,14 @@ public: void UnregisterPythonPlayerCallBack(IPlayerCallback* pCallback); void RegisterPythonMonitorCallBack(XBMCAddon::xbmc::Monitor* pCallback); void UnregisterPythonMonitorCallBack(XBMCAddon::xbmc::Monitor* pCallback); - void OnSettingsChanged(const CStdString &strings); + void OnSettingsChanged(const std::string &strings); void OnScreensaverActivated(); void OnScreensaverDeactivated(); void OnDPMSActivated(); void OnDPMSDeactivated(); void OnScanStarted(const std::string &library); void OnScanFinished(const std::string &library); - void OnAbortRequested(const CStdString &ID=""); + void OnAbortRequested(const std::string &ID=""); void OnNotification(const std::string &sender, const std::string &method, const std::string &data); virtual void Process(); diff --git a/xbmc/interfaces/python/swig.cpp b/xbmc/interfaces/python/swig.cpp index 8808f1e5e4..66c02ea127 100644 --- a/xbmc/interfaces/python/swig.cpp +++ b/xbmc/interfaces/python/swig.cpp @@ -155,7 +155,7 @@ namespace PythonBindings PyObject* exc_traceback; PyObject* pystring = NULL; - CStdString msg; + std::string msg; PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); if (exc_type == 0 && exc_value == 0 && exc_traceback == 0) diff --git a/xbmc/interfaces/python/swig.h b/xbmc/interfaces/python/swig.h index d2bfdd2cdc..d1d0961388 100644 --- a/xbmc/interfaces/python/swig.h +++ b/xbmc/interfaces/python/swig.h @@ -24,7 +24,6 @@ #include <string> #include <stdint.h> -#include "utils/StdString.h" #include "interfaces/legacy/Exception.h" #include "interfaces/legacy/AddonClass.h" #include "interfaces/legacy/Window.h" diff --git a/xbmc/linux/DBusReserve.cpp b/xbmc/linux/DBusReserve.cpp index 46226561cc..d3a4c9a345 100644 --- a/xbmc/linux/DBusReserve.cpp +++ b/xbmc/linux/DBusReserve.cpp @@ -48,7 +48,7 @@ CDBusReserve::~CDBusReserve() { while(m_devs.begin() != m_devs.end()) { - CStdString buf = *m_devs.begin(); + std::string buf = *m_devs.begin(); ReleaseDevice(buf); } @@ -56,7 +56,7 @@ CDBusReserve::~CDBusReserve() dbus_connection_unref(m_conn); } -bool CDBusReserve::AcquireDevice(const CStdString& device) +bool CDBusReserve::AcquireDevice(const std::string& device) { DBusMessage* msg, *reply; DBusMessageIter args; @@ -68,8 +68,8 @@ bool CDBusReserve::AcquireDevice(const CStdString& device) // we don't implement the RequestRelease interface int prio = INT_MAX; - CStdString service = "org.freedesktop.ReserveDevice1." + device; - CStdString object = "/org/freedesktop/ReserveDevice1/" + device; + std::string service = "org.freedesktop.ReserveDevice1." + device; + std::string object = "/org/freedesktop/ReserveDevice1/" + device; const char * interface = "org.freedesktop.ReserveDevice1"; if (!m_conn) @@ -155,12 +155,12 @@ bool CDBusReserve::AcquireDevice(const CStdString& device) } -bool CDBusReserve::ReleaseDevice(const CStdString& device) +bool CDBusReserve::ReleaseDevice(const std::string& device) { DBusError error; dbus_error_init (&error); - vector<CStdString>::iterator it = find(m_devs.begin(), m_devs.end(), device); + vector<std::string>::iterator it = find(m_devs.begin(), m_devs.end(), device); if(it == m_devs.end()) { CLog::Log(LOGDEBUG, "CDBusReserve::ReleaseDevice(%s): device wasn't aquired here", device.c_str()); @@ -168,7 +168,7 @@ bool CDBusReserve::ReleaseDevice(const CStdString& device) } m_devs.erase(it); - CStdString service = "org.freedesktop.ReserveDevice1." + device; + std::string service = "org.freedesktop.ReserveDevice1." + device; int res = dbus_bus_release_name(m_conn, service.c_str(), &error); if(res == DBUS_RELEASE_NAME_REPLY_RELEASED) diff --git a/xbmc/linux/DBusReserve.h b/xbmc/linux/DBusReserve.h index 82bc3663b5..48cbdc23a9 100644 --- a/xbmc/linux/DBusReserve.h +++ b/xbmc/linux/DBusReserve.h @@ -19,7 +19,7 @@ */ #pragma once #include "system.h" -#include "utils/StdString.h" +#include <string> #include <vector> struct DBusConnection; @@ -30,11 +30,11 @@ public: CDBusReserve(); ~CDBusReserve(); - bool AcquireDevice(const CStdString &device); - bool ReleaseDevice(const CStdString &device); + bool AcquireDevice(const std::string &device); + bool ReleaseDevice(const std::string &device); private: DBusConnection *m_conn; - std::vector<CStdString> m_devs; + std::vector<std::string> m_devs; }; diff --git a/xbmc/linux/HALManager.cpp b/xbmc/linux/HALManager.cpp index cfb699c291..3f322d14ee 100644 --- a/xbmc/linux/HALManager.cpp +++ b/xbmc/linux/HALManager.cpp @@ -427,8 +427,8 @@ void CHALManager::HandleNewVolume(CStorageDevice *dev) if (Mountable) { CLog::Log(LOGNOTICE, "HAL: Trying to mount %s", dev->FriendlyName.c_str()); - CStdString MountPoint; - CStdString TestPath; + std::string MountPoint; + std::string TestPath; if (dev->Label.size() > 0) { MountPoint = dev->Label.c_str(); @@ -608,7 +608,7 @@ bool CHALManager::ApproveDevice(CStorageDevice *device) return approve; } -bool CHALManager::Eject(CStdString path) +bool CHALManager::Eject(const std::string& path) { for (unsigned int i = 0; i < m_Volumes.size(); i++) { @@ -669,7 +669,7 @@ bool CHALManager::UnMount(CStorageDevice volume) } } -bool CHALManager::Mount(CStorageDevice *volume, CStdString mountpath) +bool CHALManager::Mount(CStorageDevice *volume, const std::string &mountpath) { CLog::Log(LOGNOTICE, "HAL: Mounting %s (%s) at %s with umask=%u", volume->UDI.c_str(), volume->toString().c_str(), mountpath.c_str(), umask (0)); DBusMessage* msg; @@ -691,7 +691,7 @@ bool CHALManager::Mount(CStorageDevice *volume, CStdString mountpath) DBusMessageIter sub; dbus_message_iter_open_container(&args, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &sub); - CStdString temporaryString; + std::string temporaryString; if (volume->FileSystem.Equals("vfat")) { diff --git a/xbmc/linux/HALManager.h b/xbmc/linux/HALManager.h index 6f4be17628..fe90c3fac5 100644 --- a/xbmc/linux/HALManager.h +++ b/xbmc/linux/HALManager.h @@ -39,8 +39,8 @@ class CHALDevice { public: - CStdString UDI; - CStdString FriendlyName; + std::string UDI; + std::string FriendlyName; CHALDevice(const char *udi) { UDI = udi; } }; @@ -53,16 +53,16 @@ public: bool Approved; bool HotPlugged; bool HalIgnore; - CStdString MountPoint; - CStdString Label; - CStdString UUID; - CStdString DevID; + std::string MountPoint; + std::string Label; + std::string UUID; + std::string DevID; int Type; - CStdString FileSystem; + std::string FileSystem; - CStdString toString() + std::string toString() { // Not the prettiest but it's better than having to reproduce it elsewere in the code... - CStdString rtn, tmp1, tmp2, tmp3, tmp4; + std::string rtn, tmp1, tmp2, tmp3, tmp4; if (UUID.size() > 0) tmp1 = StringUtils::Format("UUID %s | ", UUID.c_str()); if (FileSystem.size() > 0) @@ -116,7 +116,7 @@ public: CHALManager(); void Stop(); std::vector<CStorageDevice> GetVolumeDevices(); - bool Eject(CStdString path); + bool Eject(const std::string &path); protected: DBusConnection *m_DBusSystemConnection; LibHalContext *m_Context; @@ -135,7 +135,7 @@ private: void GenerateGDL(); bool UnMount(CStorageDevice volume); - bool Mount(CStorageDevice *volume, CStdString mountpath); + bool Mount(CStorageDevice *volume, const std::string& mountpath); void HandleNewVolume(CStorageDevice *dev); static bool ApproveDevice(CStorageDevice *device); diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp index cf9ee6c307..b4ffd13b1e 100644 --- a/xbmc/linux/LinuxTimezone.cpp +++ b/xbmc/linux/LinuxTimezone.cpp @@ -46,15 +46,15 @@ CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) char* line = NULL; size_t linelen = 0; int nameonfourthfield = 0; - CStdString s; + std::string s; std::vector<std::string> tokens; // Load timezones FILE* fp = fopen("/usr/share/zoneinfo/zone.tab", "r"); if (fp) { - CStdString countryCode; - CStdString timezoneName; + std::string countryCode; + std::string timezoneName; while (getdelim(&line, &linelen, '\n', fp) > 0) { @@ -77,13 +77,13 @@ CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) if (m_timezonesByCountryCode.count(countryCode) == 0) { - vector<CStdString> timezones; + vector<std::string> timezones; timezones.push_back(timezoneName); m_timezonesByCountryCode[countryCode] = timezones; } else { - vector<CStdString>& timezones = m_timezonesByCountryCode[countryCode]; + vector<std::string>& timezones = m_timezonesByCountryCode[countryCode]; timezones.push_back(timezoneName); } @@ -108,8 +108,8 @@ CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) } if (fp) { - CStdString countryCode; - CStdString countryName; + std::string countryCode; + std::string countryName; while (getdelim(&line, &linelen, '\n', fp) > 0) { @@ -176,26 +176,26 @@ void CLinuxTimezone::OnSettingsLoaded() CDateTime::ResetTimezoneBias(); } -vector<CStdString> CLinuxTimezone::GetCounties() +vector<std::string> CLinuxTimezone::GetCounties() { return m_counties; } -vector<CStdString> CLinuxTimezone::GetTimezonesByCountry(const CStdString country) +vector<std::string> CLinuxTimezone::GetTimezonesByCountry(const std::string country) { return m_timezonesByCountryCode[m_countryByName[country]]; } -CStdString CLinuxTimezone::GetCountryByTimezone(const CStdString timezone) +std::string CLinuxTimezone::GetCountryByTimezone(const std::string timezone) { #if defined(TARGET_DARWIN) - return CStdString("?"); + return "?"; #else return m_countryByCode[m_countriesByTimezoneName[timezone]]; #endif } -void CLinuxTimezone::SetTimezone(CStdString timezoneName) +void CLinuxTimezone::SetTimezone(std::string timezoneName) { bool use_timezone = false; @@ -215,7 +215,7 @@ void CLinuxTimezone::SetTimezone(CStdString timezoneName) } } -CStdString CLinuxTimezone::GetOSConfiguredTimezone() +std::string CLinuxTimezone::GetOSConfiguredTimezone() { char timezoneName[255]; @@ -254,7 +254,7 @@ CStdString CLinuxTimezone::GetOSConfiguredTimezone() void CLinuxTimezone::SettingOptionsTimezoneCountriesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data) { - vector<CStdString> countries = g_timezone.GetCounties(); + vector<std::string> countries = g_timezone.GetCounties(); for (unsigned int i = 0; i < countries.size(); i++) list.push_back(make_pair(countries[i], countries[i])); } @@ -263,10 +263,10 @@ void CLinuxTimezone::SettingOptionsTimezonesFiller(const CSetting *setting, std: { current = ((const CSettingString*)setting)->GetValue(); bool found = false; - vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(CSettings::Get().GetString("locale.timezonecountry")); + vector<std::string> timezones = g_timezone.GetTimezonesByCountry(CSettings::Get().GetString("locale.timezonecountry")); for (unsigned int i = 0; i < timezones.size(); i++) { - if (!found && timezones[i].Equals(current.c_str())) + if (!found && StringUtils::EqualsNoCase(timezones[i], current)) found = true; list.push_back(make_pair(timezones[i], timezones[i])); diff --git a/xbmc/linux/LinuxTimezone.h b/xbmc/linux/LinuxTimezone.h index 04d13fda9c..1598747996 100644 --- a/xbmc/linux/LinuxTimezone.h +++ b/xbmc/linux/LinuxTimezone.h @@ -23,7 +23,7 @@ #include "settings/lib/ISettingCallback.h" #include "settings/lib/ISettingsHandler.h" -#include "utils/StdString.h" +#include <string> #include <vector> #include <map> @@ -38,25 +38,25 @@ public: virtual void OnSettingsLoaded(); - CStdString GetOSConfiguredTimezone(); + std::string GetOSConfiguredTimezone(); - std::vector<CStdString> GetCounties(); - std::vector<CStdString> GetTimezonesByCountry(const CStdString country); - CStdString GetCountryByTimezone(const CStdString timezone); + std::vector<std::string> GetCounties(); + std::vector<std::string> GetTimezonesByCountry(const std::string country); + std::string GetCountryByTimezone(const std::string timezone); - void SetTimezone(CStdString timezone); + void SetTimezone(std::string timezone); int m_IsDST; static void SettingOptionsTimezoneCountriesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data); static void SettingOptionsTimezonesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, void *data); private: - std::vector<CStdString> m_counties; - std::map<CStdString, CStdString> m_countryByCode; - std::map<CStdString, CStdString> m_countryByName; + std::vector<std::string> m_counties; + std::map<std::string, std::string> m_countryByCode; + std::map<std::string, std::string> m_countryByName; - std::map<CStdString, std::vector<CStdString> > m_timezonesByCountryCode; - std::map<CStdString, CStdString> m_countriesByTimezoneName; + std::map<std::string, std::vector<std::string> > m_timezonesByCountryCode; + std::map<std::string, std::string> m_countriesByTimezoneName; }; extern CLinuxTimezone g_timezone; diff --git a/xbmc/linux/PosixMountProvider.cpp b/xbmc/linux/PosixMountProvider.cpp index 23397094e1..7ce5540a87 100644 --- a/xbmc/linux/PosixMountProvider.cpp +++ b/xbmc/linux/PosixMountProvider.cpp @@ -19,7 +19,6 @@ */ #include "PosixMountProvider.h" #include "utils/RegExp.h" -#include "utils/StdString.h" #include "utils/URIUtils.h" #include "utils/log.h" @@ -36,7 +35,7 @@ void CPosixMountProvider::Initialize() void CPosixMountProvider::GetDrives(VECSOURCES &drives) { - std::vector<CStdString> result; + std::vector<std::string> result; CRegExp reMount; #if defined(TARGET_DARWIN) @@ -90,9 +89,9 @@ void CPosixMountProvider::GetDrives(VECSOURCES &drives) } } -std::vector<CStdString> CPosixMountProvider::GetDiskUsage() +std::vector<std::string> CPosixMountProvider::GetDiskUsage() { - std::vector<CStdString> result; + std::vector<std::string> result; char line[1024]; #if defined(TARGET_DARWIN) @@ -127,7 +126,7 @@ std::vector<CStdString> CPosixMountProvider::GetDiskUsage() return result; } -bool CPosixMountProvider::Eject(CStdString mountpath) +bool CPosixMountProvider::Eject(const std::string& mountpath) { // just go ahead and try to umount the disk // if it does umount, life is good, if not, no loss. diff --git a/xbmc/linux/PosixMountProvider.h b/xbmc/linux/PosixMountProvider.h index 58da2d3984..d34247f67c 100644 --- a/xbmc/linux/PosixMountProvider.h +++ b/xbmc/linux/PosixMountProvider.h @@ -32,9 +32,9 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives) { GetDrives(localDrives); } virtual void GetRemovableDrives(VECSOURCES &removableDrives) { /*GetDrives(removableDrives);*/ } - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); private: diff --git a/xbmc/linux/XFileUtils.cpp b/xbmc/linux/XFileUtils.cpp index 21f60c1f0a..b472ce2a45 100644 --- a/xbmc/linux/XFileUtils.cpp +++ b/xbmc/linux/XFileUtils.cpp @@ -57,7 +57,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) if (lpFindData == NULL || szPath == NULL) return NULL; - CStdString strPath(szPath); + std::string strPath(szPath); if (IsAliasShortcut(strPath)) TranslateAliasShortcut(strPath); @@ -81,8 +81,8 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) size_t nFilePos = strPath.rfind(XBMC_FILE_SEP); - CStdString strDir = "."; - CStdString strFiles = strPath; + std::string strDir = "."; + std::string strFiles = strPath; if (nFilePos > 0) { @@ -93,7 +93,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) if (strFiles == "*.*") strFiles = "*"; - strFiles = CStdString("^") + strFiles + "$"; + strFiles = '^' + strFiles + '$'; StringUtils::Replace(strFiles, ".","\\."); StringUtils::Replace(strFiles, "*",".*"); StringUtils::Replace(strFiles, "?","."); @@ -108,9 +108,9 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) #if defined(TARGET_ANDROID) // android is more strict with the sort function. Let's hope it is implemented correctly. typedef int (*sortFunc)(const struct dirent ** a, const struct dirent **b); - int n = scandir(strDir, &namelist, 0, (sortFunc)alphasort); + int n = scandir(strDir.c_str(), &namelist, 0, (sortFunc)alphasort); #else - int n = scandir(strDir, &namelist, 0, alphasort); + int n = scandir(strDir.c_str(), &namelist, 0, alphasort); #endif CXHandle *pHandle = new CXHandle(CXHandle::HND_FIND_FILE); @@ -118,7 +118,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) while (n-- > 0) { - CStdString strComp(namelist[n]->d_name); + std::string strComp(namelist[n]->d_name); StringUtils::ToLower(strComp); if (re.RegFind(strComp.c_str()) >= 0) @@ -146,15 +146,15 @@ BOOL FindNextFile(HANDLE hHandle, LPWIN32_FIND_DATA lpFindData) if ((unsigned int) hHandle->m_nFindFileIterator >= hHandle->m_FindFileResults.size()) return FALSE; - CStdString strFileName = hHandle->m_FindFileResults[hHandle->m_nFindFileIterator++]; - CStdString strFileNameTest = hHandle->m_FindFileDir + strFileName; + std::string strFileName = hHandle->m_FindFileResults[hHandle->m_nFindFileIterator++]; + std::string strFileNameTest = hHandle->m_FindFileDir + strFileName; if (IsAliasShortcut(strFileNameTest)) TranslateAliasShortcut(strFileNameTest); struct stat64 fileStat; memset(&fileStat, 0, sizeof(fileStat)); - stat64(strFileNameTest, &fileStat); + stat64(strFileNameTest.c_str(), &fileStat); bool bIsDir = false; if (S_ISDIR(fileStat.st_mode)) @@ -173,7 +173,7 @@ BOOL FindNextFile(HANDLE hHandle, LPWIN32_FIND_DATA lpFindData) if (strFileName[0] == '.') lpFindData->dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; - if (access(strFileName, R_OK) == 0 && access(strFileName, W_OK) != 0) + if (access(strFileName.c_str(), R_OK) == 0 && access(strFileName.c_str(), W_OK) != 0) lpFindData->dwFileAttributes |= FILE_ATTRIBUTE_READONLY; TimeTToFileTime(fileStat.st_ctime, &lpFindData->ftCreationTime); @@ -255,7 +255,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, // with this flag set to work correctly flags |= O_NONBLOCK; - CStdString strResultFile(lpFileName); + std::string strResultFile(lpFileName); fd = open(lpFileName, flags, mode); @@ -265,7 +265,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, { // Failed to open file. maybe due to case sensitivity. // Try opening the same name in lower case. - CStdString igFileName = CSpecialProtocol::TranslatePathConvertCase(lpFileName); + std::string igFileName = CSpecialProtocol::TranslatePathConvertCase(lpFileName); fd = open(igFileName.c_str(), flags, mode); if (fd != -1) { @@ -300,7 +300,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, // if FILE_FLAG_DELETE_ON_CLOSE then "unlink" the file (delete) // the file will be deleted when the last open descriptor is closed. if (dwFlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE) - unlink(strResultFile); + unlink(strResultFile.c_str()); return result; } @@ -329,7 +329,7 @@ BOOL DeleteFile(LPCTSTR lpFileName) } else if (errno == ENOENT) { - CStdString strLower(lpFileName); + std::string strLower(lpFileName); StringUtils::ToLower(strLower); CLog::Log(LOGERROR,"%s - cant delete file <%s>. trying lower case <%s>", __FUNCTION__, lpFileName, strLower.c_str()); if (unlink(strLower.c_str()) == 0) @@ -366,7 +366,7 @@ BOOL MoveFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName) } else if (errno == ENOENT) { - CStdString strLower(lpExistingFileName); + std::string strLower(lpExistingFileName); StringUtils::ToLower(strLower); CLog::Log(LOGERROR,"%s - cant move file <%s>. trying lower case <%s>", __FUNCTION__, lpExistingFileName, strLower.c_str()); if (rename(strLower.c_str(), lpNewFileName) == 0) { @@ -397,13 +397,13 @@ BOOL CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExi return 0; } - CStdString strResultFile(lpExistingFileName); + std::string strResultFile(lpExistingFileName); // Open the files int sf = open(lpExistingFileName, O_RDONLY); if (sf == -1 && errno == ENOENT) // important to check reason for fail. only if its "file does not exist" shall we try lower case. { - CStdString strLower(lpExistingFileName); + std::string strLower(lpExistingFileName); StringUtils::ToLower(strLower); // failed to open file. maybe due to case sensitivity. try opening the same name in lower case. @@ -526,7 +526,7 @@ BOOL CreateDirectory(LPCTSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttri if (errno == ENOENT) { CLog::Log(LOGWARNING,"%s, cant create dir <%s>. trying lower case.", __FUNCTION__, lpPathName); - CStdString strLower(lpPathName); + std::string strLower(lpPathName); StringUtils::ToLower(strLower); if (mkdir(strLower.c_str(), 0755) == 0) @@ -544,7 +544,7 @@ BOOL RemoveDirectory(LPCTSTR lpPathName) if (errno == ENOENT) { CLog::Log(LOGWARNING,"%s, cant remove dir <%s>. trying lower case.", __FUNCTION__, lpPathName); - CStdString strLower(lpPathName); + std::string strLower(lpPathName); StringUtils::ToLower(strLower); if (rmdir(strLower.c_str()) == 0 || errno == ENOENT) diff --git a/xbmc/linux/XHandle.cpp b/xbmc/linux/XHandle.cpp index fc8731b3bd..70ff8cd798 100644 --- a/xbmc/linux/XHandle.cpp +++ b/xbmc/linux/XHandle.cpp @@ -154,7 +154,7 @@ BOOL WINAPI DuplicateHandle( ) { /* only a simple version of this is supported */ - ASSERT(hSourceProcessHandle == GetCurrentProcess() + assert(hSourceProcessHandle == GetCurrentProcess() && hTargetProcessHandle == GetCurrentProcess() && dwOptions == DUPLICATE_SAME_ACCESS); diff --git a/xbmc/linux/XHandle.h b/xbmc/linux/XHandle.h index 9261a2762f..021e47cd7c 100644 --- a/xbmc/linux/XHandle.h +++ b/xbmc/linux/XHandle.h @@ -24,12 +24,13 @@ #ifndef TARGET_WINDOWS #include <list> +#include <string> +#include <vector> #include "PlatformDefs.h" #include "XHandlePublic.h" #include "threads/Condition.h" #include "threads/CriticalSection.h" -#include "utils/StdString.h" struct CXHandle { @@ -56,7 +57,7 @@ public: time_t m_tmCreation; std::vector<std::string> m_FindFileResults; int m_nFindFileIterator; - CStdString m_FindFileDir; + std::string m_FindFileDir; off64_t m_iOffset; bool m_bCDROM; bool m_bEventSet; diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index 99b33c2d91..f4f63aef12 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -23,7 +23,6 @@ #include "filesystem/FavouritesDirectory.h" #include "guilib/GUIWindowManager.h" #include "utils/JobManager.h" -#include "utils/StringUtils.h" #include "utils/TimeUtils.h" #include "utils/XMLUtils.h" #include "utils/StringUtils.h" @@ -302,7 +301,7 @@ void CDirectoryProvider::RegisterListProvider(bool hasLibraryContent) bool CDirectoryProvider::UpdateURL() { - CStdString value(m_url.GetLabel(m_parentID, false)); + std::string value(m_url.GetLabel(m_parentID, false)); if (value == m_currentUrl) return false; diff --git a/xbmc/music/Artist.cpp b/xbmc/music/Artist.cpp index e864fd82ae..ac076248fe 100644 --- a/xbmc/music/Artist.cpp +++ b/xbmc/music/Artist.cpp @@ -119,7 +119,7 @@ bool CArtist::Load(const TiXmlElement *artist, bool append, bool prioritise) // we prefix to handle mixed-mode nfo's with fanart set if (prioritise) { - CStdString temp; + std::string temp; temp << *fanart2; fanart.m_xml = temp+fanart.m_xml; } diff --git a/xbmc/music/Artist.h b/xbmc/music/Artist.h index daa28a079b..b7535b77e0 100644 --- a/xbmc/music/Artist.h +++ b/xbmc/music/Artist.h @@ -25,6 +25,7 @@ #include "utils/ScraperUrl.h" #include "utils/Fanart.h" +#include "utils/StdString.h" class TiXmlNode; class CAlbum; diff --git a/xbmc/music/GUIViewStateMusic.cpp b/xbmc/music/GUIViewStateMusic.cpp index f2038e6fef..51406c7150 100644 --- a/xbmc/music/GUIViewStateMusic.cpp +++ b/xbmc/music/GUIViewStateMusic.cpp @@ -50,12 +50,12 @@ bool CGUIViewStateWindowMusic::AutoPlayNextItem() !CSettings::Get().GetBool("musicplayer.queuebydefault"); } -CStdString CGUIViewStateWindowMusic::GetLockType() +std::string CGUIViewStateWindowMusic::GetLockType() { return "music"; } -CStdString CGUIViewStateWindowMusic::GetExtensions() +std::string CGUIViewStateWindowMusic::GetExtensions() { return g_advancedSettings.m_musicExtensions; } @@ -68,17 +68,17 @@ VECSOURCES& CGUIViewStateWindowMusic::GetSources() CGUIViewStateMusicSearch::CGUIViewStateMusicSearch(const CFileItemList& items) : CGUIViewStateWindowMusic(items) { - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat"); if (strTrackLeft.empty()) strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright"); if (strTrackRight.empty()) strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright"); - CStdString strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; + std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; if (strAlbumLeft.empty()) strAlbumLeft = "%B"; // album - CStdString strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; + std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; if (strAlbumRight.empty()) strAlbumRight = "%A"; // artist @@ -106,17 +106,17 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item CMusicDatabaseDirectory dir; NODE_TYPE NodeType=dir.GetDirectoryChildType(items.GetPath()); - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat"); if (strTrackLeft.empty()) strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright"); if (strTrackRight.empty()) strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright"); - CStdString strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; + std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; if (strAlbumLeft.empty()) strAlbumLeft = "%B"; // album - CStdString strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; + std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; if (strAlbumRight.empty()) strAlbumRight = "%A"; // artist @@ -349,8 +349,8 @@ CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItem if (items.GetContent() == "songs" || items.GetContent() == "mixed") { - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty @@ -365,10 +365,10 @@ CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItem } else if (items.GetContent() == "albums") { - CStdString strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; + std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; if (strAlbumLeft.empty()) strAlbumLeft = "%B"; // album - CStdString strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; + std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; if (strAlbumRight.empty()) strAlbumRight = "%A"; // artist @@ -402,8 +402,8 @@ CGUIViewStateMusicPlaylist::CGUIViewStateMusicPlaylist(const CFileItemList& item if (CSettings::Get().GetBool("filelists.ignorethewhensorting")) sortAttribute = SortAttributeIgnoreArticle; - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight)); AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty @@ -455,8 +455,8 @@ CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& it AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%Y")); AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T", "%Y")); - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty } else @@ -564,8 +564,8 @@ CGUIViewStateWindowMusicSongs::CGUIViewStateWindowMusicSongs(const CFileItemList } else { - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByLabel, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", ""), // Userdefined, Userdefined | FolderName, empty CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone); @@ -597,10 +597,10 @@ VECSOURCES& CGUIViewStateWindowMusicSongs::GetSources() CGUIViewStateWindowMusicPlaylist::CGUIViewStateWindowMusicPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items) { - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.nowplayingtrackformat"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.nowplayingtrackformat"); if (strTrackLeft.empty()) strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.nowplayingtrackformatright"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.nowplayingtrackformatright"); if (strTrackRight.empty()) strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright"); diff --git a/xbmc/music/GUIViewStateMusic.h b/xbmc/music/GUIViewStateMusic.h index 7a8d30e86b..e4f7931331 100644 --- a/xbmc/music/GUIViewStateMusic.h +++ b/xbmc/music/GUIViewStateMusic.h @@ -30,8 +30,8 @@ protected: virtual VECSOURCES& GetSources(); virtual int GetPlaylist(); virtual bool AutoPlayNextItem(); - virtual CStdString GetLockType(); - virtual CStdString GetExtensions(); + virtual std::string GetLockType(); + virtual std::string GetExtensions(); }; class CGUIViewStateMusicSearch : public CGUIViewStateWindowMusic diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index a430ce3ed9..203d6093ba 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -2876,7 +2876,7 @@ bool CMusicDatabase::GetGenresNav(const CStdString& strBaseDir, CFileItemList& i extFilter.order.clear(); } - CStdString strSQLExtra; + std::string strSQLExtra; if (!BuildSQL(strSQLExtra, extFilter, strSQLExtra)) return false; @@ -3177,7 +3177,7 @@ bool CMusicDatabase::GetArtistsByWhere(const CStdString& strBaseDir, const Filte extFilter.order.clear(); } - CStdString strSQLExtra; + std::string strSQLExtra; if (!BuildSQL(strSQLExtra, extFilter, strSQLExtra)) return false; @@ -3336,7 +3336,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const CStdString &baseDir, const Filter &f extFilter.AppendGroup("albumview.idAlbum"); } - CStdString strSQLExtra; + std::string strSQLExtra; if (!BuildSQL(strSQLExtra, extFilter, strSQLExtra)) return false; @@ -3449,7 +3449,7 @@ bool CMusicDatabase::GetSongsByWhere(const CStdString &baseDir, const Filter &fi extFilter.AppendGroup("songview.idSong"); } - CStdString strSQLExtra; + std::string strSQLExtra; if (!BuildSQL(strSQLExtra, extFilter, strSQLExtra)) return false; @@ -4268,7 +4268,7 @@ bool CMusicDatabase::GetCompilationSongs(const CStdString& strBaseDir, CFileItem int CMusicDatabase::GetCompilationAlbumsCount() { - return strtol(GetSingleValue("album", "count(idAlbum)", "bCompilation = 1"), NULL, 10); + return strtol(GetSingleValue("album", "count(idAlbum)", "bCompilation = 1").c_str(), NULL, 10); } bool CMusicDatabase::SetPathHash(const CStdString &path, const CStdString &hash) @@ -5656,7 +5656,7 @@ bool CMusicDatabase::GetFilter(CDbUrl &musicUrl, Filter &filter, SortDescription if (xsp.GetType() == type || (xsp.GetGroup() == type && !xsp.IsGroupMixed())) { - std::set<CStdString> playlists; + std::set<std::string> playlists; filter.AppendWhere(xsp.GetWhereClause(*this, playlists)); if (xsp.GetLimit() > 0) @@ -5679,7 +5679,7 @@ bool CMusicDatabase::GetFilter(CDbUrl &musicUrl, Filter &filter, SortDescription // check if the filter playlist matches the item type if (xspFilter.GetType() == type) { - std::set<CStdString> playlists; + std::set<std::string> playlists; filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists)); } // remove the filter if it doesn't match the item type diff --git a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp index dbba39a866..08264c76fc 100644 --- a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp @@ -358,7 +358,7 @@ void CGUIDialogMusicInfo::OnGetThumb() } // Grab the thumbnail(s) from the web - vector<CStdString> thumbs; + vector<std::string> thumbs; if (m_bArtistInfo) m_artist.thumbURL.GetThumbURLs(thumbs); else diff --git a/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp b/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp index fc4cf67185..7a3d23e9ba 100644 --- a/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp +++ b/xbmc/music/dialogs/GUIDialogVisualisationPresetList.cpp @@ -132,7 +132,7 @@ void CGUIDialogVisualisationPresetList::Update() //clear filelist CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_LIST); OnMessage(msg); - std::vector<CStdString> presets; + std::vector<std::string> presets; if (m_viz->GetPresetList(presets)) { m_currentPreset = m_viz->GetPreset(); diff --git a/xbmc/music/karaoke/karaokelyrics.h b/xbmc/music/karaoke/karaokelyrics.h index ff16cdfe6e..b5eebb8a42 100644 --- a/xbmc/music/karaoke/karaokelyrics.h +++ b/xbmc/music/karaoke/karaokelyrics.h @@ -21,6 +21,8 @@ * */ +#include "utils/StdString.h" + // C++ Interface: karaokelyrics // Abstract interface class for all Karaoke lyrics diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp index a2b930e769..80ea552aa1 100644 --- a/xbmc/network/AirPlayServer.cpp +++ b/xbmc/network/AirPlayServer.cpp @@ -200,7 +200,7 @@ bool CAirPlayServer::StartServer(int port, bool nonlocal) return false; } -bool CAirPlayServer::SetCredentials(bool usePassword, const CStdString& password) +bool CAirPlayServer::SetCredentials(bool usePassword, const std::string& password) { CSingleLock lock(ServerInstanceLock); bool ret = false; @@ -212,7 +212,7 @@ bool CAirPlayServer::SetCredentials(bool usePassword, const CStdString& password return ret; } -bool CAirPlayServer::SetInternalCredentials(bool usePassword, const CStdString& password) +bool CAirPlayServer::SetInternalCredentials(bool usePassword, const std::string& password) { m_usePassword = usePassword; m_password = password; @@ -248,9 +248,9 @@ void CAirPlayServer::AnnounceToClients(int state) std::vector<CTCPClient>::iterator it; for (it = m_connections.begin(); it != m_connections.end(); it++) { - CStdString reverseHeader; - CStdString reverseBody; - CStdString response; + std::string reverseHeader; + std::string reverseBody; + std::string response; int reverseSocket = INVALID_SOCKET; it->ComposeReverseEvent(reverseHeader, reverseBody, state); @@ -347,7 +347,7 @@ void CAirPlayServer::Process() nread = recv(socket, (char*)&buffer, RECEIVEBUFFER, 0); if (nread > 0) { - CStdString sessionId; + std::string sessionId; m_connections[i].PushBuffer(this, buffer, nread, sessionId, m_reverseSockets); } if (nread <= 0) @@ -463,7 +463,7 @@ CAirPlayServer::CTCPClient& CAirPlayServer::CTCPClient::operator=(const CTCPClie } void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *buffer, - int length, CStdString &sessionId, std::map<CStdString, + int length, std::string &sessionId, std::map<std::string, int> &reverseSockets) { HttpParser::status_t status = m_httpParser->addBytes(buffer, length); @@ -471,11 +471,11 @@ void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *bu if (status == HttpParser::Done) { // Parse the request - CStdString responseHeader; - CStdString responseBody; + std::string responseHeader; + std::string responseBody; int status = ProcessRequest(responseHeader, responseBody); sessionId = m_sessionId; - CStdString statusMsg = "OK"; + std::string statusMsg = "OK"; switch(status) { @@ -498,7 +498,7 @@ void CAirPlayServer::CTCPClient::PushBuffer(CAirPlayServer *host, const char *bu } // Prepare the response - CStdString response; + std::string response; 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 @@ -556,8 +556,8 @@ void CAirPlayServer::CTCPClient::Copy(const CTCPClient& client) } -void CAirPlayServer::CTCPClient::ComposeReverseEvent( CStdString& reverseHeader, - CStdString& reverseBody, +void CAirPlayServer::CTCPClient::ComposeReverseEvent( std::string& reverseHeader, + std::string& reverseBody, int state) { @@ -580,10 +580,10 @@ void CAirPlayServer::CTCPClient::ComposeReverseEvent( CStdString& reverseHeader, } } -void CAirPlayServer::CTCPClient::ComposeAuthRequestAnswer(CStdString& responseHeader, CStdString& responseBody) +void CAirPlayServer::CTCPClient::ComposeAuthRequestAnswer(std::string& responseHeader, std::string& responseBody) { int16_t random=rand(); - CStdString randomStr = StringUtils::Format("%i", random); + std::string randomStr = StringUtils::Format("%i", random); m_authNonce=XBMC::XBMC_MD5::GetMD5(randomStr); responseHeader = StringUtils::Format(AUTH_REQUIRED, m_authNonce.c_str()); responseBody.clear(); @@ -591,16 +591,16 @@ void CAirPlayServer::CTCPClient::ComposeAuthRequestAnswer(CStdString& responseHe //as of rfc 2617 -CStdString calcResponse(const CStdString& username, - const CStdString& password, - const CStdString& realm, - const CStdString& method, - const CStdString& digestUri, - const CStdString& nonce) +std::string calcResponse(const std::string& username, + const std::string& password, + const std::string& realm, + const std::string& method, + const std::string& digestUri, + const std::string& nonce) { - CStdString response; - CStdString HA1; - CStdString HA2; + std::string response; + std::string HA1; + std::string HA2; HA1 = XBMC::XBMC_MD5::GetMD5(username + ":" + realm + ":" + password); HA2 = XBMC::XBMC_MD5::GetMD5(method + ":" + digestUri); @@ -613,7 +613,7 @@ CStdString calcResponse(const CStdString& username, //helper function //from a string field1="value1", field2="value2" it parses the value to a field -CStdString getFieldFromString(const CStdString &str, const char* field) +std::string getFieldFromString(const std::string &str, const char* field) { vector<string> tmpAr1 = StringUtils::Split(str, ","); for(vector<string>::const_iterator i = tmpAr1.begin(); i != tmpAr1.end(); ++i) @@ -631,13 +631,13 @@ CStdString getFieldFromString(const CStdString &str, const char* field) return ""; } -bool CAirPlayServer::CTCPClient::checkAuthorization(const CStdString& authStr, - const CStdString& method, - const CStdString& uri) +bool CAirPlayServer::CTCPClient::checkAuthorization(const std::string& authStr, + const std::string& method, + const std::string& uri) { bool authValid = true; - CStdString username; + std::string username; if (authStr.empty()) return false; @@ -679,10 +679,10 @@ bool CAirPlayServer::CTCPClient::checkAuthorization(const CStdString& authStr, //last check response if (authValid) { - CStdString realm = AUTH_REALM; - CStdString ourResponse = calcResponse(username, ServerInstance->m_password, realm, method, uri, m_authNonce); - CStdString theirResponse = getFieldFromString(authStr, "response"); - if (!theirResponse.Equals(ourResponse, false)) + std::string realm = AUTH_REALM; + std::string ourResponse = calcResponse(username, ServerInstance->m_password, realm, method, uri, m_authNonce); + std::string theirResponse = getFieldFromString(authStr, "response"); + if (!StringUtils::EqualsNoCase(theirResponse, ourResponse)) { authValid = false; CLog::Log(LOGDEBUG,"AirAuth: response mismatch - our: %s theirs: %s",ourResponse.c_str(), theirResponse.c_str()); @@ -715,16 +715,16 @@ void CAirPlayServer::restoreVolume() } } -int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader, - CStdString& responseBody) +int CAirPlayServer::CTCPClient::ProcessRequest( std::string& responseHeader, + std::string& responseBody) { - CStdString method = m_httpParser->getMethod(); - CStdString uri = m_httpParser->getUri(); - CStdString queryString = m_httpParser->getQueryString(); - CStdString body = m_httpParser->getBody(); - CStdString contentType = m_httpParser->getValue("content-type"); + std::string method = m_httpParser->getMethod(); + std::string uri = m_httpParser->getUri(); + std::string queryString = m_httpParser->getQueryString(); + std::string body = m_httpParser->getBody(); + std::string contentType = m_httpParser->getValue("content-type"); m_sessionId = m_httpParser->getValue("x-apple-session-id"); - CStdString authorization = m_httpParser->getValue("authorization"); + std::string authorization = m_httpParser->getValue("authorization"); int status = AIRPLAY_STATUS_OK; bool needAuth = false; @@ -814,7 +814,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader, // Content-Location and optionally a Start-Position else if (uri == "/play") { - CStdString location; + std::string location; float position = 0.0; m_lastEvent = EVENT_NONE; @@ -897,7 +897,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader, if (status != AIRPLAY_STATUS_NEED_AUTH) { - CStdString userAgent(CURL::Encode("AppleCoreMedia/1.0.0.8F455 (AppleTV; U; CPU OS 4_3 like Mac OS X; de_de)")); + std::string userAgent(CURL::Encode("AppleCoreMedia/1.0.0.8F455 (AppleTV; U; CPU OS 4_3 like Mac OS X; de_de)")); location += "|User-Agent=" + userAgent; CFileItem fileToPlay(location, false); @@ -978,7 +978,7 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader, else if (m_httpParser->getContentLength() > 0) { XFILE::CFile tmpFile; - CStdString tmpFileName = "special://temp/airplay_photo.jpg"; + std::string tmpFileName = "special://temp/airplay_photo.jpg"; if( m_httpParser->getContentLength() > 3 && m_httpParser->getBody()[1] == 'P' && diff --git a/xbmc/network/AirPlayServer.h b/xbmc/network/AirPlayServer.h index 27c7f40b2d..3668e309d2 100644 --- a/xbmc/network/AirPlayServer.h +++ b/xbmc/network/AirPlayServer.h @@ -30,7 +30,6 @@ #include "threads/Thread.h" #include "threads/CriticalSection.h" #include "utils/HttpParser.h" -#include "utils/StdString.h" #include "interfaces/IAnnouncer.h" class DllLibPlist; @@ -47,7 +46,7 @@ public: static bool StartServer(int port, bool nonlocal); static void StopServer(bool bWait); static bool IsRunning(); - static bool SetCredentials(bool usePassword, const CStdString& password); + static bool SetCredentials(bool usePassword, const std::string& password); static bool IsPlaying(){ return m_isPlaying > 0;} static void backupVolume(); static void restoreVolume(); @@ -59,7 +58,7 @@ protected: private: CAirPlayServer(int port, bool nonlocal); ~CAirPlayServer(); - bool SetInternalCredentials(bool usePassword, const CStdString& password); + bool SetInternalCredentials(bool usePassword, const std::string& password); bool Initialize(); void Deinitialize(); void AnnounceToClients(int state); @@ -74,9 +73,9 @@ private: CTCPClient(const CTCPClient& client); CTCPClient& operator=(const CTCPClient& client); void PushBuffer(CAirPlayServer *host, const char *buffer, - int length, CStdString &sessionId, - std::map<CStdString, int> &reverseSockets); - void ComposeReverseEvent(CStdString& reverseHeader, CStdString& reverseBody, int state); + int length, std::string &sessionId, + std::map<std::string, int> &reverseSockets); + void ComposeReverseEvent(std::string& reverseHeader, std::string& reverseBody, int state); void Disconnect(); @@ -85,31 +84,31 @@ private: socklen_t m_addrlen; CCriticalSection m_critSection; int m_sessionCounter; - CStdString m_sessionId; + std::string m_sessionId; private: - int ProcessRequest( CStdString& responseHeader, - CStdString& response); + int ProcessRequest( std::string& responseHeader, + std::string& response); - void ComposeAuthRequestAnswer(CStdString& responseHeader, CStdString& responseBody); - bool checkAuthorization(const CStdString& authStr, const CStdString& method, const CStdString& uri); + void ComposeAuthRequestAnswer(std::string& responseHeader, std::string& responseBody); + bool checkAuthorization(const std::string& authStr, const std::string& method, const std::string& uri); void Copy(const CTCPClient& client); HttpParser* m_httpParser; DllLibPlist *m_pLibPlist;//the lib bool m_bAuthenticated; int m_lastEvent; - CStdString m_authNonce; + std::string m_authNonce; }; CCriticalSection m_connectionLock; std::vector<CTCPClient> m_connections; - std::map<CStdString, int> m_reverseSockets; + std::map<std::string, int> m_reverseSockets; int m_ServerSocket; int m_port; bool m_nonlocal; bool m_usePassword; - CStdString m_password; + std::string m_password; int m_origVolume; static CCriticalSection ServerInstanceLock; diff --git a/xbmc/network/AirTunesServer.cpp b/xbmc/network/AirTunesServer.cpp index 0843fef99c..1ba413609c 100644 --- a/xbmc/network/AirTunesServer.cpp +++ b/xbmc/network/AirTunesServer.cpp @@ -35,7 +35,6 @@ #ifdef HAS_AIRTUNES #include "utils/log.h" -#include "utils/StdString.h" #include "network/Zeroconf.h" #include "ApplicationMessenger.h" #include "filesystem/PipeFile.h" @@ -64,7 +63,7 @@ using namespace ANNOUNCEMENT; DllLibShairplay *CAirTunesServer::m_pLibShairplay = NULL; CAirTunesServer *CAirTunesServer::ServerInstance = NULL; -CStdString CAirTunesServer::m_macAddress; +std::string CAirTunesServer::m_macAddress; std::string CAirTunesServer::m_metadata[3]; CCriticalSection CAirTunesServer::m_metadataLock; bool CAirTunesServer::m_streamStarted = false; @@ -330,10 +329,10 @@ void shairplay_log(void *cls, int level, const char *msg) CLog::Log(xbmcLevel, "AIRTUNES: %s", msg); } -bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, const CStdString &password/*=""*/) +bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, const std::string &password/*=""*/) { bool success = false; - CStdString pw = password; + std::string pw = password; CNetworkInterface *net = g_application.getNetwork().GetFirstConnectedInterface(); StopServer(true); @@ -343,7 +342,7 @@ bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, con StringUtils::Replace(m_macAddress, ":",""); while (m_macAddress.size() < 12) { - m_macAddress = CStdString("0") + m_macAddress; + m_macAddress = '0' + m_macAddress; } } else @@ -360,7 +359,7 @@ bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, con if (ServerInstance->Initialize(pw)) { success = true; - CStdString appName = StringUtils::Format("%s@%s", + std::string appName = StringUtils::Format("%s@%s", m_macAddress.c_str(), g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME).c_str()); @@ -430,7 +429,7 @@ CAirTunesServer::~CAirTunesServer() CAnnouncementManager::Get().RemoveAnnouncer(this); } -bool CAirTunesServer::Initialize(const CStdString &password) +bool CAirTunesServer::Initialize(const std::string &password) { bool ret = false; diff --git a/xbmc/network/AirTunesServer.h b/xbmc/network/AirTunesServer.h index bd614100c9..e882136f21 100644 --- a/xbmc/network/AirTunesServer.h +++ b/xbmc/network/AirTunesServer.h @@ -35,7 +35,6 @@ #include "threads/Thread.h" #include "threads/CriticalSection.h" #include "utils/HttpParser.h" -#include "utils/StdString.h" #include "filesystem/PipeFile.h" #include "interfaces/IAnnouncer.h" @@ -45,7 +44,7 @@ class CAirTunesServer : public ANNOUNCEMENT::IAnnouncer public: virtual void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); - static bool StartServer(int port, bool nonlocal, bool usePassword, const CStdString &password=""); + static bool StartServer(int port, bool nonlocal, bool usePassword, const std::string &password=""); static void StopServer(bool bWait); static bool IsRunning(); static void SetMetadataFromBuffer(const char *buffer, unsigned int size); @@ -54,7 +53,7 @@ public: private: CAirTunesServer(int port, bool nonlocal); ~CAirTunesServer(); - bool Initialize(const CStdString &password); + bool Initialize(const std::string &password); void Deinitialize(); static void RefreshCoverArt(); static void RefreshMetadata(); @@ -64,7 +63,7 @@ private: raop_t *m_pRaop; XFILE::CPipeFile *m_pPipe; static CAirTunesServer *ServerInstance; - static CStdString m_macAddress; + static std::string m_macAddress; static CCriticalSection m_metadataLock; static std::string m_metadata[3];//0 - album, 1 - title, 2 - artist static bool m_streamStarted; diff --git a/xbmc/network/DNSNameCache.cpp b/xbmc/network/DNSNameCache.cpp index cb459daea1..c5f6397220 100644 --- a/xbmc/network/DNSNameCache.cpp +++ b/xbmc/network/DNSNameCache.cpp @@ -37,7 +37,7 @@ CDNSNameCache::CDNSNameCache(void) CDNSNameCache::~CDNSNameCache(void) {} -bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddress) +bool CDNSNameCache::Lookup(const std::string& strHostName, std::string& strIpAddress) { if (strHostName.empty() && strIpAddress.empty()) return false; @@ -61,8 +61,8 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre char nmb_ip[100]; char line[200]; - CStdString cmd = "nmblookup " + strHostName; - FILE* fp = popen(cmd, "r"); + std::string cmd = "nmblookup " + strHostName; + FILE* fp = popen(cmd.c_str(), "r"); if (fp) { while (fgets(line, sizeof line, fp)) @@ -100,7 +100,7 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre return false; } -bool CDNSNameCache::GetCached(const CStdString& strHostName, CStdString& strIpAddress) +bool CDNSNameCache::GetCached(const std::string& strHostName, std::string& strIpAddress) { CSingleLock lock(m_critical); @@ -119,7 +119,7 @@ bool CDNSNameCache::GetCached(const CStdString& strHostName, CStdString& strIpAd return false; } -void CDNSNameCache::Add(const CStdString &strHostName, const CStdString &strIpAddress) +void CDNSNameCache::Add(const std::string &strHostName, const std::string &strIpAddress) { CDNSName dnsName; diff --git a/xbmc/network/DNSNameCache.h b/xbmc/network/DNSNameCache.h index e50cc821f7..97bb20b4c6 100644 --- a/xbmc/network/DNSNameCache.h +++ b/xbmc/network/DNSNameCache.h @@ -20,9 +20,8 @@ * */ -#include "utils/StdString.h" - #include <vector> +#include <string> class CCriticalSection; @@ -32,16 +31,16 @@ public: class CDNSName { public: - CStdString m_strHostName; - CStdString m_strIpAddress; + std::string m_strHostName; + std::string m_strIpAddress; }; CDNSNameCache(void); virtual ~CDNSNameCache(void); - static bool Lookup(const CStdString& strHostName, CStdString& strIpAddress); - static void Add(const CStdString& strHostName, const CStdString& strIpAddress); + static bool Lookup(const std::string& strHostName, std::string& strIpAddress); + static void Add(const std::string& strHostName, const std::string& strIpAddress); protected: - static bool GetCached(const CStdString& strHostName, CStdString& strIpAddress); + static bool GetCached(const std::string& strHostName, std::string& strIpAddress); static CCriticalSection m_critical; std::vector<CDNSName> m_vecDNSNames; }; diff --git a/xbmc/network/GUIDialogAccessPoints.cpp b/xbmc/network/GUIDialogAccessPoints.cpp index 241c71936a..9edc8b8c6b 100644 --- a/xbmc/network/GUIDialogAccessPoints.cpp +++ b/xbmc/network/GUIDialogAccessPoints.cpp @@ -84,7 +84,7 @@ void CGUIDialogAccessPoints::OnInitWindow() m_accessPoints->Clear(); - CStdString ifaceName(m_interfaceName); + std::string ifaceName(m_interfaceName); CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName); m_aps = iface->GetAccessPoints(); @@ -112,12 +112,12 @@ void CGUIDialogAccessPoints::OnInitWindow() OnMessage(msg); } -void CGUIDialogAccessPoints::SetInterfaceName(CStdString interfaceName) +void CGUIDialogAccessPoints::SetInterfaceName(std::string interfaceName) { m_interfaceName = interfaceName; } -CStdString CGUIDialogAccessPoints::GetSelectedAccessPointEssId() +std::string CGUIDialogAccessPoints::GetSelectedAccessPointEssId() { return m_selectedAPEssId; } diff --git a/xbmc/network/GUIDialogAccessPoints.h b/xbmc/network/GUIDialogAccessPoints.h index 7f884cb948..767cc452d2 100644 --- a/xbmc/network/GUIDialogAccessPoints.h +++ b/xbmc/network/GUIDialogAccessPoints.h @@ -36,15 +36,15 @@ public: virtual ~CGUIDialogAccessPoints(void); virtual void OnInitWindow(); virtual bool OnAction(const CAction &action); - void SetInterfaceName(CStdString interfaceName); - CStdString GetSelectedAccessPointEssId(); + void SetInterfaceName(std::string interfaceName); + std::string GetSelectedAccessPointEssId(); EncMode GetSelectedAccessPointEncMode(); bool WasItemSelected(); private: std::vector<NetworkAccessPoint> m_aps; - CStdString m_interfaceName; - CStdString m_selectedAPEssId; + std::string m_interfaceName; + std::string m_selectedAPEssId; EncMode m_selectedAPEncMode; bool m_wasItemSelected; CFileItemList *m_accessPoints; diff --git a/xbmc/network/GUIDialogNetworkSetup.cpp b/xbmc/network/GUIDialogNetworkSetup.cpp index 92a8de702d..7505850e09 100644 --- a/xbmc/network/GUIDialogNetworkSetup.cpp +++ b/xbmc/network/GUIDialogNetworkSetup.cpp @@ -95,7 +95,7 @@ bool CGUIDialogNetworkSetup::OnMessage(CGUIMessage& message) // \brief Show CGUIDialogNetworkSetup dialog and prompt for a new network address. // \return True if the network address is valid, false otherwise. -bool CGUIDialogNetworkSetup::ShowAndGetNetworkAddress(CStdString &path) +bool CGUIDialogNetworkSetup::ShowAndGetNetworkAddress(std::string &path) { CGUIDialogNetworkSetup *dialog = (CGUIDialogNetworkSetup *)g_windowManager.GetWindow(WINDOW_DIALOG_NETWORK_SETUP); if (!dialog) return false; @@ -159,11 +159,11 @@ void CGUIDialogNetworkSetup::OnServerBrowse() { // open a filebrowser dialog with the current address VECSOURCES shares; - CStdString path = ConstructPath(); + std::string path = ConstructPath(); // get the share as the base path CMediaSource share; - CStdString basePath = path; - CStdString tempPath; + std::string basePath = path; + std::string tempPath; while (URIUtils::GetParentPath(basePath, tempPath)) basePath = tempPath; share.strPath = basePath; @@ -315,7 +315,7 @@ void CGUIDialogNetworkSetup::UpdateButtons() m_protocol == NET_PROTOCOL_AFP)); } -CStdString CGUIDialogNetworkSetup::ConstructPath() const +std::string CGUIDialogNetworkSetup::ConstructPath() const { CURL url; if (m_protocol == NET_PROTOCOL_SMB) @@ -374,48 +374,47 @@ CStdString CGUIDialogNetworkSetup::ConstructPath() const (m_protocol == NET_PROTOCOL_NFS)) && !m_port.empty() && atoi(m_port.c_str()) > 0) { - url.SetPort(atoi(m_port)); + url.SetPort(atoi(m_port.c_str())); } if (!m_path.empty()) url.SetFileName(m_path); return url.Get(); } -void CGUIDialogNetworkSetup::SetPath(const CStdString &path) +void CGUIDialogNetworkSetup::SetPath(const std::string &path) { CURL url(path); - const CStdString &protocol = url.GetProtocol(); - if (protocol == "smb") + if (url.IsProtocol("smb")) m_protocol = NET_PROTOCOL_SMB; - else if (protocol == "ftp") + else if (url.IsProtocol("ftp")) m_protocol = NET_PROTOCOL_FTP; - else if (protocol == "http") + else if (url.IsProtocol("http")) m_protocol = NET_PROTOCOL_HTTP; - else if (protocol == "https") + else if (url.IsProtocol("https")) m_protocol = NET_PROTOCOL_HTTPS; - else if (protocol == "dav") + else if (url.IsProtocol("dav")) m_protocol = NET_PROTOCOL_DAV; - else if (protocol == "davs") + else if (url.IsProtocol("davs")) m_protocol = NET_PROTOCOL_DAVS; - else if (protocol == "daap") + else if (url.IsProtocol("daap")) m_protocol = NET_PROTOCOL_DAAP; - else if (protocol == "upnp") + else if (url.IsProtocol("upnp")) m_protocol = NET_PROTOCOL_UPNP; - else if (protocol == "tuxbox") + else if (url.IsProtocol("tuxbox")) m_protocol = NET_PROTOCOL_TUXBOX; - else if (protocol == "htsp") + else if (url.IsProtocol("htsp")) m_protocol = NET_PROTOCOL_HTSP; - else if (protocol == "vtp") + else if (url.IsProtocol("vtp")) m_protocol = NET_PROTOCOL_VTP; - else if (protocol == "myth") + else if (url.IsProtocol("myth")) m_protocol = NET_PROTOCOL_MYTH; - else if (protocol == "rss") + else if (url.IsProtocol("rss")) m_protocol = NET_PROTOCOL_RSS; - else if (protocol == "nfs") + else if (url.IsProtocol("nfs")) m_protocol = NET_PROTOCOL_NFS; - else if (protocol == "sftp" || protocol == "ssh") + else if (url.IsProtocol("sftp") || url.IsProtocol("ssh")) m_protocol = NET_PROTOCOL_SFTP; - else if (protocol == "afp") + else if (url.IsProtocol("afp")) m_protocol = NET_PROTOCOL_AFP; else m_protocol = NET_PROTOCOL_SMB; // default to smb diff --git a/xbmc/network/GUIDialogNetworkSetup.h b/xbmc/network/GUIDialogNetworkSetup.h index d0d71cfb00..d5276f4735 100644 --- a/xbmc/network/GUIDialogNetworkSetup.h +++ b/xbmc/network/GUIDialogNetworkSetup.h @@ -50,10 +50,10 @@ public: virtual void OnInitWindow(); virtual void OnDeinitWindow(int nextWindowID); - static bool ShowAndGetNetworkAddress(CStdString &path); + static bool ShowAndGetNetworkAddress(std::string &path); - CStdString ConstructPath() const; - void SetPath(const CStdString &path); + std::string ConstructPath() const; + void SetPath(const std::string &path); bool IsConfirmed() const { return m_confirmed; }; protected: @@ -64,11 +64,11 @@ protected: void UpdateButtons(); NET_PROTOCOL m_protocol; - CStdString m_server; - CStdString m_path; - CStdString m_username; - CStdString m_password; - CStdString m_port; + std::string m_server; + std::string m_path; + std::string m_username; + std::string m_password; + std::string m_port; bool m_confirmed; }; diff --git a/xbmc/network/Network.cpp b/xbmc/network/Network.cpp index 0d98f9f30f..d0c80c0f5e 100644 --- a/xbmc/network/Network.cpp +++ b/xbmc/network/Network.cpp @@ -31,6 +31,7 @@ #include "win32/WIN32Util.h" #include "utils/CharsetConverter.h" #endif +#include "utils/StringUtils.h" /* slightly modified in_ether taken from the etherboot project (http://sourceforge.net/projects/etherboot) */ bool in_ether (const char *bufp, unsigned char *addr) @@ -158,11 +159,11 @@ int CNetwork::ParseHex(char *str, unsigned char *addr) return len; } -CStdString CNetwork::GetHostName(void) +std::string CNetwork::GetHostName(void) { char hostName[128]; if (gethostname(hostName, sizeof(hostName))) - return CStdString("unknown"); + return "unknown"; std::string hostStr; #ifdef TARGET_WINDOWS @@ -199,8 +200,8 @@ bool CNetwork::HasInterfaceForIP(unsigned long address) CNetworkInterface* iface = *iter; if (iface && iface->IsConnected()) { - subnet = ntohl(inet_addr(iface->GetCurrentNetmask())); - local = ntohl(inet_addr(iface->GetCurrentIPAddress())); + subnet = ntohl(inet_addr(iface->GetCurrentNetmask().c_str())); + local = ntohl(inet_addr(iface->GetCurrentIPAddress().c_str())); if( (address & subnet) == (local & subnet) ) return true; } @@ -228,14 +229,14 @@ bool CNetwork::IsConnected() return GetFirstConnectedInterface() != NULL; } -CNetworkInterface* CNetwork::GetInterfaceByName(CStdString& name) +CNetworkInterface* CNetwork::GetInterfaceByName(const std::string& name) { std::vector<CNetworkInterface*>& ifaces = GetInterfaceList(); std::vector<CNetworkInterface*>::const_iterator iter = ifaces.begin(); while (iter != ifaces.end()) { CNetworkInterface* iface = *iter; - if (iface && iface->GetName().Equals(name)) + if (iface && iface->GetName() == name) return iface; ++iter; } @@ -424,9 +425,9 @@ bool CNetwork::PingHost(unsigned long ipaddr, unsigned short port, unsigned int if (err_msg && *err_msg) { #ifdef TARGET_WINDOWS - CStdString sock_err = CWIN32Util::WUSysMsg(WSAGetLastError()); + std::string sock_err = CWIN32Util::WUSysMsg(WSAGetLastError()); #else - CStdString sock_err = strerror(errno); + std::string sock_err = strerror(errno); #endif CLog::Log(LOGERROR, "%s(%s:%d) - %s (%s)", __FUNCTION__, inet_ntoa(addr.sin_addr), port, err_msg, sock_err.c_str()); @@ -458,9 +459,9 @@ int CreateTCPServerSocket(const int port, const bool bindLocal, const int backlo if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&no, sizeof(no)) < 0) { #ifdef _MSC_VER - CStdString sock_err = CWIN32Util::WUSysMsg(WSAGetLastError()); + std::string sock_err = CWIN32Util::WUSysMsg(WSAGetLastError()); #else - CStdString sock_err = strerror(errno); + std::string sock_err = strerror(errno); #endif CLog::Log(LOGWARNING, "%s Server: Only IPv6 supported (%s)", callerName, sock_err.c_str()); } diff --git a/xbmc/network/Network.h b/xbmc/network/Network.h index 84b1e54900..7d0629588c 100644 --- a/xbmc/network/Network.h +++ b/xbmc/network/Network.h @@ -19,12 +19,12 @@ * */ +#include <string> #include <vector> #include "system.h" #include "settings/lib/ISettingCallback.h" -#include "utils/StdString.h" enum EncMode { ENC_NONE = 0, ENC_WEP = 1, ENC_WPA = 2, ENC_WPA2 = 3 }; enum NetworkAssignment { NETWORK_DASH = 0, NETWORK_DHCP = 1, NETWORK_STATIC = 2, NETWORK_DISABLED = 3 }; @@ -32,7 +32,7 @@ enum NetworkAssignment { NETWORK_DASH = 0, NETWORK_DHCP = 1, NETWORK_STATIC = 2, class NetworkAccessPoint { public: - NetworkAccessPoint(const CStdString &essId, const CStdString &macAddress, int signalStrength, EncMode encryption, int channel = 0) + NetworkAccessPoint(const std::string &essId, const std::string &macAddress, int signalStrength, EncMode encryption, int channel = 0) { m_essId = essId; m_macAddress = macAddress; @@ -41,8 +41,8 @@ public: m_channel = channel; } - const CStdString &getEssId() const { return m_essId; } - const CStdString &getMacAddress() const { return m_macAddress; } + const std::string &getEssId() const { return m_essId; } + const std::string &getMacAddress() const { return m_macAddress; } int getSignalStrength() const { return m_dBm; } EncMode getEncryptionMode() const { return m_encryptionMode; } int getChannel() const { return m_channel; } @@ -62,8 +62,8 @@ public: static int FreqToChannel(float frequency); private: - CStdString m_essId; - CStdString m_macAddress; + std::string m_essId; + std::string m_macAddress; int m_dBm; EncMode m_encryptionMode; int m_channel; @@ -74,27 +74,27 @@ class CNetworkInterface public: virtual ~CNetworkInterface() {}; - virtual CStdString& GetName(void) = 0; + virtual std::string& GetName(void) = 0; virtual bool IsEnabled(void) = 0; virtual bool IsConnected(void) = 0; virtual bool IsWireless(void) = 0; - virtual CStdString GetMacAddress(void) = 0; + virtual std::string GetMacAddress(void) = 0; virtual void GetMacAddressRaw(char rawMac[6]) = 0; - virtual bool GetHostMacAddress(unsigned long host, CStdString& mac) = 0; + virtual bool GetHostMacAddress(unsigned long host, std::string& mac) = 0; - virtual CStdString GetCurrentIPAddress() = 0; - virtual CStdString GetCurrentNetmask() = 0; - virtual CStdString GetCurrentDefaultGateway(void) = 0; - virtual CStdString GetCurrentWirelessEssId(void) = 0; + virtual std::string GetCurrentIPAddress() = 0; + virtual std::string GetCurrentNetmask() = 0; + virtual std::string GetCurrentDefaultGateway(void) = 0; + virtual std::string GetCurrentWirelessEssId(void) = 0; // Returns the list of access points in the area virtual std::vector<NetworkAccessPoint> GetAccessPoints(void) = 0; - virtual void GetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) = 0; - virtual void SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) = 0; + virtual void GetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) = 0; + virtual void SetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) = 0; }; class CNetwork @@ -110,11 +110,11 @@ public: virtual ~CNetwork(); // Return our hostname - virtual CStdString GetHostName(void); + virtual std::string GetHostName(void); // Return the list of interfaces virtual std::vector<CNetworkInterface*>& GetInterfaceList(void) = 0; - CNetworkInterface* GetInterfaceByName(CStdString& name); + CNetworkInterface* GetInterfaceByName(const std::string& name); // Return the first interface which is active virtual CNetworkInterface* GetFirstConnectedInterface(void); @@ -136,8 +136,8 @@ public: virtual bool PingHost(unsigned long host, unsigned int timeout_ms = 2000) = 0; // Get/set the nameserver(s) - virtual std::vector<CStdString> GetNameServers(void) = 0; - virtual void SetNameServers(std::vector<CStdString> nameServers) = 0; + virtual std::vector<std::string> GetNameServers(void) = 0; + virtual void SetNameServers(const std::vector<std::string>& nameServers) = 0; // callback from application controlled thread to handle any setup void NetworkMessage(EMESSAGE message, int param); diff --git a/xbmc/network/UdpClient.cpp b/xbmc/network/UdpClient.cpp index 76cce690d5..dd2a89959d 100644 --- a/xbmc/network/UdpClient.cpp +++ b/xbmc/network/UdpClient.cpp @@ -88,7 +88,7 @@ void CUdpClient::OnStartup() SetPriority( GetMinPriority() ); } -bool CUdpClient::Broadcast(int aPort, CStdString& aMessage) +bool CUdpClient::Broadcast(int aPort, const std::string& aMessage) { CSingleLock lock(critical_section); @@ -105,14 +105,14 @@ bool CUdpClient::Broadcast(int aPort, CStdString& aMessage) } -bool CUdpClient::Send(CStdString aIpAddress, int aPort, CStdString& aMessage) +bool CUdpClient::Send(const std::string& aIpAddress, int aPort, const std::string& aMessage) { CSingleLock lock(critical_section); SOCKADDR_IN addr; addr.sin_family = AF_INET; addr.sin_port = htons(aPort); - addr.sin_addr.s_addr = inet_addr(aIpAddress); + addr.sin_addr.s_addr = inet_addr(aIpAddress.c_str()); memset(&addr.sin_zero, 0, sizeof(addr.sin_zero)); UdpCommand transmit = {addr, aMessage, NULL, 0}; @@ -121,7 +121,7 @@ bool CUdpClient::Send(CStdString aIpAddress, int aPort, CStdString& aMessage) return true; } -bool CUdpClient::Send(SOCKADDR_IN aAddress, CStdString& aMessage) +bool CUdpClient::Send(SOCKADDR_IN aAddress, const std::string& aMessage) { CSingleLock lock(critical_section); @@ -189,7 +189,7 @@ void CUdpClient::Process() messageLength = ret; messageBuffer[messageLength] = '\0'; - CStdString message = messageBuffer; + std::string message = messageBuffer; CLog::Log(UDPCLIENT_DEBUG_LEVEL, "UDPCLIENT RX: %u\t\t<- '%s'", XbmcThreads::SystemClockMillis(), message.c_str() ); @@ -260,7 +260,7 @@ bool CUdpClient::DispatchNextCommand() do { - ret = sendto(client_socket, command.message, command.message.size(), 0, (struct sockaddr *) & command.address, sizeof(command.address)); + ret = sendto(client_socket, command.message.c_str(), command.message.size(), 0, (struct sockaddr *) & command.address, sizeof(command.address)); } while (ret == -1 && !m_bStop); } diff --git a/xbmc/network/UdpClient.h b/xbmc/network/UdpClient.h index c4d886958b..576849be4b 100644 --- a/xbmc/network/UdpClient.h +++ b/xbmc/network/UdpClient.h @@ -23,7 +23,7 @@ * */ -#include "utils/StdString.h" +#include <string> #include "threads/Thread.h" #include "threads/CriticalSection.h" #include <sys/socket.h> @@ -44,19 +44,19 @@ protected: void OnStartup(); void Process(); - bool Broadcast(int aPort, CStdString& aMessage); - bool Send(CStdString aIpAddress, int aPort, CStdString& aMessage); - bool Send(SOCKADDR_IN aAddress, CStdString& aMessage); + bool Broadcast(int aPort, const std::string& aMessage); + bool Send(const std::string& aIpAddress, int aPort, const std::string& aMessage); + bool Send(SOCKADDR_IN aAddress, const std::string& aMessage); bool Send(SOCKADDR_IN aAddress, LPBYTE pMessage, DWORD dwSize); - virtual void OnMessage(SOCKADDR_IN& aRemoteAddress, CStdString& aMessage, LPBYTE pMessage, DWORD dwMessageLength){}; + virtual void OnMessage(SOCKADDR_IN& aRemoteAddress, const std::string& aMessage, LPBYTE pMessage, DWORD dwMessageLength){}; protected: struct UdpCommand { SOCKADDR_IN address; - CStdString message; + std::string message; LPBYTE binary; DWORD binarySize; }; diff --git a/xbmc/network/WakeOnAccess.cpp b/xbmc/network/WakeOnAccess.cpp index 297aef04d5..eada73623a 100644 --- a/xbmc/network/WakeOnAccess.cpp +++ b/xbmc/network/WakeOnAccess.cpp @@ -60,9 +60,9 @@ static int GetTotalSeconds(const CDateTimeSpan& ts) return ts.GetSeconds() + minutes * 60; } -static unsigned long HostToIP(const CStdString& host) +static unsigned long HostToIP(const std::string& host) { - CStdString ip; + std::string ip; CDNSNameCache::Lookup(host, ip); return inet_addr(ip.c_str()); } @@ -85,16 +85,16 @@ CWakeOnAccess::WakeUpEntry::WakeUpEntry (bool isAwake) class CMACDiscoveryJob : public CJob { public: - CMACDiscoveryJob(const CStdString& host) : m_host(host) {} + CMACDiscoveryJob(const std::string& host) : m_host(host) {} virtual bool DoWork(); - const CStdString& GetMAC() const { return m_macAddres; } - const CStdString& GetHost() const { return m_host; } + const std::string& GetMAC() const { return m_macAddres; } + const std::string& GetHost() const { return m_host; } private: - CStdString m_macAddres; - CStdString m_host; + std::string m_macAddres; + std::string m_host; }; bool CMACDiscoveryJob::DoWork() @@ -160,7 +160,7 @@ int NestDetect::m_nest = 0; class ProgressDialogHelper { public: - ProgressDialogHelper (const CStdString& heading) : m_dialog(0) + ProgressDialogHelper (const std::string& heading) : m_dialog(0) { if (g_application.IsCurrentThread()) m_dialog = (CGUIDialogProgress*) g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); @@ -175,7 +175,7 @@ public: int nest_level = NestDetect::Level(); if (nest_level > 1) { - CStdString nest = StringUtils::Format("Nesting:%d", nest_level); + std::string nest = StringUtils::Format("Nesting:%d", nest_level); m_dialog->SetLine(2, nest); } } @@ -190,7 +190,7 @@ public: enum wait_result { TimedOut, Canceled, Success }; - wait_result ShowAndWait (const WaitCondition& waitObj, unsigned timeOutSec, const CStdString& line1) + wait_result ShowAndWait (const WaitCondition& waitObj, unsigned timeOutSec, const std::string& line1) { unsigned timeOutMs = timeOutSec * 1000; @@ -237,7 +237,7 @@ private: class NetworkStartWaiter : public WaitCondition { public: - NetworkStartWaiter (unsigned settle_time_ms, const CStdString& host) : m_settle_time_ms (settle_time_ms), m_host(host) + NetworkStartWaiter (unsigned settle_time_ms, const std::string& host) : m_settle_time_ms (settle_time_ms), m_host(host) { } virtual bool SuccessWaiting () const @@ -253,7 +253,7 @@ public: private: mutable XbmcThreads::EndTime m_end; unsigned m_settle_time_ms; - const CStdString m_host; + const std::string m_host; }; class PingResponseWaiter : public WaitCondition, private IJobCallback @@ -331,14 +331,14 @@ CWakeOnAccess &CWakeOnAccess::Get() bool CWakeOnAccess::WakeUpHost(const CURL& url) { - CStdString hostName = url.GetHostName(); + std::string hostName = url.GetHostName(); if (!hostName.empty()) return WakeUpHost (hostName, url.Get()); return true; } -bool CWakeOnAccess::WakeUpHost (const CStdString& hostName, const string& customMessage) +bool CWakeOnAccess::WakeUpHost (const std::string& hostName, const string& customMessage) { if (!IsEnabled()) return true; // bail if feature is turned off @@ -370,7 +370,7 @@ bool CWakeOnAccess::WakeUpHost (const CStdString& hostName, const string& custom bool CWakeOnAccess::WakeUpHost(const WakeUpEntry& server) { - CStdString heading = StringUtils::Format(LOCALIZED(13027).c_str(), server.host.c_str()); + std::string heading = StringUtils::Format(LOCALIZED(13027).c_str(), server.host.c_str()); ProgressDialogHelper dlg (heading); @@ -431,7 +431,7 @@ bool CWakeOnAccess::WakeUpHost(const WakeUpEntry& server) return true; } -bool CWakeOnAccess::FindOrTouchHostEntry (const CStdString& hostName, WakeUpEntry& result) +bool CWakeOnAccess::FindOrTouchHostEntry (const std::string& hostName, WakeUpEntry& result) { CSingleLock lock (m_entrylist_protect); @@ -441,7 +441,7 @@ bool CWakeOnAccess::FindOrTouchHostEntry (const CStdString& hostName, WakeUpEntr { WakeUpEntry& server = *i; - if (hostName.Equals(server.host.c_str())) + if (StringUtils::EqualsNoCase(hostName, server.host)) { CDateTime now = CDateTime::GetCurrentDateTime(); @@ -462,7 +462,7 @@ bool CWakeOnAccess::FindOrTouchHostEntry (const CStdString& hostName, WakeUpEntr return need_wakeup; } -void CWakeOnAccess::TouchHostEntry (const CStdString& hostName) +void CWakeOnAccess::TouchHostEntry (const std::string& hostName) { CSingleLock lock (m_entrylist_protect); @@ -470,7 +470,7 @@ void CWakeOnAccess::TouchHostEntry (const CStdString& hostName) { WakeUpEntry& server = *i; - if (hostName.Equals(server.host.c_str())) + if (StringUtils::EqualsNoCase(hostName, server.host)) { server.nextWake = CDateTime::GetCurrentDateTime() + server.timeout; return; @@ -478,10 +478,10 @@ void CWakeOnAccess::TouchHostEntry (const CStdString& hostName) } } -static void AddHost (const CStdString& host, vector<string>& hosts) +static void AddHost (const std::string& host, vector<string>& hosts) { for (vector<string>::const_iterator it = hosts.begin(); it != hosts.end(); ++it) - if (host.Equals((*it).c_str())) + if (StringUtils::EqualsNoCase(host, *it)) return; // allready there .. if (!host.empty()) @@ -494,7 +494,7 @@ static void AddHostFromDatabase(const DatabaseSettings& setting, vector<string>& AddHost(setting.host, hosts); } -void CWakeOnAccess::QueueMACDiscoveryForHost(const CStdString& host) +void CWakeOnAccess::QueueMACDiscoveryForHost(const std::string& host) { if (IsEnabled()) { @@ -558,22 +558,22 @@ void CWakeOnAccess::QueueMACDiscoveryForAllRemotes() QueueMACDiscoveryForHost(*it); } -void CWakeOnAccess::SaveMACDiscoveryResult(const CStdString& host, const CStdString& mac) +void CWakeOnAccess::SaveMACDiscoveryResult(const std::string& host, const std::string& mac) { CLog::Log(LOGNOTICE, "%s - Mac discovered for host '%s' -> '%s'", __FUNCTION__, host.c_str(), mac.c_str()); - CStdString heading = LOCALIZED(13033); + std::string heading = LOCALIZED(13033); for (EntriesVector::iterator i = m_entries.begin(); i != m_entries.end(); ++i) { - if (host.Equals(i->host.c_str())) + if (StringUtils::EqualsNoCase(host, i->host)) { CLog::Log(LOGDEBUG, "%s - Update existing entry for host '%s'", __FUNCTION__, host.c_str()); - if (!mac.Equals(i->mac.c_str())) + if (!StringUtils::EqualsNoCase(mac, i->mac)) { if (IsEnabled()) // show notification only if we have general feature enabled { - CStdString message = StringUtils::Format(LOCALIZED(13034).c_str(), host.c_str()); + std::string message = StringUtils::Format(LOCALIZED(13034).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000); } @@ -594,7 +594,7 @@ void CWakeOnAccess::SaveMACDiscoveryResult(const CStdString& host, const CStdStr 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 = StringUtils::Format(LOCALIZED(13035).c_str(), host.c_str()); + std::string message = StringUtils::Format(LOCALIZED(13035).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, heading, message, 4000, true, 3000); } @@ -605,8 +605,8 @@ void CWakeOnAccess::OnJobComplete(unsigned int jobID, bool success, CJob *job) { CMACDiscoveryJob* discoverJob = (CMACDiscoveryJob*)job; - const CStdString& host = discoverJob->GetHost(); - const CStdString& mac = discoverJob->GetMAC(); + const std::string& host = discoverJob->GetHost(); + const std::string& mac = discoverJob->GetMAC(); if (success) { @@ -620,14 +620,14 @@ void CWakeOnAccess::OnJobComplete(unsigned int jobID, bool success, CJob *job) if (IsEnabled()) { - CStdString heading = LOCALIZED(13033); - CStdString message = StringUtils::Format(LOCALIZED(13036).c_str(), host.c_str()); + std::string heading = LOCALIZED(13033); + std::string message = StringUtils::Format(LOCALIZED(13036).c_str(), host.c_str()); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, heading, message, 4000, true, 3000); } } } -CStdString CWakeOnAccess::GetSettingFile() +std::string CWakeOnAccess::GetSettingFile() { return CSpecialProtocol::TranslatePath("special://masterprofile/wakeonlan.xml"); } @@ -698,7 +698,7 @@ void CWakeOnAccess::LoadFromXML() { WakeUpEntry entry; - CStdString strtmp; + std::string strtmp; if (XMLUtils::GetString(pWakeUp, "host", strtmp)) entry.host = strtmp; diff --git a/xbmc/network/WakeOnAccess.h b/xbmc/network/WakeOnAccess.h index fc42f48b19..5885f698cf 100644 --- a/xbmc/network/WakeOnAccess.h +++ b/xbmc/network/WakeOnAccess.h @@ -21,8 +21,8 @@ #include "URL.h" #include "XBDateTime.h" #include "utils/Job.h" -#include "utils/StdString.h" #include "settings/lib/ISettingsHandler.h" +#include <string> class CWakeOnAccess : private IJobCallback, public ISettingsHandler { @@ -30,7 +30,7 @@ public: static CWakeOnAccess &Get(); bool WakeUpHost (const CURL& fileUrl); - bool WakeUpHost (const CStdString& hostName, const std::string& customMessage); + bool WakeUpHost (const std::string& hostName, const std::string& customMessage); void QueueMACDiscoveryForAllRemotes(); @@ -58,21 +58,21 @@ public: private: CWakeOnAccess(); - CStdString GetSettingFile(); + std::string GetSettingFile(); void LoadFromXML(); void SaveToXML(); void SetEnabled(bool enabled); bool IsEnabled() const { return m_enabled; } - void QueueMACDiscoveryForHost(const CStdString& host); - void SaveMACDiscoveryResult(const CStdString& host, const CStdString& mac); + void QueueMACDiscoveryForHost(const std::string& host); + void SaveMACDiscoveryResult(const std::string& host, const std::string& mac); typedef std::vector<WakeUpEntry> EntriesVector; EntriesVector m_entries; CCriticalSection m_entrylist_protect; - bool FindOrTouchHostEntry (const CStdString& hostName, WakeUpEntry& server); - void TouchHostEntry (const CStdString& hostName); + bool FindOrTouchHostEntry (const std::string& hostName, WakeUpEntry& server); + void TouchHostEntry (const std::string& hostName); unsigned int m_netinit_sec, m_netsettle_ms; //time to wait for network connection diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp index 6d9b5042aa..56adc2f0cc 100644 --- a/xbmc/network/WebServer.cpp +++ b/xbmc/network/WebServer.cpp @@ -408,7 +408,7 @@ int CWebServer::CreateFileDownloadResponse(struct MHD_Connection *connection, co lastModified.Reset(); // get the MIME type for the Content-Type header - CStdString ext = URIUtils::GetExtension(strURL); + std::string ext = URIUtils::GetExtension(strURL); StringUtils::ToLower(ext); string mimeType = CreateMimeTypeFromExtension(ext.c_str()); @@ -543,7 +543,7 @@ int CWebServer::CreateFileDownloadResponse(struct MHD_Connection *connection, co { getData = false; - CStdString contentLength = StringUtils::Format("%" PRId64, fileLength); + std::string contentLength = StringUtils::Format("%" PRId64, fileLength); response = MHD_create_response_from_data(0, NULL, MHD_NO, MHD_NO); if (response == NULL) @@ -815,7 +815,7 @@ bool CWebServer::IsStarted() void CWebServer::SetCredentials(const string &username, const string &password) { CSingleLock lock (m_critSection); - CStdString str = username + ":" + password; + std::string str = username + ':' + password; Base64::Encode(str.c_str(), m_Credentials64Encoded); m_needcredentials = !password.empty(); @@ -827,7 +827,7 @@ bool CWebServer::PrepareDownload(const char *path, CVariant &details, std::strin { protocol = "http"; string url; - CStdString strPath = path; + std::string strPath = path; if (StringUtils::StartsWith(strPath, "image://") || (StringUtils::StartsWith(strPath, "special://") && StringUtils::EndsWith(strPath, ".tbn"))) url = "image/"; diff --git a/xbmc/network/ZeroconfBrowser.cpp b/xbmc/network/ZeroconfBrowser.cpp index 04a75fb435..2f37d01c55 100644 --- a/xbmc/network/ZeroconfBrowser.cpp +++ b/xbmc/network/ZeroconfBrowser.cpp @@ -40,8 +40,8 @@ //should be optimized away class CZeroconfBrowserDummy : public CZeroconfBrowser { - virtual bool doAddServiceType(const CStdString&){return false;} - virtual bool doRemoveServiceType(const CStdString&){return false;} + virtual bool doAddServiceType(const std::string&){return false;} + virtual bool doRemoveServiceType(const std::string&){return false;} virtual std::vector<ZeroconfService> doGetFoundServices(){return std::vector<ZeroconfService>();} virtual bool doResolveService(ZeroconfService&, double){return false;} }; @@ -93,7 +93,7 @@ void CZeroconfBrowser::Stop() m_started = false; } -bool CZeroconfBrowser::AddServiceType(const CStdString& fcr_service_type /*const CStdString& domain*/ ) +bool CZeroconfBrowser::AddServiceType(const std::string& fcr_service_type /*const std::string& domain*/ ) { CSingleLock lock(*mp_crit_sec); std::pair<tServices::iterator, bool> ret = m_services.insert(fcr_service_type); @@ -108,7 +108,7 @@ bool CZeroconfBrowser::AddServiceType(const CStdString& fcr_service_type /*const return true; } -bool CZeroconfBrowser::RemoveServiceType(const CStdString& fcr_service_type) +bool CZeroconfBrowser::RemoveServiceType(const std::string& fcr_service_type) { CSingleLock lock(*mp_crit_sec); tServices::iterator ret = m_services.find(fcr_service_type); @@ -178,19 +178,19 @@ void CZeroconfBrowser::ReleaseInstance() CZeroconfBrowser::ZeroconfService::ZeroconfService():m_port(0){} -CZeroconfBrowser::ZeroconfService::ZeroconfService(const CStdString& fcr_name, const CStdString& fcr_type, const CStdString& fcr_domain): +CZeroconfBrowser::ZeroconfService::ZeroconfService(const std::string& fcr_name, const std::string& fcr_type, const std::string& fcr_domain): m_name(fcr_name), m_domain(fcr_domain), m_port(0) { SetType(fcr_type); } -void CZeroconfBrowser::ZeroconfService::SetName(const CStdString& fcr_name) +void CZeroconfBrowser::ZeroconfService::SetName(const std::string& fcr_name) { m_name = fcr_name; } -void CZeroconfBrowser::ZeroconfService::SetType(const CStdString& fcr_type) +void CZeroconfBrowser::ZeroconfService::SetType(const std::string& fcr_type) { if(fcr_type.empty()) throw std::runtime_error("CZeroconfBrowser::ZeroconfService::SetType invalid type: "+ fcr_type); @@ -201,17 +201,17 @@ void CZeroconfBrowser::ZeroconfService::SetType(const CStdString& fcr_type) m_type = fcr_type; } -void CZeroconfBrowser::ZeroconfService::SetDomain(const CStdString& fcr_domain) +void CZeroconfBrowser::ZeroconfService::SetDomain(const std::string& fcr_domain) { m_domain = fcr_domain; } -void CZeroconfBrowser::ZeroconfService::SetHostname(const CStdString& fcr_hostname) +void CZeroconfBrowser::ZeroconfService::SetHostname(const std::string& fcr_hostname) { m_hostname = fcr_hostname; } -void CZeroconfBrowser::ZeroconfService::SetIP(const CStdString& fcr_ip) +void CZeroconfBrowser::ZeroconfService::SetIP(const std::string& fcr_ip) { m_ip = fcr_ip; } @@ -232,12 +232,12 @@ void CZeroconfBrowser::ZeroconfService::SetTxtRecords(const tTxtRecordMap& txt_r } } -CStdString CZeroconfBrowser::ZeroconfService::toPath(const ZeroconfService& fcr_service) +std::string CZeroconfBrowser::ZeroconfService::toPath(const ZeroconfService& fcr_service) { - return CStdString(fcr_service.m_type + "@" + fcr_service.m_domain + "@" + fcr_service.m_name); + return fcr_service.m_type + '@' + fcr_service.m_domain + '@' + fcr_service.m_name; } -CZeroconfBrowser::ZeroconfService CZeroconfBrowser::ZeroconfService::fromPath(const CStdString& fcr_path) +CZeroconfBrowser::ZeroconfService CZeroconfBrowser::ZeroconfService::fromPath(const std::string& fcr_path) { if( fcr_path.empty() ) throw std::runtime_error("CZeroconfBrowser::ZeroconfService::fromPath input string empty!"); diff --git a/xbmc/network/ZeroconfBrowser.h b/xbmc/network/ZeroconfBrowser.h index 274be5b33d..7fe9c8cb8f 100644 --- a/xbmc/network/ZeroconfBrowser.h +++ b/xbmc/network/ZeroconfBrowser.h @@ -25,8 +25,6 @@ #include <vector> #include <map> -#include "utils/StdString.h" - #ifdef TARGET_WINDOWS #undef SetPort // WIN32INCLUDES this is defined as SetPortA in WinSpool.h which is being included _somewhere_ #endif @@ -44,33 +42,33 @@ public: typedef std::map<std::string, std::string> tTxtRecordMap; ZeroconfService(); - ZeroconfService(const CStdString& fcr_name, const CStdString& fcr_type, const CStdString& fcr_domain); + ZeroconfService(const std::string& fcr_name, const std::string& fcr_type, const std::string& fcr_domain); /// easy conversion to string and back (used in czeronfdiretory to store this service) ///@{ - static CStdString toPath(const ZeroconfService& fcr_service); - static ZeroconfService fromPath(const CStdString& fcr_path); //throws std::runtime_error on failure + static std::string toPath(const ZeroconfService& fcr_service); + static ZeroconfService fromPath(const std::string& fcr_path); //throws std::runtime_error on failure ///@} /// general access methods ///@{ - void SetName(const CStdString& fcr_name); - const CStdString& GetName() const {return m_name;} + void SetName(const std::string& fcr_name); + const std::string& GetName() const {return m_name;} - void SetType(const CStdString& fcr_type); - const CStdString& GetType() const {return m_type;} + void SetType(const std::string& fcr_type); + const std::string& GetType() const {return m_type;} - void SetDomain(const CStdString& fcr_domain); - const CStdString& GetDomain() const {return m_domain;} + void SetDomain(const std::string& fcr_domain); + const std::string& GetDomain() const {return m_domain;} ///@} /// access methods needed during resolve ///@{ - void SetIP(const CStdString& fcr_ip); - const CStdString& GetIP() const {return m_ip;} + void SetIP(const std::string& fcr_ip); + const std::string& GetIP() const {return m_ip;} - void SetHostname(const CStdString& fcr_hostname); - const CStdString& GetHostname() const {return m_hostname;} + void SetHostname(const std::string& fcr_hostname); + const std::string& GetHostname() const {return m_hostname;} void SetPort(int f_port); int GetPort() const {return m_port;} @@ -80,17 +78,17 @@ public: ///@} private: //3 entries below identify a service - CStdString m_name; - CStdString m_type; - CStdString m_domain; + std::string m_name; + std::string m_type; + std::string m_domain; //2 entries below store 1 ip:port pair for this service - CStdString m_ip; + std::string m_ip; int m_port; //used for mdns in case dns resolution fails //we store the hostname and resolve with mdns functions again - CStdString m_hostname; + std::string m_hostname; //1 entry below stores the txt-record as a key value map for this service tTxtRecordMap m_txtrecords_map; @@ -131,8 +129,8 @@ public: protected: // pure virtual methods to implement for OS specific implementations - virtual bool doAddServiceType(const CStdString& fcr_service_type) = 0; - virtual bool doRemoveServiceType(const CStdString& fcr_service_type) = 0; + virtual bool doAddServiceType(const std::string& fcr_service_type) = 0; + virtual bool doRemoveServiceType(const std::string& fcr_service_type) = 0; virtual std::vector<ZeroconfService> doGetFoundServices() = 0; virtual bool doResolveService(ZeroconfService& fr_service, double f_timeout) = 0; @@ -148,21 +146,21 @@ private: /// adds a service type for browsing /// @param fcr_service_type the service type as string, e.g. _smb._tcp. /// @return false if it was already there - bool AddServiceType(const CStdString& fcr_service_type); + bool AddServiceType(const std::string& fcr_service_type); /// remove the specified service from discovery /// @param fcr_service_type the service type as string, e.g. _smb._tcp. /// @return if it was not found - bool RemoveServiceType(const CStdString& fcr_service_type); + bool RemoveServiceType(const std::string& fcr_service_type); struct ServiceInfo { - CStdString type; + std::string type; }; //protects data CCriticalSection* mp_crit_sec; - typedef std::set<CStdString> tServices; + typedef std::set<std::string> tServices; tServices m_services; bool m_started; diff --git a/xbmc/network/cddb.h b/xbmc/network/cddb.h index 63411d34b9..198ea33b94 100644 --- a/xbmc/network/cddb.h +++ b/xbmc/network/cddb.h @@ -32,6 +32,7 @@ #include "storage/cdioSupport.h" #include "utils/AutoPtrHandle.h" +#include "utils/StdString.h" namespace CDDB { diff --git a/xbmc/network/httprequesthandler/HTTPImageHandler.h b/xbmc/network/httprequesthandler/HTTPImageHandler.h index 292a2af178..6565da0b8d 100644 --- a/xbmc/network/httprequesthandler/HTTPImageHandler.h +++ b/xbmc/network/httprequesthandler/HTTPImageHandler.h @@ -20,8 +20,7 @@ */ #include "IHTTPRequestHandler.h" - -#include "utils/StdString.h" +#include <string> class CHTTPImageHandler : public IHTTPRequestHandler { @@ -37,5 +36,5 @@ public: virtual int GetPriority() const { return 2; } private: - CStdString m_path; + std::string m_path; }; diff --git a/xbmc/network/httprequesthandler/HTTPVfsHandler.h b/xbmc/network/httprequesthandler/HTTPVfsHandler.h index 596e8afe24..93e5602e17 100644 --- a/xbmc/network/httprequesthandler/HTTPVfsHandler.h +++ b/xbmc/network/httprequesthandler/HTTPVfsHandler.h @@ -20,8 +20,7 @@ */ #include "IHTTPRequestHandler.h" - -#include "utils/StdString.h" +#include <string> class CHTTPVfsHandler : public IHTTPRequestHandler { @@ -37,5 +36,5 @@ public: virtual int GetPriority() const { return 2; } private: - CStdString m_path; + std::string m_path; }; diff --git a/xbmc/network/linux/NetworkLinux.cpp b/xbmc/network/linux/NetworkLinux.cpp index 71375e13c6..9eef7685bc 100644 --- a/xbmc/network/linux/NetworkLinux.cpp +++ b/xbmc/network/linux/NetworkLinux.cpp @@ -67,7 +67,7 @@ using namespace std; -CNetworkInterfaceLinux::CNetworkInterfaceLinux(CNetworkLinux* network, CStdString interfaceName, char interfaceMacAddrRaw[6]) +CNetworkInterfaceLinux::CNetworkInterfaceLinux(CNetworkLinux* network, std::string interfaceName, char interfaceMacAddrRaw[6]) { m_network = network; @@ -86,7 +86,7 @@ CNetworkInterfaceLinux::~CNetworkInterfaceLinux(void) { } -CStdString& CNetworkInterfaceLinux::GetName(void) +std::string& CNetworkInterfaceLinux::GetName(void) { return m_interfaceName; } @@ -134,7 +134,7 @@ bool CNetworkInterfaceLinux::IsConnected() return iRunning && (0 != memcmp(ifr.ifr_addr.sa_data+sizeof(short), &zero, sizeof(int))); } -CStdString CNetworkInterfaceLinux::GetMacAddress() +std::string CNetworkInterfaceLinux::GetMacAddress() { return m_interfaceMacAdr; } @@ -144,9 +144,9 @@ void CNetworkInterfaceLinux::GetMacAddressRaw(char rawMac[6]) memcpy(rawMac, m_interfaceMacAddrRaw, 6); } -CStdString CNetworkInterfaceLinux::GetCurrentIPAddress(void) +std::string CNetworkInterfaceLinux::GetCurrentIPAddress(void) { - CStdString result = ""; + std::string result; struct ifreq ifr; strcpy(ifr.ifr_name, m_interfaceName.c_str()); @@ -159,9 +159,9 @@ CStdString CNetworkInterfaceLinux::GetCurrentIPAddress(void) return result; } -CStdString CNetworkInterfaceLinux::GetCurrentNetmask(void) +std::string CNetworkInterfaceLinux::GetCurrentNetmask(void) { - CStdString result = ""; + std::string result; struct ifreq ifr; strcpy(ifr.ifr_name, m_interfaceName.c_str()); @@ -174,9 +174,9 @@ CStdString CNetworkInterfaceLinux::GetCurrentNetmask(void) return result; } -CStdString CNetworkInterfaceLinux::GetCurrentWirelessEssId(void) +std::string CNetworkInterfaceLinux::GetCurrentWirelessEssId(void) { - CStdString result = ""; + std::string result; #if defined(TARGET_LINUX) char essid[IW_ESSID_MAX_SIZE + 1]; @@ -196,15 +196,15 @@ CStdString CNetworkInterfaceLinux::GetCurrentWirelessEssId(void) return result; } -CStdString CNetworkInterfaceLinux::GetCurrentDefaultGateway(void) +std::string CNetworkInterfaceLinux::GetCurrentDefaultGateway(void) { - CStdString result = ""; + std::string result; #if defined(TARGET_DARWIN) FILE* pipe = popen("echo \"show State:/Network/Global/IPv4\" | scutil | grep Router", "r"); if (pipe) { - CStdString tmpStr; + std::string tmpStr; char buffer[256] = {'\0'}; if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe)) { @@ -354,7 +354,7 @@ CNetworkInterface* CNetworkLinux::GetFirstConnectedInterface(void) } -void CNetworkLinux::GetMacAddress(CStdString interfaceName, char rawMac[6]) +void CNetworkLinux::GetMacAddress(const std::string& interfaceName, char rawMac[6]) { memset(rawMac, 0, 6); #if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) @@ -375,7 +375,7 @@ void CNetworkLinux::GetMacAddress(CStdString interfaceName, char rawMac[6]) for(interface = list; interface != NULL; interface = interface->ifa_next) { - if(CStdString(interface->ifa_name).Equals(interfaceName)) + if(interfaceName == interface->ifa_name) { if ( (interface->ifa_addr->sa_family == AF_LINK) && (((const struct sockaddr_dl *) interface->ifa_addr)->sdl_type == IFT_ETHER) ) { @@ -458,7 +458,7 @@ void CNetworkLinux::queryInterfaceList() p[n] = 0; // save the result - CStdString interfaceName = p; + std::string interfaceName = p; GetMacAddress(interfaceName, macAddrRaw); m_interfaces.push_back(new CNetworkInterfaceLinux(this, interfaceName, macAddrRaw)); } @@ -467,16 +467,16 @@ void CNetworkLinux::queryInterfaceList() #endif } -std::vector<CStdString> CNetworkLinux::GetNameServers(void) +std::vector<std::string> CNetworkLinux::GetNameServers(void) { - std::vector<CStdString> result; + std::vector<std::string> result; #if defined(TARGET_DARWIN) //only finds the primary dns (0 :) FILE* pipe = popen("scutil --dns | grep \"nameserver\\[0\\]\" | tail -n1", "r"); if (pipe) { - CStdString tmpStr; + std::string tmpStr; char buffer[256] = {'\0'}; if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe)) { @@ -505,14 +505,14 @@ std::vector<CStdString> CNetworkLinux::GetNameServers(void) for (int i = 0; i < _res.nscount; i ++) { - CStdString ns = inet_ntoa(((struct sockaddr_in *)&_res.nsaddr_list[i])->sin_addr); + std::string ns = inet_ntoa(((struct sockaddr_in *)&_res.nsaddr_list[i])->sin_addr); result.push_back(ns); } #endif return result; } -void CNetworkLinux::SetNameServers(std::vector<CStdString> nameServers) +void CNetworkLinux::SetNameServers(const std::vector<std::string>& nameServers) { #if !defined(TARGET_ANDROID) FILE* fp = fopen("/etc/resolv.conf", "w"); @@ -562,7 +562,7 @@ bool CNetworkLinux::PingHost(unsigned long remote_ip, unsigned int timeout_ms) } #if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) -bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, CStdString& mac) +bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, std::string& mac) { bool ret = false; size_t needed; @@ -612,7 +612,7 @@ bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, CStdString return ret; } #else -bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, CStdString& mac) +bool CNetworkInterfaceLinux::GetHostMacAddress(unsigned long host_ip, std::string& mac) { struct arpreq areq; struct sockaddr_in* sin; @@ -745,8 +745,8 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void) unsigned char* custom; // pointer to the event payload struct iw_event iwe_buf, *iwe = &iwe_buf; // buffer to hold individual events - CStdString essId; - CStdString macAddress; + std::string essId; + std::string macAddress; int signalLevel = 0; EncMode encryption = ENC_NONE; int channel = 0; @@ -886,7 +886,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void) return result; } -void CNetworkInterfaceLinux::GetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceLinux::GetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { ipAddress = "0.0.0.0"; networkMask = "0.0.0.0"; @@ -906,7 +906,7 @@ void CNetworkInterfaceLinux::GetSettings(NetworkAssignment& assignment, CStdStri char* line = NULL; size_t linel = 0; - CStdString s; + std::string s; bool foundInterface = false; while (getdelim(&line, &linel, '\n', fp) > 0) @@ -971,7 +971,7 @@ void CNetworkInterfaceLinux::GetSettings(NetworkAssignment& assignment, CStdStri #endif } -void CNetworkInterfaceLinux::SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceLinux::SetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { #if defined(TARGET_LINUX) FILE* fr = fopen("/etc/network/interfaces", "r"); @@ -991,7 +991,7 @@ void CNetworkInterfaceLinux::SetSettings(NetworkAssignment& assignment, CStdStri char* line = NULL; size_t linel = 0; - CStdString s; + std::string s; bool foundInterface = false; bool dataWritten = false; @@ -1075,7 +1075,7 @@ void CNetworkInterfaceLinux::SetSettings(NetworkAssignment& assignment, CStdStri #endif } -void CNetworkInterfaceLinux::WriteSettings(FILE* fw, NetworkAssignment assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceLinux::WriteSettings(FILE* fw, NetworkAssignment assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { if (assignment == NETWORK_DHCP) { diff --git a/xbmc/network/linux/NetworkLinux.h b/xbmc/network/linux/NetworkLinux.h index 3b381515f6..438f36881e 100644 --- a/xbmc/network/linux/NetworkLinux.h +++ b/xbmc/network/linux/NetworkLinux.h @@ -21,8 +21,8 @@ * */ +#include <string> #include <vector> -#include "utils/StdString.h" #include "network/Network.h" class CNetworkLinux; @@ -30,35 +30,35 @@ class CNetworkLinux; class CNetworkInterfaceLinux : public CNetworkInterface { public: - CNetworkInterfaceLinux(CNetworkLinux* network, CStdString interfaceName, char interfaceMacAddrRaw[6]); + CNetworkInterfaceLinux(CNetworkLinux* network, std::string interfaceName, char interfaceMacAddrRaw[6]); ~CNetworkInterfaceLinux(void); - virtual CStdString& GetName(void); + virtual std::string& GetName(void); virtual bool IsEnabled(void); virtual bool IsConnected(void); virtual bool IsWireless(void); - virtual CStdString GetMacAddress(void); + virtual std::string GetMacAddress(void); virtual void GetMacAddressRaw(char rawMac[6]); - virtual bool GetHostMacAddress(unsigned long host, CStdString& mac); + virtual bool GetHostMacAddress(unsigned long host, std::string& mac); - virtual CStdString GetCurrentIPAddress(); - virtual CStdString GetCurrentNetmask(); - virtual CStdString GetCurrentDefaultGateway(void); - virtual CStdString GetCurrentWirelessEssId(void); + virtual std::string GetCurrentIPAddress(); + virtual std::string GetCurrentNetmask(); + virtual std::string GetCurrentDefaultGateway(void); + virtual std::string GetCurrentWirelessEssId(void); - virtual void GetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); - virtual void SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); + virtual void GetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); + virtual void SetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); // Returns the list of access points in the area virtual std::vector<NetworkAccessPoint> GetAccessPoints(void); private: - void WriteSettings(FILE* fw, NetworkAssignment assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); - CStdString m_interfaceName; - CStdString m_interfaceMacAdr; + void WriteSettings(FILE* fw, NetworkAssignment assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); + std::string m_interfaceName; + std::string m_interfaceMacAdr; char m_interfaceMacAddrRaw[6]; CNetworkLinux* m_network; }; @@ -77,14 +77,14 @@ public: virtual bool PingHost(unsigned long host, unsigned int timeout_ms = 2000); // Get/set the nameserver(s) - virtual std::vector<CStdString> GetNameServers(void); - virtual void SetNameServers(std::vector<CStdString> nameServers); + virtual std::vector<std::string> GetNameServers(void); + virtual void SetNameServers(const std::vector<std::string>& nameServers); friend class CNetworkInterfaceLinux; private: int GetSocket() { return m_sock; } - void GetMacAddress(CStdString interfaceName, char macAddrRaw[6]); + void GetMacAddress(const std::string& interfaceName, char macAddrRaw[6]); void queryInterfaceList(); std::vector<CNetworkInterface*> m_interfaces; int m_sock; diff --git a/xbmc/network/linux/ZeroconfBrowserAvahi.cpp b/xbmc/network/linux/ZeroconfBrowserAvahi.cpp index 22762aa46e..f834d86cd5 100644 --- a/xbmc/network/linux/ZeroconfBrowserAvahi.cpp +++ b/xbmc/network/linux/ZeroconfBrowserAvahi.cpp @@ -103,7 +103,7 @@ CZeroconfBrowserAvahi::~CZeroconfBrowserAvahi() avahi_threaded_poll_free ( mp_poll ); } -bool CZeroconfBrowserAvahi::doAddServiceType ( const CStdString& fcr_service_type ) +bool CZeroconfBrowserAvahi::doAddServiceType ( const std::string& fcr_service_type ) { ScopedEventLoopBlock lock ( mp_poll ); tBrowserMap::iterator it = m_browsers.find ( fcr_service_type ); @@ -134,7 +134,7 @@ bool CZeroconfBrowserAvahi::doAddServiceType ( const CStdString& fcr_service_typ } } -bool CZeroconfBrowserAvahi::doRemoveServiceType ( const CStdString& fcr_service_type ) +bool CZeroconfBrowserAvahi::doRemoveServiceType ( const std::string& fcr_service_type ) { ScopedEventLoopBlock lock ( mp_poll ); tBrowserMap::iterator it = m_browsers.find ( fcr_service_type ); @@ -327,8 +327,8 @@ CZeroconfBrowser::ZeroconfService::tTxtRecordMap GetTxtRecords(AvahiStringList * recordMap.insert( std::make_pair( - CStdString(key), - CStdString(value) + std::string(key), + std::string(value) ) ); @@ -387,7 +387,7 @@ bool CZeroconfBrowserAvahi::createClient() return true; } -AvahiServiceBrowser* CZeroconfBrowserAvahi::createServiceBrowser ( const CStdString& fcr_service_type, AvahiClient* fp_client, void* fp_userdata) +AvahiServiceBrowser* CZeroconfBrowserAvahi::createServiceBrowser ( const std::string& fcr_service_type, AvahiClient* fp_client, void* fp_userdata) { assert(fp_client); AvahiServiceBrowser* ret = avahi_service_browser_new ( fp_client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, fcr_service_type.c_str(), diff --git a/xbmc/network/linux/ZeroconfBrowserAvahi.h b/xbmc/network/linux/ZeroconfBrowserAvahi.h index aba058fdcf..d59faa625a 100644 --- a/xbmc/network/linux/ZeroconfBrowserAvahi.h +++ b/xbmc/network/linux/ZeroconfBrowserAvahi.h @@ -44,8 +44,8 @@ class CZeroconfBrowserAvahi : public CZeroconfBrowser private: ///implementation if CZeroconfBrowser interface ///@{ - virtual bool doAddServiceType(const CStdString& fcr_service_type); - virtual bool doRemoveServiceType(const CStdString& fcr_service_type); + virtual bool doAddServiceType(const std::string& fcr_service_type); + virtual bool doRemoveServiceType(const std::string& fcr_service_type); virtual std::vector<CZeroconfBrowser::ZeroconfService> doGetFoundServices(); virtual bool doResolveService(CZeroconfBrowser::ZeroconfService& fr_service, double f_timeout); @@ -82,13 +82,13 @@ class CZeroconfBrowserAvahi : public CZeroconfBrowser static void shutdownCallback(AvahiTimeout *fp_e, void *fp_data); //helpers bool createClient(); - static AvahiServiceBrowser* createServiceBrowser(const CStdString& fcr_service_type, AvahiClient* fp_client, void* fp_userdata); + static AvahiServiceBrowser* createServiceBrowser(const std::string& fcr_service_type, AvahiClient* fp_client, void* fp_userdata); //shared variables between avahi thread and interface AvahiClient* mp_client; AvahiThreadedPoll* mp_poll; // tBrowserMap maps service types the corresponding browser - typedef std::map<CStdString, AvahiServiceBrowser*> tBrowserMap; + typedef std::map<std::string, AvahiServiceBrowser*> tBrowserMap; tBrowserMap m_browsers; // if a browser is in this set, it already sent an ALL_FOR_NOW message diff --git a/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp b/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp index 2bec634c9c..dd02715b71 100644 --- a/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp +++ b/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp @@ -115,7 +115,7 @@ void DNSSD_API CZeroconfBrowserMDNS::GetAddrInfoCallback(DNSServiceRef return; } - CStdString strIP; + std::string strIP; CZeroconfBrowserMDNS* p_instance = static_cast<CZeroconfBrowserMDNS*> ( context ); if (address->sa_family == AF_INET) @@ -146,7 +146,7 @@ void DNSSD_API CZeroconfBrowserMDNS::ResolveCallback(DNSServiceRef DNSServiceErrorType err; CZeroconfBrowser::ZeroconfService::tTxtRecordMap recordMap; - CStdString strIP; + std::string strIP; CZeroconfBrowserMDNS* p_instance = static_cast<CZeroconfBrowserMDNS*> ( context ); p_instance->m_resolving_service.SetHostname(hosttarget); @@ -221,7 +221,7 @@ void CZeroconfBrowserMDNS::removeDiscoveredService(DNSServiceRef browser, CZeroc } -bool CZeroconfBrowserMDNS::doAddServiceType(const CStdString& fcr_service_type) +bool CZeroconfBrowserMDNS::doAddServiceType(const std::string& fcr_service_type) { DNSServiceErrorType err; DNSServiceRef browser = NULL; @@ -267,7 +267,7 @@ bool CZeroconfBrowserMDNS::doAddServiceType(const CStdString& fcr_service_type) return true; } -bool CZeroconfBrowserMDNS::doRemoveServiceType(const CStdString& fcr_service_type) +bool CZeroconfBrowserMDNS::doRemoveServiceType(const std::string& fcr_service_type) { //search for this browser and remove it from the map DNSServiceRef browser = 0; @@ -321,7 +321,7 @@ bool CZeroconfBrowserMDNS::doResolveService(CZeroconfBrowser::ZeroconfService& f m_resolving_service = fr_service; m_resolved_event.Reset(); - err = DNSServiceResolve(&sdRef, 0, kDNSServiceInterfaceIndexAny, fr_service.GetName(), fr_service.GetType(), fr_service.GetDomain(), ResolveCallback, this); + err = DNSServiceResolve(&sdRef, 0, kDNSServiceInterfaceIndexAny, fr_service.GetName().c_str(), fr_service.GetType().c_str(), fr_service.GetDomain().c_str(), ResolveCallback, this); if( err != kDNSServiceErr_NoError ) { @@ -351,13 +351,13 @@ bool CZeroconfBrowserMDNS::doResolveService(CZeroconfBrowser::ZeroconfService& f // resolve the hostname if (!fr_service.GetHostname().empty()) { - CStdString strIP; + std::string strIP; // use mdns resolving m_addrinfo_event.Reset(); sdRef = NULL; - err = DNSServiceGetAddrInfo(&sdRef, 0, kDNSServiceInterfaceIndexAny, kDNSServiceProtocol_IPv4, fr_service.GetHostname(), GetAddrInfoCallback, this); + err = DNSServiceGetAddrInfo(&sdRef, 0, kDNSServiceInterfaceIndexAny, kDNSServiceProtocol_IPv4, fr_service.GetHostname().c_str(), GetAddrInfoCallback, this); if (err != kDNSServiceErr_NoError) CLog::Log(LOGERROR, "ZeroconfBrowserMDNS: DNSServiceGetAddrInfo returned (error = %ld)", (int) err); diff --git a/xbmc/network/mdns/ZeroconfBrowserMDNS.h b/xbmc/network/mdns/ZeroconfBrowserMDNS.h index 06fbab979b..ad5d46ad8e 100644 --- a/xbmc/network/mdns/ZeroconfBrowserMDNS.h +++ b/xbmc/network/mdns/ZeroconfBrowserMDNS.h @@ -37,8 +37,8 @@ public: private: ///implementation if CZeroconfBrowser interface ///@{ - virtual bool doAddServiceType(const CStdString& fcr_service_type); - virtual bool doRemoveServiceType(const CStdString& fcr_service_type); + virtual bool doAddServiceType(const std::string& fcr_service_type); + virtual bool doRemoveServiceType(const std::string& fcr_service_type); virtual std::vector<CZeroconfBrowser::ZeroconfService> doGetFoundServices(); virtual bool doResolveService(CZeroconfBrowser::ZeroconfService& fr_service, double f_timeout); diff --git a/xbmc/network/osx/ZeroconfBrowserOSX.cpp b/xbmc/network/osx/ZeroconfBrowserOSX.cpp index 2da017ce26..18487989a1 100644 --- a/xbmc/network/osx/ZeroconfBrowserOSX.cpp +++ b/xbmc/network/osx/ZeroconfBrowserOSX.cpp @@ -64,7 +64,7 @@ namespace recordMap.insert( std::make_pair( key, - CStdString((const char *)CFDataGetBytePtr(values[idx])) + std::string((const char *)CFDataGetBytePtr(values[idx])) ) ); } @@ -78,7 +78,7 @@ namespace //helper to get (first) IP and port from a resolved service //returns true on success, false on if none was found - bool CopyFirstIPv4Address(CFNetServiceRef serviceRef, CStdString &fr_address, int &fr_port) + bool CopyFirstIPv4Address(CFNetServiceRef serviceRef, std::string &fr_address, int &fr_port) { CFIndex idx; struct sockaddr_in address; @@ -238,7 +238,7 @@ removeDiscoveredService(CFNetServiceBrowserRef browser, CFOptionFlags flags, CZe } -bool CZeroconfBrowserOSX::doAddServiceType(const CStdString& fcr_service_type) +bool CZeroconfBrowserOSX::doAddServiceType(const std::string& fcr_service_type) { CFNetServiceClientContext clientContext = { 0, this, NULL, NULL, NULL }; CFStringRef domain = CFSTR(""); @@ -273,7 +273,7 @@ bool CZeroconfBrowserOSX::doAddServiceType(const CStdString& fcr_service_type) return result; } -bool CZeroconfBrowserOSX::doRemoveServiceType(const CStdString &fcr_service_type) +bool CZeroconfBrowserOSX::doRemoveServiceType(const std::string &fcr_service_type) { //search for this browser and remove it from the map CFNetServiceBrowserRef browser = 0; @@ -334,7 +334,7 @@ bool CZeroconfBrowserOSX::doResolveService(CZeroconfBrowser::ZeroconfService &fr CFNetServiceRef service = CFNetServiceCreate (NULL, domain, type, name, 0); if (CFNetServiceResolveWithTimeout(service, f_timeout, NULL) ) { - CStdString ip; + std::string ip; int port = 0; ret = CopyFirstIPv4Address(service, ip, port); fr_service.SetIP(ip); diff --git a/xbmc/network/osx/ZeroconfBrowserOSX.h b/xbmc/network/osx/ZeroconfBrowserOSX.h index fc093868fa..581bedeab1 100644 --- a/xbmc/network/osx/ZeroconfBrowserOSX.h +++ b/xbmc/network/osx/ZeroconfBrowserOSX.h @@ -43,8 +43,8 @@ public: private: ///implementation if CZeroconfBrowser interface ///@{ - virtual bool doAddServiceType(const CStdString &fcr_service_type); - virtual bool doRemoveServiceType(const CStdString &fcr_service_type); + virtual bool doAddServiceType(const std::string &fcr_service_type); + virtual bool doRemoveServiceType(const std::string &fcr_service_type); virtual std::vector<CZeroconfBrowser::ZeroconfService> doGetFoundServices(); virtual bool doResolveService(CZeroconfBrowser::ZeroconfService &fr_service, double f_timeout); @@ -67,7 +67,7 @@ private: //TODO: split the guard for discovered, resolved access? CCriticalSection m_data_guard; // tBrowserMap maps service types the corresponding browser - typedef std::map<CStdString, CFNetServiceBrowserRef> tBrowserMap; + typedef std::map<std::string, CFNetServiceBrowserRef> tBrowserMap; tBrowserMap m_service_browsers; //tDiscoveredServicesMap maps browsers to their discovered services + a ref-count for each service //ref-count is needed, because a service might pop up more than once, if there's more than one network-iface diff --git a/xbmc/network/upnp/UPnPPlayer.cpp b/xbmc/network/upnp/UPnPPlayer.cpp index e7fbf81201..992a258ed0 100644 --- a/xbmc/network/upnp/UPnPPlayer.cpp +++ b/xbmc/network/upnp/UPnPPlayer.cpp @@ -591,7 +591,7 @@ failed: return 0; }; -CStdString CUPnPPlayer::GetPlayingTitle() +std::string CUPnPPlayer::GetPlayingTitle() { return ""; }; diff --git a/xbmc/network/upnp/UPnPPlayer.h b/xbmc/network/upnp/UPnPPlayer.h index 777dc33f9d..7e20b86c4c 100644 --- a/xbmc/network/upnp/UPnPPlayer.h +++ b/xbmc/network/upnp/UPnPPlayer.h @@ -51,16 +51,16 @@ public: virtual void SeekPercentage(float fPercent = 0); virtual float GetPercentage(); virtual void SetVolume(float volume); - virtual void GetAudioInfo( CStdString& strAudioInfo) {}; - virtual void GetVideoInfo( CStdString& strVideoInfo) {}; - virtual void GetGeneralInfo( CStdString& strVideoInfo) {}; + virtual void GetAudioInfo(std::string& strAudioInfo) {}; + virtual void GetVideoInfo(std::string& strVideoInfo) {}; + virtual void GetGeneralInfo(std::string& strVideoInfo) {}; virtual bool CanRecord() { return false;}; virtual bool IsRecording() { return false;}; virtual bool Record(bool bOnOff) { return false;}; virtual int GetChapterCount() { return 0; } virtual int GetChapter() { return -1; } - virtual void GetChapterName(CStdString& strChapterName) { return; } + virtual void GetChapterName(std::string& strChapterName) { return; } virtual int SeekChapter(int iChapter) { return -1; } virtual void SeekTime(__int64 iTime = 0); @@ -74,15 +74,15 @@ public: virtual void DoAudioWork(); virtual bool OnAction(const CAction &action); - virtual CStdString GetPlayingTitle(); + virtual std::string GetPlayingTitle(); int PlayFile(const CFileItem& file, const CPlayerOptions& options, CGUIDialogBusy*& dialog, XbmcThreads::EndTime& timeout); private: PLT_MediaController* m_control; CUPnPPlayerController* m_delegate; - CStdString m_current_uri; - CStdString m_current_meta; + std::string m_current_uri; + std::string m_current_meta; bool m_started; bool m_stopremote; }; diff --git a/xbmc/network/websocket/WebSocket.cpp b/xbmc/network/websocket/WebSocket.cpp index 1a381bdcb9..498cbb10b8 100644 --- a/xbmc/network/websocket/WebSocket.cpp +++ b/xbmc/network/websocket/WebSocket.cpp @@ -26,7 +26,6 @@ #include "utils/log.h" #include "utils/HttpParser.h" #include "utils/Base64.h" -#include "utils/StdString.h" #include "utils/StringUtils.h" #include "utils/HttpResponse.h" diff --git a/xbmc/network/windows/NetworkWin32.cpp b/xbmc/network/windows/NetworkWin32.cpp index 6f6d87599b..9527f7540d 100644 --- a/xbmc/network/windows/NetworkWin32.cpp +++ b/xbmc/network/windows/NetworkWin32.cpp @@ -53,7 +53,7 @@ CNetworkInterfaceWin32::~CNetworkInterfaceWin32(void) { } -CStdString& CNetworkInterfaceWin32::GetName(void) +std::string& CNetworkInterfaceWin32::GetName(void) { g_charsetConverter.unknownToUTF8(m_adaptername); return m_adaptername; @@ -71,13 +71,13 @@ bool CNetworkInterfaceWin32::IsEnabled() bool CNetworkInterfaceWin32::IsConnected() { - CStdString strIP = m_adapter.IpAddressList.IpAddress.String; + std::string strIP = m_adapter.IpAddressList.IpAddress.String; return (strIP != "0.0.0.0"); } -CStdString CNetworkInterfaceWin32::GetMacAddress() +std::string CNetworkInterfaceWin32::GetMacAddress() { - CStdString result; + std::string result; unsigned char* mAddr = m_adapter.Address; result = StringUtils::Format("%02X:%02X:%02X:%02X:%02X:%02X", mAddr[0], mAddr[1], mAddr[2], mAddr[3], mAddr[4], mAddr[5]); return result; @@ -88,19 +88,19 @@ void CNetworkInterfaceWin32::GetMacAddressRaw(char rawMac[6]) memcpy(rawMac, m_adapter.Address, 6); } -CStdString CNetworkInterfaceWin32::GetCurrentIPAddress(void) +std::string CNetworkInterfaceWin32::GetCurrentIPAddress(void) { return m_adapter.IpAddressList.IpAddress.String; } -CStdString CNetworkInterfaceWin32::GetCurrentNetmask(void) +std::string CNetworkInterfaceWin32::GetCurrentNetmask(void) { return m_adapter.IpAddressList.IpMask.String; } -CStdString CNetworkInterfaceWin32::GetCurrentWirelessEssId(void) +std::string CNetworkInterfaceWin32::GetCurrentWirelessEssId(void) { - CStdString result = ""; + std::string result = ""; #ifdef HAS_WIN32_WLAN_API if(IsWireless()) @@ -121,8 +121,9 @@ CStdString CNetworkInterfaceWin32::GetCurrentWirelessEssId(void) GUID guid = ppInterfaceList->InterfaceInfo[i].InterfaceGuid; WCHAR wcguid[64]; StringFromGUID2(guid, (LPOLESTR)&wcguid, 64); - CStdStringW strGuid = wcguid; - CStdStringW strAdaptername = m_adapter.AdapterName; + std::wstring strGuid = wcguid; + std::wstring strAdaptername; + g_charsetConverter.utf8ToW(m_adapter.AdapterName, strAdaptername); if( strGuid == strAdaptername) { if(WlanQueryInterface(hClientHdl,&ppInterfaceList->InterfaceInfo[i].InterfaceGuid,wlan_intf_opcode_current_connection, NULL, &dwSize, (PVOID*)&pAttributes, NULL ) == ERROR_SUCCESS) @@ -144,7 +145,7 @@ CStdString CNetworkInterfaceWin32::GetCurrentWirelessEssId(void) return result; } -CStdString CNetworkInterfaceWin32::GetCurrentDefaultGateway(void) +std::string CNetworkInterfaceWin32::GetCurrentDefaultGateway(void) { return m_adapter.GatewayList.IpAddress.String; } @@ -217,9 +218,9 @@ void CNetworkWin32::queryInterfaceList() free(adapterInfo); } -std::vector<CStdString> CNetworkWin32::GetNameServers(void) +std::vector<std::string> CNetworkWin32::GetNameServers(void) { - std::vector<CStdString> result; + std::vector<std::string> result; FIXED_INFO *pFixedInfo; ULONG ulOutBufLen; @@ -259,7 +260,7 @@ std::vector<CStdString> CNetworkWin32::GetNameServers(void) return result; } -void CNetworkWin32::SetNameServers(std::vector<CStdString> nameServers) +void CNetworkWin32::SetNameServers(const std::vector<std::string>& nameServers) { return; } @@ -289,7 +290,7 @@ bool CNetworkWin32::PingHost(unsigned long host, unsigned int timeout_ms /* = 20 return false; } -bool CNetworkInterfaceWin32::GetHostMacAddress(unsigned long host, CStdString& mac) +bool CNetworkInterfaceWin32::GetHostMacAddress(unsigned long host, std::string& mac) { IPAddr src_ip = inet_addr(GetCurrentIPAddress().c_str()); BYTE bPhysAddr[6]; // for 6-byte hardware addresses @@ -355,8 +356,9 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceWin32::GetAccessPoints(void) GUID guid = interface_list->InterfaceInfo[i].InterfaceGuid; WCHAR wcguid[64]; StringFromGUID2(guid, (LPOLESTR)&wcguid, 64); - CStdStringW strGuid = wcguid; - CStdStringW strAdaptername = m_adapter.AdapterName; + std::wstring strGuid = wcguid; + std::wstring strAdaptername; + g_charsetConverter.utf8ToW(m_adapter.AdapterName, strAdaptername); if (strGuid == strAdaptername) { WLAN_BSS_LIST *bss_list; @@ -373,8 +375,8 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceWin32::GetAccessPoints(void) { const WLAN_BSS_ENTRY bss_entry = bss_list->wlanBssEntries[j]; // Add the access point info to the list of results - CStdString essId((char*)bss_entry.dot11Ssid.ucSSID, (unsigned int)bss_entry.dot11Ssid.uSSIDLength); - CStdString macAddress; + std::string essId((char*)bss_entry.dot11Ssid.ucSSID, (unsigned int)bss_entry.dot11Ssid.uSSIDLength); + std::string macAddress; // macAddress is big-endian, write in byte chunks macAddress = StringUtils::Format("%02x-%02x-%02x-%02x-%02x-%02x", bss_entry.dot11Bssid[0], bss_entry.dot11Bssid[1], bss_entry.dot11Bssid[2], @@ -400,7 +402,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceWin32::GetAccessPoints(void) return result; } -void CNetworkInterfaceWin32::GetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceWin32::GetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { ipAddress = "0.0.0.0"; networkMask = "0.0.0.0"; @@ -471,8 +473,9 @@ void CNetworkInterfaceWin32::GetSettings(NetworkAssignment& assignment, CStdStri GUID guid = ppInterfaceList->InterfaceInfo[i].InterfaceGuid; WCHAR wcguid[64]; StringFromGUID2(guid, (LPOLESTR)&wcguid, 64); - CStdStringW strGuid = wcguid; - CStdStringW strAdaptername = m_adapter.AdapterName; + std::wstring strGuid = wcguid; + std::wstring strAdaptername; + g_charsetConverter.utf8ToW(m_adapter.AdapterName, strAdaptername); if( strGuid == strAdaptername) { if(WlanQueryInterface(hClientHdl,&ppInterfaceList->InterfaceInfo[i].InterfaceGuid,wlan_intf_opcode_current_connection, NULL, &dwSize, (PVOID*)&pAttributes, NULL ) == ERROR_SUCCESS) @@ -510,12 +513,12 @@ void CNetworkInterfaceWin32::GetSettings(NetworkAssignment& assignment, CStdStri #endif } -void CNetworkInterfaceWin32::SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceWin32::SetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { return; } -void CNetworkInterfaceWin32::WriteSettings(FILE* fw, NetworkAssignment assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) +void CNetworkInterfaceWin32::WriteSettings(FILE* fw, NetworkAssignment assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode) { return; } diff --git a/xbmc/network/windows/NetworkWin32.h b/xbmc/network/windows/NetworkWin32.h index 5de65e51bb..71019f094c 100644 --- a/xbmc/network/windows/NetworkWin32.h +++ b/xbmc/network/windows/NetworkWin32.h @@ -20,8 +20,8 @@ #ifndef NETWORK_LINUX_H_ #define NETWORK_LINUX_H_ +#include <string> #include <vector> -#include "utils/StdString.h" #include "network/Network.h" #include "Iphlpapi.h" #include "utils/stopwatch.h" @@ -35,33 +35,33 @@ public: CNetworkInterfaceWin32(CNetworkWin32* network, IP_ADAPTER_INFO adapter); ~CNetworkInterfaceWin32(void); - virtual CStdString& GetName(void); + virtual std::string& GetName(void); virtual bool IsEnabled(void); virtual bool IsConnected(void); virtual bool IsWireless(void); - virtual CStdString GetMacAddress(void); + virtual std::string GetMacAddress(void); virtual void GetMacAddressRaw(char rawMac[6]); - virtual bool GetHostMacAddress(unsigned long host, CStdString& mac); + virtual bool GetHostMacAddress(unsigned long host, std::string& mac); - virtual CStdString GetCurrentIPAddress(); - virtual CStdString GetCurrentNetmask(); - virtual CStdString GetCurrentDefaultGateway(void); - virtual CStdString GetCurrentWirelessEssId(void); + virtual std::string GetCurrentIPAddress(); + virtual std::string GetCurrentNetmask(); + virtual std::string GetCurrentDefaultGateway(void); + virtual std::string GetCurrentWirelessEssId(void); - virtual void GetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); - virtual void SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); + virtual void GetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); + virtual void SetSettings(NetworkAssignment& assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); // Returns the list of access points in the area virtual std::vector<NetworkAccessPoint> GetAccessPoints(void); private: - void WriteSettings(FILE* fw, NetworkAssignment assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode); + void WriteSettings(FILE* fw, NetworkAssignment assignment, std::string& ipAddress, std::string& networkMask, std::string& defaultGateway, std::string& essId, std::string& key, EncMode& encryptionMode); IP_ADAPTER_INFO m_adapter; CNetworkWin32* m_network; - CStdString m_adaptername; + std::string m_adaptername; }; class CNetworkWin32 : public CNetwork @@ -77,8 +77,8 @@ public: virtual bool PingHost(unsigned long host, unsigned int timeout_ms = 2000); // Get/set the nameserver(s) - virtual std::vector<CStdString> GetNameServers(void); - virtual void SetNameServers(std::vector<CStdString> nameServers); + virtual std::vector<std::string> GetNameServers(void); + virtual void SetNameServers(const std::vector<std::string>& nameServers); friend class CNetworkInterfaceWin32; diff --git a/xbmc/pictures/GUIViewStatePictures.cpp b/xbmc/pictures/GUIViewStatePictures.cpp index 2e5983afeb..20b682b916 100644 --- a/xbmc/pictures/GUIViewStatePictures.cpp +++ b/xbmc/pictures/GUIViewStatePictures.cpp @@ -66,12 +66,12 @@ void CGUIViewStateWindowPictures::SaveViewState() SaveViewToDb(m_items.GetPath(), WINDOW_PICTURES, CViewStateSettings::Get().Get("pictures")); } -CStdString CGUIViewStateWindowPictures::GetLockType() +std::string CGUIViewStateWindowPictures::GetLockType() { return "pictures"; } -CStdString CGUIViewStateWindowPictures::GetExtensions() +std::string CGUIViewStateWindowPictures::GetExtensions() { if (CSettings::Get().GetBool("pictures.showvideos")) return g_advancedSettings.m_pictureExtensions+"|"+g_advancedSettings.m_videoExtensions; diff --git a/xbmc/pictures/GUIViewStatePictures.h b/xbmc/pictures/GUIViewStatePictures.h index 4132b9a6dd..53c1cca86d 100644 --- a/xbmc/pictures/GUIViewStatePictures.h +++ b/xbmc/pictures/GUIViewStatePictures.h @@ -29,8 +29,8 @@ public: protected: virtual void SaveViewState(); - virtual CStdString GetLockType(); - virtual CStdString GetExtensions(); + virtual std::string GetLockType(); + virtual std::string GetExtensions(); virtual VECSOURCES& GetSources(); }; diff --git a/xbmc/playlists/PlayList.cpp b/xbmc/playlists/PlayList.cpp index 678253e995..a7c3d0b937 100644 --- a/xbmc/playlists/PlayList.cpp +++ b/xbmc/playlists/PlayList.cpp @@ -294,12 +294,12 @@ void CPlayList::UnShuffle() m_bShuffled = false; } -const CStdString& CPlayList::GetName() const +const std::string& CPlayList::GetName() const { return m_strPlayListName; } -void CPlayList::Remove(const CStdString& strFileName) +void CPlayList::Remove(const std::string& strFileName) { int iOrder = -1; int position = 0; @@ -350,7 +350,7 @@ void CPlayList::Remove(int position) int CPlayList::RemoveDVDItems() { - std::vector <CStdString> vecFilenames; + std::vector <std::string> vecFilenames; // Collect playlist items from DVD share ivecItems it; @@ -369,11 +369,11 @@ int CPlayList::RemoveDVDItems() int nFileCount = vecFilenames.size(); if ( nFileCount ) { - std::vector <CStdString>::iterator it; + std::vector <std::string>::iterator it; it = vecFilenames.begin(); while (it != vecFilenames.end() ) { - CStdString& strFilename = *it; + std::string& strFilename = *it; Remove( strFilename ); it++; } @@ -423,7 +423,7 @@ void CPlayList::SetUnPlayable(int iItem) } -bool CPlayList::Load(const CStdString& strFileName) +bool CPlayList::Load(const std::string& strFileName) { Clear(); m_strBasePath = URIUtils::GetDirectory(strFileName); @@ -449,7 +449,7 @@ bool CPlayList::LoadData(std::istream &stream) return LoadData(ostr.str()); } -bool CPlayList::LoadData(const CStdString& strData) +bool CPlayList::LoadData(const std::string& strData) { return false; } @@ -492,7 +492,7 @@ void CPlayList::UpdateItem(const CFileItem *item) CFileItemPtr playlistItem = *it; if (playlistItem->IsSamePath(item)) { - CStdString temp = playlistItem->GetPath(); // save path, it may have been altered + std::string temp = playlistItem->GetPath(); // save path, it may have been altered *playlistItem = *item; playlistItem->SetPath(temp); break; @@ -500,7 +500,7 @@ void CPlayList::UpdateItem(const CFileItem *item) } } -const CStdString CPlayList::ResolveURL(const CFileItemPtr &item ) const +const std::string& CPlayList::ResolveURL(const CFileItemPtr &item ) const { if (item->IsMusicDb() && item->HasMusicInfoTag()) return item->GetMusicInfoTag()->GetURL(); diff --git a/xbmc/playlists/PlayList.h b/xbmc/playlists/PlayList.h index 1355252359..09aabfe672 100644 --- a/xbmc/playlists/PlayList.h +++ b/xbmc/playlists/PlayList.h @@ -21,6 +21,7 @@ #include "FileItem.h" #include <boost/shared_ptr.hpp> +#include <string> namespace PLAYLIST { @@ -29,10 +30,10 @@ class CPlayList public: CPlayList(int id = -1); virtual ~CPlayList(void) {}; - virtual bool Load(const CStdString& strFileName); + virtual bool Load(const std::string& strFileName); virtual bool LoadData(std::istream &stream); - virtual bool LoadData(const CStdString& strData); - virtual void Save(const CStdString& strFileName) const {}; + virtual bool LoadData(const std::string& strData); + virtual void Save(const std::string& strFileName) const {}; void Add(CPlayList& playlist); void Add(const CFileItemPtr &pItem); @@ -44,8 +45,8 @@ public: void Insert(const CFileItemPtr& item, int iPosition = -1); int FindOrder(int iOrder) const; - const CStdString& GetName() const; - void Remove(const CStdString& strFileName); + const std::string& GetName() const; + void Remove(const std::string& strFileName); void Remove(int position); bool Swap(int position1, int position2); bool Expand(int position); // expands any playlist at position into this playlist @@ -68,12 +69,12 @@ public: void UpdateItem(const CFileItem *item); - const CStdString ResolveURL(const CFileItemPtr &item) const; + const std::string& ResolveURL(const CFileItemPtr &item) const; protected: int m_id; - CStdString m_strPlayListName; - CStdString m_strBasePath; + std::string m_strPlayListName; + std::string m_strBasePath; int m_iPlayableItems; bool m_bShuffled; bool m_bWasPlayed; diff --git a/xbmc/playlists/PlayListB4S.cpp b/xbmc/playlists/PlayListB4S.cpp index e1c6db79ad..aaa91d779d 100644 --- a/xbmc/playlists/PlayListB4S.cpp +++ b/xbmc/playlists/PlayListB4S.cpp @@ -79,7 +79,7 @@ bool CPlayListB4S::LoadData(istream& stream) if (!pEntryElement) return false; while (pEntryElement) { - CStdString strFileName = XMLUtils::GetAttribute(pEntryElement, "Playstring"); + std::string strFileName = XMLUtils::GetAttribute(pEntryElement, "Playstring"); size_t iColon = strFileName.find(":"); if (iColon != std::string::npos) { @@ -97,7 +97,7 @@ bool CPlayListB4S::LoadData(istream& stream) } if (pNodeInfo) { - CStdString strInfo = pNodeInfo->FirstChild()->Value(); + std::string strInfo = pNodeInfo->FirstChild()->Value(); strFileName = URIUtils::SubstitutePath(strFileName); CUtil::GetQualifiedFilename(m_strBasePath, strFileName); CFileItemPtr newItem(new CFileItem(strInfo)); @@ -111,10 +111,10 @@ bool CPlayListB4S::LoadData(istream& stream) return true; } -void CPlayListB4S::Save(const CStdString& strFileName) const +void CPlayListB4S::Save(const std::string& strFileName) const { if (!m_vecItems.size()) return ; - CStdString strPlaylist = strFileName; + std::string strPlaylist = strFileName; strPlaylist = CUtil::MakeLegalPath(strPlaylist); CFile file; if (!file.OpenForWrite(strPlaylist, true)) @@ -122,7 +122,7 @@ void CPlayListB4S::Save(const CStdString& strFileName) const CLog::Log(LOGERROR, "Could not save B4S playlist: [%s]", strPlaylist.c_str()); return ; } - CStdString write; + std::string write; write += StringUtils::Format("<?xml version=%c1.0%c encoding='UTF-8' standalone=%cyes%c?>\n", 34, 34, 34, 34); write += StringUtils::Format("<WinampXML>\n"); write += StringUtils::Format(" <playlist num_entries=%c%i%c label=%c%s%c>\n", 34, m_vecItems.size(), 34, 34, m_strPlayListName.c_str(), 34); diff --git a/xbmc/playlists/PlayListB4S.h b/xbmc/playlists/PlayListB4S.h index f736190a22..d24b208b4d 100644 --- a/xbmc/playlists/PlayListB4S.h +++ b/xbmc/playlists/PlayListB4S.h @@ -30,6 +30,6 @@ public: CPlayListB4S(void); virtual ~CPlayListB4S(void); virtual bool LoadData(std::istream& stream); - virtual void Save(const CStdString& strFileName) const; + virtual void Save(const std::string& strFileName) const; }; } diff --git a/xbmc/playlists/PlayListFactory.cpp b/xbmc/playlists/PlayListFactory.cpp index c92a754a2b..9e9e83e4a2 100644 --- a/xbmc/playlists/PlayListFactory.cpp +++ b/xbmc/playlists/PlayListFactory.cpp @@ -30,7 +30,7 @@ using namespace PLAYLIST; -CPlayList* CPlayListFactory::Create(const CStdString& filename) +CPlayList* CPlayListFactory::Create(const std::string& filename) { CFileItem item(filename,false); return Create(item); @@ -44,7 +44,7 @@ CPlayList* CPlayListFactory::Create(const CFileItem& item) if (item.GetMimeType().empty()) const_cast<CFileItem&>(item).FillInMimeType(); - CStdString strMimeType = item.GetMimeType(); + std::string strMimeType = item.GetMimeType(); StringUtils::ToLower(strMimeType); if (strMimeType == "video/x-ms-asf" @@ -72,7 +72,7 @@ CPlayList* CPlayListFactory::Create(const CFileItem& item) return new CPlayListWPL(); } - CStdString extension = URIUtils::GetExtension(item.GetPath()); + std::string extension = URIUtils::GetExtension(item.GetPath()); StringUtils::ToLower(extension); if (extension == ".m3u" || extension == ".strm") @@ -105,7 +105,7 @@ CPlayList* CPlayListFactory::Create(const CFileItem& item) bool CPlayListFactory::IsPlaylist(const CFileItem& item) { - CStdString strMimeType = item.GetMimeType(); + std::string strMimeType = item.GetMimeType(); StringUtils::ToLower(strMimeType); /* These are abit uncertain @@ -138,7 +138,7 @@ bool CPlayListFactory::IsPlaylist(const CURL& url) ".m3u|.b4s|.pls|.strm|.wpl|.asx|.ram|.url|.pxml"); } -bool CPlayListFactory::IsPlaylist(const CStdString& filename) +bool CPlayListFactory::IsPlaylist(const std::string& filename) { return URIUtils::HasExtension(filename, ".m3u|.b4s|.pls|.strm|.wpl|.asx|.ram|.url|.pxml"); diff --git a/xbmc/playlists/PlayListFactory.h b/xbmc/playlists/PlayListFactory.h index 7b9a3db67c..0bd57f6423 100644 --- a/xbmc/playlists/PlayListFactory.h +++ b/xbmc/playlists/PlayListFactory.h @@ -19,7 +19,7 @@ * */ -#include "utils/StdString.h" +#include <string> class CFileItem; class CURL; @@ -31,10 +31,10 @@ namespace PLAYLIST class CPlayListFactory { public: - static CPlayList* Create(const CStdString& filename); + static CPlayList* Create(const std::string& filename); static CPlayList* Create(const CFileItem& item); static bool IsPlaylist(const CURL& url); - static bool IsPlaylist(const CStdString& filename); + static bool IsPlaylist(const std::string& filename); static bool IsPlaylist(const CFileItem& item); }; } diff --git a/xbmc/playlists/PlayListM3U.cpp b/xbmc/playlists/PlayListM3U.cpp index 69b2ff79ee..ae198b8439 100644 --- a/xbmc/playlists/PlayListM3U.cpp +++ b/xbmc/playlists/PlayListM3U.cpp @@ -67,11 +67,11 @@ CPlayListM3U::~CPlayListM3U(void) {} -bool CPlayListM3U::Load(const CStdString& strFileName) +bool CPlayListM3U::Load(const std::string& strFileName) { char szLine[4096]; - CStdString strLine; - CStdString strInfo = ""; + std::string strLine; + std::string strInfo; long lDuration = 0; Clear(); @@ -102,7 +102,7 @@ bool CPlayListM3U::Load(const CStdString& strFileName) { // Read the info and duration iColon++; - CStdString strLength = strLine.substr(iColon, iComma - iColon); + std::string strLength = strLine.substr(iColon, iComma - iColon); lDuration = atoi(strLength.c_str()); iComma++; strInfo = strLine.substr(iComma); @@ -113,13 +113,14 @@ bool CPlayListM3U::Load(const CStdString& strFileName) !StringUtils::StartsWith(strLine, M3U_ARTIST_MARKER) && !StringUtils::StartsWith(strLine, M3U_ALBUM_MARKER)) { - CStdString strFileName = strLine; + std::string strFileName = strLine; if (strFileName.size() > 0 && strFileName[0] == '#') continue; // assume a comment or something else we don't support // Skip self - do not load playlist recursively - if (URIUtils::GetFileName(strFileName).Equals(m_strPlayListName)) + // We compare case-less in case user has input incorrect case of the current playlist + if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strFileName), m_strPlayListName)) continue; if (strFileName.length() > 0) @@ -155,27 +156,27 @@ bool CPlayListM3U::Load(const CStdString& strFileName) return true; } -void CPlayListM3U::Save(const CStdString& strFileName) const +void CPlayListM3U::Save(const std::string& strFileName) const { if (!m_vecItems.size()) return; - CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); + std::string strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist,true)) { CLog::Log(LOGERROR, "Could not save M3U playlist: [%s]", strPlaylist.c_str()); return; } - CStdString strLine = StringUtils::Format("%s\n",M3U_START_MARKER); + std::string 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(); + std::string strDescription=item->GetLabel(); g_charsetConverter.utf8ToStringCharset(strDescription); 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); + std::string strFileName = ResolveURL(item); g_charsetConverter.utf8ToStringCharset(strFileName); strLine = StringUtils::Format("%s\n",strFileName.c_str()); file.Write(strLine.c_str(),strLine.size()); @@ -183,13 +184,13 @@ void CPlayListM3U::Save(const CStdString& strFileName) const file.Close(); } -CStdString CPlayListM3U::GetBestBandwidthStream(const CStdString &strFileName, size_t bandwidth) +std::string CPlayListM3U::GetBestBandwidthStream(const std::string &strFileName, size_t bandwidth) { // we may be passed a playlist that does not contain playlists of different // bitrates (eg: this playlist is really the HLS video). So, default the // return to the filename so it can be played char szLine[4096]; - CStdString strLine; + std::string strLine; size_t maxBandwidth = 0; // open the file, and if it fails, return @@ -210,7 +211,7 @@ CStdString CPlayListM3U::GetBestBandwidthStream(const CStdString &strFileName, s CURL basePlaylistUrl(URIUtils::GetParentPath(strFileName)); basePlaylistUrl.SetOptions(""); basePlaylistUrl.SetProtocolOptions(""); - CStdString basePart = basePlaylistUrl.Get(); + std::string basePart = basePlaylistUrl.Get(); // convert bandwidth specified in kbps to bps used by the m3u8 bandwidth *= 1000; @@ -227,8 +228,8 @@ CStdString CPlayListM3U::GetBestBandwidthStream(const CStdString &strFileName, s else if (StringUtils::StartsWith(strLine, M3U_STREAM_MARKER)) { // parse the line so we can pull out the bandwidth - std::map< CStdString, CStdString > params = ParseStreamLine(strLine); - std::map< CStdString, CStdString >::iterator it = params.find(M3U_BANDWIDTH_MARKER); + std::map< std::string, std::string > params = ParseStreamLine(strLine); + std::map< std::string, std::string >::iterator it = params.find(M3U_BANDWIDTH_MARKER); if (it != params.end()) { @@ -264,16 +265,16 @@ CStdString CPlayListM3U::GetBestBandwidthStream(const CStdString &strFileName, s return subStreamUrl.Get(); } -std::map< CStdString, CStdString > CPlayListM3U::ParseStreamLine(const CStdString &streamLine) +std::map< std::string, std::string > CPlayListM3U::ParseStreamLine(const std::string &streamLine) { - std::map< CStdString, CStdString > params; + std::map< std::string, std::string > params; // ensure the line has something beyond the stream marker and ':' - if (strlen(streamLine) < strlen(M3U_STREAM_MARKER) + 2) + if (streamLine.size() < strlen(M3U_STREAM_MARKER) + 2) return params; // get the actual params following the : - CStdString strParams(streamLine.substr(strlen(M3U_STREAM_MARKER) + 1)); + std::string strParams(streamLine.substr(strlen(M3U_STREAM_MARKER) + 1)); // separate the parameters std::vector<std::string> vecParams = StringUtils::Split(strParams, ","); diff --git a/xbmc/playlists/PlayListM3U.h b/xbmc/playlists/PlayListM3U.h index f1edcb380c..4ecfb0ba82 100644 --- a/xbmc/playlists/PlayListM3U.h +++ b/xbmc/playlists/PlayListM3U.h @@ -28,13 +28,13 @@ class CPlayListM3U : public: CPlayListM3U(void); virtual ~CPlayListM3U(void); - virtual bool Load(const CStdString& strFileName); - virtual void Save(const CStdString& strFileName) const; + virtual bool Load(const std::string& strFileName); + virtual void Save(const std::string& strFileName) const; - static CStdString GetBestBandwidthStream(const CStdString &strFileName, size_t bandwidth); + static std::string GetBestBandwidthStream(const std::string &strFileName, size_t bandwidth); protected: - static std::map< CStdString, CStdString > ParseStreamLine(const CStdString &streamLine); + static std::map<std::string,std::string> ParseStreamLine(const std::string &streamLine); }; } diff --git a/xbmc/playlists/PlayListPLS.cpp b/xbmc/playlists/PlayListPLS.cpp index 3c1d624d3a..1058908af1 100644 --- a/xbmc/playlists/PlayListPLS.cpp +++ b/xbmc/playlists/PlayListPLS.cpp @@ -35,7 +35,7 @@ using namespace std; using namespace XFILE; using namespace PLAYLIST; -#define START_PLAYLIST_MARKER "[playlist]" +#define START_PLAYLIST_MARKER "[playlist]" // may be case-insentive (equivalent to .ini file on win32) #define PLAYLIST_NAME "PlaylistName" /*---------------------------------------------------------------------- @@ -56,10 +56,10 @@ CPlayListPLS::CPlayListPLS(void) CPlayListPLS::~CPlayListPLS(void) {} -bool CPlayListPLS::Load(const CStdString &strFile) +bool CPlayListPLS::Load(const std::string &strFile) { //read it from the file - CStdString strFileName(strFile); + std::string strFileName(strFile); m_strPlayListName = URIUtils::GetFileName(strFileName); Clear(); @@ -88,7 +88,7 @@ bool CPlayListPLS::Load(const CStdString &strFile) } char szLine[4096]; - CStdString strLine; + std::string strLine; // run through looking for the [playlist] marker. // if we find another http stream, then load it. @@ -101,7 +101,7 @@ bool CPlayListPLS::Load(const CStdString &strFile) } strLine = szLine; StringUtils::Trim(strLine); - if(strLine.Equals(START_PLAYLIST_MARKER)) + if(StringUtils::EqualsNoCase(strLine, START_PLAYLIST_MARKER)) break; // if there is something else before playlist marker, this isn't a pls file @@ -117,9 +117,9 @@ bool CPlayListPLS::Load(const CStdString &strFile) size_t iPosEqual = strLine.find("="); if (iPosEqual != std::string::npos) { - CStdString strLeft = strLine.substr(0, iPosEqual); + std::string strLeft = strLine.substr(0, iPosEqual); iPosEqual++; - CStdString strValue = strLine.substr(iPosEqual); + std::string strValue = strLine.substr(iPosEqual); StringUtils::ToLower(strLeft); StringUtils::TrimLeft(strLeft); @@ -137,7 +137,8 @@ bool CPlayListPLS::Load(const CStdString &strFile) } // Skip self - do not load playlist recursively - if (URIUtils::GetFileName(strValue).Equals(URIUtils::GetFileName(strFileName))) + if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strValue), + URIUtils::GetFileName(strFileName))) continue; if (m_vecItems[idx - 1]->GetLabel().empty()) @@ -204,28 +205,28 @@ bool CPlayListPLS::Load(const CStdString &strFile) return true; } -void CPlayListPLS::Save(const CStdString& strFileName) const +void CPlayListPLS::Save(const std::string& strFileName) const { if (!m_vecItems.size()) return ; - CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); + std::string strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save PLS playlist: [%s]", strPlaylist.c_str()); return; } - CStdString write; + std::string write; write += StringUtils::Format("%s\n", START_PLAYLIST_MARKER); - CStdString strPlayListName=m_strPlayListName; + std::string strPlayListName=m_strPlayListName; g_charsetConverter.utf8ToStringCharset(strPlayListName); write += StringUtils::Format("PlaylistName=%s\n", strPlayListName.c_str() ); for (int i = 0; i < (int)m_vecItems.size(); ++i) { CFileItemPtr item = m_vecItems[i]; - CStdString strFileName=item->GetPath(); + std::string strFileName=item->GetPath(); g_charsetConverter.utf8ToStringCharset(strFileName); - CStdString strDescription=item->GetLabel(); + std::string strDescription=item->GetLabel(); g_charsetConverter.utf8ToStringCharset(strDescription); write += StringUtils::Format("File%i=%s\n", i + 1, strFileName.c_str() ); write += StringUtils::Format("Title%i=%s\n", i + 1, strDescription.c_str() ); @@ -304,7 +305,7 @@ bool CPlayListASX::LoadData(istream& stream) // lowercase every element TiXmlNode *pNode = pRootElement; TiXmlNode *pChild = NULL; - CStdString value; + std::string value; value = pNode->Value(); StringUtils::ToLower(value); pNode->SetValue(value); @@ -337,7 +338,7 @@ bool CPlayListASX::LoadData(istream& stream) pChild = pNode; pNode = pNode->Parent(); } - CStdString roottitle = ""; + std::string roottitle; TiXmlElement *pElement = pRootElement->FirstChildElement(); while (pElement) { @@ -348,7 +349,7 @@ bool CPlayListASX::LoadData(istream& stream) } else if (value == "entry") { - CStdString title(roottitle); + std::string title(roottitle); TiXmlElement *pRef = pElement->FirstChildElement("ref"); TiXmlElement *pTitle = pElement->FirstChildElement("title"); @@ -396,7 +397,7 @@ bool CPlayListRAM::LoadData(istream& stream) { CLog::Log(LOGINFO, "Parsing RAM"); - CStdString strMMS; + std::string strMMS; while( stream.peek() != '\n' && stream.peek() != '\r' ) strMMS += stream.get(); diff --git a/xbmc/playlists/PlayListPLS.h b/xbmc/playlists/PlayListPLS.h index d6dc59a5da..49769c4f92 100644 --- a/xbmc/playlists/PlayListPLS.h +++ b/xbmc/playlists/PlayListPLS.h @@ -28,8 +28,8 @@ class CPlayListPLS : public: CPlayListPLS(void); virtual ~CPlayListPLS(void); - virtual bool Load(const CStdString& strFileName); - virtual void Save(const CStdString& strFileName) const; + virtual bool Load(const std::string& strFileName); + virtual void Save(const std::string& strFileName) const; virtual bool Resize(std::vector<int>::size_type newSize); }; diff --git a/xbmc/playlists/PlayListURL.cpp b/xbmc/playlists/PlayListURL.cpp index ade2ed2ba9..51793b56b3 100644 --- a/xbmc/playlists/PlayListURL.cpp +++ b/xbmc/playlists/PlayListURL.cpp @@ -38,10 +38,10 @@ CPlayListURL::CPlayListURL(void) CPlayListURL::~CPlayListURL(void) {} -bool CPlayListURL::Load(const CStdString& strFileName) +bool CPlayListURL::Load(const std::string& strFileName) { char szLine[4096]; - CStdString strLine; + std::string strLine; Clear(); diff --git a/xbmc/playlists/PlayListURL.h b/xbmc/playlists/PlayListURL.h index 23c6a792e6..813e8c5d38 100644 --- a/xbmc/playlists/PlayListURL.h +++ b/xbmc/playlists/PlayListURL.h @@ -28,6 +28,6 @@ class CPlayListURL : public: CPlayListURL(void); virtual ~CPlayListURL(void); - virtual bool Load(const CStdString& strFileName); + virtual bool Load(const std::string& strFileName); }; } diff --git a/xbmc/playlists/PlayListWPL.cpp b/xbmc/playlists/PlayListWPL.cpp index 851ac8f526..4426048ec8 100644 --- a/xbmc/playlists/PlayListWPL.cpp +++ b/xbmc/playlists/PlayListWPL.cpp @@ -90,12 +90,12 @@ bool CPlayListWPL::LoadData(istream& stream) if (!pMediaElement) return false; while (pMediaElement) { - CStdString strFileName = XMLUtils::GetAttribute(pMediaElement, "src"); + std::string strFileName = XMLUtils::GetAttribute(pMediaElement, "src"); if (!strFileName.empty()) { - strFileName = URIUtils::SubstitutePath(strFileName); + std::string strFileName = URIUtils::SubstitutePath(strFileName); CUtil::GetQualifiedFilename(m_strBasePath, strFileName); - CStdString strDescription = URIUtils::GetFileName(strFileName); + std::string strDescription = URIUtils::GetFileName(strFileName); CFileItemPtr newItem(new CFileItem(strDescription)); newItem->SetPath(strFileName); Add(newItem); @@ -105,17 +105,17 @@ bool CPlayListWPL::LoadData(istream& stream) return true; } -void CPlayListWPL::Save(const CStdString& strFileName) const +void CPlayListWPL::Save(const std::string& strFileName) const { if (!m_vecItems.size()) return ; - CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); + std::string strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save WPL playlist: [%s]", strPlaylist.c_str()); return ; } - CStdString write; + std::string write; write += StringUtils::Format("<?wpl version=%c1.0%c>\n", 34, 34); write += StringUtils::Format("<smil>\n"); write += StringUtils::Format(" <head>\n"); diff --git a/xbmc/playlists/PlayListWPL.h b/xbmc/playlists/PlayListWPL.h index 4c130af143..bf5ec89002 100644 --- a/xbmc/playlists/PlayListWPL.h +++ b/xbmc/playlists/PlayListWPL.h @@ -30,6 +30,6 @@ public: CPlayListWPL(void); virtual ~CPlayListWPL(void); virtual bool LoadData(std::istream& stream); - virtual void Save(const CStdString& strFileName) const; + virtual void Save(const std::string& strFileName) const; }; } diff --git a/xbmc/playlists/PlayListXML.cpp b/xbmc/playlists/PlayListXML.cpp index 3ca9623f7a..66bea084b3 100644 --- a/xbmc/playlists/PlayListXML.cpp +++ b/xbmc/playlists/PlayListXML.cpp @@ -70,16 +70,16 @@ CPlayListXML::~CPlayListXML(void) {} -static inline CStdString GetString( const TiXmlElement* pRootElement, const char *tagName ) +static inline std::string GetString( const TiXmlElement* pRootElement, const char *tagName ) { - CStdString strValue; + std::string strValue; if ( XMLUtils::GetString(pRootElement, tagName, strValue) ) return strValue; return ""; } -bool CPlayListXML::Load( const CStdString& strFileName ) +bool CPlayListXML::Load( const std::string& strFileName ) { CXBMCTinyXML xmlDoc; @@ -109,12 +109,12 @@ bool CPlayListXML::Load( const CStdString& strFileName ) while ( pSet ) { // Get parameters - CStdString url = GetString( pSet, "url" ); - CStdString name = GetString( pSet, "name" ); - CStdString category = GetString( pSet, "category" ); - CStdString lang = GetString( pSet, "lang" ); - CStdString channel = GetString( pSet, "channel" ); - CStdString lockpass = GetString( pSet, "lockpassword" ); + std::string url = GetString( pSet, "url" ); + std::string name = GetString( pSet, "name" ); + std::string category = GetString( pSet, "category" ); + std::string lang = GetString( pSet, "lang" ); + std::string channel = GetString( pSet, "channel" ); + std::string lockpass = GetString( pSet, "lockpassword" ); // If url is empty, it doesn't make any sense if ( !url.empty() ) @@ -127,7 +127,7 @@ bool CPlayListXML::Load( const CStdString& strFileName ) if ( !lang.empty() ) name += " [" + lang + "]"; - CStdString info = name; + std::string info = name; CFileItemPtr newItem( new CFileItem(info) ); newItem->SetPath(url); @@ -165,17 +165,17 @@ bool CPlayListXML::Load( const CStdString& strFileName ) } -void CPlayListXML::Save(const CStdString& strFileName) const +void CPlayListXML::Save(const std::string& strFileName) const { if (!m_vecItems.size()) return ; - CStdString strPlaylist = CUtil::MakeLegalPath(strFileName); + std::string strPlaylist = CUtil::MakeLegalPath(strFileName); CFile file; if (!file.OpenForWrite(strPlaylist, true)) { CLog::Log(LOGERROR, "Could not save WPL playlist: [%s]", strPlaylist.c_str()); return ; } - CStdString write; + std::string write; write += StringUtils::Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); write += StringUtils::Format("<streams>\n"); for (int i = 0; i < (int)m_vecItems.size(); ++i) diff --git a/xbmc/playlists/PlayListXML.h b/xbmc/playlists/PlayListXML.h index 60a0541551..8917f37a2e 100644 --- a/xbmc/playlists/PlayListXML.h +++ b/xbmc/playlists/PlayListXML.h @@ -28,7 +28,7 @@ class CPlayListXML : public: CPlayListXML(void); virtual ~CPlayListXML(void); - virtual bool Load(const CStdString& strFileName); - virtual void Save(const CStdString& strFileName) const; + virtual bool Load(const std::string& strFileName); + virtual void Save(const std::string& strFileName) const; }; } diff --git a/xbmc/playlists/SmartPlayList.cpp b/xbmc/playlists/SmartPlayList.cpp index 40284a5fd6..95ba99c4ca 100644 --- a/xbmc/playlists/SmartPlayList.cpp +++ b/xbmc/playlists/SmartPlayList.cpp @@ -154,7 +154,7 @@ int CSmartPlaylistRule::TranslateField(const char *field) const return FieldNone; } -CStdString CSmartPlaylistRule::TranslateField(int field) const +std::string CSmartPlaylistRule::TranslateField(int field) const { for (unsigned int i = 0; i < NUM_FIELDS; i++) if (field == fields[i].field) return fields[i].string; @@ -168,7 +168,7 @@ SortBy CSmartPlaylistRule::TranslateOrder(const char *order) return SortByNone; } -CStdString CSmartPlaylistRule::TranslateOrder(SortBy order) +std::string CSmartPlaylistRule::TranslateOrder(SortBy order) { for (unsigned int i = 0; i < NUM_FIELDS; i++) if (order == fields[i].sort) return fields[i].string; @@ -186,7 +186,7 @@ Field CSmartPlaylistRule::TranslateGroup(const char *group) return FieldUnknown; } -CStdString CSmartPlaylistRule::TranslateGroup(Field group) +std::string CSmartPlaylistRule::TranslateGroup(Field group) { for (unsigned int i = 0; i < NUM_GROUPS; i++) { @@ -197,7 +197,7 @@ CStdString CSmartPlaylistRule::TranslateGroup(Field group) return ""; } -CStdString CSmartPlaylistRule::GetLocalizedField(int field) +std::string CSmartPlaylistRule::GetLocalizedField(int field) { for (unsigned int i = 0; i < NUM_FIELDS; i++) if (field == fields[i].field) return g_localizeStrings.Get(fields[i].localizedString); @@ -261,7 +261,7 @@ bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) rating >= 0.0 && rating <= 10.0; } -vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type) +vector<Field> CSmartPlaylistRule::GetFields(const std::string &type) { vector<Field> fields; bool isVideo = false; @@ -423,7 +423,7 @@ vector<Field> CSmartPlaylistRule::GetFields(const CStdString &type) return fields; } -std::vector<SortBy> CSmartPlaylistRule::GetOrders(const CStdString &type) +std::vector<SortBy> CSmartPlaylistRule::GetOrders(const std::string &type) { vector<SortBy> orders; orders.push_back(SortByNone); @@ -533,7 +533,7 @@ std::vector<SortBy> CSmartPlaylistRule::GetOrders(const CStdString &type) return orders; } -std::vector<Field> CSmartPlaylistRule::GetGroups(const CStdString &type) +std::vector<Field> CSmartPlaylistRule::GetGroups(const std::string &type) { vector<Field> groups; groups.push_back(FieldUnknown); @@ -578,7 +578,7 @@ std::vector<Field> CSmartPlaylistRule::GetGroups(const CStdString &type) return groups; } -CStdString CSmartPlaylistRule::GetLocalizedGroup(Field group) +std::string CSmartPlaylistRule::GetLocalizedGroup(Field group) { for (unsigned int i = 0; i < NUM_GROUPS; i++) { @@ -600,14 +600,14 @@ bool CSmartPlaylistRule::CanGroupMix(Field group) return false; } -CStdString CSmartPlaylistRule::GetLocalizedRule() const +std::string CSmartPlaylistRule::GetLocalizedRule() const { 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 +std::string CSmartPlaylistRule::GetVideoResolutionQuery(const std::string ¶meter) const { - CStdString retVal(" IN (SELECT DISTINCT idFile FROM streamdetails WHERE iVideoWidth "); + std::string retVal(" IN (SELECT DISTINCT idFile FROM streamdetails WHERE iVideoWidth "); int iRes = (int)strtol(parameter.c_str(), NULL, 10); int min, max; @@ -638,7 +638,7 @@ CStdString CSmartPlaylistRule::GetVideoResolutionQuery(const CStdString ¶met return retVal; } -CStdString CSmartPlaylistRule::GetBooleanQuery(const CStdString &negate, const CStdString &strType) const +std::string CSmartPlaylistRule::GetBooleanQuery(const std::string &negate, const std::string &strType) const { if (strType == "movies") { @@ -665,7 +665,7 @@ CStdString CSmartPlaylistRule::GetBooleanQuery(const CStdString &negate, const C return ""; } -CDatabaseQueryRule::SEARCH_OPERATOR CSmartPlaylistRule::GetOperator(const CStdString &strType) const +CDatabaseQueryRule::SEARCH_OPERATOR CSmartPlaylistRule::GetOperator(const std::string &strType) const { SEARCH_OPERATOR op = CDatabaseQueryRule::GetOperator(strType); if ((strType == "tvshows" || strType == "episodes") && m_field == FieldYear) @@ -679,24 +679,24 @@ CDatabaseQueryRule::SEARCH_OPERATOR CSmartPlaylistRule::GetOperator(const CStdSt return op; } -CStdString CSmartPlaylistRule::FormatParameter(const CStdString &operatorString, const CStdString ¶m, const CDatabase &db, const CStdString &strType) const +std::string CSmartPlaylistRule::FormatParameter(const std::string &operatorString, const std::string ¶m, const CDatabase &db, const std::string &strType) const { // special-casing if (m_field == FieldTime) { // translate time to seconds - CStdString seconds = StringUtils::Format("%i", StringUtils::TimeStringToSeconds(param)); + std::string seconds = StringUtils::Format("%i", StringUtils::TimeStringToSeconds(param)); return db.PrepareSQL(operatorString.c_str(), seconds.c_str()); } return CDatabaseQueryRule::FormatParameter(operatorString, param, db, strType); } -CStdString CSmartPlaylistRule::FormatWhereClause(const CStdString &negate, const CStdString &oper, const CStdString ¶m, - const CDatabase &db, const CStdString &strType) const +std::string CSmartPlaylistRule::FormatWhereClause(const std::string &negate, const std::string &oper, const std::string ¶m, + const CDatabase &db, const std::string &strType) const { - CStdString parameter = FormatParameter(oper, param, db, strType); + std::string parameter = FormatParameter(oper, param, db, strType); - CStdString query; - CStdString table; + std::string query; + std::string table; if (strType == "songs") { table = "songview"; @@ -826,7 +826,7 @@ CStdString CSmartPlaylistRule::FormatWhereClause(const CStdString &negate, const (m_operator == OPERATOR_DOES_NOT_EQUAL && param != "0") || (m_operator == OPERATOR_LESS_THAN)) { - CStdString field = GetField(FieldPlaycount, strType); + std::string field = GetField(FieldPlaycount, strType); query = field + " IS NULL OR " + field + parameter; } } @@ -835,16 +835,16 @@ CStdString CSmartPlaylistRule::FormatWhereClause(const CStdString &negate, const return query; } -CStdString CSmartPlaylistRule::GetField(int field, const CStdString &type) const +std::string CSmartPlaylistRule::GetField(int field, const std::string &type) const { if (field >= FieldUnknown && field < FieldMax) return DatabaseUtils::GetField((Field)field, MediaTypes::FromString(type), DatabaseQueryPartWhere); return ""; } -CStdString CSmartPlaylistRuleCombination::GetWhereClause(const CDatabase &db, const CStdString& strType, std::set<CStdString> &referencedPlaylists) const +std::string CSmartPlaylistRuleCombination::GetWhereClause(const CDatabase &db, const std::string& strType, std::set<std::string> &referencedPlaylists) const { - CStdString rule, currentRule; + std::string rule, currentRule; // translate the combinations into SQL for (CDatabaseQueryRuleCombinations::const_iterator it = m_combinations.begin(); it != m_combinations.end(); ++it) @@ -867,24 +867,24 @@ CStdString CSmartPlaylistRuleCombination::GetWhereClause(const CDatabase &db, co if (!rule.empty()) rule += m_type == CombinationAnd ? " AND " : " OR "; rule += "("; - CStdString currentRule; + std::string currentRule; if ((*it)->m_field == FieldPlaylist) { - CStdString playlistFile = CSmartPlaylistDirectory::GetPlaylistByName((*it)->m_parameter.at(0), strType); + std::string playlistFile = CSmartPlaylistDirectory::GetPlaylistByName((*it)->m_parameter.at(0), strType); if (!playlistFile.empty() && referencedPlaylists.find(playlistFile) == referencedPlaylists.end()) { referencedPlaylists.insert(playlistFile); CSmartPlaylist playlist; if (playlist.Load(playlistFile)) { - CStdString playlistQuery; + std::string playlistQuery; // only playlists of same type will be part of the query - if (playlist.GetType().Equals(strType) || (playlist.GetType().Equals("mixed") && (strType == "songs" || strType == "musicvideos")) || playlist.GetType().empty()) + if (playlist.GetType() == strType || (playlist.GetType() == "mixed" && (strType == "songs" || strType == "musicvideos")) || playlist.GetType().empty()) { playlist.SetType(strType); playlistQuery = playlist.GetWhereClause(db, referencedPlaylists); } - if (playlist.GetType().Equals(strType)) + if (playlist.GetType() == strType) { if ((*it)->m_operator == CDatabaseQueryRule::OPERATOR_DOES_NOT_EQUAL) currentRule = StringUtils::Format("NOT (%s)", playlistQuery.c_str()); @@ -906,7 +906,7 @@ CStdString CSmartPlaylistRuleCombination::GetWhereClause(const CDatabase &db, co return rule; } -void CSmartPlaylistRuleCombination::GetVirtualFolders(const CStdString& strType, std::vector<CStdString> &virtualFolders) const +void CSmartPlaylistRuleCombination::GetVirtualFolders(const std::string& strType, std::vector<std::string> &virtualFolders) const { for (CDatabaseQueryRuleCombinations::const_iterator it = m_combinations.begin(); it != m_combinations.end(); ++it) { @@ -920,7 +920,7 @@ void CSmartPlaylistRuleCombination::GetVirtualFolders(const CStdString& strType, if (((*it)->m_field != FieldVirtualFolder && (*it)->m_field != FieldPlaylist) || (*it)->m_operator != CDatabaseQueryRule::OPERATOR_EQUALS) continue; - CStdString playlistFile = CSmartPlaylistDirectory::GetPlaylistByName((*it)->m_parameter.at(0), strType); + std::string playlistFile = CSmartPlaylistDirectory::GetPlaylistByName((*it)->m_parameter.at(0), strType); if (playlistFile.empty()) continue; @@ -1012,7 +1012,7 @@ const TiXmlNode* CSmartPlaylist::readNameFromPath(const CURL &url) return root; } -const TiXmlNode* CSmartPlaylist::readNameFromXml(const CStdString &xml) +const TiXmlNode* CSmartPlaylist::readNameFromXml(const std::string &xml) { if (xml.empty()) { @@ -1045,7 +1045,7 @@ bool CSmartPlaylist::Load(const CURL &url) return load(readNameFromPath(url)); } -bool CSmartPlaylist::Load(const CStdString &path) +bool CSmartPlaylist::Load(const std::string &path) { const CURL pathToUrl(path); return load(readNameFromPath(pathToUrl)); @@ -1100,17 +1100,17 @@ bool CSmartPlaylist::Load(const CVariant &obj) return true; } -bool CSmartPlaylist::LoadFromXml(const CStdString &xml) +bool CSmartPlaylist::LoadFromXml(const std::string &xml) { return load(readNameFromXml(xml)); } -bool CSmartPlaylist::LoadFromXML(const TiXmlNode *root, const CStdString &encoding) +bool CSmartPlaylist::LoadFromXML(const TiXmlNode *root, const std::string &encoding) { if (!root) return false; - CStdString tmp; + std::string tmp; if (XMLUtils::GetString(root, "match", tmp)) m_ruleCombination.SetType(StringUtils::EqualsNoCase(tmp, "all") ? CSmartPlaylistRuleCombination::CombinationAnd : CSmartPlaylistRuleCombination::CombinationOr); @@ -1155,7 +1155,7 @@ bool CSmartPlaylist::LoadFromXML(const TiXmlNode *root, const CStdString &encodi return true; } -bool CSmartPlaylist::LoadFromJson(const CStdString &json) +bool CSmartPlaylist::LoadFromJson(const std::string &json) { if (json.empty()) return false; @@ -1164,7 +1164,7 @@ bool CSmartPlaylist::LoadFromJson(const CStdString &json) return Load(obj); } -bool CSmartPlaylist::Save(const CStdString &path) const +bool CSmartPlaylist::Save(const std::string &path) const { CXBMCTinyXML doc; TiXmlDeclaration decl("1.0", "UTF-8", "yes"); @@ -1251,7 +1251,7 @@ bool CSmartPlaylist::Save(CVariant &obj, bool full /* = true */) const return true; } -bool CSmartPlaylist::SaveAsJson(CStdString &json, bool full /* = true */) const +bool CSmartPlaylist::SaveAsJson(std::string &json, bool full /* = true */) const { CVariant xsp(CVariant::VariantTypeObject); if (!Save(xsp, full)) @@ -1273,12 +1273,12 @@ void CSmartPlaylist::Reset() m_groupMixed = false; } -void CSmartPlaylist::SetName(const CStdString &name) +void CSmartPlaylist::SetName(const std::string &name) { m_playlistName = name; } -void CSmartPlaylist::SetType(const CStdString &type) +void CSmartPlaylist::SetType(const std::string &type) { m_playlistType = type; } @@ -1293,29 +1293,29 @@ bool CSmartPlaylist::IsMusicType() const return IsMusicType(m_playlistType); } -bool CSmartPlaylist::IsVideoType(const CStdString &type) +bool CSmartPlaylist::IsVideoType(const std::string &type) { return type == "movies" || type == "tvshows" || type == "episodes" || type == "musicvideos" || type == "mixed"; } -bool CSmartPlaylist::IsMusicType(const CStdString &type) +bool CSmartPlaylist::IsMusicType(const std::string &type) { return type == "artists" || type == "albums" || type == "songs" || type == "mixed"; } -CStdString CSmartPlaylist::GetWhereClause(const CDatabase &db, set<CStdString> &referencedPlaylists) const +std::string CSmartPlaylist::GetWhereClause(const CDatabase &db, set<std::string> &referencedPlaylists) const { return m_ruleCombination.GetWhereClause(db, GetType(), referencedPlaylists); } -void CSmartPlaylist::GetVirtualFolders(std::vector<CStdString> &virtualFolders) const +void CSmartPlaylist::GetVirtualFolders(std::vector<std::string> &virtualFolders) const { m_ruleCombination.GetVirtualFolders(GetType(), virtualFolders); } -CStdString CSmartPlaylist::GetSaveLocation() const +std::string CSmartPlaylist::GetSaveLocation() const { if (m_playlistType == "mixed") return "mixed"; @@ -1347,17 +1347,17 @@ bool CSmartPlaylist::IsEmpty(bool ignoreSortAndLimit /* = true */) const return empty; } -bool CSmartPlaylist::CheckTypeCompatibility(const CStdString &typeLeft, const CStdString &typeRight) +bool CSmartPlaylist::CheckTypeCompatibility(const std::string &typeLeft, const std::string &typeRight) { - if (typeLeft.Equals(typeRight)) + if (typeLeft == typeRight) return true; - if (typeLeft.Equals("mixed") && - (typeRight.Equals("songs") || typeRight.Equals("musicvideos"))) + if (typeLeft == "mixed" && + (typeRight == "songs" || typeRight == "musicvideos")) return true; - if (typeRight.Equals("mixed") && - (typeLeft.Equals("songs") || typeLeft.Equals("musicvideos"))) + if (typeRight == "mixed" && + (typeLeft == "songs" || typeLeft == "musicvideos")) return true; return false; diff --git a/xbmc/playlists/SmartPlayList.h b/xbmc/playlists/SmartPlayList.h index e88cde5d77..5d8187a7df 100644 --- a/xbmc/playlists/SmartPlayList.h +++ b/xbmc/playlists/SmartPlayList.h @@ -20,12 +20,12 @@ */ #include <set> +#include <string> #include <vector> #include <boost/shared_ptr.hpp> #include "dbwrappers/DatabaseQuery.h" #include "utils/SortUtils.h" -#include "utils/StdString.h" #include "utils/XBMCTinyXML.h" class CURL; @@ -37,20 +37,20 @@ public: CSmartPlaylistRule(); virtual ~CSmartPlaylistRule() { } - CStdString GetLocalizedRule() const; + std::string GetLocalizedRule() const; static SortBy TranslateOrder(const char *order); - static CStdString TranslateOrder(SortBy order); + static std::string TranslateOrder(SortBy order); static Field TranslateGroup(const char *group); - static CStdString TranslateGroup(Field group); + static std::string TranslateGroup(Field group); - static CStdString GetLocalizedField(int field); - static CStdString GetLocalizedGroup(Field group); + static std::string GetLocalizedField(int field); + static std::string GetLocalizedGroup(Field group); static bool CanGroupMix(Field group); - static std::vector<Field> GetFields(const CStdString &type); - static std::vector<SortBy> GetOrders(const CStdString &type); - static std::vector<Field> GetGroups(const CStdString &type); + static std::vector<Field> GetFields(const std::string &type); + static std::vector<SortBy> GetOrders(const std::string &type); + static std::vector<Field> GetGroups(const std::string &type); virtual FIELD_TYPE GetFieldType(int field) const; static bool IsFieldBrowseable(int field); @@ -58,17 +58,24 @@ public: static bool ValidateRating(const std::string &input, void *data); protected: - virtual CStdString GetField(int field, const CStdString& type) const; + virtual std::string GetField(int field, const std::string& type) const; virtual int TranslateField(const char *field) const; - virtual CStdString TranslateField(int field) const; - virtual CStdString FormatParameter(const CStdString &negate, const CStdString &oper, const CDatabase &db, const CStdString &type) const; - virtual CStdString FormatWhereClause(const CStdString &negate, const CStdString &oper, const CStdString ¶m, - const CDatabase &db, const CStdString &type) const; - virtual SEARCH_OPERATOR GetOperator(const CStdString &type) const; - virtual CStdString GetBooleanQuery(const CStdString &negate, const CStdString &strType) const; + virtual std::string TranslateField(int field) const; + virtual std::string FormatParameter(const std::string &negate, + const std::string &oper, + const CDatabase &db, + const std::string &type) const; + virtual std::string FormatWhereClause(const std::string &negate, + const std::string& oper, + const std::string ¶m, + const CDatabase &db, + const std::string &type) const; + virtual SEARCH_OPERATOR GetOperator(const std::string &type) const; + virtual std::string GetBooleanQuery(const std::string &negate, + const std::string &strType) const; private: - CStdString GetVideoResolutionQuery(const CStdString ¶meter) const; + std::string GetVideoResolutionQuery(const std::string ¶meter) const; }; class CSmartPlaylistRuleCombination : public CDatabaseQueryRuleCombination @@ -77,8 +84,11 @@ public: CSmartPlaylistRuleCombination() { } virtual ~CSmartPlaylistRuleCombination() { } - CStdString GetWhereClause(const CDatabase &db, const CStdString& strType, std::set<CStdString> &referencedPlaylists) const; - void GetVirtualFolders(const CStdString& strType, std::vector<CStdString> &virtualFolders) const; + std::string GetWhereClause(const CDatabase &db, + const std::string& strType, + std::set<std::string> &referencedPlaylists) const; + void GetVirtualFolders(const std::string& strType, + std::vector<std::string> &virtualFolders) const; void AddRule(const CSmartPlaylistRule &rule); }; @@ -90,23 +100,23 @@ public: virtual ~CSmartPlaylist() { } bool Load(const CURL& url); - bool Load(const CStdString &path); + bool Load(const std::string &path); bool Load(const CVariant &obj); - bool LoadFromXml(const CStdString &xml); - bool LoadFromJson(const CStdString &json); - bool Save(const CStdString &path) const; + bool LoadFromXml(const std::string &xml); + bool LoadFromJson(const std::string &json); + bool Save(const std::string &path) const; bool Save(CVariant &obj, bool full = true) const; - bool SaveAsJson(CStdString &json, bool full = true) const; + bool SaveAsJson(std::string &json, bool full = true) const; bool OpenAndReadName(const CURL &url); - bool LoadFromXML(const TiXmlNode *root, const CStdString &encoding = "UTF-8"); + bool LoadFromXML(const TiXmlNode *root, const std::string &encoding = "UTF-8"); void Reset(); - void SetName(const CStdString &name); - void SetType(const CStdString &type); // music, video, mixed - const CStdString& GetName() const { return m_playlistName; }; - const CStdString& GetType() const { return m_playlistType; }; + void SetName(const std::string &name); + void SetType(const std::string &type); // music, video, mixed + const std::string& GetName() const { return m_playlistName; }; + const std::string& GetType() const { return m_playlistType; }; bool IsVideoType() const; bool IsMusicType() const; @@ -124,8 +134,8 @@ public: void SetOrderAttributes(SortAttribute attributes) { m_orderAttributes = attributes; } SortAttribute GetOrderAttributes() const { return m_orderAttributes; } - void SetGroup(const CStdString &group) { m_group = group; } - const CStdString& GetGroup() const { return m_group; } + void SetGroup(const std::string &group) { m_group = group; } + const std::string& GetGroup() const { return m_group; } void SetGroupMixed(bool mixed) { m_groupMixed = mixed; } bool IsGroupMixed() const { return m_groupMixed; } @@ -137,16 +147,16 @@ public: \param referencedPlaylists a set of playlists to know when we reach a cycle \param needWhere whether we need to prepend the where clause with "WHERE " */ - CStdString GetWhereClause(const CDatabase &db, std::set<CStdString> &referencedPlaylists) const; - void GetVirtualFolders(std::vector<CStdString> &virtualFolders) const; + std::string GetWhereClause(const CDatabase &db, std::set<std::string> &referencedPlaylists) const; + void GetVirtualFolders(std::vector<std::string> &virtualFolders) const; - CStdString GetSaveLocation() const; + std::string GetSaveLocation() const; static void GetAvailableFields(const std::string &type, std::vector<std::string> &fieldList); - static bool IsVideoType(const CStdString &type); - static bool IsMusicType(const CStdString &type); - static bool CheckTypeCompatibility(const CStdString &typeLeft, const CStdString &typeRight); + static bool IsVideoType(const std::string &type); + static bool IsMusicType(const std::string &type); + static bool CheckTypeCompatibility(const std::string &typeLeft, const std::string &typeRight); bool IsEmpty(bool ignoreSortAndLimit = true) const; @@ -159,19 +169,19 @@ private: const TiXmlNode* readName(const TiXmlNode *root); const TiXmlNode* readNameFromPath(const CURL &url); - const TiXmlNode* readNameFromXml(const CStdString &xml); + const TiXmlNode* readNameFromXml(const std::string &xml); bool load(const TiXmlNode *root); CSmartPlaylistRuleCombination m_ruleCombination; - CStdString m_playlistName; - CStdString m_playlistType; + std::string m_playlistName; + std::string m_playlistType; // order information unsigned int m_limit; SortBy m_orderField; SortOrder m_orderDirection; SortAttribute m_orderAttributes; - CStdString m_group; + std::string m_group; bool m_groupMixed; CXBMCTinyXML m_xmlDoc; diff --git a/xbmc/programs/GUIViewStatePrograms.cpp b/xbmc/programs/GUIViewStatePrograms.cpp index f9cc9a37ff..55a9f06c75 100644 --- a/xbmc/programs/GUIViewStatePrograms.cpp +++ b/xbmc/programs/GUIViewStatePrograms.cpp @@ -48,12 +48,12 @@ void CGUIViewStateWindowPrograms::SaveViewState() SaveViewToDb(m_items.GetPath(), WINDOW_PROGRAMS, CViewStateSettings::Get().Get("programs")); } -CStdString CGUIViewStateWindowPrograms::GetLockType() +std::string CGUIViewStateWindowPrograms::GetLockType() { return "programs"; } -CStdString CGUIViewStateWindowPrograms::GetExtensions() +std::string CGUIViewStateWindowPrograms::GetExtensions() { return ".xbe|.cut"; } diff --git a/xbmc/programs/GUIViewStatePrograms.h b/xbmc/programs/GUIViewStatePrograms.h index 9065a935b7..a78143ccc1 100644 --- a/xbmc/programs/GUIViewStatePrograms.h +++ b/xbmc/programs/GUIViewStatePrograms.h @@ -29,8 +29,8 @@ public: protected: virtual void SaveViewState(); - virtual CStdString GetLockType(); - virtual CStdString GetExtensions(); + virtual std::string GetLockType(); + virtual std::string GetExtensions(); virtual VECSOURCES& GetSources(); }; diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index fedf3d81a6..009dd7c4c1 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -1175,8 +1175,8 @@ bool CPVRManager::UpdateItem(CFileItem& item) videotag->m_genre = epgTagNow.Genre(); videotag->m_strPath = channelTag->Path(); videotag->m_strFileNameAndPath = channelTag->Path(); - videotag->m_strPlot = bHasTagNow ? epgTagNow.Plot() : StringUtils::EmptyString; - videotag->m_strPlotOutline = bHasTagNow ? epgTagNow.PlotOutline() : StringUtils::EmptyString; + videotag->m_strPlot = bHasTagNow ? epgTagNow.Plot() : ""; + videotag->m_strPlotOutline = bHasTagNow ? epgTagNow.PlotOutline() : ""; videotag->m_iEpisode = bHasTagNow ? epgTagNow.EpisodeNum() : 0; } } diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index 3ced2ca024..ad60a5b946 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -62,7 +62,7 @@ bool CPVRClients::IsInUse(const std::string& strAddonId) const CSingleLock lock(m_critSection); for (PVR_CLIENTMAP_CITR itr = m_clientMap.begin(); itr != m_clientMap.end(); itr++) - if (itr->second->Enabled() && itr->second->ID().Equals(strAddonId.c_str())) + if (itr->second->Enabled() && itr->second->ID() == strAddonId) return true; return false; } diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp index 1be33b8c98..4c3957d433 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp @@ -32,6 +32,7 @@ #include "settings/Settings.h" #include "GUIInfoManager.h" #include "cores/IPlayer.h" +#include "utils/StringUtils.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp index 308309eedd..8725096c36 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp @@ -24,6 +24,7 @@ #include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/LocalizeStrings.h" +#include "utils/StringUtils.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" diff --git a/xbmc/settings/SettingAddon.cpp b/xbmc/settings/SettingAddon.cpp index c3415fabc4..c065a03f5a 100644 --- a/xbmc/settings/SettingAddon.cpp +++ b/xbmc/settings/SettingAddon.cpp @@ -24,6 +24,7 @@ #include "utils/log.h" #include "utils/XBMCTinyXML.h" #include "utils/XMLUtils.h" +#include "utils/StdString.h" #define XML_ELM_DEFAULT "default" diff --git a/xbmc/storage/AutorunMediaJob.cpp b/xbmc/storage/AutorunMediaJob.cpp index f1982e07c4..df1cfd34e0 100644 --- a/xbmc/storage/AutorunMediaJob.cpp +++ b/xbmc/storage/AutorunMediaJob.cpp @@ -25,7 +25,7 @@ #include "guilib/Key.h" #include "utils/StringUtils.h" -CAutorunMediaJob::CAutorunMediaJob(const CStdString &label, const CStdString &path) +CAutorunMediaJob::CAutorunMediaJob(const std::string &label, const std::string &path) { m_label = label; m_path = path; @@ -54,7 +54,7 @@ bool CAutorunMediaJob::DoWork() int selection = pDialog->GetSelectedLabel(); if (selection >= 0) { - CStdString strAction = StringUtils::Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str()); + std::string strAction = StringUtils::Format("ActivateWindow(%s, %s)", GetWindowString(selection), m_path.c_str()); CBuiltins::Execute(strAction); } diff --git a/xbmc/storage/AutorunMediaJob.h b/xbmc/storage/AutorunMediaJob.h index 0e4c098c55..69acf8a43b 100644 --- a/xbmc/storage/AutorunMediaJob.h +++ b/xbmc/storage/AutorunMediaJob.h @@ -19,17 +19,17 @@ * */ #include "system.h" -#include "utils/StdString.h" +#include <string> #include "utils/Job.h" class CAutorunMediaJob : public CJob { public: - CAutorunMediaJob(const CStdString &label, const CStdString &path); + CAutorunMediaJob(const std::string &label, const std::string &path); virtual bool DoWork(); private: const char *GetWindowString(int selection); - CStdString m_path, m_label; + std::string m_path, m_label; }; diff --git a/xbmc/storage/DetectDVDType.cpp b/xbmc/storage/DetectDVDType.cpp index 07939f3caf..23e7f75b8d 100644 --- a/xbmc/storage/DetectDVDType.cpp +++ b/xbmc/storage/DetectDVDType.cpp @@ -61,8 +61,8 @@ int CDetectDVDMedia::m_DriveState = DRIVE_CLOSED_NO_MEDIA; CCdInfo* CDetectDVDMedia::m_pCdInfo = NULL; time_t CDetectDVDMedia::m_LastPoll = 0; CDetectDVDMedia* CDetectDVDMedia::m_pInstance = NULL; -CStdString CDetectDVDMedia::m_diskLabel = ""; -CStdString CDetectDVDMedia::m_diskPath = ""; +std::string CDetectDVDMedia::m_diskLabel = ""; +std::string CDetectDVDMedia::m_diskPath = ""; CDetectDVDMedia::CDetectDVDMedia() : CThread("DetectDVDMedia") { @@ -221,7 +221,7 @@ void CDetectDVDMedia::DetectMediaType() bool bCDDA(false); CLog::Log(LOGINFO, "Detecting DVD-ROM media filesystem..."); - CStdString strNewUrl; + std::string strNewUrl; CCdIoSupport cdio; // Delete old CD-Information @@ -287,7 +287,7 @@ void CDetectDVDMedia::DetectMediaType() CLog::Log(LOGWARNING, "Filesystem is not supported"); } - CStdString strLabel = ""; + std::string strLabel; if (bCDDA) { strLabel = "Audio-CD"; @@ -301,9 +301,9 @@ void CDetectDVDMedia::DetectMediaType() SetNewDVDShareUrl( strNewUrl , bCDDA, strLabel); } -void CDetectDVDMedia::SetNewDVDShareUrl( const CStdString& strNewUrl, bool bCDDA, const CStdString& strDiscLabel ) +void CDetectDVDMedia::SetNewDVDShareUrl( const std::string& strNewUrl, bool bCDDA, const std::string& strDiscLabel ) { - CStdString strDescription = "DVD"; + std::string strDescription = "DVD"; if (bCDDA) strDescription = "CD"; if (strDiscLabel != "") strDescription = strDiscLabel; @@ -490,12 +490,12 @@ CCdInfo* CDetectDVDMedia::GetCdInfo() return pCdInfo; } -const CStdString &CDetectDVDMedia::GetDVDLabel() +const std::string &CDetectDVDMedia::GetDVDLabel() { return m_diskLabel; } -const CStdString &CDetectDVDMedia::GetDVDPath() +const std::string &CDetectDVDMedia::GetDVDPath() { return m_diskPath; } diff --git a/xbmc/storage/DetectDVDType.h b/xbmc/storage/DetectDVDType.h index bdca12afc6..b1cfd9aa08 100644 --- a/xbmc/storage/DetectDVDType.h +++ b/xbmc/storage/DetectDVDType.h @@ -35,8 +35,8 @@ #include "threads/CriticalSection.h" #include "threads/Thread.h" -#include "utils/StdString.h" #include "boost/shared_ptr.hpp" +#include <string> namespace MEDIA_DETECT { @@ -59,8 +59,8 @@ public: static CCdInfo* GetCdInfo(); static CEvent m_evAutorun; - static const CStdString &GetDVDLabel(); - static const CStdString &GetDVDPath(); + static const std::string &GetDVDLabel(); + static const std::string &GetDVDPath(); static void UpdateState(); protected: @@ -69,7 +69,7 @@ protected: void DetectMediaType(); - void SetNewDVDShareUrl( const CStdString& strNewUrl, bool bCDDA, const CStdString& strDiscLabel ); + void SetNewDVDShareUrl( const std::string& strNewUrl, bool bCDDA, const std::string& strDiscLabel ); private: static CCriticalSection m_muReadingMedia; @@ -86,8 +86,8 @@ private: DWORD m_dwTrayCount; DWORD m_dwLastTrayState; - static CStdString m_diskLabel; - static CStdString m_diskPath; + static std::string m_diskLabel; + static std::string m_diskPath; boost::shared_ptr<CLibcdio> m_cdio; }; diff --git a/xbmc/storage/IStorageProvider.h b/xbmc/storage/IStorageProvider.h index 658edc3d7f..0325b0b9e5 100644 --- a/xbmc/storage/IStorageProvider.h +++ b/xbmc/storage/IStorageProvider.h @@ -29,9 +29,9 @@ class IStorageEventsCallback public: virtual ~IStorageEventsCallback() { } - virtual void OnStorageAdded(const CStdString &label, const CStdString &path) = 0; - virtual void OnStorageSafelyRemoved(const CStdString &label) = 0; - virtual void OnStorageUnsafelyRemoved(const CStdString &label) = 0; + virtual void OnStorageAdded(const std::string &label, const std::string &path) = 0; + virtual void OnStorageSafelyRemoved(const std::string &label) = 0; + virtual void OnStorageUnsafelyRemoved(const std::string &label) = 0; }; class IStorageProvider @@ -53,9 +53,9 @@ public: #endif } - virtual bool Eject(CStdString mountpath) = 0; + virtual bool Eject(const std::string& mountpath) = 0; - virtual std::vector<CStdString> GetDiskUsage() = 0; + virtual std::vector<std::string> GetDiskUsage() = 0; virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback) = 0; }; diff --git a/xbmc/storage/IoSupport.cpp b/xbmc/storage/IoSupport.cpp index 85e9391d85..2da58847ee 100644 --- a/xbmc/storage/IoSupport.cpp +++ b/xbmc/storage/IoSupport.cpp @@ -83,7 +83,7 @@ HANDLE CIoSupport::OpenCDROM() hDevice->fd = fd; hDevice->m_bCDROM = true; #elif defined(TARGET_WINDOWS) - hDevice = CreateFile(g_mediaManager.TranslateDevicePath("",true), GENERIC_READ, FILE_SHARE_READ, + hDevice = CreateFile(g_mediaManager.TranslateDevicePath("",true).c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL ); #else diff --git a/xbmc/storage/MediaManager.cpp b/xbmc/storage/MediaManager.cpp index 9cd68e6bfc..57b28ee99b 100644 --- a/xbmc/storage/MediaManager.cpp +++ b/xbmc/storage/MediaManager.cpp @@ -227,7 +227,7 @@ void CMediaManager::GetNetworkLocations(VECSOURCES &locations, bool autolocation } } -bool CMediaManager::AddNetworkLocation(const CStdString &path) +bool CMediaManager::AddNetworkLocation(const std::string &path) { CNetworkLocation location; location.path = path; @@ -236,7 +236,7 @@ bool CMediaManager::AddNetworkLocation(const CStdString &path) return SaveSources(); } -bool CMediaManager::HasLocation(const CStdString& path) const +bool CMediaManager::HasLocation(const std::string& path) const { for (unsigned int i=0;i<m_locations.size();++i) { @@ -248,7 +248,7 @@ bool CMediaManager::HasLocation(const CStdString& path) const } -bool CMediaManager::RemoveLocation(const CStdString& path) +bool CMediaManager::RemoveLocation(const std::string& path) { for (unsigned int i=0;i<m_locations.size();++i) { @@ -263,7 +263,7 @@ bool CMediaManager::RemoveLocation(const CStdString& path) return false; } -bool CMediaManager::SetLocationPath(const CStdString& oldPath, const CStdString& newPath) +bool CMediaManager::SetLocationPath(const std::string& oldPath, const std::string& newPath) { for (unsigned int i=0;i<m_locations.size();++i) { @@ -313,10 +313,10 @@ void CMediaManager::RemoveAutoSource(const CMediaSource &share) // AutoSource status functions: // - TODO: translate cdda://<device>/ -CStdString CMediaManager::TranslateDevicePath(const CStdString& devicePath, bool bReturnAsDevice) +std::string CMediaManager::TranslateDevicePath(const std::string& devicePath, bool bReturnAsDevice) { CSingleLock waitLock(m_muAutoSource); - CStdString strDevice = devicePath; + std::string strDevice = devicePath; // fallback for cdda://local/ and empty devicePath #ifdef HAS_DVD_DRIVE if(devicePath.empty() || StringUtils::StartsWith(devicePath, "cdda://local")) @@ -337,15 +337,15 @@ CStdString CMediaManager::TranslateDevicePath(const CStdString& devicePath, bool return strDevice; } -bool CMediaManager::IsDiscInDrive(const CStdString& devicePath) +bool CMediaManager::IsDiscInDrive(const std::string& devicePath) { #ifdef HAS_DVD_DRIVE #ifdef TARGET_WINDOWS if(!m_bhasoptical) return false; - CStdString strDevice = TranslateDevicePath(devicePath, true); - std::map<CStdString,CCdInfo*>::iterator it; + std::string strDevice = TranslateDevicePath(devicePath, true); + std::map<std::string,CCdInfo*>::iterator it; CSingleLock waitLock(m_muAutoSource); it = m_mapCdInfo.find(strDevice); if(it != m_mapCdInfo.end()) @@ -363,7 +363,7 @@ bool CMediaManager::IsDiscInDrive(const CStdString& devicePath) #endif } -bool CMediaManager::IsAudio(const CStdString& devicePath) +bool CMediaManager::IsAudio(const std::string& devicePath) { #ifdef HAS_DVD_DRIVE #ifdef TARGET_WINDOWS @@ -394,14 +394,14 @@ bool CMediaManager::HasOpticalDrive() return false; } -DWORD CMediaManager::GetDriveStatus(const CStdString& devicePath) +DWORD CMediaManager::GetDriveStatus(const std::string& devicePath) { #ifdef HAS_DVD_DRIVE #ifdef TARGET_WINDOWS if(!m_bhasoptical) return DRIVE_NOT_READY; - CStdString strDevice = TranslateDevicePath(devicePath, true); + std::string strDevice = TranslateDevicePath(devicePath, true); DWORD dwRet = DRIVE_NOT_READY; int status = CWIN32Util::GetDriveStatus(strDevice); @@ -430,14 +430,14 @@ DWORD CMediaManager::GetDriveStatus(const CStdString& devicePath) } #ifdef HAS_DVD_DRIVE -CCdInfo* CMediaManager::GetCdInfo(const CStdString& devicePath) +CCdInfo* CMediaManager::GetCdInfo(const std::string& devicePath) { #ifdef TARGET_WINDOWS if(!m_bhasoptical) return NULL; - CStdString strDevice = TranslateDevicePath(devicePath, true); - std::map<CStdString,CCdInfo*>::iterator it; + std::string strDevice = TranslateDevicePath(devicePath, true); + std::map<std::string,CCdInfo*>::iterator it; { CSingleLock waitLock(m_muAutoSource); it = m_mapCdInfo.find(strDevice); @@ -451,7 +451,7 @@ CCdInfo* CMediaManager::GetCdInfo(const CStdString& devicePath) if(pCdInfo!=NULL) { CSingleLock waitLock(m_muAutoSource); - m_mapCdInfo.insert(std::pair<CStdString,CCdInfo*>(strDevice,pCdInfo)); + m_mapCdInfo.insert(std::pair<std::string,CCdInfo*>(strDevice,pCdInfo)); } return pCdInfo; @@ -460,14 +460,14 @@ CCdInfo* CMediaManager::GetCdInfo(const CStdString& devicePath) #endif } -bool CMediaManager::RemoveCdInfo(const CStdString& devicePath) +bool CMediaManager::RemoveCdInfo(const std::string& devicePath) { if(!m_bhasoptical) return false; - CStdString strDevice = TranslateDevicePath(devicePath, true); + std::string strDevice = TranslateDevicePath(devicePath, true); - std::map<CStdString,CCdInfo*>::iterator it; + std::map<std::string,CCdInfo*>::iterator it; CSingleLock waitLock(m_muAutoSource); it = m_mapCdInfo.find(strDevice); if(it != m_mapCdInfo.end()) @@ -481,17 +481,19 @@ bool CMediaManager::RemoveCdInfo(const CStdString& devicePath) return false; } -CStdString CMediaManager::GetDiskLabel(const CStdString& devicePath) +std::string CMediaManager::GetDiskLabel(const std::string& devicePath) { #ifdef TARGET_WINDOWS if(!m_bhasoptical) return ""; - CStdString strDevice = TranslateDevicePath(devicePath); + std::string strDevice = TranslateDevicePath(devicePath); WCHAR cVolumenName[128]; WCHAR cFSName[128]; URIUtils::AddSlashAtEnd(strDevice); - if(GetVolumeInformationW(CStdStringW(strDevice).c_str(), cVolumenName, 127, NULL, NULL, NULL, cFSName, 127)==0) + std::wstring strDeviceW; + g_charsetConverter.utf8ToW(strDevice, strDeviceW); + if(GetVolumeInformationW(strDeviceW.c_str(), cVolumenName, 127, NULL, NULL, NULL, cFSName, 127)==0) return ""; g_charsetConverter.wToUTF8(cVolumenName, strDevice); return StringUtils::TrimRight(strDevice, " "); @@ -500,9 +502,9 @@ CStdString CMediaManager::GetDiskLabel(const CStdString& devicePath) #endif } -CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath) +std::string CMediaManager::GetDiskUniqueId(const std::string& devicePath) { - CStdString mediaPath; + std::string mediaPath; CCdInfo* pInfo = g_mediaManager.GetCdInfo(devicePath); if (pInfo == NULL) @@ -526,7 +528,7 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath) #endif // Try finding VIDEO_TS/VIDEO_TS.IFO - this indicates a DVD disc is inserted - CStdString pathVideoTS = URIUtils::AddFileToFolder(mediaPath, "VIDEO_TS"); + std::string pathVideoTS = URIUtils::AddFileToFolder(mediaPath, "VIDEO_TS"); if(!CFile::Exists(URIUtils::AddFileToFolder(pathVideoTS, "VIDEO_TS.IFO"))) return ""; // return empty @@ -539,19 +541,19 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath) CDVDInputStreamNavigator dvdNavigator(NULL); - dvdNavigator.Open(pathVideoTS, ""); - CStdString labelString; + dvdNavigator.Open(pathVideoTS.c_str(), ""); + std::string labelString; dvdNavigator.GetDVDTitleString(labelString); - CStdString serialString; + std::string serialString; dvdNavigator.GetDVDSerialString(serialString); - CStdString strID = StringUtils::Format("removable://%s_%s", labelString.c_str(), serialString.c_str()); + std::string 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; } -CStdString CMediaManager::GetDiscPath() +std::string CMediaManager::GetDiscPath() { #ifdef TARGET_WINDOWS return g_mediaManager.TranslateDevicePath(""); @@ -578,7 +580,7 @@ void CMediaManager::SetHasOpticalDrive(bool bstatus) m_bhasoptical = bstatus; } -bool CMediaManager::Eject(CStdString mountpath) +bool CMediaManager::Eject(const std::string& mountpath) { CSingleLock lock(m_CritSecStorageProvider); return m_platformStorage->Eject(mountpath); @@ -666,13 +668,13 @@ void CMediaManager::ProcessEvents() } } -std::vector<CStdString> CMediaManager::GetDiskUsage() +std::vector<std::string> CMediaManager::GetDiskUsage() { CSingleLock lock(m_CritSecStorageProvider); return m_platformStorage->GetDiskUsage(); } -void CMediaManager::OnStorageAdded(const CStdString &label, const CStdString &path) +void CMediaManager::OnStorageAdded(const std::string &label, const std::string &path) { #ifdef HAS_DVD_DRIVE if (CSettings::Get().GetInt("audiocds.autoaction") != AUTOCD_NONE || CSettings::Get().GetBool("dvds.autorun")) @@ -685,12 +687,12 @@ void CMediaManager::OnStorageAdded(const CStdString &label, const CStdString &pa #endif } -void CMediaManager::OnStorageSafelyRemoved(const CStdString &label) +void CMediaManager::OnStorageSafelyRemoved(const std::string &label) { CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(13023), label, TOAST_DISPLAY_TIME, false); } -void CMediaManager::OnStorageUnsafelyRemoved(const CStdString &label) +void CMediaManager::OnStorageUnsafelyRemoved(const std::string &label) { CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(13022), label); } diff --git a/xbmc/storage/MediaManager.h b/xbmc/storage/MediaManager.h index 8bafd4f667..a2c71a5ec0 100644 --- a/xbmc/storage/MediaManager.h +++ b/xbmc/storage/MediaManager.h @@ -41,7 +41,7 @@ class CNetworkLocation public: CNetworkLocation() { id = 0; }; int id; - CStdString path; + std::string path; }; class CMediaManager : public IStorageEventsCallback, public IJobCallback @@ -59,39 +59,39 @@ public: void GetRemovableDrives(VECSOURCES &removableDrives); void GetNetworkLocations(VECSOURCES &locations, bool autolocations = true); - bool AddNetworkLocation(const CStdString &path); - bool HasLocation(const CStdString& path) const; - bool RemoveLocation(const CStdString& path); - bool SetLocationPath(const CStdString& oldPath, const CStdString& newPath); + bool AddNetworkLocation(const std::string &path); + bool HasLocation(const std::string& path) const; + bool RemoveLocation(const std::string& path); + bool SetLocationPath(const std::string& oldPath, const std::string& newPath); void AddAutoSource(const CMediaSource &share, bool bAutorun=false); void RemoveAutoSource(const CMediaSource &share); - bool IsDiscInDrive(const CStdString& devicePath=""); - bool IsAudio(const CStdString& devicePath=""); + bool IsDiscInDrive(const std::string& devicePath=""); + bool IsAudio(const std::string& devicePath=""); bool HasOpticalDrive(); - CStdString TranslateDevicePath(const CStdString& devicePath, bool bReturnAsDevice=false); - DWORD GetDriveStatus(const CStdString& devicePath=""); + std::string TranslateDevicePath(const std::string& devicePath, bool bReturnAsDevice=false); + DWORD GetDriveStatus(const std::string& devicePath=""); #ifdef HAS_DVD_DRIVE - MEDIA_DETECT::CCdInfo* GetCdInfo(const CStdString& devicePath=""); - bool RemoveCdInfo(const CStdString& devicePath=""); - CStdString GetDiskLabel(const CStdString& devicePath=""); - CStdString GetDiskUniqueId(const CStdString& devicePath=""); + MEDIA_DETECT::CCdInfo* GetCdInfo(const std::string& devicePath=""); + bool RemoveCdInfo(const std::string& devicePath=""); + std::string GetDiskLabel(const std::string& devicePath=""); + std::string GetDiskUniqueId(const std::string& devicePath=""); #endif - CStdString GetDiscPath(); + std::string GetDiscPath(); void SetHasOpticalDrive(bool bstatus); - bool Eject(CStdString mountpath); + bool Eject(const std::string& mountpath); void EjectTray( const bool bEject=true, const char cDriveLetter='\0' ); void CloseTray(const char cDriveLetter='\0'); void ToggleTray(const char cDriveLetter='\0'); void ProcessEvents(); - std::vector<CStdString> GetDiskUsage(); + std::vector<std::string> GetDiskUsage(); - virtual void OnStorageAdded(const CStdString &label, const CStdString &path); - virtual void OnStorageSafelyRemoved(const CStdString &label); - virtual void OnStorageUnsafelyRemoved(const CStdString &label); + virtual void OnStorageAdded(const std::string &label, const std::string &path); + virtual void OnStorageSafelyRemoved(const std::string &label); + virtual void OnStorageUnsafelyRemoved(const std::string &label); virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job) { } protected: @@ -99,10 +99,10 @@ protected: CCriticalSection m_muAutoSource, m_CritSecStorageProvider; #ifdef HAS_DVD_DRIVE - std::map<CStdString,MEDIA_DETECT::CCdInfo*> m_mapCdInfo; + std::map<std::string,MEDIA_DETECT::CCdInfo*> m_mapCdInfo; #endif bool m_bhasoptical; - CStdString m_strFirstAvailDrive; + std::string m_strFirstAvailDrive; private: IStorageProvider *m_platformStorage; diff --git a/xbmc/storage/android/AndroidStorageProvider.cpp b/xbmc/storage/android/AndroidStorageProvider.cpp index 636f4cb5f3..8fcd43d159 100644 --- a/xbmc/storage/android/AndroidStorageProvider.cpp +++ b/xbmc/storage/android/AndroidStorageProvider.cpp @@ -194,9 +194,9 @@ void CAndroidStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) } } -std::vector<CStdString> CAndroidStorageProvider::GetDiskUsage() +std::vector<std::string> CAndroidStorageProvider::GetDiskUsage() { - std::vector<CStdString> result; + std::vector<std::string> result; std::string usage; // add header @@ -228,7 +228,7 @@ std::vector<CStdString> CAndroidStorageProvider::GetDiskUsage() return result; } -bool CAndroidStorageProvider::Eject(CStdString mountpath) +bool CAndroidStorageProvider::Eject(const std::string& mountpath) { return false; } diff --git a/xbmc/storage/android/AndroidStorageProvider.h b/xbmc/storage/android/AndroidStorageProvider.h index 0ffe2a546d..876d478f98 100644 --- a/xbmc/storage/android/AndroidStorageProvider.h +++ b/xbmc/storage/android/AndroidStorageProvider.h @@ -33,9 +33,9 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives); virtual void GetRemovableDrives(VECSOURCES &removableDrives); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); diff --git a/xbmc/storage/cdioSupport.cpp b/xbmc/storage/cdioSupport.cpp index 801627dd85..366ed9cc36 100644 --- a/xbmc/storage/cdioSupport.cpp +++ b/xbmc/storage/cdioSupport.cpp @@ -275,11 +275,11 @@ HANDLE CCdIoSupport::OpenCDROM() return (HANDLE) cdio; } -HANDLE CCdIoSupport::OpenIMAGE( CStdString& strFilename ) +HANDLE CCdIoSupport::OpenIMAGE( std::string& strFilename ) { CSingleLock lock(*m_cdio); - CdIo* cdio = ::cdio_open(strFilename, DRIVER_UNKNOWN); + CdIo* cdio = ::cdio_open(strFilename.c_str(), DRIVER_UNKNOWN); return (HANDLE) cdio; } diff --git a/xbmc/storage/cdioSupport.h b/xbmc/storage/cdioSupport.h index b759c9a547..f5f6823dea 100644 --- a/xbmc/storage/cdioSupport.h +++ b/xbmc/storage/cdioSupport.h @@ -36,9 +36,9 @@ #include <cdio/cdio.h> #include "threads/CriticalSection.h" -#include "utils/StdString.h" #include "boost/shared_ptr.hpp" #include <map> +#include <string> namespace MEDIA_DETECT { @@ -98,7 +98,7 @@ typedef struct signature } signature_t; -typedef std::map<cdtext_field_t, CStdString> xbmc_cdtext_t; +typedef std::map<cdtext_field_t, std::string> xbmc_cdtext_t; typedef struct TRACKINFO { @@ -136,7 +136,7 @@ public: int GetAudioTrackCount() { return m_nNumAudio; } uint32_t GetCddbDiscId() { return m_ulCddbDiscId; } int GetDiscLength() { return m_nLength; } - CStdString GetDiscLabel(){ return m_strDiscLabel; } + std::string GetDiscLabel(){ return m_strDiscLabel; } // CD-ROM with ISO 9660 filesystem bool IsIso9660( int nTrack ) { return ((m_ti[nTrack - 1].nfsInfo & FS_MASK) == FS_ISO_9660); } @@ -234,7 +234,7 @@ public: bool HasCDDBInfo() { return m_bHasCDDBInfo; } void SetNoCDDBInfo() { m_bHasCDDBInfo = false; } - void SetDiscLabel(const CStdString& strDiscLabel){ m_strDiscLabel = strDiscLabel; } + void SetDiscLabel(const std::string& strDiscLabel){ m_strDiscLabel = strDiscLabel; } private: int m_nFirstData; /* # of first data track */ @@ -247,7 +247,7 @@ private: uint32_t m_ulCddbDiscId; int m_nLength; // Disclength can be used for cddb query, also see trackinfo.nFrames bool m_bHasCDDBInfo; - CStdString m_strDiscLabel; + std::string m_strDiscLabel; xbmc_cdtext_t m_cdtext; // CD-Text for this disc }; @@ -291,7 +291,7 @@ public: HRESULT CloseTray(); HANDLE OpenCDROM(); - HANDLE OpenIMAGE( CStdString& strFilename ); + HANDLE OpenIMAGE( std::string& strFilename ); INT ReadSector(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer); INT ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer); INT ReadSectorCDDA(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer); @@ -334,7 +334,7 @@ private: track_t m_nNumTracks; track_t m_nFirstTrackNum; - CStdString m_strDiscLabel; + std::string m_strDiscLabel; int m_nFirstData; /* # of first data track */ int m_nNumData; /* # of data tracks */ diff --git a/xbmc/storage/linux/DeviceKitDisksProvider.cpp b/xbmc/storage/linux/DeviceKitDisksProvider.cpp index d037dfe26c..db70c7202e 100644 --- a/xbmc/storage/linux/DeviceKitDisksProvider.cpp +++ b/xbmc/storage/linux/DeviceKitDisksProvider.cpp @@ -30,7 +30,7 @@ void CDeviceKitDiskDeviceOldAPI::Update() { CVariant properties = CDBusUtil::GetAll("org.freedesktop.DeviceKit.Disks", m_DeviceKitUDI.c_str(), "org.freedesktop.DeviceKit.Disks.Device"); - m_isFileSystem = CStdString(properties["id-usage"].asString()) == "filesystem"; + m_isFileSystem = properties["id-usage"].asString() == "filesystem"; if (m_isFileSystem) { m_UDI = properties["id-uuid"].asString(); @@ -63,7 +63,7 @@ void CDeviceKitDiskDeviceNewAPI::Update() { CVariant properties = CDBusUtil::GetAll("org.freedesktop.DeviceKit.Disks", m_DeviceKitUDI.c_str(), "org.freedesktop.DeviceKit.Disks.Device"); - m_isFileSystem = CStdString(properties["IdUsage"].asString()) == "filesystem"; + m_isFileSystem = properties["IdUsage"].asString() == "filesystem"; if (m_isFileSystem) { m_UDI = properties["IdUuid"].asString(); @@ -180,12 +180,12 @@ CMediaSource CDeviceKitDiskDevice::ToMediaShare() bool CDeviceKitDiskDevice::IsApproved() { - return (m_isFileSystem && m_isMounted && m_UDI.length() > 0 && (m_FileSystem.length() > 0 && !m_FileSystem.Equals("swap")) && !m_MountPath.Equals("/")) || m_isOptical; + return (m_isFileSystem && m_isMounted && m_UDI.length() > 0 && (m_FileSystem.length() > 0 && m_FileSystem != "swap") && m_MountPath != "/") || m_isOptical; } #define BOOL2SZ(b) ((b) ? "true" : "false") -CStdString CDeviceKitDiskDevice::toString() +std::string CDeviceKitDiskDevice::toString() { return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s " "IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s " @@ -240,28 +240,28 @@ void CDeviceKitDisksProvider::Initialize() CLog::Log(LOGDEBUG, "DeviceKit.Disks: DaemonVersion %i", m_DaemonVersion); CLog::Log(LOGDEBUG, "DeviceKit.Disks: Querying available devices"); - std::vector<CStdString> devices = EnumerateDisks(); + std::vector<std::string> devices = EnumerateDisks(); for (unsigned int i = 0; i < devices.size(); i++) DeviceAdded(devices[i].c_str(), NULL); } -bool CDeviceKitDisksProvider::Eject(CStdString mountpath) +bool CDeviceKitDisksProvider::Eject(const std::string& mountpath) { DeviceMap::iterator itr; - CStdString path(mountpath); + std::string path(mountpath); URIUtils::RemoveSlashAtEnd(path); for (itr = m_AvailableDevices.begin(); itr != m_AvailableDevices.end(); ++itr) { CDeviceKitDiskDevice *device = itr->second; - if (device->m_MountPath.Equals(path)) + if (device->m_MountPath == path) return device->UnMount(); } return false; } -std::vector<CStdString> CDeviceKitDisksProvider::GetDiskUsage() +std::vector<std::string> CDeviceKitDisksProvider::GetDiskUsage() { CPosixMountProvider legacy; return legacy.GetDiskUsage(); @@ -385,9 +385,9 @@ void CDeviceKitDisksProvider::DeviceChanged(const char *object, IStorageEventsCa } } -std::vector<CStdString> CDeviceKitDisksProvider::EnumerateDisks() +std::vector<std::string> CDeviceKitDisksProvider::EnumerateDisks() { - std::vector<CStdString> devices; + std::vector<std::string> devices; CDBusMessage message("org.freedesktop.DeviceKit.Disks", "/org/freedesktop/DeviceKit/Disks", "org.freedesktop.DeviceKit.Disks", "EnumerateDevices"); DBusMessage *reply = message.SendSystem(); if (reply) diff --git a/xbmc/storage/linux/DeviceKitDisksProvider.h b/xbmc/storage/linux/DeviceKitDisksProvider.h index 0398d3e872..2902fe5d2f 100644 --- a/xbmc/storage/linux/DeviceKitDisksProvider.h +++ b/xbmc/storage/linux/DeviceKitDisksProvider.h @@ -35,11 +35,11 @@ public: bool IsApproved(); - CStdString toString(); + std::string toString(); CMediaSource ToMediaShare(); - CStdString m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label; + std::string m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label; bool m_isMounted, m_isMountedByUs, m_isRemovable, m_isPartition, m_isFileSystem, m_isSystemInternal, m_isOptical; float m_PartitionSizeGiB; }; @@ -74,22 +74,22 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives) { GetDisks(localDrives, false); } virtual void GetRemovableDrives(VECSOURCES &removableDrives) { GetDisks(removableDrives, true); } - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); static bool HasDeviceKitDisks(); private: - typedef std::map<CStdString, CDeviceKitDiskDevice *> DeviceMap; - typedef std::pair<CStdString, CDeviceKitDiskDevice *> DevicePair; + typedef std::map<std::string, CDeviceKitDiskDevice *> DeviceMap; + typedef std::pair<std::string, CDeviceKitDiskDevice *> DevicePair; void DeviceAdded(const char *object, IStorageEventsCallback *callback); void DeviceRemoved(const char *object, IStorageEventsCallback *callback); void DeviceChanged(const char *object, IStorageEventsCallback *callback); - std::vector<CStdString> EnumerateDisks(); + std::vector<std::string> EnumerateDisks(); void GetDisks(VECSOURCES& devices, bool EnumerateRemovable); diff --git a/xbmc/storage/linux/HALProvider.cpp b/xbmc/storage/linux/HALProvider.cpp index 78e5459deb..2068f93e45 100644 --- a/xbmc/storage/linux/HALProvider.cpp +++ b/xbmc/storage/linux/HALProvider.cpp @@ -70,12 +70,12 @@ void CHALProvider::GetRemovableDrives(VECSOURCES &removableDrives) } } -bool CHALProvider::Eject(CStdString mountpath) +bool CHALProvider::Eject(const std::string& mountpath) { return g_HalManager.Eject(mountpath); } -std::vector<CStdString> CHALProvider::GetDiskUsage() +std::vector<std::string> CHALProvider::GetDiskUsage() { CPosixMountProvider legacy; return legacy.GetDiskUsage(); diff --git a/xbmc/storage/linux/HALProvider.h b/xbmc/storage/linux/HALProvider.h index 457014e296..a698039de5 100644 --- a/xbmc/storage/linux/HALProvider.h +++ b/xbmc/storage/linux/HALProvider.h @@ -33,9 +33,9 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives); virtual void GetRemovableDrives(VECSOURCES &removableDrives); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); private: diff --git a/xbmc/storage/linux/LinuxStorageProvider.h b/xbmc/storage/linux/LinuxStorageProvider.h index 097e04b064..99a4ec9e40 100644 --- a/xbmc/storage/linux/LinuxStorageProvider.h +++ b/xbmc/storage/linux/LinuxStorageProvider.h @@ -87,12 +87,12 @@ public: m_instance->GetRemovableDrives(removableDrives); } - virtual bool Eject(CStdString mountpath) + virtual bool Eject(const std::string& mountpath) { return m_instance->Eject(mountpath); } - virtual std::vector<CStdString> GetDiskUsage() + virtual std::vector<std::string> GetDiskUsage() { return m_instance->GetDiskUsage(); } diff --git a/xbmc/storage/linux/UDevProvider.cpp b/xbmc/storage/linux/UDevProvider.cpp index 73aa408d30..84c931f596 100644 --- a/xbmc/storage/linux/UDevProvider.cpp +++ b/xbmc/storage/linux/UDevProvider.cpp @@ -153,8 +153,11 @@ void CUDevProvider::GetDisks(VECSOURCES& disks, bool removable) (cdrom && strstr(cdrom,"1")) || (mountpoint && strstr(mountpoint, "/media/")))) { - const char *label = udev_device_get_property_value(device, "ID_FS_LABEL"); - if (!label) + const char *udev_label = udev_device_get_property_value(device, "ID_FS_LABEL"); + std::string label; + if (udev_label) + label = udev_label; + else label = URIUtils::GetFileName(mountpoint); CMediaSource share; @@ -179,7 +182,7 @@ void CUDevProvider::GetRemovableDrives(VECSOURCES &removableDrives) GetDisks(removableDrives, true); } -bool CUDevProvider::Eject(CStdString mountpath) +bool CUDevProvider::Eject(const std::string& mountpath) { // just go ahead and try to umount the disk // if it does umount, life is good, if not, no loss. @@ -192,7 +195,7 @@ bool CUDevProvider::Eject(CStdString mountpath) return false; } -std::vector<CStdString> CUDevProvider::GetDiskUsage() +std::vector<std::string> CUDevProvider::GetDiskUsage() { CPosixMountProvider legacy; return legacy.GetDiskUsage(); @@ -222,9 +225,12 @@ bool CUDevProvider::PumpDriveChangeEvents(IStorageEventsCallback *callback) const char *devtype = udev_device_get_devtype(dev); if (action) { - const char *label = udev_device_get_property_value(dev, "ID_FS_LABEL"); + std::string label; + const char *udev_label = udev_device_get_property_value(dev, "ID_FS_LABEL"); const char *mountpoint = get_mountpoint(udev_device_get_devnode(dev)); - if (!label) + if (udev_label) + label = udev_label; + else if (mountpoint) label = URIUtils::GetFileName(mountpoint); if (!strcmp(action, "add") && !strcmp(devtype, "partition")) diff --git a/xbmc/storage/linux/UDevProvider.h b/xbmc/storage/linux/UDevProvider.h index ecd6f87f62..35ae37e075 100644 --- a/xbmc/storage/linux/UDevProvider.h +++ b/xbmc/storage/linux/UDevProvider.h @@ -38,9 +38,9 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives); virtual void GetRemovableDrives(VECSOURCES &removableDrives); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); diff --git a/xbmc/storage/linux/UDisksProvider.cpp b/xbmc/storage/linux/UDisksProvider.cpp index dd1bf43588..02ff5fc17b 100644 --- a/xbmc/storage/linux/UDisksProvider.cpp +++ b/xbmc/storage/linux/UDisksProvider.cpp @@ -47,7 +47,7 @@ void CUDiskDevice::Update() { CVariant properties = CDBusUtil::GetAll("org.freedesktop.UDisks", m_DeviceKitUDI.c_str(), "org.freedesktop.UDisks.Device"); - m_isFileSystem = CStdString(properties["IdUsage"].asString()) == "filesystem"; + m_isFileSystem = properties["IdUsage"].asString() == "filesystem"; if (m_isFileSystem) { m_UDI = properties["IdUuid"].asString(); @@ -158,13 +158,13 @@ CMediaSource CUDiskDevice::ToMediaShare() bool CUDiskDevice::IsApproved() { - return (m_isFileSystem && m_isMounted && m_UDI.length() > 0 && (m_FileSystem.length() > 0 && !m_FileSystem.Equals("swap")) - && !m_MountPath.Equals("/") && !m_MountPath.Equals("/boot")) || m_isOptical; + return (m_isFileSystem && m_isMounted && m_UDI.length() > 0 && (m_FileSystem.length() > 0 && m_FileSystem != "swap") + && m_MountPath != "/" && m_MountPath != "/boot") || m_isOptical; } #define BOOL2SZ(b) ((b) ? "true" : "false") -CStdString CUDiskDevice::toString() +std::string CUDiskDevice::toString() { return StringUtils::Format("DeviceUDI %s: IsFileSystem %s HasFileSystem %s " "IsSystemInternal %s IsMounted %s IsRemovable %s IsPartition %s " @@ -224,28 +224,28 @@ void CUDisksProvider::Initialize() CLog::Log(LOGDEBUG, "UDisks: DaemonVersion %i", m_DaemonVersion); CLog::Log(LOGDEBUG, "UDisks: Querying available devices"); - std::vector<CStdString> devices = EnumerateDisks(); + std::vector<std::string> devices = EnumerateDisks(); for (unsigned int i = 0; i < devices.size(); i++) DeviceAdded(devices[i].c_str(), NULL); } -bool CUDisksProvider::Eject(CStdString mountpath) +bool CUDisksProvider::Eject(const std::string& mountpath) { DeviceMap::iterator itr; - CStdString path(mountpath); + std::string path(mountpath); URIUtils::RemoveSlashAtEnd(path); for (itr = m_AvailableDevices.begin(); itr != m_AvailableDevices.end(); ++itr) { CUDiskDevice *device = itr->second; - if (device->m_MountPath.Equals(path)) + if (device->m_MountPath == path) return device->UnMount(); } return false; } -std::vector<CStdString> CUDisksProvider::GetDiskUsage() +std::vector<std::string> CUDisksProvider::GetDiskUsage() { CPosixMountProvider legacy; return legacy.GetDiskUsage(); @@ -372,9 +372,9 @@ void CUDisksProvider::DeviceChanged(const char *object, IStorageEventsCallback * } } -std::vector<CStdString> CUDisksProvider::EnumerateDisks() +std::vector<std::string> CUDisksProvider::EnumerateDisks() { - std::vector<CStdString> devices; + std::vector<std::string> devices; CDBusMessage message("org.freedesktop.UDisks", "/org/freedesktop/UDisks", "org.freedesktop.UDisks", "EnumerateDevices"); DBusMessage *reply = message.SendSystem(); if (reply) diff --git a/xbmc/storage/linux/UDisksProvider.h b/xbmc/storage/linux/UDisksProvider.h index eaa4a4cf1f..572103fe2a 100644 --- a/xbmc/storage/linux/UDisksProvider.h +++ b/xbmc/storage/linux/UDisksProvider.h @@ -35,11 +35,11 @@ public: bool IsApproved(); - CStdString toString(); + std::string toString(); CMediaSource ToMediaShare(); - CStdString m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label; + std::string m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label; bool m_isMounted, m_isMountedByUs, m_isRemovable, m_isPartition, m_isFileSystem, m_isSystemInternal, m_isOptical; int64_t m_PartitionSize; }; @@ -56,22 +56,22 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives) { GetDisks(localDrives, false); } virtual void GetRemovableDrives(VECSOURCES &removableDrives) { GetDisks(removableDrives, true); } - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); static bool HasUDisks(); private: - typedef std::map<CStdString, CUDiskDevice *> DeviceMap; - typedef std::pair<CStdString, CUDiskDevice *> DevicePair; + typedef std::map<std::string, CUDiskDevice *> DeviceMap; + typedef std::pair<std::string, CUDiskDevice *> DevicePair; void DeviceAdded(const char *object, IStorageEventsCallback *callback); void DeviceRemoved(const char *object, IStorageEventsCallback *callback); void DeviceChanged(const char *object, IStorageEventsCallback *callback); - std::vector<CStdString> EnumerateDisks(); + std::vector<std::string> EnumerateDisks(); void GetDisks(VECSOURCES& devices, bool EnumerateRemovable); diff --git a/xbmc/storage/osx/DarwinStorageProvider.cpp b/xbmc/storage/osx/DarwinStorageProvider.cpp index 17c7a9c942..35dcdac3b7 100644 --- a/xbmc/storage/osx/DarwinStorageProvider.cpp +++ b/xbmc/storage/osx/DarwinStorageProvider.cpp @@ -20,7 +20,6 @@ #include "DarwinStorageProvider.h" #include "utils/RegExp.h" -#include "utils/StdString.h" #include "Util.h" #include "guilib/LocalizeStrings.h" @@ -67,7 +66,7 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives) { unsigned i, count = 0; struct statfs *buf = NULL; - CStdString mountpoint, devicepath; + std::string mountpoint, devicepath; count = getmntinfo(&buf, 0); for (i=0; i<count; i++) @@ -86,7 +85,7 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives) CMediaSource share; share.strPath = mountpoint; - Cocoa_GetVolumeNameFromMountPoint(mountpoint, share.strName); + Cocoa_GetVolumeNameFromMountPoint(mountpoint.c_str(), share.strName); share.m_ignore = true; localDrives.push_back(share); } @@ -109,7 +108,7 @@ void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) { unsigned i, count = 0; struct statfs *buf = NULL; - CStdString mountpoint, devicepath; + std::string mountpoint, devicepath; count = getmntinfo(&buf, 0); for (i=0; i<count; i++) @@ -128,7 +127,7 @@ void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) CMediaSource share; share.strPath = mountpoint; - Cocoa_GetVolumeNameFromMountPoint(mountpoint, share.strName); + Cocoa_GetVolumeNameFromMountPoint(mountpoint.c_str(), share.strName); share.m_ignore = true; removableDrives.push_back(share); } @@ -143,9 +142,9 @@ void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) #endif } -std::vector<CStdString> CDarwinStorageProvider::GetDiskUsage() +std::vector<std::string> CDarwinStorageProvider::GetDiskUsage() { - std::vector<CStdString> result; + std::vector<std::string> result; char line[1024]; #ifdef TARGET_DARWIN_IOS @@ -166,7 +165,7 @@ std::vector<CStdString> CDarwinStorageProvider::GetDiskUsage() return result; } -bool CDarwinStorageProvider::Eject(CStdString mountpath) +bool CDarwinStorageProvider::Eject(const std::string& mountpath) { return false; } diff --git a/xbmc/storage/osx/DarwinStorageProvider.h b/xbmc/storage/osx/DarwinStorageProvider.h index b751f3ee59..e337432241 100644 --- a/xbmc/storage/osx/DarwinStorageProvider.h +++ b/xbmc/storage/osx/DarwinStorageProvider.h @@ -18,7 +18,6 @@ * <http://www.gnu.org/licenses/>. * */ -#include "utils/StdString.h" #include "storage/IStorageProvider.h" class CDarwinStorageProvider : public IStorageProvider @@ -33,9 +32,9 @@ public: virtual void GetLocalDrives(VECSOURCES &localDrives); virtual void GetRemovableDrives(VECSOURCES &removableDrives); - virtual std::vector<CStdString> GetDiskUsage(void); + virtual std::vector<std::string> GetDiskUsage(void); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); diff --git a/xbmc/storage/windows/Win32StorageProvider.cpp b/xbmc/storage/windows/Win32StorageProvider.cpp index 2bedae51a2..a469b2a48b 100644 --- a/xbmc/storage/windows/Win32StorageProvider.cpp +++ b/xbmc/storage/windows/Win32StorageProvider.cpp @@ -67,7 +67,7 @@ std::string CWin32StorageProvider::GetFirstOpticalDeviceFileName() return CWIN32Util::GetFirstOpticalDrive(); } -bool CWin32StorageProvider::Eject(CStdString mountpath) +bool CWin32StorageProvider::Eject(const std::string& mountpath) { if (!mountpath.empty()) { @@ -76,7 +76,7 @@ bool CWin32StorageProvider::Eject(CStdString mountpath) return false; } -std::vector<CStdString> CWin32StorageProvider::GetDiskUsage() +std::vector<std::string > CWin32StorageProvider::GetDiskUsage() { return CWIN32Util::GetDiskUsage(); } @@ -88,7 +88,7 @@ bool CWin32StorageProvider::PumpDriveChangeEvents(IStorageEventsCallback *callba return b; } -CDetectDisc::CDetectDisc(const CStdString &strPath, const bool bautorun) +CDetectDisc::CDetectDisc(const std::string &strPath, const bool bautorun) : m_strPath(strPath), m_bautorun(bautorun) { } diff --git a/xbmc/storage/windows/Win32StorageProvider.h b/xbmc/storage/windows/Win32StorageProvider.h index 753ae22c12..2b123e9144 100644 --- a/xbmc/storage/windows/Win32StorageProvider.h +++ b/xbmc/storage/windows/Win32StorageProvider.h @@ -33,9 +33,9 @@ public: virtual void GetRemovableDrives(VECSOURCES &removableDrives); virtual std::string GetFirstOpticalDeviceFileName(); - virtual bool Eject(CStdString mountpath); + virtual bool Eject(const std::string& mountpath); - virtual std::vector<CStdString> GetDiskUsage(); + virtual std::vector<std::string> GetDiskUsage(); virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback); @@ -46,11 +46,11 @@ public: class CDetectDisc : public CJob { public: - CDetectDisc(const CStdString &strPath, const bool bautorun); + CDetectDisc(const std::string &strPath, const bool bautorun); bool DoWork(); private: - CStdString m_strPath; + std::string m_strPath; bool m_bautorun; }; diff --git a/xbmc/test/TestUtils.cpp b/xbmc/test/TestUtils.cpp index 32ca579264..1c8234aa51 100644 --- a/xbmc/test/TestUtils.cpp +++ b/xbmc/test/TestUtils.cpp @@ -40,7 +40,7 @@ public: { Delete(); } - bool Create(const CStdString &suffix) + bool Create(const std::string &suffix) { char tmp[MAX_PATH]; int fd; @@ -81,17 +81,17 @@ public: Close(); return CFile::Delete(m_ptempFilePath); }; - CStdString getTempFilePath() const + std::string getTempFilePath() const { return m_ptempFilePath; } - CStdString getTempFileDirectory() const + std::string getTempFileDirectory() const { return m_ptempFileDirectory; } private: - CStdString m_ptempFilePath; - CStdString m_ptempFileDirectory; + std::string m_ptempFilePath; + std::string m_ptempFileDirectory; }; CXBMCTestUtils::CXBMCTestUtils() @@ -112,7 +112,7 @@ std::string CXBMCTestUtils::ReferenceFilePath(const std::string& path) bool CXBMCTestUtils::SetReferenceFileBasePath() { - CStdString xbmcPath; + std::string xbmcPath; CUtil::GetHomePath(xbmcPath); if (xbmcPath.empty()) return false; @@ -124,7 +124,7 @@ bool CXBMCTestUtils::SetReferenceFileBasePath() return true; } -XFILE::CFile *CXBMCTestUtils::CreateTempFile(CStdString const& suffix) +XFILE::CFile *CXBMCTestUtils::CreateTempFile(std::string const& suffix) { CTempFile *f = new CTempFile(); if (f->Create(suffix)) @@ -143,7 +143,7 @@ bool CXBMCTestUtils::DeleteTempFile(XFILE::CFile *tempfile) return retval; } -CStdString CXBMCTestUtils::TempFilePath(XFILE::CFile const* const tempfile) +std::string CXBMCTestUtils::TempFilePath(XFILE::CFile const* const tempfile) { if (!tempfile) return ""; @@ -151,7 +151,7 @@ CStdString CXBMCTestUtils::TempFilePath(XFILE::CFile const* const tempfile) return f->getTempFilePath(); } -CStdString CXBMCTestUtils::TempFileDirectory(XFILE::CFile const* const tempfile) +std::string CXBMCTestUtils::TempFileDirectory(XFILE::CFile const* const tempfile) { if (!tempfile) return ""; @@ -159,8 +159,8 @@ CStdString CXBMCTestUtils::TempFileDirectory(XFILE::CFile const* const tempfile) return f->getTempFileDirectory(); } -XFILE::CFile *CXBMCTestUtils::CreateCorruptedFile(CStdString const& strFileName, - CStdString const& suffix) +XFILE::CFile *CXBMCTestUtils::CreateCorruptedFile(std::string const& strFileName, + std::string const& suffix) { XFILE::CFile inputfile, *tmpfile = CreateTempFile(suffix); unsigned char buf[20], tmpchar; @@ -199,32 +199,32 @@ XFILE::CFile *CXBMCTestUtils::CreateCorruptedFile(CStdString const& strFileName, } -std::vector<CStdString> &CXBMCTestUtils::getTestFileFactoryReadUrls() +std::vector<std::string> &CXBMCTestUtils::getTestFileFactoryReadUrls() { return TestFileFactoryReadUrls; } -std::vector<CStdString> &CXBMCTestUtils::getTestFileFactoryWriteUrls() +std::vector<std::string> &CXBMCTestUtils::getTestFileFactoryWriteUrls() { return TestFileFactoryWriteUrls; } -CStdString &CXBMCTestUtils::getTestFileFactoryWriteInputFile() +std::string &CXBMCTestUtils::getTestFileFactoryWriteInputFile() { return TestFileFactoryWriteInputFile; } -void CXBMCTestUtils::setTestFileFactoryWriteInputFile(CStdString const& file) +void CXBMCTestUtils::setTestFileFactoryWriteInputFile(std::string const& file) { TestFileFactoryWriteInputFile = file; } -std::vector<CStdString> &CXBMCTestUtils::getAdvancedSettingsFiles() +std::vector<std::string> &CXBMCTestUtils::getAdvancedSettingsFiles() { return AdvancedSettingsFiles; } -std::vector<CStdString> &CXBMCTestUtils::getGUISettingsFiles() +std::vector<std::string> &CXBMCTestUtils::getGUISettingsFiles() { return GUISettingsFiles; } @@ -276,7 +276,7 @@ static const char usage[] = void CXBMCTestUtils::ParseArgs(int argc, char **argv) { int i; - CStdString arg; + std::string arg; for (i = 1; i < argc; i++) { arg = argv[i]; diff --git a/xbmc/test/TestUtils.h b/xbmc/test/TestUtils.h index de179c186c..1ad1ffeb00 100644 --- a/xbmc/test/TestUtils.h +++ b/xbmc/test/TestUtils.h @@ -20,7 +20,7 @@ #pragma once #include <string> -#include "utils/StdString.h" +#include <vector> namespace XFILE { @@ -45,7 +45,7 @@ public: * 'suffix' to append to the end of the tempfile path. The temporary * file is return as a XFILE::CFile object. */ - XFILE::CFile *CreateTempFile(CStdString const& suffix); + XFILE::CFile *CreateTempFile(std::string const& suffix); /* Function used to close and delete a temporary file previously created * using CreateTempFile(). @@ -53,28 +53,28 @@ public: bool DeleteTempFile(XFILE::CFile *tempfile); /* Function to get path of a tempfile */ - CStdString TempFilePath(XFILE::CFile const* const tempfile); + std::string TempFilePath(XFILE::CFile const* const tempfile); /* Get the containing directory of a tempfile */ - CStdString TempFileDirectory(XFILE::CFile const* const tempfile); + std::string TempFileDirectory(XFILE::CFile const* const tempfile); /* Functions to get variables used in the TestFileFactory tests. */ - std::vector<CStdString> &getTestFileFactoryReadUrls(); + std::vector<std::string> &getTestFileFactoryReadUrls(); /* Function to get variables used in the TestFileFactory tests. */ - std::vector<CStdString> &getTestFileFactoryWriteUrls(); + std::vector<std::string> &getTestFileFactoryWriteUrls(); /* Function to get the input file used in the TestFileFactory.Write tests. */ - CStdString &getTestFileFactoryWriteInputFile(); + std::string &getTestFileFactoryWriteInputFile(); /* Function to set the input file used in the TestFileFactory.Write tests */ - void setTestFileFactoryWriteInputFile(CStdString const& file); + void setTestFileFactoryWriteInputFile(std::string const& file); /* Function to get advanced settings files. */ - std::vector<CStdString> &getAdvancedSettingsFiles(); + std::vector<std::string> &getAdvancedSettingsFiles(); /* Function to get GUI settings files. */ - std::vector<CStdString> &getGUISettingsFiles(); + std::vector<std::string> &getGUISettingsFiles(); /* Function used in creating a corrupted file. The parameters are a URL * to the original file to be corrupted and a suffix to append to the @@ -82,8 +82,8 @@ public: * object which is itself a tempfile object which can be used with the * tempfile functions of this utility class. */ - XFILE::CFile *CreateCorruptedFile(CStdString const& strFileName, - CStdString const& suffix); + XFILE::CFile *CreateCorruptedFile(std::string const& strFileName, + std::string const& suffix); /* Function to parse command line options */ void ParseArgs(int argc, char **argv); @@ -95,12 +95,12 @@ private: CXBMCTestUtils(CXBMCTestUtils const&); void operator=(CXBMCTestUtils const&); - std::vector<CStdString> TestFileFactoryReadUrls; - std::vector<CStdString> TestFileFactoryWriteUrls; - CStdString TestFileFactoryWriteInputFile; + std::vector<std::string> TestFileFactoryReadUrls; + std::vector<std::string> TestFileFactoryWriteUrls; + std::string TestFileFactoryWriteInputFile; - std::vector<CStdString> AdvancedSettingsFiles; - std::vector<CStdString> GUISettingsFiles; + std::vector<std::string> AdvancedSettingsFiles; + std::vector<std::string> GUISettingsFiles; double probability; }; diff --git a/xbmc/threads/Thread.cpp b/xbmc/threads/Thread.cpp index 911b40cfd3..b7343751c0 100644 --- a/xbmc/threads/Thread.cpp +++ b/xbmc/threads/Thread.cpp @@ -25,6 +25,7 @@ #include "threads/ThreadLocal.h" #include "threads/SingleLock.h" #include "commons/Exception.h" +#include <stdlib.h> #define __STDC_FORMAT_MACROS #include <inttypes.h> diff --git a/xbmc/utils/AlarmClock.cpp b/xbmc/utils/AlarmClock.cpp index bf509ee221..06004d0f8c 100644 --- a/xbmc/utils/AlarmClock.cpp +++ b/xbmc/utils/AlarmClock.cpp @@ -36,10 +36,10 @@ CAlarmClock::~CAlarmClock() { } -void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdString& strCommand, bool bSilent /* false */, bool bLoop /* false */) +void CAlarmClock::Start(const std::string& strName, float n_secs, const std::string& strCommand, bool bSilent /* false */, bool bLoop /* false */) { // make lower case so that lookups are case-insensitive - CStdString lowerName(strName); + std::string lowerName(strName); StringUtils::ToLower(lowerName); Stop(lowerName); SAlarmClockEvent event; @@ -53,8 +53,8 @@ void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdStrin m_bIsRunning = true; } - CStdString strAlarmClock; - CStdString strStarted; + std::string strAlarmClock; + std::string strStarted; if (StringUtils::EqualsNoCase(strName, "shutdowntimer")) { strAlarmClock = g_localizeStrings.Get(20144); @@ -66,7 +66,7 @@ void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdStrin strStarted = g_localizeStrings.Get(13210); } - CStdString strMessage = StringUtils::Format(strStarted.c_str(), + std::string strMessage = StringUtils::Format(strStarted.c_str(), static_cast<int>(event.m_fSecs)/60, static_cast<int>(event.m_fSecs)%60); @@ -79,30 +79,30 @@ void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdStrin CLog::Log(LOGDEBUG,"started alarm with name: %s",lowerName.c_str()); } -void CAlarmClock::Stop(const CStdString& strName, bool bSilent /* false */) +void CAlarmClock::Stop(const std::string& strName, bool bSilent /* false */) { CSingleLock lock(m_events); - CStdString lowerName(strName); + std::string lowerName(strName); StringUtils::ToLower(lowerName); // lookup as lowercase only - map<CStdString,SAlarmClockEvent>::iterator iter = m_event.find(lowerName); + map<std::string,SAlarmClockEvent>::iterator iter = m_event.find(lowerName); if (iter == m_event.end()) return; - CStdString strAlarmClock; + std::string strAlarmClock; if (StringUtils::EqualsNoCase(strName, "shutdowntimer")) strAlarmClock = g_localizeStrings.Get(20144); else strAlarmClock = g_localizeStrings.Get(13208); - CStdString strMessage; + std::string strMessage; if( iter->second.watch.GetElapsedSeconds() > iter->second.m_fSecs ) strMessage = g_localizeStrings.Get(13211); else { float remaining = static_cast<float>(iter->second.m_fSecs-iter->second.watch.GetElapsedSeconds()); - CStdString strStarted = g_localizeStrings.Get(13212); + std::string strStarted = g_localizeStrings.Get(13212); strMessage = StringUtils::Format(strStarted.c_str(), static_cast<int>(remaining)/60, static_cast<int>(remaining)%60); @@ -130,10 +130,10 @@ void CAlarmClock::Process() { while( !m_bStop) { - CStdString strLast = ""; + std::string strLast; { CSingleLock lock(m_events); - for (map<CStdString,SAlarmClockEvent>::iterator iter=m_event.begin();iter != m_event.end(); ++iter) + for (map<std::string,SAlarmClockEvent>::iterator iter=m_event.begin();iter != m_event.end(); ++iter) if (iter->second.watch.GetElapsedSeconds() >= iter->second.m_fSecs) { Stop(iter->first); diff --git a/xbmc/utils/AlarmClock.h b/xbmc/utils/AlarmClock.h index a135371b8c..9870352f56 100644 --- a/xbmc/utils/AlarmClock.h +++ b/xbmc/utils/AlarmClock.h @@ -20,18 +20,18 @@ * */ -#include "StdString.h" #include "Stopwatch.h" #include "threads/CriticalSection.h" #include "threads/Thread.h" #include <map> +#include <string> struct SAlarmClockEvent { CStopWatch watch; double m_fSecs; - CStdString m_strCommand; + std::string m_strCommand; bool m_loop; }; @@ -40,13 +40,13 @@ class CAlarmClock : public CThread public: CAlarmClock(); ~CAlarmClock(); - void Start(const CStdString& strName, float n_secs, const CStdString& strCommand, bool bSilent = false, bool bLoop = false); + void Start(const std::string& strName, float n_secs, const std::string& strCommand, bool bSilent = false, bool bLoop = false); inline bool IsRunning() const { return m_bIsRunning; } - inline bool HasAlarm(const CStdString& strName) + inline bool HasAlarm(const std::string& strName) { // note: strName should be lower case only here // No point checking it at the moment due to it only being called @@ -55,9 +55,9 @@ public: return (m_event.find(strName) != m_event.end()); } - double GetRemaining(const CStdString& strName) + double GetRemaining(const std::string& strName) { - std::map<CStdString,SAlarmClockEvent>::iterator iter; + std::map<std::string,SAlarmClockEvent>::iterator iter; if ((iter=m_event.find(strName)) != m_event.end()) { return iter->second.m_fSecs-iter->second.watch.GetElapsedSeconds(); @@ -66,10 +66,10 @@ public: return 0.f; } - void Stop(const CStdString& strName, bool bSilent = false); + void Stop(const std::string& strName, bool bSilent = false); virtual void Process(); private: - std::map<CStdString,SAlarmClockEvent> m_event; + std::map<std::string,SAlarmClockEvent> m_event; CCriticalSection m_events; bool m_bIsRunning; diff --git a/xbmc/utils/AliasShortcutUtils.h b/xbmc/utils/AliasShortcutUtils.h index a346e936f3..73b50834f5 100644 --- a/xbmc/utils/AliasShortcutUtils.h +++ b/xbmc/utils/AliasShortcutUtils.h @@ -19,7 +19,7 @@ * */ -#include "StdString.h" +#include <string> bool IsAliasShortcut(const std::string& path); void TranslateAliasShortcut(std::string &path); diff --git a/xbmc/utils/AsyncFileCopy.h b/xbmc/utils/AsyncFileCopy.h index f75dd4df8e..c4bd9cde67 100644 --- a/xbmc/utils/AsyncFileCopy.h +++ b/xbmc/utils/AsyncFileCopy.h @@ -22,6 +22,7 @@ #include "threads/Thread.h" #include "filesystem/File.h" +#include "utils/StdString.h" class CAsyncFileCopy : public CThread, public XFILE::IFileCallback { diff --git a/xbmc/utils/Crc32.cpp b/xbmc/utils/Crc32.cpp index 91e447d765..2607b4088a 100644 --- a/xbmc/utils/Crc32.cpp +++ b/xbmc/utils/Crc32.cpp @@ -105,14 +105,14 @@ void Crc32::Compute(const char* buffer, size_t count) m_crc = (m_crc << 8) ^ crc_tab[((m_crc >> 24) ^ *buffer++) & 0xFF]; } -void Crc32::Compute(const CStdString& strValue) +void Crc32::Compute(const std::string& strValue) { Compute(strValue.c_str(), strValue.size()); } -void Crc32::ComputeFromLowerCase(const CStdString& strValue) +void Crc32::ComputeFromLowerCase(const std::string& strValue) { - CStdString strLower = strValue; + std::string strLower = strValue; StringUtils::ToLower(strLower); Compute(strLower.c_str(), strLower.size()); } diff --git a/xbmc/utils/Crc32.h b/xbmc/utils/Crc32.h index 5c10bc8fc3..3d30c8fac7 100644 --- a/xbmc/utils/Crc32.h +++ b/xbmc/utils/Crc32.h @@ -20,7 +20,8 @@ #pragma once -#include "StdString.h" +#include <string> +#include <stdint.h> class Crc32 { @@ -28,8 +29,8 @@ public: Crc32(); void Reset(); void Compute(const char* buffer, size_t count); - void Compute(const CStdString& strValue); - void ComputeFromLowerCase(const CStdString& strValue); + void Compute(const std::string& strValue); + void ComputeFromLowerCase(const std::string& strValue); operator uint32_t () const { diff --git a/xbmc/utils/Fanart.cpp b/xbmc/utils/Fanart.cpp index 58eecaabce..15279724dc 100644 --- a/xbmc/utils/Fanart.cpp +++ b/xbmc/utils/Fanart.cpp @@ -63,7 +63,7 @@ bool CFanart::Unpack() TiXmlElement *fanart = doc.FirstChildElement("fanart"); while (fanart) { - CStdString url = XMLUtils::GetAttribute(fanart, "url"); + std::string url = XMLUtils::GetAttribute(fanart, "url"); TiXmlElement *fanartThumb = fanart->FirstChildElement("thumb"); while (fanartThumb) { @@ -89,7 +89,7 @@ bool CFanart::Unpack() return true; } -CStdString CFanart::GetImageURL(unsigned int index) const +std::string CFanart::GetImageURL(unsigned int index) const { if (index >= m_fanart.size()) return ""; @@ -97,7 +97,7 @@ CStdString CFanart::GetImageURL(unsigned int index) const return m_fanart[index].strImage; } -CStdString CFanart::GetPreviewURL(unsigned int index) const +std::string CFanart::GetPreviewURL(unsigned int index) const { if (index >= m_fanart.size()) return ""; @@ -105,7 +105,7 @@ CStdString CFanart::GetPreviewURL(unsigned int index) const return m_fanart[index].strPreview.empty() ? m_fanart[index].strImage : m_fanart[index].strPreview; } -const CStdString CFanart::GetColor(unsigned int index) const +const std::string CFanart::GetColor(unsigned int index) const { if (index >= max_fanart_colors || m_fanart.size() == 0 || m_fanart[0].strColors.size() < index*9+8) @@ -133,7 +133,7 @@ unsigned int CFanart::GetNumFanarts() const return m_fanart.size(); } -bool CFanart::ParseColors(const CStdString &colorsIn, CStdString &colorsOut) +bool CFanart::ParseColors(const std::string &colorsIn, std::string &colorsOut) { // Formats: // 0: XBMC ARGB Hexadecimal string comma seperated "FFFFFFFF,DDDDDDDD,AAAAAAAA" diff --git a/xbmc/utils/Fanart.h b/xbmc/utils/Fanart.h index b484eb2e79..53464e7074 100644 --- a/xbmc/utils/Fanart.h +++ b/xbmc/utils/Fanart.h @@ -24,7 +24,7 @@ * */ -#include "StdString.h" +#include <string> #include <vector> #pragma once @@ -35,7 +35,7 @@ /// CFanart stores all data related to all available fanarts for a given TV show and provides /// functions required to manipulate and access that data. /// In order to provide an interface between the fanart data and the XBMC database, all data -/// is stored internally it its own form, as well as packed into an XML formatted CStdString +/// is stored internally it its own form, as well as packed into an XML formatted string /// stored in the member variable m_xml. /// Information on multiple fanarts for a given show is stored, but XBMC only cares about the /// very first fanart stored. These interfaces provide a means to access the data in that first @@ -60,17 +60,17 @@ public: /// /// Retrieves the fanart full res image URL /// \param index - index of image to retrieve (defaults to 0) - /// \return A CStdString containing the full URL to the full resolution fanart image - CStdString GetImageURL(unsigned int index = 0) const; + /// \return A string containing the full URL to the full resolution fanart image + std::string GetImageURL(unsigned int index = 0) const; /// /// Retrieves the fanart preview image URL, or full res image URL if that doesn't exist /// \param index - index of image to retrieve (defaults to 0) - /// \return A CStdString containing the full URL to the full resolution fanart image - CStdString GetPreviewURL(unsigned int index = 0) const; + /// \return A string containing the full URL to the full resolution fanart image + std::string GetPreviewURL(unsigned int index = 0) const; /// /// Used to return a specified fanart theme color value /// \param index: 0 based index of the color to retrieve. A fanart theme contains 3 colors, indices 0-2, arranged from darkest to lightest. - const CStdString GetColor(unsigned int index) const; + const std::string GetColor(unsigned int index) const; /// /// Sets a particular fanart to be the "primary" fanart, or in other words, sets which fanart is actually used by XBMC /// @@ -88,7 +88,7 @@ public: /// This string is the "interface" as it were to the XBMC database, and MUST be kept in sync with the rest of the class. Therefore /// anytime this string is changed, the change should be followed up by a call to CFanart::UnPack(). This XML formaytted string is /// also the interface used to pass the fanart data from the scraper to CFanart. - CStdString m_xml; + std::string m_xml; private: static const unsigned int max_fanart_colors; /// @@ -99,17 +99,17 @@ private: /// * The TVDB RGB Int Triplets, pipe seperate with leading/trailing pipes "|68,69,59|69,70,58|78,78,68|" /// * XBMC ARGB Hexadecimal string comma seperated "FFFFFFFF,DDDDDDDD,AAAAAAAA" /// - /// \param colorsIn: CStdString containing a string of colors in some format to be converted + /// \param colorsIn: string containing colors in some format to be converted /// \param colorsOut: XBMC ARGB Hexadecimal string comma seperated "FFFFFFFF,DDDDDDDD,AAAAAAAA" /// \return boolean indicating success or failure. - static bool ParseColors(const CStdString &colorsIn, CStdString &colorsOut); + static bool ParseColors(const std::string&colorsIn, std::string&colorsOut); struct SFanartData { - CStdString strImage; - CStdString strResolution; - CStdString strColors; - CStdString strPreview; + std::string strImage; + std::string strResolution; + std::string strColors; + std::string strPreview; }; /// diff --git a/xbmc/utils/HTMLTable.cpp b/xbmc/utils/HTMLTable.cpp index 84213809bf..1cd7e9dd4b 100644 --- a/xbmc/utils/HTMLTable.cpp +++ b/xbmc/utils/HTMLTable.cpp @@ -35,15 +35,15 @@ int CHTMLRow::GetColumns() const return (int)m_vecColums.size(); } -const CStdString& CHTMLRow::GetColumValue(int iColumn) const +const std::string& CHTMLRow::GetColumValue(int iColumn) const { return m_vecColums[iColumn]; } -void CHTMLRow::Parse(const CStdString& strTable) +void CHTMLRow::Parse(const std::string& strTable) { CHTMLUtil util; - CStdString strTag; + std::string strTag; int iTableRowStart = 0; do { @@ -55,7 +55,7 @@ void CHTMLRow::Parse(const CStdString& strTable) if (iTableRowEnd < -1) break; - CStdString strRow = strTable.substr(iTableRowStart, 1 + iTableRowEnd - iTableRowStart); + std::string strRow = strTable.substr(iTableRowStart, 1 + iTableRowEnd - iTableRowStart); m_vecColums.push_back(strRow); iTableRowStart = iTableRowEnd + 1; @@ -81,11 +81,11 @@ const CHTMLRow& CHTMLTable::GetRow(int iRow) const return m_vecRows[iRow]; } -void CHTMLTable::Parse(const CStdString& strHTML) +void CHTMLTable::Parse(const std::string& strHTML) { m_vecRows.erase(m_vecRows.begin(), m_vecRows.end()); CHTMLUtil util; - CStdString strTag; + std::string strTag; int iPosStart = util.FindTag(strHTML, "<table", strTag); if (iPosStart >= 0) { @@ -96,7 +96,7 @@ void CHTMLTable::Parse(const CStdString& strHTML) iPosEnd = (int)strHTML.size(); } - CStdString strTable = strHTML.substr(iPosStart, 1 + iPosEnd - iPosStart); + std::string strTable = strHTML.substr(iPosStart, 1 + iPosEnd - iPosStart); int iTableRowStart = 0; do { @@ -108,7 +108,7 @@ void CHTMLTable::Parse(const CStdString& strHTML) if (iTableRowEnd < 0) break; - CStdString strRow = strTable.substr(iTableRowStart, 1 + iTableRowEnd - iTableRowStart); + std::string strRow = strTable.substr(iTableRowStart, 1 + iTableRowEnd - iTableRowStart); CHTMLRow row; row.Parse(strRow); m_vecRows.push_back(row); diff --git a/xbmc/utils/HTMLTable.h b/xbmc/utils/HTMLTable.h index e273d572b4..d9705ba706 100644 --- a/xbmc/utils/HTMLTable.h +++ b/xbmc/utils/HTMLTable.h @@ -20,7 +20,8 @@ * */ -#include "StdString.h" +#include <string> +#include <vector> namespace HTML { @@ -30,11 +31,11 @@ public: CHTMLRow(void); virtual ~CHTMLRow(void); int GetColumns() const; - const CStdString& GetColumValue(int iColumn) const; - void Parse(const CStdString& strTableRow); + const std::string& GetColumValue(int iColumn) const; + void Parse(const std::string& strTableRow); protected: - std::vector<CStdString> m_vecColums; + std::vector<std::string> m_vecColums; }; class CHTMLTable @@ -42,7 +43,7 @@ class CHTMLTable public: CHTMLTable(void); virtual ~CHTMLTable(void); - void Parse(const CStdString& strHTML); + void Parse(const std::string& strHTML); int GetRows() const; const CHTMLRow& GetRow(int iRow) const; protected: diff --git a/xbmc/utils/HTMLUtil.cpp b/xbmc/utils/HTMLUtil.cpp index 03c0cc92b6..386ef534e6 100644 --- a/xbmc/utils/HTMLUtil.cpp +++ b/xbmc/utils/HTMLUtil.cpp @@ -20,6 +20,7 @@ #include "HTMLUtil.h" #include "utils/StringUtils.h" +#include <wctype.h> using namespace std; using namespace HTML; @@ -31,10 +32,10 @@ CHTMLUtil::CHTMLUtil(void) CHTMLUtil::~CHTMLUtil(void) {} -int CHTMLUtil::FindTag(const CStdString& strHTML, const CStdString& strTag, CStdString& strtagFound, int iPos) +int CHTMLUtil::FindTag(const std::string& strHTML, const std::string& strTag, std::string& strtagFound, int iPos) { - CStdString strHTMLLow = strHTML; - CStdString strTagLow = strTag; + std::string strHTMLLow = strHTML; + std::string strTagLow = strTag; StringUtils::ToLower(strHTMLLow); StringUtils::ToLower(strTagLow); strtagFound = ""; @@ -51,10 +52,10 @@ int CHTMLUtil::FindTag(const CStdString& strHTML, const CStdString& strTag, CStd return iStart; } -int CHTMLUtil::FindClosingTag(const CStdString& strHTML, const CStdString& strTag, CStdString& strtagFound, int iPos) +int CHTMLUtil::FindClosingTag(const std::string& strHTML, const std::string& strTag, std::string& strtagFound, int iPos) { - CStdString strHTMLLow = strHTML; - CStdString strTagLow = strTag; + std::string strHTMLLow = strHTML; + std::string strTagLow = strTag; StringUtils::ToLower(strHTMLLow); StringUtils::ToLower(strTagLow); strtagFound = ""; @@ -78,7 +79,7 @@ int CHTMLUtil::FindClosingTag(const CStdString& strHTML, const CStdString& strTa return iStart; } -void CHTMLUtil::getValueOfTag(const CStdString& strTagAndValue, CStdString& strValue) +void CHTMLUtil::getValueOfTag(const std::string& strTagAndValue, std::string& strValue) { // strTagAndValue contains: // like <a href=blablabla.....>value</a> @@ -93,7 +94,7 @@ void CHTMLUtil::getValueOfTag(const CStdString& strTagAndValue, CStdString& strV } } -void CHTMLUtil::getAttributeOfTag(const CStdString& strTagAndValue, const CStdString& strTag, CStdString& strValue) +void CHTMLUtil::getAttributeOfTag(const std::string& strTagAndValue, const std::string& strTag, std::string& strValue) { // strTagAndValue contains: // like <a href=""value"..... @@ -122,10 +123,10 @@ void CHTMLUtil::getAttributeOfTag(const CStdString& strTagAndValue, const CStdSt } } -void CHTMLUtil::RemoveTags(CStdString& strHTML) +void CHTMLUtil::RemoveTags(std::string& strHTML) { int iNested = 0; - CStdString strReturn = ""; + std::string strReturn = ""; for (int i = 0; i < (int) strHTML.size(); ++i) { if (strHTML[i] == '<') iNested++; @@ -285,7 +286,7 @@ static const HTMLMapping mappings[] = {L"‌", 0x200C}, {NULL, L'\0'}}; -void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStripped) +void CHTMLUtil::ConvertHTMLToW(const std::wstring& strHTML, std::wstring& strStripped) { /* TODO:STRING_CLEANUP */ if (strHTML.size() == 0) @@ -297,7 +298,7 @@ void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStrip strStripped = strHTML; while (mappings[iPos].html) { - StringUtils::Replace(strStripped, mappings[iPos].html,CStdStringW(1, mappings[iPos].w)); + StringUtils::Replace(strStripped, mappings[iPos].html,std::wstring(1, mappings[iPos].w)); iPos++; } @@ -306,7 +307,7 @@ void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStrip { size_t iStart = iPos + 1; iPos += 2; - CStdStringW num; + std::wstring num; int base = 10; if (strStripped[iPos+1] == L'x') { @@ -326,7 +327,7 @@ void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStrip else num = StringUtils::Format(L"&#x%ls;", num.c_str()); - StringUtils::Replace(strStripped, num,CStdStringW(1,val)); + StringUtils::Replace(strStripped, num,std::wstring(1,val)); iPos = strStripped.find(L"&#", iStart); } } diff --git a/xbmc/utils/HTMLUtil.h b/xbmc/utils/HTMLUtil.h index 2318ef7654..7d67634e20 100644 --- a/xbmc/utils/HTMLUtil.h +++ b/xbmc/utils/HTMLUtil.h @@ -20,7 +20,7 @@ * */ -#include "StdString.h" +#include <string> namespace HTML { @@ -29,11 +29,11 @@ class CHTMLUtil public: CHTMLUtil(void); virtual ~CHTMLUtil(void); - static int FindTag(const CStdString& strHTML, const CStdString& strTag, CStdString& strtagFound, int iPos = 0); - static int FindClosingTag(const CStdString& strHTML, const CStdString& strTag, CStdString& strtagFound, int iPos); - static void getValueOfTag(const CStdString& strTagAndValue, CStdString& strValue); - static void getAttributeOfTag(const CStdString& strTagAndValue, const CStdString& strTag, CStdString& strValue); - static void RemoveTags(CStdString& strHTML); - static void ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStripped); + static int FindTag(const std::string& strHTML, const std::string& strTag, std::string& strtagFound, int iPos = 0); + static int FindClosingTag(const std::string& strHTML, const std::string& strTag, std::string& strtagFound, int iPos); + static void getValueOfTag(const std::string& strTagAndValue, std::string& strValue); + static void getAttributeOfTag(const std::string& strTagAndValue, const std::string& strTag, std::string& strValue); + static void RemoveTags(std::string& strHTML); + static void ConvertHTMLToW(const std::wstring& strHTML, std::wstring& strStripped); }; } diff --git a/xbmc/utils/InfoLoader.cpp b/xbmc/utils/InfoLoader.cpp index 92bb78abe9..429964a273 100644 --- a/xbmc/utils/InfoLoader.cpp +++ b/xbmc/utils/InfoLoader.cpp @@ -40,7 +40,7 @@ void CInfoLoader::OnJobComplete(unsigned int jobID, bool success, CJob *job) m_busy = false; } -CStdString CInfoLoader::GetInfo(int info) +std::string CInfoLoader::GetInfo(int info) { // Refresh if need be if (m_refreshTime < CTimeUtils::GetFrameTime() && !m_busy) @@ -55,12 +55,12 @@ CStdString CInfoLoader::GetInfo(int info) return TranslateInfo(info); } -CStdString CInfoLoader::BusyInfo(int info) const +std::string CInfoLoader::BusyInfo(int info) const { return g_localizeStrings.Get(503); } -CStdString CInfoLoader::TranslateInfo(int info) const +std::string CInfoLoader::TranslateInfo(int info) const { return ""; } diff --git a/xbmc/utils/InfoLoader.h b/xbmc/utils/InfoLoader.h index 964743ef07..d72d5e12ab 100644 --- a/xbmc/utils/InfoLoader.h +++ b/xbmc/utils/InfoLoader.h @@ -20,8 +20,8 @@ * */ -#include "StdString.h" #include "Job.h" +#include <string> class CInfoLoader : public IJobCallback { @@ -29,14 +29,14 @@ public: CInfoLoader(unsigned int timeToRefresh = 5 * 60 * 1000); virtual ~CInfoLoader(); - CStdString GetInfo(int info); + std::string GetInfo(int info); void Refresh(); virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); protected: virtual CJob *GetJob() const=0; - virtual CStdString TranslateInfo(int info) const; - virtual CStdString BusyInfo(int info) const; + virtual std::string TranslateInfo(int info) const; + virtual std::string BusyInfo(int info) const; private: unsigned int m_refreshTime; unsigned int m_timeToRefresh; diff --git a/xbmc/utils/LabelFormatter.cpp b/xbmc/utils/LabelFormatter.cpp index b82b0a6695..0169c3d74d 100644 --- a/xbmc/utils/LabelFormatter.cpp +++ b/xbmc/utils/LabelFormatter.cpp @@ -102,7 +102,7 @@ using namespace MUSIC_INFO; #define MASK_CHARS "NSATBGYFLDIJRCKMEPHZOQUVXWapt" -CLabelFormatter::CLabelFormatter(const CStdString &mask, const CStdString &mask2) +CLabelFormatter::CLabelFormatter(const std::string &mask, const std::string &mask2) { // assemble our label masks AssembleMask(0, mask); @@ -111,14 +111,14 @@ CLabelFormatter::CLabelFormatter(const CStdString &mask, const CStdString &mask2 m_hideFileExtensions = !CSettings::Get().GetBool("filelists.showextensions"); } -CStdString CLabelFormatter::GetContent(unsigned int label, const CFileItem *item) const +std::string CLabelFormatter::GetContent(unsigned int label, const CFileItem *item) const { assert(label < 2); assert(m_staticContent[label].size() == m_dynamicContent[label].size() + 1); if (!item) return ""; - CStdString strLabel, dynamicLeft, dynamicRight; + std::string strLabel, dynamicLeft, dynamicRight; for (unsigned int i = 0; i < m_dynamicContent[label].size(); i++) { dynamicRight = GetMaskContent(m_dynamicContent[label][i], item); @@ -135,7 +135,7 @@ CStdString CLabelFormatter::GetContent(unsigned int label, const CFileItem *item void CLabelFormatter::FormatLabel(CFileItem *item) const { - CStdString maskedLabel = GetContent(0, item); + std::string maskedLabel = GetContent(0, item); if (!maskedLabel.empty()) item->SetLabel(maskedLabel); else if (!item->m_bIsFolder && m_hideFileExtensions) @@ -147,13 +147,13 @@ void CLabelFormatter::FormatLabel2(CFileItem *item) const item->SetLabel2(GetContent(1, item)); } -CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileItem *item) const +std::string CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileItem *item) const { if (!item) return ""; const CMusicInfoTag *music = item->GetMusicInfoTag(); const CVideoInfoTag *movie = item->GetVideoInfoTag(); const CPictureInfoTag *pic = item->GetPictureInfoTag(); - CStdString value; + std::string value; switch (mask.m_content) { case 'N': @@ -329,12 +329,12 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI return ""; } -void CLabelFormatter::SplitMask(unsigned int label, const CStdString &mask) +void CLabelFormatter::SplitMask(unsigned int label, const std::string &mask) { assert(label < 2); CRegExp reg; reg.RegComp("%([" MASK_CHARS "])"); - CStdString work(mask); + std::string work(mask); int findStart = -1; while ((findStart = reg.RegFind(work.c_str())) >= 0) { // we've found a match @@ -346,7 +346,7 @@ void CLabelFormatter::SplitMask(unsigned int label, const CStdString &mask) m_staticContent[label].push_back(work); } -void CLabelFormatter::AssembleMask(unsigned int label, const CStdString& mask) +void CLabelFormatter::AssembleMask(unsigned int label, const std::string& mask) { assert(label < 2); m_staticContent[label].clear(); @@ -357,7 +357,7 @@ void CLabelFormatter::AssembleMask(unsigned int label, const CStdString& mask) // could be a mask that's not surrounded with [], so pass to SplitMask. CRegExp reg; reg.RegComp("(^|[^%])\\[(([^%]|%%|%\\]|%\\[)*)%([" MASK_CHARS "])(([^%]|%%|%\\]|%\\[)*)\\]"); - CStdString work(mask); + std::string work(mask); int findStart = -1; while ((findStart = reg.RegFind(work.c_str())) >= 0) { // we've found a match for a pre/postfixed string @@ -373,7 +373,7 @@ void CLabelFormatter::AssembleMask(unsigned int label, const CStdString& mask) assert(m_staticContent[label].size() == m_dynamicContent[label].size() + 1); } -bool CLabelFormatter::FillMusicTag(const CStdString &fileName, CMusicInfoTag *tag) const +bool CLabelFormatter::FillMusicTag(const std::string &fileName, CMusicInfoTag *tag) const { // run through and find static content to split the string up size_t pos1 = fileName.find(m_staticContent[0][0], 0); @@ -391,7 +391,7 @@ bool CLabelFormatter::FillMusicTag(const CStdString &fileName, CMusicInfoTag *ta return true; } -void CLabelFormatter::FillMusicMaskContent(const char mask, const CStdString &value, CMusicInfoTag *tag) const +void CLabelFormatter::FillMusicMaskContent(const char mask, const std::string &value, CMusicInfoTag *tag) const { if (!tag) return; switch (mask) diff --git a/xbmc/utils/LabelFormatter.h b/xbmc/utils/LabelFormatter.h index 093ae7f810..d63e8041ca 100644 --- a/xbmc/utils/LabelFormatter.h +++ b/xbmc/utils/LabelFormatter.h @@ -20,7 +20,7 @@ * */ -#include "StdString.h" +#include <string> #include <vector> namespace MUSIC_INFO @@ -32,22 +32,22 @@ class CFileItem; // forward struct LABEL_MASKS { - LABEL_MASKS(const CStdString& strLabelFile="", const CStdString& strLabel2File="", const CStdString& strLabelFolder="", const CStdString& strLabel2Folder="") : + LABEL_MASKS(const std::string& strLabelFile="", const std::string& strLabel2File="", const std::string& strLabelFolder="", const std::string& strLabel2Folder="") : m_strLabelFile(strLabelFile), m_strLabel2File(strLabel2File), m_strLabelFolder(strLabelFolder), m_strLabel2Folder(strLabel2Folder) {} - CStdString m_strLabelFile; - CStdString m_strLabel2File; - CStdString m_strLabelFolder; - CStdString m_strLabel2Folder; + std::string m_strLabelFile; + std::string m_strLabel2File; + std::string m_strLabelFolder; + std::string m_strLabel2Folder; }; class CLabelFormatter { public: - CLabelFormatter(const CStdString &mask, const CStdString &mask2); + CLabelFormatter(const std::string &mask, const std::string &mask2); void FormatLabel(CFileItem *item) const; void FormatLabel2(CFileItem *item) const; @@ -57,32 +57,32 @@ public: FormatLabel2(item); } - bool FillMusicTag(const CStdString &fileName, MUSIC_INFO::CMusicInfoTag *tag) const; + bool FillMusicTag(const std::string &fileName, MUSIC_INFO::CMusicInfoTag *tag) const; private: class CMaskString { public: - CMaskString(const CStdString &prefix, char content, const CStdString &postfix) : + CMaskString(const std::string &prefix, char content, const std::string &postfix) : m_prefix(prefix), m_postfix(postfix), m_content(content) {}; - CStdString m_prefix; - CStdString m_postfix; + std::string m_prefix; + std::string m_postfix; char m_content; }; // functions for assembling the mask vectors - void AssembleMask(unsigned int label, const CStdString &mask); - void SplitMask(unsigned int label, const CStdString &mask); + void AssembleMask(unsigned int label, const std::string &mask); + void SplitMask(unsigned int label, const std::string &mask); // functions for retrieving content based on our mask vectors - CStdString GetContent(unsigned int label, const CFileItem *item) const; - CStdString GetMaskContent(const CMaskString &mask, const CFileItem *item) const; - void FillMusicMaskContent(const char mask, const CStdString &value, MUSIC_INFO::CMusicInfoTag *tag) const; + std::string GetContent(unsigned int label, const CFileItem *item) const; + std::string GetMaskContent(const CMaskString &mask, const CFileItem *item) const; + void FillMusicMaskContent(const char mask, const std::string &value, MUSIC_INFO::CMusicInfoTag *tag) const; - std::vector<CStdString> m_staticContent[2]; + std::vector<std::string> m_staticContent[2]; std::vector<CMaskString> m_dynamicContent[2]; bool m_hideFileExtensions; }; diff --git a/xbmc/utils/RecentlyAddedJob.cpp b/xbmc/utils/RecentlyAddedJob.cpp index 8f559c1076..e9f512e65f 100644 --- a/xbmc/utils/RecentlyAddedJob.cpp +++ b/xbmc/utils/RecentlyAddedJob.cpp @@ -311,20 +311,20 @@ bool CRecentlyAddedJob::UpdateTotal() CMusicDatabase musicdatabase; musicdatabase.Open(); - int MusSongTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(1)")); - int MusAlbumTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(distinct strAlbum)")); - int MusArtistTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(distinct strArtists)")); + int MusSongTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(1)").c_str()); + int MusAlbumTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(distinct strAlbum)").c_str()); + int MusArtistTotals = atoi(musicdatabase.GetSingleValue("songview" , "count(distinct strArtists)").c_str()); musicdatabase.Close(); videodatabase.Open(); - int tvShowCount = atoi(videodatabase.GetSingleValue("tvshowview" , "count(1)")); - int movieTotals = atoi(videodatabase.GetSingleValue("movieview" , "count(1)")); - int movieWatched = atoi(videodatabase.GetSingleValue("movieview" , "count(playCount)")); - int MusVidTotals = atoi(videodatabase.GetSingleValue("musicvideoview" , "count(1)")); - int MusVidWatched = atoi(videodatabase.GetSingleValue("musicvideoview" , "count(playCount)")); - int EpWatched = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(watchedcount)")); - int EpCount = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(totalcount)")); - int TvShowsWatched = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(watchedcount = totalcount)")); + int tvShowCount = atoi(videodatabase.GetSingleValue("tvshowview" , "count(1)").c_str()); + int movieTotals = atoi(videodatabase.GetSingleValue("movieview" , "count(1)").c_str()); + int movieWatched = atoi(videodatabase.GetSingleValue("movieview" , "count(playCount)").c_str()); + int MusVidTotals = atoi(videodatabase.GetSingleValue("musicvideoview" , "count(1)").c_str()); + int MusVidWatched = atoi(videodatabase.GetSingleValue("musicvideoview" , "count(playCount)").c_str()); + int EpWatched = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(watchedcount)").c_str()); + int EpCount = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(totalcount)").c_str()); + int TvShowsWatched = atoi(videodatabase.GetSingleValue("tvshowview" , "sum(watchedcount = totalcount)").c_str()); videodatabase.Close(); home->SetProperty("TVShows.Count" , tvShowCount); diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp index a22d364dbb..3636c3ed8c 100644 --- a/xbmc/utils/RssReader.cpp +++ b/xbmc/utils/RssReader.cpp @@ -24,6 +24,7 @@ #include "utils/HTMLUtil.h" #include "Application.h" #include "CharsetConverter.h" +#include "StringUtils.h" #include "URL.h" #include "filesystem/File.h" #include "filesystem/CurlFile.h" @@ -130,14 +131,14 @@ void CRssReader::Process() int iFeed = m_vecQueue.front(); m_vecQueue.erase(m_vecQueue.begin()); - m_strFeed[iFeed] = ""; - m_strColors[iFeed] = ""; + m_strFeed[iFeed].clear(); + m_strColors[iFeed].clear(); CCurlFile http; http.SetUserAgent(g_advancedSettings.m_userAgent); http.SetTimeout(2); - CStdString strXML; - CStdString strUrl = m_vecUrls[iFeed]; + std::string strXML; + std::string strUrl = m_vecUrls[iFeed]; lock.Leave(); int nRetries = 3; @@ -226,12 +227,12 @@ void CRssReader::getFeed(vecText &text) } } -void CRssReader::AddTag(const CStdString &aString) +void CRssReader::AddTag(const std::string &aString) { m_tagSet.push_back(aString); } -void CRssReader::AddString(CStdStringW aString, int aColour, int iFeed) +void CRssReader::AddString(std::wstring aString, int aColour, int iFeed) { if (m_rtlText) m_strFeed[iFeed] = aString + m_strFeed[iFeed]; @@ -254,9 +255,9 @@ void CRssReader::GetNewsItems(TiXmlElement* channelXmlNode, int iFeed) HTML::CHTMLUtil html; TiXmlElement * itemNode = channelXmlNode->FirstChildElement("item"); - map <CStdString, CStdStringW> mTagElements; - typedef pair <CStdString, CStdStringW> StrPair; - list <CStdString>::iterator i; + map <std::string, std::wstring> mTagElements; + typedef pair <std::string, std::wstring> StrPair; + list <std::string>::iterator i; // Add the title tag in if we didn't pass any tags in at all // Represents default behaviour before configurability @@ -270,23 +271,23 @@ void CRssReader::GetNewsItems(TiXmlElement* channelXmlNode, int iFeed) mTagElements.clear(); while (childNode > 0) { - CStdString strName = childNode->Value(); + std::string strName = childNode->ValueStr(); for (i = m_tagSet.begin(); i != m_tagSet.end(); ++i) { - if (!childNode->NoChildren() && i->Equals(strName)) + if (!childNode->NoChildren() && *i == strName) { - CStdString htmlText = childNode->FirstChild()->Value(); + std::string htmlText = childNode->FirstChild()->ValueStr(); // This usually happens in right-to-left languages where they want to // specify in the RSS body that the text should be RTL. // <title> // <div dir="RTL">��� ����: ���� �� �����</div> // </title> - if (htmlText.Equals("div") || htmlText.Equals("span")) - htmlText = childNode->FirstChild()->FirstChild()->Value(); + if (htmlText == "div" || htmlText == "span") + htmlText = childNode->FirstChild()->FirstChild()->ValueStr(); - CStdStringW unicodeText, unicodeText2; + std::wstring unicodeText, unicodeText2; g_charsetConverter.utf8ToW(htmlText, unicodeText2, m_rtlText); html.ConvertHTMLToW(unicodeText2, unicodeText); @@ -300,15 +301,15 @@ void CRssReader::GetNewsItems(TiXmlElement* channelXmlNode, int iFeed) int rsscolour = RSS_COLOR_HEADLINE; for (i = m_tagSet.begin(); i != m_tagSet.end(); ++i) { - map <CStdString, CStdStringW>::iterator j = mTagElements.find(*i); + map <std::string, std::wstring>::iterator j = mTagElements.find(*i); if (j == mTagElements.end()) continue; - CStdStringW& text = j->second; + std::wstring& text = j->second; AddString(text, rsscolour, iFeed); rsscolour = RSS_COLOR_BODY; - text = " - "; + text = L" - "; AddString(text, rsscolour, iFeed); } itemNode = itemNode->NextSiblingElement("item"); @@ -334,7 +335,7 @@ bool CRssReader::Parse(int iFeed) TiXmlElement* rssXmlNode = NULL; - CStdString strValue = rootXmlNode->Value(); + std::string strValue = rootXmlNode->ValueStr(); if (strValue.find("rss") != std::string::npos || strValue.find("rdf") != std::string::npos) rssXmlNode = rootXmlNode; @@ -350,13 +351,13 @@ bool CRssReader::Parse(int iFeed) TiXmlElement* titleNode = channelXmlNode->FirstChildElement("title"); if (titleNode && !titleNode->NoChildren()) { - CStdString strChannel = titleNode->FirstChild()->Value(); - CStdStringW strChannelUnicode; + std::string strChannel = titleNode->FirstChild()->Value(); + std::wstring strChannelUnicode; g_charsetConverter.utf8ToW(strChannel, strChannelUnicode, m_rtlText); AddString(strChannelUnicode, RSS_COLOR_CHANNEL, iFeed); - AddString(":", RSS_COLOR_CHANNEL, iFeed); - AddString(" ", RSS_COLOR_CHANNEL, iFeed); + AddString(L":", RSS_COLOR_CHANNEL, iFeed); + AddString(L" ", RSS_COLOR_CHANNEL, iFeed); } GetNewsItems(channelXmlNode,iFeed); diff --git a/xbmc/utils/RssReader.h b/xbmc/utils/RssReader.h index 2c6f366351..2cda7267f1 100644 --- a/xbmc/utils/RssReader.h +++ b/xbmc/utils/RssReader.h @@ -20,12 +20,12 @@ */ #include <list> +#include <string> #include <vector> #include "threads/CriticalSection.h" #include "threads/Thread.h" #include "utils/IRssObserver.h" -#include "utils/StdString.h" #include "utils/XBMCTinyXML.h" class CRssReader : public CThread @@ -37,7 +37,7 @@ public: void Create(IRssObserver* aObserver, const std::vector<std::string>& aUrl, const std::vector<int>& times, int spacesBetweenFeeds, bool rtl); bool Parse(const std::string& data, int iFeed, const std::string& charset); void getFeed(vecText &text); - void AddTag(const CStdString &addTag); + void AddTag(const std::string &addTag); void AddToQueue(int iAdd); void UpdateObserver(); void SetObserver(IRssObserver* observer); @@ -49,20 +49,20 @@ private: void Process(); bool Parse(int iFeed); void GetNewsItems(TiXmlElement* channelXmlNode, int iFeed); - void AddString(CStdStringW aString, int aColour, int iFeed); + void AddString(std::wstring aString, int aColour, int iFeed); void UpdateFeed(); virtual void OnExit(); int GetQueueSize(); IRssObserver* m_pObserver; - std::vector<CStdStringW> m_strFeed; - std::vector<CStdStringW> m_strColors; + std::vector<std::wstring> m_strFeed; + std::vector<std::wstring> m_strColors; std::vector<SYSTEMTIME *> m_vecTimeStamps; std::vector<int> m_vecUpdateTimes; int m_spacesBetweenFeeds; CXBMCTinyXML m_xml; - std::list<CStdString> m_tagSet; + std::list<std::string> m_tagSet; std::vector<std::string> m_vecUrls; std::vector<int> m_vecQueue; bool m_bIsRunning; diff --git a/xbmc/utils/ScraperParser.cpp b/xbmc/utils/ScraperParser.cpp index 5142e4ad23..a7e23c9bc0 100644 --- a/xbmc/utils/ScraperParser.cpp +++ b/xbmc/utils/ScraperParser.cpp @@ -89,7 +89,7 @@ void CScraperParser::Clear() m_strFile.clear(); } -bool CScraperParser::Load(const CStdString& strXMLFile) +bool CScraperParser::Load(const std::string& strXMLFile) { Clear(); @@ -114,7 +114,7 @@ bool CScraperParser::LoadFromXML() return false; m_pRootElement = m_document->RootElement(); - CStdString strValue = m_pRootElement->Value(); + std::string strValue = m_pRootElement->ValueStr(); if (strValue == "scraper") { TiXmlElement* pChildElement = m_pRootElement->FirstChildElement("CreateSearchUrl"); @@ -149,15 +149,15 @@ bool CScraperParser::LoadFromXML() return false; } -void CScraperParser::ReplaceBuffers(CStdString& strDest) +void CScraperParser::ReplaceBuffers(std::string& strDest) { // insert buffers size_t iIndex; for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--) { iIndex = 0; - CStdString temp = StringUtils::Format("$$%i",i+1); - while ((iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING + std::string temp = StringUtils::Format("$$%i",i+1); + while ((iIndex = strDest.find(temp,iIndex)) != std::string::npos) { strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.size(),m_param[i]); iIndex += m_param[i].length(); @@ -165,11 +165,11 @@ void CScraperParser::ReplaceBuffers(CStdString& strDest) } // insert settings iIndex = 0; - while ((iIndex = strDest.find("$INFO[", iIndex)) != CStdString::npos) + while ((iIndex = strDest.find("$INFO[", iIndex)) != std::string::npos) { size_t iEnd = strDest.find("]", iIndex); - CStdString strInfo = strDest.substr(iIndex+6, iEnd - iIndex - 6); - CStdString strReplace; + std::string strInfo = strDest.substr(iIndex+6, iEnd - iIndex - 6); + std::string strReplace; if (m_scraper) strReplace = m_scraper->GetSetting(strInfo); strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace); @@ -177,24 +177,24 @@ void CScraperParser::ReplaceBuffers(CStdString& strDest) } // insert localize strings iIndex = 0; - while ((iIndex = strDest.find("$LOCALIZE[", iIndex)) != CStdString::npos) + while ((iIndex = strDest.find("$LOCALIZE[", iIndex)) != std::string::npos) { size_t iEnd = strDest.find("]", iIndex); - CStdString strInfo = strDest.substr(iIndex+10, iEnd - iIndex - 10); - CStdString strReplace; + std::string strInfo = strDest.substr(iIndex+10, iEnd - iIndex - 10); + std::string strReplace; if (m_scraper) strReplace = m_scraper->GetString(strtol(strInfo.c_str(),NULL,10)); strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace); iIndex += strReplace.length(); } iIndex = 0; - while ((iIndex = strDest.find("\\n",iIndex)) != CStdString::npos) + while ((iIndex = strDest.find("\\n",iIndex)) != std::string::npos) strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n"); } -void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend) +void CScraperParser::ParseExpression(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend) { - CStdString strOutput = XMLUtils::GetAttribute(element, "output"); + std::string strOutput = XMLUtils::GetAttribute(element, "output"); TiXmlElement* pExpression = element->FirstChildElement("expression"); if (pExpression) @@ -218,7 +218,7 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, } CRegExp reg(bInsensitive, eUtf8); - CStdString strExpression; + std::string strExpression; if (pExpression->FirstChild()) strExpression = pExpression->FirstChild()->Value(); else @@ -261,7 +261,7 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, pExpression->QueryIntAttribute("compare",&iCompare); if (iCompare > -1) StringUtils::ToLower(m_param[iCompare-1]); - CStdString curInput = input; + std::string curInput = input; for (int iBuf=0;iBuf<MAX_SCRAPER_BUFFERS;++iBuf) { if (bClean[iBuf]) @@ -281,7 +281,7 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, dest = ""; bAppend = true; } - CStdString strCurOutput=strOutput; + std::string strCurOutput=strOutput; if (iOptional > -1) // check that required param is there { @@ -314,13 +314,13 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, std::string result = reg.GetReplaceString(strCurOutput.c_str()); if (!result.empty()) { - CStdString strResult(result); + std::string strResult(result); StringUtils::Replace(strResult, "!!!AMPAMP!!!","&"); Clean(strResult); ReplaceBuffers(strResult); if (iCompare > -1) { - CStdString strResultNoCase = strResult; + std::string strResultNoCase = strResult; StringUtils::ToLower(strResultNoCase); if (strResultNoCase.find(m_param[iCompare-1]) != std::string::npos) dest += strResult; @@ -339,13 +339,13 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, } } -void CScraperParser::ParseXSLT(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend) +void CScraperParser::ParseXSLT(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend) { TiXmlElement* pSheet = element->FirstChildElement(); if (pSheet) { XSLTUtils xsltUtils; - CStdString strXslt; + std::string strXslt; strXslt << *pSheet; ReplaceBuffers(strXslt); @@ -406,7 +406,7 @@ void CScraperParser::ParseNext(TiXmlElement* element) } const char *szInput = pReg->Attribute("input"); - CStdString strInput; + std::string strInput; if (szInput) { strInput = szInput; @@ -425,10 +425,10 @@ void CScraperParser::ParseNext(TiXmlElement* element) bInverse = true; szConditional++; } - CStdString strSetting; + std::string strSetting; if (m_scraper && m_scraper->HasSettings()) strSetting = m_scraper->GetSetting(szConditional); - bExecute = bInverse != strSetting.Equals("true"); + bExecute = bInverse != (strSetting == "true"); } if (bExecute) @@ -448,7 +448,7 @@ void CScraperParser::ParseNext(TiXmlElement* element) } } -const CStdString CScraperParser::Parse(const CStdString& strTag, +const std::string CScraperParser::Parse(const std::string& strTag, CScraper* scraper) { TiXmlElement* pChildElement = m_pRootElement->FirstChildElement(strTag.c_str()); @@ -462,7 +462,7 @@ const CStdString CScraperParser::Parse(const CStdString& strTag, TiXmlElement* pChildStart = FirstChildScraperElement(pChildElement); m_scraper = scraper; ParseNext(pChildStart); - CStdString tmp = m_param[iResult-1]; + std::string tmp = m_param[iResult-1]; const char* szClearBuffers = pChildElement->Attribute("clearbuffers"); if (!szClearBuffers || stricmp(szClearBuffers,"no") != 0) @@ -471,17 +471,17 @@ const CStdString CScraperParser::Parse(const CStdString& strTag, return tmp; } -void CScraperParser::Clean(CStdString& strDirty) +void CScraperParser::Clean(std::string& strDirty) { size_t i = 0; - CStdString strBuffer; + std::string strBuffer; while ((i = strDirty.find("!!!CLEAN!!!",i)) != std::string::npos) { size_t i2; if ((i2 = strDirty.find("!!!CLEAN!!!",i+11)) != std::string::npos) { strBuffer = strDirty.substr(i+11,i2-i-11); - CStdString strConverted(strBuffer); + std::string strConverted(strBuffer); HTML::CHTMLUtil::RemoveTags(strConverted); StringUtils::Trim(strConverted); strDirty.replace(i, i2-i+11, strConverted); @@ -511,9 +511,9 @@ void CScraperParser::Clean(CStdString& strDirty) if ((i2 = strDirty.find("!!!FIXCHARS!!!",i+14)) != std::string::npos) { strBuffer = strDirty.substr(i+14,i2-i-14); - CStdStringW wbuffer; + std::wstring wbuffer; g_charsetConverter.toW(strBuffer,wbuffer,GetSearchStringEncoding()); - CStdStringW wConverted; + std::wstring wConverted; HTML::CHTMLUtil::ConvertHTMLToW(wbuffer,wConverted); g_charsetConverter.fromW(wConverted,strBuffer,GetSearchStringEncoding()); StringUtils::Trim(strBuffer); @@ -539,7 +539,7 @@ void CScraperParser::Clean(CStdString& strDirty) } } -void CScraperParser::ConvertJSON(CStdString &string) +void CScraperParser::ConvertJSON(std::string &string) { CRegExp reg; reg.RegComp("\\\\u([0-f]{4})"); @@ -548,7 +548,7 @@ void CScraperParser::ConvertJSON(CStdString &string) int pos = reg.GetSubStart(1); std::string szReplace(reg.GetMatch(1)); - CStdString replace = StringUtils::Format("&#x%s;", szReplace.c_str()); + std::string replace = StringUtils::Format("&#x%s;", szReplace.c_str()); string.replace(string.begin()+pos-2, string.begin()+pos+4, replace); } @@ -560,7 +560,7 @@ void CScraperParser::ConvertJSON(CStdString &string) int pos2 = reg2.GetSubStart(2); std::string szHexValue(reg2.GetMatch(1)); - CStdString replace = StringUtils::Format("%c", strtol(szHexValue.c_str(), NULL, 16)); + std::string replace = StringUtils::Format("%c", strtol(szHexValue.c_str(), NULL, 16)); string.replace(string.begin()+pos1-2, string.begin()+pos2+reg2.GetSubLength(2), replace); } @@ -591,7 +591,7 @@ void CScraperParser::GetBufferParams(bool* result, const char* attribute, bool d } } -void CScraperParser::InsertToken(CStdString& strOutput, int buf, const char* token) +void CScraperParser::InsertToken(std::string& strOutput, int buf, const char* token) { char temp[4]; sprintf(temp,"\\%i",buf); diff --git a/xbmc/utils/ScraperParser.h b/xbmc/utils/ScraperParser.h index 124022e0e9..8129ef7e75 100644 --- a/xbmc/utils/ScraperParser.h +++ b/xbmc/utils/ScraperParser.h @@ -21,9 +21,8 @@ * */ +#include <string> #include <vector> -#include "StdString.h" -#include "addons/IAddon.h" #define MAX_SCRAPER_BUFFERS 20 @@ -44,24 +43,24 @@ public: CScraperParser(const CScraperParser& parser); ~CScraperParser(); CScraperParser& operator= (const CScraperParser& parser); - bool Load(const CStdString& strXMLFile); + bool Load(const std::string& strXMLFile); bool IsNoop() const { return m_isNoop; }; void Clear(); - const CStdString& GetFilename() const { return m_strFile; } - CStdString GetSearchStringEncoding() const + const std::string& GetFilename() const { return m_strFile; } + std::string GetSearchStringEncoding() const { return m_SearchStringEncoding; } - const CStdString Parse(const CStdString& strTag, + const std::string Parse(const std::string& strTag, ADDON::CScraper* scraper); void AddDocument(const CXBMCTinyXML* doc); - CStdString m_param[MAX_SCRAPER_BUFFERS]; + std::string m_param[MAX_SCRAPER_BUFFERS]; private: bool LoadFromXML(); - void ReplaceBuffers(CStdString& strDest); - void ParseExpression(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend); + void ReplaceBuffers(std::string& strDest); + void ParseExpression(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend); /*! \brief Parse an 'XSLT' declaration from the scraper This allow us to transform an inbound XML document using XSLT @@ -72,13 +71,13 @@ private: \param element the current XML element \param bAppend append or clear the buffer */ - void ParseXSLT(const CStdString& input, CStdString& dest, TiXmlElement* element, bool bAppend); + void ParseXSLT(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend); void ParseNext(TiXmlElement* element); - void Clean(CStdString& strDirty); - void ConvertJSON(CStdString &string); + void Clean(std::string& strDirty); + void ConvertJSON(std::string &string); void ClearBuffers(); void GetBufferParams(bool* result, const char* attribute, bool defvalue); - void InsertToken(CStdString& strOutput, int buf, const char* token); + void InsertToken(std::string& strOutput, int buf, const char* token); CXBMCTinyXML* m_document; TiXmlElement* m_pRootElement; @@ -86,7 +85,7 @@ private: const char* m_SearchStringEncoding; bool m_isNoop; - CStdString m_strFile; + std::string m_strFile; ADDON::CScraper* m_scraper; }; diff --git a/xbmc/utils/ScraperUrl.cpp b/xbmc/utils/ScraperUrl.cpp index bca25456be..841adee998 100644 --- a/xbmc/utils/ScraperUrl.cpp +++ b/xbmc/utils/ScraperUrl.cpp @@ -38,7 +38,7 @@ using namespace std; -CScraperUrl::CScraperUrl(const CStdString& strUrl) +CScraperUrl::CScraperUrl(const std::string& strUrl) { relevance = 0; ParseString(strUrl); @@ -69,7 +69,7 @@ void CScraperUrl::Clear() bool CScraperUrl::Parse() { - CStdString strToParse = m_xml; + std::string strToParse = m_xml; m_xml.clear(); return ParseString(strToParse); } @@ -115,7 +115,7 @@ bool CScraperUrl::ParseElement(const TiXmlElement* element) return true; } -bool CScraperUrl::ParseString(CStdString strUrl) +bool CScraperUrl::ParseString(std::string strUrl) { if (strUrl.empty()) return false; @@ -193,11 +193,11 @@ unsigned int CScraperUrl::GetMaxSeasonThumb() const return maxSeason; } -bool CScraperUrl::Get(const SUrlEntry& scrURL, std::string& strHTML, XFILE::CCurlFile& http, const CStdString& cacheContext) +bool CScraperUrl::Get(const SUrlEntry& scrURL, std::string& strHTML, XFILE::CCurlFile& http, const std::string& cacheContext) { CURL url(scrURL.m_url); http.SetReferer(scrURL.m_spoof); - CStdString strCachePath; + std::string strCachePath; if (scrURL.m_isgz) http.SetContentEncoding("gzip"); @@ -218,11 +218,11 @@ bool CScraperUrl::Get(const SUrlEntry& scrURL, std::string& strHTML, XFILE::CCur } } - CStdString strHTML1(strHTML); + std::string strHTML1(strHTML); if (scrURL.m_post) { - CStdString strOptions = url.GetOptions(); + std::string strOptions = url.GetOptions(); strOptions = strOptions.substr(1); url.SetOptions(""); @@ -304,7 +304,7 @@ bool CScraperUrl::Get(const SUrlEntry& scrURL, std::string& strHTML, XFILE::CCur if (!scrURL.m_cache.empty()) { - CStdString strCachePath = URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath, + std::string strCachePath = URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath, "scrapers/" + cacheContext + "/" + scrURL.m_cache); XFILE::CFile file; if (file.OpenForWrite(strCachePath,true)) @@ -316,7 +316,7 @@ bool CScraperUrl::Get(const SUrlEntry& scrURL, std::string& strHTML, XFILE::CCur // XML format is of strUrls is: // <TAG><url>...</url>...</TAG> (parsed by ParseElement) or <url>...</url> (ditto) -bool CScraperUrl::ParseEpisodeGuide(CStdString strUrls) +bool CScraperUrl::ParseEpisodeGuide(std::string strUrls) { if (strUrls.empty()) return false; @@ -343,15 +343,15 @@ bool CScraperUrl::ParseEpisodeGuide(CStdString strUrls) return true; } -CStdString CScraperUrl::GetThumbURL(const CScraperUrl::SUrlEntry &entry) +std::string CScraperUrl::GetThumbURL(const CScraperUrl::SUrlEntry &entry) { if (entry.m_spoof.empty()) return entry.m_url; - return entry.m_url + "|Referer=" + CStdString(CURL::Encode(entry.m_spoof)); + return entry.m_url + "|Referer=" + CURL::Encode(entry.m_spoof); } -void CScraperUrl::GetThumbURLs(std::vector<CStdString> &thumbs, const std::string &type, int season) const +void CScraperUrl::GetThumbURLs(std::vector<std::string> &thumbs, const std::string &type, int season) const { for (vector<SUrlEntry>::const_iterator iter = m_url.begin(); iter != m_url.end(); ++iter) { diff --git a/xbmc/utils/ScraperUrl.h b/xbmc/utils/ScraperUrl.h index 359169f082..d9871e8f8f 100644 --- a/xbmc/utils/ScraperUrl.h +++ b/xbmc/utils/ScraperUrl.h @@ -23,7 +23,7 @@ #include <vector> #include <map> -#include "StdString.h" +#include <string> class TiXmlElement; namespace XFILE { class CCurlFile; } @@ -31,7 +31,7 @@ namespace XFILE { class CCurlFile; } class CScraperUrl { public: - CScraperUrl(const CStdString&); + CScraperUrl(const std::string&); CScraperUrl(const TiXmlElement*); CScraperUrl(); ~CScraperUrl(); @@ -44,9 +44,9 @@ public: struct SUrlEntry { - CStdString m_spoof; - CStdString m_url; - CStdString m_cache; + std::string m_spoof; + std::string m_url; + std::string m_cache; std::string m_aspect; URLTYPES m_type; bool m_post; @@ -55,9 +55,9 @@ public: }; bool Parse(); - bool ParseString(CStdString); // copies by intention + bool ParseString(std::string); // copies by intention bool ParseElement(const TiXmlElement*); - bool ParseEpisodeGuide(CStdString strUrls); // copies by intention + bool ParseEpisodeGuide(std::string strUrls); // copies by intention const SUrlEntry GetFirstThumb(const std::string &type = "") const; const SUrlEntry GetSeasonThumb(int season, const std::string &type = "") const; @@ -67,22 +67,22 @@ public: \param URL entry to use to create the full URL \return the full URL, including referrer */ - static CStdString GetThumbURL(const CScraperUrl::SUrlEntry &entry); + static std::string GetThumbURL(const CScraperUrl::SUrlEntry &entry); /*! \brief fetch the full URL (including referrer) of thumbs \param thumbs [out] vector of thumb URLs to fill \param type the type of thumb URLs to fetch, if empty (the default) picks any \param season number of season that we want thumbs for, -1 indicates no season (the default) */ - void GetThumbURLs(std::vector<CStdString> &thumbs, const std::string &type = "", int season = -1) const; + void GetThumbURLs(std::vector<std::string> &thumbs, const std::string &type = "", int season = -1) const; void Clear(); static bool Get(const SUrlEntry&, std::string&, XFILE::CCurlFile& http, - const CStdString& cacheContext); + const std::string& cacheContext); - CStdString m_xml; - CStdString m_spoof; // for backwards compatibility only! - CStdString strTitle; - CStdString strId; + std::string m_xml; + std::string m_spoof; // for backwards compatibility only! + std::string strTitle; + std::string strId; double relevance; std::vector<SUrlEntry> m_url; }; diff --git a/xbmc/utils/Screenshot.cpp b/xbmc/utils/Screenshot.cpp index 73ab4fa9c7..db73d4aa0b 100644 --- a/xbmc/utils/Screenshot.cpp +++ b/xbmc/utils/Screenshot.cpp @@ -171,7 +171,7 @@ bool CScreenshotSurface::capture() return true; } -void CScreenShot::TakeScreenshot(const CStdString &filename, bool sync) +void CScreenShot::TakeScreenshot(const std::string &filename, bool sync) { CScreenshotSurface surface; @@ -220,9 +220,9 @@ void CScreenShot::TakeScreenshot(const CStdString &filename, bool sync) void CScreenShot::TakeScreenshot() { static bool savingScreenshots = false; - static vector<CStdString> screenShots; + static vector<std::string> screenShots; bool promptUser = false; - CStdString strDir; + std::string strDir; // check to see if we have a screenshot folder yet CSettingPath *screenshotSetting = (CSettingPath*)CSettings::Get().GetSetting("debug.screenshotpath"); @@ -250,7 +250,7 @@ void CScreenShot::TakeScreenshot() if (!strDir.empty()) { - CStdString file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(strDir, "screenshot%03d.png"), 999); + std::string file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(strDir, "screenshot%03d.png"), 999); if (!file.empty()) { @@ -259,7 +259,7 @@ void CScreenShot::TakeScreenshot() screenShots.push_back(file); if (promptUser) { // grab the real directory - CStdString newDir; + std::string newDir; if (screenshotSetting != NULL) { newDir = screenshotSetting->GetValue(); @@ -274,7 +274,7 @@ void CScreenShot::TakeScreenshot() { for (unsigned int i = 0; i < screenShots.size(); i++) { - CStdString file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(newDir, "screenshot%03d.png"), 999); + std::string file = CUtil::GetNextFilename(URIUtils::AddFileToFolder(newDir, "screenshot%03d.png"), 999); CFile::Copy(screenShots[i], file); } screenShots.clear(); diff --git a/xbmc/utils/Screenshot.h b/xbmc/utils/Screenshot.h index 2a11c428d3..200688c93d 100644 --- a/xbmc/utils/Screenshot.h +++ b/xbmc/utils/Screenshot.h @@ -19,7 +19,7 @@ * */ -#include "utils/StdString.h" +#include <string> class CScreenshotSurface { @@ -40,5 +40,5 @@ class CScreenShot public: static void TakeScreenshot(); - static void TakeScreenshot(const CStdString &filename, bool sync); + static void TakeScreenshot(const std::string &filename, bool sync); }; diff --git a/xbmc/utils/Splash.cpp b/xbmc/utils/Splash.cpp index 490ff6d591..764f64ab66 100644 --- a/xbmc/utils/Splash.cpp +++ b/xbmc/utils/Splash.cpp @@ -30,7 +30,7 @@ using namespace XFILE; -CSplash::CSplash(const CStdString& imageName) : CThread("Splash"), m_ImageName(imageName) +CSplash::CSplash(const std::string& imageName) : CThread("Splash"), m_ImageName(imageName) { fade = 0.5; m_messageLayout = NULL; @@ -57,7 +57,7 @@ void CSplash::Show() Show(""); } -void CSplash::Show(const CStdString& message) +void CSplash::Show(const std::string& message) { g_graphicsContext.Lock(); g_graphicsContext.Clear(); @@ -66,7 +66,7 @@ void CSplash::Show(const CStdString& message) g_graphicsContext.SetRenderingResolution(res, true); if (!m_image) { - m_image = new CGUIImage(0, 0, 0, 0, 1280, 720, m_ImageName); + m_image = new CGUIImage(0, 0, 0, 0, 1280, 720, CTextureInfo(m_ImageName)); m_image->SetAspectRatio(CAspectRatio::AR_CENTER); } diff --git a/xbmc/utils/Splash.h b/xbmc/utils/Splash.h index aea742c0a4..2cd7a4b13c 100644 --- a/xbmc/utils/Splash.h +++ b/xbmc/utils/Splash.h @@ -20,7 +20,7 @@ * */ -#include "StdString.h" +#include <string> #include "threads/Thread.h" class CGUITextLayout; @@ -29,7 +29,7 @@ class CGUIImage; class CSplash : public CThread { public: - CSplash(const CStdString& imageName); + CSplash(const std::string& imageName); virtual ~CSplash(); bool Start(); @@ -37,7 +37,7 @@ public: // In case you don't want to use another thread void Show(); - void Show(const CStdString& message); + void Show(const std::string& message); void Hide(); private: @@ -46,7 +46,7 @@ private: virtual void OnExit(); float fade; - CStdString m_ImageName; + std::string m_ImageName; CGUITextLayout* m_messageLayout; CGUIImage* m_image; diff --git a/xbmc/utils/StreamDetails.cpp b/xbmc/utils/StreamDetails.cpp index 000bef0d23..28b413d249 100644 --- a/xbmc/utils/StreamDetails.cpp +++ b/xbmc/utils/StreamDetails.cpp @@ -348,7 +348,7 @@ const CStreamDetail* CStreamDetails::GetNthStream(CStreamDetail::StreamType type return NULL; } -CStdString CStreamDetails::GetVideoCodec(int idx) const +std::string CStreamDetails::GetVideoCodec(int idx) const { CStreamDetailVideo *item = (CStreamDetailVideo *)GetNthStream(CStreamDetail::VIDEO, idx); if (item) @@ -409,7 +409,7 @@ std::string CStreamDetails::GetStereoMode(int idx) const return ""; } -CStdString CStreamDetails::GetAudioCodec(int idx) const +std::string CStreamDetails::GetAudioCodec(int idx) const { CStreamDetailAudio *item = (CStreamDetailAudio *)GetNthStream(CStreamDetail::AUDIO, idx); if (item) @@ -418,7 +418,7 @@ CStdString CStreamDetails::GetAudioCodec(int idx) const return ""; } -CStdString CStreamDetails::GetAudioLanguage(int idx) const +std::string CStreamDetails::GetAudioLanguage(int idx) const { CStreamDetailAudio *item = (CStreamDetailAudio *)GetNthStream(CStreamDetail::AUDIO, idx); if (item) @@ -436,7 +436,7 @@ int CStreamDetails::GetAudioChannels(int idx) const return -1; } -CStdString CStreamDetails::GetSubtitleLanguage(int idx) const +std::string CStreamDetails::GetSubtitleLanguage(int idx) const { CStreamDetailSubtitle *item = (CStreamDetailSubtitle *)GetNthStream(CStreamDetail::SUBTITLE, idx); if (item) @@ -541,7 +541,7 @@ void CStreamDetails::DetermineBestStreams(void) } /* for each */ } -CStdString CStreamDetails::VideoDimsToResolutionDescription(int iWidth, int iHeight) +std::string CStreamDetails::VideoDimsToResolutionDescription(int iWidth, int iHeight) { if (iWidth == 0 || iHeight == 0) return ""; @@ -567,7 +567,7 @@ CStdString CStreamDetails::VideoDimsToResolutionDescription(int iWidth, int iHei return ""; } -CStdString CStreamDetails::VideoAspectToAspectDescription(float fAspect) +std::string CStreamDetails::VideoAspectToAspectDescription(float fAspect) { if (fAspect == 0.0f) return ""; diff --git a/xbmc/utils/StreamDetails.h b/xbmc/utils/StreamDetails.h index 3372cfb4b7..fdda28eeab 100644 --- a/xbmc/utils/StreamDetails.h +++ b/xbmc/utils/StreamDetails.h @@ -19,9 +19,9 @@ * */ -#include "utils/StdString.h" #include "utils/IArchivable.h" #include "ISerializable.h" +#include <string> #include <vector> class CStreamDetails; @@ -59,7 +59,7 @@ public: int m_iHeight; float m_fAspect; int m_iDuration; - CStdString m_strCodec; + std::string m_strCodec; std::string m_strStereoMode; }; @@ -72,8 +72,8 @@ public: virtual bool IsWorseThan(CStreamDetail *that); int m_iChannels; - CStdString m_strCodec; - CStdString m_strLanguage; + std::string m_strCodec; + std::string m_strLanguage; }; class CStreamDetailSubtitle : public CStreamDetail @@ -85,7 +85,7 @@ public: virtual void Serialize(CVariant& value) const; virtual bool IsWorseThan(CStreamDetail *that); - CStdString m_strLanguage; + std::string m_strLanguage; }; class CStreamDetails : public IArchivable, public ISerializable @@ -98,8 +98,8 @@ public: bool operator ==(const CStreamDetails &that) const; bool operator !=(const CStreamDetails &that) const; - static CStdString VideoDimsToResolutionDescription(int iWidth, int iHeight); - static CStdString VideoAspectToAspectDescription(float fAspect); + static std::string VideoDimsToResolutionDescription(int iWidth, int iHeight); + static std::string VideoAspectToAspectDescription(float fAspect); bool HasItems(void) const { return m_vecItems.size() > 0; }; int GetStreamCount(CStreamDetail::StreamType type) const; @@ -108,7 +108,7 @@ public: int GetSubtitleStreamCount(void) const; const CStreamDetail* GetNthStream(CStreamDetail::StreamType type, int idx) const; - CStdString GetVideoCodec(int idx = 0) const; + std::string GetVideoCodec(int idx = 0) const; float GetVideoAspect(int idx = 0) const; int GetVideoWidth(int idx = 0) const; int GetVideoHeight(int idx = 0) const; @@ -116,11 +116,11 @@ public: void SetVideoDuration(int idx, const int duration); std::string GetStereoMode(int idx = 0) const; - CStdString GetAudioCodec(int idx = 0) const; - CStdString GetAudioLanguage(int idx = 0) const; + std::string GetAudioCodec(int idx = 0) const; + std::string GetAudioLanguage(int idx = 0) const; int GetAudioChannels(int idx = 0) const; - CStdString GetSubtitleLanguage(int idx = 0) const; + std::string GetSubtitleLanguage(int idx = 0) const; void AddStream(CStreamDetail *item); void Reset(void); diff --git a/xbmc/utils/StreamUtils.cpp b/xbmc/utils/StreamUtils.cpp index 1b78467662..e7ef9a149a 100644 --- a/xbmc/utils/StreamUtils.cpp +++ b/xbmc/utils/StreamUtils.cpp @@ -20,7 +20,7 @@ #include "StreamUtils.h" -int StreamUtils::GetCodecPriority(const CStdString &codec) +int StreamUtils::GetCodecPriority(const std::string &codec) { /* * Technically flac, truehd, and dtshd_ma are equivalently good as they're all lossless. However, diff --git a/xbmc/utils/StreamUtils.h b/xbmc/utils/StreamUtils.h index 925860f8d1..46edebab12 100644 --- a/xbmc/utils/StreamUtils.h +++ b/xbmc/utils/StreamUtils.h @@ -19,10 +19,10 @@ * */ -#include "StdString.h" +#include <string> class StreamUtils { public: - static int GetCodecPriority(const CStdString &codec); + static int GetCodecPriority(const std::string &codec); }; diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index bbb9b9e97b..cf1a0f61ad 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -257,7 +257,7 @@ const CSysData &CSysInfoJob::GetData() const return m_info; } -CStdString CSysInfoJob::GetCPUFreqInfo() +std::string CSysInfoJob::GetCPUFreqInfo() { double CPUFreq = GetCPUFrequency(); return StringUtils::Format("%4.2fMHz", CPUFreq);; @@ -272,7 +272,7 @@ CSysData::INTERNET_STATE CSysInfoJob::GetInternetState() return CSysData::DISCONNECTED; } -CStdString CSysInfoJob::GetMACAddress() +std::string CSysInfoJob::GetMACAddress() { #if defined(HAS_LINUX_NETWORK) || defined(HAS_WIN32_NETWORK) CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface(); @@ -282,12 +282,12 @@ CStdString CSysInfoJob::GetMACAddress() return ""; } -CStdString CSysInfoJob::GetVideoEncoder() +std::string CSysInfoJob::GetVideoEncoder() { return "GPU: " + g_Windowing.GetRenderRenderer(); } -CStdString CSysInfoJob::GetBatteryLevel() +std::string CSysInfoJob::GetBatteryLevel() { return StringUtils::Format("%d%%", g_powerManager.BatteryLevel()); } @@ -318,9 +318,9 @@ bool CSysInfoJob::SystemUpTime(int iInputMinutes, int &iMinutes, int &iHours, in return true; } -CStdString CSysInfoJob::GetSystemUpTime(bool bTotalUptime) +std::string CSysInfoJob::GetSystemUpTime(bool bTotalUptime) { - CStdString strSystemUptime; + std::string strSystemUptime; int iInputMinutes, iMinutes,iHours,iDays; if(bTotalUptime) @@ -356,7 +356,7 @@ CStdString CSysInfoJob::GetSystemUpTime(bool bTotalUptime) return strSystemUptime; } -CStdString CSysInfo::TranslateInfo(int info) const +std::string CSysInfo::TranslateInfo(int info) const { switch(info) { @@ -429,18 +429,18 @@ bool CSysInfo::Save(TiXmlNode *settings) const return true; } -bool CSysInfo::GetDiskSpace(const CStdString& drive,int& iTotal, int& iTotalFree, int& iTotalUsed, int& iPercentFree, int& iPercentUsed) +bool CSysInfo::GetDiskSpace(const std::string& drive,int& iTotal, int& iTotalFree, int& iTotalUsed, int& iPercentFree, int& iPercentUsed) { bool bRet= false; ULARGE_INTEGER ULTotal= { { 0 } }; ULARGE_INTEGER ULTotalFree= { { 0 } }; - if( !drive.empty() && !drive.Equals("*") ) + if( !drive.empty() && drive != "*" ) { #ifdef TARGET_WINDOWS - UINT uidriveType = GetDriveType(( drive + ":\\" )); + UINT uidriveType = GetDriveType(( drive + ":\\" ).c_str()); if(uidriveType != DRIVE_UNKNOWN && uidriveType != DRIVE_NO_ROOT_DIR) - bRet= ( 0 != GetDiskFreeSpaceEx( ( drive + ":\\" ), NULL, &ULTotal, &ULTotalFree) ); + bRet= ( 0 != GetDiskFreeSpaceEx( ( drive + ":\\" ).c_str(), NULL, &ULTotal, &ULTotalFree) ); #elif defined(TARGET_POSIX) bRet = (0 != GetDiskFreeSpaceEx(drive.c_str(), NULL, &ULTotal, &ULTotalFree)); #endif @@ -503,27 +503,27 @@ bool CSysInfo::GetDiskSpace(const CStdString& drive,int& iTotal, int& iTotalFree return bRet; } -CStdString CSysInfo::GetCPUModel() +std::string CSysInfo::GetCPUModel() { return "CPU: " + g_cpuInfo.getCPUModel(); } -CStdString CSysInfo::GetCPUBogoMips() +std::string CSysInfo::GetCPUBogoMips() { return "BogoMips: " + g_cpuInfo.getCPUBogoMips(); } -CStdString CSysInfo::GetCPUHardware() +std::string CSysInfo::GetCPUHardware() { return "Hardware: " + g_cpuInfo.getCPUHardware(); } -CStdString CSysInfo::GetCPURevision() +std::string CSysInfo::GetCPURevision() { return "Revision: " + g_cpuInfo.getCPURevision(); } -CStdString CSysInfo::GetCPUSerial() +std::string CSysInfo::GetCPUSerial() { return "Serial: " + g_cpuInfo.getCPUSerial(); } @@ -974,16 +974,16 @@ bool CSysInfo::HasInternet() return (m_info.internetState = CSysInfoJob::GetInternetState()) == CSysData::CONNECTED; } -CStdString CSysInfo::GetHddSpaceInfo(int drive, bool shortText) +std::string CSysInfo::GetHddSpaceInfo(int drive, bool shortText) { int percent; return GetHddSpaceInfo( percent, drive, shortText); } -CStdString CSysInfo::GetHddSpaceInfo(int& percent, int drive, bool shortText) +std::string CSysInfo::GetHddSpaceInfo(int& percent, int drive, bool shortText) { int total, totalFree, totalUsed, percentFree, percentused; - CStdString strRet; + std::string strRet; percent = 0; if (g_sysinfo.GetDiskSpace("", total, totalFree, totalUsed, percentFree, percentused)) { diff --git a/xbmc/utils/SystemInfo.h b/xbmc/utils/SystemInfo.h index 124276a41a..1b83408290 100644 --- a/xbmc/utils/SystemInfo.h +++ b/xbmc/utils/SystemInfo.h @@ -23,6 +23,7 @@ #include "md5.h" #include "InfoLoader.h" #include "settings/lib/ISubSettings.h" +#include <string> #define KB (1024) // 1 KiloByte (1KB) 1024 Byte (2^10 Byte) #define MB (1024*KB) // 1 MegaByte (1MB) 1024 KB (2^10 KB) @@ -46,14 +47,14 @@ public: internetState = UNKNOWN; }; - CStdString systemUptime; - CStdString systemTotalUptime; + std::string systemUptime; + std::string systemTotalUptime; INTERNET_STATE internetState; - CStdString videoEncoder; - CStdString cpuFrequency; - CStdString osVersionInfo; - CStdString macAddress; - CStdString batteryLevel; + std::string videoEncoder; + std::string cpuFrequency; + std::string osVersionInfo; + std::string macAddress; + std::string batteryLevel; }; class CSysInfoJob : public CJob @@ -68,11 +69,11 @@ public: private: static bool SystemUpTime(int iInputMinutes, int &iMinutes, int &iHours, int &iDays); static double GetCPUFrequency(); - static CStdString GetSystemUpTime(bool bTotalUptime); - static CStdString GetCPUFreqInfo(); - static CStdString GetMACAddress(); - static CStdString GetVideoEncoder(); - static CStdString GetBatteryLevel(); + static std::string GetSystemUpTime(bool bTotalUptime); + static std::string GetCPUFreqInfo(); + static std::string GetMACAddress(); + static std::string GetVideoEncoder(); + static std::string GetBatteryLevel(); CSysData m_info; }; @@ -117,16 +118,16 @@ public: static int GetKernelBitness(void); static int GetXbmcBitness(void); static std::string GetKernelCpuFamily(void); - CStdString GetCPUModel(); - CStdString GetCPUBogoMips(); - CStdString GetCPUHardware(); - CStdString GetCPURevision(); - CStdString GetCPUSerial(); + std::string GetCPUModel(); + std::string GetCPUBogoMips(); + std::string GetCPUHardware(); + std::string GetCPURevision(); + std::string GetCPUSerial(); static std::string GetManufacturerName(void); static std::string GetModelName(void); - bool GetDiskSpace(const CStdString& drive,int& iTotal, int& iTotalFree, int& iTotalUsed, int& iPercentFree, int& iPercentUsed); - CStdString GetHddSpaceInfo(int& percent, int drive, bool shortText=false); - CStdString GetHddSpaceInfo(int drive, bool shortText=false); + bool GetDiskSpace(const std::string& drive,int& iTotal, int& iTotalFree, int& iTotalUsed, int& iPercentFree, int& iPercentUsed); + std::string GetHddSpaceInfo(int& percent, int drive, bool shortText=false); + std::string GetHddSpaceInfo(int drive, bool shortText=false); int GetTotalUptime() const { return m_iSystemTimeTotalUp; } void SetTotalUptime(int uptime) { m_iSystemTimeTotalUp = uptime; } @@ -140,7 +141,7 @@ public: protected: virtual CJob *GetJob() const; - virtual CStdString TranslateInfo(int info) const; + virtual std::string TranslateInfo(int info) const; virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); private: diff --git a/xbmc/utils/TuxBoxUtil.cpp b/xbmc/utils/TuxBoxUtil.cpp index b8e3320fd8..4cd44272e2 100644 --- a/xbmc/utils/TuxBoxUtil.cpp +++ b/xbmc/utils/TuxBoxUtil.cpp @@ -96,8 +96,8 @@ bool CTuxBoxService::IsRunning() } void CTuxBoxService::Process() { - CStdString strCurrentServiceName = g_tuxbox.sCurSrvData.service_name; - CStdString strURL; + std::string strCurrentServiceName = g_tuxbox.sCurSrvData.service_name; + std::string strURL; while(!CThread::m_bStop && g_application.m_pPlayer->IsPlaying()) { @@ -113,9 +113,9 @@ void CTuxBoxService::Process() { CLog::Log(LOGDEBUG, "%s - receive current service data was successful", __FUNCTION__); if(!strCurrentServiceName.empty()&& - !strCurrentServiceName.Equals("NULL") && + strCurrentServiceName != "NULL" && !g_tuxbox.sCurSrvData.service_name.empty() && - !g_tuxbox.sCurSrvData.service_name.Equals("-") && + g_tuxbox.sCurSrvData.service_name != "-" && !g_tuxbox.vVideoSubChannel.mode) { //Detect Channel Change @@ -145,25 +145,25 @@ bool CTuxBoxUtil::CreateNewItem(const CFileItem& item, CFileItem& item_new) if(g_tuxbox.GetZapUrl(item.GetPath(), item_new)) { if(vVideoSubChannel.mode) - vVideoSubChannel.current_name = (CStdString)item_new.GetLabel()+" ("+vVideoSubChannel.current_name+")"; + vVideoSubChannel.current_name = item_new.GetLabel()+" ("+vVideoSubChannel.current_name+")"; return true; } else { - if(!sBoxStatus.recording.Equals("1")) //Don't Show this Dialog, if the Box is in Recording mode! A previos YN Dialog was send to user! + if(sBoxStatus.recording != "1") //Don't Show this Dialog, if the Box is in Recording mode! A previos YN Dialog was send to user! { CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__); CLog::Log(LOGDEBUG, "%s - WARNING: Zaping Failed no Zap Point found!", __FUNCTION__); CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__); - CStdString strText = StringUtils::Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel().c_str()); + std::string strText = StringUtils::Format(g_localizeStrings.Get(21334).c_str(), item.GetLabel().c_str()); CGUIDialogOK::ShowAndGetInput(21331, strText, 21333, 0); } } return false; } -bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild) +bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL &url, std::string strFilter, std::string strChild) { - CStdString strOptions, strPort; + std::string strOptions, strPort; TiXmlElement *pRootElement =root; TiXmlNode *pNode = NULL; TiXmlNode *pIt = NULL; @@ -189,12 +189,12 @@ bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL & pIt = pNode->FirstChild("name"); if (pIt) { - CStdString strItemName = pIt->FirstChild()->Value(); + std::string strItemName = pIt->FirstChild()->Value(); pIt = pNode->FirstChild("reference"); if (pIt) { - CStdString strItemPath = pIt->FirstChild()->Value(); + std::string strItemPath = pIt->FirstChild()->Value(); // add. bouquets to item list! CFileItemPtr pItem(new CFileItem); pItem->m_bIsFolder = true; @@ -222,9 +222,9 @@ bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL & } return true; } -bool CTuxBoxUtil::ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild) +bool CTuxBoxUtil::ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, std::string& strFilter, std::string& strChild) { - CStdString strPort; + std::string strPort; TiXmlElement *pRootElement = root; TiXmlNode *pNode = NULL; TiXmlNode *pIt = NULL; @@ -247,9 +247,9 @@ bool CTuxBoxUtil::ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, { CFileItemPtr pItem(new CFileItem); pIt = pNode->FirstChildElement("e2servicereference"); - CStdString strItemPath = pIt->FirstChild()->Value(); + std::string strItemPath = pIt->FirstChild()->Value(); pIt = pNode->FirstChildElement("e2servicename"); - CStdString strItemName = pIt->FirstChild()->Value(); + std::string strItemName = pIt->FirstChild()->Value(); pItem->m_bIsFolder = true; pItem->SetLabel(strItemName); { @@ -267,9 +267,9 @@ bool CTuxBoxUtil::ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, } return true; } -bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild) +bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL &url, std::string strFilter, std::string strChild) { - CStdString strPort; + std::string strPort; TiXmlElement *pRootElement =root; TiXmlNode *pNode = NULL; TiXmlNode *pIt = NULL; @@ -294,10 +294,10 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & pIt = pNode->FirstChild("name"); if (pIt) { - CStdString strItemName = pIt->FirstChild()->Value(); + std::string strItemName = pIt->FirstChild()->Value(); pIt = pNode->FirstChild("reference"); - if (strFilter.Equals(pIt->FirstChild()->Value())) + if (strFilter == pIt->FirstChild()->Value()) { pIt = pNode->FirstChild("service"); if (!pIt) @@ -315,7 +315,7 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & pIta = pIt->FirstChild("reference"); if (pIta) { - CStdString strItemPath = pIta->FirstChild()->Value(); + std::string strItemPath = pIta->FirstChild()->Value(); // channel listing add. to item list! CFileItemPtr pbItem(new CFileItem); pbItem->m_bIsFolder = false; @@ -353,7 +353,7 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & } return false; } -bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild) +bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, std::string& strFilter, std::string& strChild) { TiXmlElement *pRootElement = root; TiXmlNode *pNode = NULL; @@ -378,15 +378,15 @@ bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, while(pNode) { pIt = pNode->FirstChildElement("e2servicename"); - CStdString bqtName = pIt->FirstChild()->Value(); + std::string bqtName = pIt->FirstChild()->Value(); pIt = pNode->FirstChildElement("e2servicelist"); pIta = pIt->FirstChildElement("e2service"); while(pIta) { pItb = pIta->FirstChildElement("e2servicereference"); - CStdString strItemPath = pItb->FirstChild()->Value(); + std::string strItemPath = pItb->FirstChild()->Value(); pItb = pIta->FirstChildElement("e2servicename"); - CStdString strItemName = pItb->FirstChild()->Value(); + std::string strItemName = pItb->FirstChild()->Value(); if(bqtName == url.GetShareName()) { CFileItemPtr pbItem(new CFileItem); @@ -412,10 +412,10 @@ bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, } return true; } -bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) +bool CTuxBoxUtil::ZapToUrl(CURL url, const std::string &pathOption) { // send Zap - CStdString strZapUrl, strPostUrl, strZapName, strFilter; + std::string strZapUrl, strPostUrl, strZapName, strFilter; //Extract the ZAP to Service String //Remove the ".ts" strFilter = pathOption.substr(0, pathOption.size() - 3); @@ -436,7 +436,7 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) //Check Recording State! if(GetHttpXML(urlx,"boxstatus")) { - if(sBoxStatus.recording.Equals("1")) + if(sBoxStatus.recording == "1") { CLog::Log(LOGDEBUG, "%s ---------------------------------------------------------", __FUNCTION__); CLog::Log(LOGDEBUG, "%s - WARNING: Device is Recording! Record Mode is: %s", __FUNCTION__,sBoxStatus.recording.c_str()); @@ -472,7 +472,7 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) //Extract StreamInformations int iRetry=0; //PMT must be a valid value to be sure that the ZAP is OK and we can stream! - while(sStrmInfo.pmt.Equals("ffffffffh") && iRetry!=10) //try 10 Times + while(sStrmInfo.pmt == "ffffffffh" && iRetry!=10) //try 10 Times { CLog::Log(LOGDEBUG, "%s - Requesting STREAMINFO! TryCount: %i!", __FUNCTION__,iRetry); GetHttpXML(urlx,"streaminfo"); @@ -481,16 +481,16 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) } // PMT Not Valid? Try Time 10 reached, checking for advancedSettings m_iTuxBoxZapWaitTime - if(sStrmInfo.pmt.Equals("ffffffffh") && g_advancedSettings.m_iTuxBoxZapWaitTime > 0 ) + if(sStrmInfo.pmt == "ffffffffh" && g_advancedSettings.m_iTuxBoxZapWaitTime > 0 ) { iRetry = 0; CLog::Log(LOGDEBUG, "%s - Starting TuxBox ZapWaitTimer!", __FUNCTION__); - while(sStrmInfo.pmt.Equals("ffffffffh") && iRetry!=10) //try 10 Times + while(sStrmInfo.pmt == "ffffffffh" && iRetry!=10) //try 10 Times { CLog::Log(LOGDEBUG, "%s - Requesting STREAMINFO! TryCount: %i!", __FUNCTION__,iRetry); GetHttpXML(urlx,"streaminfo"); iRetry=iRetry+1; - if(sStrmInfo.pmt.Equals("ffffffffh")) + if(sStrmInfo.pmt == "ffffffffh") { CLog::Log(LOGERROR, "%s - STREAMINFO ERROR! Could not receive all data, TryCount: %i!", __FUNCTION__,iRetry); CLog::Log(LOGERROR, "%s - PMT is: %s (not a Valid Value)! Waiting %i sec.", __FUNCTION__,sStrmInfo.pmt.c_str(), g_advancedSettings.m_iTuxBoxZapWaitTime); @@ -500,7 +500,7 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) } //PMT Failed! No StreamInformations availible.. closing stream - if (sStrmInfo.pmt.Equals("ffffffffh")) + if (sStrmInfo.pmt == "ffffffffh") { CLog::Log(LOGERROR, "%s-------------------------------------------------------------", __FUNCTION__); CLog::Log(LOGERROR, "%s - STREAMINFO ERROR! Could not receive all data, TryCount: %i!", __FUNCTION__,iRetry); @@ -521,10 +521,10 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, const CStdString &pathOption) } return false; } -bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) +bool CTuxBoxUtil::GetZapUrl(const std::string& strPath, CFileItem &items ) { CURL url(strPath); - CStdString strOptions = url.GetOptions(); + std::string strOptions = url.GetOptions(); if (strOptions.empty()) return false; @@ -536,7 +536,7 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) if(GetHttpXML(url,"currentservicedata")) //Update Currentservicedata { //Detect VideoSubChannels - CStdString strVideoSubChannelName, strVideoSubChannelPID; + std::string strVideoSubChannelName, strVideoSubChannelPID; if(GetVideoSubChannels(strVideoSubChannelName,strVideoSubChannelPID )) { // new videosubchannel selected! settings options to new video zap id @@ -551,10 +551,10 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) vVideoSubChannel.mode= false; } - CStdString strStreamURL, strVideoStream; - CStdString strLabel, strLabel2; - CStdString strAudioChannelName, strAudioChannelPid; - CStdString strAPids; + std::string strStreamURL, strVideoStream; + std::string strLabel, strLabel2; + std::string strAudioChannelName, strAudioChannelPid; + std::string strAPids; sAudioChannel sRequestedAudioChannel; if (!GetGUIRequestedAudioChannel(sRequestedAudioChannel)) @@ -624,7 +624,7 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) strLabel2 = StringUtils::Format("%s", sCurSrvData.current_event_description.c_str()); // Set Event details - CStdString strGenre, strTitle; + std::string strGenre, strTitle; 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()); @@ -649,7 +649,7 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) // Notice: Zapstream is a streamts enhancement from PLi development team. // If you are using a non-PLi based image you might not have Zapstream installed. -bool CTuxBoxUtil::InitZapstream(const CStdString& strPath) +bool CTuxBoxUtil::InitZapstream(const std::string& strPath) { CURL url(strPath); CCurlFile http; @@ -677,7 +677,7 @@ bool CTuxBoxUtil::InitZapstream(const CStdString& strPath) { http.Close(); CHttpHeader h = http.GetHttpHeader(); - CStdString strValue = h.GetValue("server"); + std::string strValue = h.GetValue("server"); if (strValue.find("zapstream") != std::string::npos) { @@ -693,7 +693,7 @@ bool CTuxBoxUtil::InitZapstream(const CStdString& strPath) CLog::Log(LOGDEBUG, "%s - Zapstream is not available on port %i.", __FUNCTION__, g_advancedSettings.m_iTuxBoxZapstreamPort); return false; } -bool CTuxBoxUtil::SetAudioChannel( const CStdString& strPath, const AUDIOCHANNEL& sAC ) +bool CTuxBoxUtil::SetAudioChannel( const std::string& strPath, const AUDIOCHANNEL& sAC ) { CURL url(strPath); CCurlFile http; @@ -723,28 +723,28 @@ bool CTuxBoxUtil::SetAudioChannel( const CStdString& strPath, const AUDIOCHANNEL return false; } -bool CTuxBoxUtil::GetHttpXML(CURL url,CStdString strRequestType) +bool CTuxBoxUtil::GetHttpXML(CURL url,std::string strRequestType) { // Check and Set URL Request Option if(!strRequestType.empty()) { - if(strRequestType.Equals("streaminfo")) + if(strRequestType == "streaminfo") { url.SetOptions("xml/streaminfo"); } - else if(strRequestType.Equals("currentservicedata")) + else if(strRequestType == "currentservicedata") { url.SetOptions("xml/currentservicedata"); } - else if(strRequestType.Equals("boxstatus")) + else if(strRequestType == "boxstatus") { url.SetOptions("xml/boxstatus"); } - else if(strRequestType.Equals("boxinfo")) + else if(strRequestType == "boxinfo") { url.SetOptions("xml/boxinfo"); } - else if(strRequestType.Equals("serviceepg")) + else if(strRequestType == "serviceepg") { url.SetOptions("xml/serviceepg"); } @@ -774,7 +774,7 @@ bool CTuxBoxUtil::GetHttpXML(CURL url,CStdString strRequestType) if(size_total > 0) { // read response from server into string buffer - CStdString strTmp; + std::string strTmp; strTmp.reserve(size_total); char buffer[16384]; while( (size_read = http.Read( buffer, sizeof(buffer)-1) ) > 0 ) @@ -791,16 +791,17 @@ bool CTuxBoxUtil::GetHttpXML(CURL url,CStdString strRequestType) strTmp.clear(); XMLRoot = doc.RootElement(); - CStdString strRoot = XMLRoot->Value(); - if( strRoot.Equals("streaminfo")) + std::string strRoot = XMLRoot->Value(); + if( strRoot == "streaminfo") return StreamInformations(XMLRoot); - if(strRoot.Equals("currentservicedata")) + if(strRoot == "currentservicedata") return CurrentServiceData(XMLRoot); - if(strRoot.Equals("boxstatus")) + if(strRoot == "boxstatus") return BoxStatus(XMLRoot); - if(strRoot.Equals("boxinfo")) + if(strRoot == "boxinfo") return BoxInfo(XMLRoot); - if(strRoot.Equals("serviceepg") || strRoot.Equals("service_epg")) + if(strRoot == "serviceepg" || + strRoot == "service_epg") return ServiceEPG(XMLRoot); CLog::Log(LOGERROR, "%s - Unable to parse xml", __FUNCTION__); @@ -837,7 +838,7 @@ bool CTuxBoxUtil::StreamInformations(TiXmlElement *pRootElement) TiXmlNode *pIt = NULL; if(pRootElement != NULL) { - CStdString strRoot = pRootElement->Value(); + std::string strRoot = pRootElement->Value(); pNode = pRootElement->FirstChild("frontend"); if (pNode) { @@ -1470,7 +1471,7 @@ bool CTuxBoxUtil::GetRequestedAudioChannel(AUDIOCHANNEL& sRequestedAC) const return true; } -bool CTuxBoxUtil::GetVideoSubChannels(CStdString& strVideoSubChannelName, CStdString& strVideoSubChannelPid) +bool CTuxBoxUtil::GetVideoSubChannels(std::string& strVideoSubChannelName, std::string& strVideoSubChannelPid) { // no video sub channel return false! if(vVideoSubChannel.name.size() <= 0 || vVideoSubChannel.reference.size() <= 0) @@ -1502,7 +1503,7 @@ bool CTuxBoxUtil::GetVideoSubChannels(CStdString& strVideoSubChannelName, CStdSt } //Input: Service Name (Channel Namne) //Output: picon url (on ERROR the default icon path will be returned) -CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) +std::string CTuxBoxUtil::GetPicon(std::string strServiceName) { if(!g_advancedSettings.m_bTuxBoxPictureIcon) { @@ -1516,7 +1517,7 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) } else { - CStdString piconXML, piconPath, defaultPng; + std::string piconXML, piconPath, defaultPng; piconPath = "special://xbmc/userdata/PictureIcon/Picon/"; defaultPng = piconPath+"tuxbox.png"; piconXML = "special://xbmc/userdata/PictureIcon/picon.xml"; @@ -1543,10 +1544,10 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) pService = pServices->FirstChildElement("service"); while(pService) { - CStdString strName = XMLUtils::GetAttribute(pService, "name"); - CStdString strPng = XMLUtils::GetAttribute(pService, "png"); + std::string strName = XMLUtils::GetAttribute(pService, "name"); + std::string strPng = XMLUtils::GetAttribute(pService, "png"); - if(strName.Equals(strServiceName)) + if(strName == strServiceName) { strPng = piconPath + strPng; StringUtils::ToLower(strPng); @@ -1561,14 +1562,14 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) // iMODE: 0 = TV, 1 = Radio, 2 = Data, 3 = Movies, 4 = Root // SUBMODE: 0 = n/a, 1 = All, 2 = Satellites, 2 = Providers, 4 = Bouquets -CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStdString& strXMLChildString) +std::string CTuxBoxUtil::GetSubMode(int iMode, std::string& strXMLRootString, std::string& strXMLChildString) { //Todo: add a setting: "Don't Use Request mode" to advanced.xml // MODE: 0 = TV, 1 = Radio, 2 = Data, 3 = Movies, 4 = Root // SUBMODE: 0 = n/a, 1 = All, 2 = Satellites, 2 = Providers, 4 = Bouquets // Default Submode - CStdString strSubMode; + std::string strSubMode; if(iMode <0 || iMode >4) { @@ -1614,10 +1615,10 @@ CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStd } //Input: url/path of share/item file/folder //Output: the detected submode root and child string -CStdString CTuxBoxUtil::DetectSubMode(CStdString strSubMode, CStdString& strXMLRootString, CStdString& strXMLChildString) +std::string CTuxBoxUtil::DetectSubMode(std::string strSubMode, std::string& strXMLRootString, std::string& strXMLChildString) { //strSubMode = "xml/services?mode=0&submode=1" - CStdString strFilter; + std::string strFilter; size_t ipointMode = strSubMode.find("?mode="); size_t ipointSubMode = strSubMode.find("&submode="); if (ipointMode != std::string::npos) @@ -1628,23 +1629,23 @@ CStdString CTuxBoxUtil::DetectSubMode(CStdString strSubMode, CStdString& strXMLR char v = strSubMode.at(ipointSubMode + 9); if(v == '1') { - strXMLRootString = StringUtils::Format("unknowns"); - strXMLChildString = StringUtils::Format("unknown"); + strXMLRootString = "unknowns"; + strXMLChildString = "unknown"; } else if(v == '2') { - strXMLRootString = StringUtils::Format("satellites"); - strXMLChildString = StringUtils::Format("satellite"); + strXMLRootString = "satellites"; + strXMLChildString = "satellite"; } else if(v == '3') { - strXMLRootString = StringUtils::Format("providers"); - strXMLChildString = StringUtils::Format("provider"); + strXMLRootString = "providers"; + strXMLChildString = "provider"; } else if(v == '4') { - strXMLRootString = StringUtils::Format("bouquets"); - strXMLChildString = StringUtils::Format("bouquet"); + strXMLRootString = "bouquets"; + strXMLChildString = "bouquet"; } } diff --git a/xbmc/utils/TuxBoxUtil.h b/xbmc/utils/TuxBoxUtil.h index ca69bbcce1..f6532dd8a0 100644 --- a/xbmc/utils/TuxBoxUtil.h +++ b/xbmc/utils/TuxBoxUtil.h @@ -20,7 +20,7 @@ * */ -#include "StdString.h" +#include <string> #include "threads/Thread.h" class CURL; @@ -30,104 +30,104 @@ class CFileItemList; struct STREAMINFO { - CStdString frontend; - CStdString service_name; - CStdString service_reference; - CStdString provider; - CStdString vpid; - CStdString apid; - CStdString pcrpid; - CStdString tpid; - CStdString tsid; - CStdString onid; - CStdString sid; - CStdString pmt; - CStdString video_format; - CStdString supported_crypt_systems; - CStdString used_crypt_systems; - CStdString satellite; - CStdString frequency; - CStdString symbol_rate; - CStdString polarisation; - CStdString inversion; - CStdString fec; - CStdString snr; - CStdString agc; - CStdString ber; - CStdString lock; - CStdString sync; + std::string frontend; + std::string service_name; + std::string service_reference; + std::string provider; + std::string vpid; + std::string apid; + std::string pcrpid; + std::string tpid; + std::string tsid; + std::string onid; + std::string sid; + std::string pmt; + std::string video_format; + std::string supported_crypt_systems; + std::string used_crypt_systems; + std::string satellite; + std::string frequency; + std::string symbol_rate; + std::string polarisation; + std::string inversion; + std::string fec; + std::string snr; + std::string agc; + std::string ber; + std::string lock; + std::string sync; }; struct VIDEOSUBCHANNEL { - std::vector<CStdString> reference; - std::vector<CStdString> name; - std::vector<CStdString> selected; - CStdString current_name; + std::vector<std::string> reference; + std::vector<std::string> name; + std::vector<std::string> selected; + std::string current_name; bool mode; }; typedef struct AUDIOCHANNEL { - CStdString pid; - CStdString selected; - CStdString name; + std::string pid; + std::string selected; + std::string name; } sAudioChannel; struct CURRENTSERVICEDATA { - CStdString service_name; - CStdString service_reference; + std::string service_name; + std::string service_reference; std::vector<AUDIOCHANNEL> audio_channels; int requested_audio_channel; - CStdString audio_track; - CStdString current_event_date; - CStdString current_event_time; - CStdString current_event_start; - CStdString current_event_duration; - CStdString current_event_description; - CStdString current_event_details; - CStdString next_event_date; - CStdString next_event_time; - CStdString next_event_start; - CStdString next_event_duration; - CStdString next_event_description; - CStdString next_event_details; + std::string audio_track; + std::string current_event_date; + std::string current_event_time; + std::string current_event_start; + std::string current_event_duration; + std::string current_event_description; + std::string current_event_details; + std::string next_event_date; + std::string next_event_time; + std::string next_event_start; + std::string next_event_duration; + std::string next_event_description; + std::string next_event_details; }; struct BOXSTATUS { - CStdString current_time; - CStdString standby; - CStdString recording; - CStdString mode; - CStdString ip; + std::string current_time; + std::string standby; + std::string recording; + std::string mode; + std::string ip; }; struct BOXSINFO { - CStdString image_version; - CStdString image_url; - CStdString image_comment; - CStdString image_catalog; - CStdString firmware; - CStdString fpfirmware; - CStdString webinterface; - CStdString model; - CStdString manufacturer; - CStdString processor; - CStdString usbstick; - CStdString disk; + std::string image_version; + std::string image_url; + std::string image_comment; + std::string image_catalog; + std::string firmware; + std::string fpfirmware; + std::string webinterface; + std::string model; + std::string manufacturer; + std::string processor; + std::string usbstick; + std::string disk; }; struct SERVICE_EPG { - CStdString service_reference; - CStdString service_name; - CStdString image_comment; - CStdString event; - CStdString date; - CStdString time; - CStdString duration; - CStdString descritption; - CStdString genre; - CStdString genrecategory; - CStdString start; - CStdString details; + std::string service_reference; + std::string service_name; + std::string image_comment; + std::string event; + std::string date; + std::string time; + std::string duration; + std::string descritption; + std::string genre; + std::string genrecategory; + std::string start; + std::string details; }; struct ZAPSTREAM { @@ -148,29 +148,29 @@ class CTuxBoxUtil CTuxBoxUtil(void); virtual ~CTuxBoxUtil(void); - bool GetZapUrl(const CStdString& strPath, CFileItem &items); - static bool ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild); - static bool ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild); - static bool ParseChannels(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild); - static bool ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild); - bool ZapToUrl(CURL url, const CStdString &pathOption); + bool GetZapUrl(const std::string& strPath, CFileItem &items); + static bool ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL &url, std::string strFilter, std::string strChild); + static bool ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, std::string& strFilter, std::string& strChild); + static bool ParseChannels(TiXmlElement *root, CFileItemList &items, CURL &url, std::string strFilter, std::string strChild); + static bool ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, std::string& strFilter, std::string& strChild); + bool ZapToUrl(CURL url, const std::string &pathOption); bool StreamInformations(TiXmlElement *pRootElement); bool CurrentServiceData(TiXmlElement *pRootElement); bool BoxStatus(TiXmlElement *pRootElement); bool BoxInfo(TiXmlElement *pRootElement); bool ServiceEPG(TiXmlElement *pRootElement); - bool GetHttpXML(CURL url,CStdString strRequestType); + bool GetHttpXML(CURL url,std::string strRequestType); bool GetGUIRequestedAudioChannel(AUDIOCHANNEL& sRequestedAC); bool GetRequestedAudioChannel(AUDIOCHANNEL& sRequestedAC) const; - bool GetVideoSubChannels(CStdString& strVideoSubChannelName, CStdString& strVideoSubChannelPid); + bool GetVideoSubChannels(std::string& strVideoSubChannelName, std::string& strVideoSubChannelPid); bool GetVideoChannels(TiXmlElement *pRootElement); bool CreateNewItem(const CFileItem& item, CFileItem& item_new); - static bool InitZapstream(const CStdString& strPath); - static bool SetAudioChannel(const CStdString& strPath, const AUDIOCHANNEL& sAC); + static bool InitZapstream(const std::string& strPath); + static bool SetAudioChannel(const std::string& strPath, const AUDIOCHANNEL& sAC); - static CStdString GetPicon(CStdString strServiceName); - static CStdString GetSubMode(int iMode, CStdString& strXMLRootString, CStdString& strXMLChildString); - static CStdString DetectSubMode(CStdString strSubMode, CStdString& strXMLRootString, CStdString& strXMLChildString); + static std::string GetPicon(std::string strServiceName); + static std::string GetSubMode(int iMode, std::string& strXMLRootString, std::string& strXMLChildString); + static std::string DetectSubMode(std::string strSubMode, std::string& strXMLRootString, std::string& strXMLChildString); }; extern CTuxBoxUtil g_tuxbox; diff --git a/xbmc/utils/Weather.cpp b/xbmc/utils/Weather.cpp index 556cc9ae45..91689e67ba 100644 --- a/xbmc/utils/Weather.cpp +++ b/xbmc/utils/Weather.cpp @@ -88,7 +88,7 @@ bool CWeatherJob::DoWork() std::vector<std::string> argv; argv.push_back(addon->LibPath()); - CStdString strSetting = StringUtils::Format("%i", m_location); + std::string strSetting = StringUtils::Format("%i", m_location); argv.push_back(strSetting); // Download our weather @@ -130,7 +130,7 @@ const CWeatherInfo &CWeatherJob::GetInfo() const void CWeatherJob::LocalizeOverviewToken(std::string &token) { // This routine is case-insensitive. - CStdString strLocStr = ""; + std::string strLocStr; if (!token.empty()) { ilocalizedTokens i; @@ -145,7 +145,7 @@ void CWeatherJob::LocalizeOverviewToken(std::string &token) token = strLocStr; } -void CWeatherJob::LocalizeOverview(CStdString &str) +void CWeatherJob::LocalizeOverview(std::string &str) { vector<string> words = StringUtils::Split(str, " "); for (vector<string>::iterator i = words.begin(); i != words.end(); ++i) @@ -218,7 +218,7 @@ int CWeatherJob::ConvertSpeed(int curSpeed) return curSpeed; } -void CWeatherJob::FormatTemperature(CStdString &text, int temp) +void CWeatherJob::FormatTemperature(std::string &text, int temp) { CTemperature temperature = CTemperature::CreateFromCelsius(temp); text = StringUtils::Format("%.0f", temperature.ToLocale()); @@ -265,7 +265,7 @@ void CWeatherJob::LoadLocalizedToken() "fallback to strings.xml file"); // We load the tokens from the strings.xml file - CStdString strLanguagePath = "special://xbmc/language/English/strings.xml"; + std::string strLanguagePath = "special://xbmc/language/English/strings.xml"; CXBMCTinyXML xmlDoc; if (!xmlDoc.LoadFile(strLanguagePath) || !xmlDoc.RootElement()) @@ -275,13 +275,13 @@ void CWeatherJob::LoadLocalizedToken() } TiXmlElement* pRootElement = xmlDoc.RootElement(); - if (pRootElement->Value() != CStdString("strings")) + if (pRootElement->ValueStr() != "strings") return; const TiXmlElement *pChild = pRootElement->FirstChildElement(); while (pChild) { - CStdString strValue = pChild->Value(); + std::string strValue = pChild->ValueStr(); if (strValue == "string") { // Load new style language file with id as attribute const char* attrId = pChild->Attribute("id"); @@ -293,7 +293,7 @@ void CWeatherJob::LoadLocalizedToken() (LOCALIZED_TOKEN_FIRSTID3 <= id && id <= LOCALIZED_TOKEN_LASTID3) || (LOCALIZED_TOKEN_FIRSTID4 <= id && id <= LOCALIZED_TOKEN_LASTID4)) { - CStdString utf8Label(pChild->FirstChild()->Value()); + std::string utf8Label(pChild->FirstChild()->ValueStr()); if (!utf8Label.empty()) m_localizedTokens.insert(make_pair(utf8Label, id)); } @@ -303,7 +303,7 @@ void CWeatherJob::LoadLocalizedToken() } } -static CStdString ConstructPath(std::string in) // copy intended +static std::string ConstructPath(std::string in) // copy intended { if (in.find("/") != std::string::npos || in.find("\\") != std::string::npos) return in; @@ -334,7 +334,7 @@ void CWeatherJob::SetFromProperties() m_info.currentUVIndex = window->GetProperty("Current.UVIndex").asString(); LocalizeOverview(m_info.currentUVIndex); int speed = ConvertSpeed(strtol(window->GetProperty("Current.Wind").asString().c_str(),0,10)); - CStdString direction = window->GetProperty("Current.WindDirection").asString(); + std::string direction = window->GetProperty("Current.WindDirection").asString(); if (direction == "CALM") m_info.currentWind = g_localizeStrings.Get(1410); else @@ -343,7 +343,7 @@ void CWeatherJob::SetFromProperties() m_info.currentWind = StringUtils::Format(g_localizeStrings.Get(434).c_str(), direction.c_str(), speed, g_langInfo.GetSpeedUnitString().c_str()); } - CStdString windspeed = StringUtils::Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str()); + std::string 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)); @@ -354,7 +354,7 @@ void CWeatherJob::SetFromProperties() m_info.location = window->GetProperty("Current.Location").asString(); for (int i=0;i<NUM_DAYS;++i) { - CStdString strDay = StringUtils::Format("Day%i.Title",i); + std::string 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 = StringUtils::Format("Day%i.HighTemp",i); @@ -381,7 +381,7 @@ CWeather::~CWeather(void) { } -CStdString CWeather::BusyInfo(int info) const +std::string CWeather::BusyInfo(int info) const { if (info == WEATHER_IMAGE_CURRENT_ICON) return URIUtils::AddFileToFolder(WEATHER_ICON_PATH,"na.png"); @@ -389,7 +389,7 @@ CStdString CWeather::BusyInfo(int info) const return CInfoLoader::BusyInfo(info); } -CStdString CWeather::TranslateInfo(int info) const +std::string CWeather::TranslateInfo(int info) const { if (info == WEATHER_LABEL_CURRENT_COND) return m_info.currentConditions; else if (info == WEATHER_IMAGE_CURRENT_ICON) return m_info.currentIcon; @@ -408,12 +408,12 @@ CStdString CWeather::TranslateInfo(int info) const \param iLocation the location index (can be in the range [1..MAXLOCATION]) \return the city name (without the accompanying region area code) */ -CStdString CWeather::GetLocation(int iLocation) +std::string CWeather::GetLocation(int iLocation) { CGUIWindow* window = g_windowManager.GetWindow(WINDOW_WEATHER); if (window) { - CStdString setting = StringUtils::Format("Location%i", iLocation); + std::string setting = StringUtils::Format("Location%i", iLocation); return window->GetProperty(setting).asString(); } return ""; diff --git a/xbmc/utils/Weather.h b/xbmc/utils/Weather.h index ffc5b13953..1ed5eba90a 100644 --- a/xbmc/utils/Weather.h +++ b/xbmc/utils/Weather.h @@ -21,11 +21,11 @@ */ #include "InfoLoader.h" -#include "StdString.h" #include "settings/lib/ISettingCallback.h" #include "utils/GlobalsHandling.h" #include <map> +#include <string> class TiXmlElement; @@ -41,11 +41,11 @@ class TiXmlElement; struct day_forecast { - CStdString m_icon; - CStdString m_overview; - CStdString m_day; - CStdString m_high; - CStdString m_low; + std::string m_icon; + std::string m_overview; + std::string m_day; + std::string m_high; + std::string m_low; }; #define NUM_DAYS 7 @@ -77,18 +77,18 @@ public: } }; - CStdString lastUpdateTime; - CStdString location; - CStdString currentIcon; - CStdString currentConditions; - CStdString currentTemperature; - CStdString currentFeelsLike; - CStdString currentUVIndex; - CStdString currentWind; - CStdString currentDewPoint; - CStdString currentHumidity; - CStdString busyString; - CStdString naIcon; + std::string lastUpdateTime; + std::string location; + std::string currentIcon; + std::string currentConditions; + std::string currentTemperature; + std::string currentFeelsLike; + std::string currentUVIndex; + std::string currentWind; + std::string currentDewPoint; + std::string currentHumidity; + std::string busyString; + std::string naIcon; }; class CWeatherJob : public CJob @@ -100,7 +100,7 @@ public: const CWeatherInfo &GetInfo() const; private: - void LocalizeOverview(CStdString &str); + void LocalizeOverview(std::string &str); void LocalizeOverviewToken(std::string &str); void LoadLocalizedToken(); static int ConvertSpeed(int speed); @@ -111,7 +111,7 @@ private: \param text the string to format \param temp the temperature (in degrees celcius). */ - static void FormatTemperature(CStdString &text, int temp); + static void FormatTemperature(std::string &text, int temp); struct ci_less : std::binary_function<std::string, std::string, bool> { @@ -130,8 +130,8 @@ private: } }; - std::map<CStdString, int, ci_less> m_localizedTokens; - typedef std::map<CStdString, int, ci_less>::const_iterator ilocalizedTokens; + std::map<std::string, int, ci_less> m_localizedTokens; + typedef std::map<std::string, int, ci_less>::const_iterator ilocalizedTokens; CWeatherInfo m_info; int m_location; @@ -145,10 +145,10 @@ class CWeather : public CInfoLoader, public: CWeather(void); virtual ~CWeather(void); - static bool GetSearchResults(const CStdString &strSearch, CStdString &strResult); + static bool GetSearchResults(const std::string &strSearch, std::string &strResult); - CStdString GetLocation(int iLocation); - const CStdString &GetLastUpdateTime() const { return m_info.lastUpdateTime; }; + std::string GetLocation(int iLocation); + const std::string &GetLastUpdateTime() const { return m_info.lastUpdateTime; }; const day_forecast &GetForecast(int day) const; bool IsFetched(); void Reset(); @@ -157,8 +157,8 @@ public: int GetArea() const; protected: virtual CJob *GetJob() const; - virtual CStdString TranslateInfo(int info) const; - virtual CStdString BusyInfo(int info) const; + virtual std::string TranslateInfo(int info) const; + virtual std::string BusyInfo(int info) const; virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); virtual void OnSettingChanged(const CSetting *setting); diff --git a/xbmc/utils/XMLUtils.cpp b/xbmc/utils/XMLUtils.cpp index 07daa17271..d385b9274d 100644 --- a/xbmc/utils/XMLUtils.cpp +++ b/xbmc/utils/XMLUtils.cpp @@ -111,7 +111,7 @@ bool XMLUtils::GetBoolean(const TiXmlNode* pRootNode, const char* strTag, bool& { const TiXmlNode* pNode = pRootNode->FirstChild(strTag ); if (!pNode || !pNode->FirstChild()) return false; - CStdString strEnabled = pNode->FirstChild()->Value(); + std::string strEnabled = pNode->FirstChild()->ValueStr(); StringUtils::ToLower(strEnabled); if (strEnabled == "off" || strEnabled == "no" || strEnabled == "disabled" || strEnabled == "false" || strEnabled == "0" ) bBoolValue = false; @@ -124,17 +124,6 @@ bool XMLUtils::GetBoolean(const TiXmlNode* pRootNode, const char* strTag, bool& return true; } -bool XMLUtils::GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue) -{ - std::string value; - if (GetString(pRootNode, strTag, value)) - { - strStringValue = value; - return true; - } - return false; -} - bool XMLUtils::GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue) { const TiXmlElement* pElement = pRootNode->FirstChildElement(strTag ); @@ -161,10 +150,10 @@ bool XMLUtils::HasChild(const TiXmlNode* pRootNode, const char* strTag) } bool XMLUtils::GetAdditiveString(const TiXmlNode* pRootNode, const char* strTag, - const CStdString& strSeparator, CStdString& strStringValue, + const std::string& strSeparator, std::string& strStringValue, bool clear) { - CStdString strTemp; + std::string strTemp; const TiXmlElement* node = pRootNode->FirstChildElement(strTag); bool bResult=false; if (node && node->FirstChild() && clear) @@ -226,7 +215,7 @@ bool XMLUtils::GetStringArray(const TiXmlNode* pRootNode, const char* strTag, st return bResult; } -bool XMLUtils::GetPath(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue) +bool XMLUtils::GetPath(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue) { const TiXmlElement* pElement = pRootNode->FirstChildElement(strTag); if (!pElement) return false; @@ -246,7 +235,7 @@ bool XMLUtils::GetPath(const TiXmlNode* pRootNode, const char* strTag, CStdStrin bool XMLUtils::GetDate(const TiXmlNode* pRootNode, const char* strTag, CDateTime& date) { - CStdString strDate; + std::string strDate; if (GetString(pRootNode, strTag, strDate) && !strDate.empty()) { date.SetFromDBDate(strDate); @@ -258,7 +247,7 @@ bool XMLUtils::GetDate(const TiXmlNode* pRootNode, const char* strTag, CDateTime bool XMLUtils::GetDateTime(const TiXmlNode* pRootNode, const char* strTag, CDateTime& dateTime) { - CStdString strDateTime; + std::string strDateTime; if (GetString(pRootNode, strTag, strDateTime) && !strDateTime.empty()) { dateTime.SetFromDBDateTime(strDateTime); @@ -279,7 +268,7 @@ std::string XMLUtils::GetAttribute(const TiXmlElement *element, const char *tag) return ""; } -void XMLUtils::SetAdditiveString(TiXmlNode* pRootNode, const char *strTag, const CStdString& strSeparator, const CStdString& strValue) +void XMLUtils::SetAdditiveString(TiXmlNode* pRootNode, const char *strTag, const std::string& strSeparator, const std::string& strValue) { std::vector<std::string> list = StringUtils::Split(strValue, strSeparator); for (std::vector<std::string>::const_iterator i = list.begin(); i != list.end(); ++i) @@ -292,7 +281,7 @@ void XMLUtils::SetStringArray(TiXmlNode* pRootNode, const char *strTag, const st SetString(pRootNode, strTag, arrayValue.at(i)); } -void XMLUtils::SetString(TiXmlNode* pRootNode, const char *strTag, const CStdString& strValue) +void XMLUtils::SetString(TiXmlNode* pRootNode, const char *strTag, const std::string& strValue) { TiXmlElement newElement(strTag); TiXmlNode *pNewNode = pRootNode->InsertEndChild(newElement); @@ -305,19 +294,19 @@ void XMLUtils::SetString(TiXmlNode* pRootNode, const char *strTag, const CStdStr void XMLUtils::SetInt(TiXmlNode* pRootNode, const char *strTag, int value) { - CStdString strValue = StringUtils::Format("%i", value); + std::string strValue = StringUtils::Format("%i", value); SetString(pRootNode, strTag, strValue); } void XMLUtils::SetLong(TiXmlNode* pRootNode, const char *strTag, long value) { - CStdString strValue = StringUtils::Format("%ld", value); + std::string strValue = StringUtils::Format("%ld", value); SetString(pRootNode, strTag, strValue); } void XMLUtils::SetFloat(TiXmlNode* pRootNode, const char *strTag, float value) { - CStdString strValue = StringUtils::Format("%f", value); + std::string strValue = StringUtils::Format("%f", value); SetString(pRootNode, strTag, strValue); } @@ -328,11 +317,11 @@ void XMLUtils::SetBoolean(TiXmlNode* pRootNode, const char *strTag, bool value) void XMLUtils::SetHex(TiXmlNode* pRootNode, const char *strTag, uint32_t value) { - CStdString strValue = StringUtils::Format("%x", value); + std::string strValue = StringUtils::Format("%x", value); SetString(pRootNode, strTag, strValue); } -void XMLUtils::SetPath(TiXmlNode* pRootNode, const char *strTag, const CStdString& strValue) +void XMLUtils::SetPath(TiXmlNode* pRootNode, const char *strTag, const std::string& strValue) { TiXmlElement newElement(strTag); newElement.SetAttribute("pathversion", path_version); diff --git a/xbmc/utils/XMLUtils.h b/xbmc/utils/XMLUtils.h index 9285bee5d8..70e6446e46 100644 --- a/xbmc/utils/XMLUtils.h +++ b/xbmc/utils/XMLUtils.h @@ -20,7 +20,9 @@ * */ -#include "utils/StdString.h" +#include <string> +#include <stdint.h> +#include <vector> #include "utils/XBMCTinyXML.h" class CDateTime; @@ -37,7 +39,6 @@ public: static bool GetDouble(const TiXmlNode* pRootNode, const char* strTag, double &value); static bool GetInt(const TiXmlNode* pRootNode, const char* strTag, int& iIntValue); static bool GetBoolean(const TiXmlNode* pRootNode, const char* strTag, bool& bBoolValue); - static bool GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue); static bool GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue); /*! \brief Get multiple tags, concatenating the values together. Transforms @@ -53,9 +54,9 @@ public: \param value [out] the resulting string. Remains untouched if no <tag> is available, else is appended (or cleared based on the clear parameter). \param clear if true, clears the string prior to adding tags, if tags are available. Defaults to false. */ - static bool GetAdditiveString(const TiXmlNode* rootNode, const char* tag, const CStdString& separator, CStdString& value, bool clear = false); + static bool GetAdditiveString(const TiXmlNode* rootNode, const char* tag, const std::string& separator, std::string& value, bool clear = false); static bool GetStringArray(const TiXmlNode* rootNode, const char* tag, std::vector<std::string>& arrayValue, bool clear = false, const std::string& separator = ""); - static bool GetPath(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue); + static bool GetPath(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue); static bool GetFloat(const TiXmlNode* pRootNode, const char* strTag, float& value, const float min, const float max); static bool GetUInt(const TiXmlNode* pRootNode, const char* strTag, uint32_t& dwUIntValue, const uint32_t min, const uint32_t max); static bool GetInt(const TiXmlNode* pRootNode, const char* strTag, int& iIntValue, const int min, const int max); @@ -68,14 +69,14 @@ public: */ static std::string GetAttribute(const TiXmlElement *element, const char *tag); - static void SetString(TiXmlNode* pRootNode, const char *strTag, const CStdString& strValue); - static void SetAdditiveString(TiXmlNode* pRootNode, const char *strTag, const CStdString& strSeparator, const CStdString& strValue); + static void SetString(TiXmlNode* pRootNode, const char *strTag, const std::string& strValue); + static void SetAdditiveString(TiXmlNode* pRootNode, const char *strTag, const std::string& strSeparator, const std::string& strValue); static void SetStringArray(TiXmlNode* pRootNode, const char *strTag, const std::vector<std::string>& arrayValue); static void SetInt(TiXmlNode* pRootNode, const char *strTag, int value); static void SetFloat(TiXmlNode* pRootNode, const char *strTag, float value); static void SetBoolean(TiXmlNode* pRootNode, const char *strTag, bool value); static void SetHex(TiXmlNode* pRootNode, const char *strTag, uint32_t value); - static void SetPath(TiXmlNode* pRootNode, const char *strTag, const CStdString& strValue); + static void SetPath(TiXmlNode* pRootNode, const char *strTag, const std::string& strValue); static void SetLong(TiXmlNode* pRootNode, const char *strTag, long iValue); static void SetDate(TiXmlNode* pRootNode, const char *strTag, const CDateTime& date); static void SetDateTime(TiXmlNode* pRootNode, const char *strTag, const CDateTime& dateTime); diff --git a/xbmc/utils/test/TestAliasShortcutUtils.cpp b/xbmc/utils/test/TestAliasShortcutUtils.cpp index a622299d4e..15dd76d234 100644 --- a/xbmc/utils/test/TestAliasShortcutUtils.cpp +++ b/xbmc/utils/test/TestAliasShortcutUtils.cpp @@ -24,7 +24,7 @@ TEST(TestAliasShortcutUtils, IsAliasShortcut) { - CStdString a = ""; + std::string a; #if defined(TARGET_DARWIN_OSX) /* TODO: Write test case for OSX */ #else @@ -34,7 +34,7 @@ TEST(TestAliasShortcutUtils, IsAliasShortcut) TEST(TestAliasShortcutUtils, TranslateAliasShortcut) { - CStdString a = ""; + std::string a; TranslateAliasShortcut(a); #if defined(TARGET_DARWIN_OSX) /* TODO: Write test case for OSX */ diff --git a/xbmc/utils/test/TestArchive.cpp b/xbmc/utils/test/TestArchive.cpp index 5ad472dc9a..9d082dcd86 100644 --- a/xbmc/utils/test/TestArchive.cpp +++ b/xbmc/utils/test/TestArchive.cpp @@ -21,6 +21,7 @@ #include "utils/Archive.h" #include "utils/Variant.h" #include "filesystem/File.h" +#include "utils/StdString.h" #include "test/TestUtils.h" diff --git a/xbmc/utils/test/TestCrc32.cpp b/xbmc/utils/test/TestCrc32.cpp index 4a5112db57..4396a94771 100644 --- a/xbmc/utils/test/TestCrc32.cpp +++ b/xbmc/utils/test/TestCrc32.cpp @@ -39,7 +39,7 @@ TEST(TestCrc32, Compute_2) { Crc32 a; uint32_t varcrc; - CStdString s = refdata; + std::string s = refdata; a.Compute(s); varcrc = a; EXPECT_EQ(0xa4eb60e3, varcrc); @@ -49,7 +49,7 @@ TEST(TestCrc32, ComputeFromLowerCase) { Crc32 a; uint32_t varcrc; - CStdString s = refdata; + std::string s = refdata; a.ComputeFromLowerCase(s); varcrc = a; EXPECT_EQ((uint32_t)0x7f045b3e, varcrc); @@ -59,7 +59,7 @@ TEST(TestCrc32, Reset) { Crc32 a; uint32_t varcrc; - CStdString s = refdata; + std::string s = refdata; a.ComputeFromLowerCase(s); a.Reset(); varcrc = a; diff --git a/xbmc/utils/test/TestHTMLTable.cpp b/xbmc/utils/test/TestHTMLTable.cpp index 1ac16b7735..a13ff2b68f 100644 --- a/xbmc/utils/test/TestHTMLTable.cpp +++ b/xbmc/utils/test/TestHTMLTable.cpp @@ -28,11 +28,11 @@ // CHTMLRow(void); // virtual ~CHTMLRow(void); // int GetColumns() const; -// const CStdString& GetColumValue(int iColumn) const; -// void Parse(const CStdString& strTableRow); +// const std::string& GetColumValue(int iColumn) const; +// void Parse(const std::string& strTableRow); // // protected: -// std::vector<CStdString> m_vecColums; +// std::vector<std::string> m_vecColums; // }; // // class CHTMLTable @@ -40,7 +40,7 @@ // public: // CHTMLTable(void); // virtual ~CHTMLTable(void); -// void Parse(const CStdString& strHTML); +// void Parse(const std::string& strHTML); // int GetRows() const; // const CHTMLRow& GetRow(int iRow) const; // protected: @@ -51,7 +51,7 @@ TEST(TestHTMLTable, General) { HTML::CHTMLTable table; HTML::CHTMLRow row1, row2; - CStdString str; + std::string str; str = "<table>\n" " <tr>\n" " <td>r1c1</td>\n" @@ -71,7 +71,7 @@ TEST(TestHTMLTable, General) row1 = table.GetRow(0); EXPECT_EQ(2, row1.GetColumns()); - EXPECT_STREQ("r1c1", row1.GetColumValue(0)); + EXPECT_STREQ("r1c1", row1.GetColumValue(0).c_str()); str = "<tr>\n" " <td>new row1 column1</td>\n" @@ -80,5 +80,5 @@ TEST(TestHTMLTable, General) "</tr>\n"; row2.Parse(str); EXPECT_EQ(3, row2.GetColumns()); - EXPECT_STREQ("new row1 column2", row2.GetColumValue(1)); + EXPECT_STREQ("new row1 column2", row2.GetColumValue(1).c_str()); } diff --git a/xbmc/utils/test/TestHTMLUtil.cpp b/xbmc/utils/test/TestHTMLUtil.cpp index 284bccf531..a7032ae2a4 100644 --- a/xbmc/utils/test/TestHTMLUtil.cpp +++ b/xbmc/utils/test/TestHTMLUtil.cpp @@ -25,7 +25,7 @@ TEST(TestHTMLUtil, FindTag) { HTML::CHTMLUtil util; - CStdString str, found; + std::string str, found; str = "<!DOCTYPE html>\n" "<html>\n" " <head class=\"someclass\">\n" @@ -45,7 +45,7 @@ TEST(TestHTMLUtil, FindTag) TEST(TestHTMLUtil, FindClosingTag) { HTML::CHTMLUtil util; - CStdString str, found; + std::string str, found; str = "<!DOCTYPE html>\n" "<html>\n" " <head class=\"someclass\">\n" @@ -62,7 +62,7 @@ TEST(TestHTMLUtil, FindClosingTag) TEST(TestHTMLUtil, getValueOfTag) { HTML::CHTMLUtil util; - CStdString str, value; + std::string str, value; str = "<p>blah blah blah</p>"; util.getValueOfTag(str, value); EXPECT_STREQ("blah blah blah", value.c_str()); @@ -71,7 +71,7 @@ TEST(TestHTMLUtil, getValueOfTag) TEST(TestHTMLUtil, getAttributeOfTag) { HTML::CHTMLUtil util; - CStdString str, tag, value; + std::string str, tag, value; str = "<head class=\"someclass\"></head>\n"; util.getAttributeOfTag(str, "class", value); EXPECT_STREQ("\"someclass", value.c_str()); @@ -79,7 +79,7 @@ TEST(TestHTMLUtil, getAttributeOfTag) TEST(TestHTMLUtil, RemoveTags) { - CStdString str; + std::string str; str = "<!DOCTYPE html>\n" "<html>\n" " <head class=\"someclass\">\n" @@ -95,17 +95,9 @@ TEST(TestHTMLUtil, RemoveTags) TEST(TestHTMLUtil, ConvertHTMLToW) { - CStdString str; - CStdStringW refstrw, varstrw; - str = "<!DOCTYPE html>\n" - "<html>\n" - " <head class=\"someclass\">\n" - " <body>\n" - " <p>blah blah blah</p>\n" - " </body>\n" - " </head>\n" - "</html>\n"; - refstrw = str; - HTML::CHTMLUtil::ConvertHTMLToW(str, varstrw); + std::wstring inw, refstrw, varstrw; + inw = L"å&€"; + refstrw = L"å&€"; + HTML::CHTMLUtil::ConvertHTMLToW(inw, varstrw); EXPECT_STREQ(refstrw.c_str(), varstrw.c_str()); } diff --git a/xbmc/utils/test/TestLabelFormatter.cpp b/xbmc/utils/test/TestLabelFormatter.cpp index 0b9b84ecb9..d05d0238e1 100644 --- a/xbmc/utils/test/TestLabelFormatter.cpp +++ b/xbmc/utils/test/TestLabelFormatter.cpp @@ -53,7 +53,7 @@ protected: TEST_F(TestLabelFormatter, FormatLabel) { XFILE::CFile *tmpfile; - CStdString tmpfilepath, destpath; + std::string tmpfilepath, destpath; LABEL_MASKS labelMasks; CLabelFormatter formatter("", labelMasks.m_strLabel2File); @@ -73,7 +73,7 @@ TEST_F(TestLabelFormatter, FormatLabel) TEST_F(TestLabelFormatter, FormatLabel2) { XFILE::CFile *tmpfile; - CStdString tmpfilepath, destpath; + std::string tmpfilepath, destpath; LABEL_MASKS labelMasks; CLabelFormatter formatter("", labelMasks.m_strLabel2File); diff --git a/xbmc/utils/test/TestScraperUrl.cpp b/xbmc/utils/test/TestScraperUrl.cpp index c8573f4089..8f49060094 100644 --- a/xbmc/utils/test/TestScraperUrl.cpp +++ b/xbmc/utils/test/TestScraperUrl.cpp @@ -25,7 +25,7 @@ TEST(TestScraperUrl, General) { CScraperUrl a; - CStdString xmlstring; + std::string xmlstring; xmlstring = "<data spoof=\"blah\" gzip=\"yes\">\n" " <someurl>\n" diff --git a/xbmc/utils/test/TestStreamDetails.cpp b/xbmc/utils/test/TestStreamDetails.cpp index 827817aa42..1ebf688ae6 100644 --- a/xbmc/utils/test/TestStreamDetails.cpp +++ b/xbmc/utils/test/TestStreamDetails.cpp @@ -78,10 +78,10 @@ TEST(TestStreamDetails, General) TEST(TestStreamDetails, VideoDimsToResolutionDescription) { EXPECT_STREQ("1080", - CStreamDetails::VideoDimsToResolutionDescription(1920, 1080)); + CStreamDetails::VideoDimsToResolutionDescription(1920, 1080).c_str()); } TEST(TestStreamDetails, VideoAspectToAspectDescription) { - EXPECT_STREQ("2.40", CStreamDetails::VideoAspectToAspectDescription(2.39f)); + EXPECT_STREQ("2.40", CStreamDetails::VideoAspectToAspectDescription(2.39f).c_str()); } diff --git a/xbmc/utils/test/TestXBMCTinyXML.cpp b/xbmc/utils/test/TestXBMCTinyXML.cpp index f6fce6b310..0072d1b4f3 100644 --- a/xbmc/utils/test/TestXBMCTinyXML.cpp +++ b/xbmc/utils/test/TestXBMCTinyXML.cpp @@ -29,7 +29,7 @@ TEST(TestXBMCTinyXML, ParseFromString) bool retval = false; // scraper results with unescaped & CXBMCTinyXML doc; - CStdString data("<details><url function=\"ParseTMDBRating\" " + std::string data("<details><url function=\"ParseTMDBRating\" " "cache=\"tmdb-en-12244.json\">" "http://api.themoviedb.org/3/movie/12244" "?api_key=57983e31fb435df4df77afb854740ea9" @@ -62,7 +62,7 @@ TEST(TestXBMCTinyXML, ParseFromFileHandle) TiXmlElement *url = root->FirstChildElement("url"); if (url && url->FirstChild()) { - CStdString str = url->FirstChild()->ValueStr(); + std::string str = url->FirstChild()->ValueStr(); retval = (StringUtils::Trim(str) == "http://api.themoviedb.org/3/movie/12244?api_key=57983e31fb435df4df77afb854740ea9&language=en???"); } } diff --git a/xbmc/utils/test/TestXMLUtils.cpp b/xbmc/utils/test/TestXMLUtils.cpp index 05b6c8377a..7170c425dc 100644 --- a/xbmc/utils/test/TestXMLUtils.cpp +++ b/xbmc/utils/test/TestXMLUtils.cpp @@ -77,7 +77,7 @@ TEST(TestXMLUtils, GetDouble) { CXBMCTinyXML a; double val; - CStdString refstr, valstr; + std::string refstr, valstr; a.Parse("<root><node>1000.1f</node></root>"); EXPECT_TRUE(XMLUtils::GetDouble(a.RootElement(), "node", val)); @@ -115,7 +115,7 @@ TEST(TestXMLUtils, GetBoolean) TEST(TestXMLUtils, GetString) { CXBMCTinyXML a; - CStdString ref, val; + std::string ref, val; a.Parse("<root><node>some string</node></root>"); EXPECT_TRUE(XMLUtils::GetString(a.RootElement(), "node", val)); @@ -127,7 +127,7 @@ TEST(TestXMLUtils, GetString) TEST(TestXMLUtils, GetAdditiveString) { CXBMCTinyXML a, b; - CStdString ref, val; + std::string ref, val; a.Parse("<root>\n" " <node>some string1</node>\n" @@ -179,7 +179,7 @@ TEST(TestXMLUtils, GetStringArray) TEST(TestXMLUtils, GetPath) { CXBMCTinyXML a, b; - CStdString ref, val; + std::string ref, val; a.Parse("<root><node urlencoded=\"yes\">special://xbmc/</node></root>"); EXPECT_TRUE(XMLUtils::GetPath(a.RootElement(), "node", val)); @@ -220,7 +220,7 @@ TEST(TestXMLUtils, GetDateTime) TEST(TestXMLUtils, SetString) { CXBMCTinyXML a; - CStdString ref, val; + std::string ref, val; a.Parse("<root></root>"); XMLUtils::SetString(a.RootElement(), "node", "some string"); @@ -233,7 +233,7 @@ TEST(TestXMLUtils, SetString) TEST(TestXMLUtils, SetAdditiveString) { CXBMCTinyXML a; - CStdString ref, val; + std::string ref, val; a.Parse("<root></root>"); XMLUtils::SetAdditiveString(a.RootElement(), "node", ",", @@ -320,7 +320,7 @@ TEST(TestXMLUtils, SetHex) TEST(TestXMLUtils, SetPath) { CXBMCTinyXML a; - CStdString ref, val; + std::string ref, val; a.Parse("<root></root>"); XMLUtils::SetPath(a.RootElement(), "node", "special://xbmc/"); diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp index 6b408bd414..c66632ffae 100644 --- a/xbmc/video/GUIViewStateVideo.cpp +++ b/xbmc/video/GUIViewStateVideo.cpp @@ -37,12 +37,12 @@ using namespace XFILE; using namespace VIDEODATABASEDIRECTORY; -CStdString CGUIViewStateWindowVideo::GetLockType() +std::string CGUIViewStateWindowVideo::GetLockType() { return "video"; } -CStdString CGUIViewStateWindowVideo::GetExtensions() +std::string CGUIViewStateWindowVideo::GetExtensions() { return g_advancedSettings.m_videoExtensions; } @@ -306,8 +306,8 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos"); @@ -518,8 +518,8 @@ CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty - CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); - CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); + std::string strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat"); + std::string strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright"); AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos"); diff --git a/xbmc/video/GUIViewStateVideo.h b/xbmc/video/GUIViewStateVideo.h index d49217a5ed..31d7dba5cd 100644 --- a/xbmc/video/GUIViewStateVideo.h +++ b/xbmc/video/GUIViewStateVideo.h @@ -29,9 +29,9 @@ public: protected: virtual VECSOURCES& GetSources(); - virtual CStdString GetLockType(); + virtual std::string GetLockType(); virtual int GetPlaylist(); - virtual CStdString GetExtensions(); + virtual std::string GetExtensions(); }; class CGUIViewStateWindowVideoFiles : public CGUIViewStateWindowVideo diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 47d762748d..d198f9a8b7 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -4466,7 +4466,7 @@ void CVideoDatabase::UpdateTables(int iVersion) { std::string filename = i->second; bool update = URIUtils::UpdateUrlEncoding(filename) && - (!m_pDS->query(PrepareSQL("SELECT idFile FROM files WHERE strFilename = '%s'", filename.c_str())) || m_pDS->num_rows() <= 0); + (!m_pDS->query(PrepareSQL("SELECT idFile FROM files WHERE strFilename = '%s'", filename.c_str()).c_str()) || m_pDS->num_rows() <= 0); m_pDS->close(); if (update) @@ -6114,8 +6114,8 @@ bool CVideoDatabase::GetMoviesByWhere(const CStdString& strBaseDir, const Filter int total = -1; - CStdString strSQL = "select %s from movieview "; - CStdString strSQLExtra; + std::string strSQL = "select %s from movieview "; + std::string strSQLExtra; if (!CDatabase::BuildSQL(strSQLExtra, extFilter, strSQLExtra)) return false; @@ -6217,9 +6217,9 @@ bool CVideoDatabase::GetTvShowsByWhere(const CStdString& strBaseDir, const Filte int total = -1; - CStdString strSQL = "SELECT %s FROM tvshowview "; + std::string strSQL = "SELECT %s FROM tvshowview "; CVideoDbUrl videoUrl; - CStdString strSQLExtra; + std::string strSQLExtra; Filter extFilter = filter; extFilter.AppendGroup("tvshowview.idShow"); SortDescription sorting = sortDescription; @@ -6345,9 +6345,9 @@ bool CVideoDatabase::GetEpisodesByWhere(const CStdString& strBaseDir, const Filt int total = -1; - CStdString strSQL = "select %s from episodeview "; + std::string strSQL = "select %s from episodeview "; CVideoDbUrl videoUrl; - CStdString strSQLExtra; + std::string strSQLExtra; Filter extFilter = filter; SortDescription sorting = sortDescription; if (!BuildSQL(strBaseDir, strSQLExtra, extFilter, strSQLExtra, videoUrl, sorting)) @@ -7197,9 +7197,9 @@ bool CVideoDatabase::GetMusicVideosByWhere(const CStdString &baseDir, const Filt int total = -1; - CStdString strSQL = "select %s from musicvideoview "; + std::string strSQL = "select %s from musicvideoview "; CVideoDbUrl videoUrl; - CStdString strSQLExtra; + std::string strSQLExtra; Filter extFilter = filter; SortDescription sorting = sortDescription; if (!BuildSQL(baseDir, strSQLExtra, extFilter, strSQLExtra, videoUrl, sorting)) @@ -9701,7 +9701,7 @@ bool CVideoDatabase::GetFilter(CDbUrl &videoUrl, Filter &filter, SortDescription // of the path (season and episodeid) appended later (xsp.GetType() == "episodes" && itemType == "tvshows")) { - std::set<CStdString> playlists; + std::set<std::string> playlists; filter.AppendWhere(xsp.GetWhereClause(*this, playlists)); if (xsp.GetLimit() > 0) @@ -9725,7 +9725,7 @@ bool CVideoDatabase::GetFilter(CDbUrl &videoUrl, Filter &filter, SortDescription // check if the filter playlist matches the item type if (xspFilter.GetType() == itemType) { - std::set<CStdString> playlists; + std::set<std::string> playlists; filter.AppendWhere(xspFilter.GetWhereClause(*this, playlists)); } // remove the filter if it doesn't match the item type diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 6ed2e11595..492eebbe99 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -717,7 +717,7 @@ public: unsigned int GetMusicVideoIDs(const CStdString& strWhere, std::vector<std::pair<int,int> > &songIDs); bool GetRandomMusicVideo(CFileItem* item, int& idSong, const CStdString& strWhere); - static void VideoContentTypeToString(VIDEODB_CONTENT_TYPE type, CStdString& out) + static void VideoContentTypeToString(VIDEODB_CONTENT_TYPE type, std::string& out) { switch (type) { diff --git a/xbmc/video/VideoInfoTag.cpp b/xbmc/video/VideoInfoTag.cpp index fb574d79b1..dc408e1b43 100644 --- a/xbmc/video/VideoInfoTag.cpp +++ b/xbmc/video/VideoInfoTag.cpp @@ -765,7 +765,7 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise) // we prioritise mixed-mode nfo's with fanart set if (prioritise) { - CStdString temp; + std::string temp; temp << *fanart; m_fanart.m_xml = temp+m_fanart.m_xml; } diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp index da0607b743..0688bce70f 100644 --- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp @@ -703,7 +703,7 @@ void CGUIDialogVideoInfo::OnGetArt() } // Grab the thumbnails from the web - vector<CStdString> thumbs; + vector<std::string> thumbs; int season = (m_movieItem->GetVideoInfoTag()->m_type == MediaTypeSeason) ? m_movieItem->GetVideoInfoTag()->m_iSeason : -1; m_movieItem->GetVideoInfoTag()->m_strPictureURL.GetThumbURLs(thumbs, type, season); @@ -1735,7 +1735,7 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const CFileItemPtr &item, const noneitem->SetLabel(g_localizeStrings.Get(13515)); bool local = false; - vector<CStdString> thumbs; + vector<std::string> thumbs; if (type != MediaTypeArtist) { CVideoInfoTag tag; diff --git a/xbmc/view/GUIViewControl.cpp b/xbmc/view/GUIViewControl.cpp index 929661a10f..cafd582f32 100644 --- a/xbmc/view/GUIViewControl.cpp +++ b/xbmc/view/GUIViewControl.cpp @@ -187,18 +187,18 @@ void CGUIViewControl::SetSelectedItem(int item) g_windowManager.SendMessage(msg, m_parentWindow); } -void CGUIViewControl::SetSelectedItem(const CStdString &itemPath) +void CGUIViewControl::SetSelectedItem(const std::string &itemPath) { if (!m_fileItems || itemPath.empty()) return; - CStdString comparePath(itemPath); + std::string comparePath(itemPath); URIUtils::RemoveSlashAtEnd(comparePath); int item = -1; for (int i = 0; i < m_fileItems->Size(); ++i) { - CStdString strPath =(*m_fileItems)[i]->GetPath(); + std::string strPath =(*m_fileItems)[i]->GetPath(); URIUtils::RemoveSlashAtEnd(strPath); if (strPath == comparePath) { @@ -293,7 +293,7 @@ int CGUIViewControl::GetView(VIEW_TYPE type, int id) const return -1; } -void CGUIViewControl::UpdateViewAsControl(const CStdString &viewLabel) +void CGUIViewControl::UpdateViewAsControl(const std::string &viewLabel) { // the view as control could be a select/spin/dropdown button std::vector< std::pair<std::string, int> > labels; @@ -308,7 +308,7 @@ void CGUIViewControl::UpdateViewAsControl(const CStdString &viewLabel) g_windowManager.SendMessage(msg, m_parentWindow); // otherwise it's just a normal button - CStdString label = StringUtils::Format(g_localizeStrings.Get(534).c_str(), viewLabel.c_str()); // View: %s + std::string 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); diff --git a/xbmc/view/GUIViewControl.h b/xbmc/view/GUIViewControl.h index 1446ddc0b6..ba9f6ec52e 100644 --- a/xbmc/view/GUIViewControl.h +++ b/xbmc/view/GUIViewControl.h @@ -20,8 +20,8 @@ * */ +#include <string> #include <vector> -#include "utils/StdString.h" #include "guilib/GraphicContext.h" // for VIEW_TYPE class CGUIControl; @@ -43,7 +43,7 @@ public: void SetItems(CFileItemList &items); void SetSelectedItem(int item); - void SetSelectedItem(const CStdString &itemPath); + void SetSelectedItem(const std::string &itemPath); int GetSelectedItem() const; void SetFocused(); @@ -61,7 +61,7 @@ protected: int GetSelectedItem(const CGUIControl *control) const; void UpdateContents(const CGUIControl *control, int currentItem); void UpdateView(); - void UpdateViewAsControl(const CStdString &viewLabel); + void UpdateViewAsControl(const std::string &viewLabel); void UpdateViewVisibility(); int GetView(VIEW_TYPE type, int id) const; diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp index c9e4f6107e..7d506f8c60 100644 --- a/xbmc/view/GUIViewState.cpp +++ b/xbmc/view/GUIViewState.cpp @@ -56,7 +56,7 @@ using namespace std; using namespace ADDON; using namespace PVR; -CStdString CGUIViewState::m_strPlaylistDirectory; +std::string CGUIViewState::m_strPlaylistDirectory; VECSOURCES CGUIViewState::m_sources; CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& items) @@ -371,23 +371,23 @@ int CGUIViewState::GetPlaylist() return m_playlist; } -const CStdString& CGUIViewState::GetPlaylistDirectory() +const std::string& CGUIViewState::GetPlaylistDirectory() { return m_strPlaylistDirectory; } -void CGUIViewState::SetPlaylistDirectory(const CStdString& strDirectory) +void CGUIViewState::SetPlaylistDirectory(const std::string& strDirectory) { m_strPlaylistDirectory=strDirectory; URIUtils::RemoveSlashAtEnd(m_strPlaylistDirectory); } -bool CGUIViewState::IsCurrentPlaylistDirectory(const CStdString& strDirectory) +bool CGUIViewState::IsCurrentPlaylistDirectory(const std::string& strDirectory) { if (g_playlistPlayer.GetCurrentPlaylist()!=GetPlaylist()) return false; - CStdString strDir=strDirectory; + std::string strDir=strDirectory; URIUtils::RemoveSlashAtEnd(strDir); return (m_strPlaylistDirectory==strDir); @@ -398,12 +398,12 @@ bool CGUIViewState::AutoPlayNextItem() return false; } -CStdString CGUIViewState::GetLockType() +std::string CGUIViewState::GetLockType() { return ""; } -CStdString CGUIViewState::GetExtensions() +std::string CGUIViewState::GetExtensions() { return ""; } @@ -413,7 +413,7 @@ VECSOURCES& CGUIViewState::GetSources() return m_sources; } -void CGUIViewState::AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString &thumb) +void CGUIViewState::AddAddonsSource(const std::string &content, const std::string &label, const std::string &thumb) { if (!g_advancedSettings.m_bVirtualShares) return; @@ -433,7 +433,7 @@ void CGUIViewState::AddAddonsSource(const CStdString &content, const CStdString } #if defined(TARGET_ANDROID) -void CGUIViewState::AddAndroidSource(const CStdString &content, const CStdString &label, const CStdString &thumb) +void CGUIViewState::AddAndroidSource(const std::string &content, const std::string &label, const std::string &thumb) { CFileItemList items; XFILE::CAndroidAppDirectory apps; @@ -490,7 +490,7 @@ void CGUIViewState::SetSortOrder(SortOrder sortOrder) m_sortOrder = sortOrder; } -void CGUIViewState::LoadViewState(const CStdString &path, int windowID) +void CGUIViewState::LoadViewState(const std::string &path, int windowID) { // get our view state from the db CViewDatabase db; if (db.Open()) @@ -507,7 +507,7 @@ void CGUIViewState::LoadViewState(const CStdString &path, int windowID) } } -void CGUIViewState::SaveViewToDb(const CStdString &path, int windowID, CViewState *viewState) +void CGUIViewState::SaveViewToDb(const std::string &path, int windowID, CViewState *viewState) { CViewDatabase db; if (db.Open()) diff --git a/xbmc/view/GUIViewState.h b/xbmc/view/GUIViewState.h index eaf69bb75d..9c34bf0f9d 100644 --- a/xbmc/view/GUIViewState.h +++ b/xbmc/view/GUIViewState.h @@ -51,28 +51,28 @@ public: virtual bool HideParentDirItems(); virtual bool DisableAddSourceButtons(); virtual int GetPlaylist(); - const CStdString& GetPlaylistDirectory(); - void SetPlaylistDirectory(const CStdString& strDirectory); - bool IsCurrentPlaylistDirectory(const CStdString& strDirectory); + const std::string& GetPlaylistDirectory(); + void SetPlaylistDirectory(const std::string& strDirectory); + bool IsCurrentPlaylistDirectory(const std::string& strDirectory); virtual bool AutoPlayNextItem(); - virtual CStdString GetLockType(); - virtual CStdString GetExtensions(); + virtual std::string GetLockType(); + virtual std::string GetExtensions(); virtual VECSOURCES& GetSources(); protected: CGUIViewState(const CFileItemList& items); // no direct object creation, use GetViewState() virtual void SaveViewState()=0; - virtual void SaveViewToDb(const CStdString &path, int windowID, CViewState *viewState = NULL); - void LoadViewState(const CStdString &path, int windowID); + virtual void SaveViewToDb(const std::string &path, int windowID, CViewState *viewState = NULL); + void LoadViewState(const std::string &path, int windowID); /*! \brief Add the addons source for the given content type, if the user has suitable addons \param content the type of addon content desired \param label the name of the addons source \param thumb the skin image to use as the icon */ - void AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString& thumb); + void AddAddonsSource(const std::string &content, const std::string &label, const std::string& thumb); #if defined(TARGET_ANDROID) - void AddAndroidSource(const CStdString &content, const CStdString &label, const CStdString& thumb); + void AddAndroidSource(const std::string &content, const std::string &label, const std::string& thumb); #endif void AddLiveTVSources(); @@ -101,7 +101,7 @@ protected: SortOrder m_sortOrder; - static CStdString m_strPlaylistDirectory; + static std::string m_strPlaylistDirectory; }; class CGUIViewStateGeneral : public CGUIViewState diff --git a/xbmc/view/ViewDatabase.cpp b/xbmc/view/ViewDatabase.cpp index 3467fd678d..0d986383e0 100644 --- a/xbmc/view/ViewDatabase.cpp +++ b/xbmc/view/ViewDatabase.cpp @@ -119,7 +119,7 @@ void CViewDatabase::UpdateTables(int version) { SortDescription sorting = SortUtils::TranslateOldSortMethod((SORT_METHOD)m_pDS->fv(4).get_asInt()); - CStdString sql = PrepareSQL("INSERT INTO view (idView, window, path, viewMode, sortMethod, sortOrder, sortAttributes, skin) VALUES (%i, %i, '%s', %i, %i, %i, %i, '%s')", + std::string sql = PrepareSQL("INSERT INTO view (idView, window, path, viewMode, sortMethod, sortOrder, sortAttributes, skin) VALUES (%i, %i, '%s', %i, %i, %i, %i, '%s')", m_pDS->fv(0).get_asInt(), m_pDS->fv(1).get_asInt(), m_pDS->fv(2).get_asString().c_str(), m_pDS->fv(3).get_asInt(), (int)sorting.sortBy, m_pDS->fv(5).get_asInt(), (int)sorting.sortAttributes, m_pDS->fv(6).get_asString().c_str()); m_pDS2->exec(sql); @@ -130,18 +130,18 @@ void CViewDatabase::UpdateTables(int version) } } -bool CViewDatabase::GetViewState(const CStdString &path, int window, CViewState &state, const CStdString &skin) +bool CViewDatabase::GetViewState(const std::string &path, int window, CViewState &state, const std::string &skin) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString path1(path); + std::string path1(path); URIUtils::AddSlashAtEnd(path1); if (path1.empty()) path1 = "root://"; - CStdString sql; + std::string sql; if (skin.empty()) sql = PrepareSQL("select * from view where window = %i and path='%s'", window, path1.c_str()); else @@ -166,18 +166,18 @@ bool CViewDatabase::GetViewState(const CStdString &path, int window, CViewState return false; } -bool CViewDatabase::SetViewState(const CStdString &path, int window, const CViewState &state, const CStdString &skin) +bool CViewDatabase::SetViewState(const std::string &path, int window, const CViewState &state, const std::string &skin) { try { if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString path1(path); + std::string path1(path); URIUtils::AddSlashAtEnd(path1); if (path1.empty()) path1 = "root://"; - CStdString sql = PrepareSQL("select idView from view where window = %i and path='%s' and skin='%s'", window, path1.c_str(), skin.c_str()); + std::string sql = PrepareSQL("select idView from view where window = %i and path='%s' and skin='%s'", window, path1.c_str(), skin.c_str()); m_pDS->query(sql.c_str()); if (!m_pDS->eof()) { // update the view @@ -209,7 +209,7 @@ bool CViewDatabase::ClearViewStates(int windowID) if (NULL == m_pDB.get()) return false; if (NULL == m_pDS.get()) return false; - CStdString sql = PrepareSQL("delete from view where window = %i", windowID); + std::string sql = PrepareSQL("delete from view where window = %i", windowID); m_pDS->exec(sql.c_str()); } catch (...) diff --git a/xbmc/view/ViewDatabase.h b/xbmc/view/ViewDatabase.h index fbe35d3516..a5f076539f 100644 --- a/xbmc/view/ViewDatabase.h +++ b/xbmc/view/ViewDatabase.h @@ -19,6 +19,7 @@ * */ #include "dbwrappers/Database.h" +#include <string> class CViewState; @@ -29,8 +30,8 @@ public: virtual ~CViewDatabase(void); virtual bool Open(); - bool GetViewState(const CStdString &path, int windowID, CViewState &state, const CStdString &skin); - bool SetViewState(const CStdString &path, int windowID, const CViewState &state, const CStdString &skin); + bool GetViewState(const std::string &path, int windowID, CViewState &state, const std::string &skin); + bool SetViewState(const std::string &path, int windowID, const CViewState &state, const std::string &skin); bool ClearViewStates(int windowID); protected: diff --git a/xbmc/win32/WIN32Util.cpp b/xbmc/win32/WIN32Util.cpp index 1fb64fa25c..628e689a11 100644 --- a/xbmc/win32/WIN32Util.cpp +++ b/xbmc/win32/WIN32Util.cpp @@ -332,9 +332,9 @@ bool CWIN32Util::XBMCShellExecute(const std::string &strPath, bool bWaitForScrip return ret; } -std::vector<CStdString> CWIN32Util::GetDiskUsage() +std::vector<std::string> CWIN32Util::GetDiskUsage() { - vector<CStdString> result; + vector<std::string> result; ULARGE_INTEGER ULTotal= { { 0 } }; ULARGE_INTEGER ULTotalFree= { { 0 } }; @@ -342,7 +342,7 @@ std::vector<CStdString> CWIN32Util::GetDiskUsage() DWORD dwStrLength= GetLogicalDriveStrings( 0, pcBuffer ); if( dwStrLength != 0 ) { - CStdString strRet; + std::string strRet; dwStrLength+= 1; pcBuffer= new char [dwStrLength]; diff --git a/xbmc/win32/WIN32Util.h b/xbmc/win32/WIN32Util.h index f70a773ce2..210774bedb 100644 --- a/xbmc/win32/WIN32Util.h +++ b/xbmc/win32/WIN32Util.h @@ -49,7 +49,7 @@ public: static bool PowerManagement(PowerState State); static int BatteryLevel(); static bool XBMCShellExecute(const std::string &strPath, bool bWaitForScriptExit=false); - static std::vector<CStdString> GetDiskUsage(); + static std::vector<std::string> GetDiskUsage(); static std::string GetResInfoString(); static int GetDesktopColorDepth(); static std::string GetSpecialFolder(int csidl); diff --git a/xbmc/windows/GUIWindowSystemInfo.h b/xbmc/windows/GUIWindowSystemInfo.h index 3356da60dc..751995d32e 100644 --- a/xbmc/windows/GUIWindowSystemInfo.h +++ b/xbmc/windows/GUIWindowSystemInfo.h @@ -33,6 +33,6 @@ private: int m_section; void ResetLabels(); void SetControlLabel(int id, const char *format, int label, int info); - std::vector<CStdString> m_diskUsage; + std::vector<std::string> m_diskUsage; }; diff --git a/xbmc/windows/GUIWindowWeather.cpp b/xbmc/windows/GUIWindowWeather.cpp index 112fcb9081..f1c182d498 100644 --- a/xbmc/windows/GUIWindowWeather.cpp +++ b/xbmc/windows/GUIWindowWeather.cpp @@ -192,11 +192,11 @@ void CGUIWindowWeather::UpdateButtons() SET_CONTROL_LABEL(CONTROL_LABELUPDATED, g_weatherManager.GetLastUpdateTime()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_COND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_COND)); - SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_TEMP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP) + (CStdString)g_langInfo.GetTempUnitString()); - SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_FEEL, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_FEEL) + (CStdString)g_langInfo.GetTempUnitString()); + SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_TEMP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_TEMP) + g_langInfo.GetTempUnitString()); + SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_FEEL, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_FEEL) + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_UVID, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_UVID)); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_WIND, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_WIND)); - SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_DEWP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_DEWP) + (CStdString)g_langInfo.GetTempUnitString()); + SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_DEWP, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_DEWP) + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(WEATHER_LABEL_CURRENT_HUMI, g_weatherManager.GetInfo(WEATHER_LABEL_CURRENT_HUMI)); SET_CONTROL_FILENAME(WEATHER_IMAGE_CURRENT_ICON, g_weatherManager.GetInfo(WEATHER_IMAGE_CURRENT_ICON)); @@ -211,8 +211,8 @@ void CGUIWindowWeather::UpdateButtons() for (int i = 0; i < NUM_DAYS; i++) { SET_CONTROL_LABEL(CONTROL_LABELD0DAY + (i*10), g_weatherManager.GetForecast(i).m_day); - SET_CONTROL_LABEL(CONTROL_LABELD0HI + (i*10), g_weatherManager.GetForecast(i).m_high + (CStdString)g_langInfo.GetTempUnitString()); - SET_CONTROL_LABEL(CONTROL_LABELD0LOW + (i*10), g_weatherManager.GetForecast(i).m_low + (CStdString)g_langInfo.GetTempUnitString()); + SET_CONTROL_LABEL(CONTROL_LABELD0HI + (i*10), g_weatherManager.GetForecast(i).m_high + g_langInfo.GetTempUnitString()); + SET_CONTROL_LABEL(CONTROL_LABELD0LOW + (i*10), g_weatherManager.GetForecast(i).m_low + g_langInfo.GetTempUnitString()); SET_CONTROL_LABEL(CONTROL_LABELD0GEN + (i*10), g_weatherManager.GetForecast(i).m_overview); SET_CONTROL_FILENAME(CONTROL_IMAGED0IMG + (i*10), g_weatherManager.GetForecast(i).m_icon); } |