Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

var_list.hpp

00001 /*****************************************************************************
00002  * var_list.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: var_list.hpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
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

Generated on Tue Dec 20 10:14:43 2005 for vlc-0.8.4a by  doxygen 1.4.2