Skip to content

Commit 79d166a

Browse files
authored
Merge pull request #187 from AlwinEsch/Matrix-change
[Matrix] remove own StringUtils and do via new dev kit headers about
2 parents a1b2b48 + d77c409 commit 79d166a

File tree

8 files changed

+21
-270
lines changed

8 files changed

+21
-270
lines changed

CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ set(JOYSTICK_SOURCES src/addon.cpp
5353
src/storage/xml/ButtonMapXml.cpp
5454
src/storage/xml/DatabaseXml.cpp
5555
src/storage/xml/DeviceXml.cpp
56-
src/storage/xml/JoystickFamiliesXml.cpp
57-
src/utils/StringUtils.cpp)
56+
src/storage/xml/JoystickFamiliesXml.cpp)
5857

5958
set(JOYSTICK_HEADERS src/addon.h
6059
src/api/IJoystickInterface.h
@@ -107,8 +106,7 @@ set(JOYSTICK_HEADERS src/addon.h
107106
src/storage/xml/DeviceXml.h
108107
src/storage/xml/JoystickFamiliesXml.h
109108
src/storage/xml/JoystickFamilyDefinitions.h
110-
src/utils/CommonMacros.h
111-
src/utils/StringUtils.h)
109+
src/utils/CommonMacros.h)
112110

113111
if(CORE_SYSTEM_NAME MATCHES windows)
114112
list(APPEND JOYSTICK_SOURCES src/utils/windows/CharsetConverter.cpp)

peripheral.joystick/addon.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon
33
id="peripheral.joystick"
4-
version="1.7.0"
4+
version="1.7.1"
55
name="Joystick Support"
66
provider-name="Team Kodi">
77
<requires>@ADDON_DEPENDS@</requires>

src/api/Joystick.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#include "log/Log.h"
1414
#include "settings/Settings.h"
1515
#include "utils/CommonMacros.h"
16-
#include "utils/StringUtils.h"
16+
17+
#include <kodi/tools/StringUtils.h>
1718

1819
using namespace JOYSTICK;
1920

@@ -40,10 +41,10 @@ bool CJoystick::Equals(const CJoystick* rhs) const
4041

4142
void CJoystick::SetName(const std::string& strName)
4243
{
43-
std::string strSanitizedFilename = StringUtils::MakeSafeString(strName);
44+
std::string strSanitizedFilename = kodi::tools::StringUtils::MakeSafeString(strName);
4445

4546
// Remove Bluetooth MAC address as seen in Sony Playstation controllers
46-
StringUtils::RemoveMACAddress(strSanitizedFilename);
47+
strSanitizedFilename = kodi::tools::StringUtils::RemoveMACAddress(strSanitizedFilename);
4748

4849
kodi::addon::Joystick::SetName(strSanitizedFilename);
4950
}

src/storage/JustABunchOfFiles.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include "StorageUtils.h"
1212
#include "filesystem/DirectoryUtils.h"
1313
#include "log/Log.h"
14-
#include "utils/StringUtils.h"
1514

1615
#include <algorithm>
16+
#include <kodi/tools/StringUtils.h>
1717

1818
using namespace JOYSTICK;
1919

