Chameleon Applications

Chameleon Applications Commit Details

Date:2011-12-04 18:17:49 (12 years 4 months ago)
Author:Rekursor
Commit:431
Parents: 430
Message:Fixed Kernel flag engine would not reognize mutating flags
Changes:
M/trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj
M/trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.mm
M/trunk/ChameleonPrefPane/Sources/KernOptionsParser.cpp
M/trunk/ChameleonPrefPane/Sources/string_util.h

File differences

trunk/ChameleonPrefPane/Sources/string_util.h
7979
8080
8181
82
83
84
85
86
87
88
89
90
91
92
8293
8394
8495
return trim_left( trim_right( src , substr) , substr );
}
/**
* trim the space chars (or any substring) on the left of a string
*/
inline std::string string_left( const std::string& source, const std::string& substr = " ")
{
std::string str = source;
std::string::size_type pos = source.find_first_of(substr);
return pos!=std::string::npos ? str.erase(source.find_first_of(substr) ) : str;
}
inline char HexToDec(char nibble) { nibble = toupper(nibble); return (nibble < 'A') ? nibble - '0' : nibble - 'A' +10;}
#endif
trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.mm
292292
293293
294294
295
295
296296
297297
298298
{
std::string contentValue = trim(
[ [(NSTextField*) bod->contentID stringValue] UTF8String ]);
kernelFlags.removeFlag(kernelFlags.stringFromKey(bod->Name));
kernelFlags.removeFlag(bod->Name);
if(val && contentValue.length()>0)
{
std::string concat = trim(name);
trunk/ChameleonPrefPane/Sources/KernOptionsParser.cpp
5959
6060
6161
62
62
63
64
65
66
6367
64
68
69
70
6571
6672
6773
6874
6975
7076
71
72
77
78
79
80
81
82
83
7384
7485
7586
// remove a flag in the string
void KernOptionsParser::removeFlag(const std::string& flag)
{
std::string::size_type found = _options.find(flag);
if (flag.length()==0) return; // not a flag, bye
std::string::size_type pos, l = _options.length();
if (l==0) return; // empty options nothing to do
std::string f = string_left(flag, "=");
std::string::size_type found = _options.find(f);
if (found==std::string::npos) return;
_options.erase(found, found+flag.length());
// find the end of the flag
for ( pos=found+flag.length(); pos<l && _options[pos]!=' '; pos++);
_options.erase(found, pos);
_options = trim(_options);
}
// remove a flag in the string
void KernOptionsParser::addFlag(const std::string& flag)
{
std::string::size_type found = _options.find(flag);
if (found!=std::string::npos) return;
// finding a flag can be tricky as some have a variable part of the form:
// flag=value and what we want is to keep identify them while they will varyĆ 
std::string key= string_left(flag,"=");
std::string::size_type found = _options.find(key);
if (found!=std::string::npos)
removeFlag(key);
_options = " " + _options;
_options = flag + _options;
_options = trim(_options);
trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj
875875
876876
877877
878
878879
879880
881
880882
881883
882884
GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_PROFILING_CODE = YES;
INSTALL_PATH = "~/Library/PreferencePanes";
ONLY_ACTIVE_ARCH = YES;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx10.6;
VALID_ARCHS = "i386 x86_64";
};

Archive Download the corresponding diff file

Revision: 431