core :: Codec :: add_char_to
Adds a charc
to bytes s
core :: Codec :: add_string_to
Adds a strings
coded as the supported encoding to b
core :: Codec :: char_max_size
Maximum size of acharacter
in supported encoding
core :: Codec :: decode_char
Decodes a char fromb
to a Unicode code-point
core :: Codec :: decode_string
Decodes a stringb
to UTF-8
core :: Codec :: defaultinit
core :: Codec :: encode_char
Transformsc
to its representation in the format of self
core :: Codec :: encode_string
Transformss
to the format of self
core :: Codec :: is_valid_char
Is the sequence of bytes inns
at position
a valid Char ?
core :: Codec :: max_lookahead
How many lookaheads might be required to decode a single char ?core :: Codec :: add_char_to
Adds a charc
to bytes s
core :: Codec :: add_string_to
Adds a strings
coded as the supported encoding to b
core :: Codec :: char_max_size
Maximum size of acharacter
in supported encoding
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Codec :: decode_char
Decodes a char fromb
to a Unicode code-point
core :: Codec :: decode_string
Decodes a stringb
to UTF-8
core :: Object :: defaultinit
core :: Codec :: defaultinit
core :: Codec :: encode_char
Transformsc
to its representation in the format of self
core :: Codec :: encode_string
Transformss
to the format of self
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Codec :: is_valid_char
Is the sequence of bytes inns
at position
a valid Char ?
core :: Codec :: max_lookahead
How many lookaheads might be required to decode a single char ?core :: Object :: output_class_name
Display class name on stdout (debug only).
# Codes/Decodes entities from/to UTF-8
abstract class Codec
# Maximum size of a `character` in supported encoding
fun char_max_size: Int is abstract
# Transforms `c` to its representation in the format of `self`
fun encode_char(c: Char): CString is abstract
# Adds a char `c` to bytes `s`
#
# Returns the number of bytes written to `s`
fun add_char_to(c: Char, s: CString): Int is abstract
# Transforms `s` to the format of `self`
fun encode_string(s: Text): Bytes is abstract
# Adds a string `s` coded as the supported encoding to `b`
#
# Returns the number of bytes written to `s`
fun add_string_to(s: Text, b: Bytes): Int is abstract
# Size of a codet for the target encoding
fun codet_size: Int is abstract
# How many lookaheads might be required to decode a single char ?
fun max_lookahead: Int is abstract
# Is the sequence of bytes in `ns` at `position` a valid Char ?
#
# Returns either
# * 0 if valid
# * 1 if incomplete
# * 2 if invalid
fun is_valid_char(ns: CString, position: Int): Int is abstract
# Decodes a char from `b` to a Unicode code-point
fun decode_char(b: CString): Char is abstract
# Decodes a string `b` to UTF-8
fun decode_string(b: CString, len: Int): String is abstract
end
lib/core/codecs/codec_base.nit:27,1--67,3