class FFI::Clang::Tokens

Attributes

size[R]
tokens[R]

Public Class Methods

new(pointer, token_size, translation_unit) click to toggle source
Calls superclass method
# File lib/ffi/clang/token.rb, line 33
def initialize(pointer, token_size, translation_unit)
        ptr = Lib::TokensPointer.new(pointer,token_size, translation_unit)
        super ptr

        @translation_unit = translation_unit
        @size = token_size

        @tokens = []
        cur_ptr = pointer
        token_size.times {
                @tokens << Token.new(cur_ptr, translation_unit)
                cur_ptr += Lib::CXToken.size
        }
end
release(pointer) click to toggle source
# File lib/ffi/clang/token.rb, line 48
def self.release(pointer)
        Lib.dispose_tokens(pointer, pointer.token_size, pointer.translation_unit)
end

Public Instance Methods

cursors() click to toggle source
# File lib/ffi/clang/token.rb, line 58
def cursors
        ptr = MemoryPointer.new(Lib::CXCursor, @size)
        Lib.annotate_tokens(@translation_unit, self, @size, ptr)

        cur_ptr = ptr
        arr = []
        @size.times {
                arr << Cursor.new(cur_ptr, @translation_unit)
                cur_ptr += Lib::CXCursor.size
        }
        arr
end
each(&block) click to toggle source
# File lib/ffi/clang/token.rb, line 52
def each(&block)
        @tokens.each do |token|
                block.call(token)
        end
end