mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-14 23:07:56 +02:00
fixed doc typos; changed maximum sequence length to 4
This commit is contained in:
@@ -30,7 +30,7 @@ class TextEncodingManager;
|
||||
|
||||
class Foundation_API TextEncoding
|
||||
/// An abstract base class for implementing text encodings
|
||||
/// like UTF-8 or ISO 8859-1.
|
||||
/// like UTF-8 or ISO 8859-1.
|
||||
///
|
||||
/// Subclasses must override the canonicalName(), isA(),
|
||||
/// characterMap() and convert() methods and need to be
|
||||
@@ -42,12 +42,12 @@ class Foundation_API TextEncoding
|
||||
{
|
||||
public:
|
||||
typedef SharedPtr<TextEncoding> Ptr;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_SEQUENCE_LENGTH = 6 /// The maximum character byte sequence length supported.
|
||||
MAX_SEQUENCE_LENGTH = 4 /// The maximum character byte sequence length supported.
|
||||
};
|
||||
|
||||
|
||||
typedef int CharacterMap[256];
|
||||
/// The map[b] member gives information about byte sequences
|
||||
/// whose first byte is b.
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/// If map[b] is -1, then the byte sequence is malformed.
|
||||
/// If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
|
||||
/// sequence that encodes a single Unicode scalar value. Byte sequences up
|
||||
/// to 6 bytes in length are supported.
|
||||
/// to 4 bytes in length are supported.
|
||||
|
||||
virtual ~TextEncoding();
|
||||
/// Destroys the encoding.
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
/// For example, the "ISO-8859-1" encoding is also known as "Latin-1".
|
||||
///
|
||||
/// Encoding name comparision are be case insensitive.
|
||||
|
||||
|
||||
virtual const CharacterMap& characterMap() const = 0;
|
||||
/// Returns the CharacterMap for the encoding.
|
||||
/// The CharacterMap should be kept in a static member. As
|
||||
@@ -78,52 +78,54 @@ public:
|
||||
/// implemented in such a way that it just returns a static
|
||||
/// map. If the map is built at runtime, this should be
|
||||
/// done in the constructor.
|
||||
|
||||
|
||||
virtual int convert(const unsigned char* bytes) const;
|
||||
/// The convert function is used to convert multibyte sequences;
|
||||
/// bytes will point to a byte sequence of n bytes where
|
||||
/// bytes will point to a byte sequence of n bytes where
|
||||
/// sequenceLength(bytes, length) == -n, with length >= n.
|
||||
///
|
||||
/// The convert function must return the Unicode scalar value
|
||||
/// represented by this byte sequence or -1 if the byte sequence is malformed.
|
||||
///
|
||||
/// The default implementation returns (int) bytes[0].
|
||||
|
||||
virtual int queryConvert(const unsigned char* bytes, int length) const;
|
||||
/// The queryConvert function is used to convert single byte characters
|
||||
/// The queryConvert function is used to convert single byte characters
|
||||
/// or multibyte sequences;
|
||||
/// bytes will point to a byte sequence of length bytes.
|
||||
///
|
||||
/// The queryConvert function must return the Unicode scalar value
|
||||
/// represented by this byte sequence or -1 if the byte sequence is malformed
|
||||
/// or -n where n is number of bytes requested for the sequence, if lenght is
|
||||
/// or -n where n is number of bytes requested for the sequence, if length is
|
||||
/// shorter than the sequence.
|
||||
/// The length of the sequence might not be determined by the first byte,
|
||||
/// The length of the sequence might not be determined by the first byte,
|
||||
/// in which case the conversion becomes an iterative process:
|
||||
/// First call with length == 1 might return -2,
|
||||
/// Then a second call with lenght == 2 might return -4
|
||||
/// Eventually, the third call with length == 4 should return either a
|
||||
/// Then a second call with length == 2 might return -4
|
||||
/// Eventually, the third call with length == 4 should return either a
|
||||
/// Unicode scalar value, or -1 if the byte sequence is malformed.
|
||||
///
|
||||
/// The default implementation returns (int) bytes[0].
|
||||
|
||||
virtual int sequenceLength(const unsigned char* bytes, int length) const;
|
||||
/// The sequenceLength function is used to get the lenth of the sequence pointed
|
||||
/// by bytes. The length paramater should be greater or equal to the length of
|
||||
/// by bytes. The length paramater should be greater or equal to the length of
|
||||
/// the sequence.
|
||||
///
|
||||
/// The sequenceLength function must return the lenght of the sequence
|
||||
/// represented by this byte sequence or a negative value -n if length is
|
||||
/// shorter than the sequence, where n is the number of byte requested
|
||||
/// The sequenceLength function must return the length of the sequence
|
||||
/// represented by this byte sequence or a negative value -n if length is
|
||||
/// shorter than the sequence, where n is the number of byte requested
|
||||
/// to determine the length of the sequence.
|
||||
/// The length of the sequence might not be determined by the first byte,
|
||||
/// in which case the conversion becomes an iterative process as long as the
|
||||
/// The length of the sequence might not be determined by the first byte,
|
||||
/// in which case the conversion becomes an iterative process as long as the
|
||||
/// result is negative:
|
||||
/// First call with length == 1 might return -2,
|
||||
/// Then a second call with lenght == 2 might return -4
|
||||
/// Then a second call with length == 2 might return -4
|
||||
/// Eventually, the third call with length == 4 should return 4.
|
||||
/// The default implementation returns 1.
|
||||
|
||||
virtual int convert(int ch, unsigned char* bytes, int length) const;
|
||||
/// Transform the Unicode character ch into the encoding's
|
||||
/// Transform the Unicode character ch into the encoding's
|
||||
/// byte sequence. The method returns the number of bytes
|
||||
/// used. The method must not use more than length characters.
|
||||
/// Bytes and length can also be null - in this case only the number
|
||||
@@ -136,7 +138,7 @@ public:
|
||||
/// Returns the TextEncoding object for the given encoding name.
|
||||
///
|
||||
/// Throws a NotFoundException if the encoding with given name is not available.
|
||||
|
||||
|
||||
static TextEncoding::Ptr find(const std::string& encodingName);
|
||||
/// Returns a pointer to the TextEncoding object for the given encodingName,
|
||||
/// or NULL if no such TextEncoding object exists.
|
||||
@@ -170,7 +172,7 @@ public:
|
||||
|
||||
static const std::string GLOBAL;
|
||||
/// Name of the global TextEncoding, which is the empty string.
|
||||
|
||||
|
||||
protected:
|
||||
static TextEncodingManager& manager();
|
||||
/// Returns the TextEncodingManager.
|
||||
|
Reference in New Issue
Block a user