int linkOffset = 0;
int totalLength = text.GetLength();
int length = 0;
+ const wchar_t* pText = text.GetPointer();
String prefix(L"");
String subString(L"");
}
r = text.SubString(index, length, subString);
- SysTryReturn(
- NID_GRP, r == E_SUCCESS, false, E_OUT_OF_RANGE,
+ SysTryReturn(NID_GRP, r == E_SUCCESS, false, E_OUT_OF_RANGE,
"[E_OUT_OF_RANGE] SubString offset(%d) must greater than 0 and length(%d) must be less than total string length(%d).",
index, prefix.GetLength(), totalLength);
if (prefix.CompareTo(subString) == 0)
{
linkOffset = index;
- while (index < totalLength && IsGenericCharacter(text[index]))
+ while (index < totalLength && IsGenericCharacter(pText[index]))
{
- if (dotFound == false && text[index] == '.')
+ if (dotFound == false && pText[index] == '.')
{
dotFound = true;
}
- if (validTextAfterDot == false && dotFound == true && text[index] != '.')
+ if (validTextAfterDot == false && dotFound == true && pText[index] != '.')
{
validTextAfterDot = true;
}
if (dotFound == true)
{
- while (text[index - 1] == L'.' || text[index - 1] == L',')
+ while (pText[index - 1] == L'.' || pText[index - 1] == L',')
{
index--;
}
bool dotFound = false;
bool validTextBeforeDot = false;
int linkOffset = index;
+ const wchar_t* pText = text.GetPointer();
while (lastLinkEndIndex <= linkOffset)
{
- if (!IsGenericCharacter(text[linkOffset]) || text[linkOffset] == L'(' || text[linkOffset] == L'[')
+ if (!IsGenericCharacter(pText[linkOffset]) || pText[linkOffset] == L'(' || pText[linkOffset] == L'[')
{
linkOffset++;
break;
}
- if (dotFound == false && text[linkOffset] == L'.')
+ if (dotFound == false && pText[linkOffset] == L'.')
{
dotFound = true;
}
- if (validTextBeforeDot == false && dotFound == true && text[linkOffset] != L'.')
+ if (validTextBeforeDot == false && dotFound == true && pText[linkOffset] != L'.')
{
validTextBeforeDot = true;
}
linkOffset--;
+
+ if (lastLinkEndIndex > linkOffset)
+ {
+ linkOffset++;
+ break;
+ }
}
if (dotFound == true && validTextBeforeDot != true)
if (dotFound == true)
{
- while (text[linkOffset] == L'.' || text[linkOffset] == L',')
+ while (pText[linkOffset] == L'.' || pText[linkOffset] == L',')
{
linkOffset++;
}
}
index += domainLength;
- if (text[index] == L'/')
+ if (pText[index] == L'/')
{
while (index > 0)
{
- if (!IsGenericCharacter(text[index]) && text[index] != L')' && text[index] != L']')
+ if (!IsGenericCharacter(pText[index]) && pText[index] != L')' && pText[index] != L']')
{
break;
}
index++;
}
}
- else if (text[index] != null && text[index] != L' ' && text[index] != TEXT_JAPANESE_SPACE &&
- text[index] != L')' && text[index] != L']' && text[index] != 0xFFFC &&
- text[index] != 0x000A && text[index] != 0x000D)
+ else if (pText[index] != null && pText[index] != L' ' && pText[index] != TEXT_JAPANESE_SPACE &&
+ pText[index] != L')' && pText[index] != L']' && pText[index] != 0xFFFC &&
+ pText[index] != 0x000A && pText[index] != 0x000D)
{
return false;
}
int atIndex = 0;
int totalLength = text.GetLength();
int linkOffset = index;
+ const wchar_t* pText = text.GetPointer();
- if (text[index + 1] == L'@')
+ if (pText[index + 1] == L'@')
{
return false;
}
if (index > lastLinkEndIndex)
{
- while (IsEmailCharacter(text[linkOffset]) && lastLinkEndIndex <= linkOffset)
+ while (IsEmailCharacter(pText[linkOffset]) && lastLinkEndIndex <= linkOffset)
{
linkOffset--;
}
atIndex = index;
index++;
- while (IsEmailCharacter(text[index]) && index < totalLength)
+ while (IsEmailCharacter(pText[index]) && index < totalLength)
{
if (validTextAfterAt == false)
{
validTextAfterAt = true;
}
- if (text[index] == '.')
+ if (pText[index] == '.')
{
- if (text[index + 1] == '.')
+ if (pText[index + 1] == '.')
{
break;
}
return false;
}
- while (text[index - 1] == L'.')
+ while (pText[index - 1] == L'.')
{
index--;
}
int oneDot = false;
int linkOffset = 0;
int blankCount = 0;
-
+ const wchar_t* pText = text.GetPointer();
int totalLength = text.GetLength();
- if (text[index] == L'+')
+
+ if (pText[index] == L'+')
{
k = 0;
- if (!Character::IsDigit(text[index + 1]))
+ if (!Character::IsDigit(pText[index + 1]))
{
return false;
}
while (k < _MIN_PHONE_NUMBER_LENGTH)
{
- if (Character::IsDigit(text[index + j]) || text[index + j] == L'*' || text[index + j] == L'#')
+ if (Character::IsDigit(pText[index + j]) || pText[index + j] == L'*' || pText[index + j] == L'#')
{
k++;
oneHyphen = false;
oneDot = false;
}
- else if (oneHyphen == false && text[index + j] == L'-')
+ else if (oneHyphen == false && pText[index + j] == L'-')
{
oneHyphen = true;
}
- else if (oneDot == false && text[index + j] == L'.')
+ else if (oneDot == false && pText[index + j] == L'.')
{
oneDot = true;
}
- else if (text[index + j] == L' ' || text[index + j] == TEXT_JAPANESE_SPACE || text[index + j] == L'(' || text[index + j] == L')')
+ else if (pText[index + j] == L' ' || pText[index + j] == TEXT_JAPANESE_SPACE || pText[index + j] == L'(' || pText[index + j] == L')')
{
// empty statement
}
linkOffset = index;
while (index < totalLength &&
- (Character::IsDigit(text[index]) || (text[index] == L'*') ||
- (text[index] == L'#') || (text[index] == L'-') ||
- (text[index] == L' ') || (text[index] == TEXT_JAPANESE_SPACE) || (text[index] == L'+') ||
- (text[index] == L'.') || (text[index] == L'(') ||
- (text[index] == L')') || (index == linkOffset && (text[linkOffset] == L'+'))))
+ (Character::IsDigit(pText[index]) || (pText[index] == L'*') ||
+ (pText[index] == L'#') || (pText[index] == L'-') ||
+ (pText[index] == L' ') || (pText[index] == TEXT_JAPANESE_SPACE) || (pText[index] == L'+') ||
+ (pText[index] == L'.') || (pText[index] == L'(') ||
+ (pText[index] == L')') || (index == linkOffset && (pText[linkOffset] == L'+'))))
{
index++;
- if (blankCount == 0 && (text[index] == L' ' || text[index] == TEXT_JAPANESE_SPACE))
+ if (blankCount == 0 && (pText[index] == L' ' || pText[index] == TEXT_JAPANESE_SPACE))
{
blankCount++;
}
- else if (blankCount == 1 && (text[index] == L' ' || text[index] == TEXT_JAPANESE_SPACE))
+ else if (blankCount == 1 && (pText[index] == L' ' || pText[index] == TEXT_JAPANESE_SPACE))
{
blankCount++;
break;
}
- else if (Character::IsDigit(text[index]) || text[index] == L'*' || text[index] == L'#')
+ else if (Character::IsDigit(pText[index]) || pText[index] == L'*' || pText[index] == L'#')
{
blankCount = 0;
}
- else if (text[index] == L'-' && text[index + 1] == L'-')
+ else if (pText[index] == L'-' && pText[index + 1] == L'-')
{
break;
}
- else if (text[index] == L'(' || text[index] == L')')
+ else if (pText[index] == L'(' || pText[index] == L')')
{
break;
}
- else if ((text[index] == L'.' &&
- text[index + 1] == L'.') || (text[index] == L'.' && !Character::IsDigit(text[index + 1])))
+ else if ((pText[index] == L'.' &&
+ pText[index + 1] == L'.') || (pText[index] == L'.' && !Character::IsDigit(pText[index + 1])))
{
break;
}
}
}
- if (text[index - 1] == L' ' || text[index - 1] == TEXT_JAPANESE_SPACE)
+ if (pText[index - 1] == L' ' || pText[index - 1] == TEXT_JAPANESE_SPACE)
{
index -= 1;
- while (text[index] == L' ' || text[index] == TEXT_JAPANESE_SPACE)
+ while (pText[index] == L' ' || pText[index] == TEXT_JAPANESE_SPACE)
{
index--;
}
if (!gpUrlPrefixes)
{
gpUrlPrefixes = new (std::nothrow) ArrayListT <String>;
- SysTryCatch(NID_GRP
- , gpUrlPrefixes != null
- , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryCatch(NID_GRP, gpUrlPrefixes != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
r = gpUrlPrefixes->Construct();
- SysTryCatch(NID_GRP
- , r == E_SUCCESS
- , , r, "[%s] Propagated.", GetErrorMessage(r));
+ SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagated.", GetErrorMessage(r));
gpUrlPrefixes->Add(L"www.");
gpUrlPrefixes->Add(L"http://");
if (!gpDomainNames)
{
gpDomainNames = new (std::nothrow) ArrayListT <Tizen::Base::String>;
- SysTryCatch(NID_GRP
- , gpDomainNames != null
- , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryCatch(NID_GRP, gpDomainNames != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
r = gpDomainNames->Construct();
- SysTryCatch(NID_GRP
- , r == E_SUCCESS
- , , r, "[%s] Propagated.", GetErrorMessage(r));
+ SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Propagated.", GetErrorMessage(r));
gpDomainNames->Add(L".com");
gpDomainNames->Add(L".net");
}
pTextLink = CreateTextLinkInfo(0, 0, LINK_TYPE_NONE);
- SysTryCatch(NID_GRP
- , pTextLink != null
- , , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryCatch(NID_GRP, pTextLink != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
pTextLink->index = -1;
else
{
TextLinkInfo* pNextLink = CreateTextLinkInfo(linkStartIndex, linkLength, linkType);
- SysTryCatch(NID_GRP
- , pNextLink != null,
- r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
+ SysTryCatch(NID_GRP, pNextLink != null,r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
AppendTextLinkInfo(pTextLink, pNextLink);
}
result
TextCutLinkParser::SetCutLinkMask(int mask)
{
- SysTryReturn(NID_GRP
- , LINK_TYPE_NONE <= mask && mask < LINK_TYPE_MAX
+ SysTryReturn(NID_GRP, LINK_TYPE_NONE <= mask && mask < LINK_TYPE_MAX
, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
__linkMask = mask;
TextCutLinkParser::CreateTextLinkInfo(int offset, int length, LinkType linkType)
{
TextLinkInfo* pTextLinkInfo = new (std::nothrow) TextLinkInfo;
- SysTryReturn(NID_GRP
- , pTextLinkInfo != null
- , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
+ SysTryReturn(NID_GRP, pTextLinkInfo != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
pTextLinkInfo->index = 0;
pTextLinkInfo->srcOffset = offset;