-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lib.cpp
64 lines (56 loc) · 1.26 KB
/
Lib.cpp
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
#include "Lib.h"
String Lib::ReadTXT(String path,int line)
{
QFile PreQFile(path);
PreQFile.open(QIODevice::ReadOnly);
QTextStream text(&PreQFile);
String concert;
if(line==-1)
{concert=text.readAll();}
else
{concert=text.readLine(line);}
PreQFile.close();
return concert;
}
void Lib::WriteTXT(String path, String text)
{
QFile PreQFile(path);
PreQFile.open(QFile::Text|QFile::Append);
QTextStream out(&PreQFile);
out<<text;
PreQFile.close();
}
void Lib::WriteINI(String path, String section, String var, String value)
{
QSettings PreQSet(path,QSettings::IniFormat);
PreQSet.setValue("/"+section+"/"+var,value);
}
String Lib::ReadINI(String path, String section, String var)
{
QSettings PreQSet(path,QSettings::IniFormat);
return PreQSet.value("/"+section+"/"+var).toString();
}
String Lib::getPath(String str)
{
String path;
QDir dir;
path=dir.currentPath();
path+="/"+str;
return path;
}
void Lib::output(String content, bool lineFeed)
{
if(lineFeed)
cout<<content<<endl;
else
cout<<content;
}
String Lib::input(String information)
{
output(information);
String content;
cin>>content;
return content;
}
void Lib::RemoveFile(String path)
{QFile::remove(path);}