class Udgenerator::Objective

Public Instance Methods

object(type) click to toggle source
# File lib/udgenerator/objective.rb, line 19
def object(type)
        if "NSString" == type
                NSString.new()
        elsif "NSNumber" == type
                NSNumber.new()
        elsif "NSArray" == type
                NSArray.new()
        elsif "NSDictionary" == type
                NSDictionary.new()
        elsif "NSData" == type
                NSData.new()
        elsif "NSDate" == type
                NSDate.new()
        else
                AnyObject.new("#{type}")
        end
end
parse(arrStr) click to toggle source
# File lib/udgenerator/objective.rb, line 4
def parse(arrStr)
        result = {}
        arrStr.each{|s|
                if /\s*(\w+) *\* *(\w+)\s*;\s*/ =~ s then
                        result[$2] = object($1)
                elsif /- \((\w+) *\* *\)(\w+);/ =~ s then
                        result[$2] = object($1)
                elsif /\s*(\w+)\s+(\w+)\s*;\s*/ =~ s then
                        result[$2] = value($1)
                elsif /- \((\w+)\)(\w+);/ =~ s then
                        result[$2] = value($1)
                end
        }
        result
end
value(type) click to toggle source
# File lib/udgenerator/objective.rb, line 36
def value(type)
        if "NSInteger" == type then
                NSInteger.new()
        elsif "BOOL" == type then
                NSBOOL.new()
        elsif "float" == type then
                NSFloat.new()
        elsif "double" == type then
                NSDouble.new()
        else
                AnyObject.new("#{type}")
        end
end