qtmobility/src/contacts/qcontactrelationship.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    45 #include "qcontactid.h"
    45 #include "qcontactid.h"
    46 
    46 
    47 #include <QList>
    47 #include <QList>
    48 #include <QPair>
    48 #include <QPair>
    49 #include <QString>
    49 #include <QString>
       
    50 #include <QHash>
       
    51 #include <QDebug>
    50 
    52 
    51 QTM_BEGIN_NAMESPACE
    53 QTM_BEGIN_NAMESPACE
    52 
    54 
    53 /*!
    55 /*!
    54   \class QContactRelationship
    56   \class QContactRelationship
    71 
    73 
    72   \sa QContactRelationshipFilter
    74   \sa QContactRelationshipFilter
    73  */
    75  */
    74 
    76 
    75 /*!
    77 /*!
       
    78   \enum QContactRelationship::Role
       
    79   Describes the roles that a contact may take in a relationship.
       
    80   \value First The contact is the first contact in the relationship
       
    81   \value Second The contact is the second contact in the relationship
       
    82   \value Either The contact is either the first or second contact in the relationship
       
    83  */
       
    84 
       
    85 /*!
    76  * \variable QContactRelationship::HasMember
    86  * \variable QContactRelationship::HasMember
    77  * The relationship type which identifies the first contact as being a group which includes the second contact
    87  * The relationship type which identifies the first contact as being a group which includes the second contact
    78  */
    88  */
    79 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::HasMember, "HasMember");
    89 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::HasMember, "HasMember");
    80 
    90 
    81 /*!
    91 /*!
    82  * \variable QContactRelationship::Aggregates
    92  * \variable QContactRelationship::Aggregates
    83  * The relationship type which identifies the first contact as aggregating the second contact into a metacontact
    93  * The relationship type which identifies the first contact as aggregating the second contact into a metacontact
    84  */
    94  */
    85 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::Aggregates, "Aggregates");
    95 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::Aggregates, "Aggregates");
    86 
       
    87 /*!
       
    88  * \variable QContactRelationship::Is
       
    89  * \obsolete
       
    90  * Deprecated - use QContactRelationship::IsSameAs instead.
       
    91  */
       
    92 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::Is, "IsSameAs");
       
    93 
    96 
    94 /*!
    97 /*!
    95  * \variable QContactRelationship::IsSameAs
    98  * \variable QContactRelationship::IsSameAs
    96  * The relationship type which identifies the first contact as being the same contact as the second contact
    99  * The relationship type which identifies the first contact as being the same contact as the second contact
    97  */
   100  */
    98 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::IsSameAs, "IsSameAs");
   101 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::IsSameAs, "IsSameAs");
    99 
   102 
   100 /*!
   103 /*!
   101  * \variable QContactRelationship::HasAssistant
   104  * \variable QContactRelationship::HasAssistant
   102  * The relationship type which identifies the second contact as being the assistant of the first contact
   105  * The relationship type which identifies the second contact as being the assistant of the first contact
   103  */
   106  */
   104 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::HasAssistant, "HasAssistant");
   107 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::HasAssistant, "HasAssistant");
   105 
   108 
   106 /*!
   109 /*!
   107  * \variable QContactRelationship::HasManager
   110  * \variable QContactRelationship::HasManager
   108  * The relationship type which identifies the second contact as being the manager of the first contact
   111  * The relationship type which identifies the second contact as being the manager of the first contact
   109  */
   112  */
   110 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::HasManager, "HasManager");
   113 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::HasManager, "HasManager");
   111 
   114 
   112 /*!
   115 /*!
   113  * \variable QContactRelationship::HasSpouse
   116  * \variable QContactRelationship::HasSpouse
   114  * The relationship type which identifies the second contact as being the spouse of the first contact
   117  * The relationship type which identifies the second contact as being the spouse of the first contact
   115  */
   118  */
   116 Q_DEFINE_LATIN1_LITERAL(QContactRelationship::HasSpouse, "HasSpouse");
   119 Q_DEFINE_LATIN1_CONSTANT(QContactRelationship::HasSpouse, "HasSpouse");
   117 
   120 
   118 /*!
   121 /*!
   119  * Constructs a new relationship
   122  * Constructs a new relationship
   120  */
   123  */
   121 QContactRelationship::QContactRelationship()
   124 QContactRelationship::QContactRelationship()
   160         return false;
   163         return false;
   161     return true;
   164     return true;
   162 }
   165 }
   163 
   166 
   164 /*!
   167 /*!
       
   168  * Returns the hash value for \a key.
       
   169  */
       
   170 uint qHash(const QContactRelationship &key)
       
   171 {
       
   172     return qHash(key.first()) + qHash(key.second())
       
   173         + QT_PREPEND_NAMESPACE(qHash)(key.relationshipType());
       
   174 }
       
   175 
       
   176 #ifndef QT_NO_DEBUG_STREAM
       
   177 QDebug operator<<(QDebug dbg, const QContactRelationship& rel)
       
   178 {
       
   179     dbg.nospace() << "QContactRelationship(" << rel.first() << ' ' << rel.relationshipType()
       
   180             << ' ' << rel.second() << ')';
       
   181     return dbg.maybeSpace();
       
   182 }
       
   183 #endif
       
   184 
       
   185 /*!
   165  * \fn QContactRelationship::operator!=(const QContactRelationship& other) const
   186  * \fn QContactRelationship::operator!=(const QContactRelationship& other) const
   166  * Returns true if this relationship is not equal to \a other, otherwise returns false.
   187  * Returns true if this relationship is not equal to \a other, otherwise returns false.
   167  */
   188  */
   168 
   189 
   169 /*!
   190 /*!