bool menu_helpers::context_get_description(const GUID& p_guid,pfc::string_base & out) {
	service_ptr_t<contextmenu_item> ptr; t_uint32 index;
	if (!menu_item_resolver::g_resolve_context_command(p_guid, ptr, index)) return false;
	bool rv = ptr->get_item_description(index, out);
	if (!rv) out.reset();
	return rv;
}
bool file_info::meta_format(const char * p_name,pfc::string_base & p_out, const char * separator) const {
    p_out.reset();
    t_size index = meta_find(p_name);
    if (index == pfc_infinite) return false;
    meta_format_entry(index, p_out, separator);
    return true;
}
Example #3
0
void toolbar_extension::button::get_name(pfc::string_base & p_out) //config
{
	p_out.reset();
	if (m_type == TYPE_BUTTON)
	{
		p_out = "[Button] ";
		pfc::string8 temp;
		if (uie::custom_button::g_button_get_name(m_guid, temp))
		{
			p_out += temp;
		}
	}
	else if (m_type == TYPE_SEPARATOR)
		p_out = "[Separator]";
	else if (m_type == TYPE_MENU_ITEM_MAIN)
	{
		pfc::string8 temp;
		p_out = "[Main menu item] ";
		menu_helpers::mainpath_from_guid(m_guid, m_subcommand, temp);
		p_out += temp;
	}
	else
	{
		pfc::string8 temp;
		menu_helpers::contextpath_from_guid(m_guid, m_subcommand, temp);
		p_out = "[Shortcut menu item] ";
		p_out += temp;
	}
}
Example #4
0
	bool maingroupname_from_guid(const GUID & p_guid, pfc::string_base & p_out, GUID & parentout)
	{
		p_out.reset();
		parentout = pfc::guid_null;
		{
			service_enum_t<mainmenu_group> e;
			service_ptr_t<mainmenu_group> ptr;
			service_ptr_t<mainmenu_group_popup> ptrp;

			//unsigned p_service_item_index;
			while (e.next(ptr))
			{
				{
					if (ptr->get_guid() == p_guid)
					{
						parentout = ptr->get_parent();
						if (ptr->service_query_t(ptrp))
						{
							ptrp->get_display_string(p_out);
							return true;
						}
						return false;
					}

				}
			}
		}
		return false;
	}
Example #5
0
void toolbar_extension::button::get_display_text(pfc::string_base & p_out) //display
{
	p_out.reset();
	if (m_use_custom_text)
		p_out = m_text;
	else
		get_short_name(p_out);
}
Example #6
0
void wsh_panel_vars::get_default_script_code(pfc::string_base & out)
{
	out.reset();
	puResource pures = uLoadResource(core_api::get_my_instance(), uMAKEINTRESOURCE(IDR_SCRIPT), "SCRIPT");

	if (pures)
		out.set_string(reinterpret_cast<const char *>(pures->GetPointer()), pures->GetSize());
}
Example #7
0
	void insert(const char * src,unsigned idx,pfc::string_base & out)
	{
		out.reset();
		out.add_string(src,idx);
		out.add_string("&");
		out.add_string(src+idx);
		used.add_char(uCharLower(src[idx]));
	}
void file_info::meta_format_entry(t_size index, pfc::string_base & out, const char * separator) const {
    out.reset();
    t_size val, count = meta_enum_value_count(index);
    PFC_ASSERT( count > 0);
    for(val=0; val<count; val++)
    {
        if (val > 0) out += separator;
        out += meta_enum_value(index,val);
    }
}
Example #9
0
bool metadb_handle::format_title_legacy(titleformat_hook * p_hook,pfc::string_base & p_out,const char * p_spec,titleformat_text_filter * p_filter)
{
	service_ptr_t<titleformat_object> script;
	if (static_api_ptr_t<titleformat_compiler>()->compile(script,p_spec)) {
		return format_title(p_hook,p_out,script,p_filter);
	} else {
		p_out.reset();
		return false;
	}
}
Example #10
0
	virtual bool get_mask(unsigned idx, pfc::string_base & out)
	{
		if (idx > 0) return false;
		out.reset();
		for (int n = 0; n < 14; n++)
		{
			if (n) out.add_byte(';');
			out << "*." << extensions[n];
		}
		return true;
	}
