@@ -55,114 +55,87 @@ - (void)of_getCategory: (OFString **)category andKey: (OFString **)key forPath: (OFString *)path OF_DIRECT { size_t pos = [path rangeOfString: @"." - options: OF_STRING_SEARCH_BACKWARDS].location; + options: OFStringSearchBackwards].location; - if (pos == OF_NOT_FOUND) { + if (pos == OFNotFound) { *category = @""; *key = path; return; } *category = [path substringToIndex: pos]; *key = [path substringFromIndex: pos + 1]; } -- (void)setString: (OFString *)string - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setString: string - forKey: key]; - - objc_autoreleasePoolPop(pool); -} - -- (void)setInteger: (long long)integer - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setInteger: integer - forKey: key]; - - objc_autoreleasePoolPop(pool); -} - -- (void)setBool: (bool)bool_ - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setBool: bool_ - forKey: key]; - - objc_autoreleasePoolPop(pool); -} - -- (void)setFloat: (float)float_ - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setFloat: float_ - forKey: key]; - - objc_autoreleasePoolPop(pool); -} - -- (void)setDouble: (double)double_ - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setDouble: double_ - forKey: key]; - - objc_autoreleasePoolPop(pool); -} - -- (void)setArray: (OFArray *)array - forPath: (OFString *)path -{ - void *pool = objc_autoreleasePoolPush(); - OFString *category, *key; - - [self of_getCategory: &category - andKey: &key - forPath: path]; - - [[_INIFile categoryForName: category] setArray: array - forKey: key]; +- (void)setString: (OFString *)string forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setString: string forKey: key]; + + objc_autoreleasePoolPop(pool); +} + +- (void)setLongLong: (long long)longLong forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setLongLong: longLong + forKey: key]; + + objc_autoreleasePoolPop(pool); +} + +- (void)setBool: (bool)bool_ forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setBool: bool_ forKey: key]; + + objc_autoreleasePoolPop(pool); +} + +- (void)setFloat: (float)float_ forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setFloat: float_ forKey: key]; + + objc_autoreleasePoolPop(pool); +} + +- (void)setDouble: (double)double_ forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setDouble: double_ forKey: key]; + + objc_autoreleasePoolPop(pool); +} + +- (void)setStringArray: (OFArray OF_GENERIC(OFString *) *)array + forPath: (OFString *)path +{ + void *pool = objc_autoreleasePoolPush(); + OFString *category, *key; + + [self of_getCategory: &category andKey: &key forPath: path]; + [[_INIFile categoryForName: category] setStringArray: array + forKey: key]; objc_autoreleasePoolPop(pool); } - (OFString *)stringForPath: (OFString *)path @@ -169,110 +142,89 @@ defaultValue: (OFString *)defaultValue { void *pool = objc_autoreleasePoolPush(); OFString *category, *key, *ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; ret = [[_INIFile categoryForName: category] stringForKey: key defaultValue: defaultValue]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } -- (long long)integerForPath: (OFString *)path - defaultValue: (long long)defaultValue +- (long long)longLongForPath: (OFString *)path + defaultValue: (long long)defaultValue { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; long long ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; ret = [[_INIFile categoryForName: category] - integerForKey: key - defaultValue: defaultValue]; + longLongForKey: key + defaultValue: defaultValue]; objc_autoreleasePoolPop(pool); return ret; } -- (bool)boolForPath: (OFString *)path - defaultValue: (bool)defaultValue +- (bool)boolForPath: (OFString *)path defaultValue: (bool)defaultValue { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; bool ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; ret = [[_INIFile categoryForName: category] boolForKey: key defaultValue: defaultValue]; objc_autoreleasePoolPop(pool); return ret; } -- (float)floatForPath: (OFString *)path - defaultValue: (float)defaultValue +- (float)floatForPath: (OFString *)path defaultValue: (float)defaultValue { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; float ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; ret = [[_INIFile categoryForName: category] floatForKey: key defaultValue: defaultValue]; objc_autoreleasePoolPop(pool); return ret; } -- (double)doubleForPath: (OFString *)path - defaultValue: (double)defaultValue +- (double)doubleForPath: (OFString *)path defaultValue: (double)defaultValue { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; double ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; ret = [[_INIFile categoryForName: category] doubleForKey: key defaultValue: defaultValue]; objc_autoreleasePoolPop(pool); return ret; } -- (OFArray *)arrayForPath: (OFString *)path +- (OFArray OF_GENERIC(OFString *) *)stringArrayForPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; OFArray *ret; - [self of_getCategory: &category - andKey: &key - forPath: path]; - - ret = [[_INIFile categoryForName: category] arrayForKey: key]; + [self of_getCategory: &category andKey: &key forPath: path]; + ret = [[_INIFile categoryForName: category] stringArrayForKey: key]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @@ -280,14 +232,11 @@ - (void)removeValueForPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFString *category, *key; - [self of_getCategory: &category - andKey: &key - forPath: path]; - + [self of_getCategory: &category andKey: &key forPath: path]; [[_INIFile categoryForName: category] removeValueForKey: key]; objc_autoreleasePoolPop(pool); }