Oolite 1.91.0.7644-241112-7f5034b
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
32#ifndef OOENCODINGCONVERTER_EXCLUDE // For the convenience of fonttexgen
33
34#import "OOCocoa.h"
35
36@class OOCache;
37
38
39@interface OOEncodingConverter: NSObject
40{
41@private
42 NSStringEncoding _encoding;
44 NSDictionary *_substitutions;
45}
46
47- (id) initWithEncoding:(NSStringEncoding)encoding substitutions:(NSDictionary *)substitutions;
48- (id) initWithFontPList:(NSDictionary *)fontPList;
49
50- (NSData *) convertString:(NSString *)string;
51
52- (NSStringEncoding) encoding;
53
54@end
55
56#endif //OOENCODINGCONVERTER_EXCLUDE
57
58
59/*
60 There are a variety of overlapping naming schemes for text encoding.
61 We ignore them and use a fixed list:
62 "windows-latin-1" NSWindowsCP1252StringEncoding
63 "windows-latin-2" NSWindowsCP1250StringEncoding
64 "windows-cyrillic" NSWindowsCP1251StringEncoding
65 "windows-greek" NSWindowsCP1253StringEncoding
66 "windows-turkish" NSWindowsCP1254StringEncoding
67*/
68NSString *StringFromEncoding(NSStringEncoding encoding); // Returns nil for unknown
69NSStringEncoding EncodingFromString(NSString *name); // Returns (NSStringEncoding)NSNotFound for unknown
NSStringEncoding EncodingFromString(NSString *name)
NSString * StringFromEncoding(NSStringEncoding encoding)
NSDictionary * _substitutions
NSStringEncoding _encoding