Root/
Source at commit 7 created 14 years 4 months ago. By rekursor, Added a version file in the bin directory, refreshed the binaries for 10.5 and 10.6 | |
---|---|
1 | /*␊ |
2 | * property_list.h␊ |
3 | *␊ |
4 | * Created by Rekursor on 1/17/10.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | #include <CoreFoundation/CFPropertyList.h>␊ |
9 | #include <CoreFoundation/CFURLAccess.h>␊ |
10 | #include <Security/Authorization.h>␊ |
11 | #include <string>␊ |
12 | ␊ |
13 | /****************************************************************/␊ |
14 | ␊ |
15 | /**␊ |
16 | * priviledged command run for cmds like property chmods and restard command␊ |
17 | */␊ |
18 | bool executePrivilegedCmd(AuthorizationRef auth, ␊ |
19 | ␉␉␉␉␉␉ const char* pathToTool, ␊ |
20 | ␉␉␉␉␉␉ const char* args=NULL, ␊ |
21 | ␉␉␉␉␉␉ AuthorizationFlags flags=kAuthorizationFlagDefaults);␊ |
22 | ␊ |
23 | /****************************************************************/␊ |
24 | ␊ |
25 | /**␊ |
26 | * Simple PropertyList Abstraction␊ |
27 | */␊ |
28 | class PropertyList␊ |
29 | {␊ |
30 | ␉␊ |
31 | public:␊ |
32 | ␉PropertyList() : _proplistRef(0), _CFURLRef(0) {␉}␊ |
33 | ␉virtual ~PropertyList();␊ |
34 | ␉␊ |
35 | ␉bool open(const char *propListPath, CFStringRef* errString,␊ |
36 | ␉␉␉ AuthorizationRef auth=NULL, AuthorizationFlags flags=kAuthorizationFlagDefaults);␊ |
37 | ␉bool save(AuthorizationRef auth=NULL, AuthorizationFlags flags=kAuthorizationFlagDefaults);␊ |
38 | ␉bool isValid() const { return _proplistRef!=NULL;}␊ |
39 | ␉␊ |
40 | ␉const char * getStringForKey(const char *key);␊ |
41 | ␉bool setStringForKey(const char* key, const char* value);␊ |
42 | ␉const char * bootConfigPath() const {␊ |
43 | ␉␉return _propFilePath.c_str();␊ |
44 | ␉}␊ |
45 | ␉␊ |
46 | private:␊ |
47 | ␉CFPropertyListRef _proplistRef;␊ |
48 | ␉CFURLRef _CFURLRef;␊ |
49 | ␉std::string _propFilePath; // keep a track of the proplist filename␊ |
50 | };␊ |
51 | ␊ |
52 |