-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
executable file
·64 lines (47 loc) · 1.27 KB
/
util.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
59
60
61
62
63
64
#ifndef UTIL
#define UTIL
#include <QtCore/QString>
#include <QValidator>
#include <QDateTime>
//域名的最大长度
#ifndef MAX_DOMAIN_LEN
#define MAX_DOMAIN_LEN 64
#endif
#ifndef MAX_ATTRNAME_LEN
#define MAX_ATTRNAME_LEN 16
#define MAX_DESC_LEN 16
#endif
class Util
{
public:
static bool IsValidDomainStr(const QString& DomainStr);
static bool IsValidDomainChar(const QChar& ch);
static bool IsValidIpv4Str(const QString& ipStr);
static bool Is0to9(const QChar& ch);
static bool IsLetter(const QChar& ch);
static QString timestr();
};
class DomainValidator:public QValidator
{
public:
DomainValidator(QObject * parent = 0);
~DomainValidator();
virtual State validate(QString & input, int & pos)const;
};
class Ipv4Validator:public QValidator
{
public:
Ipv4Validator(QObject * parent = 0);
~Ipv4Validator();
virtual State validate(QString & input, int & pos)const;
virtual void fixup(QString & input) const;
};
class enDescValidator:public QValidator
{
public:
enDescValidator(QObject * parent = 0);
~enDescValidator();
virtual State validate(QString & input, int & pos)const;
virtual void fixup(QString & input) const;
};
#endif // UTIL