smf/smfservermodule/smfclient/client/smfrelationmgr.cpp
changeset 14 a469c0e6e7fb
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  */
       
    15 
       
    16 #include "smfrelationmgr.h"
       
    17 #include "smfrelationmgr_p.h"
       
    18 
       
    19 SmfRelationItem::SmfRelationItem(SmfProvider* provider)
       
    20 	{
       
    21 	m_provider = *(provider);
       
    22 	}
       
    23 SmfProvider SmfRelationItem::getProvider() const
       
    24 	{
       
    25 	return m_provider;
       
    26 	}
       
    27 void SmfRelationItem::setProvider(SmfProvider& provider)
       
    28 	{
       
    29 	m_provider = provider;
       
    30 	}
       
    31 SmfContact SmfRelationItem::getContact() const
       
    32 	{
       
    33 	return m_contact;
       
    34 	}
       
    35 void SmfRelationItem::setContact(SmfContact& contact)
       
    36 	{
       
    37 	m_contact = contact;
       
    38 	}
       
    39 quint32	SmfRelationItem::getIndex() const
       
    40 	{
       
    41 	return m_index;
       
    42 	}
       
    43 void SmfRelationItem::setIndex(quint32 index)
       
    44 	{
       
    45 	m_index = index;
       
    46 	}
       
    47 QDataStream &operator<<( QDataStream &aDataStream,const SmfRelationItem &aRelnItem )
       
    48 	{
       
    49 	aDataStream<<aRelnItem.getProvider();
       
    50 	aDataStream<<aRelnItem.getContact();
       
    51 	aDataStream<<aRelnItem.getIndex();
       
    52 	}
       
    53 
       
    54 QDataStream &operator>>( QDataStream &aDataStream,SmfRelationItem &aRelnItem)
       
    55 	{
       
    56 	SmfContact contact;
       
    57 	SmfProvider provider;
       
    58 	quint32 index;
       
    59 	
       
    60 	aDataStream>>provider;
       
    61 	aDataStream>>contact;
       
    62 	aDataStream>>index;
       
    63 	
       
    64 	aRelnItem.setProvider(provider);
       
    65 	aRelnItem.setContact(contact);
       
    66 	aRelnItem.setIndex(index);
       
    67 	}
       
    68 SmfRelationMgr::SmfRelationMgr(QObject* parent):QObject(parent)
       
    69 	{
       
    70 	m_private = new SmfRelationMgrPrivate(this);
       
    71 	}
       
    72 SmfRelationMgr::~SmfRelationMgr()
       
    73 	{
       
    74 	if(m_private)
       
    75 		{
       
    76 		delete m_private;
       
    77 		m_private = NULL;
       
    78 		}
       
    79 	}
       
    80 SmfRelationId SmfRelationMgr::create(SmfProvider *provider, SmfContact *contact)
       
    81 	{
       
    82 	return m_private->create(provider,contact);
       
    83 	}
       
    84 SmfError SmfRelationMgr::associate(const SmfRelationId& relation,const SmfContact* contact,SmfProvider* provider)
       
    85 	{
       
    86 	return m_private->associate(relation,contact,provider);
       
    87 	}
       
    88 SmfError SmfRelationMgr::remove(SmfRelationId& relation,const SmfContact* contact)
       
    89 	{
       
    90 	return m_private->remove(relation,contact);
       
    91 	}
       
    92 SmfRelationItem SmfRelationMgr::searchById(const SmfRelationId& relation)
       
    93 	{
       
    94 	return m_private->searchById(relation);
       
    95 	}
       
    96 SmfRelationId SmfRelationMgr::searchByContact( SmfContact contact)
       
    97 	{
       
    98 	return m_private->searchByContact(contact);
       
    99 	}
       
   100 uint SmfRelationMgr::count(SmfRelationId relation)
       
   101 	{
       
   102 	return m_private->count(relation);
       
   103 	}
       
   104 SmfRelationItem SmfRelationMgr::get(SmfRelationId& relation, quint32 index)
       
   105 	{
       
   106 	return m_private->get(relation,index);
       
   107 	}
       
   108 QList<SmfRelationItem> SmfRelationMgr::getAll(SmfRelationId& relation)
       
   109 	{
       
   110 	return m_private->getAll(relation);
       
   111 	}
       
   112 QList<SmfRelationId> SmfRelationMgr::getAllRelations()
       
   113 	{
       
   114 	return m_private->getAllRelations();
       
   115 	}
       
   116 SmfError SmfRelationMgr::Delete(SmfRelationId& relation)
       
   117 	{
       
   118 	return m_private->Delete(relation);
       
   119 	}