/usr/include/OpenSP/CharsetInfo.h is in libosp-dev 1.5.2-13ubuntu1.
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | // Copyright (c) 1994, 1997 James Clark
// See the file COPYING for copying permission.
#ifndef CharsetInfo_INCLUDED
#define CharsetInfo_INCLUDED 1
#ifdef __GNUG__
#pragma interface
#endif
#include <limits.h>
#include "UnivCharsetDesc.h"
#include "Boolean.h"
#include "types.h"
#include "StringC.h"
#include "ISet.h"
#include "CharMap.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
class SP_API CharsetInfo {
public:
CharsetInfo();
CharsetInfo(const UnivCharsetDesc &);
inline ~CharsetInfo() {}
void set(const UnivCharsetDesc &);
// Use only for characters guaranteed to me in the C basic execution
// character set and which have been verified to be in this
// character set.
Char execToDesc(char) const;
StringC execToDesc(const char *s) const;
Boolean descToUniv(WideChar from, UnivChar &to) const;
Boolean descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const;
// Return 0 for no matches, 1 for 1, 2 for more than 1
// to gets the first character; toSet gets all the characters
// if there's more than 1.
unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet)
const;
unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet,
WideChar &count)
const;
void getDescSet(ISet<Char> &) const;
int digitWeight(Char) const;
int hexDigitWeight(Char) const;
const UnivCharsetDesc &desc() const;
private:
void init();
UnivCharsetDesc desc_;
CharMap<Unsigned32> inverse_;
Char execToDesc_[UCHAR_MAX + 1];
};
inline
unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to,
ISet<WideChar> &toSet)
const
{
if (from <= charMax) {
Unsigned32 n = inverse_[from];
if (n == Unsigned32(-1))
return 0;
if (n != Unsigned32(-2)) {
to = ((n + from) & ((Unsigned32(1) << 31) - 1));
return 1;
}
}
return desc_.univToDesc(from, to, toSet);
}
inline
unsigned CharsetInfo::univToDesc(UnivChar from, WideChar &to,
ISet<WideChar> &toSet, WideChar &count)
const
{
if (from <= charMax) {
Char fromMax;
Unsigned32 n = inverse_.getRange(from, fromMax);
if (n == Unsigned32(-1)) {
count = (fromMax - from) + 1;
return 0;
}
if (n != Unsigned32(-2)) {
to = ((n + from) & ((Unsigned32(1) << 31) - 1));
count = (fromMax - from) + 1;
return 1;
}
}
return desc_.univToDesc(from, to, toSet, count);
}
inline
Boolean CharsetInfo::descToUniv(UnivChar from, WideChar &to) const
{
return desc_.descToUniv(from, to);
}
inline
Char CharsetInfo::execToDesc(char c) const
{
return execToDesc_[(unsigned char)c];
}
inline
Boolean CharsetInfo::descToUniv(WideChar from, UnivChar &to,
WideChar &alsoMax) const
{
return desc_.descToUniv(from, to, alsoMax);
}
inline
const UnivCharsetDesc &CharsetInfo::desc() const
{
return desc_;
}
#ifdef SP_NAMESPACE
}
#endif
#endif /* not CharsetInfo_INCLUDED */
|