00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef VAR_LIST_HPP
00026 #define VAR_LIST_HPP
00027
00028 #include <list>
00029
00030 #include "variable.hpp"
00031 #include "observer.hpp"
00032 #include "ustring.hpp"
00033 #include "var_percent.hpp"
00034
00035
00037 class VarList: public Variable, public Subject<VarList>
00038 {
00039 public:
00040 VarList( intf_thread_t *pIntf );
00041 virtual ~VarList();
00042
00044 virtual const string &getType() const { return m_type; }
00045
00047 virtual void add( const UStringPtr &rcString );
00048
00050 virtual void delSelected();
00051
00053 virtual void clear();
00054
00056 int size() const { return m_list.size(); }
00057
00059 struct Elem_t
00060 {
00061 UStringPtr m_cString;
00062 bool m_selected;
00063 bool m_playing;
00064
00065 Elem_t( const UStringPtr &rcString, bool selected = false, bool
00066 playing = false ):
00067 m_cString( rcString ), m_selected( selected ),
00068 m_playing( playing) {}
00069 };
00070
00072 typedef list<Elem_t>::iterator Iterator;
00073 typedef list<Elem_t>::const_iterator ConstIterator;
00074
00076 Iterator begin() { return m_list.begin(); }
00077 ConstIterator begin() const { return m_list.begin(); }
00078
00080 Iterator end() { return m_list.end(); }
00081 ConstIterator end() const { return m_list.end(); }
00082
00084 Iterator operator[]( int n );
00085 ConstIterator operator[]( int n ) const;
00086
00088 virtual void action( Elem_t *pItem ) {}
00089
00091 VarPercent &getPositionVar() const
00092 { return *((VarPercent*)m_cPosition.get()); }
00093
00095 const VariablePtr &getPositionVarPtr() const { return m_cPosition; }
00096
00097 protected:
00099 list<Elem_t> m_list;
00100
00101 private:
00103 static const string m_type;
00105 VariablePtr m_cPosition;
00106 };
00107
00108
00109 #endif