@@ -306,7 +306,7 @@ void CJustABunchOfFiles::IndexDirectory(const std::string& path, unsigned int fo
306306
items.erase(std::remove_if(items.begin(), items.end(),
307307
[this](const kodi::vfs::CDirEntry& item)
308308
{
309-
return !item.IsFolder() && !StringUtils::EndsWith(item.Path(), this->m_strExtension);
309+
return !item.IsFolder() && !kodi::tools::StringUtils::EndsWith(item.Path(), this->m_strExtension);
310310
}), items.end());
311311

312312
m_directoryCache.UpdateDirectory(path, items);

src/storage/StorageManager.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
#include "storage/api/DatabaseJoystickAPI.h"
1515
//#include "storage/retroarch/DatabaseRetroarch.h" // TODO
1616
#include "storage/xml/DatabaseXml.h"
17-
#include "utils/StringUtils.h"
1817

1918
#include "addon.h"
2019

20+
#include <kodi/tools/StringUtils.h>
21+
2122
using namespace JOYSTICK;
2223

2324
// Resources folder for add-on and user data
@@ -59,8 +60,8 @@ bool CStorageManager::Initialize(CPeripheralJoystick* peripheralLib)
5960
return false;
6061

6162
// Remove slash at end
62-
StringUtils::TrimRight(strUserPath, "\\/");
63-
StringUtils::TrimRight(strAddonPath, "\\/");
63+
kodi::tools::StringUtils::TrimRight(strUserPath, "\\/");
64+
kodi::tools::StringUtils::TrimRight(strAddonPath, "\\/");
6465

6566
strUserPath += "/" USER_RESOURCES_FOLDER;
6667
strAddonPath += "/" ADDON_RESOURCES_FOLDER;

src/storage/StorageUtils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "Device.h"
1111
#include "filesystem/DirectoryUtils.h"
1212
#include "log/Log.h"
13-
#include "utils/StringUtils.h"
1413

1514
#include <algorithm>
15+
#include <kodi/tools/StringUtils.h>
1616
#include <set>
1717
#include <sstream>
1818
#include <stdio.h>
@@ -43,7 +43,7 @@ bool CStorageUtils::EnsureDirectoryExists(const std::string& path)
4343

4444
std::string CStorageUtils::RootFileName(const kodi::addon::Joystick& device)
4545
{
46-
std::string baseFilename = StringUtils::MakeSafeUrl(device.Name());
46+
std::string baseFilename = kodi::tools::StringUtils::MakeSafeUrl(device.Name());
4747

4848
// Limit filename to a sane number of characters.
4949
if (baseFilename.length() > 50)
@@ -84,15 +84,15 @@ std::string CStorageUtils::FormatHexString(int iVal)
8484
if (iVal > 65536)
8585
iVal = 65536;
8686

87-
return StringUtils::Format("%04X", iVal);
87+
return kodi::tools::StringUtils::Format("%04X", iVal);
8888
};
8989

9090
std::string CStorageUtils::PrimitiveToString(const kodi::addon::DriverPrimitive& primitive)
9191
{
9292
switch (primitive.Type())
9393
{
9494
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON:
95-
return StringUtils::Format("button %u", primitive.DriverIndex());
95+
return kodi::tools::StringUtils::Format("button %u", primitive.DriverIndex());
9696
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION:
9797
switch (primitive.HatDirection())
9898
{
@@ -109,15 +109,15 @@ std::string CStorageUtils::PrimitiveToString(const kodi::addon::DriverPrimitive&
109109
}
110110
break;
111111
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS:
112-
return StringUtils::Format("axis %s%u",
112+
return kodi::tools::StringUtils::Format("axis %s%u",
113113
primitive.SemiAxisDirection() == JOYSTICK_DRIVER_SEMIAXIS_POSITIVE ? "+" : "-",
114114
primitive.DriverIndex());
115115
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR:
116-
return StringUtils::Format("motor %u", primitive.DriverIndex());
116+
return kodi::tools::StringUtils::Format("motor %u", primitive.DriverIndex());
117117
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY:
118-
return StringUtils::Format("key \"%s\"", primitive.Keycode().c_str());
118+
return kodi::tools::StringUtils::Format("key \"%s\"", primitive.Keycode().c_str());
119119
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON:
120-
return StringUtils::Format("mouse button %u", primitive.MouseIndex());
120+
return kodi::tools::StringUtils::Format("mouse button %u", primitive.MouseIndex());
121121
case JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION:
122122
switch (primitive.RelPointerDirection())
123123
{

src/utils/StringUtils.cpp

Lines changed: 0 additions & 174 deletions
This file was deleted.

0 commit comments

Comments
 (0)