source: other-projects/trunk/gsinstaller/unInstall.h@ 15332

Last change on this file since 15332 was 11664, checked in by mdewsnip, 18 years ago

Fixed the line endings... for real this time, I hope.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 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 { this->parameters.permitDuplication(true);
36 }
37 unInstallCommand(string commandname)
38 { this->command = commandname;
39 this->parameters.permitDuplication(true);
40 }
41 unInstallCommand(string commandname, stringArray params)
42 {
43 this->command = commandname;
44 this->parameters = params;
45 this->parameters.permitDuplication(true);
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{
58private:
59 fstream logfile;
60 string logfileName;
61 string currentModule;
62 unInstallCommandMap modules;
63 bool changed;
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:
72 installManager() { this->changed = false; }
73 bool logExists();
74 bool setLogFile(string filename);
75 bool ensureLog();
76 bool readLog();
77 bool recordLog();
78 void abortLog();
79 void setModule(string moduleName);
80 bool storeCommand(unInstallCommand &command);
81 string popCommand(stringArray &params);
82 bool isEmpty();
83 string installRoot();
84 ~installManager();
85};
86
87class installAgent
88{
89protected:
90 installManager *manager;
91public:
92 installAgent(installManager &useManager) { this->manager = &useManager; };
93 virtual bool undoAction(string actionName, stringArray &params) { return false; };
94 // bool undo(string actionName);
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.