contacts_plat/predictivesearch_utils_api/inc/CPsQuery.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Utility class to hold the search query for predictive search.
       
    15 *                Holds an array of CPsQueryItem objects.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __CPS_QUERY_H__
       
    20 #define __CPS_QUERY_H__
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <s32strm.h>
       
    25 #include <CPcsDefs.h>
       
    26 
       
    27 // CLASS FORWARD DECLARATION
       
    28 class CPsQueryItem;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33  * Utility class to hold the search sequence for predictive search. The Max length of search sequence = KPsQueryMaxLen.
       
    34  *
       
    35  * @lib pcsutils.lib
       
    36  * @since S60 v3.2
       
    37  */
       
    38 class CPsQuery : public CBase
       
    39 {
       
    40 	public:
       
    41 
       
    42 		/**
       
    43 		* Two phase construction
       
    44 		*
       
    45 		* @return Instance of CPsQuery
       
    46 		*/
       
    47 		IMPORT_C static CPsQuery* NewL();	 		
       
    48 
       
    49 		/**
       
    50 		* Destructor
       
    51 		*/
       
    52 		IMPORT_C ~CPsQuery();
       
    53 
       
    54 		/**
       
    55 		* Insert a query item to the search sequence (if the current length < KPsQueryMaxLen) 
       
    56 		*
       
    57 		* @param aQueryItem The object pointer to be inserted
       
    58 		* @param aIndex     The position within the array where the object 
       
    59 		*                   pointer is to be inserted
       
    60 		*/
       
    61 		IMPORT_C void InsertL(const CPsQueryItem& aQueryItem, TInt aIndex);
       
    62 
       
    63 		/**
       
    64 		* Appends a query item to the search sequence (if the current length < KPsQueryMaxLen)
       
    65 		*
       
    66 		* @param aQueryItem The object pointer to be appended
       
    67 		*/
       
    68 		IMPORT_C void AppendL(const CPsQueryItem& aQueryItem);
       
    69 
       
    70 		/**
       
    71 		* Returns the query item at the specified index
       
    72 		*
       
    73 		* @param aIndex  
       
    74 		* @return Instance of CPsQueryItem
       
    75 		*/
       
    76 		IMPORT_C CPsQueryItem& GetItemAtL(TInt aIndex);
       
    77 
       
    78 		/**
       
    79 		* Returns the search sequence as a single string (This does not 
       
    80 		*   return the keyboard mode)
       
    81 		*  
       
    82 		* @return Entire search query as a string
       
    83 		*/
       
    84 		IMPORT_C TDesC& QueryAsStringLC();
       
    85 
       
    86 		/**
       
    87 		* Removes the query item at the specified index
       
    88 		*
       
    89 		* @param aIndex The position within the array from where the 
       
    90 		*               object pointer is to be removed.
       
    91 		*/
       
    92 		IMPORT_C void Remove(TInt aIndex);
       
    93 
       
    94 		/**
       
    95 		* Deletes the entire search query
       
    96 		*/
       
    97 		IMPORT_C void Reset();
       
    98 
       
    99 		/**
       
   100 		* Returns the keyboard input mode for the search query
       
   101 		*		if all the keys are entered in the same mode
       
   102 		*		then returns the mode e.g. ITU-T, QWERTY
       
   103 		*      else returns unspecified mode
       
   104 		*  
       
   105 		* @return TKeyboardModes
       
   106 		*/
       
   107 		IMPORT_C TKeyboardModes KeyboardModeL();
       
   108 
       
   109 		/**
       
   110 		* Returns the length of the query
       
   111 		*  
       
   112 		* @return number of CPsQueryItem in the array
       
   113 		*/
       
   114 		IMPORT_C TInt Count();
       
   115 
       
   116 		/**
       
   117 		* Prints the query as array of query items
       
   118 		* Used only for debugging. 
       
   119 		*/	 
       
   120 		IMPORT_C void PrintQuery();
       
   121 
       
   122 		/**
       
   123 		* Writes 'this' to the stream
       
   124 		*
       
   125 		* @param aStream WriteStream with externalized contents
       
   126 		*/
       
   127 		IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const;		
       
   128 
       
   129 		/**
       
   130 		* Initializes 'this' from stream
       
   131 		*
       
   132 		* @param aStream ReadStream with data contents to be internalized
       
   133 		*/
       
   134 		IMPORT_C virtual void InternalizeL(RReadStream& aStream);
       
   135 
       
   136 
       
   137 	private:
       
   138 
       
   139 		/**
       
   140 		* Default Constructor
       
   141 		*/
       
   142 		CPsQuery();
       
   143 
       
   144 		/**
       
   145 		* Second phase constructor
       
   146 		*/
       
   147 		void ConstructL();		
       
   148 					
       
   149 		private:	
       
   150 					
       
   151 		/**
       
   152 		* The search query.
       
   153 		*/
       
   154 
       
   155 		RPointerArray<CPsQueryItem> iSearchQuery;
       
   156 
       
   157 };
       
   158 
       
   159 #endif // __CPS_QUERY_H__
       
   160 
       
   161 // End of file