[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 |
|
---|
| 34 | unInstallCommand() { };
|
---|
| 35 | unInstallCommand(string commandname) { this->command = commandname; };
|
---|
| 36 | unInstallCommand(string commandname, stringArray params)
|
---|
| 37 | {
|
---|
| 38 | this->command = commandname;
|
---|
| 39 | this->parameters = params;
|
---|
| 40 | };
|
---|
| 41 | void addParameter(string parameter) { this->parameters.add(parameter); };
|
---|
| 42 | string commandName() { return this->command; };
|
---|
| 43 | stringArray ¶meterList() { return this->parameters; };
|
---|
| 44 | } unInstallCommand;
|
---|
| 45 |
|
---|
| 46 | typedef vector<unInstallCommand> unInstallCommandList;
|
---|
| 47 |
|
---|
| 48 | typedef map<string, unInstallCommandList, less<string> > unInstallCommandMap;
|
---|
| 49 |
|
---|
| 50 | class installManager
|
---|
| 51 | {
|
---|
| 52 | private:
|
---|
| 53 | fstream logfile;
|
---|
| 54 | string logfileName;
|
---|
| 55 | string currentModule;
|
---|
| 56 | unInstallCommandMap modules;
|
---|
| 57 |
|
---|
| 58 | bool writeString(string str);
|
---|
| 59 | bool writeString(char *string);
|
---|
| 60 | bool writeSeparator();
|
---|
| 61 | string readString();
|
---|
| 62 | bool writeCommand(unInstallCommand &command);
|
---|
| 63 | string readCommand(stringArray ¶ms);
|
---|
| 64 | public:
|
---|
| 65 | installManager() { };
|
---|
| 66 | bool openLog(string filename, bool write);
|
---|
| 67 | bool closeLog();
|
---|
| 68 | bool reopenLog();
|
---|
| 69 | void setModule(string moduleName);
|
---|
| 70 | bool storeCommand(unInstallCommand &command);
|
---|
| 71 | string popCommand(stringArray ¶ms);
|
---|
| 72 | bool isEmpty();
|
---|
| 73 | ~installManager();
|
---|
| 74 | };
|
---|
| 75 |
|
---|
| 76 | class installAgent
|
---|
| 77 | {
|
---|
| 78 | protected:
|
---|
| 79 | installManager *manager;
|
---|
| 80 | public:
|
---|
| 81 | installAgent(installManager &useManager) { this->manager = &useManager; };
|
---|
| 82 | virtual bool undoAction(string actionName, stringArray ¶ms) { return false; };
|
---|
| 83 | // bool undo(string actionName);
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | #endif
|
---|