source: trunk/Cocoa/F-Script Anywhere/Source/SCPatch/SCPatchController/SCPatchContext.h@ 204

Last change on this file since 204 was 153, checked in by Nicholas Riley, 21 years ago

Integrates SCPatch and mach_inject; unfinished, buggy.

File size: 1.8 KB
Line 
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//-------------------------------------------------------------------------------------------------------------
17class MacPSN
18{
19 public:
20 ProcessSerialNumber psn;
21
22 MacPSN(ProcessSerialNumber *inPSN) { psn = *inPSN; }
23 ~MacPSN(void) { };
24
25};
26
27//-------------------------------------------------------------------------------------------------------------
28bool operator< (const MacPSN& x, const MacPSN& y);
29bool operator==(const MacPSN& x, const MacPSN& y);
30
31//-------------------------------------------------------------------------------------------------------------
32class 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
47typedef ProcessSerialNumber SCPatchContextRef;
48typedef std::multimap<MacPSN, SCPatchContext>::iterator SCPatchContextIterator;
49typedef std::pair<MacPSN, SCPatchContext> SCPatchContextPair;
50
51class 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
Note: See TracBrowser for help on using the repository browser.