Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

ListMementos.hpp

00001 #if   !defined(__LISTMEMENTOS_HPP)
00002 #define __LISTMEMENTOS_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */   
00023 
00024 #if   !defined(__COMMON_HPP)
00025 #include <corelinux/Common.hpp>
00026 #endif
00027 
00028 #if   !defined(__VECTOR_HPP)
00029 #include <corelinux/Vector.hpp>
00030 #endif
00031 
00032 #if   !defined(__MEMENTO_HPP)
00033 #include <corelinux/Memento.hpp>
00034 #endif
00035 
00036 DECLARE_CLASS( ChangedListMemento );
00037 
00038 CORELINUX_VECTOR(  string ,  ListEntries );
00039 
00044 class ChangedListMemento : public CORELINUX( Memento )
00045 {
00046 public:
00052                      ChangedListMemento( ListEntriesRef aList )
00053                         :
00054                         CORELINUX(Memento)(),
00055                         theCurrentList( aList )
00056                      {
00057                         ;  // do nothing
00058                      }
00059 
00065                      ChangedListMemento( ChangedListMementoCref aMemento )
00066                         :
00067                         CORELINUX(Memento)(aMemento),
00068                         theCurrentList( aMemento.theCurrentList )
00069                      {
00070                         ;  // do nothing
00071                      }
00072 
00074 
00075    virtual           ~ChangedListMemento( void )
00076                      {
00077                         theCurrentList.clear();
00078                      }
00079 
00080    //
00081    // Operator overloads
00082    //
00083 
00085 
00086             ChangedListMementoRef   operator=( ChangedListMementoCref aMemento )
00087             {
00088                if( *this == aMemento )
00089                {
00090                   ;  // do nothing
00091                }
00092                else
00093                {
00094                   CORELINUX(Memento)::operator=( aMemento );
00095                   theCurrentList.clear();
00096                   theCurrentList = aMemento.theCurrentList;
00097                }
00098                return ( *this );
00099             }
00100 
00102 
00103             bool operator==( ChangedListMementoCref aMemento ) const
00104             {
00105                return CORELINUX(Memento)::operator==( aMemento );
00106             }
00107 
00108    //
00109    // Accessors
00110    //
00111 
00113 
00114    inline   ListEntriesRef    getList( void )
00115             {
00116                return theCurrentList;
00117             }
00118 
00119 protected:
00120 
00121 
00122 private:
00124 
00125             ListEntries    theCurrentList;
00126 
00127 };
00128 
00129 DECLARE_CLASS( SelectionMemento );
00130 
00136 class SelectionMemento : public CORELINUX( Memento )
00137 {
00138 public:
00139 
00140                      SelectionMemento( string aSelection )
00141                         :
00142                         CORELINUX(Memento)(),
00143                         theSelection( aSelection )
00144                      {
00145                         ;  // do nothing
00146                      }
00147 
00148                      SelectionMemento( SelectionMementoCref aMemento )
00149                         :
00150                         CORELINUX(Memento)(aMemento),
00151                         theSelection( aMemento.theSelection )
00152                      {
00153                         ;  // do nothing
00154                      }
00155 
00156    virtual           ~SelectionMemento( void )
00157                      {
00158                         ;  // do nothing
00159                      }
00160 
00161    //
00162    // Operator overloads
00163    //
00164 
00165             SelectionMementoRef   operator=( SelectionMementoCref aMemento )
00166             {
00167                if( *this == aMemento )
00168                {
00169                   ;  // do nothing
00170                }
00171                else
00172                {
00173                   CORELINUX(Memento)::operator=( aMemento );
00174                   theSelection =  aMemento.theSelection ;
00175                }
00176                return ( *this );
00177             }
00178 
00179             bool operator==( SelectionMementoCref aMemento ) const
00180             {
00181                return CORELINUX(Memento)::operator==( aMemento );
00182             }
00183 
00184    //
00185    // Accessors
00186    //
00187 
00188    inline   string &getSelected( void )
00189             {
00190                return theSelection;
00191             }
00192 
00193 protected:
00194 
00195 
00196 private:
00197 
00198             string      theSelection;
00199 
00200 };
00201 
00202 DECLARE_CLASS( EditSelectionMemento );
00203 
00209 class EditSelectionMemento : public CORELINUX( Memento )
00210 {
00211 public:
00212 
00213                      EditSelectionMemento( string aSelection, string aChange )
00214                         :
00215                         CORELINUX(Memento)(),
00216                         theSelection( aSelection ),
00217                         theChange( aChange )
00218                      {
00219                         ;  // do nothing
00220                      }
00221 
00222                      EditSelectionMemento( EditSelectionMementoCref aMemento )
00223                         :
00224                         CORELINUX(Memento)(aMemento),
00225                         theSelection( aMemento.theSelection ),
00226                         theChange( aMemento.theChange )
00227                      {
00228                         ;  // do nothing
00229                      }
00230 
00231    virtual           ~EditSelectionMemento( void )
00232                      {
00233                         ;  // do nothing
00234                      }
00235 
00236    //
00237    // Operator overloads
00238    //
00239 
00240             EditSelectionMementoRef   operator=( EditSelectionMementoCref aMemento )
00241             {
00242                if( *this == aMemento )
00243                {
00244                   ;  // do nothing
00245                }
00246                else
00247                {
00248                   CORELINUX(Memento)::operator=( aMemento );
00249                   theSelection =  aMemento.theSelection ;
00250                   theChange = aMemento.theChange;
00251                }
00252                return ( *this );
00253             }
00254 
00255             bool operator==( EditSelectionMementoCref aMemento ) const
00256             {
00257                return CORELINUX(Memento)::operator==( aMemento );
00258             }
00259 
00260 
00261    //
00262    // Accessors
00263    //
00264 
00265    inline   string &getSelected( void )
00266    {
00267       return theSelection;
00268    }
00269 
00270    inline   string &getChange( void )
00271    {
00272       return theChange;
00273    }
00274 
00275 protected:
00276 
00277 
00278 private:
00279 
00280             string      theSelection;
00281             string      theChange;
00282 
00283 };
00284 
00285 
00286 
00287 #endif
00288 
00289 /*
00290    Common rcs information do not modify
00291    $Author: prudhomm $
00292    $Revision: 1.2 $
00293    $Date: 2000/08/31 22:49:01 $
00294    $Locker:  $
00295 */
00296 
00297 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium