Applications must construct an RDictionaryWriteStream
object before they can write to a stream located in a dictionary store.
To prepare a stream for writing, use the
RDictionaryWriteStream::AssignL()
or
RDictionaryWriteStream::AssignLC()
functions, passing a reference
to the dictionary store and the UID associated with the stream.
If no stream is associated with the UID, then a new stream is created. An association is made between the resulting stream ID and the UID.
If a stream is currently associated with the specified UID, then the existing stream is prepared for replacement.
The following code fragment is typical. store
is a
pointer to an opened dictionary store.
RDictionaryWriteStream::AssignLC()
opens the stream associated
with the UID theuid
and prepares the stream for writing:
...
TUid theuid;
CDictionaryStore* store;
...
RDictionaryWriteStream outstream;
outstream.AssignLC(*store,theuid);
TSomeData data;
...
outstream << data;
outstream.CommitL()
CleanupStack::PopAndDestroy(); // cleanup the write stream
...
store->CommitL(); // commit changes to the dictionary store
...