[cstdstring] drops Compare/CompareNoCase
authorJonathan Marshall <jmarshall@xbmc.org>
Sun, 27 Oct 2013 05:22:13 +0000 (18:22 +1300)
committerJonathan Marshall <jmarshall@xbmc.org>
Wed, 13 Nov 2013 21:53:04 +0000 (10:53 +1300)
35 files changed:
xbmc/Autorun.cpp
xbmc/FileItem.cpp
xbmc/GUIInfoManager.cpp
xbmc/URL.cpp
xbmc/Util.cpp
xbmc/XBDateTime.cpp
xbmc/addons/GUIDialogAddonSettings.cpp
xbmc/addons/Scraper.cpp
xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
xbmc/cores/dvdplayer/DVDPlayer.cpp
xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleTagSami.cpp
xbmc/filesystem/MythDirectory.cpp
xbmc/filesystem/SlingboxFile.cpp
xbmc/filesystem/SmartPlaylistDirectory.cpp
xbmc/guilib/GUIColorManager.cpp
xbmc/guilib/GUIControlFactory.cpp
xbmc/guilib/GUIListItem.cpp
xbmc/guilib/GUIListItem.h
xbmc/guilib/GUISliderControl.cpp
xbmc/guilib/GUIWindow.cpp
xbmc/guilib/GUIWindow.h
xbmc/guilib/TextureBundleXBT.cpp
xbmc/guilib/TextureBundleXPR.cpp
xbmc/guilib/TextureManager.cpp
xbmc/interfaces/Builtins.cpp
xbmc/interfaces/info/InfoBool.cpp
xbmc/interfaces/info/InfoBool.h
xbmc/interfaces/json-rpc/FavouritesOperations.cpp
xbmc/storage/MediaManager.cpp
xbmc/utils/AlarmClock.cpp
xbmc/utils/StdString.h
xbmc/utils/URIUtils.cpp
xbmc/video/VideoInfoScanner.cpp
xbmc/view/GUIViewControl.cpp
xbmc/windows/GUIMediaWindow.cpp

index 8ecf566..129cd63 100644 (file)
@@ -105,7 +105,7 @@ bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startF
     mediaPath = path;
 
 #ifdef TARGET_WINDOWS
-  if (mediaPath.empty() || mediaPath.CompareNoCase("iso9660://") == 0)
+  if (mediaPath.empty() || mediaPath == "iso9660://")
     mediaPath = g_mediaManager.TranslateDevicePath("");
 #endif
 
index 99ac881..f58309b 100644 (file)
@@ -2989,7 +2989,7 @@ CStdString CFileItem::GetLocalFanart() const
       URIUtils::RemoveExtension(strCandidate);
       CStdString strFanart = fanarts[i];
       URIUtils::RemoveExtension(strFanart);
-      if (strCandidate.CompareNoCase(strFanart) == 0)
+      if (StringUtils::EqualsNoCase(strCandidate, strFanart))
         return items[j]->m_strPath;
     }
   }
@@ -3006,7 +3006,7 @@ CStdString CFileItem::GetLocalMetadataPath() const
   CStdString parentFolder(parent);
   URIUtils::RemoveSlashAtEnd(parentFolder);
   parentFolder = URIUtils::GetFileName(parentFolder);
-  if (parentFolder.CompareNoCase("VIDEO_TS") == 0 || parentFolder.CompareNoCase("BDMV") == 0)
+  if (StringUtils::EqualsNoCase(parentFolder, "VIDEO_TS") || StringUtils::EqualsNoCase(parentFolder, "BDMV"))
   { // go back up another one
     parent = URIUtils::GetParentPath(parent);
   }
