Open Chinese Convert: SimpleConverter.hpp Source File

Open Chinese Convert 1.3.2+gad37fd0a6.dirty A project for conversion between Traditional and Simplified Chinese

Loading...
Searching...
No Matches
SimpleConverter.hpp
1/*
2 * Open Chinese Convert
3 *
4 * Copyright 2010-2014 Carbo Kuo <byvoid@byvoid.com>
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#include "Export.hpp"
20#include <memory>
21#include <string>
22#include <string_view>
23#include <vector>
24
25#ifndef __OPENCC_SIMPLECONVERTER_HPP_
26#define __OPENCC_SIMPLECONVERTER_HPP_
27
28#include "ConversionInspection.hpp"
29#include "ResourceProvider.hpp"
30
36
37namespace opencc {
38
39struct ConfigLoadOptions;
40
45 class OPENCC_EXPORT SimpleConverter {
46public:
51 explicit SimpleConverter(const std::string& configFileName);
52
58 SimpleConverter(const std::string& configFileName,
59 const ConfigLoadOptions& options);
60
66 SimpleConverter(const std::string& configFileName,
67 const std::vector<std::string>& paths);
68
75 SimpleConverter(const std::string& configFileName,
76 const std::vector<std::string>& paths,
77 const ConfigLoadOptions& options);
78
86 SimpleConverter(const std::string& configFileName,
87 const std::vector<std::string>& paths, const char* argv0);
88
97 SimpleConverter(const std::string& configFileName,
98 const std::vector<std::string>& paths, const char* argv0,
99 const ConfigLoadOptions& options);
100
107 SimpleConverter(const std::string& configFileName,
108 std::shared_ptr<ResourceProvider> provider);
109
117 SimpleConverter(const std::string& configFileName,
118 std::shared_ptr<ResourceProvider> provider,
119 const ConfigLoadOptions& options);
120
121 ~SimpleConverter();
122
127 std::string Convert(const std::string& input) const;
128
135 std::string Convert(std::string_view input) const;
136
141 std::string Convert(const char* input) const;
142
149 std::string Convert(const char* input, size_t length) const;
150
158 size_t Convert(const char* input, char* output) const;
159
169 size_t Convert(const char* input, size_t length, char* output) const;
170
177 ConversionInspectionResult Inspect(std::string_view input) const;
178
179private:
180 const void* internalData;
181};
182
183} // namespace opencc
184
185#endif
opencc::SimpleConverter::Convert
std::string Convert(const std::string &input) const
Converts a text.
Definition SimpleConverter.cpp:129
opencc::SimpleConverter::Inspect
ConversionInspectionResult Inspect(std::string_view input) const
Inspects the conversion process for a given text.
Definition SimpleConverter.cpp:176
opencc::SimpleConverter::SimpleConverter
SimpleConverter(const std::string &configFileName)
Constructor of SimpleConverter.
Definition SimpleConverter.cpp:88
opencc::ConfigLoadOptions
Definition Config.hpp:26
opencc::ConversionInspectionResult
Full inspection result returned by Converter::Inspect().
Definition ConversionInspection.hpp:52