jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

[question] removing Lib #7

Closed aeosynth closed 8 years ago

aeosynth commented 8 years ago

how would i remove Lib from the following code?

# prints the supported filename extensions
list = GdkPixbuf::Pixbuf.formats
while !list.null?
  list = list.as(LibGLib::SList*)

  fp = list.value.data.as(LibGdkPixbuf::PixbufFormat*)
  f = GdkPixbuf::PixbufFormat.new fp
  f.extensions.each { |ext| puts ext }

  list = list.value.next_
end

i have to cast pointers to the Lib types

jhass commented 8 years ago

Now you can:

GdkPixbuf::Pixbuf.formats.each do |format|
  format.extensions.each { |ext| puts ext }
end