epoc32/include/stdapis/glib-2.0/glib/gfileutils.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 0 061f57f2323e
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/* gfileutils.h - File utility functions
williamr@2
     2
 *
williamr@2
     3
 *  Copyright 2000 Red Hat, Inc.
williamr@2
     4
 * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
williamr@2
     5
 *
williamr@2
     6
 * GLib is free software; you can redistribute it and/or modify it
williamr@2
     7
 * under the terms of the GNU Lesser General Public License as
williamr@2
     8
 * published by the Free Software Foundation; either version 2 of the
williamr@2
     9
 * License, or (at your option) any later version.
williamr@2
    10
 *
williamr@2
    11
 * GLib is distributed in the hope that it will be useful,
williamr@2
    12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
williamr@2
    13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
williamr@2
    14
 * Lesser General Public License for more details.
williamr@2
    15
 *
williamr@2
    16
 * You should have received a copy of the GNU Lesser General Public
williamr@2
    17
 * License along with GLib; see the file COPYING.LIB.  If not,
williamr@2
    18
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
williamr@2
    19
 *   Boston, MA 02111-1307, USA.
williamr@2
    20
 */
williamr@2
    21
williamr@2
    22
#ifndef __G_FILEUTILS_H__
williamr@2
    23
#define __G_FILEUTILS_H__
williamr@2
    24
williamr@2
    25
#include <_ansi.h>
williamr@2
    26
#include <glib/gerror.h>
williamr@2
    27
williamr@2
    28
G_BEGIN_DECLS
williamr@2
    29
williamr@2
    30
#define G_FILE_ERROR g_file_error_quark ()
williamr@2
    31
williamr@2
    32
typedef enum
williamr@2
    33
{
williamr@2
    34
  G_FILE_ERROR_EXIST,
williamr@2
    35
  G_FILE_ERROR_ISDIR,
williamr@2
    36
  G_FILE_ERROR_ACCES,
williamr@2
    37
  G_FILE_ERROR_NAMETOOLONG,
williamr@2
    38
  G_FILE_ERROR_NOENT,
williamr@2
    39
  G_FILE_ERROR_NOTDIR,
williamr@2
    40
  G_FILE_ERROR_NXIO,
williamr@2
    41
  G_FILE_ERROR_NODEV,
williamr@2
    42
  G_FILE_ERROR_ROFS,
williamr@2
    43
  G_FILE_ERROR_TXTBSY,
williamr@2
    44
  G_FILE_ERROR_FAULT,
williamr@2
    45
  G_FILE_ERROR_LOOP,
williamr@2
    46
  G_FILE_ERROR_NOSPC,
williamr@2
    47
  G_FILE_ERROR_NOMEM,
williamr@2
    48
  G_FILE_ERROR_MFILE,
williamr@2
    49
  G_FILE_ERROR_NFILE,
williamr@2
    50
  G_FILE_ERROR_BADF,
williamr@2
    51
  G_FILE_ERROR_INVAL,
williamr@2
    52
  G_FILE_ERROR_PIPE,
williamr@2
    53
  G_FILE_ERROR_AGAIN,
williamr@2
    54
  G_FILE_ERROR_INTR,
williamr@2
    55
  G_FILE_ERROR_IO,
williamr@2
    56
  G_FILE_ERROR_PERM,
williamr@2
    57
  G_FILE_ERROR_NOSYS,
williamr@2
    58
  G_FILE_ERROR_FAILED
williamr@2
    59
} GFileError;
williamr@2
    60
williamr@2
    61
/* For backward-compat reasons, these are synced to an old 
williamr@2
    62
 * anonymous enum in libgnome. But don't use that enum
williamr@2
    63
 * in new code.
williamr@2
    64
 */
williamr@2
    65
typedef enum
williamr@2
    66
{
williamr@2
    67
  G_FILE_TEST_IS_REGULAR    = 1 << 0,
williamr@2
    68
  G_FILE_TEST_IS_SYMLINK    = 1 << 1,
williamr@2
    69
  G_FILE_TEST_IS_DIR        = 1 << 2,
williamr@2
    70
  G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
williamr@2
    71
  G_FILE_TEST_EXISTS        = 1 << 4
williamr@2
    72
} GFileTest;
williamr@2
    73
williamr@2
    74
IMPORT_C GQuark     g_file_error_quark      (void);
williamr@2
    75
/* So other code can generate a GFileError */
williamr@2
    76
IMPORT_C GFileError g_file_error_from_errno (gint err_no);
williamr@2
    77
williamr@2
    78
#ifdef G_OS_WIN32
williamr@2
    79
#define g_file_test g_file_test_utf8
williamr@2
    80
#define g_file_get_contents g_file_get_contents_utf8
williamr@2
    81
#define g_mkstemp g_mkstemp_utf8
williamr@2
    82
#define g_file_open_tmp g_file_open_tmp_utf8
williamr@2
    83
#endif
williamr@2
    84
williamr@2
    85
IMPORT_C gboolean g_file_test         (const gchar  *filename,
williamr@2
    86
                              GFileTest     test);
williamr@2
    87
IMPORT_C gboolean g_file_get_contents (const gchar  *filename,
williamr@2
    88
                              gchar       **contents,
williamr@2
    89
                              gsize        *length,    
williamr@2
    90
                              GError      **error);
williamr@2
    91
IMPORT_C gboolean g_file_set_contents (const gchar *filename,
williamr@2
    92
			      const gchar *contents,
williamr@2
    93
			      gssize	     length,
williamr@2
    94
			      GError	   **error);
williamr@2
    95
IMPORT_C gchar   *g_file_read_link    (const gchar  *filename,
williamr@2
    96
			      GError      **error);
williamr@2
    97
williamr@2
    98
/* Wrapper / workalike for mkstemp() */
williamr@2
    99
IMPORT_C gint    g_mkstemp            (gchar        *tmpl);
williamr@2
   100
williamr@2
   101
/* Wrapper for g_mkstemp */
williamr@2
   102
IMPORT_C gint    g_file_open_tmp      (const gchar  *tmpl,
williamr@2
   103
			      gchar       **name_used,
williamr@2
   104
			      GError      **error);
williamr@2
   105
williamr@2
   106
IMPORT_C gchar *g_build_path     (const gchar *separator,
williamr@2
   107
			 const gchar *first_element,
williamr@2
   108
			 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
williamr@2
   109
IMPORT_C gchar *g_build_pathv    (const gchar  *separator,
williamr@2
   110
			 gchar       **args) G_GNUC_MALLOC;
williamr@2
   111
williamr@2
   112
IMPORT_C gchar *g_build_filename (const gchar *first_element,
williamr@2
   113
			 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
williamr@2
   114
IMPORT_C gchar *g_build_filenamev (gchar      **args) G_GNUC_MALLOC;
williamr@2
   115
williamr@2
   116
IMPORT_C int    g_mkdir_with_parents (const gchar *pathname,
williamr@2
   117
			     int          mode);
williamr@2
   118
williamr@2
   119
G_END_DECLS
williamr@2
   120
williamr@2
   121
#endif /* __G_FILEUTILS_H__ */