Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Clipboard Class Reference

Memory buffer clipboard. More...

#include <Clipboard.h>

Inheritance diagram for Clipboard:
Collaboration diagram for Clipboard:

Public Member Functions

 Clipboard ()
 ~Clipboard () override=default
manipulators
void unmarshall (const std::string &data, Time time)
 Unmarshall clipboard data.
Public Member Functions inherited from IClipboard
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

accessors

std::string marshall () const
 Marshall clipboard data.
bool empty () final
 Empty clipboard.
void add (EFormat, const std::string &data) override
 Add data.
bool open (Time) const final
 Open clipboard.
void close () const override
 Close clipboard.
Time getTime () const override
 Get time.
bool has (EFormat) const override
 Check for data.
std::string get (EFormat) const override
 Get data.

Additional Inherited Members

Public Types inherited from IClipboard
enum  EFormat { kText , kHTML , kBitmap , kNumFormats }
 Clipboard formats. More...
using Time = uint32_t
 Timestamp type.
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

Memory buffer clipboard.

This class implements a clipboard that stores data in memory.

Constructor & Destructor Documentation

◆ Clipboard()

Clipboard::Clipboard ( )

◆ ~Clipboard()

Clipboard::~Clipboard ( )
overridedefault

Member Function Documentation

◆ add()

void Clipboard::add ( EFormat ,
const std::string & data )
overridevirtual

Add data.

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

Implements IClipboard.

◆ close()

void Clipboard::close ( ) const
overridevirtual

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).

Implements IClipboard.

◆ empty()

bool Clipboard::empty ( )
finalvirtual

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.

Implements IClipboard.

◆ get()

std::string Clipboard::get ( EFormat ) const
overridevirtual

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().

Implements IClipboard.

◆ getTime()

Clipboard::Time Clipboard::getTime ( ) const
overridevirtual

Get time.

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

Implements IClipboard.

◆ has()

bool Clipboard::has ( EFormat ) const
overridevirtual

Check for data.

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

Implements IClipboard.

◆ marshall()

std::string Clipboard::marshall ( ) const

Marshall clipboard data.

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

◆ open()

bool Clipboard::open ( Time time) const
finalvirtual

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.

Implements IClipboard.

◆ unmarshall()

void Clipboard::unmarshall ( const std::string & data,
Time time )

Unmarshall clipboard data.

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


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