omads/omadsextensions/adapters/bookmark/inc/snapshotitem.h
changeset 40 b63e67867dcd
parent 0 dab8a81a92de
equal deleted inserted replaced
39:9905f7d46607 40:b63e67867dcd
       
     1 /*
       
     2 * Copyright (c) 2007 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 
       
    30 // Defines the maximum length of a hash.
       
    31 const TInt KMaxHashLength = 20;
       
    32 typedef TBuf8<KMaxHashLength> THashValue;
       
    33 
       
    34 /**
       
    35 * @brief TSnapshotItem
       
    36 * This class represents a single item in the ChangeFinder snapshot.
       
    37 * It's derived from the generic snapshot item and extended
       
    38 * to contain the hash (name and url) information.
       
    39 */
       
    40 class TSnapshotItem : public TNSmlSnapshotItem
       
    41 	{ 
       
    42 public:
       
    43 	
       
    44 	/**
       
    45     * Constructor
       
    46     */
       
    47 	TSnapshotItem();
       
    48 
       
    49 	/**
       
    50     * Constructor
       
    51     * 
       
    52     * @param aItemId   IN: id of the item.
       
    53     * @param aParent   IN: parent item, 0 as default.
       
    54     */
       
    55 	TSnapshotItem( const TSmlDbItemUid& aItemId,
       
    56 	    const TSmlDbItemUid& aParent = 0 );
       
    57 	
       
    58 	/**
       
    59     * Writes the item to a stream.
       
    60     * 
       
    61     * @param aStream   IN: a reference to a stream, where this item is to be written.
       
    62     */
       
    63 	void ExternalizeL( RWriteStream& aStream ) const;
       
    64 
       
    65 	/**
       
    66     * Reads item from a stream.
       
    67     * 
       
    68     * @param aStream   IN: a reference to a stream, where this item is read from.
       
    69     */
       
    70 	void InternalizeL( RReadStream& aStream );	
       
    71 	
       
    72 	/**
       
    73     * Creates hash from name and url
       
    74     *
       
    75     * @param aName, name to used
       
    76     * @param aUrl, url to used
       
    77     * @return none.
       
    78     */
       
    79 	void CreateHashL( const TDesC& aName, const TDesC& aUrl );
       
    80 	
       
    81 	/**
       
    82     * Reads hash
       
    83     * 
       
    84     * @return TDesC8& hash.
       
    85     */
       
    86 	const TDesC8& Hash() const;
       
    87 	
       
    88 private:
       
    89     
       
    90     THashValue       iHash;
       
    91     };
       
    92 
       
    93 #endif