source: trunk/gsinstaller/unInstall.h@ 1639

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

Further fixes to get around bloopers in Visual C++; it wasn't resetting the
status flags for a stream on the reopening of a file, also had forgotten to read
the old log file when doing an additional installation.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
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)
10using namespace ospace::std;
11#else
12using 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
26static string uninstall_ALL = "all";
27
28typedef class unInstallCommand
29{
30public:
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 &parameterList() { return this->parameters; };
44} unInstallCommand;
45
46typedef vector<unInstallCommand> unInstallCommandList;
47
48typedef map<string, unInstallCommandList, less<string> > unInstallCommandMap;
49
50class installManager
51{
52private:
53 fstream logfile;
54 string logfileName;
55 string currentModule;
56 unInstallCommandMap modules;
57 bool changed;
58
59 bool writeString(string str);
60 bool writeString(char *string);
61 bool writeSeparator();
62 string readString();
63 bool writeCommand(unInstallCommand &command);
64 string readCommand(stringArray &params);
65public:
66 installManager() { this->changed = false; }
67 bool logExists();
68 bool setLogFile(string filename);
69 bool ensureLog();
70 bool readLog();
71 bool recordLog();
72 void setModule(string moduleName);
73 bool storeCommand(unInstallCommand &command);
74 string popCommand(stringArray &params);
75 bool isEmpty();
76 ~installManager();
77};
78
79class installAgent
80{
81protected:
82 installManager *manager;
83public:
84 installAgent(installManager &useManager) { this->manager = &useManager; };
85 virtual bool undoAction(string actionName, stringArray &params) { return false; };
86 // bool undo(string actionName);
87};
88
89#endif
Note: See TracBrowser for help on using the repository browser.