Debian Codegraph @

Framework/Pantomime/CWCharset.h

raw symbols SCIP
1 /*
2 ** CWCharset.h
3 **
4 ** Copyright (c) 2001-2007 Ludovic Marcotte
5 **
6 ** Author: Ludovic Marcotte <[email protected]>
7 **
8 ** This library is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU Lesser General Public
10 ** License as published by the Free Software Foundation; either
11 ** version 2.1 of the License, or (at your option) any later version.
12 **
13 ** This library is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** Lesser General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef _Pantomime_H_CWCharset
23 #define _Pantomime_H_CWCharset
24
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSString.h>
27
28 struct charset_code
29 {
30 int code;
31 unichar value;
32 };
33
34 /*!
35 @class CWCharset
36 @discussion This class provides a useful interface for dealing with
37 Internet message character sets.
38 */
39 @interface CWCharset : NSObject
40 {
41 @private
42 const struct charset_code *_codes;
43 int _num_codes;
44 int _identity_map;
45 }
46
47 /*!
48 @method initWithCodeCharTable: length:
49 @discussion This method is used to initialize a CWCharset instance
50 based on the charset code table. You should never
51 call this initializer directly. You should rather
52 invoke directly -init on CWCharset's subclasses.
53 @param codes The charset code table which must be sorted by code.
54 @param num_codes The size of the table.
55 */
56 - (id) initWithCodeCharTable: (const struct charset_code *) codes
57 length: (int) num_codes;
58
59 /*!
60 @method codeForCharacter:
61 @discussion This method is used to obtain the right code from
62 a Unicode character, in the code table.
63 @param theCharacter The Unicode character to use.
64 @result The code from the code table.
65 */
66 - (int) codeForCharacter: (unichar) theCharacter;
67
68 /*!
69 @method characterIsInCharset:
70 @discussion This method is used to verify if <i>theCharacter</i>
71 is present in the receiver.
72 @param theCharacter The Unicode character to verify the availability.
73 @result YES if it is present, NO otherwise.
74 */
75 - (BOOL) characterIsInCharset: (unichar) theCharacter;
76
77 /*!
78 @method name
79 @discussion This method is used to get the name of the receiver.
80 Values returned are like "iso-8859-1", "koi8-r" and
81 so on.
82 @result The Internet name of the charset.
83 */
84 - (NSString *) name;
85
86 /*!
87 @method allCharsets
88 @discussion This method is used to obtain a dictionary of all supported
89 charsets by Pantomime. The keys are the name of the charsets
90 (NSString instances) and the values are a description
91 of the charset (NSString instances).
92 @result The dictionary of all supported character sets.
93 */
94 + (NSDictionary *) allCharsets;
95
96 /*!
97 @method charsetForName:
98 @discussion This method is used to obtain a CWCharset subclass instance
99 from the Internet name of a charset.
100 @param theName The Internet name of a charset, like "iso-8859-1".
101 @result The CWCharset instance. If a non-supported name was specified,
102 an instance of CWISO8859_1 is returned.
103 */
104 + (CWCharset *) charsetForName: (NSString *) theName;
105
106 @end
107
108 #endif // _Pantomime_H_CWCharset