diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-AA5DEEB2-0B13-5FA8-8494-EC2F5C654FEF.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-AA5DEEB2-0B13-5FA8-8494-EC2F5C654FEF.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,57 @@ + + + + + +CentRepExample: +Using central repository for persistent storage +

This example application demonstrates the usage of Central Repository API +for persistent storage.

+
Description

Several +Symbian OS components have state and settings information that need to be +persistent. There is also a global state that needs to persist, for example, +default filenames, locale settings, user preferences.

The CentRep +example application first registers a group of settings with the central repository +server. It uses E80000AD.txt, a UTF-16 format text file +to initialise the repository. This text file contains access control structure +and the initial content of the repository. It is recommended to convert the +initialisation text file into a binary file using the central repository converter +tool to speed up the execution.

The application creates a CRepository object +using the CRepository::NewLC() method to access a repository +using its UID. It resets the whole repository using CRepository::Reset() method +with the contents in the initialisation file.

Each setting stored +in the repository will have a unique key to identify the setting. This unique +key is used to read and change the setting by calling the CRepository::Get() and CRepository::Set() methods +respectively. The application moves these keys to a different location using CRepository::Move() method +and deletes them from their original location.

The application also +creates another CRepository object to demonstrate that, at +any given point a repository cannot be opened with READ/WRITE access +by more than one client. In such situations, it is recommended to start a +transaction before a write operation using CRepository::StartTransaction() method. +A transaction guarantees the consistency and persistence of all values read +and written during the transaction.

Finally, the application requests +the central repository server to notify any changes to the original settings.

Related +APIs

    +
  • CRepository - Provides access to a repository.

  • +
  • CRepository::Get()

  • +
  • CRepository::Move()

  • +
  • CRepository::NewLC()

  • +
  • CRepository::Reset()

  • +
  • CRepository::Set()

  • +
  • CRepository::StartTransaction()

  • +
+
Download

Click on the following link to download +the example: CentRepExample.zip

Click: browse to view the example code.

+
Build

The Symbian OS build process describes +how to build an application.

The CentRepExample builds +an executable called CentRepExample.exe in the standard +location (\epoc32\release\winscw\<build_variant > for CodeWarrior). +After launching the executable, depending on the emulator you are using, you +may need to task away from the app launcher/shell screen to view the console.

+
\ No newline at end of file