-- EFL LuaJIT bindings: efl_file.eo (class Efl.File)
-- For use with Elua; automatically generated, do not modify

local cutil = require("cutil")
local util  = require("util")
local ffi   = require("ffi")
local eo    = require("eo")

local M, __lib = ...

local __class
local __body

local init = function()
    __class = __lib.efl_file_interface_get()
    eo.class_register("Efl_File", nil, __body, __class)
end

cutil.init_module(init, function() end)

ffi.cdef [[
    const Eo_Class *efl_file_interface_get(void);
    Eina_Bool efl_file_set(const char * file, const char * key);
    void efl_file_get(const char * *file, const char * *key);
    Eina_Bool efl_file_save(const char * file, const char * key, const char * flags);
    void efl_file_eject(void);
]]

__body = {
    file_set = function(self, file, key)
        eo.__do_start(self, __class)
        local v = __lib.efl_file_set(file, key)
        eo.__do_end()
    end,

    file_get = function(self)
        eo.__do_start(self, __class)
        local file = ffi.new("const char *[1]")
        local key = ffi.new("const char *[1]")
        __lib.efl_file_get(file, key)
        eo.__do_end()
        return ffi.string(file[0]), ffi.string(key[0])
    end,

    save = function(self, file, key, flags)
        eo.__do_start(self, __class)
        local v = __lib.efl_file_save(file, key, flags)
        eo.__do_end()
        return ((v) ~= 0)
    end,

    eject = function(self)
        eo.__do_start(self, __class)
        __lib.efl_file_eject()
        eo.__do_end()
    end,

    __properties = {
        ["file"] = { 0, 2, true, true }
    }
}

return M
