[153] | 1 | #ifndef _SCPATCHCONTEXT_
|
---|
| 2 | #define _SCPATCHCONTEXT_
|
---|
| 3 |
|
---|
| 4 | #ifdef __MWERKS__
|
---|
| 5 | #include <utility.h>
|
---|
| 6 | #include <iterator.h>
|
---|
| 7 | #include <map.h>
|
---|
| 8 | #else
|
---|
| 9 | #include <utility>
|
---|
| 10 | #include <iterator>
|
---|
| 11 | #include <map>
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | #include <Carbon/Carbon.h>
|
---|
| 15 |
|
---|
| 16 | //-------------------------------------------------------------------------------------------------------------
|
---|
| 17 | class MacPSN
|
---|
| 18 | {
|
---|
| 19 | public:
|
---|
| 20 | ProcessSerialNumber psn;
|
---|
| 21 |
|
---|
| 22 | MacPSN(ProcessSerialNumber *inPSN) { psn = *inPSN; }
|
---|
| 23 | ~MacPSN(void) { };
|
---|
| 24 |
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 | //-------------------------------------------------------------------------------------------------------------
|
---|
| 28 | bool operator< (const MacPSN& x, const MacPSN& y);
|
---|
| 29 | bool operator==(const MacPSN& x, const MacPSN& y);
|
---|
| 30 |
|
---|
| 31 | //-------------------------------------------------------------------------------------------------------------
|
---|
| 32 | class SCPatchContext
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 35 | ProcessSerialNumber psn;
|
---|
| 36 | SInt32 pid;
|
---|
| 37 | OSType creator;
|
---|
| 38 | CFStringRef path;
|
---|
| 39 | CFStringRef name;
|
---|
| 40 | UInt32 flags;
|
---|
| 41 |
|
---|
| 42 | SCPatchContext(ProcessSerialNumber *inPSN, SInt32 inPID, OSType creator);
|
---|
| 43 | SCPatchContext(const SCPatchContext &);
|
---|
| 44 | ~SCPatchContext(void) { }
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 | typedef ProcessSerialNumber SCPatchContextRef;
|
---|
| 48 | typedef std::multimap<MacPSN, SCPatchContext>::iterator SCPatchContextIterator;
|
---|
| 49 | typedef std::pair<MacPSN, SCPatchContext> SCPatchContextPair;
|
---|
| 50 |
|
---|
| 51 | class SCPatchContextList
|
---|
| 52 | {
|
---|
| 53 | private:
|
---|
| 54 | std::multimap<MacPSN, SCPatchContext> contexts;
|
---|
| 55 |
|
---|
| 56 | public:
|
---|
| 57 | SCPatchContextList(void);
|
---|
| 58 | ~SCPatchContextList(void);
|
---|
| 59 |
|
---|
| 60 | SCPatchContextRef NewContext(ProcessSerialNumber *inPSN, SInt32 inPID, OSType inCreator);
|
---|
| 61 | SCPatchContext *GetContext(ProcessSerialNumber *inPSN);
|
---|
| 62 | SCPatchContext *GetContext(OSType inCreator);
|
---|
| 63 | void DeleteContext(ProcessSerialNumber *inPSN);
|
---|
| 64 |
|
---|
| 65 | SCPatchContextIterator begin(void) { return contexts.begin(); }
|
---|
| 66 | SCPatchContextIterator end(void) { return contexts.end(); }
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | #endif |
---|