predictivesearch/PcsAlgorithm/Algorithm2/src/FindUtilChineseECE.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 0 e686773b3f54
child 58 d4f567ce2e7c
equal deleted inserted replaced
26:0d28c1c5b6dd 32:2828b4d142c0
    68 _LIT(KBlank, " ");
    68 _LIT(KBlank, " ");
    69 _LIT(KTab, "\t");
    69 _LIT(KTab, "\t");
    70 _LIT(KPanicReason, "Abnormal input parameters!");
    70 _LIT(KPanicReason, "Abnormal input parameters!");
    71 
    71 
    72 const TInt KLitLineFeed(8233);
    72 const TInt KLitLineFeed(8233);
       
    73 
       
    74 // CleanupStack helpers for item owning RPointerArrays
       
    75 template <class T>
       
    76 class CleanupResetAndDestroy
       
    77     {
       
    78 public:
       
    79     inline static void PushL( T& aRef )
       
    80         { 
       
    81         CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); 
       
    82         }
       
    83 private:
       
    84     inline static void ResetAndDestroy( TAny *aPtr )
       
    85         { 
       
    86         static_cast<T*>( aPtr )->ResetAndDestroy();
       
    87         }
       
    88     };
       
    89 
       
    90 template <class T>
       
    91 inline void CleanupResetAndDestroyPushL( T& aRef )
       
    92     { 
       
    93     CleanupResetAndDestroy<T>::PushL( aRef );
       
    94     }
    73 // ======== MEMBER FUNCTIONS ========
    95 // ======== MEMBER FUNCTIONS ========
    74 
    96 
    75 // ---------------------------------------------------------
    97 // ---------------------------------------------------------
    76 // Symbian constructor
    98 // Symbian constructor
    77 // ---------------------------------------------------------
    99 // ---------------------------------------------------------
  1053 // ---------------------------------------------------------
  1075 // ---------------------------------------------------------
  1054 //
  1076 //
  1055 void CFindUtilChineseECE::InsertStrInforArrayL(RPointerArray<STRINGINFO>& aStringInfoArr, 
  1077 void CFindUtilChineseECE::InsertStrInforArrayL(RPointerArray<STRINGINFO>& aStringInfoArr, 
  1056     TDes &aSegmentStr, const TBool aChinese)
  1078     TDes &aSegmentStr, const TBool aChinese)
  1057     {
  1079     {
       
  1080     CleanupResetAndDestroyPushL( aStringInfoArr );
  1058     if (aSegmentStr.Length() <= 0)
  1081     if (aSegmentStr.Length() <= 0)
  1059         {
  1082         {
  1060         return;
  1083         return;
  1061         }
  1084         }
  1062 
  1085 
  1067     strInfo->segmentString.LowerCase();
  1090     strInfo->segmentString.LowerCase();
  1068     strInfo->isChinese = aChinese;
  1091     strInfo->isChinese = aChinese;
  1069 
  1092 
  1070     aStringInfoArr.AppendL(strInfo);
  1093     aStringInfoArr.AppendL(strInfo);
  1071     aSegmentStr.Zero();
  1094     aSegmentStr.Zero();
       
  1095     CleanupStack::Pop( &aStringInfoArr );
  1072     }
  1096     }
  1073 
  1097 
  1074 // ---------------------------------------------------------
  1098 // ---------------------------------------------------------
  1075 // This segment is matched by search text
  1099 // This segment is matched by search text
  1076 // ---------------------------------------------------------
  1100 // ---------------------------------------------------------