core :: codec_base
A Codec (Coder/Decoder) is a tranformer from a byte-format to another
As Nit Strings are UTF-8, a codec works as :
core :: union_find
union–find algorithm using an efficient disjoint-set data structurebucketed_game :: bucketed_game
Game framework with an emphasis on efficient event coordinationaccept_scroll_and_zoom
gamnit :: camera_control_android
Two fingers camera manipulation, pinch to zoom and slide to scrollgamnit :: camera_control_linux
Mouse wheel and middle mouse button to control camerapthreads :: concurrent_array_and_barrier
A basic usage example of the modulespthreads
and pthreads::cocurrent_collections
pthreads :: concurrent_collections
Introduces thread-safe concurrent collectionsserialization :: custom_serialization
Example of an ad hoc serializer that is tailored to transform business specific objects into customized representation.egl
, sdl
and x11
FileServer
action, which is a standard and minimal file server
cocoa :: foundation
The Foundation Kit provides basic Objective-C classes and structuresfunctional_types.nit
functional :: functional_types
This module provides functional type to represents various function forms.gtk :: gtk_assistant
gtk :: gtk_dialogs
HttpRequest
class and services to create it
app::http_request
main service AsyncHttpRequest
Serializable::inspect
to show more useful information
Iterator
.
actors :: mandelbrot
Example implemented from "The computer Language Benchmarks Game" - Mandelbrotmarkdown2 :: markdown_html_rendering
HTML rendering of Markdown documentsmarkdown2 :: markdown_latex_rendering
LaTeX rendering of Markdown documentsmarkdown2 :: markdown_man_rendering
Manpages rendering of Markdown documentsmarkdown2 :: markdown_md_rendering
Markdown rendering of Markdown documentsmore_collections :: more_collections
Highly specific, but useful, collections-related classes.mpi :: mpi_simple
curl :: native_curl
Binding of C libCurl which allow us to interact with network.app.nit
on Android using a custom Java entry point
nitcc_runtime :: nitcc_runtime
Runtime library required by parsers and lexers generated by nitccnlp :: nlp_server
glesv2 :: opengles2_hello_triangle
Basic example of OpenGL ES 2.0 usage using SDL 2performance_analysis :: performance_analysis
Services to gather information on the performance of events by categoriesrestful
annotation documented at lib/nitcorn/restful.nit
sax :: sax_locator
Interface for associating a SAX event with a document location.Locator
.
msgpack :: serialization_common
Serialization services forserialization_write
and serialization_read
serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsdeserialize_json
and JsonDeserializer
serialize_to_json
and JsonSerializer
msgpack :: serialization_write
Serialize full Nit objects to MessagePack formatroot
to execute
agent_simulation
by refining the Agent class to make
socket :: socket_simple_server
Simple server example using a non-blockingTCPServer
EulerCamera
and App::frame_core_draw
to get a stereoscopic view
gamnit :: texture_atlas_parser
Tool to parse XML texture atlas and generated Nit code to access subtextures
# Base for codecs to use with streams
#
# A Codec (Coder/Decoder) is a tranformer from a byte-format to another
#
# As Nit Strings are UTF-8, a codec works as :
# - Coder: From a UTF-8 string to a specified format (writing)
# - Decoder: From a specified format to a UTF-8 string (reading)
module codec_base
import text
import bytes
# 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:15,1--67,3