source: trunk/gsinstaller/unInstall.h@ 1498

Last change on this file since 1498 was 1498, checked in by cs025, 24 years ago

Further changes for uninstaller

  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#ifndef _UNINSTALL_H_
2#define _UNINSTALL_H_
3#include <string>
4#include <vector>
5#include <map>
6using namespace std;
7
8#include <stdio.h>
9#include <fstream.h>
10
11#include "stringArray.h"
12
13static string uninstall_ALL = "all";
14
15typedef class unInstallCommand
16{ public:
17 string command;
18 stringArray parameters;
19
20 unInstallCommand() { };
21 unInstallCommand(string commandname) { this->command = commandname; };
22 unInstallCommand(string commandname, stringArray params)
23 { this->command = commandname;
24 this->parameters = params;
25 };
26 void addParameter(string parameter) { this->parameters.add(parameter); };
27 string commandName() { return this->command; };
28 stringArray &parameterList() { return this->parameters; };
29} unInstallCommand;
30
31typedef vector<unInstallCommand> unInstallCommandList;
32
33typedef map<string, unInstallCommandList, less<string> > unInstallCommandMap;
34
35class installManager
36{ private:
37 fstream logfile;
38 string logfileName;
39 string currentModule;
40 unInstallCommandMap modules;
41
42 bool writeString(string str);
43 bool writeString(char *string);
44 bool writeSeparator();
45 string readString();
46 bool writeCommand(unInstallCommand &command);
47 string readCommand(stringArray &params);
48 public:
49 installManager() { };
50 bool openLog(string filename, bool write);
51 bool closeLog();
52 bool reopenLog();
53 void setModule(string moduleName);
54 bool storeCommand(unInstallCommand &command);
55 string popCommand(stringArray &params);
56 bool isEmpty();
57 ~installManager();
58};
59
60class installAgent
61{ protected:
62 installManager *manager;
63 public:
64 installAgent(installManager &useManager) { this->manager = &useManager; };
65 virtual bool undoAction(string actionName, stringArray &params) { return false; };
66// bool undo(string actionName);
67};
68
69class unInstaller
70{ private:
71 unInstallCommandMap _map;
72 void unInstallGroup(unInstallCommandList &list);
73 bool readFile(string &fileName);
74 bool getLine(char *line, string &groupname);
75 public:
76 unInstaller(string &fileName);
77 unInstaller(const char *fileName);
78 void unInstall(string &listName);
79 bool record(string group, string cmd, string param);
80 bool record(string group, string cmd, int count, ...);
81 bool saveToFile(string filename);
82 bool execCommand(string &command, stringArray &params);
83};
84
85#endif
Note: See TracBrowser for help on using the repository browser.