glibmm: Gio::FileInfo Class Reference

glibmm 2.88.1

Public Member Functions | Static Public Member Functions | Related Symbols | List of all members
Gio::FileInfo Class Reference

FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes. More...

`#include <giomm/fileinfo.h>`

Inheritance diagram for Gio::FileInfo:
[legend]

## Public Member Functions
| FileInfo (FileInfo && src) noexcept
FileInfo & | operator= (FileInfo && src) noexcept
| ~FileInfo () noexcept override
GFileInfo * | gobj ()
| Provides access to the underlying C GObject.
const GFileInfo * | gobj () const
| Provides access to the underlying C GObject.
GFileInfo * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
| FileInfo ()
Glib::RefPtr< FileInfo > | dup () const
| Duplicates a file info structure.
void | copy_into (Glib::RefPtr< FileInfo > & dest_info) const
| First clears all of the GFileAttribute of dest_info, and then copies all of the file attributes from src_info to dest_info.
bool | has_attribute (const std::string & attribute) const
| Checks if a file info structure has an attribute named attribute.
bool | has_namespace (const std::string & name_space) const
| Checks if a file info structure has an attribute in the specified name_space.
std::vector< Glib::ustring > | list_attributes (const std::string & name_space) const
| Lists the file info structure's attributes.
std::vector< Glib::ustring > | list_attributes () const
| A list_attributes() convenience overload.
FileAttributeType | get_attribute_type (const std::string & attribute) const
| Gets the attribute type for an attribute key.
void | remove_attribute (const std::string & attribute)
| Removes all cases of attribute from info if it exists.
FileAttributeStatus | get_attribute_status (const std::string & attribute) const
| Gets the attribute status for an attribute key.
Glib::ustring | get_attribute_string (const std::string & attribute) const
| Gets the value of a string attribute.
std::vector< Glib::ustring > | get_attribute_strings (const std::string & attribute) const
| Gets the value of a stringv attribute.
Glib::ustring | get_attribute_as_string (const std::string & attribute) const
| Gets the value of an attribute, formatted as a human readable string.
std::string | get_attribute_byte_string (const std::string & attribute) const
| Gets the value of a byte string attribute.
bool | get_attribute_boolean (const std::string & attribute) const
| Gets the value of a boolean attribute.
guint32 | get_attribute_uint32 (const std::string & attribute) const
| Gets an unsigned 32-bit integer contained within the attribute.
gint32 | get_attribute_int32 (const std::string & attribute) const
| Gets a signed 32-bit integer contained within the attribute.
guint64 | get_attribute_uint64 (const std::string & attribute) const
| Gets a unsigned 64-bit integer contained within the attribute.
gint64 | get_attribute_int64 (const std::string & attribute) const
| Gets a signed 64-bit integer contained within the attribute.
Glib::RefPtr< Glib::Object > | get_attribute_object (const std::string & attribute) const
| Gets the value of a Object attribute.
bool | set_attribute_status (const std::string & attribute, FileAttributeStatus status)
| Sets the attribute status for an attribute key.
void | set_attribute_string (const std::string & attribute, const Glib::ustring & attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_strings (const std::string & attribute, const std::vector< Glib::ustring > & attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_byte_string (const std::string & attribute, const std::string & attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_boolean (const std::string & attribute, bool attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_uint32 (const std::string & attribute, guint32 attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_int32 (const std::string & attribute, gint32 attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_uint64 (const std::string & attribute, guint64 attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_int64 (const std::string & attribute, gint64 attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | set_attribute_object (const std::string & attribute, const Glib::RefPtr< Glib::Object > & attr_value)
| Sets the attribute to contain the given attr_value, if possible.
void | clear_status ()
| Clears the status information from info.
Glib::DateTime | get_deletion_date () const
| Returns the DateTime representing the deletion date of the file, as available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE.
FileType | get_file_type () const
| Gets a file's type (whether it is a regular file, symlink, etc).
bool | is_hidden () const
| Checks if a file is hidden.
bool | is_backup () const
| Checks if a file is a backup file.
bool | is_symlink () const
| Checks if a file is a symlink.
std::string | get_name () const
| Gets the name for a file.
Glib::ustring | get_display_name () const
| Gets a display name for a file.
Glib::ustring | get_edit_name () const
| Gets the edit name for a file.
Glib::RefPtr< Icon > | get_icon ()
| Gets the icon for a file.
Glib::RefPtr< const Icon > | get_icon () const
| Gets the icon for a file.
Glib::RefPtr< Icon > | get_symbolic_icon ()
| Gets the symbolic icon for a file.
Glib::RefPtr< const Icon > | get_symbolic_icon () const
| Gets the symbolic icon for a file.
Glib::ustring | get_content_type () const
| Gets the file's content type.
goffset | get_size () const
| Gets the file's size (in bytes).
Glib::DateTime | get_modification_date_time () const
| Gets the modification time of the current info and returns it as a DateTime.
Glib::DateTime | get_access_date_time () const
| Gets the access time of the current info and returns it as a DateTime.
Glib::DateTime | get_creation_date_time () const
| Gets the creation time of the current info and returns it as a DateTime.
std::string | get_symlink_target () const
| Gets the symlink target for a given FileInfo.
Glib::ustring | get_etag () const
| Gets the [entity tag][iface.nosp@m.@Gio.nosp@m..File#entity-tags] for a given FileInfo.
gint32 | get_sort_order () const
| Gets the value of the sort_order attribute from the FileInfo.
void | set_attribute_mask (const Glib::RefPtr< FileAttributeMatcher > & mask)
| Sets mask on info to match specific attribute types.
void | unset_attribute_mask ()
| Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.
void | set_file_type (FileType type)
| Sets the file type in a FileInfo to type.
void | set_is_hidden (bool hidden=true)
| Sets the "is_hidden" attribute in a FileInfo according to hidden.
void | set_is_symlink (bool symlink=true)
| Sets the "is_symlink" attribute in a FileInfo according to symlink.
void | set_name (const std::string & name)
| Sets the name attribute for the current FileInfo.
void | set_display_name (const Glib::ustring & display_name)
| Sets the display name for the current FileInfo.
void | set_edit_name (const Glib::ustring & edit_name)
| Sets the edit name for the current file.
void | set_icon (const Glib::RefPtr< Icon > & icon)
| Sets the icon for a given FileInfo.
void | set_symbolic_icon (const Glib::RefPtr< Icon > & icon)
| Sets the symbolic icon for a given FileInfo.
void | set_content_type (const Glib::ustring & content_type)
| Sets the content type attribute for a given FileInfo.
void | set_size (goffset size)
| Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.
void | set_modification_date_time (const Glib::DateTime & mtime)
| Sets the G_FILE_ATTRIBUTE_TIME_MODIFIED and G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given date/time value.
void | set_access_date_time (const Glib::DateTime & atime)
| Sets the G_FILE_ATTRIBUTE_TIME_ACCESS and G_FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given date/time value.
void | set_creation_date_time (const Glib::DateTime & creation_time)
| Sets the G_FILE_ATTRIBUTE_TIME_CREATED and G_FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given date/time value.
void | set_symlink_target (const std::string & symlink_target)
| Sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.
void | set_sort_order (gint32 sort_order)
| Sets the sort order attribute in the file info structure.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object && src) noexcept
Object & | operator= (Object && src) noexcept
void * | get_data (const QueryQuark & key)
void | set_data (const Quark & key, void * data)
void | set_data_with_c_callback (const Quark & key, void * data, GDestroyNotify notify)
void | set_data (const Quark & key, void * data, DestroyNotify notify)
| Prefer set_data_with_c_callback() with a callback with C linkage.
void | remove_data (const QueryQuark & quark)
void * | steal_data (const QueryQuark & quark)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
| You probably want to use a specific property_*() accessor method instead.
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void | set_property (const Glib::ustring & property_name, const PropertyType & value)
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
void | get_property (const Glib::ustring & property_name, PropertyType & value) const
| You probably want to use a specific property_*() accessor method instead.
template<class PropertyType>
PropertyType | get_property (const Glib::ustring & property_name) const
| You probably want to use a specific property_*() accessor method instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> & slot)
| You can use the signal_changed() signal of the property proxy instead.
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> && slot)
| You can use the signal_changed() signal of the property proxy instead.
void | freeze_notify ()
| Increases the freeze count on object.
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify().
virtual void | reference () const
| Increment the reference count for this object.
virtual void | unreference () const
| Decrement the reference count for this object.
GObject * | gobj ()
| Provides access to the underlying C GObject.
const GObject * | gobj () const
| Provides access to the underlying C GObject.
GObject * | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access.
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gio::FileInfo > | wrap (GFileInfo * object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject * object, bool take_copy=false)

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void (*)(gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams & construct_params)
| Object (GObject * castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
| ObjectBase (const char * custom_type_name)
| A derived constructor always overrides this choice.
| ObjectBase (const std::type_info & custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually.
| ObjectBase (ObjectBase && src) noexcept
ObjectBase & | operator= (ObjectBase && src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject * castitem)
void | initialize_move (GObject * castitem, Glib::ObjectBase * previous_wrapper)

## Detailed Description

FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See FileAttribute for more information on how GIO handles file attributes.

To obtain a FileInfo for a File, use File::query_info() (or its async variant). To obtain a FileInfo for a file input or output stream, use FileInput::stream_query_info() or FileOutput::stream_query_info() (or their async variants).

FileAttributeMatcher allows for searching through a FileInfo for attributes.

## Constructor & Destructor Documentation

## ◆ FileInfo() [1/2]

Gio::FileInfo::FileInfo | ( | FileInfo && | src | ) |
| noexcept

## ◆ ~FileInfo()

Gio::FileInfo::~FileInfo | ( |  | ) |
| overridenoexcept

## ◆ FileInfo() [2/2]

Gio::FileInfo::FileInfo | ( |  | ) |

## Member Function Documentation

## ◆ clear_status()

void Gio::FileInfo::clear_status | ( |  | ) |

Clears the status information from info.

## ◆ copy_into()

void Gio::FileInfo::copy_into | ( | Glib::RefPtr< FileInfo > & | dest_info | ) | const

First clears all of the GFileAttribute of dest_info, and then copies all of the file attributes from src_info to dest_info.

Parameters

  dest_info | Destination to copy attributes to.

## ◆ dup()

Glib::RefPtr< FileInfo > Gio::FileInfo::dup | ( |  | ) | const

Duplicates a file info structure.

Returns
  A duplicate FileInfo of other.

## ◆ get_access_date_time()

Glib::DateTime Gio::FileInfo::get_access_date_time | ( |  | ) | const

Gets the access time of the current info and returns it as a DateTime.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_TIME_ACCESS. If G_FILE_ATTRIBUTE_TIME_ACCESS_USEC is provided, the resulting DateTime will additionally have microsecond precision.

If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC must be queried separately using g_file_info_get_attribute_uint32().

Since glibmm 2.70

Returns
  Access time, or nullptr if unknown.

## ◆ get_attribute_as_string()

Glib::ustring Gio::FileInfo::get_attribute_as_string | ( | const std::string & | attribute | ) | const

Gets the value of an attribute, formatted as a human readable string.

This escapes things as needed to make the string valid UTF-8 and readable by humans. It’s not meant to be a machine readable or reversible escaping format.

To format file name attributes of type Gio::FileAttributeType::BYTE_STRING for output as UTF-8, use glib_filename_to_utf8() instead:

[C example ellipted]

Parameters

  attribute | A file attribute key.

Returns
  A UTF-8 string associated with the given attribute, or nullptr if the attribute wasn’t set.

## ◆ get_attribute_boolean()

bool Gio::FileInfo::get_attribute_boolean | ( | const std::string & | attribute | ) | const

Gets the value of a boolean attribute.

If the attribute does not contain a boolean value, false will be returned.

Parameters

  attribute | A file attribute key.

Returns
  The boolean value contained within the attribute.

## ◆ get_attribute_byte_string()

std::string Gio::FileInfo::get_attribute_byte_string | ( | const std::string & | attribute | ) | const

Gets the value of a byte string attribute.

If the attribute does not contain a byte string, nullptr will be returned.

Parameters

  attribute | A file attribute key.

Returns
  The contents of the attribute value as a byte string, or nullptr otherwise.

## ◆ get_attribute_int32()

gint32 Gio::FileInfo::get_attribute_int32 | ( | const std::string & | attribute | ) | const

Gets a signed 32-bit integer contained within the attribute.

If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.

Parameters

  attribute | A file attribute key.

Returns
  A signed 32-bit integer from the attribute.

## ◆ get_attribute_int64()

gint64 Gio::FileInfo::get_attribute_int64 | ( | const std::string & | attribute | ) | const

Gets a signed 64-bit integer contained within the attribute.

If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned.

Parameters

  attribute | A file attribute key.

Returns
  A signed 64-bit integer from the attribute.

## ◆ get_attribute_object()

Glib::RefPtr< Glib::Object > Gio::FileInfo::get_attribute_object | ( | const std::string & | attribute | ) | const

Gets the value of a Object attribute.

If the attribute does not contain a Object, nullptr will be returned.

Parameters

  attribute | A file attribute key.

Returns
  A Object associated with the given attribute, or nullptr otherwise.

## ◆ get_attribute_status()

FileAttributeStatus Gio::FileInfo::get_attribute_status | ( | const std::string & | attribute | ) | const

Gets the attribute status for an attribute key.

Parameters

  attribute | A file attribute key.

Returns
  A FileAttributeStatus for the given attribute, or G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid.

## ◆ get_attribute_string()

Glib::ustring Gio::FileInfo::get_attribute_string | ( | const std::string & | attribute | ) | const

Gets the value of a string attribute.

If the attribute does not contain a string, nullptr will be returned.

Parameters

  attribute | A file attribute key.

Returns
  The contents of the attribute value as a UTF-8 string, or nullptr otherwise.

## ◆ get_attribute_strings()

std::vector< Glib::ustring > Gio::FileInfo::get_attribute_strings | ( | const std::string & | attribute | ) | const

Gets the value of a stringv attribute.

If the attribute does not contain a stringv, nullptr will be returned.

Since glibmm 2.22

Parameters

  attribute | A file attribute key.

Returns
  The contents of the attribute value as a stringv, or nullptr otherwise. Do not free. These returned strings are UTF-8.

## ◆ get_attribute_type()

FileAttributeType Gio::FileInfo::get_attribute_type | ( | const std::string & | attribute | ) | const

Gets the attribute type for an attribute key.

Parameters

  attribute | A file attribute key.

Returns
  A FileAttributeType for the given attribute, or G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set.

## ◆ get_attribute_uint32()

guint32 Gio::FileInfo::get_attribute_uint32 | ( | const std::string & | attribute | ) | const

Gets an unsigned 32-bit integer contained within the attribute.

If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.

Parameters

  attribute | A file attribute key.

Returns
  An unsigned 32-bit integer from the attribute.

## ◆ get_attribute_uint64()

guint64 Gio::FileInfo::get_attribute_uint64 | ( | const std::string & | attribute | ) | const

Gets a unsigned 64-bit integer contained within the attribute.

If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.

Parameters

  attribute | A file attribute key.

Returns
  A unsigned 64-bit integer from the attribute.

## ◆ get_content_type()

Glib::ustring Gio::FileInfo::get_content_type | ( |  | ) | const

Gets the file's content type.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

Returns
  A string containing the file's content type, or nullptr if unknown.

## ◆ get_creation_date_time()

Glib::DateTime Gio::FileInfo::get_creation_date_time | ( |  | ) | const

Gets the creation time of the current info and returns it as a DateTime.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_TIME_CREATED. If G_FILE_ATTRIBUTE_TIME_CREATED_USEC is provided, the resulting DateTime will additionally have microsecond precision.

If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_CREATED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

Since glibmm 2.70

Returns
  Creation time, or nullptr if unknown.

## ◆ get_deletion_date()

Glib::DateTime Gio::FileInfo::get_deletion_date | ( |  | ) | const

Returns the DateTime representing the deletion date of the file, as available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE.

If the G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, nullptr is returned.

Since glibmm 2.36

Returns
  A DateTime, or nullptr.

## ◆ get_display_name()

Glib::ustring Gio::FileInfo::get_display_name | ( |  | ) | const

Gets a display name for a file.

This is guaranteed to always be set.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Returns
  A string containing the display name.

## ◆ get_edit_name()

Glib::ustring Gio::FileInfo::get_edit_name | ( |  | ) | const

Gets the edit name for a file.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

Returns
  A string containing the edit name.

## ◆ get_etag()

Glib::ustring Gio::FileInfo::get_etag | ( |  | ) | const

Gets the [entity tag][iface.nosp@m.@Gio.nosp@m..File#entity-tags] for a given FileInfo.

See G_FILE_ATTRIBUTE_ETAG_VALUE.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_ETAG_VALUE.

Returns
  A string containing the value of the "etag:value" attribute.

## ◆ get_file_type()

FileType Gio::FileInfo::get_file_type | ( |  | ) | const

Gets a file's type (whether it is a regular file, symlink, etc).

This is different from the file's content type, see g_file_info_get_content_type().

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_TYPE.

Returns
  A FileType for the given file.

## ◆ get_icon() [1/2]

Glib::RefPtr< Icon > Gio::FileInfo::get_icon | ( |  | ) |

Gets the icon for a file.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_ICON.

Returns
  Icon for the given info.

## ◆ get_icon() [2/2]

Glib::RefPtr< const Icon > Gio::FileInfo::get_icon | ( |  | ) | const

Gets the icon for a file.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_ICON.

Returns
  Icon for the given info.

## ◆ get_modification_date_time()

Glib::DateTime Gio::FileInfo::get_modification_date_time | ( |  | ) | const

Gets the modification time of the current info and returns it as a DateTime.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_TIME_MODIFIED. If G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting DateTime will additionally have microsecond precision.

If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC must be queried separately using g_file_info_get_attribute_uint32().

Since glibmm 2.62

Returns
  Modification time, or nullptr if unknown.

## ◆ get_name()

std::string Gio::FileInfo::get_name | ( |  | ) | const

Gets the name for a file.

This is guaranteed to always be set.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_NAME.

Returns
  A string containing the file name.

## ◆ get_size()

goffset Gio::FileInfo::get_size | ( |  | ) | const

Gets the file's size (in bytes).

The size is retrieved through the value of the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from #guint64 to #goffset before returning the result.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_SIZE.

Returns
  A #goffset containing the file's size (in bytes).

## ◆ get_sort_order()

gint32 Gio::FileInfo::get_sort_order | ( |  | ) | const

Gets the value of the sort_order attribute from the FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

Returns
  A gint32 containing the value of the "standard::sort_order" attribute.

## ◆ get_symbolic_icon() [1/2]

Glib::RefPtr< Icon > Gio::FileInfo::get_symbolic_icon | ( |  | ) |

Gets the symbolic icon for a file.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Since glibmm 2.34

Returns
  Icon for the given info.

## ◆ get_symbolic_icon() [2/2]

Glib::RefPtr< const Icon > Gio::FileInfo::get_symbolic_icon | ( |  | ) | const

Gets the symbolic icon for a file.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Since glibmm 2.34

Returns
  Icon for the given info.

## ◆ get_symlink_target()

std::string Gio::FileInfo::get_symlink_target | ( |  | ) | const

Gets the symlink target for a given FileInfo.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET.

Returns
  A string containing the symlink target.

## ◆ get_type()

GType Gio::FileInfo::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GFileInfo * Gio::FileInfo::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GFileInfo * Gio::FileInfo::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GFileInfo * Gio::FileInfo::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ has_attribute()

bool Gio::FileInfo::has_attribute | ( | const std::string & | attribute | ) | const

Checks if a file info structure has an attribute named attribute.

Parameters

  attribute | A file attribute key.

Returns
  true if info has an attribute named attribute, false otherwise.

## ◆ has_namespace()

bool Gio::FileInfo::has_namespace | ( | const std::string & | name_space | ) | const

Checks if a file info structure has an attribute in the specified name_space.

Since glibmm 2.22

Parameters

  name_space | A file attribute namespace.

Returns
  true if info has an attribute in name_space, false otherwise.

## ◆ is_backup()

bool Gio::FileInfo::is_backup | ( |  | ) | const

Checks if a file is a backup file.

The exact semantics of what constitutes a backup file are backend-specific. For local files, a file is considered a backup if its name ends with ~ and it is a regular file. This follows the POSIX convention used by text editors such as Emacs.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP.

Returns
  true if file is a backup file, false otherwise.

## ◆ is_hidden()

bool Gio::FileInfo::is_hidden | ( |  | ) | const

Checks if a file is hidden.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

Returns
  true if the file is a hidden file, false otherwise.

## ◆ is_symlink()

bool Gio::FileInfo::is_symlink | ( |  | ) | const

Checks if a file is a symlink.

It is an error to call this if the FileInfo does not contain G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

Returns
  true if the given info is a symlink.

## ◆ list_attributes() [1/2]

std::vector< Glib::ustring > Gio::FileInfo::list_attributes | ( |  | ) | const

A list_attributes() convenience overload.

## ◆ list_attributes() [2/2]

std::vector< Glib::ustring > Gio::FileInfo::list_attributes | ( | const std::string & | name_space | ) | const

Lists the file info structure's attributes.

Parameters

  name_space | A file attribute key's namespace, or nullptr to list all attributes.

Returns
  A null-terminated array of strings of all of the possible attribute types for the given name_space, or nullptr on error.

## ◆ operator=()

FileInfo & Gio::FileInfo::operator= | ( | FileInfo && | src | ) |
| noexcept

## ◆ remove_attribute()

void Gio::FileInfo::remove_attribute | ( | const std::string & | attribute | ) |

Removes all cases of attribute from info if it exists.

Parameters

  attribute | A file attribute key.

## ◆ set_access_date_time()

void Gio::FileInfo::set_access_date_time | ( | const Glib::DateTime & | atime | ) |

Sets the G_FILE_ATTRIBUTE_TIME_ACCESS and G_FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given date/time value.

G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC will be cleared.

Since glibmm 2.70

Parameters

  atime | A DateTime.

## ◆ set_attribute_boolean()

void Gio::FileInfo::set_attribute_boolean | ( | const std::string & | attribute,
|  | bool | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | A boolean value.

## ◆ set_attribute_byte_string()

void Gio::FileInfo::set_attribute_byte_string | ( | const std::string & | attribute,
|  | const std::string & | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | A byte string.

## ◆ set_attribute_int32()

void Gio::FileInfo::set_attribute_int32 | ( | const std::string & | attribute,
|  | gint32 | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | A signed 32-bit integer.

## ◆ set_attribute_int64()

void Gio::FileInfo::set_attribute_int64 | ( | const std::string & | attribute,
|  | gint64 | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | Attribute name to set.
  attr_value | Int64 value to set attribute to.

## ◆ set_attribute_mask()

void Gio::FileInfo::set_attribute_mask | ( | const Glib::RefPtr< FileAttributeMatcher > & | mask | ) |

Sets mask on info to match specific attribute types.

Parameters

  mask | A FileAttributeMatcher.

## ◆ set_attribute_object()

void Gio::FileInfo::set_attribute_object | ( | const std::string & | attribute,
|  | const Glib::RefPtr< Glib::Object > & | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | A Object.

## ◆ set_attribute_status()

bool Gio::FileInfo::set_attribute_status | ( | const std::string & | attribute,
|  | FileAttributeStatus | status )

Sets the attribute status for an attribute key.

This is only needed by external code that implement g_file_set_attributes_from_info() or similar functions.

The attribute must exist in info for this to work. Otherwise false is returned and info is unchanged.

Since glibmm 2.22

Parameters

  attribute | A file attribute key.
  status | A FileAttributeStatus.

Returns
  true if the status was changed, false if the key was not set.

## ◆ set_attribute_string()

void Gio::FileInfo::set_attribute_string | ( | const std::string & | attribute,
|  | const Glib::ustring & | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | A UTF-8 string.

## ◆ set_attribute_strings()

void Gio::FileInfo::set_attribute_strings | ( | const std::string & | attribute,
|  | const std::vector< Glib::ustring > & | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Sinze: 2.22

Parameters

  attribute | A file attribute key.
  attr_value | A nullptr terminated array of UTF-8 strings.

## ◆ set_attribute_uint32()

void Gio::FileInfo::set_attribute_uint32 | ( | const std::string & | attribute,
|  | guint32 | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | An unsigned 32-bit integer.

## ◆ set_attribute_uint64()

void Gio::FileInfo::set_attribute_uint64 | ( | const std::string & | attribute,
|  | guint64 | attr_value )

Sets the attribute to contain the given attr_value, if possible.

Parameters

  attribute | A file attribute key.
  attr_value | An unsigned 64-bit integer.

## ◆ set_content_type()

void Gio::FileInfo::set_content_type | ( | const Glib::ustring & | content_type | ) |

Sets the content type attribute for a given FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

Parameters

  content_type | A content type.

## ◆ set_creation_date_time()

void Gio::FileInfo::set_creation_date_time | ( | const Glib::DateTime & | creation_time | ) |

Sets the G_FILE_ATTRIBUTE_TIME_CREATED and G_FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given date/time value.

G_FILE_ATTRIBUTE_TIME_CREATED_NSEC will be cleared.

Since glibmm 2.70

Parameters

  creation_time | A DateTime.

## ◆ set_display_name()

void Gio::FileInfo::set_display_name | ( | const Glib::ustring & | display_name | ) |

Sets the display name for the current FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Parameters

  display_name | A string containing a display name.

## ◆ set_edit_name()

void Gio::FileInfo::set_edit_name | ( | const Glib::ustring & | edit_name | ) |

Sets the edit name for the current file.

See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

Parameters

  edit_name | A string containing an edit name.

## ◆ set_file_type()

void Gio::FileInfo::set_file_type | ( | FileType | type | ) |

Sets the file type in a FileInfo to type.

See G_FILE_ATTRIBUTE_STANDARD_TYPE.

Parameters

  type | A FileType.

## ◆ set_icon()

void Gio::FileInfo::set_icon | ( | const Glib::RefPtr< Icon > & | icon | ) |

Sets the icon for a given FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_ICON.

Parameters

  icon | A Icon.

## ◆ set_is_hidden()

void Gio::FileInfo::set_is_hidden | ( | bool | hidden = true | ) |

Sets the "is_hidden" attribute in a FileInfo according to hidden.

See G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

Parameters

  hidden | A bool.

## ◆ set_is_symlink()

void Gio::FileInfo::set_is_symlink | ( | bool | symlink = true | ) |

Sets the "is_symlink" attribute in a FileInfo according to symlink.

See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

Parameters

  symlink | A bool.

## ◆ set_modification_date_time()

void Gio::FileInfo::set_modification_date_time | ( | const Glib::DateTime & | mtime | ) |

Sets the G_FILE_ATTRIBUTE_TIME_MODIFIED and G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given date/time value.

G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared.

Since glibmm 2.62

Parameters

  mtime | A DateTime.

## ◆ set_name()

void Gio::FileInfo::set_name | ( | const std::string & | name | ) |

Sets the name attribute for the current FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_NAME.

Parameters

  name | A string containing a name.

## ◆ set_size()

void Gio::FileInfo::set_size | ( | goffset | size | ) |

Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.

Parameters

  size | A #goffset containing the file's size.

## ◆ set_sort_order()

void Gio::FileInfo::set_sort_order | ( | gint32 | sort_order | ) |

Sets the sort order attribute in the file info structure.

See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

Parameters

  sort_order | A sort order integer.

## ◆ set_symbolic_icon()

void Gio::FileInfo::set_symbolic_icon | ( | const Glib::RefPtr< Icon > & | icon | ) |

Sets the symbolic icon for a given FileInfo.

See G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Since glibmm 2.34

Parameters

  icon | A Icon.

## ◆ set_symlink_target()

void Gio::FileInfo::set_symlink_target | ( | const std::string & | symlink_target | ) |

Sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.

Parameters

  symlink_target | A static string containing a path to a symlink target.

## ◆ unset_attribute_mask()

void Gio::FileInfo::unset_attribute_mask | ( |  | ) |

Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gio::FileInfo > wrap | ( | GFileInfo * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.