1 /* $XConsortium: RangeMap.h /main/1 1996/07/29 17:02:22 cde-hp $ */
2 // Copyright (c) 1994 James Clark
3 // See the file COPYING for copying permission.
5 #ifndef RangeMap_INCLUDED
6 #define RangeMap_INCLUDED 1
15 namespace SP_NAMESPACE {
18 template<class From, class To>
19 struct RangeMapRange {
27 template<class From, class To> class RangeMapIter;
29 template<class From, class To>
33 Boolean map(From, To &, From &alsoMax) const;
34 // Return 0 for no matches, 1 for 1, 2 for more than 1.
35 unsigned inverseMap(To, From &, ISet<WideChar> &, WideChar &count) const;
36 void addRange(From, From, To);
38 Vector<RangeMapRange<From,To> > ranges_;
39 friend class RangeMapIter<From,To>;
42 template<class From, class To>
45 RangeMapIter(const RangeMap<From,To> &map);
46 Boolean next(From &fromMin, From &fromMax, To &toMin) {
50 fromMin = ptr_->fromMin;
51 fromMax = ptr_->fromMax;
60 const RangeMapRange<From,To> *ptr_;
61 // Vector<RangeMapRange<From,To> >::const_iterator ptr_;
68 #endif /* not RangeMap_INCLUDED */
70 #ifdef SP_DEFINE_TEMPLATES