class FFI::Clang::Comment

Public Class Methods

build_from(comment) click to toggle source
# File lib/ffi/clang/comment.rb, line 31
def self.build_from(comment)
        kind = Lib.comment_get_kind(comment)
        case kind
        when :comment_null
                Comment.new comment
        when :comment_text
                TextComment.new comment
        when :comment_inline_command
                InlineCommandComment.new comment
        when :comment_html_start_tag
                HTMLStartTagComment.new comment
        when :comment_html_end_tag
                HTMLEndTagComment.new comment
        when :comment_paragraph
                ParagraphComment.new comment
        when :comment_block_command
                BlockCommandComment.new comment
        when :comment_param_command
                ParamCommandComment.new comment
        when :comment_tparam_command
                TParamCommandComment.new comment
        when :comment_verbatim_block_command
                VerbatimBlockCommandComment.new comment
        when :comment_verbatim_block_line
                VerbatimBlockLineComment.new comment
        when :comment_verbatim_line
                VerbatimLine.new comment
        when :comment_full
                FullComment.new comment
        else
                raise NotImplementedError, kind
        end
end
new(comment) click to toggle source
# File lib/ffi/clang/comment.rb, line 69
def initialize(comment)
        @comment = comment
end

Public Instance Methods

child(n = 0) click to toggle source
# File lib/ffi/clang/comment.rb, line 81
def child(n = 0)
        Comment.build_from Lib.comment_get_child(@comment, n)
end
children() click to toggle source
# File lib/ffi/clang/comment.rb, line 85
def children
        num_children.times.map { |i| child(i) }
end
each(&block) click to toggle source
# File lib/ffi/clang/comment.rb, line 97
def each(&block)
        num_children.times.map do |i|
                block.call(child(i))
        end
end
has_trailing_newline?() click to toggle source
# File lib/ffi/clang/comment.rb, line 93
def has_trailing_newline?
        Lib.inline_content_comment_has_trailing_newline(@comment) != 0
end
kind() click to toggle source
# File lib/ffi/clang/comment.rb, line 73
def kind
        Lib.comment_get_kind(@comment)
end
num_children() click to toggle source
# File lib/ffi/clang/comment.rb, line 77
def num_children
        Lib.comment_get_num_children(@comment)
end
text() click to toggle source
# File lib/ffi/clang/comment.rb, line 65
def text
        return ""
end
whitespace?() click to toggle source
# File lib/ffi/clang/comment.rb, line 89
def whitespace?
        Lib.comment_is_whitespace(@comment) != 0
end