1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
22 #include "charptrless.h"
29 // This may not be the appropriate namespace...
36 // This shall be the Unicode code point. The corresponding iconv
37 // encoding name should be given by UCS_4_INTERNAL, defined in config.h.
38 typedef uint32_t UnicodeType
;
40 // This is only a memory, with no particular order of its items.
41 PtrOwner_back_Access
< std::vector
< const char * > > nameMem_
;
43 // This is idexed by size_t and maps to a name or a null pointer.
44 static const size_t TABLE_SIZE
= 65536;
45 std::vector
< const char * > namePtrs_
;
46 std::map
< UnicodeType
, const char * > namePtrsWide_
;
48 // This is the reverse map.
49 std::map
< const char *, UnicodeType
, charPtrLess
> nameMap_
;
52 GlyphList( std::istream
& iFile
);
55 // Returns true on success.
56 bool UCS4_to_name( UnicodeType code
, const char ** dst
) const;
57 bool UTF8_to_name( const char * code
, const char ** dst
) const;
59 // Returns true on success.
60 bool name_to_UCS4( const char * name
, UnicodeType
* dst
) const;
65 void readfile( std::istream
& iFile
);