1 | #ifndef _UNINSTALL_H_
|
---|
2 | #define _UNINSTALL_H_
|
---|
3 | #include <string>
|
---|
4 | #include <vector>
|
---|
5 | #include <map>
|
---|
6 | using namespace std;
|
---|
7 |
|
---|
8 | #include <stdio.h>
|
---|
9 |
|
---|
10 | #if defined (GSDL_USE_IOS_H)
|
---|
11 | #include <fstream.h>
|
---|
12 | #else
|
---|
13 | #include <fstream>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include "stringArray.h"
|
---|
17 |
|
---|
18 | static string uninstall_ALL = "all";
|
---|
19 |
|
---|
20 | typedef class unInstallCommand
|
---|
21 | {
|
---|
22 | public:
|
---|
23 | string command;
|
---|
24 | stringArray parameters;
|
---|
25 |
|
---|
26 | unInstallCommand() { };
|
---|
27 | unInstallCommand(string commandname) { this->command = commandname; };
|
---|
28 | unInstallCommand(string commandname, stringArray params)
|
---|
29 | {
|
---|
30 | this->command = commandname;
|
---|
31 | this->parameters = params;
|
---|
32 | };
|
---|
33 | void addParameter(string parameter) { this->parameters.add(parameter); };
|
---|
34 | string commandName() { return this->command; };
|
---|
35 | stringArray ¶meterList() { return this->parameters; };
|
---|
36 | } unInstallCommand;
|
---|
37 |
|
---|
38 | typedef vector<unInstallCommand> unInstallCommandList;
|
---|
39 |
|
---|
40 | typedef map<string, unInstallCommandList, less<string> > unInstallCommandMap;
|
---|
41 |
|
---|
42 | class installManager
|
---|
43 | {
|
---|
44 | private:
|
---|
45 | fstream logfile;
|
---|
46 | string logfileName;
|
---|
47 | string currentModule;
|
---|
48 | unInstallCommandMap modules;
|
---|
49 |
|
---|
50 | bool writeString(string str);
|
---|
51 | bool writeString(char *string);
|
---|
52 | bool writeSeparator();
|
---|
53 | string readString();
|
---|
54 | bool writeCommand(unInstallCommand &command);
|
---|
55 | string readCommand(stringArray ¶ms);
|
---|
56 | public:
|
---|
57 | installManager() { };
|
---|
58 | bool openLog(string filename, bool write);
|
---|
59 | bool closeLog();
|
---|
60 | bool reopenLog();
|
---|
61 | void setModule(string moduleName);
|
---|
62 | bool storeCommand(unInstallCommand &command);
|
---|
63 | string popCommand(stringArray ¶ms);
|
---|
64 | bool isEmpty();
|
---|
65 | ~installManager();
|
---|
66 | };
|
---|
67 |
|
---|
68 | class installAgent
|
---|
69 | {
|
---|
70 | protected:
|
---|
71 | installManager *manager;
|
---|
72 | public:
|
---|
73 | installAgent(installManager &useManager) { this->manager = &useManager; };
|
---|
74 | virtual bool undoAction(string actionName, stringArray ¶ms) { return false; };
|
---|
75 | // bool undo(string actionName);
|
---|
76 | };
|
---|
77 |
|
---|
78 | #endif
|
---|