Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / dti_cc / cc_pvect.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 // $TOG: cc_pvect.C /main/6 1998/04/17 11:45:20 mgreess $
24
25 #include "dti_cc/cc_exceptions.h"
26
27 template <class T> 
28 pointer_vector<T>::pointer_vector(const pointer_vector<T>& pv) :
29     f_array(new Tptr[pv.f_size]), f_size(pv.f_size), f_items(pv.f_items)  
30 {
31     for (int i=0; i<pv.f_size; i++ )
32         f_array[i] = pv.f_array[i];
33     
34     cerr << "Warning: pointer_vector(const pointer_vector&) called" << endl;
35     exit (-1);
36 }
37
38 template <class T> 
39 pointer_vector<T>::pointer_vector(size_t n, T* t) 
40   : f_array(new Tptr[n]), f_size(n), f_items(0)
41 {
42    for ( size_t i=0; i<f_size; i++ )
43     f_array[i] = t;
44 }
45
46 template <class T> 
47 pointer_vector<T>::~pointer_vector() 
48 {
49    delete f_array;
50 }
51
52 template <class T> 
53 T* pointer_vector<T>::operator[](ptrdiff_t i) const
54 {
55   if ( i < 0 || i >= (ptrdiff_t)f_size )
56     throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
57   else
58     return f_array[i];
59 }
60
61 template <class T> 
62 T*& pointer_vector<T>::operator[](ptrdiff_t i)
63 {
64   if ( i < 0 || i >= (ptrdiff_t)f_size )
65     throw(CASTCCBEXCEPT ccBoundaryException(0, f_size-1, i));
66   else
67      return f_array[i];
68 }
69