Ejemplo n.º 1
0
bool t_Str::operator!=(const t_Str &s1) const
{
        if(compare(s1.getText()) != 0)
                return true;

        return false;
}
Ejemplo n.º 2
0
void t_Str::copy(const t_Str &original)
{
	clear();

	if(original.getLength() < minsize)
	{
		content.ministring.length = (unsigned)original.getLength();
		memmove(content.ministring.text, original.getText(), original.getLength() + 1);
		content.ministring.big = false;
		return;
	}

//	ptr = original.getText();
	content.bigstring.length = original.getLength();
	content.bigstring.size = setSize(original.getLength() + 1);
	content.bigstring.text = getSpace(content.bigstring.size);
	content.ministring.big = true;
	memmove(content.bigstring.text, original.getText(), original.getLength() + 1);
}
Ejemplo n.º 3
0
t_Str::t_Str(const t_Str &str, size_t start, size_t chars)
{
	init();
	char *ptr = str.getText();
	size_t len = str.getLength();

	if(start >= len)
		return;

	ptr += start;
	len -= start;
	
	if(chars >= len)
		chars = len;

	set(ptr, chars);
}
Ejemplo n.º 4
0
int strprintf(t_Str &str, size_t size, const char *format, ...)
{
	va_list args;
	va_start(args, format);
	int rtn;

	if(!size)
		size = str.getSize();

	if(size > str.getSize())
		str.resize(size);

	char *ptr = str.getText();
	str.setLength(0);
	ptr[0] = 0;
	rtn = vsnprintf(ptr, size, format, args);
	str.setLength(strlen(ptr));
	va_end(args);
	return rtn;
}
Ejemplo n.º 5
0
bool t_Str::operator*=(const t_Str &s1) const
{
	return search(s1.getText(), s1.getLength()) != npos;
}
Ejemplo n.º 6
0
size_t t_Str::rfind(const t_Str &str, size_t ind) const
{
	return rfind(str.getText(), ind, str.getLength());
}
Ejemplo n.º 7
0
size_t t_Str::find(const t_Str &str, size_t ind, unsigned instance) const
{
	return find(str.getText(), ind, str.getLength(), instance);
}
Ejemplo n.º 8
0
unsigned t_Str::count(const t_Str &str, size_t ind) const
{
	return count(str.getText(), ind, str.getLength());
}
Ejemplo n.º 9
0
void t_Str::append(const t_Str &str)
{
	append(str.getText(), str.getLength());
}
Ejemplo n.º 10
0
void t_Str::set(const t_Str &str)
{
	set(str.getText(), str.getLength());
}
Ejemplo n.º 11
0
void t_Str::insert(size_t start, const t_Str &s)
{
	insert(start, s.getText(), s.getLength());
}