[1536] | 1 | #ifndef _UNINSTALL_H_
|
---|
| 2 | #define _UNINSTALL_H_
|
---|
| 3 | #include <string>
|
---|
| 4 | #include <vector>
|
---|
| 5 | #include <map>
|
---|
[1539] | 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
|
---|
[1536] | 12 | using namespace std;
|
---|
[1539] | 13 | #endif
|
---|
| 14 | #endif
|
---|
[1536] | 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 |
|
---|
[1673] | 34 | unInstallCommand()
|
---|
| 35 | { this->parameters.permitDuplication(true);
|
---|
| 36 | }
|
---|
| 37 | unInstallCommand(string commandname)
|
---|
| 38 | { this->command = commandname;
|
---|
| 39 | this->parameters.permitDuplication(true);
|
---|
| 40 | }
|
---|
[1536] | 41 | unInstallCommand(string commandname, stringArray params)
|
---|
[1673] | 42 | {
|
---|
[1536] | 43 | this->command = commandname;
|
---|
| 44 | this->parameters = params;
|
---|
[1673] | 45 | this->parameters.permitDuplication(true);
|
---|
[1536] | 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 | {
|
---|
[1638] | 58 | private:
|
---|
[1536] | 59 | fstream logfile;
|
---|
| 60 | string logfileName;
|
---|
| 61 | string currentModule;
|
---|
[1638] | 62 | unInstallCommandMap modules;
|
---|
| 63 | bool changed;
|
---|
[1536] | 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:
|
---|
[1638] | 72 | installManager() { this->changed = false; }
|
---|
[1639] | 73 | bool logExists();
|
---|
[1638] | 74 | bool setLogFile(string filename);
|
---|
| 75 | bool ensureLog();
|
---|
| 76 | bool readLog();
|
---|
| 77 | bool recordLog();
|
---|
[1536] | 78 | void setModule(string moduleName);
|
---|
| 79 | bool storeCommand(unInstallCommand &command);
|
---|
| 80 | string popCommand(stringArray ¶ms);
|
---|
| 81 | bool isEmpty();
|
---|
| 82 | ~installManager();
|
---|
| 83 | };
|
---|
| 84 |
|
---|
| 85 | class installAgent
|
---|
| 86 | {
|
---|
| 87 | protected:
|
---|
| 88 | installManager *manager;
|
---|
| 89 | public:
|
---|
| 90 | installAgent(installManager &useManager) { this->manager = &useManager; };
|
---|
| 91 | virtual bool undoAction(string actionName, stringArray ¶ms) { return false; };
|
---|
| 92 | // bool undo(string actionName);
|
---|
| 93 | };
|
---|
| 94 |
|
---|
| 95 | #endif
|
---|