mirror of https://github.com/procxx/kepka.git
Replaced MetaStyle project with codegen_style/numbers in MSVC.
This commit is contained in:
parent
4fe70c3a12
commit
6859109503
12
Telegram.sln
12
Telegram.sln
|
@ -5,15 +5,12 @@ VisualStudioVersion = 14.0.24720.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Telegram", "Telegram\Telegram.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Telegram", "Telegram\Telegram.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0} = {6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}
|
|
||||||
{E4DF8176-4DEF-4859-962F-B497E3E7A323} = {E4DF8176-4DEF-4859-962F-B497E3E7A323}
|
{E4DF8176-4DEF-4859-962F-B497E3E7A323} = {E4DF8176-4DEF-4859-962F-B497E3E7A323}
|
||||||
{E417CAA4-259B-4C99-88E3-805F1300E8EB} = {E417CAA4-259B-4C99-88E3-805F1300E8EB}
|
{E417CAA4-259B-4C99-88E3-805F1300E8EB} = {E417CAA4-259B-4C99-88E3-805F1300E8EB}
|
||||||
{EB7D16AC-EACF-4577-B05A-F28E5F356794} = {EB7D16AC-EACF-4577-B05A-F28E5F356794}
|
{EB7D16AC-EACF-4577-B05A-F28E5F356794} = {EB7D16AC-EACF-4577-B05A-F28E5F356794}
|
||||||
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}
|
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaStyle", "Telegram\MetaStyle.vcxproj", "{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaEmoji", "Telegram\MetaEmoji.vcxproj", "{EB7D16AC-EACF-4577-B05A-F28E5F356794}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaEmoji", "Telegram\MetaEmoji.vcxproj", "{EB7D16AC-EACF-4577-B05A-F28E5F356794}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Telegram\Updater.vcxproj", "{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Telegram\Updater.vcxproj", "{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}"
|
||||||
|
@ -48,15 +45,6 @@ Global
|
||||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32
|
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32
|
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32
|
||||||
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|Win32
|
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|Win32
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Debug|x64.ActiveCfg = Debug|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Deploy|Win32.ActiveCfg = Deploy|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Deploy|Win32.Build.0 = Deploy|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Deploy|x64.ActiveCfg = Release|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}.Release|x64.ActiveCfg = Release|Win32
|
|
||||||
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|Win32.ActiveCfg = Debug|Win32
|
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|x64.ActiveCfg = Debug|Win32
|
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Deploy|Win32.ActiveCfg = Deploy|Win32
|
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Deploy|Win32.ActiveCfg = Deploy|Win32
|
||||||
|
|
|
@ -57,6 +57,9 @@ Token invalidToken() {
|
||||||
BasicTokenizedFile::BasicTokenizedFile(const QString &filepath) : reader_(filepath) {
|
BasicTokenizedFile::BasicTokenizedFile(const QString &filepath) : reader_(filepath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BasicTokenizedFile::BasicTokenizedFile(const QByteArray &content, const QString &filepath) : reader_(content, filepath) {
|
||||||
|
}
|
||||||
|
|
||||||
bool BasicTokenizedFile::putBack() {
|
bool BasicTokenizedFile::putBack() {
|
||||||
if (currentToken_ > 0) {
|
if (currentToken_ > 0) {
|
||||||
--currentToken_;
|
--currentToken_;
|
||||||
|
|
|
@ -37,6 +37,7 @@ class LogStream;
|
||||||
class BasicTokenizedFile {
|
class BasicTokenizedFile {
|
||||||
public:
|
public:
|
||||||
explicit BasicTokenizedFile(const QString &filepath);
|
explicit BasicTokenizedFile(const QString &filepath);
|
||||||
|
explicit BasicTokenizedFile(const QByteArray &content, const QString &filepath = QString());
|
||||||
BasicTokenizedFile(const BasicTokenizedFile &other) = delete;
|
BasicTokenizedFile(const BasicTokenizedFile &other) = delete;
|
||||||
BasicTokenizedFile &operator=(const BasicTokenizedFile &other) = delete;
|
BasicTokenizedFile &operator=(const BasicTokenizedFile &other) = delete;
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,22 @@ bool readFile(const QString &filepath, QByteArray *outResult) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
CleanFile::CleanFile(const QString &filepath) : filepath_(filepath) {
|
CleanFile::CleanFile(const QString &filepath)
|
||||||
|
: filepath_(filepath)
|
||||||
|
, read_(true) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CleanFile::CleanFile(const QByteArray &content, const QString &filepath)
|
||||||
|
: filepath_(filepath)
|
||||||
|
, content_(content)
|
||||||
|
, read_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CleanFile::read() {
|
bool CleanFile::read() {
|
||||||
QByteArray content;
|
if (read_) {
|
||||||
if (!readFile(filepath_, &content)) {
|
if (!readFile(filepath_, &content_)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
filepath_ = QFileInfo(filepath_).absoluteFilePath();
|
filepath_ = QFileInfo(filepath_).absoluteFilePath();
|
||||||
|
|
||||||
|
@ -73,19 +82,19 @@ bool CleanFile::read() {
|
||||||
auto insideComment = InsideComment::None;
|
auto insideComment = InsideComment::None;
|
||||||
bool insideString = false;
|
bool insideString = false;
|
||||||
|
|
||||||
const char *begin = content.cbegin(), *end = content.cend(), *offset = begin;
|
const char *begin = content_.cbegin(), *end = content_.cend(), *offset = begin;
|
||||||
auto feedContent = [this, &offset, end](const char *ch) {
|
auto feedContent = [this, &offset, end](const char *ch) {
|
||||||
if (ch > offset) {
|
if (ch > offset) {
|
||||||
if (content_.isEmpty()) content_.reserve(end - offset - 2);
|
if (result_.isEmpty()) result_.reserve(end - offset - 2);
|
||||||
content_.append(offset, ch - offset);
|
result_.append(offset, ch - offset);
|
||||||
offset = ch;
|
offset = ch;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto feedComment = [this, &offset, end](const char *ch) {
|
auto feedComment = [this, &offset, end](const char *ch) {
|
||||||
if (ch > offset) {
|
if (ch > offset) {
|
||||||
// comments_.push_back({ content_.size(), QByteArray(offset, ch - offset) });
|
// comments_.push_back({ content_.size(), QByteArray(offset, ch - offset) });
|
||||||
if (content_.isEmpty()) content_.reserve(end - offset - 2);
|
if (result_.isEmpty()) result_.reserve(end - offset - 2);
|
||||||
content_.append(' ');
|
result_.append(' ');
|
||||||
offset = ch;
|
offset = ch;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -142,10 +151,10 @@ bool CleanFile::read() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (insideComment == InsideComment::None && end > offset) {
|
if (insideComment == InsideComment::None && end > offset) {
|
||||||
if (content_.isEmpty()) {
|
if (result_.isEmpty()) {
|
||||||
content_ = content;
|
result_ = content_;
|
||||||
} else {
|
} else {
|
||||||
content_.append(offset, end - offset);
|
result_.append(offset, end - offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -33,16 +33,17 @@ namespace common {
|
||||||
class CleanFile {
|
class CleanFile {
|
||||||
public:
|
public:
|
||||||
explicit CleanFile(const QString &filepath);
|
explicit CleanFile(const QString &filepath);
|
||||||
|
explicit CleanFile(const QByteArray &content, const QString &filepath = QString());
|
||||||
CleanFile(const CleanFile &other) = delete;
|
CleanFile(const CleanFile &other) = delete;
|
||||||
CleanFile &operator=(const CleanFile &other) = delete;
|
CleanFile &operator=(const CleanFile &other) = delete;
|
||||||
|
|
||||||
bool read();
|
bool read();
|
||||||
|
|
||||||
const char *data() const {
|
const char *data() const {
|
||||||
return content_.constData();
|
return result_.constData();
|
||||||
}
|
}
|
||||||
const char *end() const {
|
const char *end() const {
|
||||||
return content_.constEnd();
|
return result_.constEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr int MaxSize = 10 * 1024 * 1024;
|
static constexpr int MaxSize = 10 * 1024 * 1024;
|
||||||
|
@ -52,8 +53,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString filepath_;
|
QString filepath_;
|
||||||
|
QByteArray content_, result_;
|
||||||
QByteArray content_;
|
bool read_;
|
||||||
//struct Comment {
|
//struct Comment {
|
||||||
// int offset;
|
// int offset;
|
||||||
// QByteArray content;
|
// QByteArray content;
|
||||||
|
|
|
@ -30,7 +30,9 @@ namespace common {
|
||||||
// Wrapper allows you to read forward the CleanFile without overflow checks.
|
// Wrapper allows you to read forward the CleanFile without overflow checks.
|
||||||
class CleanFileReader {
|
class CleanFileReader {
|
||||||
public:
|
public:
|
||||||
CleanFileReader(const QString &filepath) : file_(filepath) {
|
explicit CleanFileReader(const QString &filepath) : file_(filepath) {
|
||||||
|
}
|
||||||
|
explicit CleanFileReader(const QByteArray &content, const QString &filepath = QString()) : file_(content, filepath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool read() {
|
bool read() {
|
||||||
|
@ -57,6 +59,9 @@ public:
|
||||||
const char *currentPtr() const {
|
const char *currentPtr() const {
|
||||||
return pos_;
|
return pos_;
|
||||||
}
|
}
|
||||||
|
int charsLeft() const {
|
||||||
|
return (end_ - pos_);
|
||||||
|
}
|
||||||
|
|
||||||
// Log error to std::cerr with 'code' at line number 'line' in data().
|
// Log error to std::cerr with 'code' at line number 'line' in data().
|
||||||
LogStream logError(int code, int line) const {
|
LogStream logError(int code, int line) const {
|
||||||
|
|
|
@ -47,6 +47,62 @@ bool Generator::writeHeader() {
|
||||||
bool Generator::writeSource() {
|
bool Generator::writeSource() {
|
||||||
source_ = std::make_unique<common::CppFile>(basePath_ + ".cpp", project_);
|
source_ = std::make_unique<common::CppFile>(basePath_ + ".cpp", project_);
|
||||||
|
|
||||||
|
source_->stream() << "\
|
||||||
|
QVector<int> phoneNumberParse(const QString &number) {\n\
|
||||||
|
QVector<int> result;\n\
|
||||||
|
\n\
|
||||||
|
int32 len = number.size();\n\
|
||||||
|
if (len > 0) switch (number.at(0).unicode()) {\n";
|
||||||
|
|
||||||
|
QString already;
|
||||||
|
for (auto i = rules_.data.cend(), e = rules_.data.cbegin(); i != e;) {
|
||||||
|
--i;
|
||||||
|
QString k = i.key();
|
||||||
|
bool onlyLastChanged = true;
|
||||||
|
while (!already.isEmpty() && (already.size() > k.size() || !already.endsWith(k.at(already.size() - 1)))) {
|
||||||
|
if (!onlyLastChanged) {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "}\n";
|
||||||
|
source_->stream() << QString("\t").repeated(already.size()) << "break;\n";
|
||||||
|
}
|
||||||
|
already = already.mid(0, already.size() - 1);
|
||||||
|
onlyLastChanged = false;
|
||||||
|
}
|
||||||
|
if (already == k) {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "}\n";
|
||||||
|
} else {
|
||||||
|
bool onlyFirstCheck = true;
|
||||||
|
while (already.size() < k.size()) {
|
||||||
|
if (!onlyFirstCheck) source_->stream() << QString("\t").repeated(1 + already.size()) << "if (len > " << already.size() << ") switch (number.at(" << already.size() << ").unicode()) {\n";
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "case '" << k.at(already.size()).toLatin1() << "':\n";
|
||||||
|
already.push_back(k.at(already.size()));
|
||||||
|
onlyFirstCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i.value().isEmpty()) {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "return QVector<int>(1, " << k.size() << ");\n";
|
||||||
|
} else {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "result.reserve(" << (i.value().size() + 1) << ");\n";
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "result.push_back(" << k.size() << ");\n";
|
||||||
|
for (int j = 0, l = i.value().size(); j < l; ++j) {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "result.push_back(" << i.value().at(j) << ");\n";
|
||||||
|
}
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "return result;\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool onlyLastChanged = true;
|
||||||
|
while (!already.isEmpty()) {
|
||||||
|
if (!onlyLastChanged) {
|
||||||
|
source_->stream() << QString("\t").repeated(1 + already.size()) << "}\n";
|
||||||
|
}
|
||||||
|
already = already.mid(0, already.size() - 1);
|
||||||
|
onlyLastChanged = false;
|
||||||
|
}
|
||||||
|
source_->stream() << "\
|
||||||
|
}\n\
|
||||||
|
\n\
|
||||||
|
return result;\n\
|
||||||
|
}\n";
|
||||||
|
|
||||||
return source_->finalize();
|
return source_->finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include <QtCore/QRegularExpression>
|
#include <QtCore/QRegularExpression>
|
||||||
#include "codegen/common/basic_tokenized_file.h"
|
#include "codegen/common/basic_tokenized_file.h"
|
||||||
#include "codegen/common/logging.h"
|
#include "codegen/common/logging.h"
|
||||||
|
#include "codegen/common/clean_file_reader.h"
|
||||||
|
#include "codegen/common/checked_utf8_string.h"
|
||||||
|
|
||||||
using BasicToken = codegen::common::BasicTokenizedFile::Token;
|
using BasicToken = codegen::common::BasicTokenizedFile::Token;
|
||||||
using BasicType = BasicToken::Type;
|
using BasicType = BasicToken::Type;
|
||||||
|
@ -34,21 +36,98 @@ namespace codegen {
|
||||||
namespace numbers {
|
namespace numbers {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
QByteArray replaceStrings(const QString &filepath) {
|
||||||
|
common::CleanFileReader reader(filepath);
|
||||||
|
if (!reader.read()) {
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
common::CheckedUtf8String string(reader.currentPtr(), reader.charsLeft());
|
||||||
|
if (!string.isValid()) {
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList lines = string.toString().split('\n');
|
||||||
|
for (auto &line : lines) {
|
||||||
|
auto match = QRegularExpression("^(\\d+;[A-Z]+;)([^;]+)(;.+)?$").match(line);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
line = match.captured(1) + '"' + match.captured(2) + '"' + match.captured(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lines.join('\n').toUtf8();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ParsedFile::ParsedFile(const Options &options)
|
ParsedFile::ParsedFile(const Options &options)
|
||||||
: file_(options.inputPath)
|
: content_(replaceStrings(options.inputPath))
|
||||||
|
, file_(content_, options.inputPath)
|
||||||
, options_(options) {
|
, options_(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParsedFile::read() {
|
bool ParsedFile::read() {
|
||||||
if (!file_.read()) {
|
if (content_.isEmpty() || !file_.read()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filepath = QFileInfo(options_.inputPath).absoluteFilePath();
|
auto filepath = QFileInfo(options_.inputPath).absoluteFilePath();
|
||||||
do {
|
do {
|
||||||
if (auto startToken = file_.getToken(BasicType::Name)) {
|
if (auto code = file_.getToken(BasicType::Int)) {
|
||||||
|
if (!file_.getToken(BasicType::Semicolon)) {
|
||||||
|
logErrorUnexpectedToken() << "';'";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!file_.getToken(BasicType::Name)) {
|
||||||
|
logErrorUnexpectedToken() << "country code";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!file_.getToken(BasicType::Semicolon)) {
|
||||||
|
logErrorUnexpectedToken() << "';'";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!file_.getToken(BasicType::String)) {
|
||||||
|
logErrorUnexpectedToken() << "country name";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file_.getToken(BasicType::Semicolon)) {
|
||||||
|
if (auto firstPart = file_.getToken(BasicType::Int)) {
|
||||||
|
if (firstPart.original.toByteArray() != code.original.toByteArray()) {
|
||||||
|
file_.putBack();
|
||||||
|
result_.data.insert(code.original.toStringUnchecked(), Rule());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rule rule;
|
||||||
|
while (auto part = file_.getToken(BasicType::Name)) {
|
||||||
|
rule.push_back(part.original.size());
|
||||||
|
}
|
||||||
|
result_.data.insert(code.original.toStringUnchecked(), rule);
|
||||||
|
if (rule.isEmpty()) {
|
||||||
|
logErrorUnexpectedToken() << "bad phone pattern";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file_.getToken(BasicType::Semicolon)) {
|
||||||
|
logErrorUnexpectedToken() << "';'";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!file_.getToken(BasicType::Int)) {
|
||||||
|
logErrorUnexpectedToken() << "country phone len";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
file_.getToken(BasicType::Semicolon);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
logErrorUnexpectedToken() << "country phone pattern";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (file_.getToken(BasicType::Int)) {
|
||||||
|
file_.putBack();
|
||||||
|
result_.data.insert(code.original.toStringUnchecked(), Rule());
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
logErrorUnexpectedToken() << "country phone pattern";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (file_.atEnd()) {
|
if (file_.atEnd()) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -28,10 +28,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
namespace codegen {
|
namespace codegen {
|
||||||
namespace numbers {
|
namespace numbers {
|
||||||
|
|
||||||
struct Rule {
|
using Rule = QVector<int>;
|
||||||
};
|
|
||||||
struct Rules {
|
struct Rules {
|
||||||
QVector<Rule> data;
|
QMap<QString, Rule> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parses an input file to the internal struct.
|
// Parses an input file to the internal struct.
|
||||||
|
@ -63,6 +62,7 @@ private:
|
||||||
return file_.logErrorUnexpectedToken();
|
return file_.logErrorUnexpectedToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray content_;
|
||||||
common::BasicTokenizedFile file_;
|
common::BasicTokenizedFile file_;
|
||||||
Options options_;
|
Options options_;
|
||||||
bool failed_ = false;
|
bool failed_ = false;
|
||||||
|
|
|
@ -1053,11 +1053,6 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="GeneratedFiles\styles\style_basic.cpp" />
|
<ClCompile Include="GeneratedFiles\styles\style_basic.cpp" />
|
||||||
<ClCompile Include="GeneratedFiles\styles\style_basic_types.cpp" />
|
<ClCompile Include="GeneratedFiles\styles\style_basic_types.cpp" />
|
||||||
<ClCompile Include="GeneratedFiles\style_auto.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="SourceFiles\apiwrap.cpp" />
|
<ClCompile Include="SourceFiles\apiwrap.cpp" />
|
||||||
<ClCompile Include="SourceFiles\app.cpp" />
|
<ClCompile Include="SourceFiles\app.cpp" />
|
||||||
<ClCompile Include="SourceFiles\application.cpp" />
|
<ClCompile Include="SourceFiles\application.cpp" />
|
||||||
|
@ -1251,6 +1246,7 @@
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/core/basic_types.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui"</Command>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/core/basic_types.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui"</Command>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
|
<ClInclude Include="GeneratedFiles\numbers.h" />
|
||||||
<ClInclude Include="GeneratedFiles\styles\style_basic.h" />
|
<ClInclude Include="GeneratedFiles\styles\style_basic.h" />
|
||||||
<ClInclude Include="GeneratedFiles\styles\style_basic_types.h" />
|
<ClInclude Include="GeneratedFiles\styles\style_basic_types.h" />
|
||||||
<ClInclude Include="SourceFiles\core\click_handler.h" />
|
<ClInclude Include="SourceFiles\core\click_handler.h" />
|
||||||
|
@ -1583,18 +1579,10 @@
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<CustomBuild Include="Resources\style_classes.txt">
|
|
||||||
<Outputs>.\GeneratedFiles\style_classes.h</Outputs>
|
|
||||||
<Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\Resources\art\\"</Command>
|
|
||||||
</CustomBuild>
|
|
||||||
<CustomBuild Include="Resources\style.txt">
|
|
||||||
<Outputs>.\GeneratedFiles\style_auto.h</Outputs>
|
|
||||||
<Outputs>.\GeneratedFiles\style_auto.cpp</Outputs>
|
|
||||||
<Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\Resources\art\\"</Command>
|
|
||||||
</CustomBuild>
|
|
||||||
<CustomBuild Include="Resources\numbers.txt">
|
<CustomBuild Include="Resources\numbers.txt">
|
||||||
|
<Outputs>.\GeneratedFiles\numbers.h</Outputs>
|
||||||
<Outputs>.\GeneratedFiles\numbers.cpp</Outputs>
|
<Outputs>.\GeneratedFiles\numbers.cpp</Outputs>
|
||||||
<Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\Resources\art\\"</Command>
|
<Command>"$(SolutionDir)$(Platform)\codegen\$(Configuration)\codegen_numbers.exe" "-o.\GeneratedFiles" ".\Resources\numbers.txt"</Command>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<CustomBuild Include="Resources\lang.strings">
|
<CustomBuild Include="Resources\lang.strings">
|
||||||
<Outputs>.\GeneratedFiles\lang_auto.h</Outputs>
|
<Outputs>.\GeneratedFiles\lang_auto.h</Outputs>
|
||||||
|
@ -1616,16 +1604,6 @@
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<ClInclude Include="GeneratedFiles\lang_auto.h" />
|
<ClInclude Include="GeneratedFiles\lang_auto.h" />
|
||||||
<ClInclude Include="GeneratedFiles\style_auto.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="GeneratedFiles\style_classes.h">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
<CustomBuild Include="SourceFiles\apiwrap.h">
|
<CustomBuild Include="SourceFiles\apiwrap.h">
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
|
@ -2229,7 +2207,6 @@
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/playerwidget.h"</Command>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/playerwidget.h"</Command>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
<ClInclude Include="SourceFiles\numbers.h" />
|
|
||||||
<ClInclude Include="SourceFiles\pspecific.h" />
|
<ClInclude Include="SourceFiles\pspecific.h" />
|
||||||
<CustomBuild Include="SourceFiles\pspecific_linux.h">
|
<CustomBuild Include="SourceFiles\pspecific_linux.h">
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
|
|
|
@ -111,9 +111,6 @@
|
||||||
<ClCompile Include="SourceFiles\mainwidget.cpp">
|
<ClCompile Include="SourceFiles\mainwidget.cpp">
|
||||||
<Filter>SourceFiles</Filter>
|
<Filter>SourceFiles</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="GeneratedFiles\style_auto.cpp">
|
|
||||||
<Filter>GeneratedFiles</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="SourceFiles\app.cpp">
|
<ClCompile Include="SourceFiles\app.cpp">
|
||||||
<Filter>SourceFiles</Filter>
|
<Filter>SourceFiles</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -1094,12 +1091,6 @@
|
||||||
<ClInclude Include="SourceFiles\logs.h">
|
<ClInclude Include="SourceFiles\logs.h">
|
||||||
<Filter>SourceFiles</Filter>
|
<Filter>SourceFiles</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="GeneratedFiles\style_auto.h">
|
|
||||||
<Filter>GeneratedFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="GeneratedFiles\style_classes.h">
|
|
||||||
<Filter>GeneratedFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="SourceFiles\countries.h">
|
<ClInclude Include="SourceFiles\countries.h">
|
||||||
<Filter>SourceFiles</Filter>
|
<Filter>SourceFiles</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1127,9 +1118,6 @@
|
||||||
<ClInclude Include="SourceFiles\pspecific_mac_p.h">
|
<ClInclude Include="SourceFiles\pspecific_mac_p.h">
|
||||||
<Filter>SourceFiles</Filter>
|
<Filter>SourceFiles</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="SourceFiles\numbers.h">
|
|
||||||
<Filter>SourceFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="SourceFiles\config.h">
|
<ClInclude Include="SourceFiles\config.h">
|
||||||
<Filter>Version</Filter>
|
<Filter>Version</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1250,6 +1238,9 @@
|
||||||
<ClInclude Include="GeneratedFiles\styles\style_basic_types.h">
|
<ClInclude Include="GeneratedFiles\styles\style_basic_types.h">
|
||||||
<Filter>GeneratedFiles\styles</Filter>
|
<Filter>GeneratedFiles\styles</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="GeneratedFiles\numbers.h">
|
||||||
|
<Filter>GeneratedFiles</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="SourceFiles\application.h">
|
<CustomBuild Include="SourceFiles\application.h">
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>UNICODE;WIN32;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>UNICODE;WIN32;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DebugInformationFormat />
|
<DebugInformationFormat />
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);.\..\..\..\SourceFiles;$(QTDIR)\include\QtCore;.\..\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);.\..\..\..\SourceFiles;$(QTDIR)\include\QtCore;.\..\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
|
Loading…
Reference in New Issue