0001 // 0002 // NSNumber.swift 0003 // Himotoki 0004 // 0005 // Created by Syo Ikeda on 11/18/15. 0006 // Copyright © 2015 Syo Ikeda. All rights reserved. 0007 // 0008 0009 import class Foundation.NSNumber 0010 0011 extension NSNumber: Decodable { 0012 public static func decode(e: Extractor) throws -> NSNumber { 0013 return try castOrFail(e) 0014 } 0015 } 0016 0017 extension UInt: Decodable { 0018 public static func decode(e: Extractor) throws -> UInt { 0019 return try NSNumber.decode(e).unsignedLongValue 0020 } 0021 } 0022 0023 extension Int8: Decodable { 0024 public static func decode(e: Extractor) throws -> Int8 { 0025 return try NSNumber.decode(e).charValue 0026 } 0027 } 0028 0029 extension UInt8: Decodable { 0030 public static func decode(e: Extractor) throws -> UInt8 { 0031 return try NSNumber.decode(e).unsignedCharValue 0032 } 0033 } 0034 0035 extension Int16: Decodable { 0036 public static func decode(e: Extractor) throws -> Int16 { 0037 return try NSNumber.decode(e).shortValue 0038 } 0039 } 0040 0041 extension UInt16: Decodable { 0042 public static func decode(e: Extractor) throws -> UInt16 { 0043 return try NSNumber.decode(e).unsignedShortValue 0044 } 0045 } 0046 0047 extension Int32: Decodable { 0048 public static func decode(e: Extractor) throws -> Int32 { 0049 return try NSNumber.decode(e).intValue 0050 } 0051 } 0052 0053 extension UInt32: Decodable { 0054 public static func decode(e: Extractor) throws -> UInt32 { 0055 return try NSNumber.decode(e).unsignedIntValue 0056 } 0057 } 0058 0059 extension Int64: Decodable { 0060 public static func decode(e: Extractor) throws -> Int64 { 0061 return try NSNumber.decode(e).longLongValue 0062 } 0063 } 0064 0065 extension UInt64: Decodable { 0066 public static func decode(e: Extractor) throws -> UInt64 { 0067 return try NSNumber.decode(e).unsignedLongLongValue 0068 } 0069 } 0070
NSNumber.swift:19 return try NSNumber.decode(e).unsignedLongValueNSNumber.swift:25 return try NSNumber.decode(e).charValueNSNumber.swift:31 return try NSNumber.decode(e).unsignedCharValueNSNumber.swift:37 return try NSNumber.decode(e).shortValueNSNumber.swift:43 return try NSNumber.decode(e).unsignedShortValueNSNumber.swift:49 return try NSNumber.decode(e).intValueNSNumber.swift:55 return try NSNumber.decode(e).unsignedIntValueNSNumber.swift:61 return try NSNumber.decode(e).longLongValueNSNumber.swift:67 return try NSNumber.decode(e).unsignedLongLongValue