VSS.Strings.Converters.Decoders

Entities

Tagged Types

Subprograms

Description

This package provides string data decoder from external encoding to Virtual_String.

Decode

function Decode
  (Self        : in out Virtual_String_Decoder'Class;
   Data_Chunk  : Ada.Streams.Stream_Element_Array;
   End_Of_Data : Boolean := True)
   return VSS.Strings.Virtual_String

Decode Data and return result. When Stateless flag was set to False, and End_Of_Data parameter is False, it returns only fully decoded portion of the data, and save incomplete data to be decoded with next call of Decode. When Stateless flag was set to True, or End_Of_Data is True, incomplete data is not allowed, it will be returned as decoding error.

Parameters
Self
Data_Chunk
End_Of_Data
Return Value

Decode

function Decode
  (Self        : in out Virtual_String_Decoder'Class;
   Data_Chunk  : VSS.Stream_Element_Vectors.Stream_Element_Vector;
   End_Of_Data : Boolean := True)
   return VSS.Strings.Virtual_String

Decode Data and return result. When Stateless flag was set to False, and End_Of_Data parameter is False, it returns only fully decoded portion of the data, and save incomplete data to be decoded with next call of Decode. When Stateless flag was set to True, or End_Of_Data is True, incomplete data is not allowed, it will be returned as decoding error.

Parameters
Self
Data_Chunk
End_Of_Data
Return Value

Error_Message

function Error_Message
  (Self : Virtual_String_Decoder'Class) return VSS.Strings.Virtual_String

Return error message for latest detected error.

Parameters
Self
Return Value

Has_Error

function Has_Error (Self : Virtual_String_Decoder'Class) return Boolean

Return True when some error has been found during decoding.

Parameters
Self
Return Value

Initialize

procedure Initialize
  (Self     : in out Virtual_String_Decoder'Class;
   Encoding : VSS.Strings.Virtual_String;
   Flags    : Converter_Flags := Default_Converter_Flags)

Initialize decoder to decode text data in given encoding. Is_Valid return True when decoder has been initialized successfully.

Parameters
Self
Encoding
Flags

Is_Valid

function Is_Valid (Self : Virtual_String_Decoder'Class) return Boolean

Return True when decoder is initialized successfully.

Parameters
Self
Return Value

Reset_State

procedure Reset_State (Self : in out Virtual_String_Decoder'Class)

Reset state of the decoder to initial (after call of Initialize). All accumulated incomplete data will be lost.

Parameters
Self

Virtual_String_Decoder

type Virtual_String_Decoder is tagged limited private;