menucontentsrv/srvinc/menusrvtypefilters.h
branchRCL_3
changeset 78 1b207dd38b72
equal deleted inserted replaced
74:edd621764147 78:1b207dd38b72
       
     1 /*
       
     2 * Copyright (c) 2008 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:  The API supports item information that is not supported by
       
    15 *                the MCS server itself
       
    16 *
       
    17 */
       
    18 #ifndef MENUSRVTYPEFILTERS_H_
       
    19 #define MENUSRVTYPEFILTERS_H_
       
    20 
       
    21 
       
    22 #include "menuengfilter.h"
       
    23 #include "menuengobject.h"
       
    24 
       
    25 /**
       
    26 * Type filter: match objects by type.
       
    27 */
       
    28 class TMenuSrvTypeFilter: public MMenuEngFilter
       
    29     {
       
    30 
       
    31 public:     // from MMenuEngFilter
       
    32 
       
    33     /**
       
    34     * Filter test function.
       
    35     * @param aObject Object.
       
    36     * @return ETrue if aObject matches this filter.
       
    37     */
       
    38     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
    39 
       
    40 public:     // new methods
       
    41 
       
    42     /**
       
    43     * Set type filter.
       
    44     * @param aType Type.
       
    45     */
       
    46     void SetType( const TDesC& aType )
       
    47         { iType.Set( aType ); }
       
    48 
       
    49 private:    // data
       
    50 
       
    51     TPtrC iType; ///< Type filter.
       
    52 
       
    53     };
       
    54 
       
    55 /**
       
    56 * Type + attribute filter: match objects by type
       
    57 * and attribute with a specific value.
       
    58 */
       
    59 class TMenuSrvTypeAttrFilter: public TMenuSrvTypeFilter
       
    60     {
       
    61 
       
    62 public:     // from MMenuEngFilter
       
    63 
       
    64     /**
       
    65     * Filter test function.
       
    66     * @param aObject Object.
       
    67     * @return ETrue if aObject matches this filter.
       
    68     */
       
    69     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
    70 
       
    71 public:     // new methods
       
    72 
       
    73     /**
       
    74     * Set attribute filter.
       
    75     * @param aName Attribute name.
       
    76     * @param aValue Attribute value.
       
    77     */
       
    78     void SetAttr( const TDesC& aName, const TDesC& aValue )
       
    79         { iAttrName.Set( aName ); iAttrValue.Set( aValue ); }
       
    80 
       
    81 private:    // data
       
    82 
       
    83     TPtrC iAttrName; ///< Attr name.
       
    84     TPtrC iAttrValue; ///< Attr value.
       
    85 
       
    86     };
       
    87 
       
    88 /**
       
    89 * Type + attribute filter: match objects by type
       
    90 * and attribute with a specific value.
       
    91 */
       
    92 class TMenuSrvAttrFilter: public MMenuEngFilter
       
    93     {
       
    94 
       
    95 public:     // from MMenuEngFilter
       
    96 
       
    97     /**
       
    98     * Filter test function.
       
    99     * @param aObject Object.
       
   100     * @return ETrue if aObject matches this filter.
       
   101     */
       
   102     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
   103 
       
   104 public:     // new methods
       
   105 
       
   106     /**
       
   107     * Set attribute filter.
       
   108     * @param aName Attribute name.
       
   109     * @param aValue Attribute value.
       
   110     */
       
   111     void SetAttr( const TDesC& aName, const TDesC& aValue )
       
   112         { iAttrName.Set( aName ); iAttrValue.Set( aValue ); }
       
   113 
       
   114 private:    // data
       
   115 
       
   116     TPtrC iAttrName; ///< Attr name.
       
   117     TPtrC iAttrValue; ///< Attr value.
       
   118     };
       
   119 
       
   120 /**
       
   121 * Type + attribute filter: match objects by type
       
   122 * and attribute with a specific value.
       
   123 */
       
   124 class TMenuSrvTypeAttrExistsFilter: public TMenuSrvTypeFilter
       
   125     {
       
   126 
       
   127 public:     // from MMenuEngFilter
       
   128 
       
   129     /**
       
   130     * Filter test function.
       
   131     * @param aObject Object.
       
   132     * @return ETrue if aObject matches this filter.
       
   133     */
       
   134     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
   135 
       
   136 public:     // new methods
       
   137 
       
   138     /**
       
   139     * Set attribute filter.
       
   140     * @param aName Attribute name.
       
   141     */
       
   142     void SetAttr( const TDesC& aName )
       
   143         { iAttrName.Set( aName ); }
       
   144 
       
   145 private:    // data
       
   146 
       
   147     TPtrC iAttrName; ///< Attr name.
       
   148 
       
   149     };
       
   150 
       
   151 /**
       
   152 * Type + attribute filter: match objects by type
       
   153 * and attribute with a specific value.
       
   154 */
       
   155 class TMenuSrvAttrExistsFilter: public TMenuSrvTypeFilter
       
   156     {
       
   157 
       
   158 public:     // from MMenuEngFilter
       
   159 
       
   160     /**
       
   161     * Filter test function.
       
   162     * @param aObject Object.
       
   163     * @return ETrue if aObject matches this filter.
       
   164     */
       
   165     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
   166 
       
   167 public:     // new methods
       
   168 
       
   169     /**
       
   170     * Set attribute filter.
       
   171     * @param aName Attribute name.
       
   172     */
       
   173     void SetAttr( const TDesC& aName )
       
   174         { iAttrName.Set( aName ); }
       
   175 
       
   176 private:    // data
       
   177 
       
   178     TPtrC iAttrName; ///< Attr name.
       
   179 
       
   180     };
       
   181 
       
   182 /**
       
   183 * Hidden attr filter for application items
       
   184 */
       
   185 class TMenuSrvHiddenAppFilter: public MMenuEngFilter
       
   186     {
       
   187 
       
   188 public:     // from MMenuEngFilter
       
   189 
       
   190     /**
       
   191     * Filter test function.
       
   192     * @param aObject Object.
       
   193     * @return ETrue if aObject matches this filter.
       
   194     */
       
   195     TBool MatchesObject( const CMenuEngObject& aObject ) const;
       
   196 
       
   197     };
       
   198 
       
   199 #endif /* MENUSRVTYPEFILTERS_H_ */