foobar2000 SDK  2015-08-03
file_info_const_impl.h
Go to the documentation of this file.
1 #define __file_info_const_impl_have_hintmap__
2 
5 {
6 public:
7  file_info_const_impl(const file_info & p_source) {copy(p_source);}
8  file_info_const_impl(const file_info_const_impl & p_source) {copy(p_source);}
10 
11  double get_length() const {return m_length;}
12 
14  const char* meta_enum_name(t_size p_index) const {return m_meta[p_index].m_name;}
15  t_size meta_enum_value_count(t_size p_index) const;
16  const char* meta_enum_value(t_size p_index,t_size p_value_number) const;
17  t_size meta_find_ex(const char * p_name,t_size p_name_length) const;
18 
20  const char* info_enum_name(t_size p_index) const {return m_info[p_index].m_name;}
21  const char* info_enum_value(t_size p_index) const {return m_info[p_index].m_value;}
22 
23 
24  const file_info_const_impl & operator=(const file_info & p_source) {copy(p_source); return *this;}
25  const file_info_const_impl & operator=(const file_info_const_impl & p_source) {copy(p_source); return *this;}
26  void copy(const file_info & p_source);
27  void reset();
28 
30 
31 private:
32  void set_length(double p_length) {uBugCheck();}
33 
34  t_size meta_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
35  void meta_insert_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) {uBugCheck();}
36  void meta_remove_mask(const bit_array & p_mask) {uBugCheck();}
37  void meta_reorder(const t_size * p_order) {uBugCheck();}
38  void meta_remove_values(t_size p_index,const bit_array & p_mask) {uBugCheck();}
39  void meta_modify_value_ex(t_size p_index,t_size p_value_index,const char * p_value,t_size p_value_length) {uBugCheck();}
40 
41  t_size info_set_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
42  void info_remove_mask(const bit_array & p_mask) {uBugCheck();}
43 
44  void set_replaygain(const replaygain_info & p_info) {uBugCheck();}
45 
46  t_size meta_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
47  t_size info_set_nocheck_ex(const char * p_name,t_size p_name_length,const char * p_value,t_size p_value_length) {uBugCheck();}
48 public:
49  struct meta_entry {
50  const char * m_name;
52  const char * const * m_valuemap;
53  };
54 
55  struct info_entry {
56  const char * m_name;
57  const char * m_value;
58  };
59 
60 #ifdef __file_info_const_impl_have_hintmap__
61  typedef t_uint32 t_index;
62  enum {hintmap_cutoff = 20};
63 #endif//__file_info_const_impl_have_hintmap__
64 private:
66  t_index m_meta_count;
67  t_index m_info_count;
68 
69  const meta_entry * m_meta;
70  const info_entry * m_info;
71 
72 #ifdef __file_info_const_impl_have_hintmap__
73  const t_index * m_hintmap;
74 #endif
75 
76  double m_length;
78 };
t_size info_get_count() const
Retrieves number of technical info entries.
const file_info_const_impl & operator=(const file_info_const_impl &p_source)
void meta_remove_values(t_size p_index, const bit_array &p_mask)
Removes values according to specified bit mask from specified metadata entry. If all values are remov...
t_size info_set_nocheck_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
void meta_reorder(const t_size *p_order)
Reorders metadata entries according to specified permutation.
const file_info_const_impl & operator=(const file_info &p_source)
double get_length() const
Retrieves audio duration, in seconds. Note that the reported duration should not be assumed to be th...
const char * info_enum_value(t_size p_index) const
Retrieves the value of specified technical info entry. Return value is a null-terminated UTF-8 encode...
t_size meta_get_count() const
Retrieves count of metadata entries.
const info_entry * m_info
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
Definition: bit_array.h:6
void meta_remove_mask(const bit_array &p_mask)
Removes metadata entries according to specified bit mask.
void info_remove_mask(const bit_array &p_mask)
Removes technical info entries indicated by specified bit mask.
replaygain_info get_replaygain() const
Retrieves ReplayGain information.
pfc::array_t< char > m_buffer
Structure containing ReplayGain scan results from some playable object, also providing various helper...
Definition: file_info.h:2
const meta_entry * m_meta
void meta_insert_value_ex(t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
Inserts a new value into specified metadata entry.
replaygain_info m_replaygain
const char * info_enum_name(t_size p_index) const
Retrieves the name of specified technical info entry. Return value is a null-terminated UTF-8 encoded...
Main interface class for information about some playable object.
Definition: file_info.h:73
size_t t_size
Definition: int_types.h:48
void set_replaygain(const replaygain_info &p_info)
Sets ReplayGain information.
t_size meta_enum_value_count(t_size p_index) const
Retrieves count of values in metadata entry of specified index. The value is always equal to or great...
const char * meta_enum_value(t_size p_index, t_size p_value_number) const
Retrieves specified value from specified metadata entry. Return value is a null-terminated UTF-8 enco...
t_size info_set_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
Creates a new technical info entry with specified name and specified value. If an entry of the same n...
t_size meta_set_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
Creates a new metadata entry of specified name with specified value. If an entry of same name already...
void copy(const file_info &p_source)
Copies entire file_info contents from specified file_info object.
t_size meta_find_ex(const char *p_name, t_size p_name_length) const
Finds index of metadata entry of specified name. Returns infinite when not found. ...
Special implementation of file_info that implements only const and copy methods. The difference betwe...
file_info_const_impl(const file_info_const_impl &p_source)
void meta_modify_value_ex(t_size p_index, t_size p_value_index, const char *p_value, t_size p_value_length)
Alters specified value in specified metadata entry.
file_info_const_impl(const file_info &p_source)
const char * meta_enum_name(t_size p_index) const
Retrieves the name of metadata entry of specified index. Return value is a null-terminated UTF-8 enco...
t_size meta_set_nocheck_ex(const char *p_name, t_size p_name_length, const char *p_value, t_size p_value_length)
PFC_NORETURN void SHARED_EXPORT uBugCheck()
void set_length(double p_length)
Sets audio duration, in seconds. Note that the reported duration should not be assumed to be the exa...
uint32_t t_uint32
Definition: int_types.h:5