ximpfw/presence/srcpresencedatamodel/presenceinfo/presenceinfofieldcollectionimp.h
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Implementation of presence info field collection.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPRESENCEINFOFIELDCOLLECTIONIMP_H
       
    20 #define CPRESENCEINFOFIELDCOLLECTIONIMP_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <s32strm.h> // RWriteStream, RReadStream
       
    24 #include <ximpbase.h>
       
    25 #include <ximpdatamodelifids.hrh>
       
    26 #include "ximpapidataobjbase.h"
       
    27 #include "presenceapiobjbase.h"
       
    28 #include "presencetypehelpers.h"
       
    29 #include "presenceinfofieldcollection.h"
       
    30 
       
    31 class MPresenceInfoField;
       
    32 class CPresenceInfoFilterImp;
       
    33 
       
    34 /**
       
    35  * Implementation of presence info field collection.
       
    36  *
       
    37  *
       
    38  *
       
    39  *
       
    40  * @ingroup ximpdatamodelapi
       
    41  * @since S60 v3.2
       
    42  */
       
    43 NONSHARABLE_CLASS( CPresenceInfoFieldCollectionImp ): public CXIMPApiDataObjBase, 
       
    44     public MPresenceInfoFieldCollection
       
    45     {
       
    46 public:
       
    47 
       
    48     /** The class ID. */
       
    49     enum { KClassId = PRIMP_CLSID_CPRESENCEINFOFIELDCOLLECTIONIMP };
       
    50 
       
    51 public:
       
    52 
       
    53     IMPORT_C static CPresenceInfoFieldCollectionImp* NewLC();
       
    54 
       
    55     virtual ~CPresenceInfoFieldCollectionImp();
       
    56 
       
    57 private:
       
    58 
       
    59     CPresenceInfoFieldCollectionImp();
       
    60 
       
    61     void ConstructL();
       
    62 
       
    63     /**
       
    64      * @see CXIMPApiDataObjBase
       
    65      */
       
    66     XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS
       
    67 
       
    68 public: // From MXIMPBase
       
    69 
       
    70     /**
       
    71      * Implementation of MXIMPBase interface methods
       
    72      * @see MXIMPBase
       
    73      */
       
    74     XIMPIMP_DECLARE_IF_BASE_METHODS
       
    75 
       
    76     /**
       
    77      * @see CXIMPApiDataObjBase
       
    78      */
       
    79     XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS
       
    80 
       
    81 public: // New functions
       
    82 
       
    83     /**
       
    84      * Internalizes object data from given stream.
       
    85      * @param aStream Stream to read.
       
    86      */
       
    87     IMPORT_C void InternalizeL( RReadStream& aStream );
       
    88 
       
    89 
       
    90 public: // from MPresenceInfoFieldCollection
       
    91 
       
    92     /**
       
    93      * @see MPresenceInfoFieldCollection
       
    94      */
       
    95     TInt FieldCount() const;
       
    96 
       
    97     /**
       
    98      * @see MPresenceInfoFieldCollection
       
    99      */
       
   100     const MPresenceInfoField& FieldAt(
       
   101             TInt aIndex ) const;
       
   102 
       
   103     /**
       
   104      * @see MPresenceInfoFieldCollection
       
   105      */
       
   106     void LookupFieldByFieldType(
       
   107             MPresenceInfoField*& aPresenceInfoField,
       
   108             const TDesC8& aMatch ) const;
       
   109             
       
   110     /**
       
   111      * @see MPresenceInfoFieldCollection
       
   112      */
       
   113     TInt DeleteFieldByFieldType(const TDesC8& aMatch );
       
   114 
       
   115     /**
       
   116      * @see MPresenceInfoFieldCollection
       
   117      */
       
   118     void AddOrReplaceFieldL(
       
   119             MPresenceInfoField* aPresenceInfoField );
       
   120 
       
   121 public: // new methods
       
   122 
       
   123     /**
       
   124      * Remove from this field collection the field
       
   125      * at the given index.
       
   126      */
       
   127     void RemoveField( TInt aIndex );
       
   128 
       
   129 private: // helpers
       
   130 
       
   131     /** 
       
   132      * Find index, starting at the given object.
       
   133      * @return KErrNotFound if not found
       
   134      * @return Otherwise returns the index of given object
       
   135      */
       
   136     TInt FindIndexOfObj( MPresenceInfoField*& aObject ) const;
       
   137 
       
   138 private: // data
       
   139 
       
   140     /**
       
   141      * OWN: The fields stored in this collection
       
   142      */
       
   143     RPrInfoFieldArray iFields;
       
   144     };
       
   145 
       
   146 #endif // CPRESENCEINFOFIELDCOLLECTIONIMP_H
       
   147 
       
   148 
       
   149