module FFI::Clang::Lib

Constants

CodeCompleteFlags
CompilationDatabaseError
CompletionContext
DiagnosticDisplayOptions
ReparseFlags
SaveError
SaveTranslationUnitFlags
TranslationUnitFlags

Public Class Methods

bitmask_from(enum, opts) click to toggle source
# File lib/ffi/clang/lib.rb, line 61
def self.bitmask_from(enum, opts)
        bitmask = 0

        opts.each do |key, value|
                if int = enum[key]
                        bitmask |= int
                else
                        raise Error, "unknown option: #{key.inspect}, expected one of #{enum.symbols}"
                end
        end

        bitmask
end
extract_string(cxstring) click to toggle source
# File lib/ffi/clang/lib/string.rb, line 35
def self.extract_string(cxstring)
        result = get_string(cxstring)
        dispose_string cxstring

        return result
end
opts_from(enum, bitmask) click to toggle source
# File lib/ffi/clang/lib.rb, line 75
def self.opts_from(enum, bitmask)
        bit = 1
        opts = {}
        while bitmask != 0
                if bitmask & 1
                        if sym = enum[bit]
                                opts[sym] = true
                        else
                                raise Error, "unknown values: #{bit}, expected one of #{enum.symbols}"
                        end
                end
                bitmask >>= 1
                bit <<= 1
        end
        opts
end