~ubuntu-branches/ubuntu/maverick/gwhere/maverick

« back to all changes in this revision

Viewing changes to src/data/gwfileinfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Bart Martens
  • Date: 2007-01-27 16:01:01 UTC
  • mfrom: (2.1.1 feisty)
  • Revision ID: james.westby@ubuntu.com-20070127160101-u673yo4vke03jg26
Tags: 0.2.3.dfsg.1-2
* debian/rules: Convert gwhere.desktop to UTF-8.  Closes: #405137.
* debian/rules: Replace all "extraibles" with "extraíbles" in
  gwhere.desktop.  Closes: #405138.
* debian/copyright: Updated for year 2007.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  GWhere.
2
 
 *  Copyright (C) 2000  S�bastien LECACHEUR
3
 
 *
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.
8
 
 *
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.
13
 
 *
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.
17
 
 */
18
 
 
19
 
 
20
 
/*!
21
 
 * @header      gwfileinfo.h
22
 
 *              GWhere<br>
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
31
 
 * @see         glib.h
32
 
 * @see         gwsupport.h
33
 
 * @see         gwcategory.h
34
 
 * @link                GWhere Web Site <http://www.gwhere.org>
35
 
 * @link                GTK+ Web Site <http://www.gtk.org>
36
 
 * @ref         gwfileinfo.c
37
 
 * @author      Author <zero@gwhere.org>
38
 
 */
39
 
 
40
 
 
41
 
#ifndef GW_DATA_FILE_INFO_H
42
 
#define GW_DATA_FILE_INFO_H
43
 
 
44
 
 
45
 
#include <glib.h>
46
 
#include <sys/types.h>
47
 
#include <sys/stat.h>
48
 
#include <unistd.h>
49
 
#include "gwcategory.h"
50
 
 
51
 
 
52
 
/*!
53
 
 * @struct      file_info
54
 
 * @abstract    File information data structure
55
 
 * @discussion  File information is an opaque data structure containing information about file properties and informations.
56
 
 */
57
 
struct file_info;
58
 
 
59
 
 
60
 
/*!
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>
66
 
 */
67
 
struct file_info * file_info_new ( void);
68
 
 
69
 
 
70
 
/*!
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>
79
 
 */
80
 
gint file_info_set_name ( struct file_info *p, gchar *name);
81
 
 
82
 
 
83
 
/*!
84
 
 * @function    file_info_set_rights
85
 
 * @abstract    Sets the file rights.
86
 
 * @discussion  This function sets the file information rights.<br>
87
 
 *              Sample : 000766
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>
93
 
 */
94
 
gint file_info_set_rights ( struct file_info *p, mode_t rights);
95
 
 
96
 
 
97
 
/*!
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>
107
 
 */
108
 
gint file_info_set_rights_from_gchar ( struct file_info *p, gchar *rights);
109
 
 
110
 
 
111
 
/*!
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>
120
 
 */
121
 
gint file_info_set_owner ( struct file_info *p, gchar *owner);
122
 
 
123
 
 
124
 
/*!
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>
133
 
 */
134
 
gint file_info_set_group ( struct file_info *p, gchar *group);
135
 
 
136
 
 
137
 
/*!
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>
146
 
 */
147
 
gint file_info_set_size ( struct file_info *p, guint64 size);
148
 
 
149
 
 
150
 
/*!
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>
159
 
 */
160
 
gint file_info_set_inode ( struct file_info *p, glong inode);
161
 
 
162
 
 
163
 
/*!
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>
172
 
 */
173
 
gint file_info_set_cdate ( struct file_info *p, gulong cdate);
174
 
 
175
 
 
176
 
/*!
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>
185
 
 */
186
 
gint file_info_set_adate ( struct file_info *p, gulong adate);
187
 
 
188
 
 
189
 
/*!
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>
198
 
 */
199
 
gint file_info_set_mdate ( struct file_info *p, gulong mdate);
200
 
 
201
 
 
202
 
/*!
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>
211
 
 */
212
 
gint file_info_set_category ( struct file_info *p, struct category *category);
213
 
 
214
 
 
215
 
/*!
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>
224
 
 */
225
 
gint file_info_set_description ( struct file_info *p, gchar *description);
226
 
 
227
 
 
228
 
/*!
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>
235
 
 */
236
 
gchar * file_info_get_name ( struct file_info *p);
237
 
 
238
 
 
239
 
/*!
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>
246
 
 */
247
 
gboolean file_info_get_isdirectory ( struct file_info *p);
248
 
 
249
 
 
250
 
/*!
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>
258
 
 */
259
 
gboolean file_info_get_is_real_directory ( struct file_info *p);
260
 
 
261
 
 
262
 
/*!
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>
269
 
 */
270
 
mode_t file_info_get_rights ( struct file_info *p);
271
 
 
272
 
 
273
 
/*!
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);
281
 
 
282
 
 
283
 
/*!
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>
290
 
 */
291
 
gchar * file_info_get_owner ( struct file_info *p);
292
 
 
293
 
 
294
 
/*!
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>
301
 
 */
302
 
gchar * file_info_get_group ( struct file_info *p);
303
 
 
304
 
 
305
 
/*!
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>
312
 
 */
313
 
guint64 file_info_get_size ( struct file_info *p);
314
 
 
315
 
 
316
 
/*!
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>
323
 
 */
324
 
glong file_info_get_inode ( struct file_info *p);
325
 
 
326
 
 
327
 
/*!
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>
334
 
 */
335
 
gulong file_info_get_cdate ( struct file_info *p);
336
 
 
337
 
 
338
 
/*!
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>
345
 
 */
346
 
gulong file_info_get_adate ( struct file_info *p);
347
 
 
348
 
 
349
 
/*!
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>
356
 
 */
357
 
gulong file_info_get_mdate ( struct file_info *p);
358
 
 
359
 
 
360
 
/*!
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>
367
 
 */
368
 
struct category * file_info_get_category ( struct file_info *p);
369
 
 
370
 
 
371
 
/*!
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>
379
 
 */
380
 
gchar * file_info_get_category_name ( struct file_info *p);
381
 
 
382
 
 
383
 
/*!
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>
390
 
 */
391
 
gint file_info_get_category_index ( struct file_info *p);
392
 
 
393
 
 
394
 
/*!
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>
401
 
 */
402
 
gchar * file_info_get_description ( struct file_info *p);
403
 
 
404
 
 
405
 
/*!
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>
412
 
 */
413
 
gchar * file_info_get_cdate_to_gchar ( struct file_info *p);
414
 
 
415
 
 
416
 
/*!
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>
423
 
 */
424
 
gchar * file_info_get_adate_to_gchar ( struct file_info *p);
425
 
 
426
 
 
427
 
/*!
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>
434
 
 */
435
 
gchar * file_info_get_mdate_to_gchar ( struct file_info *p);
436
 
 
437
 
 
438
 
/*!
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>
447
 
 */
448
 
gint file_info_free ( struct file_info *p);
449
 
 
450
 
 
451
 
#endif