The class Charset is a factory class to make a string out of arbitrarily coded C-strings and vice versa.
More...
|
| | Charset (CharsetDecoder *decoder) |
| | Special constructor for the static initialisation of the default decoder. This is always the UTF-8 encoding.
|
| |
| | Charset (const char *name, CharsetDecoder *decoder) |
| | Constructor for the static initialisation (therefore not a string).
|
| |
| | Charset (const String &name, const String *alternatives, uint8 altCount, CharsetDecoder *decoder) |
| | Constructor.
|
| |
| | ~Charset () override |
| | Destructor.
|
| |
| const String & | name () const |
| | This method returns the name of the character set.
|
| |
| bool | hasName (const String &name) const |
| | This method tests whether the character set is addressed under the desired name.
|
| |
| CharArray | decode (const char *cString) |
| | This method decodes the C-string and generates a chararray that has been converted through the encoding.
|
| |
| ByteArray | encode (const CharArray &string) |
| | This Method generates the corresponding C-string from a string using this character set.
|
| |
| | Object () noexcept |
| | Constructor.
|
| |
| virtual | ~Object () noexcept |
| | Destructor.
|
| |
| void | release () noexcept |
| | Decreases the reference counter and releases the object immediately when the reference counter becomes 0.
|
| |
| Object * | retain () noexcept |
| | Increases the reference counter of this object by 1.
|
| |
| Object * | autorelease () noexcept |
| | Same function as release(), but releases the object with a delay if the reference counter is 0. AutoreleasePool::drain() must be called in the to release the object.
|
| |
| int32 | referenceCount () const noexcept |
| | Returns the value of the reference counter.
|
| |
| virtual bool | equals (const Object *other) const |
| | Comparison of objects.
|
| |
| virtual String | displayName () const |
| | Returns the display name of the object intended to present to a user.
|
| |
| virtual void | printDiffInfo (DiffOperation operation, Object *other) const |
| | Output method for outputting the diff results for the diff algorithm.
|
| |
| void | setHighBit (bool status) noexcept |
| |
| bool | highBit () const noexcept |
| |
|
| static Charset * | forName (const String &name) |
| | This method returns the desired charset by name.
|
| |
| static Charset * | getDefault () |
| | This method returns the default character set (UTF-8).
|
| |
| static String | guess (const char *stream, size_t length) |
| | This method guesses the character encoding from the given array and returns the guessed name. If no character set is recognised, depending on the operating system, the default character set is returned. Corresponding to the operating system, those are the following:
|
| |
The class Charset is a factory class to make a string out of arbitrarily coded C-strings and vice versa.
◆ Charset() [1/3]
Special constructor for the static initialisation of the default decoder. This is always the UTF-8 encoding.
◆ Charset() [2/3]
Constructor for the static initialisation (therefore not a string).
- Parameters
-
| name | Name of the character set |
| decoder | The decoder for this character set |
◆ Charset() [3/3]
Constructor.
- Parameters
-
| name | Name of the character set |
| alternatives | Alternative names for the character set |
| altCount | Number of alternative names for this character set |
| decoder | The decoder for this character set |
◆ ~Charset()
| jm::Charset::~Charset |
( |
| ) |
|
|
override |
◆ decode()
| CharArray jm::Charset::decode |
( |
const char * |
cString | ) |
|
This method decodes the C-string and generates a chararray that has been converted through the encoding.
- Parameters
-
| cString | The C-string that is to be converted. |
◆ encode()
This Method generates the corresponding C-string from a string using this character set.
- Parameters
-
| string | The C-string that is to be converted. |
◆ forName()
This method returns the desired charset by name.
- Parameters
-
| name | The name of the charset. |
- Returns
- The charset, or NULL, if the charset for name was not found.
◆ getDefault()
| static Charset * jm::Charset::getDefault |
( |
| ) |
|
|
static |
This method returns the default character set (UTF-8).
◆ guess()
| static String jm::Charset::guess |
( |
const char * |
stream, |
|
|
size_t |
length |
|
) |
| |
|
static |
This method guesses the character encoding from the given array and returns the guessed name. If no character set is recognised, depending on the operating system, the default character set is returned. Corresponding to the operating system, those are the following:
- Windows: Windows-1252
- Mac: MacRoman
- Linux: UTF-8 However, even if one of the values above is returned it does not automatically mean that no character set was recognised.
◆ hasName()
| bool jm::Charset::hasName |
( |
const String & |
name | ) |
const |
This method tests whether the character set is addressed under the desired name.
- Parameters
-
| name | The name that is to be checked using this method. |
- Returns
- Returns true if either the name of the character set or one of the alternative names matches
name. Otherwise, return value is false.
◆ name()
| const String & jm::Charset::name |
( |
| ) |
const |
This method returns the name of the character set.
◆ quitCharsets
Deletes the charset objects.
- Note
- Called by System::quit. Therefore no export or direct call by developer necessary.