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 modString; |
11 |
bool hasOnis; |
12 |
bool hasDeltas; |
13 |
bool hasBSL; |
14 |
bool hasDats; |
15 |
bool category; |
16 |
string creator; |
17 |
bool isEngine; |
18 |
string readme; |
19 |
bool globalNeeded; |
20 |
}; |
21 |
|
22 |
int mainMenu(); |
23 |
vector<ModPackage> getPackages(); |
24 |
ModPackage fileToModPackage(fstream&); |
25 |
|
26 |
void installPackages(); |
27 |
void uninstallPackages(); |
28 |
void getInstalledPackages(); |
29 |
|
30 |
bool getDirectoryContents(char , char &); |
31 |
|
32 |
|
33 |
void Tokenize(const string& str, |
34 |
vector<string>& tokens, |
35 |
const string& delimiters = " ") |
36 |
{ |
37 |
// Skip delimiters at beginning. |
38 |
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
39 |
// Find first "non-delimiter". |
40 |
string::size_type pos = str.find_first_of(delimiters, lastPos); |
41 |
|
42 |
while (string::npos != pos || string::npos != lastPos) |
43 |
{ |
44 |
// Found a token, add it to the vector. |
45 |
tokens.push_back(str.substr(lastPos, pos - lastPos)); |
46 |
// Skip delimiters. Note the "not_of" |
47 |
lastPos = str.find_first_not_of(delimiters, pos); |
48 |
// Find next "non-delimiter" |
49 |
pos = str.find_first_of(delimiters, lastPos); |
50 |
} |
51 |
} |