class String
Public Instance Methods
to_ruby_method(show)
click to toggle source
# File bin/rbqtapi, line 105 def to_ruby_method(show) if !show return self end method_name = self.clone if method_name =~ /([:A-Za-z0-9]+)\*.*[ :]+([A-Za-z0-9]+)::([A-Za-z0-9]+)(\(.*\))/ && $2 == $3 method_name = $1 + '#new' + $4 + "\n" end method_name.gsub!(/char*/, 'String') method_name.gsub!(/[*&]/, '') method_name.gsub!(/KSharedPtr<([^>]*)>/) { $1 } method_name.gsub!(/QPair<([^>]*)>/) { '[' + $1 + ']' } method_name.gsub!(/(static|void|const) /, '') method_name.gsub!(/operator/, '') method_name.gsub!(/ const/, '') method_name.gsub!(/enum /, '') method_name.gsub!(/QStringList/, '[String, ...]') method_name.gsub!(/QString/, 'String') method_name.gsub!(/bool/, 'Boolean') method_name.gsub!(/mode_t|time_t|long/, 'Integer') method_name.gsub!(/float|double|qreal/, 'Float') method_name.gsub!(/q?u?longlong/, 'Integer') method_name.gsub!(/^q?u?(int|long|short)[0-9]?[0-9]?/, 'Integer') method_name.gsub!(/([^A-Za-z])q?u?(int|long|short)[0-9]?[0-9]?([,)])/) { $1 + 'Integer' + $3 } method_name.gsub!(/Q(List|Vector)<([^>]+)>/) { '[' + $2 + ', ...]' } method_name.gsub!(/Q(Hash|Map)<([^>]+),([^>]+)>/) { '{' + $2 + ' => ' + $3 + ', ...}' } method_name.gsub!(/::setRange\(([a-zA-Z]+), ([a-zA-Z]+)\)/) { '::range=' + $1 + '..' + $2 } method_name.gsub!(/::(is|has)([A-Z])([\w]+)\(/) { '::' + $2.downcase + $3 + "?" + "(" } method_name.gsub!(/::set([A-Z])([a-zA-Z]+)(\([^,]*\))/) { '::' + $1.downcase + $2 + '=' + $3 } method_name.sub!(/::([a-z])/) { '#' + $1 } method_name.gsub!(/Q([A-Z])/) { 'Qt::' + $1 } method_name.sub!('()', '') return method_name end