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

var_list.cpp

00001 /*****************************************************************************
00002  * var_list.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: var_list.cpp 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 #include "var_list.hpp"
00026 
00027 
00028 const string VarList::m_type = "list";
00029 
00030 
00031 VarList::VarList( intf_thread_t *pIntf ): Variable( pIntf )
00032 {
00033     // Create the position variable
00034     m_cPosition = VariablePtr( new VarPercent( pIntf ) );
00035     getPositionVar().set( 1.0 );
00036 }
00037 
00038 
00039 VarList::~VarList()
00040 {
00041 }
00042 
00043 
00044 void VarList::add( const UStringPtr &rcString )
00045 {
00046     m_list.push_back( Elem_t( rcString ) );
00047     notify();
00048 }
00049 
00050 
00051 void VarList::delSelected()
00052 {
00053     Iterator it = begin();
00054     while( it != end() )
00055     {
00056         if( (*it).m_selected )
00057         {
00058             Iterator oldIt = it;
00059             it++;
00060             m_list.erase( oldIt );
00061         }
00062         else
00063         {
00064             it++;
00065         }
00066     }
00067     notify();
00068 }
00069 
00070 
00071 void VarList::clear()
00072 {
00073     m_list.clear();
00074 }
00075 
00076 
00077 VarList::Iterator VarList::operator[]( int n )
00078 {
00079     Iterator it = begin();
00080     for( int i = 0; i < n; i++ )
00081     {
00082         if( it != end() )
00083         {
00084             it++;
00085         }
00086         else
00087         {
00088             break;
00089         }
00090     }
00091     return it;
00092 }
00093 
00094 
00095 VarList::ConstIterator VarList::operator[]( int n ) const
00096 {
00097     ConstIterator it = begin();
00098     for( int i = 0; i < n; i++ )
00099     {
00100         if( it != end() )
00101         {
00102             it++;
00103         }
00104         else
00105         {
00106             break;
00107         }
00108     }
00109     return it;
00110 }
00111 

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