metadataengine/client/src/mdeitem.cpp
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2009 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mdeitem.h"
       
    20 #include "mdepanic.h"
       
    21 
       
    22 
       
    23 CMdEItem::CMdEItem(CMdESession* aSession, TItemId aId)
       
    24 		: iSession(aSession), iId(aId)
       
    25 	{
       
    26 
       
    27 	}
       
    28 
       
    29 
       
    30 void CMdEItem::ItemBaseConstruct()
       
    31 	{
       
    32 	}
       
    33 
       
    34 
       
    35 CMdEItem::~CMdEItem()
       
    36 	{
       
    37 	}
       
    38 
       
    39 
       
    40 EXPORT_C TBool CMdEItem::BelongsToSession() const
       
    41 	{
       
    42 	return iSession ? ETrue : EFalse;
       
    43 	}
       
    44 
       
    45 
       
    46 EXPORT_C CMdESession& CMdEItem::Session() const
       
    47 	{
       
    48 	CheckSession();
       
    49 
       
    50 	return *iSession;
       
    51 	}
       
    52 
       
    53 
       
    54 void CMdEItem::CheckSession() const
       
    55 	{
       
    56 	__ASSERT_DEBUG(BelongsToSession(),
       
    57 					TMdEPanic::Panic(TMdEPanic::EItemDoesNotBelongToSession));
       
    58 	}
       
    59 
       
    60 
       
    61 void CMdEItem::SetSession(CMdESession& aSession)
       
    62 	{
       
    63 	iSession = &aSession;
       
    64 	}
       
    65 
       
    66 
       
    67 EXPORT_C TBool CMdEItem::InDatabase() const
       
    68 	{
       
    69 	if (iId != KNoId)
       
    70 		{
       
    71 		return ETrue;
       
    72 		}
       
    73 	else
       
    74 		{
       
    75 		return EFalse;
       
    76 		}
       
    77 	}
       
    78 
       
    79 
       
    80 EXPORT_C TItemId CMdEItem::Id() const
       
    81 	{
       
    82 	return iId;
       
    83 	}
       
    84 
       
    85 
       
    86 void CMdEItem::SetId(TItemId aId)
       
    87 	{
       
    88 	iId = aId;
       
    89 	}
       
    90