class Objc2swiftAssistant::ObjCFileNode

Attributes

header_file_path[RW]
implementation_file_path[RW]
name_root[RW]
objc_2_swift_converter[RW]
processed_header_file[RW]
processed_implementation_file[RW]
recognized_code[RW]

Public Class Methods

new(directory_node, name_root ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 239
def initialize(directory_node, name_root )
  super( directory_node )
  @name_root = name_root
end

Public Instance Methods

cannonical_source_file_path() click to toggle source

Utility

# File lib/objc2swift_assistant/file_sets.rb, line 319
def cannonical_source_file_path
  source_path = relative_impl_path
  source_path ||=  relative_header_path
  source_path
end
create_generated_file_nodes( generated_file_set, generated_directory ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 269
def create_generated_file_nodes( generated_file_set, generated_directory )
  swift_file_name = @name_root + '.swift'
  generated_file_node = generated_directory.file_nodes_by_name[ swift_file_name ]

  if generated_file_node.nil?
    generated_file_node = GeneratedSwiftFileNode.new( generated_directory, swift_file_name )
    generated_directory.file_nodes_by_name[ swift_file_name ] = generated_file_node
  end

  @objc_2_swift_converter.swift_file_node = generated_file_node
end
dump( indent, tab, errors_only ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 281
def dump( indent, tab, errors_only )
  # puts( indent + "NameRoot:       #{@name_root}")
  puts( indent + "#{@name_root} :")

  unless @processed_header_file.nil?
    puts( indent+tab + "Header:")
    @processed_header_file.dump( indent+tab+tab, tab, errors_only )
  end

  unless @processed_implementation_file.nil?
    puts( indent+tab + "Implementation:")
    @processed_implementation_file.dump( indent+tab+tab, tab, errors_only )
  end

  unless @objc_2_swift_converter.nil?
    puts( indent+tab + "Swift File Generation:")
    @objc_2_swift_converter.dump( indent+tab+tab, tab, errors_only )
  end
end
prepare_conversion( configuration ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 257
def prepare_conversion( configuration )
  @objc_2_swift_converter = ObjC2SwiftFileConverter.new( self, configuration )
  @objc_2_swift_converter.prepare
end
prepare_for_use() click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 244
def prepare_for_use
  # puts( "prepare_for_use() header: #{@header_file_path}, implementation: #{@implementation_file_path}")
  @recognized_code = []
  @processed_header_file = ProcessedSourceFile.new( @header_file_path, :header, @file_set.configuration ) unless @header_file_path.nil? || @file_set.omit_file( relative_header_path )
  @processed_implementation_file = ProcessedSourceFile.new( @implementation_file_path, :implementation, @file_set.configuration ) unless @implementation_file_path.nil? || @file_set.omit_file( relative_impl_path )
end
recognize_code_fragments( recognizers ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 251
def recognize_code_fragments( recognizers )
  @file_set.configuration.log_verbose( "Recognizing code fragments in #{@header_file_path}, #{@implementation_file_path}")
  @processed_header_file.recognize_code_fragments( recognizers ) unless @processed_header_file.nil?
  @processed_implementation_file.recognize_code_fragments( recognizers ) unless @processed_implementation_file.nil?
end
relative_header_path() click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 301
def relative_header_path
  if @header_file_path.nil?
    return nil
  else
    return @directory_node.relative_path.join( @header_file_path.basename )
  end

end
relative_impl_path() click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 310
def relative_impl_path
  if @implementation_file_path.nil?
    return nil
  else
    return @directory_node.relative_path.join( @implementation_file_path.basename )
  end
end
root_matches() click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 262
def root_matches
  root_matches = []
  root_matches.concat( @processed_header_file.root_matches ) unless @processed_header_file.nil?
  root_matches.concat( @processed_implementation_file.root_matches ) unless @processed_implementation_file.nil?
  return root_matches
end