Skip to content

Commit

Permalink
Changed operator definition from <| to <-
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanhimmelman committed Feb 25, 2015
1 parent 4dc159d commit 4872214
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 139 deletions.
44 changes: 22 additions & 22 deletions ObjectMapper/Core/Operators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import Foundation
* This provides a way to add custom logic to handle specific types of objects
*/

infix operator <| {}
infix operator <- {}

// MARK:- Objects with Basic types
/**
* Object of Basic type
*/

public func <| <T>(inout left: T, right: Map) {
public func <- <T>(inout left: T, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().basicType(&left, object: right.currentValue)
} else {
Expand All @@ -32,7 +32,7 @@ public func <| <T>(inout left: T, right: Map) {
/**
* Optional object of basic type
*/
public func <| <T>(inout left: T?, right: Map) {
public func <- <T>(inout left: T?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -43,7 +43,7 @@ public func <| <T>(inout left: T?, right: Map) {
/**
* Implicitly unwrapped optional object of basic type
*/
public func <| <T>(inout left: T!, right: Map) {
public func <- <T>(inout left: T!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -54,7 +54,7 @@ public func <| <T>(inout left: T!, right: Map) {
/**
* Object of Basic type with Transform
*/
public func <| <T, Transform: TransformType where Transform.Object == T>(inout left: T, right: (Map, Transform)) {
public func <- <T, Transform: TransformType where Transform.Object == T>(inout left: T, right: (Map, Transform)) {
if right.0.mappingType == MappingType.fromJSON {
var value: T? = right.1.transformFromJSON(right.0.currentValue)
FromJSON().basicType(&left, object: value)
Expand All @@ -67,7 +67,7 @@ public func <| <T, Transform: TransformType where Transform.Object == T>(inout l
/**
* Optional object of basic type with Transform
*/
public func <| <T, Transform: TransformType where Transform.Object == T>(inout left: T?, right: (Map, Transform)) {
public func <- <T, Transform: TransformType where Transform.Object == T>(inout left: T?, right: (Map, Transform)) {
if right.0.mappingType == MappingType.fromJSON {
var value: T? = right.1.transformFromJSON(right.0.currentValue)
FromJSON().optionalBasicType(&left, object: value)
Expand All @@ -80,7 +80,7 @@ public func <| <T, Transform: TransformType where Transform.Object == T>(inout l
/**
* Implicitly unwrapped optional object of basic type with Transform
*/
public func <| <T, Transform: TransformType where Transform.Object == T>(inout left: T!, right: (Map, Transform)) {
public func <- <T, Transform: TransformType where Transform.Object == T>(inout left: T!, right: (Map, Transform)) {
if right.0.mappingType == MappingType.fromJSON {
var value: T? = right.1.transformFromJSON(right.0.currentValue)
FromJSON().optionalBasicType(&left, object: value)
Expand All @@ -94,7 +94,7 @@ public func <| <T, Transform: TransformType where Transform.Object == T>(inout l
/**
* Array of objects with Basic types
*/
public func <| (inout left: Array<AnyObject>, right: Map) {
public func <- (inout left: Array<AnyObject>, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().basicType(&left, object: right.currentValue)
} else {
Expand All @@ -105,7 +105,7 @@ public func <| (inout left: Array<AnyObject>, right: Map) {
/**
* Optional array of objects with Basic type
*/
public func <| (inout left: Array<AnyObject>?, right: Map) {
public func <- (inout left: Array<AnyObject>?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -116,7 +116,7 @@ public func <| (inout left: Array<AnyObject>?, right: Map) {
/**
* Implicitly unwrapped optional array of objects with Basic type
*/
public func <| (inout left: Array<AnyObject>!, right: Map) {
public func <- (inout left: Array<AnyObject>!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -128,7 +128,7 @@ public func <| (inout left: Array<AnyObject>!, right: Map) {
/**
* Dictionary of objects with Basic type
*/
public func <| (inout left: Dictionary<String, AnyObject>, right: Map) {
public func <- (inout left: Dictionary<String, AnyObject>, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().basicType(&left, object: right.currentValue)
} else {
Expand All @@ -139,7 +139,7 @@ public func <| (inout left: Dictionary<String, AnyObject>, right: Map) {
/**
* Optional dictionary of objects with Basic type <String, AnyObject>
*/
public func <| (inout left: Dictionary<String, AnyObject>?, right: Map) {
public func <- (inout left: Dictionary<String, AnyObject>?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -150,7 +150,7 @@ public func <| (inout left: Dictionary<String, AnyObject>?, right: Map) {
/**
* Implicitly unwrapped optional dictionary of objects with Basic type <String, AnyObject>
*/
public func <| (inout left: Dictionary<String, AnyObject>!, right: Map) {
public func <- (inout left: Dictionary<String, AnyObject>!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalBasicType(&left, object: right.currentValue)
} else {
Expand All @@ -162,7 +162,7 @@ public func <| (inout left: Dictionary<String, AnyObject>!, right: Map) {
/**
* Object conforming to Mappable
*/
public func <| <T: Mappable>(inout left: T, right: Map) {
public func <- <T: Mappable>(inout left: T, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().object(&left, object: right.currentValue)
} else {
Expand All @@ -173,7 +173,7 @@ public func <| <T: Mappable>(inout left: T, right: Map) {
/**
* Optional Mappable objects
*/
public func <| <T: Mappable>(inout left: T?, right: Map) {
public func <- <T: Mappable>(inout left: T?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObject(&left, object: right.currentValue)
} else {
Expand All @@ -184,7 +184,7 @@ public func <| <T: Mappable>(inout left: T?, right: Map) {
/**
* Implicitly unwrapped optional Mappable objects
*/
public func <| <T: Mappable>(inout left: T!, right: Map) {
public func <- <T: Mappable>(inout left: T!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObject(&left, object: right.currentValue)
} else {
Expand All @@ -196,7 +196,7 @@ public func <| <T: Mappable>(inout left: T!, right: Map) {
/**
* Dictionary of Mappable objects <String, T: Mappable>
*/
public func <| <T: Mappable>(inout left: Dictionary<String, T>, right: Map) {
public func <- <T: Mappable>(inout left: Dictionary<String, T>, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().objectDictionary(&left, object: right.currentValue)
} else {
Expand All @@ -207,7 +207,7 @@ public func <| <T: Mappable>(inout left: Dictionary<String, T>, right: Map) {
/**
* Optional Dictionary of Mappable object <String, T: Mappable>
*/
public func <| <T: Mappable>(inout left: Dictionary<String, T>?, right: Map) {
public func <- <T: Mappable>(inout left: Dictionary<String, T>?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObjectDictionary(&left, object: right.currentValue)
} else {
Expand All @@ -218,7 +218,7 @@ public func <| <T: Mappable>(inout left: Dictionary<String, T>?, right: Map) {
/**
* Implicitly unwrapped Optional Dictionary of Mappable object <String, T: Mappable>
*/
public func <| <T: Mappable>(inout left: Dictionary<String, T>!, right: Map) {
public func <- <T: Mappable>(inout left: Dictionary<String, T>!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObjectDictionary(&left, object: right.currentValue)
} else {
Expand All @@ -230,7 +230,7 @@ public func <| <T: Mappable>(inout left: Dictionary<String, T>!, right: Map) {
/**
* Array of Mappable objects
*/
public func <| <T: Mappable>(inout left: Array<T>, right: Map) {
public func <- <T: Mappable>(inout left: Array<T>, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().objectArray(&left, object: right.currentValue)
} else {
Expand All @@ -241,7 +241,7 @@ public func <| <T: Mappable>(inout left: Array<T>, right: Map) {
/**
* Optional array of Mappable objects
*/
public func <| <T: Mappable>(inout left: Array<T>?, right: Map) {
public func <- <T: Mappable>(inout left: Array<T>?, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObjectArray(&left, object: right.currentValue)
} else {
Expand All @@ -252,7 +252,7 @@ public func <| <T: Mappable>(inout left: Array<T>?, right: Map) {
/**
* Implicitly unwrapped Optional array of Mappable objects
*/
public func <| <T: Mappable>(inout left: Array<T>!, right: Map) {
public func <- <T: Mappable>(inout left: Array<T>!, right: Map) {
if right.mappingType == MappingType.fromJSON {
FromJSON().optionalObjectArray(&left, object: right.currentValue)
} else {
Expand Down
108 changes: 54 additions & 54 deletions ObjectMapperTests/BasicTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,61 +71,61 @@ class BasicTypes: Mappable {
}

func mapping(map: Map) {
bool <| map["bool"]
boolOptional <| map["boolOpt"]
boolImplicityUnwrapped <| map["boolImp"]
int <| map["int"]
intOptional <| map["intOpt"]
intImplicityUnwrapped <| map["intImp"]
double <| map["double"]
doubleOptional <| map["doubleOpt"]
doubleImplicityUnwrapped <| map["doubleImp"]
float <| map["float"]
floatOptional <| map["floatOpt"]
floatImplicityUnwrapped <| map["floatImp"]
string <| map["string"]
stringOptional <| map["stringOpt"]
stringImplicityUnwrapped <| map["stringImp"]
anyObject <| map["anyObject"]
anyObjectOptional <| map["anyObjectOpt"]
anyObjectImplicitlyUnwrapped <| map["anyObjectImp"]
bool <- map["bool"]
boolOptional <- map["boolOpt"]
boolImplicityUnwrapped <- map["boolImp"]
int <- map["int"]
intOptional <- map["intOpt"]
intImplicityUnwrapped <- map["intImp"]
double <- map["double"]
doubleOptional <- map["doubleOpt"]
doubleImplicityUnwrapped <- map["doubleImp"]
float <- map["float"]
floatOptional <- map["floatOpt"]
floatImplicityUnwrapped <- map["floatImp"]
string <- map["string"]
stringOptional <- map["stringOpt"]
stringImplicityUnwrapped <- map["stringImp"]
anyObject <- map["anyObject"]
anyObjectOptional <- map["anyObjectOpt"]
anyObjectImplicitlyUnwrapped <- map["anyObjectImp"]

arrayBool <| map["arrayBool"]
arrayBoolOptional <| map["arrayBoolOpt"]
arrayBoolImplicityUnwrapped <| map["arrayBoolImp"]
arrayInt <| map["arrayInt"]
arrayIntOptional <| map["arrayIntOpt"]
arrayIntImplicityUnwrapped <| map["arrayIntImp"]
arrayDouble <| map["arrayDouble"]
arrayDoubleOptional <| map["arrayDoubleOpt"]
arrayDoubleImplicityUnwrapped <| map["arrayDoubleImp"]
arrayFloat <| map["arrayFloat"]
arrayFloatOptional <| map["arrayFloatOpt"]
arrayFloatImplicityUnwrapped <| map["arrayFloatImp"]
arrayString <| map["arrayString"]
arrayStringOptional <| map["arrayStringOpt"]
arrayStringImplicityUnwrapped <| map["arrayStringImp"]
arrayAnyObject <| map["arrayAnyObject"]
arrayAnyObjectOptional <| map["arrayAnyObjectOpt"]
arrayAnyObjectImplicitlyUnwrapped <| map["arratAnyObjectImp"]
arrayBool <- map["arrayBool"]
arrayBoolOptional <- map["arrayBoolOpt"]
arrayBoolImplicityUnwrapped <- map["arrayBoolImp"]
arrayInt <- map["arrayInt"]
arrayIntOptional <- map["arrayIntOpt"]
arrayIntImplicityUnwrapped <- map["arrayIntImp"]
arrayDouble <- map["arrayDouble"]
arrayDoubleOptional <- map["arrayDoubleOpt"]
arrayDoubleImplicityUnwrapped <- map["arrayDoubleImp"]
arrayFloat <- map["arrayFloat"]
arrayFloatOptional <- map["arrayFloatOpt"]
arrayFloatImplicityUnwrapped <- map["arrayFloatImp"]
arrayString <- map["arrayString"]
arrayStringOptional <- map["arrayStringOpt"]
arrayStringImplicityUnwrapped <- map["arrayStringImp"]
arrayAnyObject <- map["arrayAnyObject"]
arrayAnyObjectOptional <- map["arrayAnyObjectOpt"]
arrayAnyObjectImplicitlyUnwrapped <- map["arratAnyObjectImp"]

dictBool <| map["dictBool"]
dictBoolOptional <| map["dictBoolOpt"]
dictBoolImplicityUnwrapped <| map["dictBoolImp"]
dictInt <| map["dictInt"]
dictIntOptional <| map["dictIntOpt"]
dictIntImplicityUnwrapped <| map["dictIntImp"]
dictDouble <| map["dictDouble"]
dictDoubleOptional <| map["dictDoubleOpt"]
dictDoubleImplicityUnwrapped <| map["dictDoubleImp"]
dictFloat <| map["dictFloat"]
dictFloatOptional <| map["dictFloatOpt"]
dictFloatImplicityUnwrapped <| map["dictFloatImp"]
dictString <| map["dictString"]
dictStringOptional <| map["dictStringOpt"]
dictStringImplicityUnwrapped <| map["dictStringImp"]
dictAnyObject <| map["dictAnyObject"]
dictAnyObjectOptional <| map["dictAnyObjectOpt"]
dictAnyObjectImplicitlyUnwrapped <| map["dictAnyObjectImp"]
dictBool <- map["dictBool"]
dictBoolOptional <- map["dictBoolOpt"]
dictBoolImplicityUnwrapped <- map["dictBoolImp"]
dictInt <- map["dictInt"]
dictIntOptional <- map["dictIntOpt"]
dictIntImplicityUnwrapped <- map["dictIntImp"]
dictDouble <- map["dictDouble"]
dictDoubleOptional <- map["dictDoubleOpt"]
dictDoubleImplicityUnwrapped <- map["dictDoubleImp"]
dictFloat <- map["dictFloat"]
dictFloatOptional <- map["dictFloatOpt"]
dictFloatImplicityUnwrapped <- map["dictFloatImp"]
dictString <- map["dictString"]
dictStringOptional <- map["dictStringOpt"]
dictStringImplicityUnwrapped <- map["dictStringImp"]
dictAnyObject <- map["dictAnyObject"]
dictAnyObjectOptional <- map["dictAnyObjectOpt"]
dictAnyObjectImplicitlyUnwrapped <- map["dictAnyObjectImp"]
}
}
Loading

0 comments on commit 4872214

Please sign in to comment.