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

Last change on this file since 296 was 294, checked in by gumby, 16 years ago

Reader is pretty much finished. What to work on now?

File size: 2.2 KB
RevLine 
[278]1#include <string>
[290]2#include <vector>
[292]3#include <fstream>
[290]4
[278]5using namespace std;
6
[290]7struct ModPackage {
[293]8 bool isInstalled; //replace with function
9 string name;
[294]10 string modStringName;
11 int modStringVersion;
[293]12 bool hasOnis;
13 bool hasDeltas;
14 bool hasBSL;
15 bool hasDats;
[294]16 string category;
[293]17 string creator;
18 bool isEngine;
19 string readme;
20 bool globalNeeded;
[294]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
[290]37};
[294]38//Initialization
39ModPackage::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}
[290]56
57int mainMenu();
58vector<ModPackage> getPackages();
[293]59ModPackage fileToModPackage(fstream&);
[290]60
[278]61void installPackages();
62void uninstallPackages();
63void getInstalledPackages();
64
65bool getDirectoryContents(char , char &);
66
[293]67
68void Tokenize(const string& str,
[294]69 vector<string>& tokens,
70 const string& delimiters = " ")
[293]71{
[294]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);
[293]76
[294]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 }
[293]86}
Note: See TracBrowser for help on using the repository browser.