2001-11-25 21:32:41 +03:00
|
|
|
#ifndef CCLIPBOARD_H
|
|
|
|
#define CCLIPBOARD_H
|
|
|
|
|
|
|
|
//
|
|
|
|
// CClipboard -- stores clipboard data in a memory buffer
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "IClipboard.h"
|
|
|
|
#include "CString.h"
|
|
|
|
|
|
|
|
class CClipboard : public IClipboard {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-11-25 21:32:41 +03:00
|
|
|
CClipboard();
|
|
|
|
virtual ~CClipboard();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
|
|
|
// unmarshall clipboard data
|
2002-04-29 17:31:44 +04:00
|
|
|
void unmarshall(const CString& data, Time);
|
2001-11-25 21:32:41 +03:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// marshall clipboard data
|
|
|
|
CString marshall() const;
|
|
|
|
|
|
|
|
// IClipboard overrides
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual bool empty();
|
2001-11-25 21:32:41 +03:00
|
|
|
virtual void add(EFormat, const CString& data);
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual bool open(Time) const;
|
|
|
|
virtual void close() const;
|
2002-04-29 17:31:44 +04:00
|
|
|
virtual Time getTime() const;
|
2001-11-25 21:32:41 +03:00
|
|
|
virtual bool has(EFormat) const;
|
|
|
|
virtual CString get(EFormat) const;
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// transfer all the data in one clipboard to another. the
|
|
|
|
// clipboards can be of any concrete clipboard type (and
|
2002-04-29 17:31:44 +04:00
|
|
|
// they don't have to be the same type). this also sets
|
|
|
|
// the timestamp to time, if provided, or the time in src.
|
2002-05-27 20:22:59 +04:00
|
|
|
// returns true iff the copy succeeded.
|
|
|
|
static bool copy(IClipboard* dst, const IClipboard* src);
|
|
|
|
static bool copy(IClipboard* dst, const IClipboard* src, Time);
|
2001-11-25 21:32:41 +03:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-11-25 21:32:41 +03:00
|
|
|
UInt32 readUInt32(const char*) const;
|
|
|
|
void writeUInt32(CString*, UInt32) const;
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2002-05-27 20:22:59 +04:00
|
|
|
mutable bool m_open;
|
|
|
|
mutable Time m_time;
|
|
|
|
bool m_owner;
|
|
|
|
Time m_timeOwned;
|
2001-11-25 21:32:41 +03:00
|
|
|
bool m_added[kNumFormats];
|
|
|
|
CString m_data[kNumFormats];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|