diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-29 14:34:01 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-29 14:34:01 +0200 |
commit | 7d9d18850322a11f0f40913a5442b7a981b47c0a (patch) | |
tree | 2c01727c282fc10aca18576a39f39d6a4d521c3e /lib/efl | |
parent | c2855a3809a9c76a94e4434efe7caecef27b8a35 (diff) | |
download | ffi-efl-7d9d18850322a11f0f40913a5442b7a981b47c0a.zip ffi-efl-7d9d18850322a11f0f40913a5442b7a981b47c0a.tar.gz |
update efl/eet* and specs
Diffstat (limited to 'lib/efl')
-rw-r--r-- | lib/efl/eet.rb | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/lib/efl/eet.rb b/lib/efl/eet.rb index d546b5e..2e5bf0b 100644 --- a/lib/efl/eet.rb +++ b/lib/efl/eet.rb @@ -4,46 +4,38 @@ require 'efl/ffi/eet' # module Efl + # module Eet # - class << self + class REetFile # - def open path, mode=:eet_file_mode_read, &blk - if blk - f = Efl::FFI.eet_open path, mode - raise Exception.new "Unable to open file #{path}" if f.nil? - yield EetFile.new f - Efl::FFI.eet_close f - else - f = Efl::FFI.eet_open path, mode - return EetFile.new f unless f.nil? - end - end - end - # - class EetFile + include Efl::ClassHelper + @search_paths = [ [Efl::Eet,'eet_'] ].freeze # def initialize ptr @ptr=ptr end private :initialize # - def close - Efl::FFI.eet_close @ptr - @ptr=nil - end - # - def mode_get - Efl::FFI.eet_mode_get @ptr + def self.open path, mode=:eet_file_mode_read, &blk + if blk + f = Efl::Eet.eet_open path, mode + raise Exception.new "Unable to open file #{path}" if f.nil? + yield REetFile.new f + Efl::Eet.eet_close f + else + f = Efl::Eet.eet_open path, mode + return REetFile.new f unless f.nil? + end end # def write key, data, compress=false - Efl::FFI.eet_write @ptr, key, ::FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) + Efl::Eet.eet_write @ptr, key, FFI::MemoryPointer.from_string(data), data.bytesize, ( compress ? 1 : 0 ) end # def read key - ptr = ::FFI::MemoryPointer.new(:int) - data = Efl::FFI.eet_read @ptr, key, ptr + ptr = FFI::MemoryPointer.new(:int) + data = Efl::Eet.eet_read @ptr, key, ptr s = ptr.read_int ptr.free return nil if s==0 @@ -53,6 +45,7 @@ module Efl end # end + # end # # EOF |