2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: UnivCharsetDesc.h /main/1 1996/07/29 17:07:49 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
27 #ifndef UnivCharsetDesc_INCLUDED
28 #define UnivCharsetDesc_INCLUDED 1
40 namespace SP_NAMESPACE {
47 class SP_API UnivCharsetDesc {
51 // Note that this is a count, as in the SGML declaration,
52 // rather than a maximum.
69 UnivCharsetDesc(const Range *, size_t);
70 void set(const Range *, size_t);
71 Boolean descToUniv(WideChar from, UnivChar &to) const;
72 Boolean descToUniv(WideChar from, UnivChar &to, WideChar &alsoMax) const;
73 // Return 0 for no matches, 1 for 1, 2 for more than 1
74 unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet)
76 unsigned univToDesc(UnivChar from, WideChar &to, ISet<WideChar> &toSet,
79 void addRange(WideChar descMin, WideChar descMax, UnivChar univMin);
80 void addBaseRange(const UnivCharsetDesc &baseSet,
84 ISet<WideChar> &baseMissing);
85 WideChar maxDesc() const;
87 RangeMap<WideChar,UnivChar> descToUniv_;
88 friend class UnivCharsetDescIter;
91 class SP_API UnivCharsetDescIter {
93 UnivCharsetDescIter(const UnivCharsetDesc &);
94 Boolean next(WideChar &descMin, WideChar &descMax, UnivChar &univMin);
96 RangeMapIter<WideChar,UnivChar> iter_;
100 Boolean UnivCharsetDesc::descToUniv(WideChar from, UnivChar &to) const
103 return descToUniv_.map(from, to, tem);
107 Boolean UnivCharsetDesc::descToUniv(WideChar from, UnivChar &to,
108 WideChar &alsoMax) const
110 return descToUniv_.map(from, to, alsoMax);
114 unsigned UnivCharsetDesc::univToDesc(UnivChar from, WideChar &to,
115 ISet<WideChar> &toSet) const
118 return descToUniv_.inverseMap(from, to, toSet, tem);
122 unsigned UnivCharsetDesc::univToDesc(UnivChar from, WideChar &to,
123 ISet<WideChar> &toSet,
124 WideChar &count) const
126 return descToUniv_.inverseMap(from, to, toSet, count);
130 void UnivCharsetDesc::addRange(WideChar descMin,
134 descToUniv_.addRange(descMin, descMax, univMin);
138 UnivCharsetDescIter::UnivCharsetDescIter(const UnivCharsetDesc &desc)
139 : iter_(desc.descToUniv_)
144 Boolean UnivCharsetDescIter::next(WideChar &descMin,
148 return iter_.next(descMin, descMax, univMin);
155 #endif /* not UnivCharsetDesc_INCLUDED */