Loading...
Searching...
No Matches
opencc::ConverterStream Class Reference

## Public Member Functions

| ConverterStream (ConverterPtr converter, size_t maxKeepChars=16)
std::string | ConvertChunk (std::string_view input)
| Appends `input` to pending, then emits everything up to the last `maxKeepChars` code points (extended if an incomplete IDS is detected).
std::string | Finish (std::string_view input)
| Appends `input` to pending and flushes everything at once.
std::string | Finish ()

## Constructor & Destructor Documentation

## ConverterStream()

opencc::ConverterStream::ConverterStream | ( | ConverterPtr | converter,
|  | size_t | maxKeepChars = 16 )

inline explicit

Parameters

  converter | The converter applied to each flushed chunk.
  maxKeepChars | Number of Unicode code points (not bytes) to retain at the end of the pending buffer after each ConvertChunk() call, so that a phrase or IDS straddling two consecutive chunks is not split across separate Convert() invocations. Defaults to 16 code points.

## Member Function Documentation

## ConvertChunk()

std::string ConverterStream::ConvertChunk | ( | std::string_view | input | ) |

Appends `input` to pending, then emits everything up to the last `maxKeepChars` code points (extended if an incomplete IDS is detected).

The kept tail remains in pending so that a phrase or IDS spanning two consecutive calls is not split across separate Convert() invocations.

## Finish()

std::string ConverterStream::Finish | ( | std::string_view | input | ) |

Appends `input` to pending and flushes everything at once.

Note
  Not equivalent to ConvertChunk(`input`) + Finish(): ConvertChunk applies the keepStart window and issues two Convert() calls, which breaks phrase or IDS matches that span the boundary. Use this overload for the final chunk when no more data is coming.

The documentation for this class was generated from the following files:

- Converter.hpp
- Converter.cpp