kernel/eka/include/e32std.inl
changeset 90 947f0dc9f7a8
parent 33 0173bcd7697c
child 109 b3a1d9898418
--- a/kernel/eka/include/e32std.inl	Tue Feb 02 01:24:03 2010 +0200
+++ b/kernel/eka/include/e32std.inl	Fri Apr 16 16:24:37 2010 +0300
@@ -259,6 +259,102 @@
 @return True, if the character is 0; false, otherwise.
 */
 	{return(iChar==0);}
+
+
+
+
+inline TBool TChar::IsSupplementary(TUint aChar)
+/**
+@param aChar The 32-bit code point value of a Unicode character.
+
+@return True, if aChar is supplementary character; false, otherwise.
+*/
+	{
+	return (aChar > 0xFFFF);
+	}
+
+
+
+
+inline TBool TChar::IsSurrogate(TText16 aInt16)
+/**
+@return True, if aText16 is high surrogate or low surrogate; false, otherwise.
+*/
+	{
+	return (aInt16 & 0xF800) == 0xD800;
+	}
+
+
+
+
+inline TBool TChar::IsHighSurrogate(TText16 aInt16)
+/**
+@return True, if aText16 is high surrogate; false, otherwise.
+*/
+	{
+	return (aInt16 & 0xFC00) == 0xD800;
+	}
+
+
+
+
+inline TBool TChar::IsLowSurrogate(TText16 aInt16)
+/**
+@return True, if aText16 is low surrogate; false, otherwise.
+*/
+	{
+	return (aInt16 & 0xFC00) == 0xDC00;
+	}
+
+
+
+
+inline TUint TChar::JoinSurrogate(TText16 aHighSurrogate, TText16 aLowSurrogate)
+/**
+Combine a high surrogate and a low surrogate into a supplementary character.
+
+@return The 32-bit code point value of the generated Unicode supplementary
+        character.
+*/
+	{
+	return ((aHighSurrogate - 0xD7F7) << 10) + aLowSurrogate;
+	}
+
+
+
+
+inline TText16 TChar::GetHighSurrogate(TUint aChar)
+/**
+Retrieve the high surrogate of a supplementary character.
+
+@param aChar The 32-bit code point value of a Unicode character.
+
+@return High surrogate of aChar, if aChar is a supplementary character; 
+        aChar itself, if aChar is not a supplementary character.
+
+@see TChar::GetLowSurrogate
+*/
+	{
+	return STATIC_CAST(TText16, 0xD7C0 + (aChar >> 10));
+	}
+
+
+
+
+inline TText16 TChar::GetLowSurrogate(TUint aChar)
+/**
+Retrieve the low surrogate of a supplementary character.
+
+@param aChar The 32-bit code point value of a Unicode character.
+
+@return Low surrogate of aChar, if aChar is a supplementary character; 
+        zero, if aChar is not a supplementary character.
+
+@see TChar::GetHighSurrogate
+*/
+	{
+	return STATIC_CAST(TText16, 0xDC00 | (aChar & 0x3FF));
+	}
 #endif // _UNICODE