PECengine/AttributeLibrary2/Src/CPEngAttrConstructorCon.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Presence attribute constructor container.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPENGATTRCONSTRUCTORCON_H
       
    19 #define CPENGATTRCONSTRUCTORCON_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Base.h>
       
    23 #include <MPEngPresenceAttrTypeProperties2.h>
       
    24 
       
    25 
       
    26 
       
    27 //FORWARD DECLARATION
       
    28 class CPEngPresenceAttrConstructor;
       
    29 class MPEngPresenceAttrConstructorTypeImp;
       
    30 class CPEngSessionSlotObject;
       
    31 
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36  * Presence attribute model constructor container.
       
    37  *
       
    38  * @lib PEngAttrLib
       
    39  * @since 3.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CPEngAttrConstructorCon ) : public CBase
       
    42     {
       
    43 public: /* Construction */
       
    44 
       
    45 
       
    46     /**
       
    47      * Instantiates CPEngAttrConstructorCon object.
       
    48      *
       
    49      * @return New CPEngAttrConstructorCon instance.
       
    50      */
       
    51     static CPEngAttrConstructorCon* NewL( CPEngSessionSlotObject& aOwner );
       
    52 
       
    53 
       
    54     /**
       
    55      * Destructor.
       
    56      */
       
    57     ~CPEngAttrConstructorCon();
       
    58 
       
    59 
       
    60 private:
       
    61 
       
    62     /**
       
    63      * C++ constructor.
       
    64      */
       
    65     CPEngAttrConstructorCon( CPEngSessionSlotObject& aOwner );
       
    66 
       
    67 
       
    68 
       
    69 public: // Constructor management
       
    70 
       
    71 
       
    72     /**
       
    73      * Adds new attribute type constructor.
       
    74      * Takes always the ownership of given aTypeConstructor object.
       
    75      *
       
    76      * @param aTypeConstructor The type constructor.
       
    77      * @param aType The attribute type.
       
    78      * @param aOrigin The attribute origin setting.
       
    79      */
       
    80     void AddConstructorL( MPEngPresenceAttrConstructorTypeImp* aTypeConstructor,
       
    81                           TUint32 aType,
       
    82                           TPEngAttributeOriginator aOrigin );
       
    83 
       
    84     /**
       
    85      * Finds a constructor by attribute type.
       
    86      *
       
    87      * @param aType The attribute type.
       
    88      * @return The attribute constructor. NULL if no constructor
       
    89      * found for requested type. Constructor ownership stays
       
    90      * on the container.
       
    91      */
       
    92     CPEngPresenceAttrConstructor* FindByType( TUint32 aType );
       
    93 
       
    94 
       
    95     /**
       
    96      * Finds a constructor by attribute type.
       
    97      * Leaves if the attribute type is unknown.
       
    98      *
       
    99      * @param aType The attribute type.
       
   100      * @return The attribute constructor.
       
   101      * Constructor ownership stays on the container.
       
   102      */
       
   103     CPEngPresenceAttrConstructor& FindByTypeL( TUint32 aType );
       
   104 
       
   105 
       
   106     /**
       
   107      * Gets a TArray presenting known attribute types.
       
   108      *
       
   109      * @return The TArray of known attribute types.
       
   110      */
       
   111     TArray<TUint32> TypeArray() const;
       
   112 
       
   113 
       
   114 
       
   115 
       
   116 private:    // Reference access for CPEngPresenceAttrConstructor
       
   117 
       
   118     /**
       
   119      * CPEngPresenceAttrConstructor is a friend
       
   120      * so it can increase / decrease reference count when needed.
       
   121      *
       
   122      * @since 3.0
       
   123      */
       
   124     friend class CPEngPresenceAttrConstructor;      // CSI: 36 #
       
   125 
       
   126 
       
   127     /**
       
   128      * Opens a reference to container.
       
   129      *
       
   130      * @since 3.0
       
   131      */
       
   132     void OpenRef();
       
   133 
       
   134 
       
   135     /**
       
   136      * Closes a reference to container.
       
   137      *
       
   138      * @since 3.0
       
   139      */
       
   140     void CloseRef();
       
   141 
       
   142 
       
   143 
       
   144 
       
   145 private:    // Helpers
       
   146 
       
   147 
       
   148     /**
       
   149      * Assertion function to verify attribute
       
   150      * constructor contents.
       
   151      * @param aConstructor The constructor instance to verify.
       
   152      */
       
   153     void __AssertConstructorValidL( const CPEngPresenceAttrConstructor& aConstructor );
       
   154 
       
   155 
       
   156     /**
       
   157      * TArray accessor functions for attribute type list.
       
   158      */
       
   159     static TInt GetTypeCount( const CBase* aPtr );
       
   160     static const TAny* GetTypePtr( const CBase* aPtr, TInt aIndex );
       
   161 
       
   162 
       
   163 
       
   164 private:    // Data
       
   165 
       
   166     //REF: The Presence Attribute Manger owning this container
       
   167     CPEngSessionSlotObject&  iOwner;
       
   168 
       
   169 
       
   170     //OWN: The attribute constructors.
       
   171     RPointerArray< CPEngPresenceAttrConstructor > iConstructors;
       
   172 
       
   173     };
       
   174 
       
   175 
       
   176 
       
   177 #endif      // CPENGATTRCONSTRUCTORCON_H
       
   178 
       
   179 // End of File