| LEFT | RIGHT |
| 1 // | 1 // |
| 2 // FavIcon | 2 // FavIcon |
| 3 // Copyright © 2016 Leon Breedt | 3 // Copyright © 2016 Leon Breedt |
| 4 // | 4 // |
| 5 // Licensed under the Apache License, Version 2.0 (the "License"); | 5 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 // you may not use this file except in compliance with the License. | 6 // you may not use this file except in compliance with the License. |
| 7 // You may obtain a copy of the License at | 7 // You may obtain a copy of the License at |
| 8 // | 8 // |
| 9 // http://www.apache.org/licenses/LICENSE-2.0 | 9 // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 // | 10 // |
| 11 // Unless required by applicable law or agreed to in writing, software | 11 // Unless required by applicable law or agreed to in writing, software |
| 12 // distributed under the License is distributed on an "AS IS" BASIS, | 12 // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 // See the License for the specific language governing permissions and | 14 // See the License for the specific language governing permissions and |
| 15 // limitations under the License. | 15 // limitations under the License. |
| 16 // | 16 // |
| 17 | 17 |
| 18 import FavIcon.XMLDocument | 18 import FavIcon.XMLDocument |
| 19 import Foundation | |
| 20 | 19 |
| 21 /// Represents an icon size. | 20 /// Represents an icon size. |
| 22 struct IconSize: Hashable, Equatable { | 21 struct IconSize: Hashable, Equatable { |
| 23 var hashValue: Int { | 22 var hashValue: Int { |
| 24 return width.hashValue ^ height.hashValue | 23 return width.hashValue ^ height.hashValue |
| 25 } | 24 } |
| 26 | 25 |
| 27 static func == (lhs: IconSize, rhs: IconSize) -> Bool { | 26 static func == (lhs: IconSize, rhs: IconSize) -> Bool { |
| 28 return lhs.width == rhs.width && lhs.height == rhs.height | 27 return lhs.width == rhs.width && lhs.height == rhs.height |
| 29 } | 28 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 for size in string.components(separatedBy: .whitespaces) { | 307 for size in string.components(separatedBy: .whitespaces) { |
| 309 let parts = size.components(separatedBy: "x") | 308 let parts = size.components(separatedBy: "x") |
| 310 if parts.count != 2 { continue } | 309 if parts.count != 2 { continue } |
| 311 if let width = Int(parts[0]), let height = Int(parts[1]) { | 310 if let width = Int(parts[0]), let height = Int(parts[1]) { |
| 312 sizes.append(IconSize(width: width, height: height)) | 311 sizes.append(IconSize(width: width, height: height)) |
| 313 } | 312 } |
| 314 } | 313 } |
| 315 } | 314 } |
| 316 return sizes | 315 return sizes |
| 317 } | 316 } |
| LEFT | RIGHT |