os/graphics/graphicstools/bitmapfonttools/inc/STRNG.INL
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Header STRNG.INL
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file
sl@0
    22
 @publishedAll 
sl@0
    23
*/
sl@0
    24
sl@0
    25
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    26
inline String::String()
sl@0
    27
 :	iLength(0), iText(NULL)
sl@0
    28
	{
sl@0
    29
	}
sl@0
    30
sl@0
    31
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    32
inline String::String(const char* aText)
sl@0
    33
 :	iLength(0), iText(NULL)
sl@0
    34
	{
sl@0
    35
	if (aText && CreateText(strlen(aText)))
sl@0
    36
		{
sl@0
    37
		CopyText(iText, aText, iLength);
sl@0
    38
		iText[iLength] = '\0';
sl@0
    39
		}
sl@0
    40
	}
sl@0
    41
sl@0
    42
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    43
inline String::String(int aLength,char* aText)
sl@0
    44
 :	iLength(0), iText(NULL)
sl@0
    45
	{
sl@0
    46
	if (aText && CreateText(aLength))
sl@0
    47
		{
sl@0
    48
		CopyText(iText, aText, aLength);
sl@0
    49
		iText[iLength] = '\0';
sl@0
    50
		}
sl@0
    51
	}
sl@0
    52
sl@0
    53
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    54
inline String::String(const String& aString)
sl@0
    55
 :	iLength(0), iText(NULL)
sl@0
    56
	{
sl@0
    57
	if (CreateText(aString.iLength))
sl@0
    58
		{
sl@0
    59
		CopyText(iText, aString.iText, iLength);
sl@0
    60
		iText[iLength] = '\0';
sl@0
    61
		}
sl@0
    62
	}
sl@0
    63
sl@0
    64
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    65
inline String& String::operator = (const char* aText)
sl@0
    66
	{
sl@0
    67
	char* text = iText;
sl@0
    68
	if (CreateText(strlen(aText)))
sl@0
    69
		{
sl@0
    70
		CopyText(iText, aText, iLength);
sl@0
    71
		iText[iLength] = '\0';
sl@0
    72
		DeleteText(text);
sl@0
    73
		}
sl@0
    74
	return *this;
sl@0
    75
	}
sl@0
    76
sl@0
    77
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    78
inline String& String::operator = (const String& aString)
sl@0
    79
	{
sl@0
    80
	String string(aString);
sl@0
    81
	char* text = iText;
sl@0
    82
	if (CreateText(string.iLength))
sl@0
    83
		{
sl@0
    84
		CopyText(iText, string.iText, iLength);
sl@0
    85
		iText[iLength] = '\0';
sl@0
    86
		DeleteText(text);
sl@0
    87
		}
sl@0
    88
	return *this;
sl@0
    89
	}
sl@0
    90
sl@0
    91
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
    92
inline String& String::operator += (const char aChar)
sl@0
    93
	{
sl@0
    94
	char* text = iText;
sl@0
    95
	if (CreateText(iLength + 1))
sl@0
    96
		{
sl@0
    97
		CopyText(iText, text, iLength - 1);
sl@0
    98
		iText[iLength - 1] = aChar;
sl@0
    99
		iText[iLength] = '\0';
sl@0
   100
		DeleteText(text);
sl@0
   101
		}
sl@0
   102
	return *this;
sl@0
   103
	}
sl@0
   104
sl@0
   105
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   106
inline String& String::operator += (const String& aString)
sl@0
   107
	{
sl@0
   108
	char* text = iText;
sl@0
   109
	int length = iLength;
sl@0
   110
	if (CreateText(length + aString.iLength))
sl@0
   111
		{
sl@0
   112
		CopyText(iText, text, length);
sl@0
   113
		CopyText(iText + length, aString.iText, aString.iLength);
sl@0
   114
		iText[iLength] = '\0';
sl@0
   115
		DeleteText(text);
sl@0
   116
		}
sl@0
   117
	return *this;
sl@0
   118
	}
sl@0
   119
sl@0
   120
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   121
inline int String::operator == (const String& aString) const
sl@0
   122
	{
sl@0
   123
	boolean same = etrue;
sl@0
   124
	if (iLength != aString.iLength)
sl@0
   125
		same = efalse;
sl@0
   126
	else
sl@0
   127
		{
sl@0
   128
		for (int i = 0; i < iLength; i++)
sl@0
   129
			same = same && ((*this)[i] == aString[i]);
sl@0
   130
		}
sl@0
   131
	return same;
sl@0
   132
	}
sl@0
   133
sl@0
   134
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   135
inline char& String::operator [] (const int aNum) const
sl@0
   136
	{
sl@0
   137
	return iText[aNum];
sl@0
   138
	}
sl@0
   139
sl@0
   140
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   141
inline int String::Length() const
sl@0
   142
	{
sl@0
   143
	return iLength;
sl@0
   144
	}
sl@0
   145
sl@0
   146
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   147
inline const char* String::Text()
sl@0
   148
	{
sl@0
   149
	return iText;
sl@0
   150
	}
sl@0
   151
sl@0
   152
/** WARNING:  Functon for internal use ONLY.  Compatibility is not guaranteed in future releases. */
sl@0
   153
inline void String::CopyText(char* aDest, const char* aSource, int aLength) const
sl@0
   154
	{
sl@0
   155
	for (int i = 0; i < aLength; i++)
sl@0
   156
		aDest[i] = aSource[i];
sl@0
   157
	}