PECengine/AttributeLibrary2/Src/PEngAttributeStoreIDCodec.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Codec to code attribute type and presence id.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __PENGATTRIBUTESTOREIDCODEC_H
       
    19 #define __PENGATTRIBUTESTOREIDCODEC_H
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include <E32Std.h>
       
    24 
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 /**
       
    29  * Codec to code attribute type and presence id
       
    30  * as one store id descriptor.
       
    31  *
       
    32  * @since 3.0
       
    33  */
       
    34 NONSHARABLE_CLASS( PEngAttributeStoreIDCodec )
       
    35     {
       
    36 public: // New encode / decode functions
       
    37 
       
    38 
       
    39     /**
       
    40      * Generates a attribute store id from given
       
    41      * attribute type and presence id.
       
    42      *
       
    43      * @since 3.0
       
    44      * @param aAttributeType The type of the attribute
       
    45      * @param aPresenceID The presenceID of the attribute
       
    46      * @return Attribute StoreId.
       
    47      */
       
    48     static HBufC* GenerateStoreIdL( TUint32 aAttributeType,
       
    49                                     const TDesC& aPresenceId );
       
    50 
       
    51 
       
    52 
       
    53 
       
    54     /**
       
    55      * Resolves attribute type and owner presence id
       
    56      * from store id.
       
    57      *
       
    58      * @since 3.0
       
    59      * @param aStoreId The store id to resolve.
       
    60      * @param aAttributeType On succesful return contains resolved attribute type.
       
    61      * @param aPresenceId On successful return contains resolved presence id.
       
    62      * Returned aPresenceId is valid only lifetime of given source store id.
       
    63      * @return KErrNone if succesful. KErrCorrupt if given aStoreId
       
    64      * isn't valid attribute store id.
       
    65      */
       
    66     static TInt ResolveStoreId( const TDesC& aStoreId,
       
    67                                 TUint32& aAttributeType,
       
    68                                 TPtrC& aPresenceId );
       
    69 
       
    70 
       
    71 
       
    72 public: // Match functions
       
    73 
       
    74     /**
       
    75      * Checks is there given attribute type present in given store id.
       
    76      *
       
    77      * @since 3.0
       
    78      * @param aStoreId Store id to check.
       
    79      * @param aAttributeType Attribute type to find.
       
    80      */
       
    81     static TBool AttributeTypePresentInStoreId( const TDesC& aStoreId,
       
    82                                                 TUint32 aAttributeType );
       
    83 
       
    84 
       
    85     /**
       
    86      * Checks is there given presence id present in given store id.
       
    87      *
       
    88      * @since 3.0
       
    89      * @param aStoreId Store id to check.
       
    90      * @param aPresenceId Presence id to find.
       
    91      */
       
    92     static TBool PresenceIdPresentInStoreId( const TDesC& aStoreId,
       
    93                                              const TDesC& aPresenceId );
       
    94 
       
    95 
       
    96 
       
    97 private: //protected constructor & destructor
       
    98 
       
    99     PEngAttributeStoreIDCodec();
       
   100     ~PEngAttributeStoreIDCodec();
       
   101     };
       
   102 
       
   103 #endif      //__PENGATTRIBUTESTOREIDCODEC_H
       
   104 
       
   105 
       
   106 // End of File