17
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20
* You should have received a copy of the GNU General Public License along
21
* with this program; if not, write to the Free Software Foundation, Inc.,
22
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
23
*****************************************************************************/
25
25
#ifndef VAR_LIST_HPP
37
37
class VarList: public Variable, public Subject<VarList>
40
VarList( intf_thread_t *pIntf );
43
/// Get the variable type
44
virtual const string &getType() const { return m_type; }
46
/// Add a pointer on a string in the list
47
virtual void add( const UStringPtr &rcString );
49
/// Remove the selected elements from the list
50
virtual void delSelected();
52
/// Remove all the elements from the list
55
/// Get the number of items in the list
56
int size() const { return m_list.size(); }
58
/// Type of an element in the list
65
Elem_t( const UStringPtr &rcString, bool selected = false, bool
67
m_cString( rcString ), m_selected( selected ),
68
m_playing( playing) {}
72
typedef list<Elem_t>::iterator Iterator;
73
typedef list<Elem_t>::const_iterator ConstIterator;
75
/// Beginning of the list
76
Iterator begin() { return m_list.begin(); }
77
ConstIterator begin() const { return m_list.begin(); }
80
Iterator end() { return m_list.end(); }
81
ConstIterator end() const { return m_list.end(); }
83
/// Return an iterator on the n'th element of the list
84
Iterator operator[]( int n );
85
ConstIterator operator[]( int n ) const;
87
/// Execute the action associated to this item
88
virtual void action( Elem_t *pItem ) {}
90
/// Get a reference on the position variable
91
VarPercent &getPositionVar() const
92
{ return *((VarPercent*)m_cPosition.get()); }
94
/// Get a counted pointer on the position variable
95
const VariablePtr &getPositionVarPtr() const { return m_cPosition; }
103
static const string m_type;
104
/// Position variable
105
VariablePtr m_cPosition;
40
VarList( intf_thread_t *pIntf );
43
/// Get the variable type
44
virtual const string &getType() const { return m_type; }
46
/// Add a pointer on a string in the list
47
virtual void add( const UStringPtr &rcString );
49
/// Remove the selected elements from the list
50
virtual void delSelected();
52
/// Remove all the elements from the list
55
/// Get the number of items in the list
56
int size() const { return m_list.size(); }
58
/// Type of an element in the list
65
Elem_t( const UStringPtr &rcString,
66
bool selected = false, bool playing = false )
67
: m_cString( rcString ),
68
m_selected( selected ), m_playing( playing ) { }
72
typedef list<Elem_t>::iterator Iterator;
73
typedef list<Elem_t>::const_iterator ConstIterator;
75
/// Beginning of the list
76
Iterator begin() { return m_list.begin(); }
77
ConstIterator begin() const { return m_list.begin(); }
80
Iterator end() { return m_list.end(); }
81
ConstIterator end() const { return m_list.end(); }
83
/// Return an iterator on the n'th element of the list
84
Iterator operator[]( int n );
85
ConstIterator operator[]( int n ) const;
87
/// Execute the action associated to this item
88
virtual void action( Elem_t *pItem ) { }
90
/// Get a reference on the position variable
91
VarPercent &getPositionVar() const
92
{ return *((VarPercent*)m_cPosition.get()); }
94
/// Get a counted pointer on the position variable
95
const VariablePtr &getPositionVarPtr() const { return m_cPosition; }
103
static const string m_type;
104
/// Position variable
105
VariablePtr m_cPosition;