Exemplo n.º 1
0
UTF8API_EXPORT void uFixAmpersandChars_v2(const char * src,string_base & out)
{
	out.reset();
	while(*src)
	{
		if (*src=='&')
		{
			out.add_string("&&");
			src++;
		}
		else out.add_byte(*(src++));
	}
}
Exemplo n.º 2
0
bool menu_manager::get_description(menu_item::type type,const char * name,string_base & out)
{
	service_enum_t<menu_item> e;
	menu_item * ptr;
	string8_fastalloc action_name;
	for(ptr=e.first();ptr;ptr=e.next())
	{
		if (ptr->get_type()==type)
		{
			unsigned action,num_actions = ptr->get_num_items();
			for(action=0;action<num_actions;action++)
			{
				action_name.reset();
				ptr->enum_item(action,action_name);
				if (!stricmp_utf8(name,action_name))
				{
					bool rv = ptr->get_description(action,out);
					ptr->service_release();
					if (!rv) out.reset();
					return rv;
				}
			}
		}
		ptr->service_release();
	}
	return false;
}
Exemplo n.º 3
0
static void fix_ampersand(const char * src,string_base & out)
{
	unsigned ptr = 0;
	while(src[ptr])
	{
		if (src[ptr]=='&')
		{
			out.add_string("&&");
			ptr++;
			while(src[ptr]=='&')
			{
				out.add_string("&&");
				ptr++;
			}
		}
		else out.add_byte(src[ptr++]);
	}
}
Exemplo n.º 4
0
void stringToLowerAppend(string_base & out, const char * src, t_size len) {
	while(len && *src) {
		unsigned c; t_size d;
		d = utf8_decode_char(src,c,len);
		if (d==0 || d>len) break;
		out.add_char(charLower(c));
		src+=d;
		len-=d;
	}
}
Exemplo n.º 5
0
void string_printf::g_run(string_base & out,const char * fmt,va_list list)
{
	out.reset();
	while(*fmt)
	{
		if (*fmt=='%')
		{
			fmt++;
			if (*fmt=='%')
			{
				out.add_char('%');
				fmt++;
			}
			else
			{
				bool force_sign = false;
				if (*fmt=='+')
				{
					force_sign = true;
					fmt++;
				}
				char padchar = (*fmt == '0') ? '0' : ' ';
				t_size pad = 0;
				while(*fmt>='0' && *fmt<='9')
				{
					pad = pad * 10 + (*fmt - '0');
					fmt++;
				}

				if (*fmt=='s' || *fmt=='S')
				{
					const char * ptr = va_arg(list,const char*);
					t_size len = strlen(ptr);
					if (pad>len) out.add_chars(padchar,pad-len);
					out.add_string(ptr);
					fmt++;

				}
				else if (*fmt=='i' || *fmt=='I' || *fmt=='d' || *fmt=='D')
				{
					char temp[8*sizeof(int)];
					int val = va_arg(list,int);
					if (force_sign && val>0) out.add_char('+');
					_itoa_s(val,temp,10);
					t_size len = strlen(temp);
					if (pad>len) out.add_chars(padchar,pad-len);
					out.add_string(temp);
					fmt++;
				}
				else if (*fmt=='u' || *fmt=='U')
Exemplo n.º 6
0
inline euint _hash ( const string_base<C, STR_CMP_PROC, DEFAULT_STR_PROC> &key )
{
    return key.get_hash();
}