/usr/include/OpenSP/RangeMap.h is in libosp-dev 1.5.2-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef RangeMap_INCLUDED
#define RangeMap_INCLUDED 1
#include "Vector.h"
#include "Boolean.h"
#include "ISet.h"
#include "types.h"
#include <stddef.h>
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
template<class From, class To>
struct RangeMapRange {
From fromMin;
From fromMax;
To toMin;
};
template<class From, class To> class RangeMapIter;
template<class From, class To>
class RangeMap {
public:
RangeMap();
Boolean map(From, To &, From &alsoMax) const;
// Return 0 for no matches, 1 for 1, 2 for more than 1.
unsigned inverseMap(To, From &, ISet<WideChar> &, WideChar &count) const;
void addRange(From, From, To);
private:
Vector<RangeMapRange<From,To> > ranges_;
friend class RangeMapIter<From,To>;
};
template<class From, class To>
class RangeMapIter {
public:
RangeMapIter(const RangeMap<From,To> &map);
Boolean next(From &fromMin, From &fromMax, To &toMin) {
if (!count_)
return 0;
else {
fromMin = ptr_->fromMin;
fromMax = ptr_->fromMax;
toMin = ptr_->toMin;
ptr_++;
count_--;
return 1;
}
}
private:
size_t count_;
typename Vector<RangeMapRange<From,To> >::const_iterator ptr_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not RangeMap_INCLUDED */
#ifdef SP_DEFINE_TEMPLATES
#include "RangeMap.cxx"
#endif
|