Enumerations | Functions

go-file.c File Reference

#include <goffice/goffice-config.h>
#include "go-file.h"
#include "go-glib-extras.h"
#include <gsf/gsf-input-memory.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-output-stdio.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

Enumerations

enum  GOFileDateType {
  GO_FILE_DATE_TYPE_ACCESSED = 0, GO_FILE_DATE_TYPE_MODIFIED, GO_FILE_DATE_TYPE_CHANGED, GO_FILE_DATE_TYPE_ACCESSED = 0,
  GO_FILE_DATE_TYPE_MODIFIED, GO_FILE_DATE_TYPE_CHANGED
}

Functions

char * go_filename_from_uri (const char *uri)
char * go_filename_to_uri (const char *filename)
char * go_filename_simplify (const char *filename, GODotDot dotdot, gboolean make_absolute)
static char * simplify_path (const char *uri)
static char * simplify_host_path (const char *uri, size_t hstart)
char * go_url_simplify (const char *uri)
char * go_url_resolve_relative (const char *ref_uri, const char *rel_uri)
static char * make_rel (const char *uri, const char *ref_uri, const char *uri_host, const char *slash)
char * go_url_make_relative (const char *uri, const char *ref_uri)
char * go_shell_arg_to_uri (const char *arg)
char * go_basename_from_uri (const char *uri)
 go_basename_from_uri: :
char * go_dirname_from_uri (const char *uri, gboolean brief)
 go_dirname_from_uri: :
static gboolean is_fd_uri (const char *uri, int *fd)
static GsfInput * open_plain_file (const char *path, GError **err)
GsfInput * go_file_open (char const *uri, GError **err)
 go_file_open : : : GError
GsfOutput * go_file_create (char const *uri, GError **err)
GSList * go_file_split_urls (const char *data)
gchar * go_file_get_owner_name (char const *uri)
gchar * go_file_get_group_name (char const *uri)
GOFilePermissionsgo_get_file_permissions (char const *uri)
void go_set_file_permissions (char const *uri, GOFilePermissions *file_permissions)
static time_t go_file_get_date (char const *uri, GOFileDateType type)
time_t go_file_get_date_accessed (char const *uri)
time_t go_file_get_date_modified (char const *uri)
time_t go_file_get_date_changed (char const *uri)
gchar * go_url_decode (gchar const *text)
 go_url_decode: : constant buffer to decode.
gchar * go_url_encode (gchar const *text, int type)
 go_url_encode: url-encode a string according to RFC 2368.
static char * check_program (char const *prog)
GError * go_url_show (gchar const *url)
gboolean go_url_check_extension (gchar const *uri, gchar const *std_ext, gchar **new_uri)
 go_url_check_extension : Uri : Standard extension for the content type : New uri
gchar * go_get_mime_type (G_GNUC_UNUSED gchar const *uri)
gchar * go_get_mime_type_for_data (G_GNUC_UNUSED gconstpointer data, G_GNUC_UNUSED int data_size)
gchar const * go_mime_type_get_description (gchar const *mime_type)
 go_mime_type_get_description: : the mime type to describe.
gchar const ** go_shell_argv_to_glib_encoding (G_GNUC_UNUSED gint argc, gchar const **argv)
void go_shell_argv_to_glib_encoding_free (void)
gint go_file_access (char const *uri, gint mode)

Enumeration Type Documentation

Enumerator:
GO_FILE_DATE_TYPE_ACCESSED 
GO_FILE_DATE_TYPE_MODIFIED 
GO_FILE_DATE_TYPE_CHANGED 
GO_FILE_DATE_TYPE_ACCESSED 
GO_FILE_DATE_TYPE_MODIFIED 
GO_FILE_DATE_TYPE_CHANGED 

Function Documentation

static char* check_program ( char const *  prog  )  [static]

Referenced by go_url_show().

char* go_basename_from_uri ( const char *  uri  ) 

go_basename_from_uri: :

go_basename_from_uri: : The uri

Decode the final path component. Returns as UTF-8 encoded suitable for display.

References file, and go_filename_from_uri().

char* go_dirname_from_uri ( const char *  uri,
gboolean  brief 
)

go_dirname_from_uri: :

