-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir.h
37 lines (30 loc) · 1.31 KB
/
dir.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
#ifndef DIR_H
#define DIR_H
#define MAX_DIR_LEN 256
#include<string.h>
#include<QXmlStreamReader>
#include<QFile>
#include<QDebug>
#include <QDomDocument>
#include <QProcessEnvironment>
extern char dir[MAX_DIR_LEN];
extern size_t max_retrans_times;
extern size_t wait_time_ms;
extern size_t max_find_response_time_ms;
extern size_t state_file_send_interval;
#define INIT "./615A.ini"
#define LOAD_DIR {QFile file(INIT);if(file.open(QIODevice::ReadOnly)){QDataStream in(&file); in.readRawData(dir, MAX_DIR_LEN); file.close();}};
#define GET_DIR QString path = dir;
#define UPDATE_DIR(pathList) QString path = pathList.at(0); strcpy(dir, path.left(path.lastIndexOf('/')).toStdString().data());
#define SAVE_DIR {\
QFile file(INIT);\
if(file.open(QIODevice::ReadWrite | QIODevice::Truncate)){\
file.write(dir, strlen(dir) + 1);\
file.close();\
}\
};
bool loadxml(); //从XML文件中加载用户目录,最大重传次数,重传等待时间等参数
bool savexml(); //将用户目录,最大重传次数,重传等待时间等参数写到XML文件中
enum Type{stringType, ulonglongType};
bool newElement(QDomDocument *doc, QDomElement* root, QString name, Type type, void* data);
#endif // DIR_H