class EasySwig::Csharp::CsharpFeatures
Attributes
director[RW]
immutable[RW]
partial[RW]
properties[RW]
struct[RW]
Public Instance Methods
ignore_operator(name)
click to toggle source
# File lib/csharp/csharp_features.rb, line 52 def ignore_operator(name) ['operator+','operator+=', 'operator-', 'operator-=', 'operator*', 'operator*=', 'operator/', 'operator/=', 'operator<', 'operator<=', 'operator>', 'operator>=', 'operator=', 'operator[]', 'operator==', 'operator!=', 'operator^', 'operator~', 'operator%', 'operator&', 'operator|', 'operator&&', 'operator||', 'operator<<', 'operator>>'].include?(name) end
infer_basename(node)
click to toggle source
Calls superclass method
# File lib/csharp/csharp_features.rb, line 23 def infer_basename(node) aux = node.target_name.gsub(/_([a-z])/i) { |match| $1.upcase } case node.node_type when 'function', 'attribute', 'variable' node.basename = aux.gsub(/^([A-Z])/) { |match| $1.downcase } when 'method' if node.constructor? node.basename = aux else node.basename = aux.gsub(/^([A-Z])/) { |match| $1.downcase } end when 'class', 'enum' node.basename = aux.gsub(/^([a-z])/) { |match| $1.upcase } when 'namespace' node.basename = node.target_name.gsub(".", "::") else super node end end
infer_target_name(node)
click to toggle source
Calls superclass method
EasySwig::Features#infer_target_name
# File lib/csharp/csharp_features.rb, line 64 def infer_target_name(node) case node.node_type when 'method' if node.basename.start_with? '~' node.target_name = 'Dispose' return end if @properties node.target_name ||= node.setter_for node.target_name ||= node.getter_for if node.target_name list = [] wnode = node.parent.wrapped_node list.push(*wnode.methods) list.push(*wnode.attributes) if list.any? { |m| m.basename.capitalize == node.target_name.capitalize } node.target_name.prepend('_') end end end node.target_name ||= node.basename node.target_name = node.target_name.gsub(/^(_?)([a-z])/) { |match| $2.upcase.prepend $1 } when 'function', 'variable', 'attribute' node.target_name ||= node.basename.gsub(/^([a-z])/) { |match| $1.upcase } when 'namespace' node.target_name ||= node.basename.gsub("::", ".") else super node end end
to_s()
click to toggle source
# File lib/csharp/csharp_features.rb, line 12 def to_s s = @properties ? 'properties': '' s << @struct ? 'struct' : '' s << @director ? 'director' : '' s << @immutable ? 'immutable' : '' end
to_str()
click to toggle source
# File lib/csharp/csharp_features.rb, line 19 def to_str to_s end