A content type is a platform specific string that defines the type of a file.
More...
A content type is a platform specific string that defines the type of a file.
On UNIX it is a mime type like "text/plain" or "image/png". On Win32 it is an extension string like ".doc", ".txt" or a perceived string like "audio". Such strings can be looked up in the registry at HKEY_CLASSES_ROOT.
◆ content_type_can_be_executable()
bool Gio::content_type_can_be_executable |
( |
const Glib::ustring & |
type | ) |
|
Checks if a content type can be executable.
Note that for instance things like text files can be executables (i.e. scripts and batch files).
- Parameters
-
type | a content type string. |
- Returns
- true if the file type corresponds to a type that can be executable, false otherwise.
◆ content_type_equals()
Compares two content types for equality.
- Parameters
-
type1 | A content type string. |
type2 | A content type string. |
- Returns
- true if the two strings are identical or equivalent, false otherwise.
◆ content_type_from_mime_type()
Tries to find a content type based on the mime type name.
- Parameters
-
mime_type | a mime type string. |
- Returns
- string with content type or empty when it does not know.
- Since glibmm 2.20:
◆ content_type_get_description()
Gets the human readable description of the content type.
- Parameters
-
type | A content type string. |
- Returns
- a short description of the content type type.
◆ content_type_get_icon()
Gets the icon for a content type.
- Parameters
-
type | A content type string. |
- Returns
- Icon corresponding to the content type.
◆ content_type_get_mime_type()
Gets the mime-type for the content type, if one is registered.
- Parameters
-
type | A content type string. |
- Returns
- the registered mime-type for the given type, or an empty string if unknown.
◆ content_type_get_symbolic_icon()
Gets the symbolic icon for a content type.
- Parameters
-
type | A content type string. |
- Returns
- symbolic Icon corresponding to the content type.
- Since glibmm 2.34:
◆ content_type_guess() [1/2]
Glib::ustring Gio::content_type_guess |
( |
const std::string & |
filename, |
|
|
const guchar * |
data, |
|
|
gsize |
data_size, |
|
|
bool & |
result_uncertain |
|
) |
| |
Guesses the content type based on example data.
If the function is uncertain, result_uncertain will be set to true. Either filename may be an empty string or data may be 0
, in which case the guess will be based solely on the other argument.
- Parameters
-
| filename | a string. |
| data | A stream of data. |
| data_size | The size of data. |
[out] | result_uncertain | A flag indicating the certainty of the result. |
- Returns
- A string indicating a guessed content type for the given data.
◆ content_type_guess() [2/2]
Guesses the content type based on example data.
If the function is uncertain, result_uncertain will be set to true. filename may be an empty string, in which case the guess will be based solely on data.
- Parameters
-
| filename | a string. |
| data | A stream of data. |
[out] | result_uncertain | A flag indicating the certainty of the result. |
- Returns
- A string indicating a guessed content type for the given data.
◆ content_type_guess_for_tree()
Tries to guess the type of the tree with root root, by looking at the files it contains.
The result is a list of content types, with the best guess coming first.
The types returned all have the form x-content/foo, e.g. x-content/audio-cdda (for audio CDs) or x-content/image-dcf (for a camera memory card). See the shared-mime-info specification for more on x-content types.
- Parameters
-
root | The root of the tree to guess a type for. |
- Returns
- List of zero or more content types.
- Since glibmm 2.18:
◆ content_type_is_a()
Determines if type is a subset of supertype.
- Parameters
-
type | A content type string. |
supertype | A content type string. |
- Returns
- true if type is a kind of supertype, false otherwise.
◆ content_type_is_unknown()
Checks if the content type is the generic "unknown" type.
On unix this is the "application/octet-stream" mimetype, while on win32 it is "*".
- Parameters
-
type | A content type string. |
- Returns
- true if the type is the unknown type.
◆ content_types_get_registered()
Gets a list of strings containing all the registered content types known to the system.
- Returns
- List of the registered content types.