Add utils-class for static utils methods
This commit is contained in:
parent
c4cbf89182
commit
74753ce644
@ -73,11 +73,13 @@ HEADERS += \
|
||||
src/ATBAPP/ATBAPPplugin.h \
|
||||
src/ATBAPP/DeviceControllerInterface.h \
|
||||
src/ATBAPP/ATBHealthEvent.h \
|
||||
src/ATBAPP/ATBDeviceControllerPlugin.h
|
||||
src/ATBAPP/ATBDeviceControllerPlugin.h \
|
||||
src/ATBAPP/Utils.h
|
||||
|
||||
SOURCES += \
|
||||
src/ATBAPP/ATBHealthEvent.cpp \
|
||||
src/ATBAPP/ATBDeviceControllerPlugin.cpp
|
||||
src/ATBAPP/ATBDeviceControllerPlugin.cpp \
|
||||
src/ATBAPP/Utils.cpp
|
||||
|
||||
DISTFILES += \
|
||||
generate-version.sh
|
||||
|
18
src/ATBAPP/Utils.cpp
Normal file
18
src/ATBAPP/Utils.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "Utils.h"
|
||||
|
||||
Utils::Utils(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Utils::compare(const void* a, const void* b)
|
||||
{
|
||||
int int_a = * ( (int*) a );
|
||||
int int_b = * ( (int*) b );
|
||||
|
||||
if ( int_a == int_b ) return 0;
|
||||
else if ( int_a < int_b ) return -1;
|
||||
else return 1;
|
||||
}
|
23
src/ATBAPP/Utils.h
Normal file
23
src/ATBAPP/Utils.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class Utils : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static int compare(const void* a, const void* b);
|
||||
|
||||
private:
|
||||
explicit Utils(QObject *parent = nullptr);
|
||||
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // UTILS_H
|
Loading…
Reference in New Issue
Block a user