Clipboard contents, stored as multiple type representations of the same data.
Clipboard data is stored in multiple formats, keyed by MIME type (eg, text/plain, text/html) or an application-defined type string.
Building a Payload
Use ClipboardData::Create() to create a payload, then call Set() to add entries. Set() is chainable, so you can build a multi-format payload in one expression:
data->Set("text/html", "<b>hello world</b>");
static RefPtr< ClipboardData > Create()
Create an empty payload.
Entry order is preserved: when you build a payload yourself you should add the richest format first (the order the OS clipboard will advertise them in).
- Note
- Use bare MIME types (text/plain, not text/plain;charset=utf-8)– the library normalizes charset-suffixes at its own boundaries.
|
| virtual ClipboardData & | Set (const String &type, const ClipboardValue &value)=0 |
| | Set the value for a type (replaces any existing entry with the same type).
|
| virtual ClipboardData & | Remove (const String &type)=0 |
| | Remove the entry for a type (does nothing if no such entry exists).
|
| virtual bool | Has (const String &type) const =0 |
| | Whether or not an entry exists for a type.
|
| virtual ClipboardValue | Get (const String &type) const =0 |
| | Get the value for a type (an empty value when no such entry exists).
|
| virtual String | AsText () const =0 |
| | Get the text/plain entry's text (an empty string when there is none, or when that entry holds bytes).
|
| virtual String | AsHTML () const =0 |
| | Get the text/html entry's text (an empty string when there is none, or when that entry holds bytes).
|
| virtual size_t | size () const =0 |
| | Get the number of entries.
|
| virtual String | type_at (size_t index) const =0 |
| | Get the type of the entry at a certain index, in insertion order (an empty string when index is out of range).
|
| virtual String | source_url () const =0 |
| | Get the URL of the document this payload came from (can be empty).
|
| virtual void | set_source_url (const String &url)=0 |
| | Set the URL of the document this payload came from.
|
| virtual void | AddRef () const =0 |
| | Increment the reference count (thread-safe).
|
| virtual void | Release () const =0 |
| | Decrement the reference count (thread-safe).
|
| virtual int | ref_count () const =0 |
| | Get the current reference count.
|
| virtual WeakControlBlock * | weak_control_block () const |
| | Get the control block used to track weak references to this object.
|