comparison foosdk/sdk/foobar2000/SDK/icon_remap.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 //! New in 0.9.5; allows your file format to use another icon than <extension>.ico when registering the file type with Windows shell. \n
4 //! Implementation: use icon_remapping_impl, or simply: static service_factory_single_t<icon_remapping_impl> myicon("ext","iconname.ico");
5 class icon_remapping : public service_base {
6 public:
7 //! @param p_extension File type extension being queried.
8 //! @param p_iconname Receives the icon name to use, including the .ico extension.
9 //! @returns True when p_iconname has been set, false if we don't recognize the specified extension.
10 virtual bool query(const char * p_extension,pfc::string_base & p_iconname) = 0;
11
12 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(icon_remapping);
13 };
14
15 //! Standard implementation of icon_remapping.
16 class icon_remapping_impl : public icon_remapping {
17 public:
18 icon_remapping_impl(const char * p_extension,const char * p_iconname) : m_extension(p_extension), m_iconname(p_iconname) {}
19 bool query(const char * p_extension,pfc::string_base & p_iconname) {
20 if (pfc::stricmp_ascii(p_extension,m_extension) == 0) {
21 p_iconname = m_iconname; return true;
22 } else {
23 return false;
24 }
25 }
26 private:
27 pfc::string8 m_extension,m_iconname;
28 };