Hauptseite   Klassenhierarchie   Alphabetische Liste   Übersicht   Auflistung der Dateien   Elementübersicht  

PluginList.h

00001 /***************************************************************************
00002                        PluginList.h  -  description
00003                              -------------------
00004     begin                : Sat Jan 5 2002
00005     copyright            : (C) 2002 by Christian Tusche
00006     email                : christian.tusche@stud.uni-goettingen.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _PLUGIN_LIST_H
00019 #define _PLUGIN_LIST_H
00020 
00021 #include "String.h"
00022 #include <vector.h>
00023 
00024 
00025 
00026 
00031 template <class Info_Typ>
00032 class PluginList: public vector<Info_Typ*> {
00033 public: 
00034     PluginList();
00035     ~PluginList();
00036 
00039     void Libname( const char *name );
00040 
00043     PluginList<Info_Typ> &operator += ( PluginList &liste );
00044 
00047     PluginList<Info_Typ> &operator += ( const Info_Typ &element );
00048 
00051     PluginList<Info_Typ> &operator += ( const Info_Typ *element );
00052 
00055     Info_Typ &Element( unsigned int num );
00056 
00059     unsigned int NumElements( void ){ return size(); }
00060 
00061 protected:
00062     String lib_name;
00063     Info_Typ std_format;
00064 };
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 /****************************************************************************************/
00080 /***** Implementierung ******************************************************************/
00081 /****************************************************************************************/
00082 template <class Info_Typ>
00083 PluginList<Info_Typ>::PluginList()
00084 {
00085 }
00086 
00087 
00088 
00089 
00090 template <class Info_Typ>
00091 PluginList<Info_Typ>::~PluginList()
00092 {
00093     while( size() > 0 ) {
00094         delete back();
00095         pop_back();
00096     }
00097 }
00098 
00099 
00100 
00101 
00102 
00103 
00106 template <class Info_Typ>
00107 void PluginList<Info_Typ>::Libname( const char *name )
00108 {
00109     lib_name = name;
00110 }
00111 
00112 
00113 
00114 
00115 
00116 
00119 template <class Info_Typ>
00120 PluginList<Info_Typ> &PluginList<Info_Typ>::operator += ( PluginList<Info_Typ> &liste )
00121 {
00122     for( unsigned int i=0; i < liste.size(); i++ ) {
00123         (*this) += liste.Element( i );
00124     }
00125 
00126     return *this;
00127 }
00128 
00129 
00130 
00131 
00132 
00133 template <class Info_Typ>
00134 PluginList<Info_Typ> &PluginList<Info_Typ>::operator += ( const Info_Typ &element )
00135 {
00136     Info_Typ *format = new Info_Typ( element );
00137     format->SetLibname( lib_name );
00138     push_back( format );
00139     return *this;
00140 }
00141 
00142 
00143 
00146 template <class Info_Typ>
00147 PluginList<Info_Typ> &PluginList<Info_Typ>::operator += ( const Info_Typ *element )
00148 {
00149     return *this += *element;
00150 }
00151 
00152 
00153 
00154 
00155 
00158 template <class Info_Typ>
00159 Info_Typ &PluginList<Info_Typ>::Element( unsigned int num )
00160 {
00161     if( num < size() )
00162         return **(begin() + num );
00163 
00164     return std_format;
00165 }
00166 
00167 #endif

Erzeugt am Tue Dec 31 22:54:54 2002 für av_convert von doxygen1.2.9.1 geschrieben von Dimitri van Heesch, © 1997-2001