Open Chinese Convert 1.3.2+gad37fd0a6.dirty
A project for conversion between Traditional and Simplified Chinese
Loading...
Searching...
No Matches
opencc::SimpleConverter Class Reference

A high-level converter. More...

#include <SimpleConverter.hpp>

Public Member Functions

 SimpleConverter (const std::string &configFileName)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, const ConfigLoadOptions &options)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, const std::vector< std::string > &paths)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, const std::vector< std::string > &paths, const ConfigLoadOptions &options)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, const std::vector< std::string > &paths, const char *argv0)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, const std::vector< std::string > &paths, const char *argv0, const ConfigLoadOptions &options)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, std::shared_ptr< ResourceProvider > provider)
 Constructor of SimpleConverter.
 SimpleConverter (const std::string &configFileName, std::shared_ptr< ResourceProvider > provider, const ConfigLoadOptions &options)
 Constructor of SimpleConverter.
std::string Convert (const std::string &input) const
 Converts a text.
std::string Convert (std::string_view input) const
 Converts a text without requiring a null-terminated buffer.
std::string Convert (const char *input) const
 Converts a text.
std::string Convert (const char *input, size_t length) const
 Converts a text.
size_t Convert (const char *input, char *output) const
 Converts a text and writes to an allocated buffer Please make sure the buffer has sufficient space.
size_t Convert (const char *input, size_t length, char *output) const
 Converts a text and writes to an allocated buffer Please make sure the buffer has sufficient space.
ConversionInspectionResult Inspect (std::string_view input) const
 Inspects the conversion process for a given text.

Detailed Description

A high-level converter.

Constructor & Destructor Documentation

◆ SimpleConverter() [1/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName)
explicit

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.

◆ SimpleConverter() [2/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
const ConfigLoadOptions & options )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
optionsConfiguration loading options.

◆ SimpleConverter() [3/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
const std::vector< std::string > & paths )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
pathsAdditional paths to locate configuration and dictionary files.

◆ SimpleConverter() [4/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
const std::vector< std::string > & paths,
const ConfigLoadOptions & options )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
pathsAdditional paths to locate configuration and dictionary files.
optionsConfiguration loading options.

◆ SimpleConverter() [5/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
const std::vector< std::string > & paths,
const char * argv0 )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
pathsAdditional paths to locate configuration and dictionary files.
argv0Path of the executable (argv[0]), in addition to additional paths.

◆ SimpleConverter() [6/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
const std::vector< std::string > & paths,
const char * argv0,
const ConfigLoadOptions & options )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
pathsAdditional paths to locate configuration and dictionary files.
argv0Path of the executable (argv[0]), in addition to additional paths.
optionsConfiguration loading options.

◆ SimpleConverter() [7/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
std::shared_ptr< ResourceProvider > provider )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
providerProvider used to locate dictionary/resource files referenced by the configuration.

◆ SimpleConverter() [8/8]

SimpleConverter::SimpleConverter ( const std::string & configFileName,
std::shared_ptr< ResourceProvider > provider,
const ConfigLoadOptions & options )

Constructor of SimpleConverter.

Parameters
configFileNameFile name of configuration.
providerProvider used to locate dictionary/resource files referenced by the configuration.
optionsConfiguration loading options.

Member Function Documentation

◆ Convert() [1/6]

std::string SimpleConverter::Convert ( const char * input) const

Converts a text.

Parameters
inputA C-Style std::string (terminated by '\0') to be converted.

◆ Convert() [2/6]

size_t SimpleConverter::Convert ( const char * input,
char * output ) const

Converts a text and writes to an allocated buffer Please make sure the buffer has sufficient space.

Parameters
inputA C-Style std::string (terminated by '\0') to be converted.
outputBuffer to write the converted text.
Returns
Length of converted text.

◆ Convert() [3/6]

std::string SimpleConverter::Convert ( const char * input,
size_t length ) const

Converts a text.

Parameters
inputA C-Style std::string limited by a given length to be converted.
lengthMaximal length in byte of the input std::string.

◆ Convert() [4/6]

size_t SimpleConverter::Convert ( const char * input,
size_t length,
char * output ) const

Converts a text and writes to an allocated buffer Please make sure the buffer has sufficient space.

Parameters
inputA C-Style std::string limited by a given length to be converted.
lengthMaximal length in byte of the input std::string.
outputBuffer to write the converted text.
Returns
Length of converted text.

◆ Convert() [5/6]

std::string SimpleConverter::Convert ( const std::string & input) const

Converts a text.

Parameters
inputText to be converted.

◆ Convert() [6/6]

std::string SimpleConverter::Convert ( std::string_view input) const

Converts a text without requiring a null-terminated buffer.

New code should prefer this overload when a string_view is already available.

Parameters
inputText to be converted.

◆ Inspect()

ConversionInspectionResult SimpleConverter::Inspect ( std::string_view input) const

Inspects the conversion process for a given text.

Returns the segmentation result, per-stage conversion outputs, and final output string.

Parameters
inputText to be inspected.

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