Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/Sources/property_list.h

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 */
18bool 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 */
28class PropertyList
29{
30
31public:
32PropertyList() : _proplistRef(0), _CFURLRef(0) {}
33virtual ~PropertyList();
34
35bool open(const char *propListPath, CFStringRef* errString,
36 AuthorizationRef auth=NULL, AuthorizationFlags flags=kAuthorizationFlagDefaults);
37bool save(AuthorizationRef auth=NULL, AuthorizationFlags flags=kAuthorizationFlagDefaults);
38bool isValid() const { return _proplistRef!=NULL;}
39
40const char * getStringForKey(const char *key);
41bool setStringForKey(const char* key, const char* value);
42const char * bootConfigPath() const {
43return _propFilePath.c_str();
44}
45
46private:
47CFPropertyListRef _proplistRef;
48CFURLRef _CFURLRef;
49std::string _propFilePath; // keep a track of the proplist filename
50};
51
52

Archive Download this file

Revision: 14