-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathClan.cpp
117 lines (94 loc) · 2.38 KB
/
Clan.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// wxWindows includes
#include <wx/string.h>
#include <wx/arrstr.h>
#include <wx/dynarray.h>
// Statsgen includes
#include "Clan.h"
#include "GlobalStatistics.h"
#include "StaticFunctions.h"
void Clan::ReadConfig()
{
wxString configBase;
wxString configKey;
wxString configValue;
wxString baseGroup;
baseGroup="Clan"+id;
configBase.Printf("/%s/",baseGroup.GetData());
configKey=configBase+"TagColoured";
globalStatistics.configData.ReadTextValue(configKey,&tag,"");
configKey=configBase+"FullName";
globalStatistics.configData.ReadTextValue(configKey,&name,"");
configKey=configBase+"WebAddress";
globalStatistics.configData.ReadTextValue(configKey,&webAddress,"");
configKey=configBase+"BannerAddress";
globalStatistics.configData.ReadTextValue(configKey,&banner,"");
configKey=configBase+"RegExp";
globalStatistics.configData.ReadTextValue(configKey,®ExpString,"");
regExp=new wxRegEx();
regExp->Compile(regExpString);
}
Clan::Clan(wxString &idIn)
{
id=idIn;
ReadConfig();
}
Clan::~Clan()
{
delete (regExp);
}
wxString Clan::SQLTableName()
{
wxString tableName="clan";
return (tableName);
}
wxString Clan::SQLCreateTable()
{
wxString SQL;
SQL.Printf("create table %s"
"("
"clanindex integer,"
"%s,"
"%s,"
"%s,"
"%s"
")",
SQLTableName().GetData(),
StatsgenDatabase::StringFieldDefinition("tag","clantag",FIELD_WIDTH_CLAN_TAG).GetData(),
StatsgenDatabase::StringFieldDefinition("name","clanname",FIELD_WIDTH_CLAN_NAME).GetData(),
StatsgenDatabase::StringFieldDefinition("webaddress","clannweb",FIELD_WIDTH_CLAN_WEBADDRESS).GetData(),
StatsgenDatabase::StringFieldDefinition("banner","clanbanner",FIELD_WIDTH_CLAN_BANNER).GetData()
);
return SQL;
}
bool Clan::WriteToDatabase(int itemIndex)
{
wxString SQL;
bool retVal=true;
SQL.Printf("Insert into %s"
"(clanindex,tag,name,webaddress,banner)"
"values('%d','%s','%s','%s','%s')",
SQLTableName().GetData(),
itemIndex,
tag.GetData(),
name.GetData(),
webAddress.GetData(),
banner.GetData());
globalStatistics.statsgenDatabase.SimpleExecute(SQL);
return retVal;
}
void Clan::WriteConfig()
{
wxString configBase;
wxString configKey;
wxString configValue;
wxString baseGroup;
baseGroup="Clan"+id;
}
bool Clan::IsMember(wxString &name)
{
wxString decoloured;
bool retVal;
decoloured=DecolouriseName(name);
retVal=regExp->Matches(decoloured);
return (retVal);
}