go_dirname_from_uri: : target

: if TRUE, hide "file://" if present.

Decode the all but the final path component. Returns as UTF-8 encoded suitable for display.

References go_filename_from_uri().

gint go_file_access ( char const *  uri,
gint  mode 
)
GsfOutput* go_file_create ( char const *  uri,
GError **  err 
)
static time_t go_file_get_date ( char const *  uri,
GOFileDateType  type 
) [static]
time_t go_file_get_date_accessed ( char const *  uri  ) 
time_t go_file_get_date_changed ( char const *  uri  ) 
time_t go_file_get_date_modified ( char const *  uri  ) 
gchar* go_file_get_group_name ( char const *  uri  ) 
gchar* go_file_get_owner_name ( char const *  uri  ) 
GsfInput* go_file_open ( char const *  uri,
GError **  err 
)

go_file_open : : : GError

go_file_open : : target uri : GError

Try all available methods to open a file or return an error

References fd, go_filename_from_uri(), is_fd_uri(), and open_plain_file().

GSList* go_file_split_urls ( const char *  data  ) 
char* go_filename_from_uri ( const char *  uri  ) 
char* go_filename_simplify ( const char *  filename,
GODotDot  dotdot,
gboolean  make_absolute 
)
char* go_filename_to_uri ( const char *  filename  ) 
GOFilePermissions* go_get_file_permissions ( char const *  uri  ) 
gchar* go_get_mime_type ( G_GNUC_UNUSED gchar const *  uri  ) 
gchar* go_get_mime_type_for_data ( G_GNUC_UNUSED gconstpointer  data,
G_GNUC_UNUSED int  data_size 
)
gchar const* go_mime_type_get_description ( gchar const *  mime_type  ) 

go_mime_type_get_description: : the mime type to describe.

returns: the description for the mime type as a newly allocated string. Needs to be freed with g_free(). If the description is not found, the mime type itself will be returned.

References description.

void go_set_file_permissions ( char const *  uri,
GOFilePermissions file_permissions 
)
char* go_shell_arg_to_uri ( const char *  arg  ) 
gchar const** go_shell_argv_to_glib_encoding ( G_GNUC_UNUSED gint  argc,
gchar const **  argv 
)
void go_shell_argv_to_glib_encoding_free ( void   ) 
gboolean go_url_check_extension ( gchar const *  uri,
gchar const *  std_ext,
gchar **  new_uri 
)

go_url_check_extension : Uri : Standard extension for the content type : New uri

Modifies given by adding the extension if needed. If no is given or already has some extension, it just copies .

Value in new_uri: newly allocated string which you should free after use, containing (optionally) modified uri.

Return Value: FALSE if the uri has an extension not matching

References gchar, and go_utf8_collate_casefold().

gchar* go_url_decode ( gchar const *  text  ) 

go_url_decode: : constant buffer to decode.

Decode the result of go_url_encode.

Returns: a decoded string which the caller is responsible for freeing.

gchar* go_url_encode ( gchar const *  text,
int  type 
)

go_url_encode: url-encode a string according to RFC 2368.

go_url_encode: : The constant text to be encoded : 0 : mailto, 1: file or http

char* go_url_make_relative ( const char *  uri,
const char *  ref_uri 
)

References make_rel().

char* go_url_resolve_relative ( const char *  ref_uri,
const char *  rel_uri 
)

References go_url_simplify().

GError* go_url_show ( gchar const *  url  ) 

References check_program(), and gchar.

char* go_url_simplify ( const char *  uri  ) 
static gboolean is_fd_uri ( const char *  uri,
int *  fd 
) [static]

Referenced by go_file_create(), and go_file_open().

static char* make_rel ( const char *  uri,
const char *  ref_uri,
const char *  uri_host,
const char *  slash 
) [static]

Referenced by go_url_make_relative().

static GsfInput* open_plain_file ( const char *  path,
GError **  err 
) [static]

Referenced by go_file_open().

static char* simplify_host_path ( const char *  uri,
size_t  hstart 
) [static]

References simplify_path().

Referenced by go_url_simplify().

static char* simplify_path ( const char *  uri  )  [static]

Referenced by simplify_host_path().