com.github.ukrainiantolatin.res.UkrainianToLatin.h Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ukrainiantolatin Show documentation
Show all versions of ukrainiantolatin Show documentation
The utility class to convert ukrainian words to the latin characters
#pragma once
#include
#include
/*
* $Id$
*
* Copyright 2012 Valentyn Kolesnikov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace com
{
namespace github
{
namespace ukrainiantolatin
{
///
/// UkrainianToLatin utility class.
///
/// @author Valentyn Kolesnikov
/// @version $Revision$ $Date$
///
class UkrainianToLatin final
{
private:
enum class Convert
{
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
AA(L"Аа"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
BB(L"Бб"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
VV(L"Вв"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
HH(L"Гг"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
GG(L"Ґґ"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
DD(L"Дд"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
EE(L"Ее"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YeIe(L"Єє"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
ZhZh(L"Жж"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
ZZ(L"Зз"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YY(L"Ии"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
II(L"Іі"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YiI(L"Її"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YI(L"Йй"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
KK(L"Кк"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
LL(L"Лл"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
MM(L"Мм"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
NN(L"Нн"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
OO(L"Оо"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
PP(L"Пп"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
RR(L"Рр"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
SS(L"Сс"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
TT(L"Тт"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
UU(L"Уу"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
FF(L"Фф"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
KhKh(L"Хх"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
TsTs(L"Цц"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
ChCh(L"Чч"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
ShSh(L"Шш"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
ShchShch(L"Щщ"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YuIu(L"Юю"),
//JAVA TO C++ CONVERTER TODO TASK: Enum values cannot be strings in C++:
YaIa(L"Яя");
//JAVA TO C++ CONVERTER TODO TASK: Enums cannot contain fields in C++:
// private String cyrilic;
//JAVA TO C++ CONVERTER TODO TASK: Enums cannot contain methods in C++:
// private Convert(String cyrilic)
// {
// this.cyrilic = cyrilic;
// }
///
/// Gets cyrilic.
/// the cyrilic
//JAVA TO C++ CONVERTER TODO TASK: Enums cannot contain methods in C++:
// public String getCyrilic()
// {
// return cyrilic;
// }
};
private:
class ConvertCase
{
private:
const Convert convert;
const bool lowcase;
public:
ConvertCase(Convert convert, bool lowcase);
virtual Convert getConvert();
virtual bool isLowcase();
};
private:
static const int INDEX_0 = 0;
static const int INDEX_1 = 1;
static const int INDEX_2 = 2;
static const int INDEX_3 = 3;
static const int INDEX_4 = 4;
static const int INDEX_8 = 8;
static const int LENGTH_2 = 2;
static const int LENGTH_3 = 3;
static const int LENGTH_4 = 4;
static const int LENGTH_8 = 8;
static Map *cyrToLat;
//JAVA TO C++ CONVERTER TODO TASK: Static constructors are not allowed in native C++:
static UkrainianToLatin();
///
/// Generates latinic from cyrilic.
/// the name
/// the result
public:
static std::wstring generateLat(const std::wstring &name);
///
///
private:
static void checkFirstChar(StringBuffer *result, ConvertCase *convertCase, ConvertCase *nextConvertCase);
///
///
static void checkMiddleChar(StringBuffer *result, ConvertCase *convertCase, ConvertCase *nextConvertCase);
};
}
}
}