Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IClipboard Class Referenceabstract

Clipboard interface. More...

#include <IClipboard.h>

Inheritance diagram for IClipboard:
Collaboration diagram for IClipboard:

Public Types

enum  EFormat { kText , kHTML , kBitmap , kNumFormats }
 Clipboard formats. More...
using Time = uint32_t
 Timestamp type.

Public Member Functions

manipulators
virtual bool empty ()=0
 Empty clipboard.
virtual void add (EFormat, const std::string &data)=0
 Add data.
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

accessors

virtual bool open (Time time) const =0
 Open clipboard.
virtual void close () const =0
 Close clipboard.
virtual Time getTime () const =0
 Get time.
virtual bool has (EFormat) const =0
 Check for data.
virtual std::string get (EFormat) const =0
 Get data.
static std::string marshall (const IClipboard *clipboard)
 Marshall clipboard data.
static void unmarshall (IClipboard *clipboard, const std::string_view &data, Time time)
 Unmarshall clipboard data.
static bool copy (IClipboard *dst, const IClipboard *src)
 Copy clipboard.
static bool copy (IClipboard *dst, const IClipboard *src, Time)
 Copy clipboard.

Detailed Description

Clipboard interface.

This interface defines the methods common to all clipboards.

Member Typedef Documentation

◆ Time

using IClipboard::Time = uint32_t

Timestamp type.

Timestamp type. Timestamps are in milliseconds from some arbitrary starting time. Timestamps will wrap around to 0 after about 49 3/4 days.

Member Enumeration Documentation

◆ EFormat

Clipboard formats.

The list of known clipboard formats. kNumFormats must be last and formats must be sequential starting from zero. Clipboard data set via add() and retrieved via get() must be in one of these formats. Platform dependent clipboard subclasses can and should present any suitable formats derivable from these formats.

kText is a text format encoded in UTF-8. Newlines are LF (not CR or LF/CR).

kBitmap is an image format. The data is a BMP file without the 14 byte header (i.e. starting at the INFOHEADER) and with the image data immediately following the 40 byte INFOHEADER.

kHTML is a text format encoded in UTF-8 and containing a valid HTML fragment (but not necessarily a complete HTML document). Newlines are LF.

Enumerator
kText 

Text format, UTF-8, newline is LF.

kHTML 

HTML format, HTML fragment, UTF-8, newline is LF.

kBitmap 

Bitmap format, BMP 24/32bpp, BI_RGB.

kNumFormats 

The number of clipboard formats.

Member Function Documentation

◆ add()

virtual void IClipboard::add ( EFormat ,
const std::string & data )
pure virtual

Add data.

Add data in the given format to the clipboard. May only be called after a successful empty().

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ close()

virtual void IClipboard::close ( ) const
pure virtual

Close clipboard.

Close the clipboard. close() must match a preceding successful open(). This signals that the clipboard has been filled with all the necessary data or all data has been read. It does not mean the clipboard ownership should be released (if it was taken).

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ copy() [1/2]

bool IClipboard::copy ( IClipboard * dst,
const IClipboard * src )
static

Copy clipboard.

Transfers all the data in one clipboard to another. The clipboards can be of any concrete clipboard type (and they don't have to be the same type). This also sets the destination clipboard's timestamp to source clipboard's timestamp. Returns true iff the copy succeeded.

◆ copy() [2/2]

bool IClipboard::copy ( IClipboard * dst,
const IClipboard * src,
Time time )
static

Copy clipboard.

Transfers all the data in one clipboard to another. The clipboards can be of any concrete clipboard type (and they don't have to be the same type). This also sets the timestamp to time. Returns true iff the copy succeeded.

◆ empty()

virtual bool IClipboard::empty ( )
pure virtual

Empty clipboard.

Take ownership of the clipboard and clear all data from it. This must be called between a successful open() and close(). Return false if the clipboard ownership could not be taken; the clipboard should not be emptied in this case.

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ get()

virtual std::string IClipboard::get ( EFormat ) const
pure virtual

Get data.

Return the data in the given format. Returns the empty string if there is no data in that format. Must be called between a successful open() and close().

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ getTime()

virtual Time IClipboard::getTime ( ) const
pure virtual

Get time.

Return the timestamp passed to the last successful open().

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ has()

virtual bool IClipboard::has ( EFormat ) const
pure virtual

Check for data.

Return true iff the clipboard contains data in the given format. Must be called between a successful open() and close().

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ marshall()

std::string IClipboard::marshall ( const IClipboard * clipboard)
static

Marshall clipboard data.

Merge clipboard's data into a single buffer that can be later unmarshalled to restore the clipboard and return the buffer.

◆ open()

virtual bool IClipboard::open ( Time time) const
pure virtual

Open clipboard.

Open the clipboard. Return true iff the clipboard could be opened. If open() returns true then the client must call close() at some later time; if it returns false then close() must not be called. time should be the current time or a time in the past when the open should effectively have taken place.

Implemented in Clipboard, MSWindowsClipboard, OSXClipboard, and XWindowsClipboard.

◆ unmarshall()

void IClipboard::unmarshall ( IClipboard * clipboard,
const std::string_view & data,
Time time )
static

Unmarshall clipboard data.

Extract marshalled clipboard data and store it in clipboard. Sets the clipboard time to time.


The documentation for this class was generated from the following files: