uiservicetabsettings/inc/cvimpstsettings.h
branchRCL_3
changeset 22 3104fc151679
parent 21 2b7283837edb
child 23 9a48e301e94b
equal deleted inserted replaced
21:2b7283837edb 22:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  settings container.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CVIMPSTSETTINGS_H
       
    19 #define __CVIMPSTSETTINGS_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <s32strm.h>
       
    24 
       
    25 
       
    26 class CVIMPSTSettingsKeyValuePairs;
       
    27  
       
    28 /*
       
    29  * - Key-value pairs.
       
    30  *   Key-value pair mechanism for generic Settings extensions.
       
    31  * 
       
    32  * @since 3.0
       
    33  */
       
    34 
       
    35 class CVIMPSTSettings : public CBase
       
    36     {
       
    37 
       
    38     public:  // Constructors and destructor
       
    39 
       
    40         /**
       
    41          * Two-phased constructor.
       
    42          *
       
    43          * @since 3.0
       
    44          */
       
    45         static CVIMPSTSettings* NewL();
       
    46 
       
    47 
       
    48         /**
       
    49          * Two-phased constructor.
       
    50          *
       
    51          * @since 3.0
       
    52          */
       
    53         static CVIMPSTSettings* NewLC();
       
    54 
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         virtual ~CVIMPSTSettings();
       
    60 
       
    61 
       
    62     private:  // Constructors
       
    63 
       
    64         /**
       
    65          * C++ default constructor.
       
    66          */
       
    67         CVIMPSTSettings();
       
    68 
       
    69 
       
    70     public: //SAP extension
       
    71 
       
    72         /**
       
    73          * Key-value pair setters.
       
    74          *
       
    75          * Stores  arbitrary data for given keyword.
       
    76          * Key-value pairs are stored to flat data structure
       
    77          * in side the target SAP. Different data types
       
    78          * may not share same key name.
       
    79          * Keyword may not contain string "||". Also, the
       
    80          * maximum length for key+value is
       
    81          * NCentralRepositoryConstants::KMaxUnicodeStringLength-5
       
    82          *
       
    83          * @since 3.0
       
    84          * @param aKey Keyword to use to identify the value.
       
    85          * @param aValue Descriptor / integer value to store.
       
    86          * @return KErrNone: Storing the key value was succesful.
       
    87          *         KErrGeneral: Different data type was previously
       
    88          *         associated with given key. Old value will remain
       
    89          *         KErrNoMemory: Out of memory. Old value will remain
       
    90          *		   KErrTooBig: Key+value are too big for storing
       
    91          */
       
    92         
       
    93         TInt SetOpaqueDesC16( const TDesC& aKey, const TDesC16& aValue );
       
    94 
       
    95 
       
    96         /**
       
    97          * Key-value pair getters.
       
    98          *
       
    99          * Gets data previously stored for given keyword.
       
   100          *
       
   101          * @since 3.0
       
   102          * @param aKey Keyword to identify the value.
       
   103          * @param aValue Pointer descriptor / integer where the value is get.
       
   104          *        Pointer descriptor is put to point to requested data.
       
   105          *        Data is owned by the SAP container and stays valid
       
   106          *        untill the container object is destroyed or new
       
   107          *        value for key is assigned.
       
   108          * @return KErrNone: Retrieving the key value was succesful.
       
   109          *         KErrNotFound: No value associated with given key.
       
   110          *         KErrGeneral: Different data type associated with key.
       
   111          */
       
   112 
       
   113         TInt GetOpaqueDesC16( const TDesC& aKey, TPtrC16& aValue ) const;
       
   114 
       
   115 
       
   116         /**
       
   117          * Key-value pair cleanup.
       
   118          *
       
   119          * Deletes previously stored key-value pair.
       
   120          *
       
   121          * @since 3.0
       
   122          * @param aKey Keyword to identify the key-value pair.
       
   123          * @return KErrNone: Key-value pair removed.
       
   124          *         KErrNotFound: Key-value pair not found.
       
   125          */
       
   126         TInt DeleteOpaque( const TDesC& aKey );
       
   127         
       
   128         /**
       
   129          * return keyvalue pairs 
       
   130          */
       
   131         CVIMPSTSettingsKeyValuePairs& KeyValuePairs();
       
   132 
       
   133 
       
   134     private:    // Data
       
   135        
       
   136         CVIMPSTSettingsKeyValuePairs*  iKeyValuePairs; ///< OWN: key value pairs
       
   137 
       
   138     };
       
   139 
       
   140 #endif      // __CVIMPSTSETTINGS_H
       
   141 
       
   142 //  End of File
       
   143