IClipboard Class Reference

Clipboard interface. More...

#include <IClipboard.h>

Inherits IInterface.

Inherited by CClipboard, CMSWindowsClipboard, COSXClipboard, and CXWindowsClipboard.

Inheritance diagram for IClipboard:

Inheritance graph
[legend]
Collaboration diagram for IClipboard:

Collaboration graph
[legend]
List of all members.

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 CString get (EFormat) const =0
 Get data.
static CString marshall (const IClipboard *clipboard)
 Marshall clipboard data.
static void unmarshall (IClipboard *clipboard, const CString &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.

Public Types

typedef UInt32 Time
 Timestamp type.
 kText
 Text format, UTF-8, newline is LF.
 kBitmap
 Bitmap format, BMP 24/32bpp, BI_RGB.
 kHTML
 HTML format, HTML fragment, UTF-8, newline is LF.
 kNumFormats
 The number of clipboard formats.
enum  EFormat { kText, kBitmap, kHTML, kNumFormats }
 Clipboard formats. More...

Public Member Functions

manipulators
virtual bool empty ()=0
 Empty clipboard.
virtual void add (EFormat, const CString &data)=0
 Add data.

Detailed Description

Clipboard interface.

This interface defines the methods common to all clipboards.

Definition at line 26 of file IClipboard.h.


Member Typedef Documentation

typedef UInt32 IClipboard::Time

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.

Definition at line 34 of file IClipboard.h.


Member Enumeration Documentation

enum IClipboard::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.
kBitmap  Bitmap format, BMP 24/32bpp, BI_RGB.
kHTML  HTML format, HTML fragment, UTF-8, newline is LF.
kNumFormats  The number of clipboard formats.

Definition at line 55 of file IClipboard.h.


Member Function Documentation

virtual void IClipboard::add ( EFormat  ,
const CString &  data 
) [pure virtual]

Add data.

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

Referenced by copy(), and unmarshall().

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 CMSWindowsClipboard, COSXClipboard, CXWindowsClipboard, and CClipboard.

Referenced by copy(), marshall(), and unmarshall().

bool IClipboard::copy ( IClipboard dst,
const IClipboard src,
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.

Definition at line 112 of file IClipboard.cpp.

References add(), close(), empty(), get(), has(), kNumFormats, and open().

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.

Definition at line 103 of file IClipboard.cpp.

References getTime().

Referenced by CXWindowsScreen::getClipboard(), COSXScreen::getClipboard(), CMSWindowsScreen::getClipboard(), CClientProxy1_0::getClipboard(), CXWindowsScreen::setClipboard(), COSXScreen::setClipboard(), CMSWindowsScreen::setClipboard(), and CClientProxy1_0::setClipboard().

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 CMSWindowsClipboard, COSXClipboard, CXWindowsClipboard, and CClipboard.

Referenced by copy(), and unmarshall().

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

Referenced by copy(), and marshall().

virtual Time IClipboard::getTime (  )  const [pure virtual]

Get time.

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

Implemented in CMSWindowsClipboard, COSXClipboard, CXWindowsClipboard, and CClipboard.

Referenced by copy().

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

Referenced by copy(), and marshall().

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

Definition at line 62 of file IClipboard.cpp.

References close(), get(), has(), kNumFormats, and open().

Referenced by CClipboard::marshall(), and CServerProxy::onClipboardChanged().

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.

Referenced by copy(), marshall(), and unmarshall().

void IClipboard::unmarshall ( IClipboard clipboard,
const CString &  data,
Time  time 
) [static]

Unmarshall clipboard data.

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

Definition at line 23 of file IClipboard.cpp.

References add(), close(), empty(), kNumFormats, and open().

Referenced by CClipboard::unmarshall().


The documentation for this class was generated from the following files:
Generated on Fri Nov 6 00:19:19 2009 for synergy-plus by  doxygen 1.4.7