/usr/include/sp/NamedResourceTable.h is in libsp1-dev 1.3.4-1.2.1-47.3ubuntu1.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | // Copyright (c) 1994 James Clark
// See the file COPYING for copying permission.
#ifndef NamedResourceTable_INCLUDED
#define NamedResourceTable_INCLUDED 1
#include "NamedResource.h"
#include "PointerTable.h"
#include "StringC.h"
#include "Hash.h"
#include "Ptr.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
struct NamedResourceKeyFunction {
static inline
const StringC &key(const NamedResource &p) {
return p.name();
}
};
template<class T> class NamedResourceTableIter;
template<class T> class ConstNamedResourceTableIter;
template<class T>
class NamedResourceTable {
#ifdef __lucid
struct X {
Ptr<T> _X; // work around lcc bug
};
#endif
public:
NamedResourceTable() { }
Ptr<T> insert(const Ptr<T> &p, Boolean replace = 0) {
return (T *)table_.insert((NamedResource *)p.pointer(), replace).pointer();
}
Ptr<T> lookup(const StringC &str) const {
return (T *)table_.lookup(str).pointer();
}
ConstPtr<T> lookupConst(const StringC &str) const {
return (T *)table_.lookup(str).pointer();
}
const T *lookupTemp(const StringC &str) const {
return (const T *)table_.lookup(str).pointer();
}
Ptr<T> remove(const StringC &str) {
return (T *)table_.remove(str).pointer();
}
size_t count() const { return table_.count(); }
void clear() { table_.clear(); }
void swap(NamedResourceTable<T> &to) { table_.swap(to.table_); }
private:
PointerTable<Ptr<NamedResource>, StringC, Hash,
NamedResourceKeyFunction> table_;
friend class NamedResourceTableIter<T>;
friend class ConstNamedResourceTableIter<T>;
};
template<class T>
class NamedResourceTableIter {
public:
NamedResourceTableIter(const NamedResourceTable<T> &table)
: iter_(table.table_) { }
Ptr<T> next() {
return (T *)iter_.next().pointer();
}
private:
PointerTableIter<Ptr<NamedResource>, StringC, Hash,
NamedResourceKeyFunction> iter_;
};
template<class T>
class ConstNamedResourceTableIter {
public:
ConstNamedResourceTableIter(const NamedResourceTable<T> &table)
: iter_(table.table_) { }
ConstPtr<T> next() {
return (T *)iter_.next().pointer();
}
const T *nextTemp() {
return (const T *)iter_.next().pointer();
}
private:
PointerTableIter<Ptr<NamedResource>, StringC, Hash,
NamedResourceKeyFunction> iter_;
};
#ifdef SP_NAMESPACE
}
#endif
#endif /* not NamedResourceTable_INCLUDED */
|