Esempio n. 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
        }
}
Esempio n. 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);
}
Esempio n. 3
0
TCDynStr operator * (const TCString& s1,uint count)
{
    CHECK(s1.valid());
    TCDynStr    s(s1);
    return s *= count;
}
Esempio n. 4
0
TCDynStr operator + (const char *s1,const TCString& s2)
{
    CHECK(s1 != NULL && s2.valid());
    TCDynStr    s(s1);
    return s += s2;
}
Esempio n. 5
0
TCDynStr operator + (const TCString& s1,const TCString& s2)
{
    CHECK(s1.valid() && s2.valid());
    TCDynStr    s(s1);
    return s += s2;
}