foobar2000 SDK  2015-01-14
Public Member Functions | Static Public Member Functions
input_file_typeabstract

#include <input_file_type.h>

+ Inheritance diagram for input_file_type:

Public Member Functions

 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (input_file_type)
 
virtual unsigned get_count ()=0
 
virtual bool get_mask (unsigned idx, pfc::string_base &out)=0
 
virtual bool get_name (unsigned idx, pfc::string_base &out)=0
 
virtual bool is_associatable (unsigned idx)=0
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Static Public Member Functions

static void build_openfile_mask (pfc::string_base &out, bool b_include_playlists=true)
 
static void make_extension_support_fingerprint (pfc::string_base &str)
 
static void make_filetype_support_fingerprint (pfc::string_base &str)
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Entrypoint interface for registering media file types that can be opened through "open file" dialogs or associated with foobar2000 application in Windows shell.
Instead of implementing this directly, use DECLARE_FILE_TYPE() / DECLARE_FILE_TYPE_EX() macros.

Definition at line 3 of file input_file_type.h.

Member Function Documentation

void input_file_type::build_openfile_mask ( pfc::string_base out,
bool  b_include_playlists = true 
)
static

Definition at line 69 of file input_file_type.cpp.

70 {
71  t_fnList extensionsAll, extensionsPl;;
72 
73  if (b_include_playlists) {
75  while(e.next(ptr)) {
76  if (ptr->is_associatable()) {
77  pfc::string_formatter temp; temp << "*." << ptr->get_extension();
78  extensionsPl += temp;
79  extensionsAll += temp;
80  }
81  }
82  }
83 
85  t_masks masks;
86  {
89  pfc::string_formatter name, mask;
90  while(e.next(ptr)) {
91  const unsigned count = ptr->get_count();
92  for(unsigned n=0;n<count;n++) {
93  name.reset();
94  mask.reset();
95  if (ptr->get_name(n,name) && ptr->get_mask(n,mask)) {
96  if (!strchr(name,'|') && !strchr(mask,'|')) {
97  masks.find_or_add(name) += mask;
98  extensionsAll += mask;
99  }
100  }
101  }
102  }
103  }
104  pfc::string_formatter outBuf;
105  outBuf << "All files|*.*|";
106  formatMaskList(outBuf, extensionsAll, "All supported types");
107  formatMaskList(outBuf, extensionsPl, "Playlists");
108  for(t_masks::const_iterator walk = masks.first(); walk.is_valid(); ++walk) {
109  formatMaskList(outBuf,walk->m_value,walk->m_key);
110  }
111  out = outBuf;
112 }
Definition: map.h:16
string8_fastalloc string_formatter
Definition: string_base.h:614
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
static void formatMaskList(pfc::string_base &out, t_fnList const &in)
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
input_file_type::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( input_file_type  )
virtual unsigned input_file_type::get_count ( )
pure virtual
virtual bool input_file_type::get_mask ( unsigned  idx,
pfc::string_base out 
)
pure virtual
virtual bool input_file_type::get_name ( unsigned  idx,
pfc::string_base out 
)
pure virtual
virtual bool input_file_type::is_associatable ( unsigned  idx)
pure virtual
void input_file_type::make_extension_support_fingerprint ( pfc::string_base str)
static

Definition at line 46 of file input_file_type.cpp.

46  {
48  {
52  while(e.next(ptr)) {
53  const unsigned count = ptr->get_count();
54  for(unsigned n=0;n<count;n++) {
55  mask.reset();
56  if (ptr->get_mask(n,mask)) {
57  if (strchr(mask,'|') == NULL) masks += mask;
58  }
59  }
60  }
61  }
63  for(pfc::const_iterator<pfc::string8> walk = masks.first(); walk.is_valid(); ++walk) {
64  if (!out.is_empty()) out << "|";
65  out << *walk;
66  }
67  str = out;
68 }
bool is_valid() const
Definition: iterators.h:24
const_iterator first() const
Definition: avltree.h:485
string8_fastalloc string_formatter
Definition: string_base.h:614
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
void input_file_type::make_filetype_support_fingerprint ( pfc::string_base str)
static

Definition at line 24 of file input_file_type.cpp.

24  {
27 
28  {
29  componentversion::ptr ptr; service_enum_t<componentversion> e;
31  while(e.next(ptr)) {
32  name = "";
33  ptr->get_component_name(name);
34  if (strstr(name, "decoder") != NULL || strstr(name, "Decoder") != NULL) names += name;
35  }
36  }
37 
38 
40  for(pfc::const_iterator<pfc::string8> walk = names.first(); walk.is_valid(); ++walk) {
41  if (!out.is_empty()) str << "|";
42  out << *walk;
43  }
44  str = out;
45 }
static void make_extension_support_fingerprint(pfc::string_base &str)
bool is_valid() const
Definition: iterators.h:24
const_iterator first() const
Definition: avltree.h:485
string8_fastalloc string_formatter
Definition: string_base.h:614
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587

The documentation for this class was generated from the following files: