source: AE/Installer/trunk/source/methods.h@ 301

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