--- a/Symbian3/PDK/Source/GUID-442F2E69-87B5-54E7-B62A-70B742432372.dita Tue Jul 20 12:00:49 2010 +0100
+++ b/Symbian3/PDK/Source/GUID-442F2E69-87B5-54E7-B62A-70B742432372.dita Fri Aug 13 16:47:46 2010 +0100
@@ -1,82 +1,82 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
-<!-- This component and the accompanying materials are made available under the terms of the License
-"Eclipse Public License v1.0" which accompanies this distribution,
-and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
-<!-- Initial Contributors:
- Nokia Corporation - initial contribution.
-Contributors:
--->
-<!DOCTYPE concept
- PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
-<concept id="GUID-442F2E69-87B5-54E7-B62A-70B742432372" xml:lang="en"><title>How
-to Commit and Revert </title><shortdesc>Changes to a store are not made permanent until they are committed
-and until such changes are committed, they can be rolled back (i.e. reverted)</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
-<p>Transactions are supported by a commit and revert protocol.</p>
-<p>In the following code fragment, <codeph>store</codeph> is a pointer to
-an opened permanent file store. The function <codeph>doUpdateStoreL()</codeph> adds
-a number of streams to this store and, if successful, establishes a new commit
-point.</p>
-<p>If a failure occurs or the call to <codeph>CommitL()</codeph> fails, then <codeph>doUpdateStoreL()</codeph> leaves;
-the leave is trapped and any changes made to the store are rolled back, so
-that the store is in the same state as it was before the changes were started.
-The store, therefore, remains in a consistent state in the event of failure.</p>
-<p><codeph>CItemArray</codeph> is a class that encapsulates an array of <codeph>TItem</codeph> objects;
-the relevant part of the definition is:</p>
-<codeblock id="GUID-0B5B04A7-AB4A-55CA-BCF0-9E19623F1554" xml:space="preserve">typedef TBuf<100> TItem;</codeblock>
-<codeblock id="GUID-52A3FAC2-4E23-5574-A21C-DE087ADDB911" xml:space="preserve">class CItemArray : public CBase
- {
-public:
- ...
- void AddItemL(const TItem& anItem);
- void StoreL() const;
- void ExternalizeL(RWriteStream& aStream) const;
- ...
-private:
- CStreamStore& iStore;
- ...
- CArrayFixFlat<TStreamId>* iArray;
- }</codeblock>
-<p>The example also assumes that the store is one that allows streams to be
-modified and replaced; for example, a permanent file store.</p>
-<codeblock id="GUID-21AFD117-3D52-55BE-BEB7-430CF08D0429" xml:space="preserve">...
-TRAPD(error,doUpdateStoreL(*store));
-if (error!=KErrNone)
- {
- store->Revert();
- ...
- }
-...</codeblock>
-<codeblock id="GUID-EB07D2AA-ECAA-5014-84F0-85767A60E366" xml:space="preserve">LOCAL_C void doUpdateStoreL(CPersistentStore& aStore)
- {
- _LIT(KTxtHello,"hello");
- _LIT(KtxtWorld," world!");
- // get the root stream into memory
- CItemArray* array=CItemArray::NewLC(aStore,aStore.Root());
-
- // Add some items
- TItem item;
- item = KTxtHello;
- array->AddItemL(item);
- item = KTxtWorld;
- array->AddItemL(item);
- // Re-write the root stream with new data
- array->StoreL();
- // commit all changes
- aStore.CommitL();
- ...
- }</codeblock>
-<codeblock id="GUID-3E2184DA-7C74-58F0-925E-6AE1317732C9" xml:space="preserve">void CItemArray::AddItemL(const TItem& anItem)
- {
- RStoreWriteStream outstream;
- TStreamId id=outstream.CreateLC(iStore);
- outstream<<anItem;
- outstream.CommitL();
- CleanupStack::PopAndDestroy();
- iArray->AppendL(id);
- }
-</codeblock>
-</conbody><related-links>
-<link href="GUID-C9D8D913-C65F-5A69-A606-30F59BFB38E2.dita"><linktext>File Stores</linktext>
-</link>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License
+"Eclipse Public License v1.0" which accompanies this distribution,
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+ Nokia Corporation - initial contribution.
+Contributors:
+-->
+<!DOCTYPE concept
+ PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-442F2E69-87B5-54E7-B62A-70B742432372" xml:lang="en"><title>How
+to Commit and Revert </title><shortdesc>Changes to a store are not made permanent until they are committed
+and until such changes are committed, they can be rolled back (i.e. reverted)</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>Transactions are supported by a commit and revert protocol.</p>
+<p>In the following code fragment, <codeph>store</codeph> is a pointer to
+an opened permanent file store. The function <codeph>doUpdateStoreL()</codeph> adds
+a number of streams to this store and, if successful, establishes a new commit
+point.</p>
+<p>If a failure occurs or the call to <codeph>CommitL()</codeph> fails, then <codeph>doUpdateStoreL()</codeph> leaves;
+the leave is trapped and any changes made to the store are rolled back, so
+that the store is in the same state as it was before the changes were started.
+The store, therefore, remains in a consistent state in the event of failure.</p>
+<p><codeph>CItemArray</codeph> is a class that encapsulates an array of <codeph>TItem</codeph> objects;
+the relevant part of the definition is:</p>
+<codeblock id="GUID-0B5B04A7-AB4A-55CA-BCF0-9E19623F1554" xml:space="preserve">typedef TBuf<100> TItem;</codeblock>
+<codeblock id="GUID-52A3FAC2-4E23-5574-A21C-DE087ADDB911" xml:space="preserve">class CItemArray : public CBase
+ {
+public:
+ ...
+ void AddItemL(const TItem& anItem);
+ void StoreL() const;
+ void ExternalizeL(RWriteStream& aStream) const;
+ ...
+private:
+ CStreamStore& iStore;
+ ...
+ CArrayFixFlat<TStreamId>* iArray;
+ }</codeblock>
+<p>The example also assumes that the store is one that allows streams to be
+modified and replaced; for example, a permanent file store.</p>
+<codeblock id="GUID-21AFD117-3D52-55BE-BEB7-430CF08D0429" xml:space="preserve">...
+TRAPD(error,doUpdateStoreL(*store));
+if (error!=KErrNone)
+ {
+ store->Revert();
+ ...
+ }
+...</codeblock>
+<codeblock id="GUID-EB07D2AA-ECAA-5014-84F0-85767A60E366" xml:space="preserve">LOCAL_C void doUpdateStoreL(CPersistentStore& aStore)
+ {
+ _LIT(KTxtHello,"hello");
+ _LIT(KtxtWorld," world!");
+ // get the root stream into memory
+ CItemArray* array=CItemArray::NewLC(aStore,aStore.Root());
+
+ // Add some items
+ TItem item;
+ item = KTxtHello;
+ array->AddItemL(item);
+ item = KTxtWorld;
+ array->AddItemL(item);
+ // Re-write the root stream with new data
+ array->StoreL();
+ // commit all changes
+ aStore.CommitL();
+ ...
+ }</codeblock>
+<codeblock id="GUID-3E2184DA-7C74-58F0-925E-6AE1317732C9" xml:space="preserve">void CItemArray::AddItemL(const TItem& anItem)
+ {
+ RStoreWriteStream outstream;
+ TStreamId id=outstream.CreateLC(iStore);
+ outstream<<anItem;
+ outstream.CommitL();
+ CleanupStack::PopAndDestroy();
+ iArray->AppendL(id);
+ }
+</codeblock>
+</conbody><related-links>
+<link href="GUID-C9D8D913-C65F-5A69-A606-30F59BFB38E2.dita"><linktext>File Stores</linktext>
+</link>
</related-links></concept>
\ No newline at end of file