1class CocoaRef::DataTypeDef < CocoaRef::MethodDef
2  attr_accessor :fields
3  def initialize
4    super
5    @fields = ''
6  end
7  
8  def to_rdoc
9    str  = ''
10    str += "  # This is a ruby wrapped class generated by BridgeSupport.\n"
11    str += "  #\n"
12    str += "  # Description::  #{@description.rdocify}\n"  unless @description.empty?
13    unless @discussion.empty?
14      index = 0
15      @discussion.each do |paragraph|
16        if index.zero?
17          str += "  # Discussion::   #{paragraph.rdocify}\n"
18        else
19          str += "  #                #{paragraph.rdocify}\n"
20        end
21        str += "  #\n"
22        index = index.next
23      end
24    end
25    str += "  # Definition::   #{@definition.rdocify}\n" unless @definition.empty?
26    str += "  # Availability:: #{@availability.rdocify}\n" unless @availability.empty?
27    unless @see_also.empty?
28      str += "  # See also::     "
29      @see_also.each do |s|
30        str += "<tt>#{s.to_rb_def}</tt> " unless s.empty?
31      end
32      str += "\n"
33    end
34    
35    begin
36      fields = OSX.const_get(@name).fields
37      str += "  class #{@name}\n"
38      str += "    attr_accessor :#{fields.join(', :')}\n" unless fields.empty?
39      unless OSX.const_get(@name).opaque?
40        str += "    def initialize(#{fields.join(', ')})\n"
41        str += "    end\n\n"
42        str += "    # :call-seq:\n"
43        str += "    #   to_a => [#{fields.join(', ')}]\n"
44        str += "    #\n"
45        str += "    # Returns the values of the fields as an Array.\n"
46        str += "    def to_a\n"
47        str += "    end\n\n"
48      end
49      str += "    # :call-seq:\n"
50      str += "    #   == => true or false\n"
51      str += "    #\n"
52      str += "    # Compares the #{@name} instance to another #{@name} instance.\n"
53      str += "    def ==(other)\n"
54      str += "    end\n"
55      str += "  end\n\n"
56    rescue OSX::OCMessageSendException
57      str += "\n\n"
58    end
59  
60    return str
61  end
62end