2
* Copyright (C) 2000 S�bastien LECACHEUR
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
* @header gwfileinfo.h
23
* Copyright (C) 2000 S�bastien LECACHEUR<br><br>
24
* This Distributed under the terms of the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public Licence</a><br><br>
25
* This component was developed for the GWhere project.<br>
26
* It's an object for file representation. His structure gets many informations as name, size, owner, ...<br><br>
27
* Category field is collaborative. All other fields are agregated.
28
* @abstract This is the file information data structure.
29
* @author S�bastien LECACHEUR <zero@gwhere.org>
30
* @version 1.0 2001/08/21
34
* @link GWhere Web Site <http://www.gwhere.org>
35
* @link GTK+ Web Site <http://www.gtk.org>
37
* @author Author <zero@gwhere.org>
41
#ifndef GW_DATA_FILE_INFO_H
42
#define GW_DATA_FILE_INFO_H
46
#include <sys/types.h>
49
#include "gwcategory.h"
54
* @abstract File information data structure
55
* @discussion File information is an opaque data structure containing information about file properties and informations.
61
* @function file_info_new
62
* @abstract Creates a new file information.
63
* @discussion This function creates a new file information. It's an allocation function.
64
* @result a pointer to the file information structure.<br>
65
* Returns <i>NULL</i> when an error occured.<br>
67
struct file_info * file_info_new ( void);
71
* @function file_info_set_name
72
* @abstract Sets the file name.
73
* @discussion This function sets the name of the file
74
* @param p the file information to set the name
75
* @param name the name
76
* @result an error code.<br>
77
* Returns <i>0</i> when it's done.<br>
78
* Returns <i>-1</i> when an error occured.<br>
80
gint file_info_set_name ( struct file_info *p, gchar *name);
84
* @function file_info_set_rights
85
* @abstract Sets the file rights.
86
* @discussion This function sets the file information rights.<br>
88
* @param p the file information to set rights
89
* @param rights the rights under bit format
90
* @result an error code.<br>
91
* Returns <i>0</i> when it's done.<br>
92
* Returns <i>-1</i> when an error occured.<br>
94
gint file_info_set_rights ( struct file_info *p, mode_t rights);
98
* @function file_info_set_rights_from_gchar
99
* @abstract Sets the file rights from the string format.
100
* @discussion This function sets the file information rights from string format.<br>
101
* Sample : -rwxrwxrwx
102
* @param p the file information to set rights
103
* @param rights the rights under string format
104
* @result an error code.<br>
105
* Returns <i>0</i> when it's done.<br>
106
* Returns <i>-1</i> when an error occured.<br>
108
gint file_info_set_rights_from_gchar ( struct file_info *p, gchar *rights);
112
* @function file_info_set_owner
113
* @abstract Sets the file owner.
114
* @discussion This function sets the file information owner.<br>
115
* @param p the file information to set owner
116
* @param owner the owner
117
* @result an error code.<br>
118
* Returns <i>0</i> when it's done.<br>
119
* Returns <i>-1</i> when an error occured.<br>
121
gint file_info_set_owner ( struct file_info *p, gchar *owner);
125
* @function file_info_set_group
126
* @abstract Sets the file owner group.
127
* @discussion This function sets the file information owner group.<br>
128
* @param p the file information to set owner group
129
* @param group the group
130
* @result an error code.<br>
131
* Returns <i>0</i> when it's done.<br>
132
* Returns <i>-1</i> when an error occured.<br>
134
gint file_info_set_group ( struct file_info *p, gchar *group);
138
* @function file_info_set_size
139
* @abstract Sets the file size.
140
* @discussion This function sets the file information size.<br>
141
* @param p the file information to set size
142
* @param size the size
143
* @result an error code.<br>
144
* Returns <i>0</i> when it's done.<br>
145
* Returns <i>-1</i> when an error occured.<br>
147
gint file_info_set_size ( struct file_info *p, guint64 size);
151
* @function file_info_set_inode
152
* @abstract Sets the file inode.
153
* @discussion This function sets the file information inode.<br>
154
* @param p the file information to set inode
155
* @param inode the inode
156
* @result an error code.<br>
157
* Returns <i>0</i> when it's done.<br>
158
* Returns <i>-1</i> when an error occured.<br>
160
gint file_info_set_inode ( struct file_info *p, glong inode);
164
* @function file_info_set_cdate
165
* @abstract Sets the file creation date.
166
* @discussion This function sets the file information creation date.<br>
167
* @param p the file information to set creation date
168
* @param cdate the creation date
169
* @result an error code.<br>
170
* Returns <i>0</i> when it's done.<br>
171
* Returns <i>-1</i> when an error occured.<br>
173
gint file_info_set_cdate ( struct file_info *p, gulong cdate);
177
* @function file_info_set_adate
178
* @abstract Sets the file last access date.
179
* @discussion This function sets the file information last access date.<br>
180
* @param p the file information to set last access date
181
* @param adate the last access date
182
* @result an error code.<br>
183
* Returns <i>0</i> when it's done.<br>
184
* Returns <i>-1</i> when an error occured.<br>
186
gint file_info_set_adate ( struct file_info *p, gulong adate);
190
* @function file_info_set_mdate
191
* @abstract Sets the file last modification date.
192
* @discussion This function sets the file last information modification date.<br>
193
* @param p the information to set last modification date
194
* @param mdate the last modification date
195
* @result an error code.<br>
196
* Returns <i>0</i> when it's done.<br>
197
* Returns <i>-1</i> when an error occured.<br>
199
gint file_info_set_mdate ( struct file_info *p, gulong mdate);
203
* @function file_info_set_category
204
* @abstract Sets the file category.
205
* @discussion This function sets the file information category. The category is <i>struct category</i><br>
206
* @param p the information to set category
207
* @param category the category
208
* @result an error code.<br>
209
* Returns <i>0</i> when it's done.<br>
210
* Returns <i>-1</i> when an error occured.<br>
212
gint file_info_set_category ( struct file_info *p, struct category *category);
216
* @function file_info_set_description
217
* @abstract Sets the file description.
218
* @discussion This function sets the file information description.<br>
219
* @param p the file information to set description
220
* @param description the description
221
* @result an error code.<br>
222
* Returns <i>0</i> when it's done.<br>
223
* Returns <i>-1</i> when an error occured.<br>
225
gint file_info_set_description ( struct file_info *p, gchar *description);
229
* @function file_info_get_name
230
* @abstract Gets the file name.
231
* @discussion This function gets the file information name.<br>
232
* @param p the file information to get name
233
* @result The name.<br>
234
* Returns <i>NULL</i> when an error occured.<br>
236
gchar * file_info_get_name ( struct file_info *p);
240
* @function file_info_get_isdirectory
241
* @abstract Gets if is a folder.
242
* @discussion This function gets if the file information is folder.<br>
243
* @param p the file information to get if is a folder
244
* @result <i>TRUE</i> if is a folder or <i>FALSE</i> if is a file.<br>
245
* Returns <i>FALSE</i> when an error occured.<br>
247
gboolean file_info_get_isdirectory ( struct file_info *p);
251
* @function file_info_get_is_real_directory
252
* @abstract Gets if is a real folder.
253
* @discussion This function gets if the file information is a real folder.<br>
254
* "." and ".." are not a real folder
255
* @param p the file information to get if is a folder
256
* @result <i>TRUE</i> if is a folder or <i>FALSE</i> if is a file.<br>
257
* Returns <i>FALSE</i> when an error occured.<br>
259
gboolean file_info_get_is_real_directory ( struct file_info *p);
263
* @function file_info_get_rights
264
* @abstract Gets the file rights under bits format.
265
* @discussion this function gets the file information rights under bits format.<br>
266
* @param p the file information to get rights
267
* @result The bits format rights.<br>
268
* Returns <i>0</i> when an error occured.<br>
270
mode_t file_info_get_rights ( struct file_info *p);
274
* @function file_info_get_rights_to_gchar
275
* @abstract Gets the file rights under string format.
276
* @discussion this function gets the file information rights under string format.<br>
277
* @param p the file information to get rights
278
* @result The string format rights.<br>
279
* Returns <i>NULL</i> when an error occured.<br>
280
*/gchar* file_info_get_rights_to_gchar ( struct file_info *p);
284
* @function file_info_get_owner
285
* @abstract Gets the file owner.
286
* @discussion This function gets the file information owner.<br>
287
* @param p the file information to get owner
288
* @result The owner.<br>
289
* Returns <i>NULL</i> when an error occured.<br>
291
gchar * file_info_get_owner ( struct file_info *p);
295
* @function file_info_get_group
296
* @abstract Gets the file owner group.
297
* @discussion This function gets the file information owner group.<br>
298
* @param p the file information to get owner group
299
* @result The owner group.<br>
300
* Returns <i>NULL</i> when an error occured.<br>
302
gchar * file_info_get_group ( struct file_info *p);
306
* @function file_info_get_size
307
* @abstract Gets the file size.
308
* @discussion This functions gets the file information size.<br>
309
* @param p the file information to get size
310
* @result The size.<br>
311
* Returns <i>-1</i> when an error occured.<br>
313
guint64 file_info_get_size ( struct file_info *p);
317
* @function file_info_get_inode
318
* @abstract Gets the file inode.
319
* @discussion This function gets the file information inode.<br>
320
* @param p the file information to get inode
321
* @result The inode.<br>
322
* Returns <i>-1</i> when an error occured.<br>
324
glong file_info_get_inode ( struct file_info *p);
328
* @function file_info_get_cdate
329
* @abstract Gets the file creation date.
330
* @discussion This function gets the file information creation date.<br>
331
* @param p the file information to get creation date
332
* @result The creation date.<br>
333
* Returns <i>0</i> when an error occured.<br>
335
gulong file_info_get_cdate ( struct file_info *p);
339
* @function file_info_get_adate
340
* @abstract Gets the file last access date.
341
* @discussion This function gets the file information last access date.<br>
342
* @param p the file information to get last access date
343
* @result The last access date.<br>
344
* Returns <i>0</i> when an error occured.<br>
346
gulong file_info_get_adate ( struct file_info *p);
350
* @function file_info_get_mdate
351
* @abstract Gets the file last modification date.
352
* @discussion This function gets the file information last modification date.<br>
353
* @param p the file information to get last modification date
354
* @result The last modification date.<br>
355
* Returns <i>0</i> when an error occured.<br>
357
gulong file_info_get_mdate ( struct file_info *p);
361
* @function file_info_get_category
362
* @abstract Gets the file category.
363
* @discussion This function gets the file information category. The category is the category datas structure.<br>
364
* @param p the file information to get category
365
* @result The category.<br>
366
* Returns <i>NULL</i> when an error occured.<br>
368
struct category * file_info_get_category ( struct file_info *p);
372
* @function file_info_get_category_name
373
* @abstract Gets the file category name.
374
* @discussion This function gets the file category name.<br>
375
* @param p the file information to get category name
376
* @result The category name.<br>
377
* Returns <i>""</i> when there are not category.<br>
378
* Returns <i>NULL</i> when an error occured.<br>
380
gchar * file_info_get_category_name ( struct file_info *p);
384
* @function file_info_get_category_index
385
* @abstract Gets the file category index.
386
* @discussion This function gets the file information category index.<br>
387
* @param p the file information to get category index
388
* @result The category index.<br>
389
* Returns <i>-1</i> when an error occured.<br>
391
gint file_info_get_category_index ( struct file_info *p);
395
* @function file_info_get_description
396
* @abstract Gets the file description.
397
* @discussion This function gets the file information description.<br>
398
* @param p the file information to get description
399
* @result The description.<br>
400
* Returns <i>NULL</i> when an error occured.<br>
402
gchar * file_info_get_description ( struct file_info *p);
406
* @function file_info_get_cdate_to_gchar
407
* @abstract Gets the formated file creation date.
408
* @discussion This function gets the formated file information creation date.<br>
409
* @param p the file information to get formated creation date
410
* @result The formated creation date. Must be freed with g_free().<br>
411
* Returns <i>NULL</i> when an error occured.<br>
413
gchar * file_info_get_cdate_to_gchar ( struct file_info *p);
417
* @function file_info_get_adate_to_gchar
418
* @abstract Gets the formated file last access date.
419
* @discussion This function gets the formated file information last access date.<br>
420
* @param p the file information to get formated last access date
421
* @result The formated last access date. Must be freed with g_free().<br>
422
* Returns <i>NULL</i> when an error occured.<br>
424
gchar * file_info_get_adate_to_gchar ( struct file_info *p);
428
* @function file_info_get_mdate_to_gchar
429
* @abstract Gets the formated file last modification date.
430
* @discussion This function gets the formated file information last modification date.<br>
431
* @param p the file information to get last modification date
432
* @result The formated last modification date. Must be freed with g_free().<br>
433
* Returns <i>NULL</i> when an error occured.<br>
435
gchar * file_info_get_mdate_to_gchar ( struct file_info *p);
439
* @function file_info_free
440
* @abstract Frees datas structure.
441
* @discussion This function frees the file information datas structure.<br>
442
* Doesn't free Category because it's collaborative.<br>
443
* @param p the file information to free
444
* @result an error code.<br>
445
* Returns <i>0</i> when it's done.<br>
446
* Returns <i>-1</i> when an error occured.<br>
448
gint file_info_free ( struct file_info *p);