--- a/uifw/EikStd/coctlsrc/smileymodel.cpp Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/EikStd/coctlsrc/smileymodel.cpp Tue Aug 31 15:28:30 2010 +0300
@@ -390,89 +390,3 @@
aText[i + aDocPos] = CSmileyManager::KPlaceHolder;
}
}
-
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-const char KStartSymbol[] = {'(', '<', '[', '{'};
-const char KEndSymbol[] = {')', '>', ']', '}'};
-
-TInt IndexFrom(const char* const aPtr, TInt aLength, TInt aChar)
- {
- for(TInt i=0; i<aLength; i++)
- {
- if(aPtr[i] == aChar) return i;
- }
-
- return KErrNotFound;
- }
-
-TBool HavePairedSymbol(const TDesC& aText, TInt aSmileyLength)
- {
- char stack[CSmileyManager::KMaxLength];
- TInt pos = 0;
-
- TInt i = aText.Length() - 1;
- const TInt smileyPos = aText.Length() - aSmileyLength;
-
- for(TInt i=aText.Length()-1; i>=0; i--)
- {
- TInt index = IndexFrom(KEndSymbol, sizeof(KEndSymbol), aText[i]); // detect end symbol
- if(KErrNotFound != index) // push
- {
- stack[pos++] = KStartSymbol[index];
- }
- else if(pos) // detect start symbol
- {
- if(stack[pos-1] == aText[i]) // meet a start symbol
- {
- pos--;
- if(!pos) return (smileyPos > i);
- }
- }
-
- if(smileyPos == i) // smiley combination finished
- {
- if(!pos) return EFalse;
- }
- }
-
- return EFalse;
- }
-
-TBool IsPartOfUrl(const TDesC& aText)
- {
- const TInt end = aText.Length() - 1;
- TInt pos = end;
- while(pos > 0)
- {
- const TUint16 word = aText[--pos];
- if(word == ' ' || word == 0x2029)
- {
- break;
- }
- }
-
- TInt length = end - pos;
- if(length > 5)
- {
- TPtrC field(aText.Mid(pos,length));
- pos = field.Find(_L(":\\\\"));
- if(KErrNotFound == pos) pos = field.Find(_L("://"));
- if(KErrNotFound != pos)
- {
- return ETrue;
- }
- }
-
- return EFalse;
- }
-
-TBool CSmileyModel::IsSmileyBySemanticAnalysis(const TDesC& aText, TInt aSmileyLength)
- {
- if(HavePairedSymbol(aText, aSmileyLength)) return EFalse;
-
- if(IsPartOfUrl(aText)) return EFalse;
-
- return ETrue;
- }