Oolite
Loading...
Searching...
No Matches
OOEncodingConverter.h
Go to the documentation of this file.
1/*
2
3OOEncodingConverter.h
4
5Convert a string to an 8-bit encoding, with some Oolite-specific remappings
6specified at init time (currently always from oolite-font.plist).
7
8
9Copyright (C) 2008-2013 Jens Ayton and contributors
10
11Permission is hereby granted, free of charge, to any person obtaining a copy
12of this software and associated documentation files (the "Software"), to deal
13in the Software without restriction, including without limitation the rights
14to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15copies of the Software, and to permit persons to whom the Software is
16furnished to do so, subject to the following conditions:
17
18The above copyright notice and this permission notice shall be included in all
19copies or substantial portions of the Software.
20
21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27SOFTWARE.
28
29*/
30
31#ifndef OOENCODINGCONVERTER_EXCLUDE // For the convenience of fonttexgen
32
33#import "OOFoundation.h"
34
35@class OOCache;
36
37@interface OOEncodingConverter : NSObject {
38@private
39 NSStringEncoding _encoding;
41 NSDictionary* _substitutions;
42}
43
44- (id)initWithEncoding:(NSStringEncoding)encoding substitutions:(NSDictionary*)substitutions;
45- (id)initWithFontPList:(NSDictionary*)fontPList;
46
47- (NSData*)convertString:(NSString*)string;
48
49- (NSStringEncoding)encoding;
50
51@end
52
53#endif // OOENCODINGCONVERTER_EXCLUDE
54
55/*
56 There are a variety of overlapping naming schemes for text encoding.
57 We ignore them and use a fixed list:
58 "windows-latin-1" NSWindowsCP1252StringEncoding
59 "windows-latin-2" NSWindowsCP1250StringEncoding
60 "windows-cyrillic" NSWindowsCP1251StringEncoding
61 "windows-greek" NSWindowsCP1253StringEncoding
62 "windows-turkish" NSWindowsCP1254StringEncoding
63*/
64NSString* StringFromEncoding(NSStringEncoding encoding); // Returns nil for unknown
65NSStringEncoding EncodingFromString(NSString* name); // Returns (NSStringEncoding)NSNotFound for unknown
NSStringEncoding EncodingFromString(NSString *name)
NSString * StringFromEncoding(NSStringEncoding encoding)
NSDictionary * _substitutions
NSStringEncoding _encoding