dsdm: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / nsgmls / XcharMap.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 libraries 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 /* $XConsortium: XcharMap.C /main/1 1996/07/29 17:08:05 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
26
27 #ifndef XcharMap_DEF_INCLUDED
28 #define XcharMap_DEF_INCLUDED 1
29
30 #include <stddef.h>
31
32 #ifdef SP_NAMESPACE
33 namespace SP_NAMESPACE {
34 #endif
35
36 template<class T>
37 SharedXcharMap<T>::SharedXcharMap()
38 {
39 }
40
41 template<class T>
42 SharedXcharMap<T>::SharedXcharMap(T defaultValue)
43 {
44   for (size_t i = 0; i < sizeof(v)/sizeof(v[0]); i++)
45     v[i] = defaultValue;
46 }
47
48 template<class T>
49 XcharMap<T>::XcharMap()
50 : ptr_(0)
51 {
52 }
53
54 template<class T>
55 XcharMap<T>::XcharMap(T defaultValue)
56 : sharedMap_(new SharedXcharMap<T>(defaultValue))
57 {
58   ptr_ = sharedMap_->ptr();
59 }
60
61 template<class T>
62 void XcharMap<T>::setRange(Char min, Char max, T val)
63 {
64   if (min <= max) {
65     do {
66       ptr_[min] = val;
67     } while (min++ != max);
68   }
69 }
70
71 #ifdef SP_NAMESPACE
72 }
73 #endif
74
75 #endif /* not XcharMap_DEF_INCLUDED */