1
/*****************************************************************************
3
*****************************************************************************
4
* Copyright (C) 2003 VideoLAN
5
* $Id: var_list.hpp 6961 2004-03-05 17:34:23Z sam $
7
* Authors: Cyril Deguet <asmax@via.ecp.fr>
8
* Olivier Teuli�re <ipkiss@via.ecp.fr>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23
*****************************************************************************/
30
#include "variable.hpp"
31
#include "observer.hpp"
32
#include "ustring.hpp"
33
#include "var_percent.hpp"
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;