omads/omadsextensions/adapters/contactsgroup/inc/snapshotitem.h
branchRCL_3
changeset 52 4f0867e42d62
parent 51 8e7494275d3a
child 56 3e6957da2ff8
equal deleted inserted replaced
51:8e7494275d3a 52:4f0867e42d62
     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:  Private snapshot item header
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __SNAPSHOTITEM_H__
       
    20 #define __SNAPSHOTITEM_H__
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <s32strm.h>
       
    25 #include <nsmlsnapshotitem.h>
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 class CContactGroup;
       
    30 
       
    31 // Defines the maximum length of a hash.
       
    32 const TInt KMaxHashLength = 20;
       
    33 typedef TBuf8<KMaxHashLength> THashValue;
       
    34 
       
    35 /**
       
    36 * @brief TSnapshotItem
       
    37 * This class represents a single item in the ChangeFinder snapshot.
       
    38 * It's derived from the generic snapshot item and extended
       
    39 * to contain the hash (name and url) information.
       
    40 */
       
    41 class TSnapshotItem : public TNSmlSnapshotItem
       
    42 	{ 
       
    43 public:
       
    44 	
       
    45 	/**
       
    46     * Constructor
       
    47     */
       
    48 	TSnapshotItem();
       
    49 
       
    50 	/**
       
    51     * Constructor
       
    52     * 
       
    53     * @param aItemId   IN: id of the item.
       
    54     * @param aParent   IN: parent item, 0 as default.
       
    55     */
       
    56 	TSnapshotItem( const TSmlDbItemUid& aItemId,
       
    57 	    const TSmlDbItemUid& aParent = 0 );
       
    58 	
       
    59 	/**
       
    60     * Writes the item to a stream.
       
    61     * 
       
    62     * @param aStream   IN: a reference to a stream, where this item is to be written.
       
    63     */
       
    64 	void ExternalizeL( RWriteStream& aStream ) const;
       
    65 
       
    66 	/**
       
    67     * Reads item from a stream.
       
    68     * 
       
    69     * @param aStream   IN: a reference to a stream, where this item is read from.
       
    70     */
       
    71 	void InternalizeL( RReadStream& aStream );	
       
    72 	
       
    73 	/**
       
    74     * Creates hash from name and url
       
    75     *
       
    76     * @param aName, name to used
       
    77     * @param aUrl, url to used
       
    78     * @return none.
       
    79     */
       
    80 	void CreateHashL( const TDesC& aName, const TDesC& aUrl );
       
    81 	void CreateHashL( CContactGroup& aGroup );
       
    82 	
       
    83 	/**
       
    84     * Reads hash
       
    85     * 
       
    86     * @return TDesC8& hash.
       
    87     */
       
    88 	const TDesC8& Hash() const;
       
    89 	
       
    90 private:
       
    91     
       
    92     THashValue       iHash;
       
    93     };
       
    94 
       
    95 #endif