File: CWCharset.h

package info (click to toggle)
pantomime 1.4.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,288 kB
  • sloc: objc: 22,039; makefile: 11; sh: 4
file content (108 lines) | stat: -rw-r--r-- 3,445 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
**  CWCharset.h
**
**  Copyright (c) 2001-2007 Ludovic Marcotte
**
**  Author: Ludovic Marcotte <ludovic@Sophos.ca>
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**  
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
**  Lesser General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _Pantomime_H_CWCharset
#define _Pantomime_H_CWCharset

#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

struct charset_code
{
  int code;
  unichar value;
};

/*!
  @class CWCharset
  @discussion This class provides a useful interface for dealing with 
              Internet message character sets.
*/
@interface CWCharset : NSObject
{
  @private
    const struct charset_code *_codes;
    int _num_codes;
    int _identity_map;
}

/*!
  @method initWithCodeCharTable: length:
  @discussion This method is used to initialize a CWCharset instance
              based on the charset code table. You should never
	      call this initializer directly. You should rather
	      invoke directly -init on CWCharset's subclasses.
  @param codes The charset code table which must be sorted by code.
  @param num_codes The size of the table.
*/
- (id) initWithCodeCharTable: (const struct charset_code *) codes
                      length: (int) num_codes;

/*!
  @method codeForCharacter:
  @discussion This method is used to obtain the right code from
              a Unicode character, in the code table.
  @param theCharacter The Unicode character to use.
  @result The code from the code table.
*/
- (int) codeForCharacter: (unichar) theCharacter;

/*!
  @method characterIsInCharset:
  @discussion This method is used to verify if <i>theCharacter</i>
              is present in the receiver.
  @param theCharacter The Unicode character to verify the availability.
  @result YES if it is present, NO otherwise.
*/
- (BOOL) characterIsInCharset: (unichar) theCharacter;

/*!
  @method name
  @discussion This method is used to get the name of the receiver.
              Values returned are like "iso-8859-1", "koi8-r" and
	      so on.
  @result The Internet name of the charset.
*/
- (NSString *) name;

/*!
  @method allCharsets
  @discussion This method is used to obtain a dictionary of all supported
              charsets by Pantomime. The keys are the name of the charsets
	      (NSString instances) and the values are a description 
	      of the charset (NSString instances).
  @result The dictionary of all supported character sets.
*/
+ (NSDictionary *) allCharsets;

/*!
  @method charsetForName:
  @discussion This method is used to obtain a CWCharset subclass instance
              from the Internet name of a charset.
  @param theName The Internet name of a charset, like "iso-8859-1".
  @result The CWCharset instance. If a non-supported name was specified,
          an instance of CWISO8859_1 is returned.
*/
+ (CWCharset *) charsetForName: (NSString *) theName;

@end

#endif // _Pantomime_H_CWCharset