forked from phonegap/phonegap
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/sintaxi/phonegap
- Loading branch information
Showing
33 changed files
with
1,408 additions
and
5,614 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.DS_Store | ||
.*.sw? | ||
tmp/ | ||
*.xcodeproj/* !*.xcodeproj/project.pbxproj | ||
lib/iphone/phonegap-min.js | ||
lib/iphone/phonegap.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Categories.h | ||
// PhoneGap | ||
// | ||
// Created by Shazron Abdullah on 26/05/09. | ||
// Copyright 2009 Nitobi Software. All rights reserved. | ||
// | ||
|
||
|
||
@interface NSMutableDictionary(NSDictionary_Extension) | ||
|
||
- (bool) existsValue:(NSString*)expectedValue forKey:(NSString*)key; | ||
- (NSUInteger) integerValueForKey:(NSString*)key defaultValue:(NSUInteger)defaultValue withRange:(NSRange)range; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Categories.m | ||
// PhoneGap | ||
// | ||
// Created by Shazron Abdullah on 26/05/09. | ||
// Copyright 2009 Nitobi Software. All rights reserved. | ||
// | ||
|
||
#import "Categories.h" | ||
#import <math.h> | ||
|
||
@implementation NSMutableDictionary(NSDictionary_Extension) | ||
|
||
- (bool) existsValue:(NSString*)expectedValue forKey:(NSString*)key | ||
{ | ||
id val = [self valueForKey:key]; | ||
bool exists = false; | ||
if (val != nil) { | ||
exists = [(NSString*)val compare:expectedValue options:NSCaseInsensitiveSearch] == 0; | ||
} | ||
|
||
return exists; | ||
} | ||
|
||
- (NSUInteger) integerValueForKey:(NSString*)key defaultValue:(NSUInteger)defaultValue withRange:(NSRange)range | ||
{ | ||
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; | ||
[numberFormatter setRoundingMode:NSNumberFormatterRoundCeiling]; | ||
|
||
NSUInteger value = defaultValue; | ||
|
||
id val = [self valueForKey:key]; | ||
if (val != nil) { | ||
NSNumber* number = [numberFormatter numberFromString:(NSString*)val]; | ||
value = [number unsignedIntValue]; | ||
} | ||
|
||
[numberFormatter release]; | ||
|
||
// min, max checks | ||
value = MAX(range.location, value); | ||
value = MIN(range.length, value); | ||
|
||
return value; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.