smf/smfservermodule/smfserver/datastoremgr/smfSocialProfile.cpp
changeset 7 be09cf1f39dd
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
       
     1 /*!	\file
       
     2     \brief File containing implementation for SMFSocialProfile class.
       
     3 
       
     4     Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     5     All rights reserved.
       
     6     This component and the accompanying materials are made available
       
     7     under the terms of the "{License}"
       
     8     which accompanies  this distribution, and is available
       
     9     at the URL "{LicenseUrl}".
       
    10 
       
    11     \author Jaspinder Singh, Sasken Communication Technologies Ltd - Initial contribution
       
    12 
       
    13     \author
       
    14     \version 0.1
       
    15 
       
    16 */
       
    17 
       
    18 #include "smfSocialProfile.h"
       
    19 
       
    20 //! \fn SMFSocialProfile(const SMFSocialNetworkingSite&, const SMFUserProfile&, QObject*)
       
    21 /*!
       
    22     \brief  Constructor for the class SMFSocialProfile.
       
    23     \param  site A constant reference to the SMFSocialNetworkingSite profile associated with this profile.
       
    24     \param  user_profile A constant reference to the SMFUserProfile object associated with this profile.
       
    25     \param  parent Reference to the parent object.
       
    26 */
       
    27 SMFSocialProfile::SMFSocialProfile(const SMFSocialNetworkingSite &site, const QString& profile_url, const QString& screen_alias, QObject *parent):QObject(parent){
       
    28     setAssociatedSns(site);
       
    29     m_social_profile_id = -1;    // Set as negative to indicate that this is not yet stored in the database.
       
    30     setAssociatedUserID(-1);
       
    31     m_screen_alias = screen_alias;
       
    32     m_profile_url = profile_url;
       
    33 }
       
    34 
       
    35 
       
    36 SMFSocialProfile::SMFSocialProfile (const SMFSocialProfile& other){
       
    37     this->setAssociatedSnsID(other.associatedSnsID());
       
    38     this->setAssociatedUserID(other.associatedUserID());
       
    39     this->setScreenAlias(other.screenAlias());
       
    40     this->setProfileURL(other.profileURL());
       
    41     this->setParent(other.parent());
       
    42     m_social_profile_id = other.profileID();
       
    43 }
       
    44 
       
    45 
       
    46 //! \fn SMFSocialProfile(int , int , QObject* )
       
    47 /*!
       
    48     \brief  Constructor for the class SMFSocialProfile.
       
    49     \param  sns_id Integer id of the SMFSocialNetworkingSite profile associated with this profile.
       
    50     \param  user_id Integer id of the SMFUserProfile associated with this profile.
       
    51     \param  parent Reference to the parent object.
       
    52 */
       
    53 SMFSocialProfile::SMFSocialProfile(int sns_id, int user_id, const QString& profile_url, const QString& screen_alias, QObject* parent):QObject(parent){
       
    54     setAssociatedUserID(user_id);
       
    55     setAssociatedSnsID(sns_id);
       
    56     m_social_profile_id = -1;    // Set as negative to indicate that this is not yet stored in the database.
       
    57     m_screen_alias = screen_alias;
       
    58     m_profile_url = profile_url;
       
    59 }
       
    60 
       
    61 //! \fn ~SMFSocialProfile()
       
    62 /*!
       
    63     \brief  Destructor for the class SMFSocialProfile.
       
    64 */
       
    65 SMFSocialProfile::~SMFSocialProfile(){
       
    66     // Empty
       
    67 }
       
    68 
       
    69 
       
    70 //! \fn associatedSnsID()
       
    71 /*!
       
    72     \brief  Gets the ID of the Social Networking Site associated with this profile.
       
    73     \return Integer ID of the Social Networking Site associated with this profile.
       
    74 
       
    75     \sa setAssociatedSnsID()
       
    76     \sa setAssociatedSns()
       
    77 */
       
    78 int SMFSocialProfile::associatedSnsID() const{
       
    79     return m_sns_id;
       
    80 }
       
    81 
       
    82 
       
    83 //! \fn associatedUserID()
       
    84 /*!
       
    85     \brief  Gets the ID of the User Profile associated with this profile.
       
    86     \return Integer ID identifying the User Profile associated with this profile.
       
    87 
       
    88     \sa setAssociatedUserID()
       
    89     \sa setAssociatedUserProfile()
       
    90 */
       
    91 int SMFSocialProfile::associatedUserID() const{
       
    92     return m_user_id;
       
    93 }
       
    94 
       
    95 
       
    96 //! \fn profileURL()
       
    97 /*!
       
    98     \brief  Gets profile URL of the social profile.
       
    99     \return Returns a QString containing the profile URL of this social profile.
       
   100             An empty string is returned if the value is not present.
       
   101 
       
   102     \sa setProfileURL()
       
   103 */
       
   104 const QString& SMFSocialProfile::profileURL() const{
       
   105     return m_profile_url;
       
   106 }
       
   107 
       
   108 
       
   109 //! \fn screenAlias()
       
   110 /*!
       
   111     \brief  Gets the screen alias of the social profile.
       
   112     \return Returns a QString containing the screen alias of this social profile.
       
   113             An empty string is returned if the value is not present.
       
   114 
       
   115     \sa setScreenAlias()
       
   116 */
       
   117 const QString& SMFSocialProfile::screenAlias() const{
       
   118     return m_screen_alias;
       
   119 }
       
   120 
       
   121 
       
   122 //! \fn profileID()
       
   123 /*!
       
   124     \brief  Gets the profile ID of the social profile.
       
   125     \return Returns an Integer ID of this profile.
       
   126 */
       
   127 int SMFSocialProfile::profileID() const{
       
   128     return m_social_profile_id;
       
   129 }
       
   130 
       
   131 //! \fn setProfileID()
       
   132 /*!
       
   133     \brief  Private function to set the profile ID.
       
   134     \param  id Integer ID to be set.
       
   135 */
       
   136 void SMFSocialProfile::setProfileID(int id){
       
   137     m_social_profile_id = id;
       
   138 }
       
   139 
       
   140 //! \fn setAssociatedSns(const SMFSocialNetworkingSite& )
       
   141 /*!
       
   142     \brief  Sets the social networking site associated to this ID. This function and the related
       
   143             function setAssociatedSnsID() do the same job of associating a social networking site to
       
   144             this profile. Either one of these can be called to create an association. There is no
       
   145             requirement to call both separately.
       
   146     \param  site Constant reference to the SMFSocialNetworkingSite to be associated.
       
   147 
       
   148     \sa     setAssociatedSnsID()
       
   149     \sa     associatedSnsID()
       
   150 */
       
   151 void SMFSocialProfile::setAssociatedSns(const SMFSocialNetworkingSite &site){
       
   152     setAssociatedSnsID(site.snsID());
       
   153 }
       
   154 
       
   155 
       
   156 //! \fn setAssociatedSnsID( int )
       
   157 /*!
       
   158     \brief  Sets the social networking site associated to this ID. This function and the related
       
   159             function setAssociatedSns() do the same job of associating a social networking site to
       
   160             this profile. Either one of these can be called to create an association. There is no
       
   161             requirement to call both separately.
       
   162     \param  id Integer ID of the Social Networking site to be associated.
       
   163 
       
   164     \sa     setAssociatedSns()
       
   165     \sa     associatedSnsID()
       
   166 */
       
   167 void SMFSocialProfile::setAssociatedSnsID(int sns_id){
       
   168     m_sns_id = sns_id;
       
   169 }
       
   170 
       
   171 
       
   172 //! \fn setAssociatedUserProfile( const SMFUserProfile& )
       
   173 /*!
       
   174     \brief  Sets the social user profile associated to this ID. This function and the related
       
   175             function setAssociatedUserID() do the same job of associating a user profile to
       
   176             this profile. Either one of these can be called to create an association. There is no
       
   177             requirement to call both separately.
       
   178     \param  user_profile Constant reference to the SMFUserProfile to be associated with this profile.
       
   179 
       
   180     \sa     setAssociatedUserID()
       
   181     \sa     associatedUserID()
       
   182 */
       
   183 void SMFSocialProfile::setAssociatedUserProfile(const SMFUserProfile &user_profile){
       
   184     setAssociatedUserID(user_profile.userID());
       
   185 }
       
   186 
       
   187 
       
   188 //! \fn setAssociatedUserProfile( const SMFUserProfile& )
       
   189 /*!
       
   190     \brief  Sets the social user profile associated to this ID. This function and the related
       
   191             function setAssociatedUserProfile() do the same job of associating a user profile to
       
   192             this profile. Either one of these can be called to create an association. There is no
       
   193             requirement to call both separately.
       
   194     \param  id Integer ID identifying the SMFUserProfile to be associated with this profile.
       
   195 
       
   196     \sa     setAssociatedUserProfile()
       
   197     \sa     associatedUserID()
       
   198 */
       
   199 void SMFSocialProfile::setAssociatedUserID(int user_id){
       
   200     m_user_id = user_id;
       
   201 }
       
   202 
       
   203 
       
   204 //! \fn setProfileURL( const QString& )
       
   205 /*!
       
   206     \brief  Sets the profile URL for the social profile
       
   207     \param  profile_url Constant reference to the profile URL string.
       
   208 
       
   209     \sa     profileURL()
       
   210 */
       
   211 void SMFSocialProfile::setProfileURL(const QString &profile_url){
       
   212     m_profile_url = profile_url;
       
   213 }
       
   214 
       
   215 
       
   216 //! \fn setScreenAlias( const QString& )
       
   217 /*!
       
   218     \brief  Sets the screen alias for the social profile
       
   219     \param  screen_alias Constant reference to the screen alias string.
       
   220 
       
   221     \sa     screenAlias()
       
   222 */
       
   223 void SMFSocialProfile::setScreenAlias(const QString &screen_alias){
       
   224     m_screen_alias = screen_alias;
       
   225 }