upnpharvester/common/cmlibrary/inc/cmsqlpropertycontainer.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     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:      Capsulating property item objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __CMSQLPROPERTYCONTAINER_H
       
    24 #define __CMSQLPROPERTYCONTAINER_H
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 #include "cmcommontypes.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class RWriteStream;
       
    32 class RReadStream;
       
    33 class CCmSqlPropertyItem;
       
    34 
       
    35 /**
       
    36  *  CCmSqlPropertyContainer class
       
    37  *  Capsulating property item objects
       
    38  *  @lib cmcommon.lib
       
    39  *  @since S60 v3.0
       
    40  */
       
    41 class CCmSqlPropertyContainer : public CBase
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /* Constructors and destructor. */
       
    47 
       
    48     /**
       
    49      * Creates new CCmSqlPropertyContainer class.
       
    50      * @param None
       
    51      * @return  pointer to CCmSqlPropertyContainer class
       
    52      */
       
    53     IMPORT_C static CCmSqlPropertyContainer* NewL();
       
    54 
       
    55     /**
       
    56      * Creates new CCmSqlPropertyContainer class and
       
    57      * leaves the instance in the cleanup stack.
       
    58      * @return  pointer to CCmSqlPropertyContainer class
       
    59      */
       
    60     IMPORT_C static CCmSqlPropertyContainer* NewLC();
       
    61 
       
    62     /**
       
    63      * Destructor.
       
    64      */
       
    65     IMPORT_C virtual ~CCmSqlPropertyContainer();
       
    66 
       
    67 public:
       
    68 
       
    69     /**
       
    70     *
       
    71     * @since Series 60 3.1
       
    72     * @param CCmSqlPropertyItem*
       
    73     */
       
    74     IMPORT_C void AddPropertyItemL( CCmSqlPropertyItem* aItem );
       
    75 
       
    76     /**
       
    77     *
       
    78     * @since Series 60 3.1
       
    79     * @param aIndex
       
    80     */
       
    81     IMPORT_C void DeletePropertyItem( TInt aIndex );
       
    82 
       
    83     /**
       
    84     *
       
    85     * @since Series 60 3.1
       
    86     * @param aIndex
       
    87     * @return CCmSqlPropertyItem*
       
    88     */
       
    89     IMPORT_C CCmSqlPropertyItem* PropertyItem( TInt aIndex );
       
    90 
       
    91     /**
       
    92     *
       
    93     * @since Series 60 3.1
       
    94     * @return TInt
       
    95     */
       
    96     IMPORT_C TInt PropertyItemCount() const;
       
    97 
       
    98     /**
       
    99     *
       
   100     * @since Series 60 3.1
       
   101     * @return TInt
       
   102     */
       
   103     IMPORT_C void SetType( TCmMetadataField aType );
       
   104 
       
   105     /**
       
   106     *
       
   107     * @since Series 60 3.1
       
   108     * @return TCmMetadataField
       
   109     */
       
   110     IMPORT_C TCmMetadataField Type( );
       
   111 
       
   112     /**
       
   113     *
       
   114     * @since Series 60 3.1
       
   115     * @param aItem, item to be checked
       
   116     * @return ETrue if duplicate
       
   117     */
       
   118     IMPORT_C TBool IsDuplicate( CCmSqlPropertyItem& aItem );
       
   119 
       
   120 public:
       
   121 
       
   122     /**
       
   123     * Externalizes container information to stream.
       
   124     * Leaves in case of errors.
       
   125     * @since Series 60 3.1
       
   126     * @param reference to RWriteStream
       
   127     * @return none
       
   128     */
       
   129     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   130 
       
   131     /**
       
   132     * Internalizes container information from stream.
       
   133     * Leaves in case of errors.
       
   134     * @since Series 60 3.1
       
   135     * @param reference to RReadStream
       
   136     * @return none
       
   137     */
       
   138     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   139 
       
   140 
       
   141     /**
       
   142      * Sort item by alphabet
       
   143      * @since S60 5.1
       
   144      *
       
   145      * @param None
       
   146      * @return none
       
   147      */
       
   148     IMPORT_C void SortPropertyItem( );
       
   149 
       
   150 protected:
       
   151 
       
   152     /**
       
   153      * Constructor.
       
   154      */
       
   155     CCmSqlPropertyContainer();
       
   156 
       
   157     /**
       
   158      * Second-phase constructor.
       
   159      */
       
   160     void ConstructL();
       
   161 
       
   162     /**
       
   163      * The function which determines the order of two class T type objects
       
   164      *
       
   165      * @since S60 5.1
       
   166      * @param aItemOne, first item
       
   167      * @param aItemTwo, second item
       
   168      * @return TInt, match value
       
   169      */
       
   170     static TInt CompareItem( const CCmSqlPropertyItem& aItemOne,
       
   171                                 const CCmSqlPropertyItem& aItemTwo );
       
   172                                 
       
   173 private: // data
       
   174 
       
   175     RPointerArray<CCmSqlPropertyItem> iPropertyItems; // items owned
       
   176     TCmMetadataField                  iType;
       
   177     };
       
   178 
       
   179 
       
   180 #endif //  __CMSQLPROPERTYCONTAINER_H