1 | /*␊ |
2 | * KernOptionsParser.h␊ |
3 | * ChameleonPrefPane␊ |
4 | *␊ |
5 | * Created by Rekursor on 1/23/10.␊ |
6 | */␊ |
7 | #include <string>␊ |
8 | #include <list>␊ |
9 | #include "string_util.h"␊ |
10 | ␊ |
11 | class KernOptionsParser␊ |
12 | {␊ |
13 | public:␊ |
14 | ␉KernOptionsParser() {}␊ |
15 | ␉␊ |
16 | ␉// extract from the string all kern options␊ |
17 | ␉bool parseOptions(const char* options);␊ |
18 | ␉␊ |
19 | ␉// get the corresponding kern option "xxxx=yyyy"␊ |
20 | ␉const std::string& stringFromKey(const std::string& key) const;␊ |
21 | ␉␊ |
22 | ␉// get the left member of kern option "xxxx=yyyy"␊ |
23 | ␉inline std::string leftMember(const std::string& expression) const␊ |
24 | {␊ |
25 | return string_left(expression, "=");␊ |
26 | }␊ |
27 | ␉␊ |
28 | ␉// get the right member of kern option "xxxx=yyyy"␊ |
29 | ␉inline std::string rightMember(const std::string& expression) const␊ |
30 | {␊ |
31 | return string_right(expression, "=");␊ |
32 | }␊ |
33 | ␉␊ |
34 | ␉// add / remove a kernel Flags in the string␊ |
35 | ␉void addFlag(const std::string& flag);␊ |
36 | ␉void removeFlag(const std::string& flag);␊ |
37 | ␉␊ |
38 | ␉const std::string& options() const { return _options;}␊ |
39 | ␉␊ |
40 | private:␊ |
41 | ␉bool _status;␊ |
42 | ␉std::string _options;␊ |
43 | ␉std::list<std::string> _optionsList;␊ |
44 | }; |