presencecache/presencecacheutils/inc/presenceobjecthelpers.h
changeset 0 e686773b3f54
child 32 2828b4d142c0
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  Templated algorithms to simplify object handling
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PRESENCEOBJECTHELPERS_H
       
    19 #define PRESENCEOBJECTHELPERS_H
       
    20 
       
    21 #include <s32mem.h>
       
    22 
       
    23 class MPresenceBuddyInfo2;
       
    24 
       
    25 // const TInt KObjectBufGranurality = 100;
       
    26 
       
    27 
       
    28 class TPresenceArrayPacker
       
    29     {
       
    30 public:
       
    31     /**
       
    32      * Pack array of buffers to buffer.
       
    33      * @param aBufferArray Array of buffers to pack.
       
    34      * @return Buffer containing buffers.
       
    35      */
       
    36     IMPORT_C static HBufC8* PackArrayL( const RPointerArray< MPresenceBuddyInfo2 >& aBufferArray );
       
    37     
       
    38     /**
       
    39      * Unpack array of buffers to array.
       
    40      * @param aBufferArray. Target array for new buffers. Ownhersip of items in array is transferred to caller.
       
    41      * @param aPack Packet containing array of buffers.
       
    42      */
       
    43     IMPORT_C static void UnPackArrayL( RPointerArray< MPresenceBuddyInfo2 >& aBufferArray, const TDesC8& aPack  );
       
    44     };
       
    45 
       
    46 class PresenceCacheBuddyUtils
       
    47     {
       
    48 public:
       
    49     /**
       
    50      * Reset buddy info expiry time stamp
       
    51      */
       
    52     IMPORT_C static void ResetBuddyInfoTimeStamp(MPresenceBuddyInfo2& aBuddy);
       
    53 
       
    54     /**
       
    55      * Check is buddy info expired
       
    56      */
       
    57     IMPORT_C static TBool IsBuddyInfoExpired(const MPresenceBuddyInfo2& aBuddy);
       
    58 private:
       
    59     // Hide constructor and destructor
       
    60     PresenceCacheBuddyUtils();
       
    61     ~PresenceCacheBuddyUtils();
       
    62     };
       
    63 
       
    64 #endif // PRESENCEOBJECTHELPERS_H