foobar2000 SDK  2015-08-03
Public Member Functions | Data Fields | Private Attributes
playlist_position_reference_tracker

#include <playlist_position_reference_tracker.h>

+ Inheritance diagram for playlist_position_reference_tracker:

Public Member Functions

 playlist_position_reference_tracker (bool p_trackitem=true)
 
void on_items_added (t_size p_playlist, t_size p_start, const pfc::list_base_const_t< metadb_handle_ptr > &p_data, const bit_array &p_selection)
 
void on_items_removed (t_size p_playlist, const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_items_reordered (t_size p_playlist, const t_size *p_order, t_size p_count)
 
void on_items_replaced (t_size p_playlist, const bit_array &p_mask, const pfc::list_base_const_t< t_on_items_replaced_entry > &p_data)
 
void on_playlist_created (t_size p_index, const char *p_name, t_size p_name_len)
 
void on_playlists_removed (const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_playlists_reorder (const t_size *p_order, t_size p_count)
 
- Public Member Functions inherited from playlist_callback_impl_base
 playlist_callback_impl_base (t_uint32 p_flags=0)
 
 ~playlist_callback_impl_base ()
 
void on_default_format_changed ()
 
void on_item_ensure_visible (t_size p_playlist, t_size p_idx)
 
void on_item_focus_change (t_size p_playlist, t_size p_from, t_size p_to)
 
void on_items_added (t_size p_playlist, t_size p_start, const pfc::list_base_const_t< metadb_handle_ptr > &p_data, const bit_array &p_selection)
 
void on_items_modified (t_size p_playlist, const bit_array &p_mask)
 
void on_items_modified_fromplayback (t_size p_playlist, const bit_array &p_mask, play_control::t_display_level p_level)
 
void on_items_removed (t_size p_playlist, const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_items_removing (t_size p_playlist, const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_items_reordered (t_size p_playlist, const t_size *p_order, t_size p_count)
 
void on_items_replaced (t_size p_playlist, const bit_array &p_mask, const pfc::list_base_const_t< t_on_items_replaced_entry > &p_data)
 
void on_items_selection_change (t_size p_playlist, const bit_array &p_affected, const bit_array &p_state)
 
void on_playback_order_changed (t_size p_new_index)
 
void on_playlist_activate (t_size p_old, t_size p_new)
 
void on_playlist_created (t_size p_index, const char *p_name, t_size p_name_len)
 
void on_playlist_locked (t_size p_playlist, bool p_locked)
 
void on_playlist_renamed (t_size p_index, const char *p_new_name, t_size p_new_name_len)
 
void on_playlists_removed (const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_playlists_removing (const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
 
void on_playlists_reorder (const t_size *p_order, t_size p_count)
 
void set_callback_flags (t_uint32 p_flags)
 

Data Fields

t_size m_item
 
t_size m_playlist
 

Private Attributes

const bool m_trackitem
 

Additional Inherited Members

- Public Types inherited from playlist_callback
enum  {
  flag_on_items_added = 1 << 0, flag_on_items_reordered = 1 << 1, flag_on_items_removing = 1 << 2, flag_on_items_removed = 1 << 3,
  flag_on_items_selection_change = 1 << 4, flag_on_item_focus_change = 1 << 5, flag_on_items_modified = 1 << 6, flag_on_items_modified_fromplayback = 1 << 7,
  flag_on_items_replaced = 1 << 8, flag_on_item_ensure_visible = 1 << 9, flag_on_playlist_activate = 1 << 10, flag_on_playlist_created = 1 << 11,
  flag_on_playlists_reorder = 1 << 12, flag_on_playlists_removing = 1 << 13, flag_on_playlists_removed = 1 << 14, flag_on_playlist_renamed = 1 << 15,
  flag_on_default_format_changed = 1 << 16, flag_on_playback_order_changed = 1 << 17, flag_on_playlist_locked = 1 << 18, flag_all = ~0,
  flag_item_ops = flag_on_items_added | flag_on_items_reordered | flag_on_items_removing | flag_on_items_removed | flag_on_items_selection_change | flag_on_item_focus_change | flag_on_items_modified | flag_on_items_modified_fromplayback | flag_on_items_replaced | flag_on_item_ensure_visible, flag_playlist_ops = flag_on_playlist_activate | flag_on_playlist_created | flag_on_playlists_reorder | flag_on_playlists_removing | flag_on_playlists_removed | flag_on_playlist_renamed | flag_on_playlist_locked
}
 
- Protected Member Functions inherited from playlist_callback
 playlist_callback ()
 
 ~playlist_callback ()
 

Detailed Description

Definition at line 1 of file playlist_position_reference_tracker.h.

Constructor & Destructor Documentation

playlist_position_reference_tracker::playlist_position_reference_tracker ( bool  p_trackitem = true)
inline
Parameters
p_trackitemSpecifies whether we want to track some specific item rather than just an offset in a playlist. When set to true, item index becomes invalidated when the item we're tracking is removed.

Definition at line 4 of file playlist_position_reference_tracker.h.

Member Function Documentation

void playlist_position_reference_tracker::on_items_added ( t_size  p_playlist,
t_size  p_start,
const pfc::list_base_const_t< metadb_handle_ptr > &  p_data,
const bit_array p_selection 
)
inlinevirtual

Implements playlist_callback.

Definition at line 6 of file playlist_position_reference_tracker.h.

6  {
7  if (p_playlist == m_playlist && m_item != pfc_infinite && p_start <= m_item) {
8  m_item += p_data.get_count();
9  }
10  }
virtual t_size get_count() const =0
void playlist_position_reference_tracker::on_items_removed ( t_size  p_playlist,
const bit_array p_mask,
t_size  p_old_count,
t_size  p_new_count 
)
inlinevirtual

Implements playlist_callback.

Definition at line 21 of file playlist_position_reference_tracker.h.

21  {
22  if (p_playlist == m_playlist) {
23  if (m_item < p_old_count) {
24  const t_size item_before = m_item;
25  for(t_size walk = p_mask.find_first(true,0,p_old_count); walk < p_old_count; walk = p_mask.find_next(true,walk,p_old_count)) {
26  if (walk < item_before) {
27  m_item--;
28  } else if (walk == item_before) {
29  if (m_trackitem) m_item = pfc_infinite;
30  break;
31  } else {
32  break;
33  }
34  }
35  if (m_item >= p_new_count) m_item = pfc_infinite;
36  } else {
37  m_item = pfc_infinite;
38  }
39  }
40  }
t_size find_next(bool val, t_size previous, t_size max) const
Definition: bit_array.h:32
t_size find_first(bool val, t_size start, t_size max) const
Definition: bit_array.h:31
size_t t_size
Definition: int_types.h:48
void playlist_position_reference_tracker::on_items_reordered ( t_size  p_playlist,
const t_size p_order,
t_size  p_count 
)
inlinevirtual

Implements playlist_callback.

Definition at line 11 of file playlist_position_reference_tracker.h.

11  {
12  if (p_playlist == m_playlist) {
13  if (m_item < p_count) {
15  } else {
16  m_item = pfc_infinite;
17  }
18  }
19  }
static t_size g_find_reverse(const t_size *order, t_size val)
Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the pe...
Definition: other.cpp:90
void playlist_position_reference_tracker::on_items_replaced ( t_size  p_playlist,
const bit_array p_mask,
const pfc::list_base_const_t< t_on_items_replaced_entry > &  p_data 
)
inlinevirtual

Implements playlist_callback.

Definition at line 43 of file playlist_position_reference_tracker.h.

43 {}
void playlist_position_reference_tracker::on_playlist_created ( t_size  p_index,
const char *  p_name,
t_size  p_name_len 
)
inlinevirtual

Implements playlist_callback.

Definition at line 45 of file playlist_position_reference_tracker.h.

45  {
46  if (m_playlist != pfc_infinite && p_index <= m_playlist) m_playlist++;
47  }
void playlist_position_reference_tracker::on_playlists_removed ( const bit_array p_mask,
t_size  p_old_count,
t_size  p_new_count 
)
inlinevirtual

Implements playlist_callback.

Definition at line 52 of file playlist_position_reference_tracker.h.

52  {
53  if (m_playlist < p_old_count) {
54  const t_size playlist_before = m_playlist;
55  for(t_size walk = p_mask.find_first(true,0,p_old_count); walk < p_old_count; walk = p_mask.find_next(true,walk,p_old_count)) {
56  if (walk < playlist_before) {
57  m_playlist--;
58  } else if (walk == playlist_before) {
59  m_playlist = pfc_infinite;
60  break;
61  } else {
62  break;
63  }
64  }
65  } else {
66  m_playlist = pfc_infinite;
67  }
68  }
t_size find_next(bool val, t_size previous, t_size max) const
Definition: bit_array.h:32
t_size find_first(bool val, t_size start, t_size max) const
Definition: bit_array.h:31
size_t t_size
Definition: int_types.h:48
void playlist_position_reference_tracker::on_playlists_reorder ( const t_size p_order,
t_size  p_count 
)
inlinevirtual

Implements playlist_callback.

Definition at line 48 of file playlist_position_reference_tracker.h.

48  {
50  else m_playlist = pfc_infinite;
51  }
static t_size g_find_reverse(const t_size *order, t_size val)
Insecure - may deadlock or crash on invalid permutation content. In theory faster than walking the pe...
Definition: other.cpp:90

Field Documentation

t_size playlist_position_reference_tracker::m_item

Definition at line 70 of file playlist_position_reference_tracker.h.

t_size playlist_position_reference_tracker::m_playlist

Definition at line 70 of file playlist_position_reference_tracker.h.

const bool playlist_position_reference_tracker::m_trackitem
private

Definition at line 72 of file playlist_position_reference_tracker.h.


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