qtmobility/src/contacts/qcontactfilter.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    59   This class is used as a parameter to various functions offered by QContactManager, to allow
    59   This class is used as a parameter to various functions offered by QContactManager, to allow
    60   selection of contacts which have certain details or properties.
    60   selection of contacts which have certain details or properties.
    61  */
    61  */
    62 
    62 
    63 /*!
    63 /*!
    64  * \enum QContactFilter::FilterType
    64   \enum QContactFilter::FilterType
    65  * Describes the type of the filter
    65   Describes the type of the filter
    66  * \value InvalidFilter An invalid filter which matches nothing
    66   \value InvalidFilter An invalid filter which matches nothing
    67  * \value ContactDetailFilter A filter which matches contacts containing one or more details of a particular definition with a particular value
    67   \value ContactDetailFilter A filter which matches contacts containing one or more details of a particular definition with a particular value
    68  * \value ContactDetailRangeFilter A filter which matches contacts containing one or more details of a particular definition whose values are within a particular range
    68   \value ContactDetailRangeFilter A filter which matches contacts containing one or more details of a particular definition whose values are within a particular range
    69  * \value ChangeLogFilter A filter which matches contacts whose timestamps have been updated since some particular date and time
    69   \value ChangeLogFilter A filter which matches contacts whose timestamps have been updated since some particular date and time
    70  * \value ActionFilter A filter which matches contacts for which a particular action is available, or which contain a detail with a particular value for which a particular action is available
    70   \value ActionFilter A filter which matches contacts for which a particular action is available, or which contain a detail with a particular value for which a particular action is available
    71  * \value RelationshipFilter A filter which matches contacts which participate in a particular type of relationship, or relationship with a specified contact
    71   \value RelationshipFilter A filter which matches contacts which participate in a particular type of relationship, or relationship with a specified contact
    72  * \value IntersectionFilter A filter which matches all contacts that are matched by all filters it includes
    72   \value IntersectionFilter A filter which matches all contacts that are matched by all filters it includes
    73  * \value UnionFilter A filter which matches any contact that is matched by any of the filters it includes
    73   \value UnionFilter A filter which matches any contact that is matched by any of the filters it includes
    74  * \value LocalIdFilter A filter which matches any contact whose local id is contained in a particular list of contact local ids
    74   \value LocalIdFilter A filter which matches any contact whose local id is contained in a particular list of contact local ids
    75  * \value DefaultFilter A filter which matches everything
    75   \value DefaultFilter A filter which matches everything
    76  */
    76  */
    77 
    77 
    78 /*!
    78 /*!
    79  * \enum QContactFilter::MatchFlag
    79   \enum QContactFilter::MatchFlag
    80  * Describes the semantics of matching followed by the filter
    80   Describes the semantics of matching followed by the filter
    81  * \value MatchExactly Performs QVariant-based matching
    81   \value MatchExactly Performs QVariant-based matching
    82  * \value MatchContains The search term is contained in the item
    82   \value MatchContains The search term is contained in the item
    83  * \value MatchStartsWith The search term matches the start of the item
    83   \value MatchStartsWith The search term matches the start of the item
    84  * \value MatchEndsWith The search term matches the end of the item
    84   \value MatchEndsWith The search term matches the end of the item
    85  * \value MatchFixedString Performs string-based matching. String-based comparisons are case-insensitive unless the \c MatchCaseSensitive flag is also specified
    85   \value MatchFixedString Performs string-based matching. String-based comparisons are case-insensitive unless the \c MatchCaseSensitive flag is also specified
    86  * \value MatchCaseSensitive The search is case sensitive
    86   \value MatchCaseSensitive The search is case sensitive
    87  * \value MatchPhoneNumber The search term is considered to be in the form of a phone number, and special processing (removing dialing prefixes, non significant
    87   \value MatchPhoneNumber The search term is considered to be in the form of a phone number, and special processing (removing dialing prefixes, non significant
    88  *        characters like '-'. ')' etc). may be performed when matching the item.
    88          characters like '-'. ')' etc). may be performed when matching the item.
    89  * \value MatchKeypadCollation The search term is in the form of text entered by a numeric phone keypad (such as ITU-T E.161 compliant keypads).  Each digit in the
    89   \value MatchKeypadCollation The search term is in the form of text entered by a numeric phone keypad (such as ITU-T E.161 compliant keypads).  Each digit in the
    90  *        search term can represent a number of alphanumeric symbols.  For example, the search string "43556" would match items "HELLO", "GEKKO", "HELL6" and "43556" among others.
    90          search term can represent a number of alphanumeric symbols.  For example, the search string "43556" would match items "HELLO", "GEKKO", "HELL6" and "43556" among others.
    91  *        Accented characters and other punctuation characters may additionally be matched by the QContactManager in a way consistent with the platform.
    91          Accented characters and other punctuation characters may additionally be matched by the QContactManager in a way consistent with the platform.
    92  */
    92  */
    93 
    93 
    94 /*!
    94 /*!
    95  * \fn QContactFilter::operator!=(const QContactFilter& other) const
    95   \fn QContactFilter::operator!=(const QContactFilter& other) const
    96  * Returns true if this filter is not identical to the \a other filter.
    96   Returns true if this filter is not identical to the \a other filter.
    97  * \sa operator==()
    97   \sa operator==()
    98  */
    98  */
    99 
    99 
   100 #if !defined(Q_CC_MWERKS)
   100 #if !defined(Q_CC_MWERKS)
   101 template<> QTM_PREPEND_NAMESPACE(QContactFilterPrivate) *QSharedDataPointer<QTM_PREPEND_NAMESPACE(QContactFilterPrivate)>::clone()
   101 template<> QTM_PREPEND_NAMESPACE(QContactFilterPrivate) *QSharedDataPointer<QTM_PREPEND_NAMESPACE(QContactFilterPrivate)>::clone()
   102 {
   102 {
   153 
   153 
   154     /* Otherwise, use the virtual op == */
   154     /* Otherwise, use the virtual op == */
   155     return d_ptr->compare(other.d_ptr);
   155     return d_ptr->compare(other.d_ptr);
   156 }
   156 }
   157 
   157 
   158 /*! Constructs a new filter from the given data pointer \a d */
   158 /*!
       
   159   \internal
       
   160   Constructs a new filter from the given data pointer \a d
       
   161  */
   159 QContactFilter::QContactFilter(QContactFilterPrivate *d)
   162 QContactFilter::QContactFilter(QContactFilterPrivate *d)
   160     : d_ptr(d)
   163     : d_ptr(d)
   161 {
   164 {
   162 
   165 
   163 }
   166 }
   164 
   167 
   165 /*! Intersects the \a left and \a right filters */
   168 /*!
       
   169  \relates QContactFilter
       
   170  Returns a filter which is the intersection of the \a left and \a right filters
       
   171  \sa QContactIntersectionFilter
       
   172  */
   166 const QContactFilter operator&(const QContactFilter& left, const QContactFilter& right)
   173 const QContactFilter operator&(const QContactFilter& left, const QContactFilter& right)
   167 {
   174 {
   168     // XXX TODO: empty intersection/union operations are not well defined yet.
   175     // XXX TODO: empty intersection/union operations are not well defined yet.
   169     //if (left.type() == QContactFilter::Intersection) {
   176     //if (left.type() == QContactFilter::Intersection) {
   170     //    QContactIntersectionFilter bf(left);
   177     //    QContactIntersectionFilter bf(left);
   184     QContactIntersectionFilter nif;
   191     QContactIntersectionFilter nif;
   185     nif << left << right;
   192     nif << left << right;
   186     return nif;
   193     return nif;
   187 }
   194 }
   188 
   195 
   189 /*! Unions the \a left and \a right filters */
   196 /*!
       
   197  \relates QContactFilter
       
   198  Returns a filter which is the union of the \a left and \a right filters
       
   199  \sa QContactUnionFilter
       
   200  */
   190 const QContactFilter operator|(const QContactFilter& left, const QContactFilter& right)
   201 const QContactFilter operator|(const QContactFilter& left, const QContactFilter& right)
   191 {
   202 {
   192     if (left.type() == QContactFilter::UnionFilter) {
   203     if (left.type() == QContactFilter::UnionFilter) {
   193         QContactUnionFilter bf(left);
   204         QContactUnionFilter bf(left);
   194         /* we can just add the right to this one */
   205         /* we can just add the right to this one */