gtkmm 4.16.0
|
Advertising and negotiating of content exchange formats. More...
#include <gdkmm/contentformats.h>
Public Member Functions | |
void | reference () const |
Increment the reference count for this object. | |
void | unreference () const |
Decrement the reference count for this object. | |
GdkContentFormats * | gobj () |
Provides access to the underlying C instance. | |
const GdkContentFormats * | gobj () const |
Provides access to the underlying C instance. | |
GdkContentFormats * | gobj_copy () const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
ContentFormats ()=delete | |
ContentFormats (const ContentFormats &)=delete | |
ContentFormats & | operator= (const ContentFormats &)=delete |
Glib::ustring | to_string () const |
Prints the given ContentFormats into a string for human consumption. | |
std::vector< GType > | get_gtypes () const |
Gets the Types included in the ContentFormats. | |
std::vector< Glib::ustring > | get_mime_types () const |
Gets the mime types included in the ContentFormats. | |
bool | contain_gtype (GType type) const |
Checks if a given GType is part of the given formats. | |
bool | contain_mime_type (const Glib::ustring & mime_type) const |
Checks if a given mime type is part of the given formats. | |
Glib::RefPtr< ContentFormats > | join (const Glib::RefPtr< const ContentFormats > & second) const |
Append all missing types from second to *this , in the order they had in second. | |
bool | match (const Glib::RefPtr< const ContentFormats > & second) const |
Checks if first and second have any matching formats. | |
GType | match_gtype (const Glib::RefPtr< const ContentFormats > & second) const |
Finds the first GType from first that is also contained in second. | |
Glib::ustring | match_mime_type (const Glib::RefPtr< const ContentFormats > & second) const |
Finds the first mime type from *this that is also contained in second. | |
Static Public Member Functions | |
static Glib::RefPtr< ContentFormats > | create (const std::vector< Glib::ustring > & mime_types={}) |
Creates a new Gdk::ContentFormats from an array of mime types. | |
static Glib::RefPtr< ContentFormats > | create (const Glib::ustring & mime_type) |
Creates a new Gdk::ContentFormats from a mime type. | |
static Glib::RefPtr< ContentFormats > | create (GType type) |
Creates a new Gdk::ContentFormats from a GType. | |
static Glib::RefPtr< ContentFormats > | parse (const Glib::ustring &string) |
Parses the given string into Gdk::ContentFormats and returns the formats. | |
Protected Member Functions | |
void | operator delete (void *, std::size_t) |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::ContentFormats > | wrap (GdkContentFormats * object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Advertising and negotiating of content exchange formats.
Gdk::ContentFormats is used to advertise and negotiate the format of content passed between different widgets, windows or applications using for example the clipboard or drag'n'drop.
GDK supports content in 2 forms: GType and mime type. Using GTypes is meant only for in-process content transfers. Mime types are meant to be used for data passing both in-process and out-of-process. The details of how data is passed is described in the documentation of the actual implementations.
A Gdk::ContentFormats describes a set of possible formats content can be exchanged in. It is assumed that this set is ordered. GTypes are more important than mime types. Order between different Gtypes or mime types is the order they were added in, most important first. Functions that care about order, such as join(), describe in their documentation how they interpret that order, though in general the order of the first argument is considered the primary order of the result, followed by the order of further arguments.
For debugging purposes, the function to_string() exists. It will print a comma-separated list of formats from most important to least important.
Gdk::ContentFormats is an immutable object. After creation, you cannot change the types it represents. Instead, new Gdk::ContentFormats have to be created. Gdk::ContentFormatsBuilder is meant to help in this endeavor.
|
delete |
|
delete |
bool Gdk::ContentFormats::contain_gtype | ( | GType | type | ) | const |
Checks if a given GType
is part of the given formats.
type | The GType to search for. |
true
if the GType
was found. bool Gdk::ContentFormats::contain_mime_type | ( | const Glib::ustring & | mime_type | ) | const |
Checks if a given mime type is part of the given formats.
mime_type | The mime type to search for. |
true
if the mime_type was found.
|
static |
Creates a new Gdk::ContentFormats from a mime type.
mime_type | A mime type. |
|
static |
Creates a new Gdk::ContentFormats from an array of mime types.
The mime types must be different or the behavior of the return value is undefined. If you cannot guarantee this, use Gdk::ContentFormatsBuilder instead.
mime_types | A vector of mime types. |
|
static |
Creates a new Gdk::ContentFormats from a GType.
type | A GType. |
std::vector< GType > Gdk::ContentFormats::get_gtypes | ( | ) | const |
Gets the Types included in the ContentFormats.
Note that they may not contain any Types, in particular when they are empty. In that case an empty vector will be returned.
std::vector< Glib::ustring > Gdk::ContentFormats::get_mime_types | ( | ) | const |
Gets the mime types included in the ContentFormats.
Note that they may not contain any mime types, in particular when they are empty. In that case an empty vector will be returned.
GdkContentFormats * Gdk::ContentFormats::gobj | ( | ) |
Provides access to the underlying C instance.
const GdkContentFormats * Gdk::ContentFormats::gobj | ( | ) | const |
Provides access to the underlying C instance.
GdkContentFormats * Gdk::ContentFormats::gobj_copy | ( | ) | const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< ContentFormats > Gdk::ContentFormats::join | ( | const Glib::RefPtr< const ContentFormats > & | second | ) | const |
Append all missing types from second to *this
, in the order they had in second.
second | The ContentFormats to merge from. |
bool Gdk::ContentFormats::match | ( | const Glib::RefPtr< const ContentFormats > & | second | ) | const |
Checks if first and second have any matching formats.
second | The Gdk::ContentFormats to intersect with. |
true
if a matching format was found. GType Gdk::ContentFormats::match_gtype | ( | const Glib::RefPtr< const ContentFormats > & | second | ) | const |
Finds the first GType
from first that is also contained in second.
If no matching GType
is found, G_TYPE_INVALID is returned.
second | The Gdk::ContentFormats to intersect with. |
GType
or G_TYPE_INVALID if none. Glib::ustring Gdk::ContentFormats::match_mime_type | ( | const Glib::RefPtr< const ContentFormats > & | second | ) | const |
Finds the first mime type from *this
that is also contained in second.
If no matching mime type is found, an empty string is returned.
second | The Gdk::ContentFormats to intersect with. |
|
protected |
|
delete |
|
static |
Parses the given string into Gdk::ContentFormats
and returns the formats.
Strings printed via to_string() can be read in again successfully using this function.
If string does not describe valid content formats, nullptr
is returned.
string | The string to parse. |
void Gdk::ContentFormats::reference | ( | ) | const |
Increment the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
Glib::ustring Gdk::ContentFormats::to_string | ( | ) | const |
Prints the given ContentFormats into a string for human consumption.
The resulting string can be parsed with parse().
void Gdk::ContentFormats::unreference | ( | ) | const |
Decrement the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
|
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. |