contacts_plat/predictivesearch_utils_api/inc/CPsClientData.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:  Client side class to hold the result of predictive search.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __C_PS_CLIENT_DATA_H__
       
    19 #define __C_PS_CLIENT_DATA_H__
       
    20 
       
    21 // SYSTEM INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <s32strm.h>
       
    24 #include <e32math.h>
       
    25 
       
    26 //USER INCLUDES
       
    27 
       
    28 // CLASS DECLARATION
       
    29 /**
       
    30  * This is a client side class to hold the results of search
       
    31  *
       
    32  * @lib PsServerClientAPI.lib
       
    33  * @since S60 v3.2
       
    34  */
       
    35 class CPsClientData: public CBase
       
    36 {
       
    37 	public:
       
    38 	
       
    39 		/**
       
    40 		* Two phase construction
       
    41 		* @return Instance of CPsClientData
       
    42 		*/
       
    43 		IMPORT_C static CPsClientData* NewL();	 		
       
    44 
       
    45 		/**
       
    46 		* Destructor
       
    47 		*/
       
    48 		IMPORT_C ~CPsClientData();
       
    49 		
       
    50 	public:
       
    51 		
       
    52 		/**
       
    53 		* Makes a clone of the current object
       
    54 		*
       
    55 		* @return The clone
       
    56 		*/
       
    57 		IMPORT_C CPsClientData* CloneL() const;
       
    58 		/**
       
    59 		* Provides the unique identifier of this object
       
    60 		*
       
    61 		* @return Unique identifier of this object
       
    62 		*/
       
    63 		IMPORT_C TInt Id() const;
       
    64 
       
    65 		/**
       
    66 		* Sets the unique identifier of this object 
       
    67 		* @param aId The unique identifier
       
    68 		*/
       
    69 		IMPORT_C void SetId(const TInt aId);
       
    70 
       
    71 		/**
       
    72 		* Provides the URI of this object
       
    73 		*
       
    74 		* @return Unique URI of this object
       
    75 		*/
       
    76 		IMPORT_C HBufC* Uri() const;
       
    77 
       
    78 		/**
       
    79 		* Sets the unique URI of this object 
       
    80 		* @param aUri The unique URI 
       
    81 		*/
       
    82 		IMPORT_C void SetUriL(const TDesC& aUri);
       
    83 		
       
    84 		/**
       
    85 		* Pointer to the data element at the specified location
       
    86 		*
       
    87 		* @param aIndex Index of data element
       
    88 		* @param Pointer to data element
       
    89 		*/
       
    90 		IMPORT_C HBufC* Data(TInt aIndex) const;
       
    91 
       
    92 		/**
       
    93 		* Sets the data at the specified location
       
    94 		*
       
    95 		* @param aIndex Index of data element
       
    96 		* @param aData Data descriptor to be searched
       
    97 		*/
       
    98 		IMPORT_C void SetDataL(const TInt aIndex,
       
    99 		       const TDesC& aData);
       
   100 		
       
   101 		/**
       
   102 		* Returns the number of data elements
       
   103 		*
       
   104 		* @return Number of data elements
       
   105 		*/
       
   106 		IMPORT_C TInt DataElementCount() const;
       
   107 
       
   108 		/**
       
   109 		* Writes 'this' to the stream
       
   110 		*
       
   111 		* @param aStream WriteStream with externalized contents
       
   112 		*/
       
   113 		IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const;		
       
   114 
       
   115 		/**
       
   116 		* Initializes 'this' from stream
       
   117 		*
       
   118 		* @param aStream ReadStream with data contents to be internalized
       
   119 		*/
       
   120 		IMPORT_C virtual void InternalizeL(RReadStream& aStream);
       
   121 	
       
   122 		/**
       
   123 		* Returns the data extension
       
   124 		*
       
   125 		* @return Pointer to data extension if supported. Else NULL.
       
   126 		*/
       
   127 		IMPORT_C TAny* DataExtension() const;
       
   128 
       
   129 		/**
       
   130 		* Set the data extension
       
   131 		*
       
   132 		* @param aDataExt Data Extension for this object
       
   133 		*/
       
   134 		IMPORT_C void SetDataExtensionL(TAny* aDataExt);
       
   135 		
       
   136 		/**
       
   137 		* Sets the contact as bookmarked
       
   138 		*/
       
   139 		IMPORT_C void SetMark();
       
   140 		
       
   141 		/**
       
   142 		* Returns ETrue if the contact is bookmarked, else EFalse
       
   143 		*/
       
   144 		IMPORT_C TBool IsMarked() const;
       
   145 		
       
   146 		/**
       
   147 		* Sets FieldMatch attribute
       
   148 		*
       
   149 		* @param aFieldMatch 
       
   150 		*/
       
   151 		IMPORT_C void SetFieldMatch(TUint8 aFieldMatch);		
       
   152 
       
   153 		/**
       
   154 		* Returns the Field match attribute
       
   155 		*
       
   156 		* @return FieldMatch Attribute
       
   157 		*/
       
   158 		IMPORT_C TUint8 FieldMatch() const; 
       
   159 	
       
   160 	private:    // functions
       
   161 	
       
   162 		/**
       
   163 		* Default Constructor
       
   164 		*/
       
   165 		CPsClientData();
       
   166 
       
   167 		/**
       
   168 		* Second phase constructor
       
   169 		*/
       
   170 		void ConstructL();
       
   171 		
       
   172 		/**
       
   173 		* Second phase constructor
       
   174 		*/
       
   175 		void ConstructL(const CPsClientData& aRhs);
       
   176 
       
   177 	
       
   178 	private:	// data members
       
   179 				
       
   180 		/**
       
   181 		* Unique id 
       
   182 		*/
       
   183 		TInt iId;	
       
   184 
       
   185 		/**
       
   186 		* URI. Indicates the data source.
       
   187 		*/
       
   188 		HBufC* iUri;
       
   189 
       
   190 		/**
       
   191 		* Data fields
       
   192 		*/
       
   193 		RPointerArray<HBufC>* iData;
       
   194 		
       
   195 		/**
       
   196  		* Indicates in bit positions, what data fields 
       
   197 		* are matched for predictive search
       
   198 		*/	
       
   199 		TUint8 iFiledMatches;
       
   200 
       
   201 		/**
       
   202 		* Extended Data field
       
   203 		*/	
       
   204 		TAny* iDataExtension; 
       
   205 		
       
   206 		/**
       
   207 		* Field to indicate if a contact is bookmarked or not
       
   208 		*/
       
   209 		TBool iMarked;
       
   210 
       
   211 };
       
   212 
       
   213 #endif // __C_PS_CLIENT_DATA_H__