Example #11
0
void pfc::winPrefixPath(pfc::string_base & out, const char * p_path) {
	const char * prepend_header = "\\\\?\\";
	const char * prepend_header_net = "\\\\?\\UNC\\";
	if (pfc::strcmp_partial( p_path, prepend_header ) == 0) { out = p_path; return; }
	out.reset();
	if (pfc::strcmp_partial(p_path,"\\\\") != 0) {
		out << prepend_header << p_path;
	} else {
		out << prepend_header_net << (p_path+2);
	}
};
Example #12
0
void stream_reader::read_string_raw(pfc::string_base & p_out,abort_callback & p_abort) {
	enum {delta = 256};
	char buffer[delta];
	p_out.reset();
	for(;;) {
		t_size delta_done;
		delta_done = read(buffer,delta,p_abort);
		p_out.add_string(buffer,delta_done);
		if (delta_done < delta) break;
	}
}
Example #13
0
void toolbar_extension::button::get_short_name(pfc::string_base & p_out) //tooltip
{
	p_out.reset();
	if (m_type == TYPE_BUTTON)
		uie::custom_button::g_button_get_name(m_guid, p_out);
	else if (m_type == TYPE_SEPARATOR)
		p_out = "Separator";
	else if (m_type == TYPE_MENU_ITEM_MAIN)
		menu_helpers::mainpath_from_guid(m_guid, m_subcommand, p_out, true);
	else
		menu_helpers::contextpath_from_guid(m_guid, m_subcommand, p_out, true);
}
	void chars_to_lower( const char* p_src , pfc::string_base& p_out )
	{
		p_out.reset();
		const char* p = p_src;
		for (;*p;)
		{
			unsigned test;
			t_size delta = pfc::utf8_decode_char(p,test);
			if( delta == 0 || test == 0 ) break;
			p_out.add_char(pfc::charLower(test));
			p+=delta;
		}
	}
Example #15
0
void titleformat_compiler::remove_color_marks(const char * src,pfc::string_base & out)//helper
{
	out.reset();
	while(*src)
	{
		if (*src==3)
		{
			src++;
			while(*src && *src!=3) src++;
			if (*src==3) src++;
		}
		else out.add_byte(*src++);
	}
}
Example #16
0
	void mainpath_from_guid(const GUID & p_guid, const GUID & p_subguid, pfc::string_base & p_out, bool b_short)
	{
		p_out.reset();
		service_enum_t<mainmenu_commands> e;
		service_ptr_t<mainmenu_commands> ptr;

		unsigned p_service_item_index;
		while (e.next(ptr))
		{
			service_ptr_t<mainmenu_commands_v2> ptr_v2;
			ptr->service_query_t(ptr_v2);
			unsigned p_service_item_count = ptr->get_command_count();
			for (p_service_item_index = 0; p_service_item_index < p_service_item_count; p_service_item_index++)
			{
				if (p_guid == ptr->get_command(p_service_item_index))
				{
					pfc::string8 name;
					ptr->get_name(p_service_item_index, name);
					if (p_subguid != pfc::guid_null && ptr_v2.is_valid() && ptr_v2->is_command_dynamic(p_service_item_index))
					{
						pfc::string8 name_sub;
						mainmenu_node::ptr ptr_node = ptr_v2->dynamic_instantiate(p_service_item_index);
						mainmenunode_subguid_to_path(ptr_node, p_subguid, name_sub, true);
						name << "/" << name_sub;
					}
					if (!b_short)
					{
						pfc::list_t<pfc::string8> levels;
						GUID parent = ptr->get_parent();
						while (parent != pfc::guid_null)
						{
							pfc::string8 parentname;
							if (maingroupname_from_guid(GUID(parent), parentname, parent))
								levels.insert_item(parentname, 0);
						}
						unsigned i, count = levels.get_count();
						for (i = 0; i<count; i++)
						{
							p_out.add_string(levels[i]);
							p_out.add_byte('/');

						}
					}
					p_out.add_string(name);
				}

			}
		}
	}
Example #17
0
void winPrefixPath(pfc::string_base & out, const char * p_path) {
	if (pfc::string_has_prefix(p_path, "..\\") || strstr(p_path, "\\..\\") ) {
		// do not touch relative paths if we somehow got them here
		out = p_path;
		return;
	}
	const char * prepend_header = "\\\\?\\";
	const char * prepend_header_net = "\\\\?\\UNC\\";
	if (pfc::strcmp_partial( p_path, prepend_header ) == 0) { out = p_path; return; }
	out.reset();
	if (pfc::strcmp_partial(p_path,"\\\\") != 0) {
		out << prepend_header << p_path;
	} else {
		out << prepend_header_net << (p_path+2);
	}
};
Example #18
0
void toolbar_extension::button::get_name_type(pfc::string_base & p_out) //config
{
	p_out.reset();
	if (m_type == TYPE_BUTTON)
	{
		p_out = "Button";
	}
	else if (m_type == TYPE_SEPARATOR)
		p_out = "Separator";
	else if (m_type == TYPE_MENU_ITEM_MAIN)
	{
		p_out = "Main menu item";
	}
	else
	{
		p_out = "Shortcut menu item";
	}
}
Example #19
0
	bool __contextpath_from_guid_recur(contextmenu_item_node * p_node, const GUID & p_subcommand, pfc::string_base & p_out, bool b_short, bool b_root)
	{
		if (p_node)
		{
			if (p_node->get_type() == contextmenu_item_node::TYPE_POPUP)
			{
				pfc::string8 subname, temp = p_out;
				unsigned dummy;
				p_node->get_display_data(subname, dummy, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list);
				if (temp.get_length() && temp.get_ptr()[temp.get_length() - 1] != '/')
					temp.add_byte('/');
				temp << subname;
				unsigned child, child_count = p_node->get_children_count();
				for (child = 0; child<child_count; child++)
				{
					contextmenu_item_node * p_child = p_node->get_child(child);
					if (__contextpath_from_guid_recur(p_child, p_subcommand, temp, b_short, false))
					{
						p_out = temp;
						return true;
					}
				}
			}
			else if (p_node->get_type() == contextmenu_item_node::TYPE_COMMAND && !b_root)
			{
				if (p_node->get_guid() == p_subcommand)
				{
					pfc::string8 subname;
					unsigned dummy;
					p_node->get_display_data(subname, dummy, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list);
					if (!b_short)
						p_out.add_byte('/');
					else
						p_out.reset();
					p_out.add_string(subname);
					return true;
				}
			}
		}
		return false;
	}
