Skip to content

Commit

Permalink
Decouple Util and StringUtil
Browse files Browse the repository at this point in the history
Util included StringUtil which lead to many classes relying on it,
decouple it instead and make it explicit to include StringUtils.

This was achieved by moving the sortstringbyname from Util class
to a better fit, StringUtil. The method was also optimized to
avoid copying of the string and use the method from the StringUtil
instead.
  • Loading branch information
denizt authored and Deniz Türkoglu committed Feb 23, 2015
1 parent 10d8d19 commit 583eda7
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 13 deletions.
13 changes: 0 additions & 13 deletions xbmc/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <vector>
#include <string.h>
#include <stdint.h>
#include "utils/StringUtils.h"
#include "MediaSource.h"

#define ARRAY_SIZE(X) (sizeof(X)/sizeof((X)[0]))
Expand All @@ -37,18 +36,6 @@
class CFileItemList;
class CURL;

struct sortstringbyname
{
bool operator()(const std::string& strItem1, const std::string& strItem2)
{
std::string strLine1 = strItem1;
std::string strLine2 = strItem2;
StringUtils::ToLower(strLine1);
StringUtils::ToLower(strLine2);
return strcmp(strLine1.c_str(), strLine2.c_str()) < 0;
}
};

struct ExternalStreamInfo
{
std::string name;
Expand Down
1 change: 1 addition & 0 deletions xbmc/addons/AddonCallbacksPVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "AddonCallbacksPVR.h"
#include "settings/AdvancedSettings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "dialogs/GUIDialogKaiToast.h"

#include "epg/EpgContainer.h"
Expand Down
1 change: 1 addition & 0 deletions xbmc/dialogs/GUIDialogFileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "GUIDialogFileBrowser.h"
#include "Util.h"
#include "utils/URIUtils.h"
#include "utils/StringUtils.h"
#include "network/GUIDialogNetworkSetup.h"
#include "GUIDialogMediaSource.h"
#include "GUIDialogContextMenu.h"
Expand Down
1 change: 1 addition & 0 deletions xbmc/filesystem/AFPFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "settings/AdvancedSettings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/TimeUtils.h"

using namespace XFILE;
Expand Down
1 change: 1 addition & 0 deletions xbmc/filesystem/HDHomeRunFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "HDHomeRunFile.h"
#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "Util.h"
#include "DllHDHomeRun.h"
Expand Down
1 change: 1 addition & 0 deletions xbmc/filesystem/IDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "URL.h"
#include "PasswordManager.h"
#include "utils/URIUtils.h"
#include "utils/StringUtils.h"

using namespace XFILE;

Expand Down
1 change: 1 addition & 0 deletions xbmc/filesystem/PVRDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Util.h"
#include "URL.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "guilib/LocalizeStrings.h"

Expand Down
1 change: 1 addition & 0 deletions xbmc/playlists/PlayListB4S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "music/tags/MusicInfoTag.h"
#include "filesystem/File.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/XMLUtils.h"

Expand Down
1 change: 1 addition & 0 deletions xbmc/playlists/PlayListWPL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "settings/AdvancedSettings.h"
#include "filesystem/File.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/XMLUtils.h"

Expand Down
1 change: 1 addition & 0 deletions xbmc/playlists/PlayListXML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Util.h"
#include "utils/RegExp.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/XMLUtils.h"
#include "utils/Variant.h"
Expand Down
1 change: 1 addition & 0 deletions xbmc/profiles/dialogs/GUIDialogProfileSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "settings/lib/Setting.h"
#include "storage/MediaManager.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"

#define CONTROL_PROFILE_IMAGE CONTROL_SETTINGS_CUSTOM + 1
Expand Down
1 change: 1 addition & 0 deletions xbmc/pvr/addons/PVRClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"

using namespace ADDON;
using namespace PVR;
Expand Down
1 change: 1 addition & 0 deletions xbmc/pvr/windows/GUIWindowPVRChannels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "epg/EpgContainer.h"
#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "threads/SingleLock.h"

using namespace PVR;
Expand Down
1 change: 1 addition & 0 deletions xbmc/utils/HttpRangeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "HttpRangeUtils.h"
#include "Util.h"
#include "network/httprequesthandler/IHTTPRequestHandler.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"

#include <algorithm>
Expand Down
8 changes: 8 additions & 0 deletions xbmc/utils/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,11 @@ class StringUtils
private:
static std::string m_lastUUID;
};

struct sortstringbyname
{
bool operator()(const std::string& strItem1, const std::string& strItem2)
{
return StringUtils::CompareNoCase(strItem1, strItem2) < 0;
}
};

0 comments on commit 583eda7

Please sign in to comment.