mediaPath = path;
#ifdef TARGET_WINDOWS
- if (mediaPath.empty() || mediaPath.CompareNoCase("iso9660://") == 0)
+ if (mediaPath.empty() || mediaPath == "iso9660://")
mediaPath = g_mediaManager.TranslateDevicePath("");
#endif
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;
}
}
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);
}
{
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;
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));
}
// 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 != "")
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));
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"))
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;
}
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;
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());
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);
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())
// 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())
#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"
// 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("");
}
strUTF8.erase(del_start, pos - del_start);
pos = del_start;
}
- if (!tagOptionValue.Compare(lang))
+ if (!tagOptionValue.compare(lang))
{
m_flag[FLAG_LANGUAGE] = false;
}
url.SetFileName("movies/" + path);
break;
case TV_SHOWS:
- if (filter.CompareNoCase(name))
+ if (!StringUtils::EqualsNoCase(filter, name))
{
m_dll->ref_release(program);
continue;
// 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
{
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);
CSmartPlaylist playlist;
if (playlist.OpenAndReadName(item->GetPath()))
{
- if (playlist.GetName().CompareNoCase(name) == 0)
+ if (StringUtils::EqualsNoCase(playlist.GetName(), name))
return item->GetPath();
}
}
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);
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;
}
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;
#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;
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;
{
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;
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);
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;
// 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");
// 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");
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;
}
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;
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);
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;
}
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);
}
{
#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
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;
}
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);
}
{
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);
}
#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)
{
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
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())
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())
mediaPath = devicePath;
#ifdef TARGET_WINDOWS
- if (mediaPath.empty() || mediaPath.CompareNoCase("iso9660://") == 0)
+ if (mediaPath.empty() || mediaPath == "iso9660://")
{
mediaPath = g_mediaManager.TranslateDevicePath("");
URIUtils::AddSlashAtEnd(mediaPath);
CStdString strAlarmClock;
CStdString strStarted;
- if (strName.CompareNoCase("shutdowntimer") == 0)
+ if (StringUtils::EqualsNoCase(strName, "shutdowntimer"))
{
strAlarmClock = g_localizeStrings.Get(20144);
strStarted = g_localizeStrings.Get(20146);
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);
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;
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;
{
CStdString strPath =(*m_fileItems)[i]->GetPath();
URIUtils::RemoveSlashAtEnd(strPath);
- if (strPath.CompareNoCase(comparePath) == 0)
+ if (strPath == comparePath)
{
item = i;
break;
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();