source: trunk/gsinstaller/unInstall.h@ 2013

Last change on this file since 2013 was 1673, checked in by cs025, 23 years ago

Fixed problem in uninstalling which appeared when uninstalling the shortcut
icons.
Parameters to undo didn't permit two parameters to be the same, and if for
example a shortcut was in a group with the same name, a parameter
disappeared. Fixed by extending stringArray class to be configured to accept
duplicate entries.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
RevLine 
[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)
10using namespace ospace::std;
11#else
[1536]12using 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
26static string uninstall_ALL = "all";
27
28typedef class unInstallCommand
29{
30public:
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 &parameterList() { return this->parameters; };
50} unInstallCommand;
51
52typedef vector<unInstallCommand> unInstallCommandList;
53
54typedef map<string, unInstallCommandList, less<string> > unInstallCommandMap;
55
56class installManager
57{
[1638]58private:
[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 &params);
71public:
[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 &params);
81 bool isEmpty();
82 ~installManager();
83};
84
85class installAgent
86{
87protected:
88 installManager *manager;
89public:
90 installAgent(installManager &useManager) { this->manager = &useManager; };
91 virtual bool undoAction(string actionName, stringArray &params) { return false; };
92 // bool undo(string actionName);
93};
94
95#endif
Note: See TracBrowser for help on using the repository browser.