Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: baclipb.h
Link against: bafl.lib

Class CClipboard

CClipboard

Support

Supported from 5.0

Description

Clipboard. A repository of copied data which is available for pasting.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CClipboardClipboard

Defined in CClipboard:
Clear(), CommitL(), CopyToL(), NewForReadingL(), NewForReadingLC(), NewForWritingLC(), PasteFromL(), Store(), StreamDictionary(), ~CClipboard()

Inherited from CBase:
operator new()


Construction and destruction


NewForWritingLC()

static CClipboard* NewForWritingLC(RFs& aFs);

Description

Constructs a clipboard object and prepares the clipboard's store for writing.

If the file associated with the clipboard's store does not exist, it is created; if it already exists, any existing content is discarded.

Parameters

RFs& aFs

A handle to a file server session.

Return value

CClipboard*

A pointer to the newly constructed clipboard object. This pointer is put onto the cleanup stack.


NewForReadingL()

static CClipboard* NewForReadingL(RFs& aFs);

Description

Constructs a clipboard object and prepares the clipboard's store for reading.

Parameters

RFs& aFs

A handle to a file server session.

Return value

CClipboard*

A pointer to the newly constructed clipboard object.

Leave codes

 

The function can leave with one of the system-wide error codes, e.g. KErrNoMemory . If the file associated with the clipboard store either does not exist or is corrupt or is in use, the functions do not leave. In this event, CClipboard 's stream dictionary, CStreamDictionary , is empty and a call to its At() member function with any UID returns KNullStreamId .


NewForReadingLC()

static CClipboard* NewForReadingLC(RFs& aFs);

Description

Constructs a clipboard object and prepares the clipboard's store for reading, placing a pointer to the object on the cleanup stack. This allows the object and allocated resources to be cleaned up if a subsequent leave occurs.

Parameters

RFs& aFs

A handle to a file server session.

Return value

CClipboard*

A pointer to the newly constructed clipboard object. This pointer is put onto the cleanup stack.

Leave codes

 

The function can leave with one of the system-wide error codes, e.g. KErrNoMemory . If the file associated with the clipboard store either does not exist or is corrupt or is in use, the functions do not leave. In this event, CClipboard 's stream dictionary, CStreamDictionary , is empty and a call to its At() member function with any UID returns KNullStreamId .


~CClipboard()

~CClipboard();

Description

Destructor. Frees all resources owned by the object, prior to its destruction. In particular, the file associated with the clipboard's store is closed.

Note that if the clipboard file store has no root stream, i.e. the CommitL() member function of CClipboard has not been called prior to deleting the CClipboard object, then the file associated with the clipboard file store is deleted.

[Top]


Using the clipboard


Clear()

static TInt Clear(RFs& aFs);

Description

Empties the clipboard.

Note that if the file associated with the clipboard's store does not exist, this is not regarded as an error and the function completes successfully.

Parameters

RFs& aFs

A handle to a file server session.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


CommitL()

void CommitL();

Description

Commits changes to the clipboard's store.

It externalises the stream dictionary to the clipboard store as the root stream and then commits all changes to the store. This function must be called after application data has been externalised; failure to do so results in the deletion of the file associated with the clipboard store and the loss of data.


Store()

CStreamStore& Store() const;

Description

Returns a reference to the clipboard's file store.

Return value

CStreamStore&

A reference to the clipboard's store.


StreamDictionary()

CStreamDictionary& StreamDictionary() const;

Description

Returns a reference to the clipboard's stream dictionary.

Return value

CStreamDictionary&

A reference to the clipboard's stream dictionary.

[Top]


Special cases


CopyToL()

void CopyToL(TReal aReal);

Description

Copies a double-precision floating point value to the clipboard.

Note that the function does not automatically commit changes to the clipboard's store. This must be done explicitly.

Parameters

TReal aReal

The double-precision floating point value to be copied to the clipboard.

See also:


PasteFromL()

TBool PasteFromL(TReal& aReal);

Description

Pastes a double-precision floating point value from the clipboard.

If a double-precision floating point value exists on the clipboard, then the function restores it to the referenced argument and returns a true value.

If there is no double-precision floating point value on the clipboard, then the function returns a false value. The referenced argument is not changed.

Parameters

TReal& aReal

On return, contains the double-precision floating point value found on the clipboard.

Return value

TBool

True, if a double-precision floating point value exists on the clipboard and has been pasted to the referenced argument; false otherwise.