1#ifndef CHARACTER_SET_H
2#define CHARACTER_SET_H
3
4#include <SupportDefs.h>
5
6namespace BPrivate {
7
8/**
9 * @file   CharacterSet.h
10 * @author Andrew Bachmann
11 * @brief  Defines BCharacterSet
12 *
13 * @see http://www.iana.org/assignments/character-sets
14 **/
15
16class BCharacterSet {
17    /**
18     * @class BCharacterSet
19     * @brief An object holding a variety of useful information about a character set.
20     *
21     * This information has been derived from the IANA standards organization.
22     * Since IANA provides several names for some encodings, this object also
23     * provides for aliases.
24     **/
25public:
26	/**
27     * @brief default constructor, for stack allocated character set objects
28     **/
29    BCharacterSet();
30	/**
31     * @brief constructor, for internal use only
32     **/
33    BCharacterSet(uint32 id, uint32 MIBenum, const char * print_name,
34                  const char * iana_name, const char * mime_name,
35                  const char ** aliases);
36    /**
37     * @brief returns an id for use in BFont::SetEncoding
38     * @return an id for use in BFont::SetEncoding
39     **/
40    uint32 GetFontID(void) const;
41    /**
42     * @brief returns an id for use in convert_to/from_utf8
43     * @return an id for use in convert_to/from_utf8
44     **/
45    uint32 GetConversionID(void) const;
46    /**
47     * @brief returns an id for use in MIBs to identify coded character sets
48     * @return an id for use in MIBs to identify coded character sets
49     **/
50    uint32 GetMIBenum(void) const;
51    /**
52     * @brief returns the IANA standard name for this character set
53     * @return the IANA standard name for this character set
54     **/
55    const char * GetName(void) const;
56    /**
57     * @brief returns a user interface friendly name for this character set
58     * @return a user interface friendly name for this character set
59     **/
60    const char * GetPrintName(void) const;
61    /**
62     * @brief returns the MIME preferred name for this character set, or null if none exists
63     * @return the MIME preferred name for this character set, or null if none exists
64     **/
65    const char * GetMIMEName(void) const;
66    /**
67     * @brief returns the number of aliases for this character set
68     * @return the number of aliases for this character set
69     **/
70    int32 CountAliases(void) const;
71    /**
72     * @brief returns the index'th alias, or NULL if out of range
73     * @return the index'th alias, or NULL if out of range
74     **/
75    const char * AliasAt(uint32 index) const;
76
77private:
78    uint32     id;            //! id from convert_to_utf8/convert_from_utf8
79    uint32     MIBenum;       //! for use in MIBs to identify coded character sets
80    const char * print_name;  //! user interface friendly name
81    const char * iana_name;   //! standard IANA name
82    const char * mime_name;   //! the preferred mime name
83    const char ** aliases;    //! aliases for this character set
84    uint32     aliases_count; //! how many aliases are available
85};
86
87}
88
89#endif // CHARACTER_SET_H
90