Gio::File Class Reference
File and directory handling. More...

Public Types | |
| typedef sigc::slot< void, goffset, goffset > | SlotFileProgress |
| A signal handler would be, for instance: void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);. | |
| typedef sigc::slot< bool, const char*, goffset > | SlotReadMore |
| A signal handler would be, for instance: bool on_read_more(const char* file_contents, goffset file_size);. | |
Public Member Functions | |
| virtual | ~File () |
| GFile* | gobj () |
| Provides access to the underlying C GObject. | |
| const GFile* | gobj () const |
| Provides access to the underlying C GObject. | |
| Glib::RefPtr<File> | dup () const |
| Duplicates a File handle. | |
| guint | hash () const |
| Creates a hash value for a File. | |
| bool | equal (const Glib::RefPtr<const File>& other) const |
| Checks equality of two given File<!-- -->s. | |
| std::string | get_basename () const |
| Gets the base name (the last component of the path) for a given File. | |
| std::string | get_path () const |
| Gets the local pathname for File, if one exists. | |
| std::string | get_uri () const |
| Gets the URI for the file. | |
| Glib::ustring | get_parse_name () const |
| Gets the parse name of the file. | |
| Glib::RefPtr<File> | get_parent () const |
| Gets the parent directory for the file. | |
| Glib::RefPtr<File> | get_child (const std::string& name) const |
| Gets a child of file with basename equal to name. | |
| Glib::RefPtr<File> | get_child_for_display_name (const Glib::ustring& display_name) const |
| Gets the child of file for a given display_name (i.e. a UTF8 version of the name). | |
| bool | has_prefix (const Glib::RefPtr<const File>& prefix) const |
| Checks whether file has the prefix specified by prefix. | |
| std::string | get_relative_path (const Glib::RefPtr<const File>& descendant) const |
| Gets the path for descendant relative to parent. | |
| Glib::RefPtr<File> | resolve_relative_path (const std::string& relative_path) const |
| Resolves a relative path for file to an absolute path. | |
| bool | is_native () const |
| Checks to see if a file is native to the platform. | |
| bool | has_uri_scheme (const std::string& uri_scheme) const |
| Checks to see if a File has a given URI scheme. | |
| std::string | get_uri_scheme () const |
| Gets the URI scheme for a File. | |
| Glib::RefPtr<FileInputStream> | read (const Glib::RefPtr<Cancellable>& cancellable) |
| Opens a file for reading. | |
| Glib::RefPtr<FileInputStream> | read () |
| Opens a file for reading. | |
| void | read_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously opens the file for reading. | |
| void | read_async (const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously opens the file for reading. | |
| Glib::RefPtr<FileInputStream> | read_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous file read operation started with g_file_read_async(). | |
| Glib::RefPtr<FileOutputStream> | append_to (const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE) |
| Gets an output stream for appending data to the file. | |
| Glib::RefPtr<FileOutputStream> | append_to (FileCreateFlags flags=FILE_CREATE_NONE) |
| Gets an output stream for appending data to the file. | |
| Glib::RefPtr<FileOutputStream> | create_file (const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE) |
| Creates a new file and returns an output stream for writing to it. | |
| Glib::RefPtr<FileOutputStream> | create_file (FileCreateFlags flags=FILE_CREATE_NONE) |
| Creates a new file and returns an output stream for writing to it. | |
| Glib::RefPtr<FileOutputStream> | replace (const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. | |
| Glib::RefPtr<FileOutputStream> | replace (const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. | |
| void | append_to_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously opens the file for appending. | |
| void | append_to_async (const SlotAsyncReady& slot, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously opens the file for appending. | |
| Glib::RefPtr<FileOutputStream> | append_to_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous file append operation started with g_file_append_to_async(). | |
| void | create_file_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously creates a new file and returns an output stream for writing to it. | |
| void | create_file_async (const SlotAsyncReady& slot, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously creates a new file and returns an output stream for writing to it. | |
| Glib::RefPtr<FileOutputStream> | create_file_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous file create operation started with g_file_create_async(). | |
| void | replace_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. | |
| void | replace_async (const SlotAsyncReady& slot, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. | |
| Glib::RefPtr<FileOutputStream> | replace_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous file replace operation started with g_file_replace_async(). | |
| Glib::RefPtr<FileInfo> | query_info (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) const |
| Gets the requested information about the file. | |
| Glib::RefPtr<FileInfo> | query_info (const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) const |
| Gets the requested information about the file. | |
| bool | query_exists (const Glib::RefPtr<Cancellable>& cancellable) const |
| Utility function to check if a particular file exists. | |
| bool | query_exists () const |
| Utility function to check if a particular file exists. | |
| void | query_info_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) const |
| Asynchronously gets the requested information about specified file. | |
| void | query_info_async (const SlotAsyncReady& slot, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) const |
| Asynchronously gets the requested information about specified file. | |
| Glib::RefPtr<FileInfo> | query_info_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous file info query. | |
| Glib::RefPtr<FileInfo> | query_filesystem_info (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*") |
| Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself. | |
| Glib::RefPtr<FileInfo> | query_filesystem_info (const std::string& attributes="*") |
| Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself. | |
| Glib::RefPtr<Mount> | find_enclosing_mount (const Glib::RefPtr<Cancellable>& cancellable) |
| Gets a Mount for the File. | |
| void | query_filesystem_info_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", int io_priority=Glib::PRIORITY_DEFAULT) const |
| Asynchronously gets the requested information about the filesystem that the file is on. | |
| void | query_filesystem_info_async (const SlotAsyncReady& slot, const std::string& attributes="*", int io_priority=Glib::PRIORITY_DEFAULT) const |
| Asynchronously gets the requested information about the filesystem that the file is on. | |
| Glib::RefPtr<FileInfo> | query_filesystem_info_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous filesystem info query. | |
| Glib::RefPtr<Mount> | find_enclosing_mount () |
| Gets a Mount for the File. | |
| void | find_enclosing_mount_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously gets the mount for the file. | |
| void | find_enclosing_mount_async (const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously gets the mount for the file. | |
| Glib::RefPtr<Mount> | find_enclosing_mount_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous find mount request. | |
| Glib::RefPtr<FileEnumerator> | enumerate_children (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) |
| Gets the requested information about the files in a directory. | |
| Glib::RefPtr<FileEnumerator> | enumerate_children (const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) |
| Gets the requested information about the files in a directory. | |
| void | enumerate_children_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously gets the requested information about the files in a directory. | |
| void | enumerate_children_async (const SlotAsyncReady& slot, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously gets the requested information about the files in a directory. | |
| Glib::RefPtr<FileEnumerator> | enumerate_children_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an async enumerate children operation. | |
| Glib::RefPtr<File> | set_display_name (const Glib::ustring& display_name, const Glib::RefPtr<Cancellable>& cancellable) |
| Renames file to the specified display name. | |
| Glib::RefPtr<File> | set_display_name (const Glib::ustring& display_name) |
| Renames the file to the specified display name. | |
| void | set_display_name_async (const Glib::ustring& display_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously sets the display name for a given Gio::File. | |
| void | set_display_name_async (const Glib::ustring& display_name, const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously sets the display name for a given Gio::File. | |
| Glib::RefPtr<File> | set_display_name_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes setting a display name started with g_file_set_display_name_async(). | |
| bool | remove (const Glib::RefPtr<Cancellable>& cancellable) |
| Deletes a file. | |
| bool | remove () |
| Deletes a file. | |
| bool | trash (const Glib::RefPtr<Cancellable>& cancellable) |
| Sends file to the "Trashcan", if possible. | |
| bool | trash () |
| Sends the file to the "Trashcan", if possible. | |
| bool | copy (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE) |
| Copies the file source to the location specified by destination. | |
| bool | copy (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags=FILE_COPY_NONE) |
| bool | copy (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE) |
| void | copy_async (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Copies the file to the location specified by destination asynchronously. | |
| void | copy_async (const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Copies the file to the location specified by destination asynchronously. | |
| void | copy_async (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Copies the file to the location specified by destination asynchronously. | |
| void | copy_async (const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Copies the file to the location specified by destination asynchronously. | |
| bool | copy_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes copying the file started with g_file_copy_async(). | |
| bool | move (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE) |
| Tries to move the file or directory source to the location specified by destination. | |
| bool | move (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags=FILE_COPY_NONE) |
| bool | move (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE) |
| bool | make_directory (const Glib::RefPtr<Cancellable>& cancellable) |
| Creates a directory. | |
| bool | make_directory () |
| Creates a directory. | |
| bool | make_symbolic_link (const std::string& symlink_value, const Glib::RefPtr<Cancellable>& cancellable) |
| Creates a symbolic link. | |
| bool | make_symbolic_link (const std::string& symlink_value) |
| Creates a symbolic link. | |
| Glib::RefPtr <FileAttributeInfoList> | query_settable_attributes (const Glib::RefPtr<Cancellable>& cancellable) |
| Obtain the list of settable attributes for the file. | |
| Glib::RefPtr <FileAttributeInfoList> | query_settable_attributes () |
| Obtain the list of settable attributes for the file. | |
| Glib::RefPtr <FileAttributeInfoList> | query_writable_namespaces (const Glib::RefPtr<Cancellable>& cancellable) |
| Obtain the list of attribute namespaces where new attributes can be created by a user. | |
| Glib::RefPtr <FileAttributeInfoList> | query_writable_namespaces () |
| Obtain the list of attribute namespaces where new attributes can be created by a user. | |
| bool | set_attributes_from_info (const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) |
| Tries to set all attributes in the FileInfo on the target values, not stopping on the first error. | |
| bool | set_attributes_from_info (const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) |
| Tries to set all attributes in the FileInfo on the target values, not stopping on the first error. | |
| void | set_attributes_async (const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously sets the attributes of file with info. | |
| void | set_attributes_async (const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) |
| Asynchronously sets the attributes of file with info. | |
| bool | set_attributes_finish (const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info) |
| bool | set_attribute_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value. | |
| bool | set_attribute_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value. | |
| bool | set_attribute_byte_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. | |
| bool | set_attribute_byte_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. | |
| bool | set_attribute_uint32 (const std::string& attribute, guint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value. | |
| bool | set_attribute_uint32 (const std::string& attribute, guint32 value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value. | |
| bool | set_attribute_int32 (const std::string& attribute, gint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value. | |
| bool | set_attribute_int32 (const std::string& attribute, gint32 value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value. | |
| bool | set_attribute_uint64 (const std::string& attribute, guint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value. | |
| bool | set_attribute_uint64 (const std::string& attribute, guint64 value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value. | |
| bool | set_attribute_int64 (const std::string& attribute, gint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value. | |
| bool | set_attribute_int64 (const std::string& attribute, gint64 value, FileQueryInfoFlags flags) |
| Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value. | |
| void | mount_enclosing_volume (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Starts a mount_operation, mounting the volume that contains the file. | |
| void | mount_enclosing_volume (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Starts a mount_operation, mounting the volume that contains the file. | |
| void | mount_enclosing_volume (const SlotAsyncReady& slot, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Starts a mount_operation, mounting the volume that contains the file. | |
| void | mount_enclosing_volume (MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Starts a mount_operation, mounting the volume that contains the file. | |
| bool | mount_enclosing_volume_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes a mount operation started by g_file_mount_enclosing_volume(). | |
| void | mount_mountable (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Mounts a file of type FILE_TYPE_MOUNTABLE. | |
| void | mount_mountable (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Mounts a file of type FILE_TYPE_MOUNTABLE. | |
| void | mount_mountable (const SlotAsyncReady& slot, MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction. | |
| void | mount_mountable (MountMountFlags flags=MOUNT_MOUNT_NONE) |
| Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction. | |
| Glib::RefPtr<File> | mount_mountable_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes a mount operation. | |
| void | unmount_mountable (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Unmounts a file of type FILE_TYPE_MOUNTABLE. | |
| void | unmount_mountable (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Unmounts a file of type FILE_TYPE_MOUNTABLE. | |
| void | unmount_mountable (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Unmounts a file of type FILE_TYPE_MOUNTABLE. | |
| bool | unmount_mountable_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an unmount operation, see g_file_unmount_mountable() for details. | |
| void | eject_mountable (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Starts an asynchronous eject on a mountable. | |
| void | eject_mountable (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Starts an asynchronous eject on a mountable. | |
| void | eject_mountable (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE) |
| Starts an asynchronous eject on a mountable. | |
| bool | eject_mountable_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous eject operation started by g_file_eject_mountable(). | |
| bool | copy_attributes (const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE) |
| Copies the file attributes from source to destination. | |
| bool | copy_attributes (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE) |
| Copies the file attributes from source to destination. | |
| Glib::RefPtr<FileMonitor> | monitor_directory (const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags=FILE_MONITOR_NONE) |
| Obtains a directory monitor for the given file. | |
| Glib::RefPtr<FileMonitor> | monitor_directory (FileMonitorFlags flags=FILE_MONITOR_NONE) |
| Obtains a directory monitor for the given file. | |
| Glib::RefPtr<FileMonitor> | monitor_file (const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags=FILE_MONITOR_NONE) |
| Obtains a file monitor for the given file. | |
| Glib::RefPtr<FileMonitor> | monitor_file (FileMonitorFlags flags=FILE_MONITOR_NONE) |
| Obtains a file monitor for the given file. | |
| Glib::RefPtr<AppInfo> | query_default_handler (const Glib::RefPtr<Cancellable>& cancellable) |
Returns: a AppInfo if the handle was found, 0 if there were errors. | |
| Glib::RefPtr<AppInfo> | query_default_handler () |
| Returns the AppInfo that is registered as the default application to handle the file specified by the file. | |
| bool | load_contents (const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length, std::string& etag_out) |
| Loads the content of the file into memory, returning the size of the data. | |
| bool | load_contents (char*& contents, gsize& length, std::string& etag_out) |
| Loads the content of the file into memory, returning the size of the data. | |
| void | load_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) |
| Starts an asynchronous load of the file's contents. | |
| void | load_contents_async (const SlotAsyncReady& slot) |
| Starts an asynchronous load of the file's contents. | |
| bool | load_contents_finish (const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out) |
| Finishes an asynchronous load of the file's contents. | |
| void | load_partial_contents_async (const SlotReadMore& slot_read_more, const SlotAsyncReady& slot_async_ready, const Glib::RefPtr<Cancellable>& cancellable) |
| Reads the partial contents of a file. | |
| void | load_partial_contents_async (const SlotReadMore& slot_read_more, const SlotAsyncReady& slot_async_ready) |
| Reads the partial contents of a file. | |
| bool | load_partial_contents_finish (const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length, std::string& etag_out) |
| Finishes an asynchronous partial load operation that was started with load_partial_contents_async(). | |
| void | replace_contents (const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Replaces the contents of the file with contents of length bytes. | |
| void | replace_contents (const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Replaces the contents of the file with contents of length bytes. | |
| void | replace_contents (const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Replaces the contents of the file with contents. | |
| void | replace_contents (const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Replaces the contents of the file with contents. | |
| void | replace_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const char* contents, gsize length, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Starts an asynchronous replacement of the file with the given contents of length bytes. | |
| void | replace_contents_async (const SlotAsyncReady& slot, const char* contents, gsize length, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Starts an asynchronous replacement of the file with the given contents of length bytes. | |
| void | replace_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& contents, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Starts an asynchronous replacement of the file with the given contents of length bytes. | |
| void | replace_contents_async (const SlotAsyncReady& slot, const std::string& contents, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE) |
| Starts an asynchronous replacement of the file with the given contents. | |
| void | replace_contents_finish (const Glib::RefPtr<AsyncResult>& result, std::string& etag) |
| Finishes an asynchronous replace of the given file . | |
| void | replace_contents_finish (const Glib::RefPtr<AsyncResult>& result) |
| Finishes an asynchronous replace of the given file . | |
Static Public Member Functions | |
| static void | add_interface (GType gtype_implementer) |
| static Glib::RefPtr<File> | create_for_path (const std::string& path) |
| Constructs a File for a given path. | |
| static Glib::RefPtr<File> | create_for_uri (const std::string& uri) |
| Constructs a File for a given URI. | |
| static Glib::RefPtr<File> | create_for_commandline_arg (const std::string& arg) |
| Constructs a File for a given argument from the command line. | |
| static Glib::RefPtr<File> | create_for_parse_name (const Glib::ustring& parse_name) |
Related Functions | |
| (Note that these are not member functions.) | |
| Glib::RefPtr<Gio::File> | wrap (GFile* object, bool take_copy=false) |
| A Glib::wrap() method for this object. | |
Detailed Description
File and directory handling.Gio::File is a high level abstraction for manipulating files on a virtual file system. Gio::Files are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that a Gio::File object does not represent a file, merely a handle to a file. All file I/O is implemented as streaming operations (see Gio::InputStream and Gio::OutputStream).
A GioFile can be constructed from a path, URI, or a command line argument.
You can move through the filesystem with Gio::File handles with get_parent() to get a handle to the parent directory, get_child() to get a handle to a child within a directory, and resolve_relative_path() to resolve a relative path between two Gio::Files.
Many Gio::File operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a SlotAsyncReady callback slot which is then used to finalize the operation, producing a AsyncResult which is then passed to the function's matching _finish() operation.
Some Gio::File operations do not have synchronous analogs, as they may take a very long time to finish, and blocking may leave an application unusable. Notable cases include: mount_mountable() to mount a mountable file, unmount_mountable() to unmount a mountable file, and eject_mountable() to eject a mountable file.
One notable feature of Gio::Files are entity tags, or "etags" for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag headers, which are a very similar concept.
Member Typedef Documentation
| typedef sigc::slot<void, goffset, goffset> Gio::File::SlotFileProgress |
A signal handler would be, for instance: void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);.
| typedef sigc::slot<bool, const char*, goffset> Gio::File::SlotReadMore |
A signal handler would be, for instance: bool on_read_more(const char* file_contents, goffset file_size);.
Constructor & Destructor Documentation
| virtual Gio::File::~File | ( | ) | [virtual] |
Member Function Documentation
| static void Gio::File::add_interface | ( | GType | gtype_implementer | ) | [static] |
| GFile* Gio::File::gobj | ( | ) | [inline] |
| const GFile* Gio::File::gobj | ( | ) | const [inline] |
| static Glib::RefPtr<File> Gio::File:: |
