predictivesearch/PcsUtils/src/CPsQueryItem.cpp
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 a single query item for predictive search.
       
    15 *                Used to represent the search sequence character-by-character
       
    16 *                along with the keyboard type(eg ITU-T, QWERTY ) in which the 
       
    17 *                character was input.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <s32mem.h>
       
    24 #include "CPsQueryItem.h"
       
    25 
       
    26 // ============================== MEMBER FUNCTIONS ============================
       
    27 
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CPsQueryItem::NewL
       
    31 // Two Phase constructor
       
    32 // ----------------------------------------------------------------------------
       
    33 EXPORT_C CPsQueryItem* CPsQueryItem::NewL()
       
    34 {
       
    35 	CPsQueryItem* self = new (ELeave) CPsQueryItem();	
       
    36     CleanupStack::PushL(self);
       
    37     self->ConstructL();
       
    38     CleanupStack::Pop();
       
    39     return self;
       
    40 	
       
    41 }
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CPsQueryItem::CPsQueryItem
       
    45 // Default constructor
       
    46 // ----------------------------------------------------------------------------
       
    47 CPsQueryItem::CPsQueryItem()
       
    48 {
       
    49 }
       
    50 
       
    51 // ----------------------------------------------------------------------------
       
    52 // CPsQueryItem::ConstructL
       
    53 // Two phase construction
       
    54 // ----------------------------------------------------------------------------
       
    55 void CPsQueryItem::ConstructL()
       
    56 {
       
    57 }
       
    58 
       
    59 // ----------------------------------------------------------------------------
       
    60 // CPsQueryItem::~CPsQueryItem
       
    61 // Destructor
       
    62 // ----------------------------------------------------------------------------
       
    63 EXPORT_C CPsQueryItem::~CPsQueryItem()
       
    64 {	
       
    65 }
       
    66 
       
    67 // ----------------------------------------------------------------------------
       
    68 // CPsQueryItem::SetMode
       
    69 // Sets the keyboard mode eg ITU-T, QWERTY etc
       
    70 // ----------------------------------------------------------------------------
       
    71 EXPORT_C void CPsQueryItem::SetMode(const TKeyboardModes aMode)
       
    72 {   
       
    73     iMode = aMode;
       
    74 }
       
    75 
       
    76 // ----------------------------------------------------------------------------
       
    77 // CPsQueryItem::SetCharacter
       
    78 // Sets a character of the search sequence
       
    79 // ----------------------------------------------------------------------------
       
    80 EXPORT_C void CPsQueryItem::SetCharacter(const TChar aCharacter)
       
    81 {
       
    82 	iCharacter = aCharacter;
       
    83 }
       
    84 
       
    85 // ----------------------------------------------------------------------------
       
    86 // CPsQueryItem::Mode
       
    87 // Returns the keyboard mode eg ITU-T, QWERTY etc
       
    88 // ----------------------------------------------------------------------------
       
    89 EXPORT_C TKeyboardModes CPsQueryItem::Mode() const
       
    90 {
       
    91     return iMode;
       
    92 }
       
    93 
       
    94 // ----------------------------------------------------------------------------
       
    95 // CPsQueryItem::Character
       
    96 // Returns a character of the search sequence
       
    97 // ----------------------------------------------------------------------------
       
    98 EXPORT_C TChar CPsQueryItem::Character() const
       
    99 {
       
   100     return iCharacter;
       
   101 }
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // CPsQueryItem::ExternalizeL
       
   105 // Writes 'this' to aStream
       
   106 // ----------------------------------------------------------------------------
       
   107 EXPORT_C void CPsQueryItem::ExternalizeL(RWriteStream& aStream) const
       
   108 {
       
   109 	aStream.WriteInt16L(iMode);
       
   110 	aStream.WriteInt16L(iCharacter);
       
   111 }
       
   112 
       
   113 // ----------------------------------------------------------------------------
       
   114 // CPsQueryItem::InternalizeL
       
   115 // Initializes 'this' with the contents of aStream
       
   116 // ----------------------------------------------------------------------------
       
   117 EXPORT_C void CPsQueryItem::InternalizeL(RReadStream& aStream)
       
   118 {
       
   119     iMode = (TKeyboardModes)aStream.ReadInt16L();
       
   120     iCharacter = aStream.ReadInt16L();
       
   121 }
       
   122