summaryrefslogtreecommitdiff
path: root/src/lib/eio/efl_io_manager.eo
blob: 9149595d3b3a0167a06004eccb82677fb924be17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import eina_types;

struct @beta Eio.Data
{
  [[A structure to handle arbitrary data to be sent over Promises.]]
  data: void_ptr; [[Private data pointer]]
  size: uint; [[Size of private data]]
}

function @beta EflIoPath {
  [[EflIoPath function]]
  params {
     @in paths: array<string>; [[Accessor to an array of path.]]
  }
};

function @beta EflIoDirectInfo {
  [[EflIoDirectInfo function]]
  params {
     @in entries: array<Eina.File_Direct_Info>; [[Accessor to an array of info.]]
  }
};

class @beta Efl.Io.Manager extends Efl.Loop_Consumer
{
  [[Class representing an asynchronous file operation.]]

  methods {
    ls @const {
      [[Lists entries in a given path.
        See @Eina.File.
      ]]
      params {
        @in path: string; [[Path we want to list entries for]]
        paths: EflIoPath; [[Callback called for each packet of files found]]
      }
      return: future<uint64> @move; [[Amount of files found during the listing of the directory]]
    }

    direct_ls @const {
      [[Lists entries in a given path with more information.]]
      params {
        @in path: string;[[Path we want to list entries for]]
        @in recursive: bool; [[If $true, list entries recursively, $false otherwise]]
	info: EflIoDirectInfo; [[Callback called for each packet of @Eina.File_Direct_Info]]
      }
      return: future<uint64> @move; [[Amount of files found during the listing of the directory]]
    }

    stat_ls @const {
      [[Lists entries in a given path with stat information.]]
      params {
        @in path: string;[[Path we want to list entries for]]
        @in recursive: bool; [[If $true, list entries recursively, $false otherwise]]
	info: EflIoDirectInfo; [[Callback called for each packet of @Eina.File_Direct_Info]]
      }
      return: future<uint64> @move; [[Amount of files found during the listing of the directory]]
    }

    // Extended attributes
    xattr_ls @const {
      [[Lists all extended attributes asynchronously.]]
      params {
         @in path: string; [[Path we want to list entries for]]
         paths: EflIoPath; [[Callback called for each packet of extended attributes found.]]
      }
      return: future<uint64> @move; [[Amount of extended attributes found]]
    }

    stat @const {
      [[Get stat info on a given file/directory.]]
      params {
        @in path: string; [[Path we want to get stat information for]]
      }
      return: future<Eina.Stat>; [[Stat information]]
    }

    // FIXME: Add helper for Eina.Value to Xattr
    @property xattr {
      [[Retrieves or sets information of a given extended attribute.]]
      set {
         values {
            data: ptr(Eina.Binbuf); [[Data to set as information]]
            flags: Eina.Xattr.Flags; [[Extended attributes flags]]
         }
         return: future<uint64> @move; [[Future for asynchronous set operation]]
      }
      get {
         return: future<Eina.Binbuf> @move; [[Information]]
      }
      keys {
         path: string; [[File path]]
         attribute: string; [[Attribute name]]
      }
    }

    // helper api
    open @const {
      [[Opens a file.

      The fulfilled value in the promise will be the Eina.File*.]]
      params {
        @in path: string; [[Path to file]]
        @in shared: bool; [[$true if the file can be accessed by others, $false otherwise]]
      }
      return: future<Eina.File> @move; [[Eina file handle]]
    }
    close @const {
      [[Closes an open Eina.File.]]
      params {
        @in file: ptr(Eina.File); [[Eina file handle]]
        // Here we're just interested whether the promise was fulfilled or not. No value needed.
      }
      return: future<int> @move; [[Close return code]]
    }
  }
}