/[svn]/linuxsampler/trunk/src/common/ArrayList.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/ArrayList.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2054 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC revision 2055 by persson, Sat Jan 30 10:30:02 2010 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2010 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 132  namespace LinuxSampler { Line 132  namespace LinuxSampler {
132                  return pData[iPosition];                  return pData[iPosition];
133              }              }
134    
135                /**
136                 * Copy constructor.
137                 */
138                ArrayList(const ArrayList& list) {
139                    copy(list);
140                }
141    
142                /**
143                 * Assignment.
144                 */
145                ArrayList& operator=(const ArrayList& list) {
146                    if (this != &list) {
147                        clear();
148                        copy(list);
149                    }
150                    return *this;
151                }
152    
153          private:          private:
154              T*   pData;              T*   pData;
155              int  iSize;              int  iSize;
156    
157                void copy(const ArrayList& list) {
158                    iSize = list.iSize;
159                    if (list.pData) {
160                        pData = new T[iSize];
161                        for (int i = 0 ; i < iSize ; i++) {
162                            pData[i] = list.pData[i];
163                        }
164                    } else {
165                        pData = NULL;
166                    }
167                }
168      };      };
169    
170  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2054  
changed lines
  Added in v.2055

  ViewVC Help
Powered by ViewVC