source: trunk/gsinstaller/unInstall.h@ 1638

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

Fundamental changes in the method of handling logs to further bypass faults
in the Microsoft implementation of C++ fstream class.

  • 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 setLogFile(string filename);
68 bool ensureLog();
69 bool readLog();
70 bool recordLog();
71 void setModule(string moduleName);
72 bool storeCommand(unInstallCommand &command);
73 string popCommand(stringArray &params);
74 bool isEmpty();
75 ~installManager();
76};
77
78class installAgent
79{
80protected:
81 installManager *manager;
82public:
83 installAgent(installManager &useManager) { this->manager = &useManager; };
84 virtual bool undoAction(string actionName, stringArray &params) { return false; };
85 // bool undo(string actionName);
86};
87
88#endif
Note: See TracBrowser for help on using the repository browser.