Skip to content

Instantly share code, notes, and snippets.

@yas375
Created May 1, 2016 07:43
Show Gist options
  • Save yas375/6e271111ab382588a0f7b5bba21bbe3b to your computer and use it in GitHub Desktop.
Save yas375/6e271111ab382588a0f7b5bba21bbe3b to your computer and use it in GitHub Desktop.
{"service_job_id":"1","service_name":"travis-ci","source_files":[{"name":"FormatterKit/TTTAddressFormatter.m","source":" | 1|// TTTAddressFormatter.m\n | 2|//\n | 3|// Copyright (c) 2012 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTAddressFormatter.h\"\n | 24|\n | 25|#import <Availability.h>\n | 26|\n | 27|#import <AddressBook/AddressBook.h>\n | 28|\n | 29|#if __IPHONE_OS_VERSION_MIN_REQUIRED\n | 30|#import <AddressBookUI/AddressBookUI.h>\n | 31|\n 0| 32|#define TTTAddressStreetKey ((__bridge NSString *)kABPersonAddressStreetKey)\n 0| 33|#define TTTAddressLocalityKey ((__bridge NSString *)kABPersonAddressCityKey)\n 0| 34|#define TTTAddressRegionKey ((__bridge NSString *)kABPersonAddressStateKey)\n 0| 35|#define TTTAddressPostalCodeKey ((__bridge NSString *)kABPersonAddressZIPKey)\n 0| 36|#define TTTAddressCountryKey ((__bridge NSString *)kABPersonAddressCountryKey)\n 0| 37|#define TTTAddressCountryCodeKey ((__bridge NSString *)kABPersonAddressCountryCodeKey)\n | 38|#elif __MAC_OS_X_VERSION_MIN_REQUIRED\n | 39|#define TTTAddressStreetKey (kABAddressStreetKey)\n | 40|#define TTTAddressLocalityKey (kABAddressCityKey)\n | 41|#define TTTAddressRegionKey (kABAddressStateKey)\n | 42|#define TTTAddressPostalCodeKey (kABAddressZIPKey)\n | 43|#define TTTAddressCountryKey (kABAddressCountryKey)\n | 44|#define TTTAddressCountryCodeKey (kABAddressCountryCodeKey)\n | 45|#endif\n | 46|\n | 47|@implementation TTTAddressFormatter\n | 48|@synthesize locale = _locale;\n | 49|\n 0| 50|- (id)init {\n 0| 51| self = [super init];\n 0| 52| if (!self) {\n 0| 53| return nil;\n 0| 54| }\n 0| 55| \n 0| 56| self.locale = [NSLocale currentLocale];\n 0| 57| \n 0| 58| return self;\n 0| 59|}\n | 60|\n | 61|- (NSString *)stringFromAddressWithStreet:(NSString *)street\n | 62| locality:(NSString *)locality\n | 63| region:(NSString *)region\n | 64| postalCode:(NSString *)postalCode\n | 65| country:(NSString *)country\n 0| 66|{\n 0| 67| NSMutableDictionary *mutableAddressComponents = [NSMutableDictionary dictionary];\n 0| 68| \n 0| 69| if (street) {\n 0| 70| mutableAddressComponents[TTTAddressStreetKey] = street;\n 0| 71| }\n 0| 72| \n 0| 73| if (locality) {\n 0| 74| mutableAddressComponents[TTTAddressLocalityKey] = locality;\n 0| 75| }\n 0| 76| \n 0| 77| if (region) {\n 0| 78| mutableAddressComponents[TTTAddressRegionKey] = region;\n 0| 79| }\n 0| 80| \n 0| 81| if (postalCode) {\n 0| 82| mutableAddressComponents[TTTAddressPostalCodeKey] = postalCode;\n 0| 83| }\n 0| 84| \n 0| 85| if (country) {\n 0| 86| mutableAddressComponents[TTTAddressCountryKey] = country;\n 0| 87| }\n 0| 88| \n 0| 89| NSString *countryCode = [self.locale objectForKey:NSLocaleCountryCode];\n 0| 90| if (countryCode) {\n 0| 91| mutableAddressComponents[TTTAddressCountryCodeKey] = countryCode;\n 0| 92| }\n 0| 93| \n 0| 94| return [self stringForObjectValue:mutableAddressComponents];\n 0| 95|}\n | 96|\n | 97|#pragma mark - NSFormatter\n | 98|\n 0| 99|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 100| if (![anObject isKindOfClass:[NSDictionary class]]) {\n 0| 101| return nil;\n 0| 102| }\n 0| 103|\n 0| 104|#if __IPHONE_OS_VERSION_MIN_REQUIRED\n 0| 105| return ABCreateStringWithAddressDictionary((NSDictionary *)anObject, NO);\n 0| 106|#elif __MAC_OS_X_VERSION_MIN_REQUIRED\n | 107| return [[[ABAddressBook sharedAddressBook] formattedAddressFromDictionary:(NSDictionary *)anObject] string];\n | 108|#else\n | 109| return nil;\n | 110|#endif\n 0| 111|}\n | 112|\n | 113|- (BOOL)getObjectValue:(out __unused __autoreleasing id *)obj\n | 114| forString:(__unused NSString *)string\n | 115| errorDescription:(out NSString *__autoreleasing *)error\n 0| 116|{\n 0| 117| *error = NSLocalizedStringFromTableInBundle(@\"Method Not Implemented\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 118| \n 0| 119| return NO;\n 0| 120|}\n | 121|\n | 122|#pragma mark - NSCopying\n | 123|\n 0| 124|- (id)copyWithZone:(NSZone *)zone {\n 0| 125| TTTAddressFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 126| formatter.locale = [self.locale copyWithZone:zone];\n 0| 127|\n 0| 128| return formatter;\n 0| 129|}\n | 130|\n | 131|#pragma mark - NSCoding\n | 132|\n 0| 133|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 134| self = [super initWithCoder:aDecoder];\n 0| 135| \n 0| 136| self.locale = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(locale))];\n 0| 137| \n 0| 138| return self;\n 0| 139|}\n | 140|\n 0| 141|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 142| [super encodeWithCoder:aCoder];\n 0| 143| \n 0| 144| [aCoder encodeObject:self.locale forKey:NSStringFromSelector(@selector(locale))];\n 0| 145|}\n | 146|\n | 147|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,null,null,null,null,0,null,null,null,null,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,null,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTArrayFormatter.m","source":" | 1|// TTTArrayFormatter.m\n | 2|//\n | 3|// Copyright (c) 2011���2015 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTArrayFormatter.h\"\n | 24|\n | 25|@implementation TTTArrayFormatter\n | 26|@synthesize arrayStyle = _arrayStyle;\n | 27|@synthesize delimiter = _delimiter;\n | 28|@synthesize separator = _separator;\n | 29|@synthesize conjunction = _conjunction;\n | 30|@synthesize abbreviatedConjunction = _abbreviatedConjunction;\n | 31|@synthesize usesAbbreviatedConjunction = _usesAbbreviatedConjunction;\n | 32|@synthesize usesSerialDelimiter = _usesSerialDelimiter;\n | 33|\n 0| 34|- (id)init {\n 0| 35| self = [super init];\n 0| 36| if (!self) {\n 0| 37| return nil;\n 0| 38| }\n 0| 39|\n 0| 40| self.delimiter = NSLocalizedStringFromTableInBundle(@\",\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"List delimiter\");\n 0| 41| self.separator = NSLocalizedStringFromTableInBundle(@\" \", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"List separator\");\n 0| 42| self.conjunction = NSLocalizedStringFromTableInBundle(@\"and\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"List conjunction\");\n 0| 43| self.abbreviatedConjunction = NSLocalizedStringFromTableInBundle(@\"&\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 44| self.usesAbbreviatedConjunction = NO;\n 0| 45| self.usesSerialDelimiter = YES;\n 0| 46|\n 0| 47| return self;\n 0| 48|}\n | 49|\n | 50|+ (NSString *)localizedStringFromArray:(NSArray *)anArray\n | 51| arrayStyle:(TTTArrayFormatterStyle)style\n 0| 52|{\n 0| 53| TTTArrayFormatter *formatter = [[TTTArrayFormatter alloc] init];\n 0| 54| [formatter setArrayStyle:style];\n 0| 55|\n 0| 56| return [formatter stringFromArray:anArray];\n 0| 57|}\n | 58|\n 0| 59|- (NSString *)stringFromArray:(NSArray *)anArray {\n 0| 60| return [self stringFromArray:anArray rangesOfComponents:nil];\n 0| 61|}\n | 62|\n | 63|- (NSString *)stringFromArray:(NSArray *)anArray\n | 64| rangesOfComponents:(NSArray * __autoreleasing *)rangeValues\n 0| 65|{\n 0| 66| NSMutableString *mutableString = [NSMutableString string];\n 0| 67| NSMutableArray *componentRanges = [NSMutableArray arrayWithCapacity:[anArray count]];\n 0| 68| for (NSUInteger idx = 0; idx < [anArray count]; idx++) {\n 0| 69| NSString *component = [anArray[idx] description];\n 0| 70| if (!component) {\n 0| 71| continue;\n 0| 72| }\n 0| 73|\n 0| 74| BOOL isFirstComponent = (idx == 0);\n 0| 75| BOOL isLastComponent = (idx == [anArray count] - 1);\n 0| 76| BOOL isPenultimateComponent = (idx == [anArray count] - 2);\n 0| 77| if (self.conjunction && self.arrayStyle != TTTArrayFormatterDataStyle && (isLastComponent && !isFirstComponent)) {\n 0| 78| [mutableString appendString:self.usesAbbreviatedConjunction ? self.abbreviatedConjunction : self.conjunction];\n 0| 79| [mutableString appendString:self.separator];\n 0| 80| }\n 0| 81|\n 0| 82| NSRange componentRange = NSMakeRange([mutableString length], [component length]);\n 0| 83| [componentRanges addObject:[NSValue valueWithRange:componentRange]];\n 0| 84|\n 0| 85| [mutableString appendString:component];\n 0| 86|\n 0| 87| if (self.arrayStyle == TTTArrayFormatterDataStyle) {\n 0| 88| if (!isLastComponent) {\n 0| 89| [mutableString appendString:self.delimiter];\n 0| 90| [mutableString appendString:self.separator];\n 0| 91| }\n 0| 92| } else if (self.delimiter && [anArray count] > 2 && !isLastComponent) {\n 0| 93| if (isPenultimateComponent && !self.usesSerialDelimiter) {\n 0| 94| [mutableString appendString:self.separator];\n 0| 95| } else {\n 0| 96| [mutableString appendString:self.delimiter];\n 0| 97| [mutableString appendString:self.separator];\n 0| 98| }\n 0| 99| } else if ([anArray count] == 2 && !isLastComponent) {\n 0| 100| [mutableString appendString:self.separator];\n 0| 101| }\n 0| 102| }\n 0| 103|\n 0| 104| if (rangeValues) {\n 0| 105| *rangeValues = [NSArray arrayWithArray:componentRanges];\n 0| 106| }\n 0| 107|\n 0| 108| return [NSString stringWithString:mutableString];\n 0| 109|}\n | 110|\n 0| 111|- (NSArray *)arrayFromString:(NSString *)aString {\n 0| 112| NSArray *array = nil;\n 0| 113| [self getObjectValue:&array forString:aString errorDescription:nil];\n 0| 114|\n 0| 115| return array;\n 0| 116|}\n | 117|\n | 118|#pragma mark - NSFormatter\n | 119|\n 0| 120|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 121| if (![anObject isKindOfClass:[NSArray class]]) {\n 0| 122| return nil;\n 0| 123| }\n 0| 124|\n 0| 125| return [self stringFromArray:(NSArray *)anObject rangesOfComponents:nil];\n 0| 126|}\n | 127|\n | 128|- (BOOL)getObjectValue:(out __autoreleasing id *)obj\n | 129| forString:(NSString *)string\n | 130| errorDescription:(out NSString *__autoreleasing *)error\n 0| 131|{\n 0| 132| BOOL returnValue = NO;\n 0| 133| NSMutableArray *components = nil;\n 0| 134|\n 0| 135| if (string) {\n 0| 136| components = [[string componentsSeparatedByString:self.delimiter] mutableCopy];\n 0| 137| NSMutableString *lastComponent = [(NSString *)[components lastObject] mutableCopy];\n 0| 138| NSRange lastComponentConjunctionRange = [lastComponent rangeOfString:self.conjunction];\n 0| 139| if (lastComponentConjunctionRange.location != NSNotFound) {\n 0| 140| [lastComponent replaceCharactersInRange:lastComponentConjunctionRange withString:self.delimiter];\n 0| 141| [components removeLastObject];\n 0| 142| [components addObjectsFromArray:[lastComponent componentsSeparatedByString:self.delimiter]];\n 0| 143| }\n 0| 144|\n 0| 145| if (components) {\n 0| 146| *obj = [NSArray arrayWithArray:components];\n 0| 147| } else {\n 0| 148| if (error) {\n 0| 149| *error = NSLocalizedStringFromTableInBundle(@\"Couldn���t convert to NSArray\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Error converting to NSArray\");\n 0| 150| }\n 0| 151| }\n 0| 152| }\n 0| 153|\n 0| 154| return returnValue;\n 0| 155|}\n | 156|\n | 157|#pragma mark - NSCopying\n | 158|\n 0| 159|- (id)copyWithZone:(NSZone *)zone {\n 0| 160| TTTArrayFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 161|\n 0| 162| formatter.arrayStyle = self.arrayStyle;\n 0| 163| formatter.delimiter = [self.delimiter copyWithZone:zone];\n 0| 164| formatter.separator = [self.separator copyWithZone:zone];\n 0| 165| formatter.conjunction = [self.conjunction copyWithZone:zone];\n 0| 166| formatter.abbreviatedConjunction = [self.abbreviatedConjunction copyWithZone:zone];\n 0| 167| formatter.usesAbbreviatedConjunction = self.usesAbbreviatedConjunction;\n 0| 168| formatter.usesSerialDelimiter = self.usesSerialDelimiter;\n 0| 169|\n 0| 170| return formatter;\n 0| 171|}\n | 172|\n | 173|#pragma mark - NSCoding\n | 174|\n 0| 175|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 176| self = [super initWithCoder:aDecoder];\n 0| 177|\n 0| 178| self.arrayStyle = (TTTArrayFormatterStyle)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(arrayStyle))];\n 0| 179| self.delimiter = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(delimiter))];\n 0| 180| self.separator = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(separator))];\n 0| 181| self.conjunction = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(conjunction))];\n 0| 182| self.abbreviatedConjunction = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(abbreviatedConjunction))];\n 0| 183| self.usesAbbreviatedConjunction = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesAbbreviatedConjunction))];\n 0| 184| self.usesSerialDelimiter = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesSerialDelimiter))];\n 0| 185|\n 0| 186| return self;\n 0| 187|}\n | 188|\n 0| 189|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 190| [super encodeWithCoder:aCoder];\n 0| 191|\n 0| 192| [aCoder encodeInteger:self.arrayStyle forKey:NSStringFromSelector(@selector(arrayStyle))];\n 0| 193| [aCoder encodeObject:self.delimiter forKey:NSStringFromSelector(@selector(delimiter))];\n 0| 194| [aCoder encodeObject:self.separator forKey:NSStringFromSelector(@selector(separator))];\n 0| 195| [aCoder encodeObject:self.conjunction forKey:NSStringFromSelector(@selector(conjunction))];\n 0| 196| [aCoder encodeObject:self.abbreviatedConjunction forKey:NSStringFromSelector(@selector(abbreviatedConjunction))];\n 0| 197| [aCoder encodeBool:self.usesAbbreviatedConjunction forKey:NSStringFromSelector(@selector(usesAbbreviatedConjunction))];\n 0| 198| [aCoder encodeBool:self.usesSerialDelimiter forKey:NSStringFromSelector(@selector(usesSerialDelimiter))];\n 0| 199|}\n | 200|\n | 201|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTColorFormatter.m","source":" | 1|// TTTColorFormatter.m\n | 2|// \n | 3|// Copyright (c) 2013 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|// \n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|// \n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTColorFormatter.h\"\n | 24|\n | 25|#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED\n | 26|\n | 27|#import <tgmath.h>\n | 28|\n 0| 29|static void TTTGetRGBAComponentsFromColor(UIColor *color, CGFloat *red, CGFloat *green, CGFloat *blue, CGFloat *alpha) {\n 0| 30| [color getRed:red green:green blue:blue alpha:alpha];\n 0| 31|}\n | 32|\n 0| 33|static void TTTGetCMYKComponentsFromColor(UIColor *color, CGFloat *cyan, CGFloat *magenta, CGFloat *yellow, CGFloat *black) {\n 0| 34| CGFloat r = 0.0f, g = 0.0f, b = 0.0f;\n 0| 35| TTTGetRGBAComponentsFromColor(color, &r, &g, &b, NULL);\n 0| 36|\n 0| 37| CGFloat k = 1.0f - fmax(fmax(r, g), b);\n 0| 38| CGFloat dK = 1.0f - k;\n 0| 39|\n 0| 40| CGFloat c = (1.0f - (r + k)) / dK;\n 0| 41| CGFloat m = (1.0f - (g + k)) / dK;\n 0| 42| CGFloat y = (1.0f - (b + k)) / dK;\n 0| 43|\n 0| 44| if (cyan) *cyan = c;\n 0| 45| if (magenta) *magenta = m;\n 0| 46| if (yellow) *yellow = y;\n 0| 47| if (black) *black = k;\n 0| 48|}\n | 49|\n 0| 50|static void TTTGetHSLComponentsFromColor(UIColor *color, CGFloat *hue, CGFloat *saturation, CGFloat *lightness) {\n 0| 51| CGFloat r = 0.0f, g = 0.0f, b = 0.0f;\n 0| 52| TTTGetRGBAComponentsFromColor(color, &r, &g, &b, NULL);\n 0| 53|\n 0| 54| CGFloat h = 0.0f, s = 0.0f, l = 0.0f;\n 0| 55|\n 0| 56| CGFloat v = fmax(fmax(r, g), b);\n 0| 57| CGFloat m = fmin(fmin(r, g), b);\n 0| 58| l = (m + v) / 2.0f;\n 0| 59|\n 0| 60| CGFloat vm = v - m;\n 0| 61|\n 0| 62| if (l > 0.0f && vm > 0.0f) {\n 0| 63| s = vm / ((l <= 0.5f) ? (v + m) : (2.0f - v - m));\n 0| 64|\n 0| 65| CGFloat r2 = (v - r) / vm;\n 0| 66| CGFloat g2 = (v - g) / vm;\n 0| 67| CGFloat b2 = (v - b) / vm;\n 0| 68|\n 0| 69| if (r == v) {\n 0| 70| h = (g == m ? 5.0f + b2 : 1.0f - g2);\n 0| 71| } else if (g == v) {\n 0| 72| h = (b == m ? 1.0f + r2 : 3.0f - b2);\n 0| 73| } else {\n 0| 74| h = (r == m ? 3.0f + g2 : 5.0f - r2);\n 0| 75| }\n 0| 76|\n 0| 77| h /= 6.0f;\n 0| 78| }\n 0| 79|\n 0| 80| if (hue) *hue = h;\n 0| 81| if (saturation) *saturation = s;\n 0| 82| if (lightness) *lightness = l;\n 0| 83|}\n | 84|\n | 85|#pragma mark -\n | 86|\n | 87|@implementation TTTColorFormatter\n | 88|\n 0| 89|- (NSString *)hexadecimalStringFromColor:(UIColor *)color {\n 0| 90| CGFloat r = 0.0f, g = 0.0f, b = 0.0f;\n 0| 91| TTTGetRGBAComponentsFromColor(color, &r, &g, &b, NULL);\n 0| 92|\n 0| 93| return [NSString stringWithFormat:@\"#%02lX%02lX%02lX\", (unsigned long)round(r * 0xFF), (unsigned long)round(g * 0xFF), (unsigned long)round(b * 0xFF)];\n 0| 94|}\n | 95|\n 0| 96|- (UIColor *)colorFromHexadecimalString:(NSString *)string {\n 0| 97| NSScanner *scanner = [NSScanner scannerWithString:string];\n 0| 98| scanner.charactersToBeSkipped = [[NSCharacterSet alphanumericCharacterSet] invertedSet];\n 0| 99|\n 0| 100| unsigned value;\n 0| 101| [scanner scanHexInt:&value];\n 0| 102|\n 0| 103| CGFloat r = ((value & 0xFF0000) >> 16) / 255.0f;\n 0| 104| CGFloat g = ((value & 0xFF00) >> 8) / 255.0f;\n 0| 105| CGFloat b = ((value & 0xFF)) / 255.0f;\n 0| 106|\n 0| 107| return [UIColor colorWithRed:r green:g blue:b alpha:1.0];\n 0| 108|}\n | 109|\n | 110|#pragma mark -\n | 111|\n 0| 112|- (NSString *)RGBStringFromColor:(UIColor *)color {\n 0| 113| CGFloat r = 0.0f, g = 0.0f, b = 0.0f;\n 0| 114| TTTGetRGBAComponentsFromColor(color, &r, &g, &b, NULL);\n 0| 115|\n 0| 116| return [NSString stringWithFormat:@\"rgb(%lu, %lu, %lu)\", (unsigned long)round(r * 0xFF), (unsigned long)round(g * 0xFF), (unsigned long)round(b * 0xFF)];\n 0| 117|}\n | 118|\n 0| 119|- (UIColor *)colorFromRGBString:(NSString *)string {\n 0| 120| return [self colorFromRGBAString:string];\n 0| 121|}\n | 122|\n | 123|#pragma mark -\n | 124|\n 0| 125|- (NSString *)RGBAStringFromColor:(UIColor *)color {\n 0| 126| CGFloat r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f;\n 0| 127| TTTGetRGBAComponentsFromColor(color, &r, &g, &b, &a);\n 0| 128|\n 0| 129| return [NSString stringWithFormat:@\"rgb(%lu, %lu, %lu, %g)\", (unsigned long)round(r * 0xFF), (unsigned long)round(g * 0xFF), (unsigned long)round(b * 0xFF), a];\n 0| 130|\n 0| 131|}\n | 132|\n 0| 133|- (UIColor *)colorFromRGBAString:(NSString *)string {\n 0| 134| NSScanner *scanner = [NSScanner scannerWithString:string];\n 0| 135| scanner.charactersToBeSkipped = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];\n 0| 136|\n 0| 137| NSInteger r, g, b; float a;\n 0| 138| [scanner scanInteger:&r];\n 0| 139| [scanner scanInteger:&g];\n 0| 140| [scanner scanInteger:&b];\n 0| 141|\n 0| 142| if ([scanner scanFloat:&a]) {\n 0| 143| return [UIColor colorWithRed:(r / 255.0f) green:(g / 255.0f) blue:(b / 255.0f) alpha:a];\n 0| 144| } else {\n 0| 145| return [UIColor colorWithRed:(r / 255.0f) green:(g / 255.0f) blue:(b / 255.0f) alpha:1.0];\n 0| 146| }\n 0| 147|\n 0| 148|}\n | 149|\n | 150|#pragma mark -\n | 151|\n 0| 152|- (NSString *)CMYKStringFromColor:(UIColor *)color {\n 0| 153| CGFloat c = 0.0f, m = 0.0f, y = 0.0f, k = 0.0f;\n 0| 154| TTTGetCMYKComponentsFromColor(color, &c, &m, &y, &k);\n 0| 155|\n 0| 156| return [NSString stringWithFormat:@\"cmyk(%g%%, %g%%, %g%%, %g%%)\", c * 100.0f, m * 100.0f, y * 100.0f, k * 100.0f];\n 0| 157|}\n | 158|\n 0| 159|- (UIColor *)colorFromCMYKString:(NSString *)string {\n 0| 160| NSScanner *scanner = [NSScanner scannerWithString:string];\n 0| 161| scanner.charactersToBeSkipped = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];\n 0| 162| \n 0| 163| float c, m, y, k;\n 0| 164| \n 0| 165| [scanner scanFloat:&c];\n 0| 166| [scanner scanFloat:&m];\n 0| 167| [scanner scanFloat:&y];\n 0| 168| [scanner scanFloat:&k];\n 0| 169| \n 0| 170| c *= 0.01f;\n 0| 171| m *= 0.01f;\n 0| 172| y *= 0.01f;\n 0| 173| k *= 0.01f;\n 0| 174| \n 0| 175| CGFloat dk = 1.0f - k;\n 0| 176| \n 0| 177| return [UIColor colorWithRed:(1.0f - c) * dk green:(1.0f - m) * dk blue:(1.0f - y) * dk alpha:1.0f];\n 0| 178|}\n | 179|\n | 180|#pragma mark -\n | 181|\n 0| 182|- (NSString *)HSLStringFromColor:(UIColor *)color {\n 0| 183| CGFloat h = 0.0f, s = 0.0f, l = 0.0f;\n 0| 184| TTTGetHSLComponentsFromColor(color, &h, &s, &l);\n 0| 185|\n 0| 186| return [NSString stringWithFormat:@\"hsl(%0.0lu, %g%%, %g%%)\", (unsigned long)round(h * 0xFF), s * 100.0f, l * 100.0f];\n 0| 187|}\n | 188|\n 0| 189|- (UIColor *)colorFromHSLString:(NSString *)string {\n 0| 190| NSScanner *scanner = [NSScanner scannerWithString:string];\n 0| 191| scanner.charactersToBeSkipped = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];\n 0| 192|\n 0| 193| NSInteger h, s, l;\n 0| 194| [scanner scanInteger:&h];\n 0| 195| [scanner scanInteger:&s];\n 0| 196| [scanner scanInteger:&l];\n 0| 197|\n 0| 198| return [UIColor colorWithHue:(h / 359.0f) saturation:(s / 100.0f) brightness:(l / 100.0f) alpha:1.0f];\n 0| 199|}\n | 200|\n | 201|#pragma mark -\n | 202|\n 0| 203|- (NSString *)UIColorDeclarationFromColor:(UIColor *)color {\n 0| 204| CGFloat r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f;\n 0| 205| [color getRed:&r green:&g blue:&b alpha:&a];\n 0| 206|\n 0| 207| return [NSString stringWithFormat:@\"[UIColor colorWithRed:%g green:%g blue:%g alpha:%g]\", r, g, b, a];\n 0| 208|}\n | 209|\n | 210|#pragma mark - NSFormatter\n | 211|\n 0| 212|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 213| if (![anObject isKindOfClass:[UIColor class]]) {\n 0| 214| return nil;\n 0| 215| }\n 0| 216|\n 0| 217| return [self hexadecimalStringFromColor:(UIColor *)anObject];\n 0| 218|}\n | 219|\n | 220|- (BOOL)getObjectValue:(out __autoreleasing id *)obj\n | 221| forString:(NSString *)string\n | 222| errorDescription:(out NSString *__autoreleasing *)error\n 0| 223|{\n 0| 224| UIColor *color = nil;\n 0| 225| if ([string hasPrefix:@\"#\"]) {\n 0| 226| color = [self colorFromHexadecimalString:string];\n 0| 227| } else if ([string hasPrefix:@\"rgb(\"]) {\n 0| 228| color = [self colorFromRGBString:string];\n 0| 229| } else if ([string hasPrefix:@\"rgba(\"]) {\n 0| 230| color = [self colorFromRGBAString:string];\n 0| 231| } else if ([string hasPrefix:@\"cmyk(\"]) {\n 0| 232| color = [self colorFromCMYKString:string];\n 0| 233| } else if ([string hasPrefix:@\"hsl(\"]) {\n 0| 234| color = [self colorFromHSLString:string];\n 0| 235| }\n 0| 236|\n 0| 237| if (color) {\n 0| 238| *obj = color;\n 0| 239|\n 0| 240| return YES;\n 0| 241| }\n 0| 242|\n 0| 243| *error = NSLocalizedStringFromTableInBundle(@\"Color format not recognized\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 244|\n 0| 245| return NO;\n 0| 246|}\n | 247|\n | 248|@end\n | 249|\n | 250|#endif","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,0,0,0,null,null,null,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null]},{"name":"FormatterKit/TTTLocationFormatter.m","source":" | 1|// TTTLocationFormatter.m\n | 2|//\n | 3|// Copyright (c) 2011���2015 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTLocationFormatter.h\"\n | 24|\n | 25|static double const kTTTMetersToKilometersCoefficient = 0.001;\n | 26|static double const kTTTMetersToFeetCoefficient = 3.2808399;\n | 27|static double const kTTTMetersToYardsCoefficient = 1.0936133;\n | 28|static double const kTTTMetersToMilesCoefficient = 0.000621371192;\n | 29|\n 0| 30|static inline double CLLocationDistanceToKilometers(CLLocationDistance distance) {\n 0| 31| return distance * kTTTMetersToKilometersCoefficient;\n 0| 32|}\n | 33|\n 0| 34|static inline double CLLocationDistanceToFeet(CLLocationDistance distance) {\n 0| 35| return distance * kTTTMetersToFeetCoefficient;\n 0| 36|}\n | 37|\n 0| 38|static inline double CLLocationDistanceToYards(CLLocationDistance distance) {\n 0| 39| return distance * kTTTMetersToYardsCoefficient;\n 0| 40|}\n | 41|\n 0| 42|static inline double CLLocationDistanceToMiles(CLLocationDistance distance) {\n 0| 43| return distance * kTTTMetersToMilesCoefficient;\n 0| 44|}\n | 45|\n | 46|#pragma mark -\n | 47|\n 0| 48|static inline double DEG2RAD(double degrees) {\n 0| 49| return degrees * M_PI / 180;\n 0| 50|}\n | 51|\n 0| 52|static inline double RAD2DEG(double radians) {\n 0| 53| return radians * 180 / M_PI;\n 0| 54|}\n | 55|\n 0| 56|static inline void TTTGetDegreesMinutesSecondsFromCoordinateDegrees(CLLocationDegrees degrees, double *d, double *m, double *s) {\n 0| 57| double r;\n 0| 58|\n 0| 59| *d = trunc(degrees);\n 0| 60| r = fabs(degrees - *d);\n 0| 61|\n 0| 62| *m = 60.0 * r;\n 0| 63| r = *m - floor(*m);\n 0| 64|\n 0| 65| *s = 60.0 * r;\n 0| 66|}\n | 67|\n 0| 68|static inline void TTTGetCardinalDirectionsFromCoordinate(CLLocationCoordinate2D coordinate, TTTLocationCardinalDirection *latitudeDirection, TTTLocationCardinalDirection *longitudeDirection) {\n 0| 69| *latitudeDirection = coordinate.latitude >= 0.0 ? TTTNorthDirection : TTTSouthDirection;\n 0| 70| *longitudeDirection = coordinate.longitude >= 0.0 ? TTTEastDirection : TTTWestDirection;\n 0| 71|}\n | 72|\n 0| 73|static inline CLLocationDegrees CLLocationDegreesBearingBetweenCoordinates(CLLocationCoordinate2D originCoordinate, CLLocationCoordinate2D destinationCoordinate) {\n 0| 74| double lat1 = DEG2RAD(originCoordinate.latitude);\n 0| 75|\tdouble lon1 = DEG2RAD(originCoordinate.longitude);\n 0| 76|\tdouble lat2 = DEG2RAD(destinationCoordinate.latitude);\n 0| 77|\tdouble lon2 = DEG2RAD(destinationCoordinate.longitude);\n 0| 78|\n 0| 79| double dLon = lon2 - lon1;\n 0| 80|\tdouble y = sin(dLon) * cos(lat2);\n 0| 81|\tdouble x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon);\n 0| 82|\tdouble bearing = atan2(y, x) + (2 * M_PI);\n 0| 83|\n 0| 84| // `atan2` works on a range of -�� to 0 to ��, so add on 2�� and perform a modulo check\n 0| 85|\tif (bearing > (2 * M_PI)) {\n 0| 86|\t\tbearing = bearing - (2 * M_PI);\n 0| 87|\t}\n 0| 88|\n 0| 89|\treturn RAD2DEG(bearing);\n 0| 90|}\n | 91|\n 0| 92|TTTLocationCardinalDirection TTTLocationCardinalDirectionFromBearing(CLLocationDegrees bearing) {\n 0| 93| if(bearing > 337.5) {\n 0| 94| return TTTNorthDirection;\n 0| 95| } else if(bearing > 292.5) {\n 0| 96| return TTTNorthwestDirection;\n 0| 97| } else if(bearing > 247.5) {\n 0| 98| return TTTWestDirection;\n 0| 99| } else if(bearing > 202.5) {\n 0| 100| return TTTSouthwestDirection;\n 0| 101| } else if(bearing > 157.5) {\n 0| 102| return TTTSouthDirection;\n 0| 103| } else if(bearing > 112.5) {\n 0| 104| return TTTSoutheastDirection;\n 0| 105| } else if(bearing > 67.5) {\n 0| 106| return TTTEastDirection;\n 0| 107| } else if(bearing > 22.5) {\n 0| 108| return TTTNortheastDirection;\n 0| 109| } else {\n 0| 110| return TTTNorthDirection;\n 0| 111| }\n 0| 112|}\n | 113|\n | 114|#pragma mark -\n | 115|\n | 116|static double const kTTTMetersPerSecondToKilometersPerHourCoefficient = 3.6;\n | 117|static double const kTTTMetersPerSecondToFeetPerSecondCoefficient = 3.2808399;\n | 118|static double const kTTTMetersPerSecondToMilesPerHourCoefficient = 2.23693629;\n | 119|\n 0| 120|static inline double CLLocationSpeedToKilometersPerHour(CLLocationSpeed speed) {\n 0| 121| return speed * kTTTMetersPerSecondToKilometersPerHourCoefficient;\n 0| 122|}\n | 123|\n 0| 124|static inline double CLLocationSpeedToFeetPerSecond(CLLocationSpeed speed) {\n 0| 125| return speed * kTTTMetersPerSecondToFeetPerSecondCoefficient;\n 0| 126|}\n | 127|\n 0| 128|static inline double CLLocationSpeedToMilesPerHour(CLLocationSpeed speed) {\n 0| 129| return speed * kTTTMetersPerSecondToMilesPerHourCoefficient;\n 0| 130|}\n | 131|\n | 132|#pragma mark -\n | 133|\n 0| 134|static NSString * TTTLocalizedStringForCardinalDirection(TTTLocationCardinalDirection direction) {\n 0| 135| switch (direction) {\n 0| 136| case TTTNorthDirection:\n 0| 137| return NSLocalizedStringFromTableInBundle(@\"North\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"North Direction\");\n 0| 138| case TTTNortheastDirection:\n 0| 139| return NSLocalizedStringFromTableInBundle(@\"Northeast\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Northeast Direction\");\n 0| 140| case TTTEastDirection:\n 0| 141| return NSLocalizedStringFromTableInBundle(@\"East\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"East Direction\");\n 0| 142| case TTTSoutheastDirection:\n 0| 143| return NSLocalizedStringFromTableInBundle(@\"Southeast\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Southeast Direction\");\n 0| 144| case TTTSouthDirection:\n 0| 145| return NSLocalizedStringFromTableInBundle(@\"South\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"South Direction\");\n 0| 146| case TTTSouthwestDirection:\n 0| 147| return NSLocalizedStringFromTableInBundle(@\"Southwest\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Southwest Direction\");\n 0| 148| case TTTWestDirection:\n 0| 149| return NSLocalizedStringFromTableInBundle(@\"West\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"West Direction\");\n 0| 150| case TTTNorthwestDirection:\n 0| 151| return NSLocalizedStringFromTableInBundle(@\"Northwest\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Northwest Direction\");\n 0| 152| default:\n 0| 153| return nil;\n 0| 154| }\n 0| 155|}\n | 156|\n 0| 157|static NSString * TTTLocalizedStringForAbbreviatedCardinalDirection(TTTLocationCardinalDirection direction) {\n 0| 158| switch (direction) {\n 0| 159| case TTTNorthDirection:\n 0| 160| return NSLocalizedStringFromTableInBundle(@\"N\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"North Direction Abbreviation\");\n 0| 161| case TTTNortheastDirection:\n 0| 162| return NSLocalizedStringFromTableInBundle(@\"NE\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Northeast Direction Abbreviation\");\n 0| 163| case TTTEastDirection:\n 0| 164| return NSLocalizedStringFromTableInBundle(@\"E\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"East Direction Abbreviation\");\n 0| 165| case TTTSoutheastDirection:\n 0| 166| return NSLocalizedStringFromTableInBundle(@\"SE\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Southeast Direction Abbreviation\");\n 0| 167| case TTTSouthDirection:\n 0| 168| return NSLocalizedStringFromTableInBundle(@\"S\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"South Direction Abbreviation\");\n 0| 169| case TTTSouthwestDirection:\n 0| 170| return NSLocalizedStringFromTableInBundle(@\"SW\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Southwest Direction Abbreviation\");\n 0| 171| case TTTWestDirection:\n 0| 172| return NSLocalizedStringFromTableInBundle(@\"W\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"West Direction Abbreviation\");\n 0| 173| case TTTNorthwestDirection:\n 0| 174| return NSLocalizedStringFromTableInBundle(@\"NW\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTLocationFormatter class]], @\"Northwest Direction Abbreviation\");\n 0| 175| default:\n 0| 176| return nil;\n 0| 177| }\n 0| 178|}\n | 179|\n | 180|@interface TTTLocationFormatter ()\n | 181|@property (readwrite, nonatomic, strong) NSNumberFormatter *numberFormatter;\n | 182|@end\n | 183|\n | 184|@implementation TTTLocationFormatter\n | 185|@synthesize numberFormatter = _numberFormatter;\n | 186|@synthesize coordinateOrder = _coordinateOrder;\n | 187|@synthesize coordinateStyle = _coordinateStyle;\n | 188|@synthesize bearingStyle = _bearingStyle;\n | 189|@synthesize unitSystem = _unitSystem;\n | 190|\n 0| 191|- (id)init {\n 0| 192| self = [super init];\n 0| 193| if (!self) {\n 0| 194| return nil;\n 0| 195| }\n 0| 196|\n 0| 197| self.coordinateOrder = TTTCoordinateLatLngOrder;\n 0| 198| self.bearingStyle = TTTBearingWordStyle;\n 0| 199|\n 0| 200| BOOL usesMetricSystem = [[(NSLocale *)[NSLocale currentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue];\n 0| 201| self.unitSystem = usesMetricSystem ? TTTMetricSystem : TTTImperialSystem;\n 0| 202|\n 0| 203| _numberFormatter = [[NSNumberFormatter alloc] init];\n 0| 204| [_numberFormatter setLocale:[NSLocale currentLocale]];\n 0| 205| [_numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];\n 0| 206| [_numberFormatter setMaximumSignificantDigits:2];\n 0| 207| [_numberFormatter setUsesSignificantDigits:YES];\n 0| 208|\n 0| 209| return self;\n 0| 210|}\n | 211|\n | 212|#pragma mark -\n | 213|\n 0| 214|- (NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate {\n 0| 215| NSString *latitudeString = nil;\n 0| 216| NSString *longitudeString = nil;\n 0| 217|\n 0| 218| switch (self.coordinateStyle) {\n 0| 219| case TTTSignedDegreesFormat:\n 0| 220| latitudeString = [self.numberFormatter stringFromNumber:@(coordinate.latitude)];\n 0| 221| longitudeString = [self.numberFormatter stringFromNumber:@(coordinate.longitude)];\n 0| 222| break;\n 0| 223| case TTTDegreesFormat: {\n 0| 224| static NSString * TTTDegreesFormatString = @\"%@�� %@\";\n 0| 225| TTTLocationCardinalDirection latitudeDirection, longitudeDirection;\n 0| 226| TTTGetCardinalDirectionsFromCoordinate(coordinate, &latitudeDirection, &longitudeDirection);\n 0| 227| latitudeString = [NSString stringWithFormat:TTTDegreesFormatString, [self.numberFormatter stringFromNumber:@(fabs(coordinate.latitude))], TTTLocalizedStringForAbbreviatedCardinalDirection(latitudeDirection)];\n 0| 228| longitudeString = [NSString stringWithFormat:TTTDegreesFormatString, [self.numberFormatter stringFromNumber:@(fabs(coordinate.longitude))], TTTLocalizedStringForAbbreviatedCardinalDirection(longitudeDirection)];\n 0| 229| break;\n 0| 230| }\n 0| 231| case TTTDegreesMinutesSecondsFormat: {\n 0| 232| static NSString * TTTDegreesMinutesSecondsFormatString = @\"%d�� %d��� %@��� %@\";\n 0| 233| double degrees, minutes, seconds;\n 0| 234| TTTLocationCardinalDirection latitudeDirection, longitudeDirection;\n 0| 235| TTTGetCardinalDirectionsFromCoordinate(coordinate, &latitudeDirection, &longitudeDirection);\n 0| 236|\n 0| 237| TTTGetDegreesMinutesSecondsFromCoordinateDegrees(coordinate.latitude, &degrees, &minutes, &seconds);\n 0| 238| latitudeString = [NSString stringWithFormat:TTTDegreesMinutesSecondsFormatString, (NSInteger)degrees, (NSInteger)minutes, [self.numberFormatter stringFromNumber:@(seconds)], TTTLocalizedStringForAbbreviatedCardinalDirection(latitudeDirection)];\n 0| 239|\n 0| 240| TTTGetDegreesMinutesSecondsFromCoordinateDegrees(coordinate.longitude, &degrees, &minutes, &seconds);\n 0| 241| longitudeString = [NSString stringWithFormat:TTTDegreesMinutesSecondsFormatString, (NSInteger)degrees, (NSInteger)minutes, [self.numberFormatter stringFromNumber:@(seconds)], TTTLocalizedStringForAbbreviatedCardinalDirection(longitudeDirection)];\n 0| 242| break;\n 0| 243| }\n 0| 244| default:\n 0| 245| break;\n 0| 246| }\n 0| 247|\n 0| 248| switch (self.coordinateOrder) {\n 0| 249| case TTTCoordinateLatLngOrder:\n 0| 250| return [NSString stringWithFormat:@\"%@, %@\", latitudeString, longitudeString];\n 0| 251| break;\n 0| 252| case TTTCoordinateLngLatOrder:\n 0| 253| return [NSString stringWithFormat:@\"%@, %@\", longitudeString, latitudeString];\n 0| 254| default:\n 0| 255| return nil;;\n 0| 256| }\n 0| 257|}\n | 258|\n 0| 259|- (NSString *)stringFromLocation:(CLLocation *)location {\n 0| 260| return [self stringFromCoordinate:location.coordinate];\n 0| 261|}\n | 262|\n 0| 263|- (NSString *)stringFromDistance:(CLLocationDistance)distance {\n 0| 264| NSString *distanceString = nil;\n 0| 265| NSString *unitString = nil;\n 0| 266|\n 0| 267| switch (self.unitSystem) {\n 0| 268| case TTTMetricSystem: {\n 0| 269| double meterDistance = distance;\n 0| 270| double kilometerDistance = CLLocationDistanceToKilometers(distance);\n 0| 271|\n 0| 272| if (kilometerDistance >= 1) {\n 0| 273| distanceString = [_numberFormatter stringFromNumber:@(kilometerDistance)];\n 0| 274| unitString = NSLocalizedStringFromTableInBundle(@\"km\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Kilometer Unit\");\n 0| 275| } else {\n 0| 276| distanceString = [_numberFormatter stringFromNumber:@(meterDistance)];\n 0| 277| unitString = NSLocalizedStringFromTableInBundle(@\"m\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Meter Unit\");\n 0| 278| }\n 0| 279| break;\n 0| 280| }\n 0| 281|\n 0| 282| case TTTImperialSystem: {\n 0| 283| double feetDistance = CLLocationDistanceToFeet(distance);\n 0| 284| double yardDistance = CLLocationDistanceToYards(distance);\n 0| 285| double milesDistance = CLLocationDistanceToMiles(distance);\n 0| 286|\n 0| 287| if (feetDistance < 300) {\n 0| 288| distanceString = [_numberFormatter stringFromNumber:@(feetDistance)];\n 0| 289| unitString = NSLocalizedStringFromTableInBundle(@\"ft\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Feet Unit\");\n 0| 290| } else if (yardDistance < 500) {\n 0| 291| distanceString = [_numberFormatter stringFromNumber:@(yardDistance)];\n 0| 292| unitString = NSLocalizedStringFromTableInBundle(@\"yds\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Yard Unit\");\n 0| 293| } else {\n 0| 294| distanceString = [_numberFormatter stringFromNumber:@(milesDistance)];\n 0| 295| unitString = (milesDistance > 1.0 && milesDistance < 1.1) ? NSLocalizedStringFromTableInBundle(@\"mile\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Mile Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"miles\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Mile Unit (Plural)\");\n 0| 296| }\n 0| 297| break;\n 0| 298| }\n 0| 299| }\n 0| 300|\n 0| 301| return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@\"Distance Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"#{Distance} #{Unit}\"), distanceString, unitString];\n 0| 302|}\n | 303|\n 0| 304|- (NSString *)stringFromBearing:(CLLocationDegrees)bearing {\n 0| 305| switch (self.bearingStyle) {\n 0| 306| case TTTBearingWordStyle:\n 0| 307| return TTTLocalizedStringForCardinalDirection(TTTLocationCardinalDirectionFromBearing(bearing));\n 0| 308| case TTTBearingAbbreviationWordStyle:\n 0| 309| return TTTLocalizedStringForAbbreviatedCardinalDirection(TTTLocationCardinalDirectionFromBearing(bearing));\n 0| 310| case TTTBearingNumericStyle:\n 0| 311| return [self.numberFormatter stringFromNumber:@(bearing)];\n 0| 312| }\n 0| 313|\n 0| 314| return nil;\n 0| 315|}\n | 316|\n 0| 317|- (NSString *)stringFromSpeed:(CLLocationSpeed)speed {\n 0| 318| NSString *speedString = nil;\n 0| 319| NSString *unitString = nil;\n 0| 320|\n 0| 321| switch (self.unitSystem) {\n 0| 322| case TTTMetricSystem: {\n 0| 323| double metersPerSecondSpeed = speed;\n 0| 324| double kilometersPerHourSpeed = CLLocationSpeedToKilometersPerHour(speed);\n 0| 325|\n 0| 326| if (kilometersPerHourSpeed > 1) {\n 0| 327| speedString = [self.numberFormatter stringFromNumber:@(kilometersPerHourSpeed)];\n 0| 328| unitString = NSLocalizedStringFromTableInBundle(@\"km/h\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Kilometers Per Hour Unit\");\n 0| 329| } else {\n 0| 330| speedString = [self.numberFormatter stringFromNumber:@(metersPerSecondSpeed)];\n 0| 331| unitString = NSLocalizedStringFromTableInBundle(@\"m/s\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Meters Per Second Unit\");\n 0| 332| }\n 0| 333| break;\n 0| 334| }\n 0| 335|\n 0| 336| case TTTImperialSystem: {\n 0| 337| double feetPerSecondSpeed = CLLocationSpeedToFeetPerSecond(speed);\n 0| 338| double milesPerHourSpeed = CLLocationSpeedToMilesPerHour(speed);\n 0| 339|\n 0| 340| if (milesPerHourSpeed > 1) {\n 0| 341| speedString = [self.numberFormatter stringFromNumber:@(milesPerHourSpeed)];\n 0| 342| unitString = NSLocalizedStringFromTableInBundle(@\"mph\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Miles Per Hour Unit\");\n 0| 343| } else {\n 0| 344| speedString = [self.numberFormatter stringFromNumber:@(feetPerSecondSpeed)];\n 0| 345| unitString = NSLocalizedStringFromTableInBundle(@\"ft/s\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Feet Per Second Unit\");\n 0| 346| }\n 0| 347| break;\n 0| 348| }\n 0| 349| }\n 0| 350|\n 0| 351| return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@\"Speed Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"#{Speed} #{Unit}\"), speedString, unitString];\n 0| 352|}\n | 353|\n | 354|- (NSString *)stringFromDistanceFromLocation:(CLLocation *)originLocation\n | 355| toLocation:(CLLocation *)destinationLocation\n 0| 356|{\n 0| 357| return [self stringFromDistance:[destinationLocation distanceFromLocation:originLocation]];\n 0| 358|}\n | 359|\n | 360|- (NSString *)stringFromBearingFromLocation:(CLLocation *)originLocation\n | 361| toLocation:(CLLocation *)destinationLocation\n 0| 362|{\n 0| 363| return [self stringFromBearing:CLLocationDegreesBearingBetweenCoordinates(originLocation.coordinate, destinationLocation.coordinate)];\n 0| 364|}\n | 365|\n | 366|- (NSString *)stringFromDistanceAndBearingFromLocation:(CLLocation *)originLocation\n | 367| toLocation:(CLLocation *)destinationLocation\n 0| 368|{\n 0| 369| return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@\"Dimension Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"#{Dimensional Quantity} #{Direction}\"), [self stringFromDistanceFromLocation:originLocation toLocation:destinationLocation], [self stringFromBearingFromLocation:originLocation toLocation:destinationLocation]];\n 0| 370|}\n | 371|\n | 372|- (NSString *)stringFromVelocityFromLocation:(CLLocation *)originLocation\n | 373| toLocation:(CLLocation *)destinationLocation\n | 374| atSpeed:(CLLocationSpeed)speed\n 0| 375|{\n 0| 376| return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@\"Dimension Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"#{Dimensional Quantity} #{Direction}\"), [self stringFromSpeed:speed], [self stringFromBearingFromLocation:originLocation toLocation:destinationLocation]];\n 0| 377|}\n | 378|\n | 379|#pragma mark - NSFormatter\n | 380|\n 0| 381|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 382| if (![anObject isKindOfClass:[CLLocation class]]) {\n 0| 383| return nil;\n 0| 384| }\n 0| 385|\n 0| 386| return [self stringFromLocation:(CLLocation *)anObject];\n 0| 387|}\n | 388|\n | 389|- (BOOL)getObjectValue:(out __unused __autoreleasing id *)obj\n | 390| forString:(__unused NSString *)string\n | 391| errorDescription:(out NSString *__autoreleasing *)error\n 0| 392|{\n 0| 393| *error = NSLocalizedStringFromTableInBundle(@\"Method Not Implemented\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 394|\n 0| 395| return NO;\n 0| 396|}\n | 397|\n | 398|#pragma mark - NSCopying\n | 399|\n 0| 400|- (id)copyWithZone:(NSZone *)zone {\n 0| 401| TTTLocationFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 402|\n 0| 403| formatter.numberFormatter = [self.numberFormatter copyWithZone:zone];\n 0| 404| formatter.coordinateOrder = self.coordinateOrder;\n 0| 405| formatter.bearingStyle = self.bearingStyle;\n 0| 406| formatter.unitSystem = self.unitSystem;\n 0| 407|\n 0| 408| return formatter;\n 0| 409|}\n | 410|\n | 411|#pragma mark - NSCoding\n | 412|\n 0| 413|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 414| self = [super initWithCoder:aDecoder];\n 0| 415|\n 0| 416| self.numberFormatter = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(numberFormatter))];\n 0| 417| self.coordinateOrder = (TTTLocationFormatterCoordinateOrder)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(coordinateOrder))];\n 0| 418| self.bearingStyle = (TTTLocationFormatterBearingStyle)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(bearingStyle))];\n 0| 419| self.unitSystem = (TTTLocationUnitSystem)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(unitSystem))];\n 0| 420|\n 0| 421| return self;\n 0| 422|}\n | 423|\n 0| 424|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 425| [super encodeWithCoder:aCoder];\n 0| 426|\n 0| 427| [aCoder encodeObject:self.numberFormatter forKey:NSStringFromSelector(@selector(numberFormatter))];\n 0| 428| [aCoder encodeInteger:self.coordinateOrder forKey:NSStringFromSelector(@selector(coordinateOrder))];\n 0| 429| [aCoder encodeInteger:self.bearingStyle forKey:NSStringFromSelector(@selector(bearingStyle))];\n 0| 430| [aCoder encodeInteger:self.unitSystem forKey:NSStringFromSelector(@selector(unitSystem))];\n 0| 431|}\n | 432|\n | 433|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,null,0,0,0,null,0,0,0,null,0,0,0,null,null,null,0,0,0,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,0,0,0,null,0,0,0,null,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,null,null,null,0,0,0,null,null,null,0,0,0,null,null,null,null,0,0,0,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTNameFormatter.m","source":" | 1|// TTTNameFormatter.m\n | 2|// \n | 3|// Copyright (c) 2014 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|// \n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|// \n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTNameFormatter.h\"\n | 24|\n | 25|#if !defined(__MAC_OS_X_VERSION_MAX_ALLOWED)\n | 26|\n | 27|#import <AddressBook/AddressBook.h>\n | 28|\n | 29|@implementation TTTNameFormatter\n | 30|\n | 31|- (NSString *)stringFromFirstName:(NSString *)firstName\n | 32| lastName:(NSString *)lastName\n 0| 33|{\n 0| 34| return [self stringFromPrefix:nil firstName:firstName middleName:nil lastName:lastName suffix:nil];\n 0| 35|}\n | 36|\n | 37|- (NSString *)stringFromPrefix:(NSString *)prefix\n | 38| firstName:(NSString *)firstName\n | 39| middleName:(NSString *)middleName\n | 40| lastName:(NSString *)lastName\n | 41| suffix:(NSString *)suffix\n 0| 42|{\n 0| 43| ABRecordRef record = ABPersonCreate();\n 0| 44| ABRecordSetValue(record, kABPersonPrefixProperty, (__bridge CFStringRef)prefix, NULL);\n 0| 45| ABRecordSetValue(record, kABPersonFirstNameProperty, (__bridge CFStringRef)firstName, NULL);\n 0| 46| ABRecordSetValue(record, kABPersonMiddleNameProperty, (__bridge CFStringRef)middleName, NULL);\n 0| 47| ABRecordSetValue(record, kABPersonLastNameProperty, (__bridge CFStringRef)lastName, NULL);\n 0| 48| ABRecordSetValue(record, kABPersonSuffixProperty, (__bridge CFStringRef)suffix, NULL);\n 0| 49|\n 0| 50| NSString *name = (__bridge_transfer NSString *)ABRecordCopyCompositeName(record);\n 0| 51| CFRelease(record);\n 0| 52|\n 0| 53| return name;\n 0| 54|}\n | 55|\n | 56|@end\n | 57|\n | 58|#endif","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null]},{"name":"FormatterKit/TTTOrdinalNumberFormatter.m","source":" | 1|// TTTOrdinalNumberFormatter.m\n | 2|//\n | 3|// Copyright (c) 2011���2015 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTOrdinalNumberFormatter.h\"\n | 24|\n | 25|static NSString * const kTTTOrdinalNumberFormatterDefaultOrdinalIndicator = @\".\";\n | 26|\n | 27|@implementation TTTOrdinalNumberFormatter\n | 28|@synthesize ordinalIndicator = _ordinalIndicator;\n | 29|@synthesize grammaticalGender = _grammaticalGender;\n | 30|@synthesize grammaticalNumber = _grammaticalNumber;\n | 31|\n 0| 32|- (id)init {\n 0| 33| self = [super init];\n 0| 34| if (!self) {\n 0| 35| return nil;\n 0| 36| }\n 0| 37|\n 0| 38| [self setNumberStyle:NSNumberFormatterNoStyle];\n 0| 39| [self setAllowsFloats:NO];\n 0| 40| [self setGeneratesDecimalNumbers:NO];\n 0| 41| [self setRoundingMode:NSNumberFormatterRoundFloor];\n 0| 42| [self setMinimum:@(0)];\n 0| 43| [self setLenient:YES];\n 0| 44|\n 0| 45| return self;\n 0| 46|}\n | 47|\n | 48|#pragma mark -\n | 49|\n 0| 50|- (NSString *)localizedOrdinalIndicatorStringFromNumber:(NSNumber *)number {\n 0| 51| NSString *languageCode = [[self locale] objectForKey:NSLocaleLanguageCode];\n 0| 52| if ([languageCode isEqualToString:@\"en\"]) {\n 0| 53| return [self enOrdinalIndicatorStringFromNumber:number];\n 0| 54| } else if ([languageCode isEqualToString:@\"fr\"]) {\n 0| 55| return [self frOrdinalIndicatorStringFromNumber:number];\n 0| 56| } else if ([languageCode isEqualToString:@\"nl\"]) {\n 0| 57| return [self nlOrdinalIndicatorStringFromNumber:number];\n 0| 58| } else if ([languageCode isEqualToString:@\"it\"]) {\n 0| 59| return [self itOrdinalIndicatorStringFromNumber:number];\n 0| 60| } else if ([languageCode isEqualToString:@\"pt\"]) {\n 0| 61| return [self ptOrdinalIndicatorStringFromNumber:number];\n 0| 62| } else if ([languageCode isEqualToString:@\"es\"]) {\n 0| 63| return [self esOrdinalIndicatorStringFromNumber:number];\n 0| 64| } else if ([languageCode isEqualToString:@\"ga\"]) {\n 0| 65| return [self gaOrdinalIndicatorStringFromNumber:number];\n 0| 66| } else if ([languageCode isEqualToString:@\"ja\"]) {\n 0| 67| return [self jaOrdinalIndicatorStringFromNumber:number];\n 0| 68| } else if ([languageCode isEqualToString:@\"zh\"]) {\n 0| 69| return [self zhHansOrdinalIndicatorStringFromNumber:number];\n 0| 70| } else if ([languageCode isEqualToString:@\"ca\"]) {\n 0| 71| return [self caOrdinalIndicatorStringFromNumber:number];\n 0| 72| } else if ([languageCode isEqualToString:@\"sv\"]) {\n 0| 73| return [self svOrdinalIndicatorStringFromNumber:number];\n 0| 74| } else {\n 0| 75| return kTTTOrdinalNumberFormatterDefaultOrdinalIndicator;\n 0| 76| }\n 0| 77|}\n | 78|\n 0| 79|- (NSString *)caOrdinalIndicatorStringFromNumber:(NSNumber *)number {\n 0| 80| if (self.grammaticalNumber == TTTOrdinalNumberFormatterPlural) {\n 0| 81| if (self.grammaticalGender == TTTOrdinalNumberFormatterFemaleGender) {\n 0| 82| return @\"es\";\n 0| 83| } else {\n 0| 84| switch ([number integerValue]) {\n 0| 85| case 1:\n 0| 86| return @\"rs\";\n 0| 87| case 2:\n 0| 88| return @\"ns\";\n 0| 89| case 3:\n 0| 90| return @\"rs\";\n 0| 91| case 4:\n 0| 92| return @\"ts\";\n 0| 93| default:\n 0| 94| return @\"ns\";\n 0| 95| }\n 0| 96| }\n 0| 97| } else {\n 0| 98| if (self.grammaticalGender == TTTOrdinalNumberFormatterFemaleGender) {\n 0| 99| return @\"a\";\n 0| 100| } else {\n 0| 101| switch ([number integerValue]) {\n 0| 102| case 1:\n 0| 103| return @\"r\";\n 0| 104| case 2:\n 0| 105| return @\"n\";\n 0| 106| case 3:\n 0| 107| return @\"r\";\n 0| 108| case 4:\n 0| 109| return @\"t\";\n 0| 110| default:\n 0| 111| return @\"��\";\n 0| 112| }\n 0| 113| }\n 0| 114| }\n 0| 115|}\n | 116|\n 0| 117|- (NSString *)enOrdinalIndicatorStringFromNumber:(NSNumber *)number {\n 0| 118| // If number % 100 is 11, 12, or 13\n 0| 119| if (NSLocationInRange([number integerValue] % 100, NSMakeRange(11, 3))) {\n 0| 120| return @\"th\";\n 0| 121| }\n 0| 122|\n 0| 123| switch ([number integerValue] % 10) {\n 0| 124| case 1:\n 0| 125| return @\"st\";\n 0| 126| case 2:\n 0| 127| return @\"nd\";\n 0| 128| case 3:\n 0| 129| return @\"rd\";\n 0| 130| default:\n 0| 131| return @\"th\";\n 0| 132| }\n 0| 133|}\n | 134|\n 0| 135|- (NSString *)esOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 136| switch (self.grammaticalGender) {\n 0| 137| case TTTOrdinalNumberFormatterFemaleGender:\n 0| 138| return @\"\\u00AA\"; // FEMININE ORDINAL INDICATOR\n 0| 139| default:\n 0| 140| return @\"\\u00BA\"; // MASCULINE ORDINAL INDICATOR\n 0| 141| }\n 0| 142|}\n | 143|\n 0| 144|- (NSString *)frOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 145| NSString *ordinalIndicator = nil;\n 0| 146| if ([number integerValue] == 1) {\n 0| 147| switch (self.grammaticalGender) {\n 0| 148| case TTTOrdinalNumberFormatterMaleGender:\n 0| 149| ordinalIndicator = @\"er\";\n 0| 150| break;\n 0| 151| case TTTOrdinalNumberFormatterFemaleGender:\n 0| 152| ordinalIndicator = @\"re\";\n 0| 153| break;\n 0| 154| default:\n 0| 155| ordinalIndicator = @\"er\";\n 0| 156| break;\n 0| 157| }\n 0| 158| } else {\n 0| 159| ordinalIndicator = @\"e\";\n 0| 160| }\n 0| 161|\n 0| 162| switch (self.grammaticalNumber) {\n 0| 163| case TTTOrdinalNumberFormatterDual:\n 0| 164| case TTTOrdinalNumberFormatterTrial:\n 0| 165| case TTTOrdinalNumberFormatterQuadral:\n 0| 166| case TTTOrdinalNumberFormatterPlural:\n 0| 167| ordinalIndicator = [ordinalIndicator stringByAppendingString:@\"s\"];\n 0| 168| break;\n 0| 169| default:\n 0| 170| break;\n 0| 171| }\n 0| 172|\n 0| 173| return ordinalIndicator;\n 0| 174|}\n | 175|\n 0| 176|- (NSString *)gaOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 177| return @\"\\u00FA\"; // LATIN SMALL LETTER U WITH ACUTE\n 0| 178|}\n | 179|\n 0| 180|- (NSString *)itOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 181| switch (self.grammaticalGender) {\n 0| 182| case TTTOrdinalNumberFormatterMaleGender:\n 0| 183| return @\"\\u00BA\"; // MASCULINE ORDINAL INDICATOR\n 0| 184| case TTTOrdinalNumberFormatterFemaleGender:\n 0| 185| return @\"\\u00AA\"; // FEMININE ORDINAL INDICATOR\n 0| 186| default:\n 0| 187| return kTTTOrdinalNumberFormatterDefaultOrdinalIndicator;\n 0| 188| }\n 0| 189|}\n | 190|\n 0| 191|- (NSString *)jaOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 192| return @\"\\u756A\"; // Unicode Han Character 'to take turns; a turn, a time; to repeat'\n 0| 193|}\n | 194|\n 0| 195|- (NSString *)nlOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 196| return @\"e\";\n 0| 197|}\n | 198|\n 0| 199|- (NSString *)ptOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 200| switch (self.grammaticalGender) {\n 0| 201| case TTTOrdinalNumberFormatterMaleGender:\n 0| 202| return @\"\\u00BA\"; // MASCULINE ORDINAL INDICATOR\n 0| 203| case TTTOrdinalNumberFormatterFemaleGender:\n 0| 204| return @\"\\u00AA\"; // FEMININE ORDINAL INDICATOR\n 0| 205| default:\n 0| 206| return kTTTOrdinalNumberFormatterDefaultOrdinalIndicator;\n 0| 207| }\n 0| 208|}\n | 209|\n 0| 210|- (NSString *)zhHansOrdinalIndicatorStringFromNumber:(__unused NSNumber *)number {\n 0| 211| return @\"\\u7B2C\"; // Unicode Han Character 'sequence, number; grade, degree'\n 0| 212|}\n | 213|\n 0| 214|- (NSString *)svOrdinalIndicatorStringFromNumber:(NSNumber *)number {\n 0| 215| // If number % 100 is 11 or 12, ordinals are 11:e and 12:e.\n 0| 216| if (NSLocationInRange([number integerValue] % 100, NSMakeRange(11, 2))) {\n 0| 217| return @\":e\";\n 0| 218| }\n 0| 219| \n 0| 220| // 1:a, 2:a, 3:e, 4:e and so on. Also, 21:a, 22:a, 23:e ...\n 0| 221| switch ([number integerValue] % 10) {\n 0| 222| case 1:\n 0| 223| return @\":a\";\n 0| 224| case 2:\n 0| 225| return @\":a\";\n 0| 226| default:\n 0| 227| return @\":e\";\n 0| 228| }\n 0| 229|}\n | 230|\n | 231|#pragma mark - NSFormatter\n | 232|\n 0| 233|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 234| if (![anObject isKindOfClass:[NSNumber class]]) {\n 0| 235| return nil;\n 0| 236| }\n 0| 237|\n 0| 238| NSString *indicator = self.ordinalIndicator;\n 0| 239| if (!indicator) {\n 0| 240| indicator = [self localizedOrdinalIndicatorStringFromNumber:(NSNumber *)anObject];\n 0| 241| }\n 0| 242|\n 0| 243| NSString *string = nil;\n 0| 244| @synchronized(self) {\n 0| 245| [self setPositivePrefix:nil];\n 0| 246| [self setPositiveSuffix:nil];\n 0| 247|\n 0| 248| NSString *languageCode = [[self locale] objectForKey:NSLocaleLanguageCode];\n 0| 249| if ([languageCode hasPrefix:@\"zh\"]) {\n 0| 250| [self setPositivePrefix:indicator];\n 0| 251| } else {\n 0| 252| [self setPositiveSuffix:indicator];\n 0| 253| }\n 0| 254|\n 0| 255| string = [super stringForObjectValue:anObject];\n 0| 256| }\n 0| 257|\n 0| 258| return string;\n 0| 259|}\n | 260|\n | 261|- (BOOL)getObjectValue:(out __autoreleasing id *)obj\n | 262| forString:(NSString *)string\n | 263| errorDescription:(out NSString *__autoreleasing *)error\n 0| 264|{\n 0| 265| NSInteger integer = NSNotFound;\n 0| 266| NSScanner *scanner = [NSScanner scannerWithString:string];\n 0| 267| [scanner scanInteger:&integer];\n 0| 268|\n 0| 269| if (integer != NSNotFound) {\n 0| 270| *obj = @(integer);\n 0| 271|\n 0| 272| return YES;\n 0| 273| }\n 0| 274|\n 0| 275| *error = NSLocalizedStringFromTableInBundle(@\"String did not contain a valid ordinal number\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 276|\n 0| 277| return NO;\n 0| 278|}\n | 279|\n | 280|#pragma mark - NSCopying\n | 281|\n 0| 282|- (id)copyWithZone:(NSZone *)zone {\n 0| 283| TTTOrdinalNumberFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 284|\n 0| 285| formatter.ordinalIndicator = [self.ordinalIndicator copyWithZone:zone];\n 0| 286| formatter.grammaticalGender = self.grammaticalGender;\n 0| 287| formatter.grammaticalNumber = self.grammaticalNumber;\n 0| 288|\n 0| 289| return formatter;\n 0| 290|}\n | 291|\n | 292|#pragma mark - NSCoding\n | 293|\n 0| 294|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 295| self = [super initWithCoder:aDecoder];\n 0| 296|\n 0| 297| self.ordinalIndicator = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(ordinalIndicator))];\n 0| 298| self.grammaticalGender = (TTTOrdinalNumberFormatterPredicateGrammaticalGender)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(grammaticalGender))];\n 0| 299| self.grammaticalNumber = (TTTOrdinalNumberFormatterPredicateGrammaticalNumber)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(grammaticalNumber))];\n 0| 300|\n 0| 301| return self;\n 0| 302|}\n | 303|\n 0| 304|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 305| [super encodeWithCoder:aCoder];\n 0| 306|\n 0| 307| [aCoder encodeObject:self.ordinalIndicator forKey:NSStringFromSelector(@selector(ordinalIndicator))];\n 0| 308| [aCoder encodeInteger:self.grammaticalGender forKey:NSStringFromSelector(@selector(grammaticalGender))];\n 0| 309| [aCoder encodeInteger:self.grammaticalNumber forKey:NSStringFromSelector(@selector(grammaticalNumber))];\n 0| 310|}\n | 311|\n | 312|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,null,0,0,0,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTTimeIntervalFormatter.m","source":" | 1|// TTTTimeIntervalFormatter.m\n | 2|//\n | 3|// Copyright (c) 2011���2015 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTTimeIntervalFormatter.h\"\n | 24|\n | 25|#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)\n 994| 26| #define TTTCalendarUnitYear NSCalendarUnitYear\n 645| 27| #define TTTCalendarUnitMonth NSCalendarUnitMonth\n 8.89k| 28| #define TTTCalendarUnitWeek NSCalendarUnitWeekOfYear\n 815| 29| #define TTTCalendarUnitDay NSCalendarUnitDay\n 897| 30| #define TTTCalendarUnitHour NSCalendarUnitHour\n 985| 31| #define TTTCalendarUnitMinute NSCalendarUnitMinute\n 2.06k| 32| #define TTTCalendarUnitSecond NSCalendarUnitSecond\n 0| 33| #define TTTDateComponentUndefined NSDateComponentUndefined\n | 34|#else\n | 35| #define TTTCalendarUnitYear NSYearCalendarUnit\n | 36| #define TTTCalendarUnitMonth NSMonthCalendarUnit\n | 37| #define TTTCalendarUnitWeek NSWeekOfYearCalendarUnit\n | 38| #define TTTCalendarUnitDay NSDayCalendarUnit\n | 39| #define TTTCalendarUnitHour NSHourCalendarUnit\n | 40| #define TTTCalendarUnitMinute NSMinuteCalendarUnit\n | 41| #define TTTCalendarUnitSecond NSSecondCalendarUnit\n | 42| #define TTTDateComponentUndefined NSUndefinedDateComponent\n | 43|#endif\n | 44|\n 3.85k| 45|static inline NSCalendarUnit NSCalendarUnitFromString(NSString *string) {\n 3.85k| 46| if ([string isEqualToString:@\"year\"]) {\n 550| 47| return TTTCalendarUnitYear;\n 3.30k| 48| } else if ([string isEqualToString:@\"month\"]) {\n 550| 49| return TTTCalendarUnitMonth;\n 2.75k| 50| } else if ([string isEqualToString:@\"weekOfYear\"]) {\n 550| 51| return TTTCalendarUnitWeek;\n 2.20k| 52| } else if ([string isEqualToString:@\"day\"]) {\n 550| 53| return TTTCalendarUnitDay;\n 1.65k| 54| } else if ([string isEqualToString:@\"hour\"]) {\n 550| 55| return TTTCalendarUnitHour;\n 1.10k| 56| } else if ([string isEqualToString:@\"minute\"]) {\n 550| 57| return TTTCalendarUnitMinute;\n 550| 58| } else if ([string isEqualToString:@\"second\"]) {\n 550| 59| return TTTCalendarUnitSecond;\n 550| 60| }\n 3.85k| 61|\n 0| 62| return TTTDateComponentUndefined;\n 3.85k| 63|}\n | 64|\n 3.85k| 65|static inline NSComparisonResult NSCalendarUnitCompareSignificance(NSCalendarUnit a, NSCalendarUnit b) {\n 3.85k| 66| if ((a == TTTCalendarUnitWeek) ^ (b == TTTCalendarUnitWeek)) {\n 550| 67| if (b == TTTCalendarUnitWeek) {\n 550| 68| switch (a) {\n 0| 69| case TTTCalendarUnitYear:\n 0| 70| case TTTCalendarUnitMonth:\n 0| 71| return NSOrderedDescending;\n 550| 72| default:\n 550| 73| return NSOrderedAscending;\n 550| 74| }\n 0| 75| } else {\n 0| 76| switch (b) {\n 0| 77| case TTTCalendarUnitYear:\n 0| 78| case TTTCalendarUnitMonth:\n 0| 79| return NSOrderedAscending;\n 0| 80| default:\n 0| 81| return NSOrderedDescending;\n 0| 82| }\n 0| 83| }\n 3.30k| 84| } else {\n 3.30k| 85| if (a > b) {\n 2.75k| 86| return NSOrderedAscending;\n 550| 87| } else if (a < b) {\n 0| 88| return NSOrderedDescending;\n 550| 89| } else {\n 550| 90| return NSOrderedSame;\n 550| 91| }\n 3.30k| 92| }\n 3.85k| 93|}\n | 94|\n | 95|@implementation TTTTimeIntervalFormatter\n | 96|@synthesize locale = _locale;\n | 97|@synthesize calendar = _calendar;\n | 98|@synthesize pastDeicticExpression = _pastDeicticExpression;\n | 99|@synthesize presentDeicticExpression = _presentDeicticExpression;\n | 100|@synthesize futureDeicticExpression = _futureDeicticExpression;\n | 101|@synthesize deicticExpressionFormat = _deicticExpressionFormat;\n | 102|@synthesize suffixExpressionFormat = _suffixExpressionFormat;\n | 103|@synthesize approximateQualifierFormat = _approximateQualifierFormat;\n | 104|@synthesize presentTimeIntervalMargin = _presentTimeIntervalMargin;\n | 105|@synthesize usesAbbreviatedCalendarUnits = _usesAbbreviatedCalendarUnits;\n | 106|@synthesize usesApproximateQualifier = _usesApproximateQualifier;\n | 107|@synthesize usesIdiomaticDeicticExpressions = _usesIdiomaticDeicticExpressions;\n | 108|@synthesize numberOfSignificantUnits = _numberOfSignificantUnits;\n | 109|@synthesize leastSignificantUnit = _leastSignificantUnit;\n | 110|@synthesize significantUnits = _significantUnits;\n | 111|\n 110| 112|- (id)init {\n 110| 113| self = [super init];\n 110| 114| if (!self) {\n 0| 115| return nil;\n 0| 116| }\n 110| 117|\n 110| 118| self.locale = [NSLocale currentLocale];\n 110| 119| self.calendar = [NSCalendar currentCalendar];\n 110| 120|\n 110| 121| self.pastDeicticExpression = NSLocalizedStringFromTableInBundle(@\"ago\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Past Deictic Expression\");\n 110| 122| self.presentDeicticExpression = NSLocalizedStringFromTableInBundle(@\"just now\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Present Deictic Expression\");\n 110| 123| self.futureDeicticExpression = NSLocalizedStringFromTableInBundle(@\"from now\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Future Deictic Expression\");\n 110| 124|\n 110| 125| self.deicticExpressionFormat = NSLocalizedStringWithDefaultValue(@\"Deictic Expression Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"Deictic Expression Format (#{Time} #{Ago/From Now}\");\n 110| 126| self.approximateQualifierFormat = NSLocalizedStringFromTableInBundle(@\"about %@\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Approximate Qualifier Format\");\n 110| 127| self.suffixExpressionFormat = NSLocalizedStringWithDefaultValue(@\"Suffix Expression Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"Suffix Expression Format (#{Time} #{Unit})\");\n 110| 128|\n 110| 129| self.presentTimeIntervalMargin = 1;\n 110| 130|\n 110| 131| self.significantUnits = TTTCalendarUnitYear | TTTCalendarUnitMonth | TTTCalendarUnitWeek | TTTCalendarUnitDay | TTTCalendarUnitHour | TTTCalendarUnitMinute | TTTCalendarUnitSecond;\n 110| 132| self.numberOfSignificantUnits = 1;\n 110| 133| self.leastSignificantUnit = TTTCalendarUnitSecond;\n 110| 134|\n 110| 135| return self;\n 110| 136|}\n | 137|\n 583| 138|- (NSString *)stringForTimeInterval:(NSTimeInterval)seconds {\n 583| 139| NSDate *date = [NSDate date];\n 583| 140| return [self stringForTimeIntervalFromDate:date toDate:[NSDate dateWithTimeInterval:seconds sinceDate:date]];\n 583| 141|}\n | 142|\n | 143|- (NSString *)stringForTimeIntervalFromDate:(NSDate *)startingDate\n | 144| toDate:(NSDate *)endingDate\n 584| 145|{\n 584| 146| NSTimeInterval seconds = [startingDate timeIntervalSinceDate:endingDate];\n 584| 147| if (fabs(seconds) < self.presentTimeIntervalMargin) {\n 4| 148| return self.presentDeicticExpression;\n 4| 149| }\n 584| 150|\n 580| 151| NSDateComponents *components = [self.calendar components:self.significantUnits fromDate:startingDate toDate:endingDate options:0];\n 580| 152|\n 580| 153| if (self.usesIdiomaticDeicticExpressions) {\n 187| 154| NSString *idiomaticDeicticExpression = [self localizedIdiomaticDeicticExpressionForComponents:components];\n 187| 155| if (idiomaticDeicticExpression) {\n 30| 156| return idiomaticDeicticExpression;\n 30| 157| }\n 187| 158| }\n 580| 159|\n 550| 160| NSString *string = nil;\n 550| 161| BOOL isApproximate = NO;\n 550| 162| NSUInteger numberOfUnits = 0;\n 3.85k| 163| for (NSString *unitName in @[@\"year\", @\"month\", @\"weekOfYear\", @\"day\", @\"hour\", @\"minute\", @\"second\"]) {\n 3.85k| 164| NSCalendarUnit unit = NSCalendarUnitFromString(unitName);\n 3.85k| 165| if ((self.significantUnits & unit) && NSCalendarUnitCompareSignificance(self.leastSignificantUnit, unit) != NSOrderedDescending) {\n 3.85k| 166| NSNumber *number = @(abs((int)[[components valueForKey:unitName] integerValue]));\n 3.85k| 167| if ([number integerValue]) {\n 1.76k| 168| NSString *suffix = [NSString stringWithFormat:self.suffixExpressionFormat, number, [self localizedStringForNumber:[number unsignedIntegerValue] ofCalendarUnit:unit]];\n 1.76k| 169| if (!string) {\n 550| 170| string = suffix;\n 1.21k| 171| } else if (self.numberOfSignificantUnits == 0 || numberOfUnits < self.numberOfSignificantUnits) {\n 0| 172| string = [string stringByAppendingFormat:@\" %@\", suffix];\n 1.21k| 173| } else {\n 1.21k| 174| isApproximate = YES;\n 1.21k| 175| }\n 1.76k| 176|\n 1.76k| 177| numberOfUnits++;\n 1.76k| 178| }\n 3.85k| 179| }\n 3.85k| 180| }\n 550| 181|\n 550| 182| if (string) {\n 550| 183| if (seconds > 0) {\n 358| 184| if ([self.pastDeicticExpression length]) {\n 358| 185| string = [NSString stringWithFormat:self.deicticExpressionFormat, string, self.pastDeicticExpression];\n 358| 186| }\n 192| 187| } else {\n 192| 188| if ([self.futureDeicticExpression length]) {\n 192| 189| string = [NSString stringWithFormat:self.deicticExpressionFormat, string, self.futureDeicticExpression];\n 192| 190| }\n 192| 191| }\n 550| 192|\n 550| 193| if (isApproximate && self.usesApproximateQualifier) {\n 0| 194| string = [NSString stringWithFormat:self.approximateQualifierFormat, string];\n 0| 195| }\n 0| 196| } else {\n 0| 197| string = self.presentDeicticExpression;\n 0| 198| }\n 550| 199|\n 550| 200| return string;\n 580| 201|}\n | 202|\n 1.76k| 203|- (NSString *)localizedStringForNumber:(NSUInteger)number ofCalendarUnit:(NSCalendarUnit)unit {\n 1.76k| 204| BOOL singular = (number == 1);\n 1.76k| 205|\n 1.76k| 206| if (self.usesAbbreviatedCalendarUnits) {\n 0| 207| switch (unit) {\n 0| 208| case TTTCalendarUnitYear:\n 0| 209| return singular ? NSLocalizedStringFromTableInBundle(@\"yr\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Year Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"yrs\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Year Unit (Plural, Abbreviated)\");\n 0| 210| case TTTCalendarUnitMonth:\n 0| 211| return singular ? NSLocalizedStringFromTableInBundle(@\"mo\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Month Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"mos\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Month Unit (Plural, Abbreviated)\");\n 0| 212| case TTTCalendarUnitWeek:\n 0| 213| return singular ? NSLocalizedStringFromTableInBundle(@\"wk\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Week Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"wks\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Week Unit (Plural, Abbreviated)\");\n 0| 214| case TTTCalendarUnitDay:\n 0| 215| return singular ? NSLocalizedStringFromTableInBundle(@\"d\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Day Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"days\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Day Unit (Plural, Abbreviated)\");\n 0| 216| case TTTCalendarUnitHour:\n 0| 217| return singular ? NSLocalizedStringFromTableInBundle(@\"hr\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Hour Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"hrs\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Hour Unit (Plural, Abbreviated)\");\n 0| 218| case TTTCalendarUnitMinute:\n 0| 219| return singular ? NSLocalizedStringFromTableInBundle(@\"min\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Minute Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"mins\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Minute Unit (Plural, Abbreviated)\");\n 0| 220| case TTTCalendarUnitSecond:\n 0| 221| return singular ? NSLocalizedStringFromTableInBundle(@\"s\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Second Unit (Singular, Abbreviated)\") : NSLocalizedStringFromTableInBundle(@\"s\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Second Unit (Plural, Abbreviated)\");\n 0| 222| default:\n 0| 223| return nil;\n 0| 224| }\n 1.76k| 225| } else {\n 1.76k| 226| switch (unit) {\n 4| 227| case TTTCalendarUnitYear:\n 2| 228| return singular ? NSLocalizedStringFromTableInBundle(@\"year\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Year Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"years\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Year Unit (Plural)\");\n 95| 229| case TTTCalendarUnitMonth:\n 93| 230| return singular ? NSLocalizedStringFromTableInBundle(@\"month\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Month Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"months\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Month Unit (Plural)\");\n 98| 231| case TTTCalendarUnitWeek:\n 93| 232| return singular ? NSLocalizedStringFromTableInBundle(@\"week\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Week Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"weeks\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Week Unit (Plural)\");\n 265| 233| case TTTCalendarUnitDay:\n 178| 234| return singular ? NSLocalizedStringFromTableInBundle(@\"day\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Day Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"days\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Day Unit (Plural)\");\n 347| 235| case TTTCalendarUnitHour:\n 343| 236| return singular ? NSLocalizedStringFromTableInBundle(@\"hour\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Hour Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"hours\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Hour Unit (Plural)\");\n 435| 237| case TTTCalendarUnitMinute:\n 344| 238| return singular ? NSLocalizedStringFromTableInBundle(@\"minute\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Minute Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"minutes\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Minute Unit (Plural)\");\n 525| 239| case TTTCalendarUnitSecond:\n 435| 240| return singular ? NSLocalizedStringFromTableInBundle(@\"second\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Second Unit (Singular)\") : NSLocalizedStringFromTableInBundle(@\"seconds\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Second Unit (Plural)\");\n 0| 241| default:\n 0| 242| return nil;\n 1.76k| 243| }\n 1.76k| 244| }\n 1.76k| 245|}\n | 246|\n | 247|#pragma mark -\n | 248|\n 187| 249|- (NSString *)localizedIdiomaticDeicticExpressionForComponents:(NSDateComponents *)components {\n 187| 250| NSString *languageCode = [self.locale objectForKey:NSLocaleLanguageCode];\n 187| 251| if ([languageCode isEqualToString:@\"ca\"]) {\n 6| 252| return [self caRelativeDateStringForComponents:components];\n 181| 253| } else if ([languageCode isEqualToString:@\"cs\"]) {\n 6| 254| return [self csRelativeDateStringForComponents:components];\n 175| 255| } else if ([languageCode isEqualToString:@\"es\"]) {\n 6| 256| return [self esRelativeDateStringForComponents:components];\n 169| 257| } else if ([languageCode isEqualToString:@\"en\"]) {\n 1| 258| return [self enRelativeDateStringForComponents:components];\n 168| 259| } else if ([languageCode isEqualToString:@\"fr\"]) {\n 6| 260| return [self frRelativeDateStringForComponents:components];\n 162| 261| } else if ([languageCode isEqualToString:@\"he\"]) {\n 6| 262| return [self heRelativeDateStringForComponents:components];\n 156| 263| } else if ([languageCode isEqualToString:@\"it\"]) {\n 6| 264| return [self itRelativeDateStringForComponents:components];\n 150| 265| } else if ([languageCode isEqualToString:@\"ja\"]) {\n 6| 266| return [self jaRelativeDateStringForComponents:components];\n 144| 267| } else if ([languageCode isEqualToString:@\"nl\"]) {\n 6| 268| return [self nlRelativeDateStringForComponents:components];\n 138| 269| } else if ([languageCode isEqualToString:@\"pl\"]) {\n 6| 270| return [self plRelativeDateStringForComponents:components];\n 132| 271| } else if ([languageCode isEqualToString:@\"hu\"]) {\n 6| 272| return [self huRelativeDateStringForComponents:components];\n 126| 273| } else if ([languageCode isEqualToString:@\"zh\"]) {\n 18| 274| NSString *languageScript = [self.locale objectForKey:NSLocaleScriptCode];\n 18| 275| if (![languageScript isEqualToString:@\"Hant\"]) {\n 12| 276| return [self zhHansRelativeDateStringForComponents:components];\n 12| 277| }\n 18| 278| }\n 187| 279|\n 114| 280| return nil;\n 187| 281|}\n | 282|\n 6| 283|- (NSString *)caRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 284| if ([components year] == -1) {\n 0| 285| return @\"any passat\";\n 6| 286| } else if ([components month] == -1 && [components year] == 0) {\n 0| 287| return @\"mes passat\";\n 6| 288| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 289| return @\"setmana passada\";\n 6| 290| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 291| return @\"ahir\";\n 5| 292| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 293| return @\"abans d'ahir\";\n 1| 294| }\n 6| 295|\n 4| 296| if ([components year] == 1) {\n 0| 297| return @\"pr��xim any\";\n 4| 298| } else if ([components month] == 1 && [components year] == 0) {\n 0| 299| return @\"pr��xim mes\";\n 4| 300| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 301| return @\"pr��xima setmana\";\n 4| 302| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 303| return @\"dem��\";\n 4| 304| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 305| return @\"passat dem��\";\n 0| 306| }\n 4| 307|\n 4| 308| return nil;\n 4| 309|}\n | 310|\n 1| 311|- (NSString *)enRelativeDateStringForComponents:(NSDateComponents *)components {\n 1| 312| if ([components year] == -1) {\n 0| 313| return @\"last year\";\n 1| 314| } else if ([components month] == -1 && [components year] == 0) {\n 0| 315| return @\"last month\";\n 1| 316| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 317| return @\"last week\";\n 1| 318| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 319| return @\"yesterday\";\n 1| 320| }\n 1| 321|\n 0| 322| if ([components year] == 1) {\n 0| 323| return @\"next year\";\n 0| 324| } else if ([components month] == 1 && [components year] == 0) {\n 0| 325| return @\"next month\";\n 0| 326| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 327| return @\"next week\";\n 0| 328| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 329| return @\"tomorrow\";\n 0| 330| }\n 0| 331|\n 0| 332| return nil;\n 0| 333|}\n | 334|\n 6| 335|- (NSString *)esRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 336| if ([components year] == -1) {\n 0| 337| return @\"a��o pasado\";\n 6| 338| } else if ([components month] == -1 && [components year] == 0) {\n 0| 339| return @\"mes pasado\";\n 6| 340| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 341| return @\"semana pasada\";\n 6| 342| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 343| return @\"ayer\";\n 5| 344| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 345| return @\"antes de ayer\";\n 1| 346| }\n 6| 347|\n 4| 348| if ([components year] == 1) {\n 0| 349| return @\"pr��ximo a��o\";\n 4| 350| } else if ([components month] == 1 && [components year] == 0) {\n 0| 351| return @\"pr��ximo mes\";\n 4| 352| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 353| return @\"pr��xima semana\";\n 4| 354| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 355| return @\"ma��ana\";\n 4| 356| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 357| return @\"pasado ma��ana\";\n 0| 358| }\n 4| 359|\n 4| 360| return nil;\n 4| 361|}\n | 362|\n 6| 363|- (NSString *)heRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 364| if ([components year] == -1) {\n 0| 365| return @\"������ ����������\";\n 6| 366| } else if ([components month] == -1 && [components year] == 0) {\n 0| 367| return @\"������ ��������\";\n 6| 368| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 369| return @\"�������� ��������\";\n 6| 370| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 371| return @\"����������\";\n 1| 372| }\n 6| 373|\n 5| 374| if ([components year] == -2) {\n 0| 375| return @\"�������� ������������\";\n 5| 376| } else if ([components month] == -2 && [components year] == 0) {\n 0| 377| return @\"�������� ��������������\";\n 5| 378| } else if ([components weekOfYear] == -2 && [components year] == 0 && [components month] == 0) {\n 0| 379| return @\"�������� ��������������\";\n 5| 380| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 381| return @\"����������\";\n 1| 382| }\n 5| 383|\n 4| 384| if ([components year] == 1) {\n 0| 385| return @\"������ ��������\";\n 4| 386| } else if ([components month] == 1 && [components year] == 0) {\n 0| 387| return @\"�������� ������\";\n 4| 388| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 389| return @\"�������� ������\";\n 4| 390| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 391| return @\"������\";\n 0| 392| }\n 4| 393|\n 4| 394| if ([components year] == 2) {\n 0| 395| return @\"�������� ������������\";\n 4| 396| } else if ([components month] == 2 && [components year] == 0) {\n 0| 397| return @\"�������� ��������������\";\n 4| 398| } else if ([components weekOfYear] == 2 && [components year] == 0 && [components month] == 0) {\n 0| 399| return @\"�������� ��������������\";\n 4| 400| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 401| return @\"��������������\";\n 0| 402| }\n 4| 403|\n 4| 404| return nil;\n 4| 405|}\n | 406|\n 6| 407|- (NSString *)nlRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 408| if ([components year] == -1) {\n 0| 409| return @\"vorig jaar\";\n 6| 410| } else if ([components month] == -1 && [components year] == 0) {\n 0| 411| return @\"vorige maand\";\n 6| 412| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 413| return @\"vorige week\";\n 6| 414| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 415| return @\"gisteren\";\n 5| 416| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 417| return @\"eergisteren\";\n 1| 418| }\n 6| 419|\n 4| 420| if ([components year] == 1) {\n 0| 421| return @\"volgend jaar\";\n 4| 422| } else if ([components month] == 1 && [components year] == 0) {\n 0| 423| return @\"volgende maand\";\n 4| 424| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 425| return @\"volgende week\";\n 4| 426| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 427| return @\"morgen\";\n 4| 428| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 429| return @\"overmorgen\";\n 0| 430| }\n 4| 431|\n 4| 432| return nil;\n 4| 433|}\n | 434|\n 6| 435|- (NSString *)plRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 436| if ([components year] == -1) {\n 0| 437| return @\"zesz��y rok\";\n 6| 438| } else if ([components month] == -1 && [components year] == 0) {\n 0| 439| return @\"zesz��y miesi��c\";\n 6| 440| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 441| return @\"zesz��y tydzie��\";\n 6| 442| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 443| return @\"wczoraj\";\n 5| 444| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 445| return @\"przedwczoraj\";\n 1| 446| }\n 6| 447|\n 4| 448| if ([components year] == 1) {\n 0| 449| return @\"przysz��y rok\";\n 4| 450| } else if ([components month] == 1 && [components year] == 0) {\n 0| 451| return @\"przysz��y miesi��c\";\n 4| 452| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 453| return @\"przysz��y tydzie��\";\n 4| 454| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 455| return @\"jutro\";\n 4| 456| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 457| return @\"pojutrze\";\n 0| 458| }\n 4| 459|\n 4| 460| return nil;\n 4| 461|}\n | 462|\n 6| 463|- (NSString *)csRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 464| if ([components year] == -1) {\n 0| 465| return @\"minul�� rok\";\n 6| 466| } else if ([components month] == -1 && [components year] == 0) {\n 0| 467| return @\"minul�� m��s��c\";\n 6| 468| } else if ([components weekOfYear] == -1 && [components month] == 0 && [components year] == 0) {\n 0| 469| return @\"minul�� t��den\";\n 6| 470| } else if ([components day] == -1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 471| return @\"v��era\";\n 5| 472| } else if ([components day] == -2 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 473| return @\"p��edev����rem\";\n 1| 474| }\n 6| 475|\n 4| 476| if ([components year] == 1) {\n 0| 477| return @\"p������t�� rok\";\n 4| 478| } else if ([components month] == 1 && [components year] == 0) {\n 0| 479| return @\"p������t�� m��s��c\";\n 4| 480| } else if ([components weekOfYear] == 1 && [components month] == 0 && [components year] == 0) {\n 0| 481| return @\"p������t�� t��den\";\n 4| 482| } else if ([components day] == 1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 0| 483| return @\"z��tra\";\n 4| 484| } else if ([components day] == 2 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 0| 485| return @\"poz��t����\";\n 0| 486| }\n 4| 487|\n 4| 488| return nil;\n 4| 489|}\n | 490|\n 6| 491|- (NSString *)jaRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 492| if ([components year] == -1) {\n 0| 493| return @\"������\";\n 6| 494| } else if ([components month] == -1 && [components year] == 0) {\n 0| 495| return @\"������\";\n 6| 496| } else if ([components weekOfYear] == -1 && [components month] == 0 && [components year] == 0) {\n 0| 497| return @\"������\";\n 6| 498| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 499| return @\"������\";\n 1| 500| }\n 6| 501|\n 5| 502| if ([components year] == 1) {\n 0| 503| return @\"������\";\n 5| 504| } else if ([components month] == 1 && [components year] == 0) {\n 0| 505| return @\"������\";\n 5| 506| } else if ([components weekOfYear] == 1 && [components month] == 0 && [components year] == 0) {\n 0| 507| return @\"������\";\n 5| 508| } else if ([components day] == 1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 0| 509| return @\"������\";\n 0| 510| }\n 5| 511|\n 5| 512| return nil;\n 5| 513|}\n | 514|\n 6| 515|- (NSString *)frRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 516| if ([components year] == -1) {\n 0| 517| return @\"l'annn��e derni��re\";\n 6| 518| } else if ([components month] == -1 && [components year] == 0) {\n 0| 519| return @\"le mois dernier\";\n 6| 520| } else if ([components weekOfYear] == -1 && [components month] == 0 && [components year] == 0) {\n 0| 521| return @\"la semaine derni��re\";\n 6| 522| } else if ([components day] == -1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 523| return @\"hier\";\n 1| 524| }\n 6| 525|\n 5| 526| if ([components year] == 1) {\n 0| 527| return @\"l'ann��e prochaine\";\n 5| 528| } else if ([components month] == 1 && [components year] == 0) {\n 0| 529| return @\"le mois prochain\";\n 5| 530| } else if ([components weekOfYear] == 1 && [components month] == 0 && [components year] == 0) {\n 0| 531| return @\"la semaine prochaine\";\n 5| 532| } else if ([components day] == 1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 0| 533| return @\"demain\";\n 0| 534| }\n 5| 535|\n 5| 536| return nil;\n 5| 537|}\n | 538|\n 6| 539|- (NSString *)itRelativeDateStringForComponents:(NSDateComponents *)components {\n 6| 540| if ([components year] == -1) {\n 0| 541| return @\"un anno fa\";\n 6| 542| } else if ([components month] == -1 && [components year] == 0) {\n 0| 543| return @\"un mese fa\";\n 6| 544| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 545| return @\"una settimana fa\";\n 6| 546| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 547| return @\"ieri\";\n 1| 548| }\n 6| 549|\n 5| 550| if ([components year] == 1) {\n 0| 551| return @\"l'anno prossimo\";\n 5| 552| } else if ([components month] == 1 && [components year] == 0) {\n 0| 553| return @\"il mese prossimo\";\n 5| 554| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 555| return @\"la prossima settimana\";\n 5| 556| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 557| return @\"domani\";\n 0| 558| }\n 5| 559|\n 5| 560| return nil;\n 5| 561|}\n | 562|\n | 563|- (NSString *)huRelativeDateStringForComponents:(NSDateComponents *)components\n 6| 564|{\n 6| 565| if ([components year] == -1) {\n 0| 566| return @\"tavaly\";\n 6| 567| } else if ([components month] == -1 && [components year] == 0) {\n 0| 568| return @\"m��lt h��napban\";\n 6| 569| } else if ([components weekOfYear] == -1 && [components year] == 0 && [components month] == 0) {\n 0| 570| return @\"el��z�� week\";\n 6| 571| } else if ([components day] == -1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 572| return @\"tegnap\";\n 5| 573| } else if ([components day] == -2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 1| 574| return @\"tegnapel��tt\";\n 1| 575| }\n 6| 576|\n 4| 577| if ([components year] == 1) {\n 0| 578| return @\"j��v��re\";\n 4| 579| } else if ([components month] == 1 && [components year] == 0) {\n 0| 580| return @\"j��v�� h��napban\";\n 4| 581| } else if ([components weekOfYear] == 1 && [components year] == 0 && [components month] == 0) {\n 0| 582| return @\"j��v�� h��ten\";\n 4| 583| } else if ([components day] == 1 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 584| return @\"holnap\";\n 4| 585| } else if ([components day] == 2 && [components year] == 0 && [components month] == 0 && [components weekOfYear] == 0) {\n 0| 586| return @\"holnaput��n\";\n 0| 587| }\n 4| 588| \n 4| 589| return nil;\n 4| 590|}\n | 591|\n 12| 592|- (NSString *)zhHansRelativeDateStringForComponents:(NSDateComponents *)components {\n 12| 593| if ([components year] == -2) {\n 1| 594| return @\"������\";\n 11| 595| } else if ([components year] == -1) {\n 1| 596| return @\"������\";\n 10| 597| } else if ([components month] == -1 && [components year] == 0) {\n 1| 598| return @\"������\";\n 9| 599| } else if ([components weekOfYear] == -1 && [components month] == 0 && [components year] == 0) {\n 1| 600| return @\"������\";\n 8| 601| } else if ([components day] == -1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 602| return @\"������\";\n 7| 603| } else if ([components day] == -2 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 604| return @\"������\";\n 1| 605| }\n 12| 606|\n 6| 607| if ([components year] == 2) {\n 1| 608| return @\"������\";\n 5| 609| } else if ([components year] == 1) {\n 1| 610| return @\"������\";\n 4| 611| } else if ([components month] == 1 && [components year] == 0) {\n 1| 612| return @\"������\";\n 3| 613| } else if ([components weekOfYear] == 1 && [components month] == 0 && [components year] == 0) {\n 1| 614| return @\"������\";\n 2| 615| } else if ([components day] == 1 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 616| return @\"������\";\n 1| 617| } else if ([components day] == 2 && [components weekOfYear] == 0 && [components month] == 0 && [components year] == 0) {\n 1| 618| return @\"������\";\n 1| 619| }\n 6| 620|\n 0| 621| return nil;\n 6| 622|}\n | 623|\n | 624|#pragma mark - NSFormatter\n | 625|\n 0| 626|- (NSString *)stringForObjectValue:(id)anObject {\n 0| 627| if (![anObject isKindOfClass:[NSNumber class]]) {\n 0| 628| return nil;\n 0| 629| }\n 0| 630|\n 0| 631| return [self stringForTimeInterval:[(NSNumber *)anObject doubleValue]];\n 0| 632|}\n | 633|\n | 634|- (BOOL)getObjectValue:(out __unused __autoreleasing id *)obj\n | 635| forString:(__unused NSString *)string\n | 636| errorDescription:(out NSString *__autoreleasing *)error\n 0| 637|{\n 0| 638| *error = NSLocalizedStringFromTableInBundle(@\"Method Not Implemented\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 639|\n 0| 640| return NO;\n 0| 641|}\n | 642|\n | 643|#pragma mark - NSCopying\n | 644|\n 0| 645|- (id)copyWithZone:(NSZone *)zone {\n 0| 646| TTTTimeIntervalFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 647|\n 0| 648| formatter.locale = [self.locale copyWithZone:zone];\n 0| 649| formatter.pastDeicticExpression = [self.pastDeicticExpression copyWithZone:zone];\n 0| 650| formatter.presentDeicticExpression = [self.presentDeicticExpression copyWithZone:zone];\n 0| 651| formatter.futureDeicticExpression = [self.futureDeicticExpression copyWithZone:zone];\n 0| 652| formatter.deicticExpressionFormat = [self.deicticExpressionFormat copyWithZone:zone];\n 0| 653| formatter.approximateQualifierFormat = [self.approximateQualifierFormat copyWithZone:zone];\n 0| 654| formatter.presentTimeIntervalMargin = self.presentTimeIntervalMargin;\n 0| 655| formatter.usesAbbreviatedCalendarUnits = self.usesAbbreviatedCalendarUnits;\n 0| 656| formatter.usesApproximateQualifier = self.usesApproximateQualifier;\n 0| 657| formatter.usesIdiomaticDeicticExpressions = self.usesIdiomaticDeicticExpressions;\n 0| 658|\n 0| 659| return formatter;\n 0| 660|}\n | 661|\n | 662|#pragma mark - NSCoding\n | 663|\n 0| 664|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 665| self = [super initWithCoder:aDecoder];\n 0| 666|\n 0| 667| self.locale = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(locale))];\n 0| 668| self.pastDeicticExpression = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(pastDeicticExpression))];\n 0| 669| self.presentDeicticExpression = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(presentDeicticExpression))];\n 0| 670| self.futureDeicticExpression = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(futureDeicticExpression))];\n 0| 671| self.deicticExpressionFormat = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(deicticExpressionFormat))];\n 0| 672| self.approximateQualifierFormat = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(approximateQualifierFormat))];\n 0| 673| self.presentTimeIntervalMargin = [aDecoder decodeDoubleForKey:NSStringFromSelector(@selector(presentTimeIntervalMargin))];\n 0| 674| self.usesAbbreviatedCalendarUnits = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesAbbreviatedCalendarUnits))];\n 0| 675| self.usesApproximateQualifier = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesApproximateQualifier))];\n 0| 676| self.usesIdiomaticDeicticExpressions = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesIdiomaticDeicticExpressions))];\n 0| 677|\n 0| 678| return self;\n 0| 679|}\n | 680|\n 0| 681|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 682| [super encodeWithCoder:aCoder];\n 0| 683|\n 0| 684| [aCoder encodeObject:self.locale forKey:NSStringFromSelector(@selector(locale))];\n 0| 685| [aCoder encodeObject:self.pastDeicticExpression forKey:NSStringFromSelector(@selector(pastDeicticExpression))];\n 0| 686| [aCoder encodeObject:self.presentDeicticExpression forKey:NSStringFromSelector(@selector(presentDeicticExpression))];\n 0| 687| [aCoder encodeObject:self.futureDeicticExpression forKey:NSStringFromSelector(@selector(futureDeicticExpression))];\n 0| 688| [aCoder encodeObject:self.deicticExpressionFormat forKey:NSStringFromSelector(@selector(deicticExpressionFormat))];\n 0| 689| [aCoder encodeObject:self.approximateQualifierFormat forKey:NSStringFromSelector(@selector(approximateQualifierFormat))];\n 0| 690| [aCoder encodeDouble:self.presentTimeIntervalMargin forKey:NSStringFromSelector(@selector(presentTimeIntervalMargin))];\n 0| 691| [aCoder encodeBool:self.usesAbbreviatedCalendarUnits forKey:NSStringFromSelector(@selector(usesAbbreviatedCalendarUnits))];\n 0| 692| [aCoder encodeBool:self.usesApproximateQualifier forKey:NSStringFromSelector(@selector(usesApproximateQualifier))];\n 0| 693| [aCoder encodeBool:self.usesIdiomaticDeicticExpressions forKey:NSStringFromSelector(@selector(usesIdiomaticDeicticExpressions))];\n 0| 694|}\n | 695|\n | 696|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,994,645,8890.0,815,897,985,2060.0,0,null,null,null,null,null,null,null,null,null,null,null,3850.0,3850.0,550,3300.0,550,2750.0,550,2200.0,550,1650.0,550,1100.0,550,550,550,550,3850.0,0,3850.0,null,3850.0,3850.0,550,550,0,0,0,550,550,550,0,0,0,0,0,0,0,0,0,3300.0,3300.0,2750.0,550,0,550,550,550,3300.0,3850.0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,110,110,110,0,0,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,null,583,583,583,583,null,null,null,584,584,584,4,4,584,580,580,580,187,187,30,30,187,580,550,550,550,3850.0,3850.0,3850.0,3850.0,3850.0,1760.0,1760.0,550,1210.0,0,1210.0,1210.0,1210.0,1760.0,1760.0,1760.0,3850.0,3850.0,550,550,550,358,358,358,192,192,192,192,192,550,550,0,0,0,0,0,550,550,580,null,1760.0,1760.0,1760.0,1760.0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1760.0,1760.0,4,2,95,93,98,93,265,178,347,343,435,344,525,435,0,0,1760.0,1760.0,1760.0,null,null,null,187,187,187,6,181,6,175,6,169,1,168,6,162,6,156,6,150,6,144,6,138,6,132,6,126,18,18,12,12,18,187,114,187,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,1,1,0,1,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,6,6,0,6,0,6,0,6,1,1,6,5,0,5,0,5,0,5,1,1,5,4,0,4,0,4,0,4,0,0,4,4,0,4,0,4,0,4,0,0,4,4,4,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,6,6,0,6,0,6,0,6,1,1,6,5,0,5,0,5,0,5,0,0,5,5,5,null,6,6,0,6,0,6,0,6,1,1,6,5,0,5,0,5,0,5,0,0,5,5,5,null,6,6,0,6,0,6,0,6,1,1,6,5,0,5,0,5,0,5,0,0,5,5,5,null,null,6,6,0,6,0,6,0,6,1,5,1,1,6,4,0,4,0,4,0,4,0,4,0,0,4,4,4,null,12,12,1,11,1,10,1,9,1,8,1,7,1,1,12,6,1,5,1,4,1,3,1,2,1,1,1,1,6,0,6,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTURLRequestFormatter.m","source":" | 1|// TTTURLRequestFormatter.m\n | 2|//\n | 3|// Copyright (c) 2011���2015 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTURLRequestFormatter.h\"\n | 24|\n | 25|@interface NSMutableString (TTTURLRequestFormatter)\n | 26|- (void)appendCommandLineArgument:(NSString *)arg;\n | 27|@end\n | 28|\n | 29|@implementation NSMutableString (TTTURLRequestFormatter)\n | 30|\n 0| 31|- (void)appendCommandLineArgument:(NSString *)arg {\n 0| 32| [self appendFormat:@\" %@\", [arg stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];\n 0| 33|}\n | 34|\n | 35|@end\n | 36|\n | 37|#pragma mark -\n | 38|\n | 39|@implementation TTTURLRequestFormatter\n | 40|\n 0| 41|- (NSString *)stringFromURLRequest:(NSURLRequest *)request {\n 0| 42| return [NSString stringWithFormat:@\"%@ '%@'\", [request HTTPMethod], [[request URL] absoluteString]];\n 0| 43|}\n | 44|\n 0| 45|+ (NSString *)cURLCommandFromURLRequest:(NSURLRequest *)request {\n 0| 46| NSMutableString *command = [NSMutableString stringWithString:@\"curl\"];\n 0| 47|\n 0| 48| [command appendCommandLineArgument:[NSString stringWithFormat:@\"-X %@\", [request HTTPMethod]]];\n 0| 49|\n 0| 50| if ([[request HTTPBody] length] > 0) {\n 0| 51| NSMutableString *HTTPBodyString = [[NSMutableString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];\n 0| 52| [HTTPBodyString replaceOccurrencesOfString:@\"\\\\\" withString:@\"\\\\\\\\\" options:0 range:NSMakeRange(0, [HTTPBodyString length])];\n 0| 53| [HTTPBodyString replaceOccurrencesOfString:@\"`\" withString:@\"\\\\`\" options:0 range:NSMakeRange(0, [HTTPBodyString length])];\n 0| 54| [HTTPBodyString replaceOccurrencesOfString:@\"\\\"\" withString:@\"\\\\\\\"\" options:0 range:NSMakeRange(0, [HTTPBodyString length])];\n 0| 55| [HTTPBodyString replaceOccurrencesOfString:@\"$\" withString:@\"\\\\$\" options:0 range:NSMakeRange(0, [HTTPBodyString length])];\n 0| 56| [command appendCommandLineArgument:[NSString stringWithFormat:@\"-d \\\"%@\\\"\", HTTPBodyString]];\n 0| 57| }\n 0| 58|\n 0| 59| NSString *acceptEncodingHeader = [[request allHTTPHeaderFields] valueForKey:@\"Accept-Encoding\"];\n 0| 60| if ([acceptEncodingHeader rangeOfString:@\"gzip\"].location != NSNotFound) {\n 0| 61| [command appendCommandLineArgument:@\"--compressed\"];\n 0| 62| }\n 0| 63|\n 0| 64| if ([request URL]) {\n 0| 65| NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[request URL]];\n 0| 66| if (cookies.count) {\n 0| 67| NSMutableString *mutableCookieString = [NSMutableString string];\n 0| 68| for (NSHTTPCookie *cookie in cookies) {\n 0| 69| [mutableCookieString appendFormat:@\"%@=%@;\", cookie.name, cookie.value];\n 0| 70| }\n 0| 71|\n 0| 72| [command appendCommandLineArgument:[NSString stringWithFormat:@\"--cookie \\\"%@\\\"\", mutableCookieString]];\n 0| 73| }\n 0| 74| }\n 0| 75|\n 0| 76| for (id field in [request allHTTPHeaderFields]) {\n 0| 77| [command appendCommandLineArgument:[NSString stringWithFormat:@\"-H %@\", [NSString stringWithFormat:@\"'%@: %@'\", field, [[request valueForHTTPHeaderField:field] stringByReplacingOccurrencesOfString:@\"\\'\" withString:@\"\\\\\\'\"]]]];\n 0| 78| }\n 0| 79|\n 0| 80| [command appendCommandLineArgument:[NSString stringWithFormat:@\"\\\"%@\\\"\", [[request URL] absoluteString]]];\n 0| 81|\n 0| 82| return [NSString stringWithString:command];\n 0| 83|}\n | 84|\n 0| 85|+ (NSString *)WgetCommandFromURLRequest:(NSURLRequest *)request {\n 0| 86| if (!([[request HTTPMethod] isEqualToString:@\"GET\"] || [[request HTTPMethod] isEqualToString:@\"POST\"])) {\n 0| 87| [NSException raise:@\"Invalid HTTP Method\" format:@\"Wget can only make GET and POST requests\"];\n 0| 88| }\n 0| 89|\n 0| 90| NSMutableString *command = [NSMutableString stringWithString:@\"wget\"];\n 0| 91|\n 0| 92| if ([[request HTTPBody] length] > 0) {\n 0| 93| NSString *HTTPBodyString = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];\n 0| 94| [command appendCommandLineArgument:[NSString stringWithFormat:@\"-d %@\", HTTPBodyString]];\n 0| 95| }\n 0| 96|\n 0| 97| for (id field in [request allHTTPHeaderFields]) {\n 0| 98| [command appendCommandLineArgument:[NSString stringWithFormat:@\"--header=%@\", [NSString stringWithFormat:@\"'%@: %@'\", field, [[request valueForHTTPHeaderField:field] stringByReplacingOccurrencesOfString:@\"\\'\" withString:@\"\\\\\\'\"]]]];\n 0| 99| }\n 0| 100|\n 0| 101| [command appendCommandLineArgument:[NSString stringWithFormat:@\"\\\"%@\\\"\", [[request URL] absoluteString]]];\n 0| 102|\n 0| 103| return [NSString stringWithString:command];\n 0| 104|}\n | 105|\n | 106|@end\n | 107|\n | 108|#pragma mark -\n | 109|\n | 110|@implementation TTTHTTPURLResponseFormatter\n | 111|\n 0| 112|- (NSString *)stringFromHTTPURLResponse:(NSHTTPURLResponse *)response {\n 0| 113| return [NSString stringWithFormat:@\"%d '%@'\", (int)[response statusCode], [[response URL] absoluteString]];\n 0| 114|}\n | 115|\n | 116|#pragma mark - NSFormatter\n | 117|\n 0| 118|- (NSString *)stringForObjectValue:(id)obj {\n 0| 119| if ([obj isKindOfClass:[NSHTTPURLResponse class]]) {\n 0| 120| return [self stringFromHTTPURLResponse:(NSHTTPURLResponse *)obj];\n 0| 121| } else {\n 0| 122| return nil;\n 0| 123| }\n 0| 124|}\n | 125|\n | 126|- (BOOL)getObjectValue:(out __unused __autoreleasing id *)obj\n | 127| forString:(__unused NSString *)string\n | 128| errorDescription:(out NSString *__autoreleasing *)error\n 0| 129|{\n 0| 130| *error = NSLocalizedStringFromTableInBundle(@\"Method Not Implemented\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], nil);\n 0| 131|\n 0| 132| return NO;\n 0| 133|}\n | 134|\n | 135|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,null,null,null,null,null,null,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,0,0,0,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,null,null]},{"name":"FormatterKit/TTTUnitOfInformationFormatter.m","source":" | 1|// TTTUnitOfInformationFormatter.m\n | 2|//\n | 3|// Copyright (c) 2012 Mattt Thompson (http://mattt.me)\n | 4|//\n | 5|// Permission is hereby granted, free of charge, to any person obtaining a copy\n | 6|// of this software and associated documentation files (the \"Software\"), to deal\n | 7|// in the Software without restriction, including without limitation the rights\n | 8|// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n | 9|// copies of the Software, and to permit persons to whom the Software is\n | 10|// furnished to do so, subject to the following conditions:\n | 11|//\n | 12|// The above copyright notice and this permission notice shall be included in\n | 13|// all copies or substantial portions of the Software.\n | 14|//\n | 15|// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n | 16|// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n | 17|// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n | 18|// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n | 19|// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n | 20|// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n | 21|// THE SOFTWARE.\n | 22|\n | 23|#import \"TTTUnitOfInformationFormatter.h\"\n | 24|\n 0| 25|static inline NSUInteger TTTNumberOfBitsInUnit(TTTUnitOfInformation unit) {\n 0| 26| switch (unit) {\n 0| 27| case TTTBit:\n 0| 28| return 1;\n 0| 29| case TTTNibble:\n 0| 30| return 4;\n 0| 31| case TTTByte:\n 0| 32| return 8;\n 0| 33| case TTTWord:\n 0| 34| return 16;\n 0| 35| case TTTDoubleWord:\n 0| 36| return 32;\n 0| 37| }\n 0| 38|}\n | 39|\n 0| 40|static inline double TTTScaleFactorForIECPrefix(TTTUnitPrefix prefix) {\n 0| 41| switch (prefix) {\n 0| 42| case TTTKilo:\n 0| 43| return pow(2.0, 10.0);\n 0| 44| case TTTMega:\n 0| 45| return pow(2.0, 20.0);\n 0| 46| case TTTGiga:\n 0| 47| return pow(2.0, 30.0);\n 0| 48| case TTTTera:\n 0| 49| return pow(2.0, 40.0);\n 0| 50| case TTTPeta:\n 0| 51| return pow(2.0, 50.0);\n 0| 52| case TTTExa:\n 0| 53| return pow(2.0, 60.0);\n 0| 54| }\n 0| 55|}\n | 56|\n 0| 57|static inline NSString * TTTBitUnitStringForIECPrefix(TTTUnitPrefix prefix) {\n 0| 58| switch (prefix) {\n 0| 59| case TTTKilo:\n 0| 60| return NSLocalizedStringFromTableInBundle(@\"Kibit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Kibibit Unit\");\n 0| 61| case TTTMega:\n 0| 62| return NSLocalizedStringFromTableInBundle(@\"Mibit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Mebibit Unit\");\n 0| 63| case TTTGiga:\n 0| 64| return NSLocalizedStringFromTableInBundle(@\"Gibit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Gibibit Unit\");\n 0| 65| case TTTTera:\n 0| 66| return NSLocalizedStringFromTableInBundle(@\"Tibit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Tebibit Unit\");\n 0| 67| case TTTPeta:\n 0| 68| return NSLocalizedStringFromTableInBundle(@\"Pibit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Pebibit Unit\");\n 0| 69| case TTTExa:\n 0| 70| return nil;\n 0| 71| }\n 0| 72|}\n | 73|\n 0| 74|static inline NSString * TTTByteUnitStringForIECPrefix(TTTUnitPrefix prefix) {\n 0| 75| switch (prefix) {\n 0| 76| case TTTKilo:\n 0| 77| return NSLocalizedStringFromTableInBundle(@\"KiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Kibibyte Unit\");\n 0| 78| case TTTMega:\n 0| 79| return NSLocalizedStringFromTableInBundle(@\"MiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Mebibyte Unit\");\n 0| 80| case TTTGiga:\n 0| 81| return NSLocalizedStringFromTableInBundle(@\"GiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Gibibyte Unit\");\n 0| 82| case TTTTera:\n 0| 83| return NSLocalizedStringFromTableInBundle(@\"TiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Tebibyte Unit\");\n 0| 84| case TTTPeta:\n 0| 85| return NSLocalizedStringFromTableInBundle(@\"PiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Pebibyte Unit\");\n 0| 86| case TTTExa:\n 0| 87| return NSLocalizedStringFromTableInBundle(@\"EiB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Exbibyte Unit\");\n 0| 88| }\n 0| 89|}\n | 90|\n 0| 91|static inline double TTTScaleFactorForSIPrefix(TTTUnitPrefix prefix) {\n 0| 92| switch (prefix) {\n 0| 93| case TTTKilo:\n 0| 94| return pow(10.0, 3.0);\n 0| 95| case TTTMega:\n 0| 96| return pow(10.0, 6.0);\n 0| 97| case TTTGiga:\n 0| 98| return pow(10.0, 9.0);\n 0| 99| case TTTTera:\n 0| 100| return pow(10.0, 12.0);\n 0| 101| case TTTPeta:\n 0| 102| return pow(10.0, 15.0);\n 0| 103| case TTTExa:\n 0| 104| return pow(10.0, 18.0);\n 0| 105| }\n 0| 106|}\n | 107|\n 0| 108|static inline NSString * TTTBitUnitStringForSIPrefix(TTTUnitPrefix prefix) {\n 0| 109| switch (prefix) {\n 0| 110| case TTTKilo:\n 0| 111| return NSLocalizedStringFromTableInBundle(@\"kbit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Kilobit Unit\");\n 0| 112| case TTTMega:\n 0| 113| return NSLocalizedStringFromTableInBundle(@\"Mbit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Megabit Unit\");\n 0| 114| case TTTGiga:\n 0| 115| return NSLocalizedStringFromTableInBundle(@\"Gbit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Gigabit Unit\");\n 0| 116| case TTTTera:\n 0| 117| return NSLocalizedStringFromTableInBundle(@\"Tbit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Terabit Unit\");\n 0| 118| case TTTPeta:\n 0| 119| return NSLocalizedStringFromTableInBundle(@\"Pbit\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Petabit Unit\");\n 0| 120| case TTTExa:\n 0| 121| return nil;\n 0| 122| }\n 0| 123|}\n | 124|\n 0| 125|static inline NSString * TTTByteUnitStringForSIPrefix(TTTUnitPrefix prefix) {\n 0| 126| switch (prefix) {\n 0| 127| case TTTKilo:\n 0| 128| return NSLocalizedStringFromTableInBundle(@\"KB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Kilobyte Unit\");\n 0| 129| case TTTMega:\n 0| 130| return NSLocalizedStringFromTableInBundle(@\"MB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Megabyte Unit\");\n 0| 131| case TTTGiga:\n 0| 132| return NSLocalizedStringFromTableInBundle(@\"GB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Gigabyte Unit\");\n 0| 133| case TTTTera:\n 0| 134| return NSLocalizedStringFromTableInBundle(@\"TB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Terabyte Unit\");\n 0| 135| case TTTPeta:\n 0| 136| return NSLocalizedStringFromTableInBundle(@\"PB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Petabyte Unit\");\n 0| 137| case TTTExa:\n 0| 138| return NSLocalizedStringFromTableInBundle(@\"EB\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], @\"Exabyte Unit\");\n 0| 139| }\n 0| 140|}\n | 141|\n | 142|@interface TTTUnitOfInformationFormatter ()\n | 143|@property (readwrite, nonatomic, strong) NSNumberFormatter *numberFormatter;\n | 144|@end\n | 145|\n | 146|@implementation TTTUnitOfInformationFormatter\n | 147|@synthesize displaysInTermsOfBytes = _displaysInTermsOfBytes;\n | 148|@synthesize usesIECBinaryPrefixesForCalculation = _usesIECBinaryPrefixesForCalculation;\n | 149|@synthesize usesIECBinaryPrefixesForDisplay = _usesIECBinaryPrefixesForDisplay;\n | 150|@synthesize numberFormatter = _numberFormatter;\n | 151|\n 0| 152|- (id)init {\n 0| 153| self = [super init];\n 0| 154| if (!self) {\n 0| 155| return nil;\n 0| 156| }\n 0| 157|\n 0| 158| _numberFormatter = [[NSNumberFormatter alloc] init];\n 0| 159| [_numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];\n 0| 160| [_numberFormatter setRoundingIncrement:@(0.01f)];\n 0| 161|\n 0| 162| self.displaysInTermsOfBytes = YES;\n 0| 163| self.usesIECBinaryPrefixesForCalculation = YES;\n 0| 164| self.usesIECBinaryPrefixesForDisplay = NO;\n 0| 165|\n 0| 166| return self;\n 0| 167|}\n | 168|\n | 169|#pragma mark -\n | 170|\n 0| 171|- (double)scaleFactorForPrefix:(TTTUnitPrefix)prefix {\n 0| 172| return self.usesIECBinaryPrefixesForCalculation ? TTTScaleFactorForIECPrefix(prefix) : TTTScaleFactorForSIPrefix(prefix);\n 0| 173|}\n | 174|\n 0| 175|- (TTTUnitPrefix)prefixForInteger:(uint64_t)value {\n 0| 176| if ([self scaleFactorForPrefix:TTTExa] < value) {\n 0| 177| return TTTExa;\n 0| 178| } else if ([self scaleFactorForPrefix:TTTPeta] < value) {\n 0| 179| return TTTPeta;\n 0| 180| } else if ([self scaleFactorForPrefix:TTTTera] < value) {\n 0| 181| return TTTTera;\n 0| 182| } else if ([self scaleFactorForPrefix:TTTGiga] < value) {\n 0| 183| return TTTGiga;\n 0| 184| } else if ([self scaleFactorForPrefix:TTTMega] < value) {\n 0| 185| return TTTMega;\n 0| 186| } else {\n 0| 187| return TTTKilo;\n 0| 188| }\n 0| 189|}\n | 190|\n | 191|#pragma mark -\n | 192|\n 0| 193|- (NSString *)stringFromNumberOfBits:(NSNumber *)number {\n 0| 194| NSString *unitString = nil;\n 0| 195| double doubleValue = [number doubleValue];\n 0| 196|\n 0| 197| if (self.displaysInTermsOfBytes) {\n 0| 198| doubleValue /= TTTNumberOfBitsInUnit(TTTByte);\n 0| 199| }\n 0| 200|\n 0| 201| if (doubleValue < [self scaleFactorForPrefix:TTTKilo]) {\n 0| 202| unitString = self.displaysInTermsOfBytes ? NSLocalizedStringFromTableInBundle(@\"bytes\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Byte Unit\") : NSLocalizedStringFromTableInBundle(@\"bits\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"Bit Unit\");\n 0| 203| } else {\n 0| 204| TTTUnitPrefix prefix = [self prefixForInteger:(uint64_t)llround(doubleValue)];\n 0| 205| if (self.displaysInTermsOfBytes) {\n 0| 206| unitString = self.usesIECBinaryPrefixesForDisplay ? TTTByteUnitStringForIECPrefix(prefix) : TTTByteUnitStringForSIPrefix(prefix);\n 0| 207| } else {\n 0| 208| unitString = self.usesIECBinaryPrefixesForDisplay ? TTTBitUnitStringForIECPrefix(prefix) : TTTBitUnitStringForSIPrefix(prefix);\n 0| 209| }\n 0| 210|\n 0| 211| doubleValue /= [self scaleFactorForPrefix:prefix];\n 0| 212| }\n 0| 213|\n 0| 214| return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@\"Unit of Information Format String\", @\"FormatterKit\", [NSBundle bundleForClass:[self class]], @\"%@ %@\", @\"#{Value} #{Unit}\"), [_numberFormatter stringFromNumber:@(doubleValue)], unitString];\n 0| 215|}\n | 216|\n | 217|- (NSString *)stringFromNumber:(NSNumber *)number\n | 218| ofUnit:(TTTUnitOfInformation)unit\n 0| 219|{\n 0| 220| return [self stringFromNumberOfBits:@([number unsignedLongLongValue] * TTTNumberOfBitsInUnit(unit))];\n 0| 221|}\n | 222|\n | 223|- (NSString *)stringFromNumber:(NSNumber *)number\n | 224| ofUnit:(TTTUnitOfInformation)unit\n | 225| withPrefix:(TTTUnitPrefix)prefix\n 0| 226|{\n 0| 227| return [self stringFromNumber:@([self scaleFactorForPrefix:prefix] * [number unsignedIntegerValue]) ofUnit:unit];\n 0| 228|}\n | 229|\n | 230|#pragma mark - NSFormatter\n | 231|\n 0| 232|- (NSString *)stringForObjectValue:(id)obj {\n 0| 233| if ([obj isKindOfClass:[NSNumber class]]) {\n 0| 234| return [self stringFromNumberOfBits:(NSNumber *)obj];\n 0| 235| } else {\n 0| 236| return nil;\n 0| 237| }\n 0| 238|}\n | 239|\n | 240|- (BOOL)getObjectValue:(out __unused __autoreleasing id *)obj\n | 241| forString:(__unused NSString *)string\n | 242| errorDescription:(out NSString *__autoreleasing *)error\n 0| 243|{\n 0| 244| *error = NSLocalizedStringFromTableInBundle(@\"Method Not Implemented\", @\"FormatterKit\", [NSBundle bundleForClass:[TTTUnitOfInformationFormatter class]], nil);\n 0| 245|\n 0| 246| return NO;\n 0| 247|}\n | 248|\n | 249|#pragma mark - NSCopying\n | 250|\n 0| 251|- (id)copyWithZone:(NSZone *)zone {\n 0| 252| TTTUnitOfInformationFormatter *formatter = [[[self class] allocWithZone:zone] init];\n 0| 253|\n 0| 254| formatter.numberFormatter = [self.numberFormatter copyWithZone:zone];\n 0| 255| formatter.displaysInTermsOfBytes = self.displaysInTermsOfBytes;\n 0| 256| formatter.usesIECBinaryPrefixesForCalculation = self.usesIECBinaryPrefixesForCalculation;\n 0| 257| formatter.usesIECBinaryPrefixesForDisplay = self.usesIECBinaryPrefixesForDisplay;\n 0| 258|\n 0| 259| return formatter;\n 0| 260|}\n | 261|\n | 262|#pragma mark - NSCoding\n | 263|\n 0| 264|- (id)initWithCoder:(NSCoder *)aDecoder {\n 0| 265| self = [super initWithCoder:aDecoder];\n 0| 266|\n 0| 267| self.numberFormatter = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(numberFormatter))];\n 0| 268| self.displaysInTermsOfBytes = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(displaysInTermsOfBytes))];\n 0| 269| self.usesIECBinaryPrefixesForCalculation = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesIECBinaryPrefixesForCalculation))];\n 0| 270| self.usesIECBinaryPrefixesForDisplay = [aDecoder decodeBoolForKey:NSStringFromSelector(@selector(usesIECBinaryPrefixesForDisplay))];\n 0| 271|\n 0| 272| return self;\n 0| 273|}\n | 274|\n 0| 275|- (void)encodeWithCoder:(NSCoder *)aCoder {\n 0| 276| [super encodeWithCoder:aCoder];\n 0| 277|\n 0| 278| [aCoder encodeObject:self.numberFormatter forKey:NSStringFromSelector(@selector(numberFormatter))];\n 0| 279| [aCoder encodeBool:self.displaysInTermsOfBytes forKey:NSStringFromSelector(@selector(displaysInTermsOfBytes))];\n 0| 280| [aCoder encodeBool:self.usesIECBinaryPrefixesForCalculation forKey:NSStringFromSelector(@selector(usesIECBinaryPrefixesForCalculation))];\n 0| 281| [aCoder encodeBool:self.usesIECBinaryPrefixesForDisplay forKey:NSStringFromSelector(@selector(usesIECBinaryPrefixesForDisplay))];\n 0| 282|}\n | 283|\n | 284|@end","coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,null,null,null,null,null,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,null,null,null,null,0,0,0,null,null,null,0,0,0,0,0,0,0,null,null,null,null,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,null,null,null,0,0,0,0,0,0,0,0,0,0,null,0,0,0,0,0,0,0,0,null,null]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment