-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlotools.h
58 lines (50 loc) · 1.58 KB
/
lotools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef MYTOOLS_H
#define MYTOOLS_H
#include <QString>
#include <QStringList>
#include <QTextEdit>
#define TOOL_NETWORK 0
#if TOOL_NETWORK
#include <QtNetwork>
#endif
#define LoProperty0(type, name) \
private: type lp_##name; \
public: void set##name(type v) \
{ lp_##name = v; } \
public: type name(void) const \
{ return lp_##name; }
#define LoProperty1(type, name) \
private: type lp_##name; \
public: void set##name(const type & v) \
{ lp_##name = v; } \
public: type name(void) const \
{ return lp_##name; }
/*
#define LoPropertyObj(type, name) \
private: type lp_##name; \
signals: void sig##name##Changed(type v) \
public: void set##name(type v) \
{ lp_##name = v; \
sig##name##Changed(v); } \
public: type name(void) const \
{ return lp_##name; }
*/
class LoTools
{
protected:
LoTools();
#if TOOL_NETWORK
public: // Network
static QStringList getLocalIPv4List();
#endif
public: // Data Conversion
static QByteArray Hex2BArray(const QString &h);
static QString BArray2Hex(const QByteArray &a);
static QString Str2Hex (const QString &s);
static QString Hex2Str (const QString &h);
static void go2TheEnd (QTextEdit *te);
public: // Qt Extend
static void append(QTextEdit *te, const QByteArray &d);
static void append(QTextEdit *te, const QString &s);
};
#endif // MYTOOLS_H