示例#1
0
文件: GString.cpp 项目: gbaumgart/vt
GString operator+(const signed char *_p1, GString &_p2)
{
	GString strRet;

	while (_p1 && *_p1)
	{
		if (strRet._len >= strRet._max)
			strRet.resize();
		strRet._str[strRet._len] = *_p1;
		_p1++;
		strRet._len++;
	}

	for (int i = 0; i < _p2._len; strRet._len++, i++)
	{
		if (strRet._len >= strRet._max)
			strRet.resize();
		strRet._str[strRet._len] = _p2._str[i];
	}

	if (strRet._len >= strRet._max)
		strRet.resize();
	strRet._str[strRet._len] = 0;

	return strRet;
}
示例#2
0
文件: GString.cpp 项目: gbaumgart/vt
GString operator+(GString &_p1, const char *_p2)
{
	GString strRet;

	for (int i = 0; i < _p1._len; strRet._len++, i++)
	{
		if (strRet._len >= strRet._max)
			strRet.resize();
		strRet._str[strRet._len] = _p1._str[i];
	}

	while (_p2 && *_p2)
	{
		if (strRet._len >= strRet._max)
			strRet.resize();
		strRet._str[strRet._len] = *_p2;
		_p2++;
		strRet._len++;
	}

	if (strRet._len >= strRet._max)
		strRet.resize();
	strRet._str[strRet._len] = 0;

	return strRet;
}