Top Level Namespace
Defined Under Namespace
Modules: Ribosome, SwiftGenerator Classes: StringEnumPropertyType, SwiftObjectPropertyType, SwiftPropertyType, USIWireDataClass
Instance Method Summary collapse
-
#amp ⇒ Object
Escape function for &.
-
#at ⇒ Object
Escape function for @.
- #initial_property_types ⇒ Object
-
#slash ⇒ Object
Escape function for /.
Instance Method Details
#amp ⇒ Object
Escape function for &
324 325 326 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 324 def amp() return "&" end |
#at ⇒ Object
Escape function for @
319 320 321 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 319 def at() return "@" end |
#initial_property_types ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 76 def initial_property_types iso_date = SwiftPropertyType.new( :NSDate, :String, auto_bridged:false, test_value: $date_lambda ) iso_date.custom_marshaling = lambda{|dest, value| "#{dest} = DateFormatting.isoStringFromDate( #{value} )" } iso_date.custom_unmarshaling = lambda{|dest, value| "#{dest} = DateFormatting.dateFromISOString( #{value} )" } iso_date.custom_equality_test = lambda{|name, other| "optionalDatesEqual( #{name}, #{other})" } int_type = SwiftPropertyType.new( :Int, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint_type = SwiftPropertyType.new( :UInt, :NSNumber, auto_bridged:true, test_value: $number_lambda ) float_type = SwiftPropertyType.new( :Float, :NSNumber, auto_bridged:true, test_value: $number_lambda ) double_type = SwiftPropertyType.new( :Double, :NSNumber, auto_bridged:true, test_value: $number_lambda ) bool_type = SwiftPropertyType.new( :Bool, :NSNumber, auto_bridged:true, test_value: lambda{|num| return num.even? ? 'true' : 'false' }) int_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.integerValue" } uint_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.unsignedIntegerValue" } float_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.floatValue" } double_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.doubleValue" } bool_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.boolValue" } # Specified-Precision numeric types int8_type = SwiftPropertyType.new( :Int8, :NSNumber, auto_bridged:true, test_value: $number_lambda ) int16_type = SwiftPropertyType.new( :Int16, :NSNumber, auto_bridged:true, test_value: $number_lambda ) int32_type = SwiftPropertyType.new( :Int32, :NSNumber, auto_bridged:true, test_value: $number_lambda ) int64_type = SwiftPropertyType.new( :Int64, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint8_type = SwiftPropertyType.new( :UInt8, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint16_type = SwiftPropertyType.new( :UInt16, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint32_type = SwiftPropertyType.new( :UInt32, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint64_type = SwiftPropertyType.new( :UInt64, :NSNumber, auto_bridged:true, test_value: $number_lambda ) float80_type = SwiftPropertyType.new( :Float80, :NSNumber, auto_bridged:true, test_value: $number_lambda ) # TODO: unmarshaling for specified-precision numeric types # int8_type.custom_unmarshaling # int16_type.custom_unmarshaling # int32_type.custom_unmarshaling # int64_type.custom_unmarshaling # uint8_type.custom_unmarshaling # uint16_type.custom_unmarshaling # uint32_type.custom_unmarshaling # uint64_type.custom_unmarshaling # float80_type.custom_unmarshaling return [ int_type, uint_type, float_type, double_type, bool_type, int8_type, int16_type, int32_type, int64_type, uint8_type, uint16_type, uint32_type, uint64_type, SwiftPropertyType.new( :String, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :NSString, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :USIObjectID, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :AnvilEndpoint, :AnvilEndpoint, auto_bridged:true, test_value: nil ), iso_date ] end |
#slash ⇒ Object
Escape function for /
329 330 331 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 329 def slash() return "/" end |