@@ -3251,9 +3251,9 @@ CStdString CFileItem::FindTrailer() const
   {
     CStdString strCandidate = items[i]->m_strPath;
     URIUtils::RemoveExtension(strCandidate);
-    if (strCandidate.CompareNoCase(strFile) == 0 ||
-        strCandidate.CompareNoCase(strFile2) == 0 ||
-        strCandidate.CompareNoCase(strFile3) == 0)
+    if (StringUtils::EqualsNoCase(strCandidate, strFile) ||
+        StringUtils::EqualsNoCase(strCandidate, strFile2) ||
+        StringUtils::EqualsNoCase(strCandidate, strFile3))
     {
       strTrailer = items[i]->m_strPath;
       break;
index fe3254f..4a59f4e 100644 (file)
@@ -843,9 +843,9 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
       int compareString = ConditionalStringParameter(label);
       if (cat.num_params() > 2)
       {
-        if (cat.param(2).CompareNoCase("left") == 0)
+        if (StringUtils::EqualsNoCase(cat.param(2), "left"))
           return AddMultiInfo(GUIInfo(STRING_STR_LEFT, info, compareString));
-        else if (cat.param(2).CompareNoCase("right") == 0)
+        else if (StringUtils::EqualsNoCase(cat.param(2), "right"))
           return AddMultiInfo(GUIInfo(STRING_STR_RIGHT, info, compareString));
       }
       return AddMultiInfo(GUIInfo(STRING_STR, info, compareString));
index 153e77d..cb07d38 100644 (file)
@@ -305,11 +305,11 @@ void CURL::Parse(const CStdString& strURL1)
   }
 
   // iso9960 doesnt have an hostname;-)
-  if (m_strProtocol.CompareNoCase("iso9660") == 0
-    || m_strProtocol.CompareNoCase("musicdb") == 0
-    || m_strProtocol.CompareNoCase("videodb") == 0
-    || m_strProtocol.CompareNoCase("sources") == 0
-    || m_strProtocol.CompareNoCase("pvr") == 0
+  if (m_strProtocol == "iso9660"
+    || m_strProtocol == "musicdb"
+    || m_strProtocol == "videodb"
+    || m_strProtocol == "sources"
+    || m_strProtocol == "pvr"
     || StringUtils::StartsWith(m_strProtocol, "mem"))
   {
     if (m_strHostName != "" && m_strFileName != "")
index 576f740..0c8be08 100644 (file)
@@ -1537,8 +1537,8 @@ void CUtil::GetSkinThemes(vector<CStdString>& vecTheme)
     if (!pItem->m_bIsFolder)
     {
       CStdString strExtension = URIUtils::GetExtension(pItem->GetPath());
-      if ((strExtension == ".xpr" && pItem->GetLabel().CompareNoCase("Textures.xpr")) ||
-          (strExtension == ".xbt" && pItem->GetLabel().CompareNoCase("Textures.xbt")))
+      if ((strExtension == ".xpr" && !StringUtils::EqualsNoCase(pItem->GetLabel(), "Textures.xpr")) ||
+          (strExtension == ".xbt" && !StringUtils::EqualsNoCase(pItem->GetLabel(), "Textures.xbt")))
       {
         CStdString strLabel = pItem->GetLabel();
         vecTheme.push_back(strLabel.substr(0, strLabel.size() - 4));
@@ -2098,7 +2098,7 @@ int CUtil::ScanArchiveForSubtitles( const CStdString& strArchivePath, const CStd
    int iPos=0;
     while (sub_exts[iPos])
     {
-     if (strExt.CompareNoCase(sub_exts[iPos]) == 0)
+     if (StringUtils::EqualsNoCase(strExt, sub_exts[iPos]))
      {
       CStdString strSourceUrl;
       if (URIUtils::HasExtension(strArchivePath, ".rar"))
index b89257e..1d3f9b7 100644 (file)
@@ -228,9 +228,9 @@ void CDateTimeSpan::SetFromPeriod(const CStdString &period)
   if (pos != std::string::npos)
   {
     CStdString units = period.substr(pos, 3);
-    if (units.CompareNoCase("wee") == 0)
+    if (StringUtils::EqualsNoCase(units, "wee"))
       days *= 7;
-    else if (units.CompareNoCase("mon") == 0)
+    else if (StringUtils::EqualsNoCase(units, "mon"))
       days *= 31;
   }
 
@@ -1369,7 +1369,7 @@ int CDateTime::MonthStringToMonthNum(const CStdString& month)
   const char* abr_months[] = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
 
   int i = 0;
-  for (; i < 12 && month.CompareNoCase(months[i]) != 0 && month.CompareNoCase(abr_months[i]) != 0; i++);
+  for (; i < 12 && !StringUtils::EqualsNoCase(month, months[i]) && !StringUtils::EqualsNoCase(month, abr_months[i]); i++);
   i++;
 
   return i;
index c69d4d0..94b8f17 100644 (file)
@@ -527,7 +527,7 @@ void CGUIDialogAddonSettings::UpdateFromControls()
         case CGUIControl::GUICONTROL_SETTINGS_SLIDER:
           {
             CStdString option = setting->Attribute("option");
-            if (option.size() == 0 || option.CompareNoCase("float") == 0)
+            if (option.size() == 0 || StringUtils::EqualsNoCase(option, "float"))
               value = StringUtils::Format("%f", ((CGUISettingsSliderControl *)control)->GetFloatValue());
             else
               value = StringUtils::Format("%i", ((CGUISettingsSliderControl *)control)->GetIntValue());
@@ -872,11 +872,11 @@ void CGUIDialogAddonSettings::CreateControls()
         CStdString option = setting->Attribute("option");
         int iType=0;
 
-        if (option.size() == 0 || option.CompareNoCase("float") == 0)
+        if (option.size() == 0 || StringUtils::EqualsNoCase(option, "float"))
           iType = SPIN_CONTROL_TYPE_FLOAT;
-        else if (option.CompareNoCase("int") == 0)
+        else if (StringUtils::EqualsNoCase(option, "int"))
           iType = SPIN_CONTROL_TYPE_INT;
-        else if (option.CompareNoCase("percent") == 0)
+        else if (StringUtils::EqualsNoCase(option, "percent"))
           iType = 0;
 
         ((CGUISettingsSliderControl *)pControl)->SetType(iType);
@@ -943,7 +943,7 @@ vector<std::string> CGUIDialogAddonSettings::GetFileEnumValues(const CStdString
   else
     fullPath = URIUtils::AddFileToFolder(m_addon->Path(), path);
 
-  bool hideExtensions = (options.CompareNoCase("hideext") == 0);
+  bool hideExtensions = StringUtils::EqualsNoCase(options, "hideext");
   // fetch directory
   CFileItemList items;
   if (!mask.empty())
index 5965b01..ab6b11e 100644 (file)
@@ -618,7 +618,7 @@ std::vector<CScraperUrl> CScraper::FindMovie(XFILE::CCurlFile &fcurl, const CStd
 
     // we need to sort if returned results don't specify 'sorted="yes"'
     if (fSort)
-      fSort = CStdString(xhResults.Element()->Attribute("sorted")).CompareNoCase("yes") != 0;
+      fSort = !StringUtils::EqualsNoCase(xhResults.Element()->Attribute("sorted"), "yes");
 
     for (TiXmlElement *pxeMovie = xhResults.FirstChild("entity").Element();
       pxeMovie; pxeMovie = pxeMovie->NextSiblingElement())
index 42b6351..600ffa7 100644 (file)
@@ -44,6 +44,7 @@
 #include "DllSwScale.h"
 #include "utils/log.h"
 #include "utils/GLUtils.h"
+#include "utils/StringUtils.h"
 #include "RenderCapture.h"
 #include "RenderFormats.h"
 #include "cores/IPlayer.h"
index c37e5c3..1dbc732 100644 (file)
@@ -654,7 +654,7 @@ bool CDVDPlayer::OpenInputStream()
   // correct the filename if needed
   CStdString filename(m_filename);
   if (StringUtils::StartsWith(filename, "dvd://")
-  ||  filename.CompareNoCase("iso9660://video_ts/video_ts.ifo") == 0)
+  ||  StringUtils::EqualsNoCase(filename, "iso9660://video_ts/video_ts.ifo"))
   {
     m_filename = g_mediaManager.TranslateDevicePath("");
   }
index 7621a33..47857eb 100644 (file)
@@ -161,7 +161,7 @@ void CDVDSubtitleTagSami::ConvertLine(CDVDOverlayText* pOverlay, const char* lin
             strUTF8.erase(del_start, pos - del_start);
             pos = del_start;
           }
-          if (!tagOptionValue.Compare(lang))
+          if (!tagOptionValue.compare(lang))
           {
             m_flag[FLAG_LANGUAGE] = false;
           }
index 5af8229..792cd3d 100644 (file)
@@ -280,7 +280,7 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items,
         url.SetFileName("movies/" + path);
         break;
       case TV_SHOWS:
-        if (filter.CompareNoCase(name))
+        if (!StringUtils::EqualsNoCase(filter, name))
         {
           m_dll->ref_release(program);
           continue;
index d7e7194..8cdbc7c 100644 (file)
@@ -55,9 +55,9 @@ bool CSlingboxFile::Open(const CURL& url)
 
   // Prepare to connect to the Slingbox
   bool bAdmin;
-  if (url.GetUserName().CompareNoCase("administrator") == 0)
+  if (StringUtils::EqualsNoCase(url.GetUserName(), "administrator"))
     bAdmin = true;
-  else if (url.GetUserName().CompareNoCase("viewer") == 0)
+  else if (StringUtils::EqualsNoCase(url.GetUserName(), "viewer"))
     bAdmin = false;
   else
   {
@@ -528,7 +528,7 @@ void CSlingboxFile::LoadSettings(const CStdString& strHostname)
     pElement = pElement->NextSiblingElement("slingbox"))
   {
     if (pElement->Attribute("hostname") == NULL ||      
-      !m_sSlingboxSettings.strHostname.CompareNoCase(pElement->Attribute("hostname")))
+      StringUtils::EqualsNoCase(m_sSlingboxSettings.strHostname, pElement->Attribute("hostname")))
     {
       // Load setting values
       XMLUtils::GetInt(pElement, "width", m_sSlingboxSettings.iVideoWidth, 0, 640);
index f1d4cce..77ad2df 100644 (file)
@@ -339,7 +339,7 @@ namespace XFILE
         CSmartPlaylist playlist;
         if (playlist.OpenAndReadName(item->GetPath()))
         {
-          if (playlist.GetName().CompareNoCase(name) == 0)
+          if (StringUtils::EqualsNoCase(playlist.GetName(), name))
             return item->GetPath();
         }
       }
index 0275cdf..e71d171 100644 (file)
@@ -60,7 +60,7 @@ void CGUIColorManager::Load(const CStdString &colorFile)
     LoadXML(xmlDoc);
 
   // now the color map requested
-  if (colorFile.CompareNoCase("SKINDEFAULT") == 0)
+  if (StringUtils::EqualsNoCase(colorFile, "SKINDEFAULT"))
     return; // nothing to do
 
   path = URIUtils::AddFileToFolder(basePath, colorFile);
index 9079401..cefef93 100644 (file)
@@ -115,7 +115,7 @@ static const ControlMapping controls[] =
 CGUIControl::GUICONTROLTYPES CGUIControlFactory::TranslateControlType(const CStdString &type)
 {
   for (unsigned int i = 0; i < sizeof(controls) / sizeof(controls[0]); ++i)
-    if (0 == type.CompareNoCase(controls[i].name))
+    if (StringUtils::EqualsNoCase(type, controls[i].name))
       return controls[i].type;
   return CGUIControl::GUICONTROL_UNKNOWN;
 }
@@ -292,32 +292,32 @@ bool CGUIControlFactory::GetAspectRatio(const TiXmlNode* pRootNode, const char*
     return false;
 
   ratio = node->FirstChild()->Value();
-  if (ratio.CompareNoCase("keep") == 0) aspect.ratio = CAspectRatio::AR_KEEP;
-  else if (ratio.CompareNoCase("scale") == 0) aspect.ratio = CAspectRatio::AR_SCALE;
-  else if (ratio.CompareNoCase("center") == 0) aspect.ratio = CAspectRatio::AR_CENTER;
-  else if (ratio.CompareNoCase("stretch") == 0) aspect.ratio = CAspectRatio::AR_STRETCH;
+  if (StringUtils::EqualsNoCase(ratio, "keep")) aspect.ratio = CAspectRatio::AR_KEEP;
+  else if (StringUtils::EqualsNoCase(ratio, "scale")) aspect.ratio = CAspectRatio::AR_SCALE;
+  else if (StringUtils::EqualsNoCase(ratio, "center")) aspect.ratio = CAspectRatio::AR_CENTER;
+  else if (StringUtils::EqualsNoCase(ratio, "stretch")) aspect.ratio = CAspectRatio::AR_STRETCH;
 
   const char *attribute = node->Attribute("align");
   if (attribute)
   {
     CStdString align(attribute);
-    if (align.CompareNoCase("center") == 0) aspect.align = ASPECT_ALIGN_CENTER | (aspect.align & ASPECT_ALIGNY_MASK);
-    else if (align.CompareNoCase("right") == 0) aspect.align = ASPECT_ALIGN_RIGHT | (aspect.align & ASPECT_ALIGNY_MASK);
-    else if (align.CompareNoCase("left") == 0) aspect.align = ASPECT_ALIGN_LEFT | (aspect.align & ASPECT_ALIGNY_MASK);
+    if (StringUtils::EqualsNoCase(align, "center")) aspect.align = ASPECT_ALIGN_CENTER | (aspect.align & ASPECT_ALIGNY_MASK);
+    else if (StringUtils::EqualsNoCase(align, "right")) aspect.align = ASPECT_ALIGN_RIGHT | (aspect.align & ASPECT_ALIGNY_MASK);
+    else if (StringUtils::EqualsNoCase(align, "left")) aspect.align = ASPECT_ALIGN_LEFT | (aspect.align & ASPECT_ALIGNY_MASK);
   }
   attribute = node->Attribute("aligny");
   if (attribute)
   {
     CStdString align(attribute);
-    if (align.CompareNoCase("center") == 0) aspect.align = ASPECT_ALIGNY_CENTER | (aspect.align & ASPECT_ALIGN_MASK);
-    else if (align.CompareNoCase("bottom") == 0) aspect.align = ASPECT_ALIGNY_BOTTOM | (aspect.align & ASPECT_ALIGN_MASK);
-    else if (align.CompareNoCase("top") == 0) aspect.align = ASPECT_ALIGNY_TOP | (aspect.align & ASPECT_ALIGN_MASK);
+    if (StringUtils::EqualsNoCase(align, "center")) aspect.align = ASPECT_ALIGNY_CENTER | (aspect.align & ASPECT_ALIGN_MASK);
+    else if (StringUtils::EqualsNoCase(align, "bottom")) aspect.align = ASPECT_ALIGNY_BOTTOM | (aspect.align & ASPECT_ALIGN_MASK);
+    else if (StringUtils::EqualsNoCase(align, "top")) aspect.align = ASPECT_ALIGNY_TOP | (aspect.align & ASPECT_ALIGN_MASK);
   }
   attribute = node->Attribute("scalediffuse");
   if (attribute)
   {
     CStdString scale(attribute);
-    if (scale.CompareNoCase("true") == 0 || scale.CompareNoCase("yes") == 0)
+    if (StringUtils::EqualsNoCase(scale, "true") || StringUtils::EqualsNoCase(scale, "yes"))
       aspect.scaleDiffuse = true;
     else
       aspect.scaleDiffuse = false;
index 0b80593..f00ae61 100644 (file)
 #include "GUIListItemLayout.h"
 #include "utils/Archive.h"
 #include "utils/CharsetConverter.h"
+#include "utils/StringUtils.h"
 #include "utils/Variant.h"
 
 using namespace std;
 
+bool CGUIListItem::icompare::operator()(const CStdString &s1, const CStdString &s2) const
+{
+  return StringUtils::CompareNoCase(s1, s2) < 0;
+}
+
 CGUIListItem::CGUIListItem(const CGUIListItem& item)
 {
   m_layout = NULL;
index 5b8e04a..541d27a 100644 (file)
@@ -185,10 +185,7 @@ protected:
 
   struct icompare
   {
-    bool operator()(const CStdString &s1, const CStdString &s2) const
-    {
-      return s1.CompareNoCase(s2) < 0;
-    }
+    bool operator()(const CStdString &s1, const CStdString &s2) const;
   };
 
   typedef std::map<CStdString, CVariant, icompare> PropertyMap;
index 334d73e..8c399fc 100644 (file)
@@ -643,7 +643,7 @@ void CGUISliderControl::SetAction(const CStdString &action)
 {
   for (size_t i = 0; i < sizeof(actions)/sizeof(SliderAction); i++)
   {
-    if (action.CompareNoCase(actions[i].action) == 0)
+    if (StringUtils::EqualsNoCase(action, actions[i].action))
     {
       m_action = &actions[i];
       return;
index f8db8ea..ed6000e 100644 (file)
 
 using namespace std;
 
+bool CGUIWindow::icompare::operator()(const CStdString &s1, const CStdString &s2) const
+{
+  return StringUtils::CompareNoCase(s1, s2) < 0;
+}
+
 CGUIWindow::CGUIWindow(int id, const CStdString &xmlFile)
 {
   SetID(id);
index 5a996c4..8e5cd2a 100644 (file)
@@ -267,10 +267,7 @@ protected:
   bool m_animationsEnabled;
   struct icompare
   {
-    bool operator()(const CStdString &s1, const CStdString &s2) const
-    {
-      return s1.CompareNoCase(s2) < 0;
-    }
+    bool operator()(const CStdString &s1, const CStdString &s2) const;
   };
 
   CGUIAction m_loadActions;
index 622dd9a..7c29a7c 100644 (file)
@@ -61,7 +61,7 @@ bool CTextureBundleXBT::OpenBundle()
     // if we are the theme bundle, we only load if the user has chosen
     // a valid theme (or the skin has a default one)
     CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
-    if (!theme.empty() && theme.CompareNoCase("SKINDEFAULT"))
+    if (!theme.empty() && !StringUtils::EqualsNoCase(theme, "SKINDEFAULT"))
     {
       CStdString themeXBT(URIUtils::ReplaceExtension(theme, ".xbt"));
       strPath = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media");
index 587924f..0769252 100644 (file)
@@ -131,7 +131,7 @@ bool CTextureBundleXPR::OpenBundle()
     // if we are the theme bundle, we only load if the user has chosen
     // a valid theme (or the skin has a default one)
     CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
-    if (!theme.empty() && theme.CompareNoCase("SKINDEFAULT"))
+    if (!theme.empty() && !StringUtils::EqualsNoCase(theme, "SKINDEFAULT"))
     {
       CStdString themeXPR(URIUtils::ReplaceExtension(theme, ".xpr"));
       strPath = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media");
index ea272cd..6a3829f 100644 (file)
@@ -354,8 +354,7 @@ const CTextureArray& CGUITextureManager::Load(const CStdString& strTextureName,
       int iImages = AnimatedGifSet.LoadGIF(strPath.c_str());
       if (iImages == 0)
       {
-        CStdString rootPath = strPath.substr(0, g_SkinInfo->Path().size());
-        if (0 == rootPath.CompareNoCase(g_SkinInfo->Path()))
+        if (StringUtils::StartsWith(strPath, g_SkinInfo->Path()))
           CLog::Log(LOGERROR, "Texture manager unable to load file: %s", strPath.c_str());
         return emptyTexture;
       }
index 00dcccf..3123454 100644 (file)
@@ -237,7 +237,7 @@ bool CBuiltins::HasCommand(const CStdString& execString)
   CUtil::SplitExecFunction(execString, function, parameters);
   for (unsigned int i = 0; i < sizeof(commands)/sizeof(BUILT_IN); i++)
   {
-    if (function.CompareNoCase(commands[i].command) == 0 && (!commands[i].needsParameters || parameters.size()))
+    if (StringUtils::EqualsNoCase(function, commands[i].command) && (!commands[i].needsParameters || parameters.size()))
       return true;
   }
   return false;
@@ -1075,7 +1075,7 @@ int CBuiltins::Execute(const CStdString& execString)
     else
     { // check if shutdown is specified in particular, and get the time for it
       CStdString strHeading;
-      if (parameter.CompareNoCase("shutdowntimer") == 0)
+      if (StringUtils::EqualsNoCase(parameter, "shutdowntimer"))
         strHeading = g_localizeStrings.Get(20145);
       else
         strHeading = g_localizeStrings.Get(13209);
@@ -1090,9 +1090,9 @@ int CBuiltins::Execute(const CStdString& execString)
     for (unsigned int i = 3; i < params.size() ; i++)
     {
       // check "true" for backward comp
-      if (params[i].CompareNoCase("true") == 0 || params[i].CompareNoCase("silent") == 0)
+      if (StringUtils::EqualsNoCase(params[i], "true") || StringUtils::EqualsNoCase(params[i], "silent"))
         silent = true;
-      else if (params[i].CompareNoCase("loop") == 0)
+      else if (StringUtils::EqualsNoCase(params[i], "loop"))
         loop = true;
     }
 
@@ -1117,7 +1117,7 @@ int CBuiltins::Execute(const CStdString& execString)
   else if (execute.Equals("cancelalarm"))
   {
     bool silent = false;
-    if (params.size() > 1 && params[1].CompareNoCase("true") == 0)
+    if (params.size() > 1 && StringUtils::EqualsNoCase(params[1], "true"))
       silent = true;
     g_alarmClock.Stop(params[0],silent);
   }
@@ -1125,7 +1125,7 @@ int CBuiltins::Execute(const CStdString& execString)
   {
 #ifdef HAS_DVD_DRIVE
     bool restart = false;
-    if (params.size() > 0 && params[0].CompareNoCase("restart") == 0)
+    if (params.size() > 0 && StringUtils::EqualsNoCase(params[0], "restart"))
       restart = true;
     CAutorun::PlayDisc(g_mediaManager.GetDiscPath(), true, restart);
 #endif
@@ -1147,7 +1147,7 @@ int CBuiltins::Execute(const CStdString& execString)
     if (params.size() > 1)
     {
       int string = CSkinSettings::Get().TranslateBool(params[0]);
-      CSkinSettings::Get().SetBool(string, params[1].CompareNoCase("true") == 0);
+      CSkinSettings::Get().SetBool(string, StringUtils::EqualsNoCase(params[1], "true"));
       CSettings::Get().Save();
       return 0;
     }
@@ -1343,9 +1343,9 @@ int CBuiltins::Execute(const CStdString& execString)
   else if (execute.Equals("dialog.close") && params.size())
   {
     bool bForce = false;
-    if (params.size() > 1 && params[1].CompareNoCase("true") == 0)
+    if (params.size() > 1 && StringUtils::EqualsNoCase(params[1], "true"))
       bForce = true;
-    if (params[0].CompareNoCase("all") == 0)
+    if (StringUtils::EqualsNoCase(params[0], "all"))
     {
       g_windowManager.CloseDialogs(bForce);
     }
@@ -1528,7 +1528,7 @@ int CBuiltins::Execute(const CStdString& execString)
   {
     CGUIMessage message(GUI_MSG_NOTIFY_ALL, g_windowManager.GetActiveWindow(), 0, GUI_MSG_UPDATE, 0);
     message.SetStringParam(params[0]);
-    if (params.size() > 1 && params[1].CompareNoCase("replace") == 0)
+    if (params.size() > 1 && StringUtils::EqualsNoCase(params[1], "replace"))
       message.SetParam2(1); // reset the history
     g_windowManager.SendMessage(message);
   }
index 4174ed9..db4926c 100644 (file)
 #include "InfoBool.h"
 #include <stack>
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "GUIInfoManager.h"
 
 using namespace std;
 using namespace INFO;
 
+bool InfoBool::operator==(const InfoBool &right) const
+{
+  return (m_context == right.m_context &&
+          StringUtils::EqualsNoCase(m_expression, right.m_expression));
+}
+
 InfoSingle::InfoSingle(const CStdString &expression, int context)
 : InfoBool(expression, context)
 {
index 8ded20d..2674cac 100644 (file)
@@ -62,11 +62,7 @@ public:
     return m_value;
   }
 
-  bool operator==(const InfoBool &right) const
-  {
-    return (m_context == right.m_context && 
-            m_expression.CompareNoCase(right.m_expression) == 0);
-  }
+  bool operator==(const InfoBool &right) const;
 
   /*! \brief Update the value of this info bool
    This is called if and only if the info bool is dirty, allowing it to update it's current value
index a369577..57bd42e 100644 (file)
@@ -61,7 +61,7 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const CStdString &method, IT
     if (fields.find("thumbnail") !=  fields.end())
       object["thumbnail"] = item->GetArt("thumb");
 
-    if (function.CompareNoCase("ActivateWindow") == 0)
+    if (StringUtils::EqualsNoCase(function, "ActivateWindow"))
     {
       object["type"] = "window";
       if (fields.find("window") != fields.end())
@@ -79,13 +79,13 @@ JSONRPC_STATUS CFavouritesOperations::GetFavourites(const CStdString &method, IT
           object["windowparameter"] = "";
       }
     }
-    else if (function.CompareNoCase("PlayMedia") == 0)
+    else if (StringUtils::EqualsNoCase(function, "PlayMedia"))
     {
       object["type"] = "media";
       if (fields.find("path") !=  fields.end())
         object["path"] = parameters[0];
     }
-    else if (function.CompareNoCase("RunScript") == 0)
+    else if (StringUtils::EqualsNoCase(function, "RunScript"))
     {
       object["type"] = "script";
       if (fields.find("path") !=  fields.end())
index e9f7bec..5d08030 100644 (file)
@@ -514,7 +514,7 @@ CStdString CMediaManager::GetDiskUniqueId(const CStdString& devicePath)
     mediaPath = devicePath;
 
 #ifdef TARGET_WINDOWS
-  if (mediaPath.empty() || mediaPath.CompareNoCase("iso9660://") == 0)
+  if (mediaPath.empty() || mediaPath == "iso9660://")
   {
     mediaPath = g_mediaManager.TranslateDevicePath("");
     URIUtils::AddSlashAtEnd(mediaPath);
index 0329f26..37b1466 100644 (file)
@@ -55,7 +55,7 @@ void CAlarmClock::Start(const CStdString& strName, float n_secs, const CStdStrin
 
   CStdString strAlarmClock;
   CStdString strStarted;
-  if (strName.CompareNoCase("shutdowntimer") == 0)
+  if (StringUtils::EqualsNoCase(strName, "shutdowntimer"))
   {
     strAlarmClock = g_localizeStrings.Get(20144);
     strStarted = g_localizeStrings.Get(20146);
index 662cdca..edff946 100644 (file)
@@ -2547,16 +2547,6 @@ public:
     return ssicoll(this->c_str(), this->length(), szThat, sslen(szThat));
   }
 #endif
-  int Compare(PCMYSTR szThat) const
-  {
-    return this->compare(szThat);
-  }
-
-  int CompareNoCase(PCMYSTR szThat)  const
-  {
-    return ssicmp(this->c_str(), szThat);
-  }
-
   int FindOneOf(PCMYSTR szCharSet) const
   {
     MYSIZE nIdx = this->find_first_of(szCharSet);
index 74a9d0e..9c1bfa9 100644 (file)
@@ -619,10 +619,10 @@ bool URIUtils::IsRAR(const CStdString& strFile)
   if (strExtension.Equals(".001") && !StringUtils::EndsWithNoCase(strFile, ".ts.001"))
     return true;
 
-  if (strExtension.CompareNoCase(".cbr") == 0)
+  if (StringUtils::EqualsNoCase(strExtension, ".cbr"))
     return true;
 
-  if (strExtension.CompareNoCase(".rar") == 0)
+  if (StringUtils::EqualsNoCase(strExtension, ".rar"))
     return true;
 
   return false;
index 013644a..cc3bd2f 100644 (file)
@@ -1421,7 +1421,7 @@ namespace VIDEO
           matches.push_back(*guide);
           continue;
         }
-        if (!guide->cScraperUrl.strTitle.empty() && guide->cScraperUrl.strTitle.CompareNoCase(file->strTitle.c_str()) == 0)
+        if (!guide->cScraperUrl.strTitle.empty() && StringUtils::EqualsNoCase(guide->cScraperUrl.strTitle, file->strTitle))
         {
           bFound = true;
           break;
index cec96e0..85edf66 100644 (file)
@@ -202,7 +202,7 @@ void CGUIViewControl::SetSelectedItem(const CStdString &itemPath)
   {
     CStdString strPath =(*m_fileItems)[i]->GetPath();
     URIUtils::RemoveSlashAtEnd(strPath);
-    if (strPath.CompareNoCase(comparePath) == 0)
+    if (strPath == comparePath)
     {
       item = i;
       break;
index a20e2f2..cd01d33 100644 (file)
@@ -487,7 +487,7 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
         m_vecItems->SetPath("");
       CStdString dir = message.GetStringParam(0);
       const CStdString &ret = message.GetStringParam(1);
-      bool returning = ret.CompareNoCase("return") == 0;
+      bool returning = StringUtils::EqualsNoCase(ret, "return");
       if (!dir.empty())
       {
         m_history.ClearPathHistory();