Example #20
0
	void contextpath_from_guid(const GUID & p_guid, const GUID & p_subcommand, pfc::string_base & p_out, bool b_short)
	{
		p_out.reset();
		service_enum_t<contextmenu_item> e;
		service_ptr_t<contextmenu_item> ptr;

		unsigned p_service_item_index;
		while (e.next(ptr))
		{
			unsigned p_service_item_count = ptr->get_num_items();
			for (p_service_item_index = 0; p_service_item_index < p_service_item_count; p_service_item_index++)
			{
				if (p_guid == ptr->get_item_guid(p_service_item_index))
				{
					pfc::string8 name;
					ptr->get_item_name(p_service_item_index, name);
					if (!b_short)
					{
						ptr->get_item_default_path(p_service_item_index, p_out);
						if (p_out.get_length() && p_out[p_out.get_length() - 1] != '/')
							p_out.add_byte('/');
					}
					p_out.add_string(name);

					if (p_subcommand != pfc::guid_null)
					{
						pfc::ptrholder_t<contextmenu_item_node_root> p_node(ptr->instantiate_item(p_service_item_index, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list));

						if (p_node.is_valid())
							if (__contextpath_from_guid_recur(p_node.get_ptr(), p_subcommand, p_out, b_short, true))
								return;
					}
				}

			}
		}
	}
Example #21
0
void GetOSVersionString(pfc::string_base & out) {
	out.reset(); GetOSVersionStringAppend(out);
}
Example #22
0
void urlEncode(pfc::string_base & out, const char * in) {
	out.reset(); urlEncodeAppend(out, in);
}
Example #23
0
static void build_cue_meta_name(const char * p_name,unsigned p_tracknumber,pfc::string_base & p_out) {
	p_out.reset();
	p_out << "cue_track" << pfc::format_uint(p_tracknumber % 100,2) << "_" << p_name;
}
	void read_v2(const service_ptr_t<file> & p_file,abort_callback & p_abort,pfc::string_base & p_out,bool & is_utf8, bool forceUTF8) {
		p_out.reset();
		p_file->reopen( p_abort );
		
		pfc::array_t<char> mem;
		t_filesize size64;
		size64 = p_file->get_size(p_abort);
		if (size64 == filesize_invalid)//typically HTTP
		{
			pfc::string8 ansitemp;
			t_size done;
			enum { delta = 1024 * 64, max = 1024 * 512 };

			if ( forceUTF8 ) {
				is_utf8 = true;
			} else {
				is_utf8 = false;
				char temp[3];
				done = p_file->read(temp, 3, p_abort);
				if (done != 3)
				{
					if (done > 0) p_out = pfc::stringcvt::string_utf8_from_ansi(temp, done);
					return;
				}
				if (!memcmp(utf8_header, temp, 3)) is_utf8 = true;
				else ansitemp.add_string(temp, 3);
			}

			mem.set_size(delta);
			
			for(;;)
			{
				done = p_file->read(mem.get_ptr(),delta,p_abort);
				if (done > 0)
				{
					if (is_utf8) p_out.add_string(mem.get_ptr(),done);
					else ansitemp.add_string(mem.get_ptr(),done);
				}
				if (done < delta) break;
			}

			if (!is_utf8)
			{
				p_out = pfc::stringcvt::string_utf8_from_ansi(ansitemp);
			}

			return;
		}
		else
		{
			if (size64>1024*1024*128) throw exception_io_data();//hard limit
			t_size size = pfc::downcast_guarded<t_size>(size64);
			mem.set_size(size+1);
			char * asdf = mem.get_ptr();
			p_file->read_object(asdf,size,p_abort);
			asdf[size]=0;
			if ( forceUTF8 ) {
				is_utf8 = true;
				p_out = asdf;
			} else if (size>3 && !memcmp(utf8_header,asdf,3)) {
				is_utf8 = true; 
				p_out.add_string(asdf+3); 
			} else {
				is_utf8 = false;
				p_out = pfc::stringcvt::string_utf8_from_ansi(asdf);
			}
			return;
		}
	}
Example #25
0
void titleformat_compiler::remove_forbidden_chars_string(pfc::string_base & p_out,const char * p_source,t_size p_source_len,const char * p_reserved_chars)
{
	p_out.reset();
	remove_forbidden_chars_string_append(p_out,p_source,p_source_len,p_reserved_chars);
}