Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 2.82 KB

TPJAnsiSBCSPipeFilter-OnLineEnd.md

File metadata and controls

56 lines (38 loc) · 2.82 KB

OnLineEnd event

Project: I/O Utility Classes

Unit: PJPipeFilters

Class: TPJAnsiSBCSPipeFilter

Applies to: ~>1.0

property OnLineEnd: TPJAnsiTextReadEvent;

Description

This event is triggered whenever an end of a line is encountered in the ANSI text read from the associated pipe. Line ends are determined by the value of the EOLMarker property.

The event can also be triggered when the Flush method is called or when the object is destroyed. This occurs if there is some text remaining that has not been terminated by the end of line marker.

The event handler is passed the following parameters:

  • Sender - Set to the TPJAnsiSBCSPipeFilter object that triggered the event.

  • Text - An AnsiString containing the line of text, stripped of the end of line marker.

Example

Suppose we have a TPJAnsiSBCSPipeFilter object created on a pipe that contains the following ANSI text:

Lorem ipsum<EOL>intellegam<EOL>dissentias<EOL>te sea

The EOLMarker property is set to "<EOL>". We perform three pipe reads and a flush operation before destroying the object. Here's what happens:

  • The ReadPipe method is called and reads text "Lorem ip" from the pipe.
    • OnLineEnd is not triggered because the text contains no end of line marker ("<EOL>").
    • The text is recorded for later use in a "carry forward" buffer.
  • ReadPipe is called and reads "sum<EOL>intellegam<EOL>dis" from the pipe.
    • The text is appended to the carried forward text to get "Lorem ipsum<EOL>intellegam<EOL>dis", which is then processed.
    • OnLineEnd is triggered with parameter "Lorem ipsum". The following "<EOL>" is discarded.
    • OnLineEnd is triggered again with parameter "intellegam". The following "<EOL>" is again discarded.
    • The text "dis" is left over and recorded in the carry forward buffer.
  • ReadPipe is called and reads "sentias<EOL>te sea" from the pipe.
    • The text is appended to the carried forward text to get "dissentias<EOL>te sea", which is processed.
    • OnLineEnd is triggered with parameter "dissentias" and the following "<EOL>" is discarded.
    • The remaining text "te sea" is recorded in the carry forward buffer.
  • The Flush method is called.
    • OnLineEnd is triggered with carried forward text "te sea" as its parameter.
    • The carry forward buffer is cleared.
  • The object is destroyed, which automatically calls Flush once more.
    • Nothing happens because the carry forward buffer is empty.

See Also