Beispiel #1
0
TCDynStr::TCDynStr(const TCString& str,uint pos,uint count)
/****************************************************************************
*
* Function:     TCDynStr::TCDynStr
* Parameters:   str     - TCString to copy from
*               pos     - Starting position in the string
*               count   - Number of characters to copy
*
* Description:  Constructs a string from another string, starting at the
*               position 'pos' and including 'count' characters.
*
****************************************************************************/
{
    CHECK(str.valid());
    if (pos > str.length())
        pos = str.length();
    if (count > str.length() - pos)
        count = str.length() - pos;
    len = count+1;
    size = computeSize(len);
    if ((text = new char[size]) != NULL) {
        memcpy(text,(const char *)str+pos,len);
        text[count] = '\0';             // Null terminate the string
        }
}
Beispiel #2
0
TCSubStr::TCSubStr(const TCString& str,uint pos,uint count)
/****************************************************************************
*
* Function:		TCSubStr::TCSubStr
* Parameters:	str		- TCString to copy from
*				pos		- Starting position in the string
*				count	- Number of characters to copy
*
* Description:	Constructs a TCSubStr from another string, starting at the
*				position 'pos' and including 'count' characters.
*
****************************************************************************/
{
	CHECK(str.valid());
	if (pos > str.length())
		pos = str.length();
	if (count > str.length() - pos)
		count = str.length() - pos;
	len = count+1;
	text = (char *)((const char *)str + pos);
}
Beispiel #3
0
TCDynStr operator * (const TCString& s1,uint count)
{
    CHECK(s1.valid());
    TCDynStr    s(s1);
    return s *= count;
}
Beispiel #4
0
TCDynStr operator + (const char *s1,const TCString& s2)
{
    CHECK(s1 != NULL && s2.valid());
    TCDynStr    s(s1);
    return s += s2;
}
Beispiel #5
0
TCDynStr operator + (const TCString& s1,const TCString& s2)
{
    CHECK(s1.valid() && s2.valid());
    TCDynStr    s(s1);
    return s += s2;
}