summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_inline_helper.x
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eio/eio_inline_helper.x')
-rw-r--r--src/lib/eio/eio_inline_helper.x105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/lib/eio/eio_inline_helper.x b/src/lib/eio/eio_inline_helper.x
new file mode 100644
index 0000000..af49646
--- /dev/null
+++ b/src/lib/eio/eio_inline_helper.x
@@ -0,0 +1,105 @@
1/* EIO - EFL data type library
2 * Copyright (C) 2010 Enlightenment Developers:
3 * Cedric Bail <cedric.bail@free.fr>
4 * Vincent "caro" Torri <vtorri at univ-evry dot fr>
5 * Stephen "okra" Houston <unixtitan@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library;
19 * if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef EIO_INLINE_HELPER_H__
23# define EIO_INLINE_HELPER_H__
24
25/**
26 * @addtogroup Eio_Helper
27 *
28 * @{
29 */
30
31/**
32 * @brief Return last acces time to a file
33 * @param stat The stat buffer as given by eio_file_stat callback.
34 * @return last access time.
35 *
36 * This function return the st_atime field, last acces time, as double like all EFL time call.
37 */
38static inline double
39eio_file_atime(const Eina_Stat *st)
40{
41 if (!st) return 0.0;
42 return (double) st->atime;
43}
44
45/**
46 * @brief Return last modification time of a file
47 * @param stat The stat buffer as given by eio_file_stat callback.
48 * @return last modification time.
49 *
50 * This function return the st_mtime field, last modification time, as double like all EFL time call.
51 */
52static inline double
53eio_file_mtime(const Eina_Stat *st)
54{
55 if (!st) return 0.0;
56 return (double) st->mtime;
57}
58
59/**
60 * @brief Return file length.
61 * @param stat The stat buffer as given by eio_file_stat callback.
62 * @return the length of a file.
63 *
64 * This function is just an accessor to st_size and return the file length.
65 */
66static inline long long
67eio_file_size(const Eina_Stat *st)
68{
69 if (!st) return 0;
70 return st->size;
71}
72
73/**
74 * @brief Return if path is a directory.
75 * @param stat The stat buffer as given by eio_file_stat callback.
76 * @return EINA_TRUE if the path is a directory.
77 *
78 * This function tell you if the stated path is a directory or not.
79 */
80static inline Eina_Bool
81eio_file_is_dir(const Eina_Stat *st)
82{
83 if (!st) return EINA_FALSE;
84 return (S_ISDIR(st->mode)) ? EINA_TRUE : EINA_FALSE;
85}
86
87/**
88 * @brief Return if path is a length.
89 * @param stat The stat buffer as given by eio_file_stat callback.
90 * @return EINA_TRUE if the path is a length.
91 *
92 * This function tell you if the stated path is a length or not.
93 */
94static inline Eina_Bool
95eio_file_is_lnk(const Eina_Stat *st)
96{
97 if (!st) return EINA_FALSE;
98 return (S_ISLNK(st->mode)) ? EINA_TRUE : EINA_FALSE;
99}
100
101/**
102 * @}
103 */
104
105#endif