Exemplo n.º 1
0
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
{
	TiXmlString tmp;
	tmp.reserve(a.length() + b.length());
	tmp += a;
	tmp += b;
	return tmp;
}
Exemplo n.º 2
0
	// TiXmlString copy constructor
	TiXmlString::TiXmlString (const TiXmlString& copy)
	{
		unsigned newlen;
		WCHAR * newstring;

		// Prevent copy to self!
		if ( &copy == this )
			return;

		if (! copy.allocated)
		{
			allocated = 0;
			cstring = NULL;
			current_length = 0;
			return;
		}
		newlen = copy.length () + 1;
		newstring = new WCHAR [newlen];

		// strcpy (newstring, copy.cstring);
		CopyMemory(newstring, copy.cstring, sizeof(WCHAR)*newlen);

		allocated = newlen;
		cstring = newstring;
		current_length = newlen - 1;
	}
Exemplo n.º 3
0
TiXmlString operator + (const char* a, const TiXmlString & b)
{
	TiXmlString tmp;
	TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( std::strlen(a) );
	tmp.reserve(a_len + b.length());
	tmp.append(a, a_len);
	tmp += b;
	return tmp;
}
Exemplo n.º 4
0
TiXmlString operator + (const TiXmlString & a, const char* b)
{
	TiXmlString tmp;
	TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( std::strlen(b) );
	tmp.reserve(a.length() + b_len);
	tmp += a;
	tmp.append(b, b_len);
	return tmp;
}
Exemplo n.º 5
0
bool TiXmlString::operator == (const TiXmlString & compare) const
{
	if ( allocated && compare.allocated )
	{
		assert( cstring );
		assert( compare.cstring );
		return ( strcmp( cstring, compare.cstring ) == 0 );
 	}
	else if ( length() == 0 && compare.length() == 0 )
	{
		return true;
	}
	return false;
}
Exemplo n.º 6
0
	// TiXmlString copy constructor
	TiXmlString ( const TiXmlString & copy) : rep_(0)
	{
		init(copy.length());
		memcpy(start(), copy.data(), length());
	}
Exemplo n.º 7
0
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
{
	return    ( a.length() == b.length() )				// optimization on some platforms
	       && ( strcmp(a.c_str(), b.c_str()) == 0 );	// actual compare
}