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