1 |
#include <string> |
2 |
#include <vector> |
3 |
#include <fstream> |
4 |
|
5 |
using namespace std; |
6 |
|
7 |
struct ModPackage { |
8 |
bool isInstalled; //replace with function |
9 |
string name; |
10 |
string modStringName; |
11 |
int modStringVersion; |
12 |
bool hasOnis; |
13 |
bool hasDeltas; |
14 |
bool hasBSL; |
15 |
bool hasDats; |
16 |
string category; |
17 |
string creator; |
18 |
bool isEngine; |
19 |
string readme; |
20 |
bool globalNeeded; |
21 |
ModPackage(); |
22 |
void doOutput() { |
23 |
cout << "Mod: " << name; cout << "\n"; //remove this when done |
24 |
cout << " String: " << modStringName << " v." << modStringVersion << "\n"; |
25 |
cout << " Category: " << category << "\n"; |
26 |
cout << " Creator: " << creator << "\n"; |
27 |
cout << " HasOnis: " << hasOnis << "\n"; |
28 |
cout << " HasBSL: " << hasBSL << "\n"; |
29 |
cout << " HasDeltas: " << hasDeltas << "\n"; |
30 |
cout << " HasDats: " << hasDats << "\n"; |
31 |
cout << " IsEngine: " << isEngine << "\n"; |
32 |
cout << " GlobalNeeded: " << globalNeeded << "\n"; |
33 |
cout << " Readme: " << readme << "\n"; |
34 |
cout << "\n"; |
35 |
} |
36 |
|
37 |
}; |
38 |
//Initialization |
39 |
ModPackage::ModPackage() { |
40 |
isInstalled = 0; //replace with function |
41 |
name = ""; |
42 |
modStringName = ""; |
43 |
modStringVersion = 0; |
44 |
hasOnis = 0; |
45 |
hasDeltas = 0; |
46 |
hasBSL = 0; |
47 |
hasDats = 0; |
48 |
category = ""; |
49 |
creator = ""; |
50 |
isEngine = 0; |
51 |
readme = ""; |
52 |
globalNeeded = 1; |
53 |
// void doOutput() const |
54 |
// { }; |
55 |
} |
56 |
|
57 |
int mainMenu(); |
58 |
vector<ModPackage> getPackages(); |
59 |
ModPackage fileToModPackage(fstream&); |
60 |
|
61 |
void installPackages(); |
62 |
void uninstallPackages(); |
63 |
void getInstalledPackages(); |
64 |
|
65 |
bool getDirectoryContents(char , char &); |
66 |
|
67 |
|
68 |
void Tokenize(const string& str, |
69 |
vector<string>& tokens, |
70 |
const string& delimiters = " ") |
71 |
{ |
72 |
// Skip delimiters at beginning. |
73 |
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
74 |
// Find first "non-delimiter". |
75 |
string::size_type pos = str.find_first_of(delimiters, lastPos); |
76 |
|
77 |
while (string::npos != pos || string::npos != lastPos) |
78 |
{ |
79 |
// Found a token, add it to the vector. |
80 |
tokens.push_back(str.substr(lastPos, pos - lastPos)); |
81 |
// Skip delimiters. Note the "not_of" |
82 |
lastPos = str.find_first_not_of(delimiters, pos); |
83 |
// Find next "non-delimiter" |
84 |
pos = str.find_first_of(delimiters, lastPos); |
85 |
} |
86 |
} |