glibmm
2.42.0
|
FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes. More...
#include <giomm/fileinfo.h>
Public Member Functions | |
virtual | ~FileInfo () |
GFileInfo* | gobj () |
Provides access to the underlying C GObject. More... | |
const GFileInfo* | gobj () const |
Provides access to the underlying C GObject. More... | |
GFileInfo* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
FileInfo () | |
Glib::RefPtr< FileInfo > | dup () const |
Duplicates a file info structure. More... | |
void | copy_into (Glib::RefPtr< FileInfo >& dest_info) const |
Copies all of the [GFileAttribute][gio-GFileAttribute] from src_info to dest_info. More... | |
bool | has_attribute (const std::string& attribute) const |
Checks if a file info structure has an attribute named attribute. More... | |
bool | has_namespace (const std::string& name_space) const |
Checks if a file info structure has an attribute in the specified name_space. More... | |
Glib::StringArrayHandle | list_attributes (const std::string& name_space) const |
Lists the file info structure's attributes. More... | |
FileAttributeType | get_attribute_type (const std::string& attribute) const |
Gets the attribute type for an attribute key. More... | |
void | remove_attribute (const std::string& attribute) |
Removes all cases of attribute from info if it exists. More... | |
FileAttributeStatus | get_attribute_status (const std::string& attribute) const |
Gets the attribute status for an attribute key. More... | |
std::string | get_attribute_string (const std::string& attribute) const |
Gets the value of a string attribute. More... | |
std::vector< Glib::ustring > | get_attribute_strings (const std::string& attribute) const |
Gets the value of a stringv attribute. More... | |
Glib::ustring | get_attribute_as_string (const std::string& attribute) const |
Gets the value of a attribute, formated as a string. More... | |
std::string | get_attribute_byte_string (const std::string& attribute) const |
Gets the value of a byte string attribute. More... | |
bool | get_attribute_boolean (const std::string& attribute) const |
Gets the value of a boolean attribute. More... | |
guint32 | get_attribute_uint32 (const std::string& attribute) const |
Gets an unsigned 32-bit integer contained within the attribute. More... | |
gint32 | get_attribute_int32 (const std::string& attribute) const |
Gets a signed 32-bit integer contained within the attribute. More... | |
guint64 | get_attribute_uint64 (const std::string& attribute) const |
Gets a unsigned 64-bit integer contained within the attribute. More... | |
gint64 | get_attribute_int64 (const std::string& attribute) const |
Gets a signed 64-bit integer contained within the attribute. More... | |
Glib::RefPtr< Glib::Object > | get_attribute_object (const std::string& attribute) const |
Gets the value of a Object attribute. More... | |
bool | set_attribute_status (const std::string& attribute, FileAttributeStatus status) |
Sets the attribute status for an attribute key. More... | |
void | set_attribute_string (const std::string& attribute, const std::string& attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
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. More... | |
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. More... | |
void | set_attribute_boolean (const std::string& attribute, bool attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
void | set_attribute_uint32 (const std::string& attribute, guint32 attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
void | set_attribute_int32 (const std::string& attribute, gint32 attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
void | set_attribute_uint64 (const std::string& attribute, guint64 attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
void | set_attribute_int64 (const std::string& attribute, gint64 attr_value) |
Sets the attribute to contain the given attr_value, if possible. More... | |
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. More... | |
void | clear_status () |
Clears the status information from info. More... | |
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. More... | |
FileType | get_file_type () const |
Gets a file's type (whether it is a regular file, symlink, etc). More... | |
bool | is_hidden () const |
Checks if a file is hidden. More... | |
bool | is_backup () const |
Checks if a file is a backup file. More... | |
bool | is_symlink () const |
Checks if a file is a symlink. More... | |
std::string | get_name () const |
Gets the name for a file. More... | |
std::string | get_display_name () const |
Gets a display name for a file. More... | |
std::string | get_edit_name () const |
Gets the edit name for a file. More... | |
Glib::RefPtr< Icon > | get_icon () |
Gets the icon for a file. More... | |
Glib::RefPtr< const Icon > | get_icon () const |
Gets the icon for a file. More... | |
Glib::RefPtr< Icon > | get_symbolic_icon () |
Gets the symbolic icon for a file. More... | |
Glib::RefPtr< const Icon > | get_symbolic_icon () const |
Gets the symbolic icon for a file. More... | |
std::string | get_content_type () const |
Gets the file's content type. More... | |
goffset | get_size () const |
Gets the file's size. More... | |
Glib::TimeVal | modification_time () const |
std::string | get_symlink_target () const |
Gets the symlink target for a given FileInfo. More... | |
std::string | get_etag () const |
Gets the [entity tag][gfile-etag] for a given FileInfo. More... | |
gint32 | get_sort_order () const |
Gets the value of the sort_order attribute from the FileInfo. More... | |
void | set_attribute_mask (const Glib::RefPtr< FileAttributeMatcher >& mask) |
Sets mask on info to match specific attribute types. More... | |
void | unset_attribute_mask () |
Unsets a mask set by g_file_info_set_attribute_mask(), if one is set. More... | |
void | set_file_type (FileType type) |
Sets the file type in a FileInfo to type. More... | |
void | set_is_hidden (bool is_hidden=true) |
Sets the "is_hidden" attribute in a FileInfo according to is_hidden. More... | |
void | set_is_symlink (bool is_symlink=true) |
Sets the "is_symlink" attribute in a FileInfo according to is_symlink. More... | |
void | set_name (const std::string& name) |
Sets the name attribute for the current FileInfo. More... | |
void | set_display_name (const std::string& display_name) |
Sets the display name for the current FileInfo. More... | |
void | set_edit_name (const std::string& edit_name) |
Sets the edit name for the current file. More... | |
void | set_icon (const Glib::RefPtr< Icon >& icon) |
Sets the icon for a given FileInfo. More... | |
void | set_symbolic_icon (const Glib::RefPtr< Icon >& icon) |
Sets the symbolic icon for a given FileInfo. More... | |
void | set_content_type (const std::string& content_type) |
Sets the content type attribute for a given FileInfo. More... | |
void | set_size (goffset size) |
Sets the FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size. More... | |
void | set_modification_time (const Glib::TimeVal& mtime) |
Sets the FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file info to the given time value. More... | |
void | set_symlink_target (const std::string& symlink_target) |
Sets the FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target. More... | |
void | set_sort_order (gint32 sort_order) |
Sets the sort order attribute in the file info structure. More... | |
![]() | |
void* | get_data (const QueryQuark& key) |
void | set_data (const Quark& key, void* data) |
void | set_data (const Quark& key, void* data, DestroyNotify notify) |
void | remove_data (const QueryQuark& quark) |
void* | steal_data (const QueryQuark& quark) |
![]() | |
void | set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value) |
You probably want to use a specific property_*() accessor method instead. More... | |
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const |
You probably want to use a specific property_*() accessor method instead. More... | |
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. More... | |
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. More... | |
void | 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, but this is necessary when using the reduced API. More... | |
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, const sigc::slot< void >& slot) |
You can use the signal_changed() signal of the property proxy instead, but this is necessary when using the reduced API. More... | |
void | freeze_notify () |
Increases the freeze count on object. More... | |
void | thaw_notify () |
Reverts the effect of a previous call to freeze_notify(). More... | |
virtual void | reference () const |
Increment the reference count for this object. More... | |
virtual void | unreference () const |
Decrement the reference count for this object. More... | |
GObject* | gobj () |
Provides access to the underlying C GObject. More... | |
const GObject* | gobj () const |
Provides access to the underlying C GObject. More... | |
GObject* | gobj_copy () const |
Give a ref-ed copy to someone. Use for direct struct access. More... | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gio::FileInfo > | wrap (GFileInfo* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
![]() | |
Glib::RefPtr< Glib::Object > | wrap (GObject* object, bool take_copy=false) |
Additional Inherited Members | |
![]() | |
typedef void(* | DestroyNotify )(gpointer data) |
![]() | |
Object () | |
Object (const Glib::ConstructParams& construct_params) | |
Object (GObject* castitem) | |
virtual | ~Object () |
![]() | |
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. More... | |
ObjectBase (const char* custom_type_name) | |
A derived constructor always overrides this choice. More... | |
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. More... | |
virtual | ~ObjectBase ()=0 |
void | initialize (GObject* castitem) |
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.
|
virtual |
Gio::FileInfo::FileInfo | ( | ) |
void Gio::FileInfo::clear_status | ( | ) |
Clears the status information from info.
void Gio::FileInfo::copy_into | ( | Glib::RefPtr< FileInfo >& | dest_info | ) | const |
Copies all of the [GFileAttribute][gio-GFileAttribute] from src_info to dest_info.
dest_info | Destination to copy attributes to. |
Glib::RefPtr<FileInfo> Gio::FileInfo::dup | ( | ) | const |
Duplicates a file info structure.
Glib::ustring Gio::FileInfo::get_attribute_as_string | ( | const std::string & | attribute | ) | const |
Gets the value of a attribute, formated as a string.
This escapes things as needed to make the string valid utf8.
attribute | A file attribute key. |
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.
attribute | A file attribute key. |
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, 0
will be returned.
attribute | A file attribute key. |
0
otherwise. 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.
attribute | A file attribute key. |
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 an signed 64-bit integer, or is invalid, 0 will be returned.
attribute | A file attribute key. |
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, 0
will be returned.
attribute | A file attribute key. |
0
otherwise. FileAttributeStatus Gio::FileInfo::get_attribute_status | ( | const std::string & | attribute | ) | const |
Gets the attribute status for an attribute key.
attribute | A file attribute key. |
std::string 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, 0
will be returned.
attribute | A file attribute key. |
0
otherwise. 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, 0
will be returned.
attribute | A file attribute key. |
0
otherwise. Do not free. These returned strings are UTF-8. FileAttributeType Gio::FileInfo::get_attribute_type | ( | const std::string & | attribute | ) | const |
Gets the attribute type for an attribute key.
attribute | A file attribute key. |
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.
attribute | A file attribute key. |
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.
attribute | A file attribute key. |
std::string Gio::FileInfo::get_content_type | ( | ) | const |
Gets the file's content type.
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, 0
is returned.
0
. std::string Gio::FileInfo::get_display_name | ( | ) | const |
Gets a display name for a file.
std::string Gio::FileInfo::get_edit_name | ( | ) | const |
Gets the edit name for a file.
std::string Gio::FileInfo::get_etag | ( | ) | const |
Gets the [entity tag][gfile-etag] for a given FileInfo.
See FILE_ATTRIBUTE_ETAG_VALUE.
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().
Glib::RefPtr<Icon> Gio::FileInfo::get_icon | ( | ) |
Gets the icon for a file.
Glib::RefPtr<const Icon> Gio::FileInfo::get_icon | ( | ) | const |
Gets the icon for a file.
std::string Gio::FileInfo::get_name | ( | ) | const |
Gets the name for a file.
goffset Gio::FileInfo::get_size | ( | ) | const |
Gets the file's size.
gint32 Gio::FileInfo::get_sort_order | ( | ) | const |
Gets the value of the sort_order attribute from the FileInfo.
See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
Glib::RefPtr<Icon> Gio::FileInfo::get_symbolic_icon | ( | ) |
Glib::RefPtr<const Icon> Gio::FileInfo::get_symbolic_icon | ( | ) | const |
std::string Gio::FileInfo::get_symlink_target | ( | ) | const |
Gets the symlink target for a given FileInfo.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
bool Gio::FileInfo::has_attribute | ( | const std::string & | attribute | ) | const |
Checks if a file info structure has an attribute named attribute.
attribute | A file attribute key. |
true
if Ginfo has an attribute named attribute, false
otherwise. 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.
name_space | A file attribute namespace. |
true
if Ginfo has an attribute in name_space, false
otherwise. bool Gio::FileInfo::is_backup | ( | ) | const |
Checks if a file is a backup file.
true
if file is a backup file, false
otherwise. bool Gio::FileInfo::is_hidden | ( | ) | const |
Checks if a file is hidden.
true
if the file is a hidden file, false
otherwise. bool Gio::FileInfo::is_symlink | ( | ) | const |
Checks if a file is a symlink.
true
if the given info is a symlink. Glib::StringArrayHandle Gio::FileInfo::list_attributes | ( | const std::string & | name_space | ) | const |
Lists the file info structure's attributes.
name_space | A file attribute key's namespace. |
0
on error. Glib::TimeVal Gio::FileInfo::modification_time | ( | ) | const |
void Gio::FileInfo::remove_attribute | ( | const std::string & | attribute | ) |
Removes all cases of attribute from info if it exists.
attribute | A file attribute key. |
void Gio::FileInfo::set_attribute_boolean | ( | const std::string & | attribute, |
bool | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | A file attribute key. |
attr_value | A boolean value. |
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.
attribute | A file attribute key. |
attr_value | A byte string. |
void Gio::FileInfo::set_attribute_int32 | ( | const std::string & | attribute, |
gint32 | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | A file attribute key. |
attr_value | A signed 32-bit integer. |
void Gio::FileInfo::set_attribute_int64 | ( | const std::string & | attribute, |
gint64 | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | Attribute name to set. |
attr_value | Int64 value to set attribute to. |
void Gio::FileInfo::set_attribute_mask | ( | const Glib::RefPtr< FileAttributeMatcher >& | mask | ) |
Sets mask on info to match specific attribute types.
mask | A FileAttributeMatcher. |
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.
attribute | A file attribute key. |
attr_value | A Object. |
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.
attribute | A file attribute key. |
status | A FileAttributeStatus. |
true
if the status was changed, false
if the key was not set. void Gio::FileInfo::set_attribute_string | ( | const std::string & | attribute, |
const std::string & | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | A file attribute key. |
attr_value | A UTF-8 string. |
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
attribute | A file attribute key. |
attr_value | A 0 terminated array of UTF-8 strings. |
void Gio::FileInfo::set_attribute_uint32 | ( | const std::string & | attribute, |
guint32 | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | A file attribute key. |
attr_value | An unsigned 32-bit integer. |
void Gio::FileInfo::set_attribute_uint64 | ( | const std::string & | attribute, |
guint64 | attr_value | ||
) |
Sets the attribute to contain the given attr_value, if possible.
attribute | A file attribute key. |
attr_value | An unsigned 64-bit integer. |
void Gio::FileInfo::set_content_type | ( | const std::string & | content_type | ) |
Sets the content type attribute for a given FileInfo.
See FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
content_type | A content type. See [GContentType][gio-GContentType]. |
void Gio::FileInfo::set_display_name | ( | const std::string & | display_name | ) |
Sets the display name for the current FileInfo.
See FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
display_name | A string containing a display name. |
void Gio::FileInfo::set_edit_name | ( | const std::string & | edit_name | ) |
Sets the edit name for the current file.
See FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
edit_name | A string containing an edit name. |
void Gio::FileInfo::set_file_type | ( | FileType | type | ) |
Sets the file type in a FileInfo to type.
See FILE_ATTRIBUTE_STANDARD_TYPE.
type | A FileType. |
void Gio::FileInfo::set_icon | ( | const Glib::RefPtr< Icon >& | icon | ) |
void Gio::FileInfo::set_is_hidden | ( | bool | is_hidden = true | ) |
Sets the "is_hidden" attribute in a FileInfo according to is_hidden.
See FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
is_hidden | A bool . |
void Gio::FileInfo::set_is_symlink | ( | bool | is_symlink = true | ) |
Sets the "is_symlink" attribute in a FileInfo according to is_symlink.
See FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
is_symlink | A bool . |
void Gio::FileInfo::set_modification_time | ( | const Glib::TimeVal& | mtime | ) |
Sets the FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file info to the given time value.
mtime | A TimeVal. |
void Gio::FileInfo::set_name | ( | const std::string & | name | ) |
Sets the name attribute for the current FileInfo.
See FILE_ATTRIBUTE_STANDARD_NAME.
name | A string containing a name. |
void Gio::FileInfo::set_size | ( | goffset | size | ) |
Sets the FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.
size | A #goffset containing the file's size. |
void Gio::FileInfo::set_sort_order | ( | gint32 | sort_order | ) |
Sets the sort order attribute in the file info structure.
See FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
sort_order | A sort order integer. |
void Gio::FileInfo::set_symbolic_icon | ( | const Glib::RefPtr< Icon >& | icon | ) |
void Gio::FileInfo::set_symlink_target | ( | const std::string & | symlink_target | ) |
Sets the FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.
symlink_target | A static string containing a path to a symlink target. |
void Gio::FileInfo::unset_attribute_mask | ( | ) |
Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.
|
related |
A Glib::wrap() method for this object.
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. |