Merge branch 'styles' into dev

This commit is contained in:
John Preston 2016-04-20 17:24:51 +03:00
commit acec941f02
72 changed files with 9519 additions and 638 deletions

5
.gitignore vendored
View File

@ -33,10 +33,11 @@ ipch/
._*
.qmake.stash
/Mac/
/Telegram/*.xcodeproj/xcuserdata/
/Telegram/*.xcodeproj/project.xcworkspace/
project.xcworkspace
xcuserdata
/Telegram/*.user.*
*.pro.user
/Linux/
/Telegram/Makefile
*.*~

View File

@ -5,13 +5,12 @@ VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Telegram", "Telegram\Telegram.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
ProjectSection(ProjectDependencies) = postProject
{6F483617-7C84-4E7E-91D8-1FF28A4CE3A0} = {6F483617-7C84-4E7E-91D8-1FF28A4CE3A0}
{E4DF8176-4DEF-4859-962F-B497E3E7A323} = {E4DF8176-4DEF-4859-962F-B497E3E7A323}
{E417CAA4-259B-4C99-88E3-805F1300E8EB} = {E417CAA4-259B-4C99-88E3-805F1300E8EB}
{EB7D16AC-EACF-4577-B05A-F28E5F356794} = {EB7D16AC-EACF-4577-B05A-F28E5F356794}
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}
EndProjectSection
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}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Updater", "Telegram\Updater.vcxproj", "{6B4BA3BE-7B15-4B4C-B200-81ABFDEF2C76}"
@ -24,6 +23,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Packer", "Telegram\Packer.v
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codegen_style", "Telegram\build\vc\codegen_style\codegen_style.vcxproj", "{E4DF8176-4DEF-4859-962F-B497E3E7A323}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codegen_numbers", "Telegram\build\vc\codegen_numbers\codegen_numbers.vcxproj", "{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -44,15 +45,6 @@ Global
{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|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|x64.ActiveCfg = Debug|Win32
{EB7D16AC-EACF-4577-B05A-F28E5F356794}.Deploy|Win32.ActiveCfg = Deploy|Win32
@ -94,11 +86,22 @@ Global
{E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|Win32.ActiveCfg = Release|Win32
{E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|Win32.Build.0 = Release|Win32
{E4DF8176-4DEF-4859-962F-B497E3E7A323}.Release|x64.ActiveCfg = Release|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|Win32.ActiveCfg = Debug|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|Win32.Build.0 = Debug|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Debug|x64.ActiveCfg = Debug|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|Win32.ActiveCfg = Debug|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|Win32.Build.0 = Debug|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|x64.ActiveCfg = Release|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Deploy|x64.Build.0 = Release|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|Win32.ActiveCfg = Release|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|Win32.Build.0 = Release|Win32
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E4DF8176-4DEF-4859-962F-B497E3E7A323} = {2F863EAD-33C9-4014-A573-93F085BA9CB1}
{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6} = {2F863EAD-33C9-4014-A573-93F085BA9CB1}
EndGlobalSection
EndGlobal

View File

@ -19,6 +19,8 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
// Legacy styles
using "./basic_types.style";
using "./basic.style";
QVector<int> phoneNumberParse(const QString &number);
//using "overview/overview.style";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,413 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
textStyle {
linkFlags: font;
linkFlagsOver: font;
linkFg: color;
linkFgDown: color;
monoFg: color;
selectBg: color;
selectOverlay: color;
lineHeight: pixels;
}
linkButton {
color: color;
overColor: color;
downColor: color;
font: font;
overFont: font;
}
sysButton {
size: size;
img: sprite;
color: color;
overColor: color;
duration: int;
}
flatButton {
color: color;
overColor: color;
downColor: color;
bgColor: color;
overBgColor: color;
downBgColor: color;
width: pixels;
height: pixels;
textTop: pixels;
overTextTop: pixels;
downTextTop: pixels;
font: font;
overFont: font;
duration: int;
cursor: cursor;
}
iconedButton {
icon: sprite;
iconPos: point;
downIcon: sprite;
downIconPos: point;
color: color;
bgColor: color;
overBgColor: color;
width: pixels;
height: pixels;
font: font;
opacity: double;
overOpacity: double;
textPos: point;
downTextPos: point;
duration: int;
cursor: cursor;
}
flatCheckbox {
textColor: color;
bgColor: color;
disColor: color;
width: pixels;
height: pixels;
textTop: pixels;
textLeft: pixels;
font: font;
duration: int;
bgFunc: transition;
cursor: cursor;
disabledCursor: cursor;
imageRect: sprite;
chkImageRect: sprite;
overImageRect: sprite;
chkOverImageRect: sprite;
disImageRect: sprite;
chkDisImageRect: sprite;
imagePos: point;
}
flatInput {
textColor: color;
bgColor: color;
bgActive: color;
width: pixels;
height: pixels;
textMrg: margins;
align: align;
font: font;
cursor: cursor;
imgRect: sprite;
imgPos: point;
borderWidth: pixels;
borderColor: color;
borderActive: color;
borderError: color;
phColor: color;
phFocusColor: color;
phPos: point;
phAlign: align;
phShift: pixels;
phDuration: int;
phLeftFunc: transition;
phAlphaFunc: transition;
phColorFunc: transition;
}
flatTextarea {
textColor: color;
bgColor: color;
width: pixels;
textMrg: margins;
align: align;
font: font;
cursor: cursor;
phColor: color;
phFocusColor: color;
phPos: point;
phAlign: align;
phShift: pixels;
phDuration: int;
phLeftFunc: transition;
phAlphaFunc: transition;
phColorFunc: transition;
}
flatScroll {
barColor: color;
bgColor: color;
barOverColor: color;
bgOverColor: color;
round: pixels;
width: pixels;
minHeight: pixels;
deltax: pixels;
deltat: pixels;
deltab: pixels;
topsh: pixels;
bottomsh: pixels;
shColor: color;
duration: int;
hiding: int;
}
countryInput {
width: pixels;
height: pixels;
top: pixels;
bgColor: color;
ptrSize: size;
textMrg: margins;
font: font;
align: align;
}
slider {
color: color;
thikness: pixels;
width: pixels;
bar: sprite;
}
flatLabel {
font: font;
minWidth: pixels;
width: pixels;
align: align;
}
switcher {
border: pixels;
borderColor: color;
bgColor: color;
bgHovered: color;
bgActive: color;
height: pixels;
font: font;
textColor: color;
activeColor: color;
duration: int;
}
dropdown {
border: pixels;
borderColor: color;
padding: margins;
shadow: sprite;
shadowShift: pixels;
duration: int;
width: pixels;
}
PopupMenu {
skip: pixels;
shadow: sprite;
shadowShift: pixels;
itemBg: color;
itemBgOver: color;
itemFg: color;
itemFgOver: color;
itemFgDisabled: color;
itemFgShortcut: color;
itemFgShortcutOver: color;
itemFgShortcutDisabled: color;
itemPadding: margins;
itemFont: font;
separatorPadding: margins;
separatorWidth: pixels;
separatorFg: color;
arrow: sprite;
duration: int;
widthMin: pixels;
widthMax: pixels;
}
Tooltip {
textBg: color;
textFg: color;
textFont: font;
textBorder: color;
textPadding: margins;
shift: point;
skip: pixels;
widthMax: pixels;
linesMax: int;
}
botKeyboardButton {
margin: pixels;
padding: pixels;
height: pixels;
textTop: pixels;
downTextTop: pixels;
}
BoxButton {
textFg: color;
textFgOver: color;
textBg: color; // rect of textBg with rounded rect of textBgOver upon it
textBgOver: color;
width: pixels;
height: pixels;
textTop: pixels;
font: font;
duration: int;
}
Checkbox {
textFg: color;
textBg: color;
checkFg: color;
checkFgOver: color;
checkFgActive: color;
width: pixels;
height: pixels;
textPosition: point;
diameter: pixels;
thickness: pixels;
checkIcon: sprite;
font: font;
duration: int;
}
Radiobutton {
textFg: color;
textBg: color;
checkFg: color;
checkFgOver: color;
checkFgActive: color;
width: pixels;
height: pixels;
textPosition: point;
diameter: pixels;
thickness: pixels;
checkSkip: pixels;
font: font;
duration: int;
}
InputArea {
textFg: color;
textMargins: margins;
placeholderFg: color;
placeholderFgActive: color;
placeholderMargins: margins;
placeholderAlign: align;
placeholderShift: pixels;
duration: int;
borderFg: color;
borderFgActive: color;
borderFgError: color;
border: pixels;
borderActive: pixels;
borderError: pixels;
font: font;
width: pixels;
heightMin: pixels;
heightMax: pixels;
}
InputField {
textFg: color;
textMargins: margins;
textAlign: align;
placeholderFg: color;
placeholderFgActive: color;
placeholderMargins: margins;
placeholderAlign: align;
placeholderShift: pixels;
duration: int;
borderFg: color;
borderFgActive: color;
borderFgError: color;
border: pixels;
borderActive: pixels;
borderError: pixels;
font: font;
width: pixels;
height: pixels;
iconSprite: sprite;
iconPosition: point;
}
PeerAvatarButton {
size: pixels;
photoSize: pixels;
}

View File

@ -25,7 +25,6 @@ fsize: 13px;
normalFont: font(fsize);
semiboldFont: font(fsize semibold);
spriteFile: ':/gui/art/sprite.png' / 2:':/gui/art/sprite_125x.png' / 3:':/gui/art/sprite_150x.png' / 4:':/gui/art/sprite_200x.png';
emojiImgSize: 18px; // exceptional value for retina
emojiSize: 18px;
emojiPadding: 0px;
@ -2297,13 +2296,14 @@ overviewFileExtFont: font(18px semibold);
// Mac specific
macAccessory: size(450, 90);
macAccessoryWidth: 450;
macAccessoryHeight: 90;
macEnableFilterAdd: 2;
macEnableFilterTop: 5;
macSelectorTop: 6;
macAlwaysThisAppTop: 4;
macAppHintTop: 8;
macCautionIconSize: size(16, 16);
macCautionIconSize: 16;
btnContext: iconedButton(btnDefIconed) {
bgColor: white;

View File

@ -82,7 +82,7 @@ namespace {
HistoryItem *hoveredItem = 0, *pressedItem = 0, *hoveredLinkItem = 0, *pressedLinkItem = 0, *contextItem = 0, *mousedItem = 0;
QPixmap *sprite = 0, *emoji = 0, *emojiLarge = 0;
QPixmap *emoji = 0, *emojiLarge = 0;
style::font monofont;
struct CornersPixmaps {
@ -1993,14 +1993,6 @@ namespace {
if (family.isEmpty()) family = QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
::monofont = style::font(st::normalFont->f.pixelSize(), 0, family);
}
if (!::sprite) {
if (rtl()) {
::sprite = new QPixmap(QPixmap::fromImage(QImage(st::spriteFile).mirrored(true, false)));
} else {
::sprite = new QPixmap(st::spriteFile);
}
if (cRetina()) ::sprite->setDevicePixelRatio(cRetinaFactor());
}
emojiInit();
if (!::emoji) {
::emoji = new QPixmap(QLatin1String(EName));
@ -2061,8 +2053,6 @@ namespace {
void deinitMedia() {
audioFinish();
delete ::sprite;
::sprite = 0;
delete ::emoji;
::emoji = 0;
delete ::emojiLarge;
@ -2140,7 +2130,7 @@ namespace {
}
const QPixmap &sprite() {
return *::sprite;
return style::spritePixmap();
}
const QPixmap &emoji() {

View File

@ -0,0 +1,298 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/common/basic_tokenized_file.h"
#include "codegen/common/logging.h"
#include "codegen/common/clean_file_reader.h"
#include "codegen/common/checked_utf8_string.h"
using Token = codegen::common::BasicTokenizedFile::Token;
using Type = Token::Type;
namespace codegen {
namespace common {
namespace {
constexpr int kErrorUnterminatedStringLiteral = 201;
constexpr int kErrorIncorrectUtf8String = 202;
constexpr int kErrorIncorrectToken = 203;
constexpr int kErrorUnexpectedToken = 204;
bool isDigitChar(char ch) {
return (ch >= '0') && (ch <= '9');
}
bool isNameChar(char ch) {
return isDigitChar(ch) || ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || (ch == '_');
}
bool isWhitespaceChar(char ch) {
return (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t');
}
Token invalidToken() {
return { Type::Invalid, QString(), ConstUtf8String(nullptr, 0), false };
}
} // namespace
BasicTokenizedFile::BasicTokenizedFile(const QString &filepath) : reader_(filepath) {
}
BasicTokenizedFile::BasicTokenizedFile(const QByteArray &content, const QString &filepath) : reader_(content, filepath) {
}
bool BasicTokenizedFile::putBack() {
if (currentToken_ > 0) {
--currentToken_;
return true;
}
return false;
}
Token BasicTokenizedFile::getAnyToken() {
if (currentToken_ >= tokens_.size()) {
if (readToken() == Type::Invalid) {
return invalidToken();
}
}
return tokens_.at(currentToken_++);
}
Token BasicTokenizedFile::getToken(Type typeCondition) {
if (auto token = getAnyToken()) {
if (token.type == typeCondition) {
return token;
}
putBack();
}
return invalidToken();
}
Type BasicTokenizedFile::readToken() {
auto result = readOneToken(StartWithWhitespace::Allow);
// Try to read double token.
if (result == Type::Int) {
if (readOneToken(StartWithWhitespace::Deny) == Type::Dot) {
// We got int and dot, so it is double already.
result = uniteLastTokens(Type::Double);
// Try to read one more int (after dot).
if (readOneToken(StartWithWhitespace::Deny) == Type::Int) {
result = uniteLastTokens(Type::Double);
}
}
} else if (result == Type::Dot) {
if (readOneToken(StartWithWhitespace::Deny) == Type::Int) {
//We got dot and int, so it is double.
result = uniteLastTokens(Type::Double);
}
}
return result;
}
Type BasicTokenizedFile::readOneToken(StartWithWhitespace condition) {
skipWhitespaces();
if (tokenStartWhitespace_ && condition == StartWithWhitespace::Deny) {
return Type::Invalid;
}
if (reader_.atEnd()) {
return Type::Invalid;
}
auto ch = reader_.currentChar();
if (ch == '"') {
return readString();
} else if (isNameChar(ch)) {
return readNameOrNumber();
}
return readSingleLetter();
}
Type BasicTokenizedFile::saveToken(Type type, const QString &value) {
ConstUtf8String original = { tokenStart_, reader_.currentPtr() };
tokens_.push_back({ type, value, original, tokenStartWhitespace_ });
return type;
}
Type BasicTokenizedFile::uniteLastTokens(Type type) {
auto size = tokens_.size();
if (size < 2) {
return Type::Invalid;
}
auto &token(tokens_[size - 2]);
auto originalFrom = token.original.data();
auto originalTill = tokens_.back().original.end();
token.type = type;
token.original = { originalFrom, originalTill };
token.value += tokens_.back().value;
tokens_.pop_back();
return type;
}
Type BasicTokenizedFile::readNameOrNumber() {
while (!reader_.atEnd()) {
if (!isDigitChar(reader_.currentChar())) {
break;
}
reader_.skipChar();
}
bool onlyDigits = true;
while (!reader_.atEnd()) {
if (!isNameChar(reader_.currentChar())) {
break;
}
onlyDigits = false;
reader_.skipChar();
}
return saveToken(onlyDigits ? Type::Int : Type::Name);
}
Type BasicTokenizedFile::readString() {
reader_.skipChar();
auto offset = reader_.currentPtr();
QByteArray value;
while (!reader_.atEnd()) {
auto ch = reader_.currentChar();
if (ch == '"') {
break;
}
if (ch == '\n') {
reader_.logError(kErrorUnterminatedStringLiteral, lineNumber_) << "unterminated string literal.";
failed_ = true;
return Type::Invalid;
}
if (ch == '\\') {
reader_.skipChar();
ch = reader_.currentChar();
if (reader_.atEnd() || ch == '\n') {
reader_.logError(kErrorUnterminatedStringLiteral, lineNumber_) << "unterminated string literal.";
failed_ = true;
return Type::Invalid;
}
if (reader_.currentPtr() > offset + 1) {
value.append(offset, reader_.currentPtr() - offset - 1);
}
offset = reader_.currentPtr() + 1;
if (ch == 'n') {
value.append('\n');
} else if (ch == 't') {
value.append('\t');
} else if (ch == '"') {
value.append('"');
} else if (ch == '\\') {
value.append('\\');
}
} else {
value.append(ch);
}
reader_.skipChar();
}
if (reader_.atEnd()) {
reader_.logError(kErrorUnterminatedStringLiteral, lineNumber_) << "unterminated string literal.";
failed_ = true;
return Type::Invalid;
}
CheckedUtf8String checked(value);
if (!checked.isValid()) {
reader_.logError(kErrorIncorrectUtf8String, lineNumber_) << "incorrect UTF-8 string literal.";
failed_ = true;
return Type::Invalid;
}
reader_.skipChar();
return saveToken(Type::String, checked.toString());
}
Type BasicTokenizedFile::readSingleLetter() {
auto type = singleLetterTokens_.value(reader_.currentChar(), Type::Invalid);
if (type == Type::Invalid) {
reader_.logError(kErrorIncorrectToken, lineNumber_) << "incorrect token '" << reader_.currentChar() << "'";
return Type::Invalid;
}
reader_.skipChar();
return saveToken(type);
}
void BasicTokenizedFile::skipWhitespaces() {
if (reader_.atEnd()) return;
auto ch = reader_.currentChar();
tokenStartWhitespace_ = isWhitespaceChar(ch);
if (tokenStartWhitespace_) {
do {
if (ch == '\n') {
++lineNumber_;
}
reader_.skipChar();
ch = reader_.currentChar();
} while (!reader_.atEnd() && isWhitespaceChar(ch));
}
tokenStart_ = reader_.currentPtr();
}
LogStream operator<<(LogStream &&stream, BasicTokenizedFile::Token::Type type) {
const char *value = "'invalid'";
switch (type) {
case Type::Invalid: break;
case Type::Int: value = "'int'"; break;
case Type::Double: value = "'double'"; break;
case Type::String: value = "'string'"; break;
case Type::LeftParenthesis: value = "'('"; break;
case Type::RightParenthesis: value = "')'"; break;
case Type::LeftBrace: value = "'{'"; break;
case Type::RightBrace: value = "'}'"; break;
case Type::LeftBracket: value = "'['"; break;
case Type::RightBracket: value = "']'"; break;
case Type::Colon: value = "':'"; break;
case Type::Semicolon: value = "';'"; break;
case Type::Comma: value = "','"; break;
case Type::Dot: value = "'.'"; break;
case Type::Number: value = "'#'"; break;
case Type::Plus: value = "'+'"; break;
case Type::Minus: value = "'-'"; break;
case Type::Equals: value = "'='"; break;
case Type::Name: value = "'identifier'"; break;
}
return std::forward<LogStream>(stream) << value;
}
LogStream BasicTokenizedFile::logError(int code) const {
return reader_.logError(code, lineNumber_);
}
LogStream BasicTokenizedFile::logErrorUnexpectedToken() const {
if (currentToken_ < tokens_.size()) {
auto token = tokens_.at(currentToken_).original.toStdString();
return logError(kErrorUnexpectedToken) << "unexpected token '" << token << "', expected ";
}
return logError(kErrorUnexpectedToken) << "unexpected token, expected ";
}
BasicTokenizedFile::~BasicTokenizedFile() = default;
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,158 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QList>
#include "codegen/common/const_utf8_string.h"
#include "codegen/common/clean_file_reader.h"
namespace codegen {
namespace common {
class LogStream;
// Interface for reading a cleaned from comments file by basic tokens.
class BasicTokenizedFile {
public:
explicit BasicTokenizedFile(const QString &filepath);
explicit BasicTokenizedFile(const QByteArray &content, const QString &filepath = QString());
BasicTokenizedFile(const BasicTokenizedFile &other) = delete;
BasicTokenizedFile &operator=(const BasicTokenizedFile &other) = delete;
struct Token {
// String - utf8 string converted to QString.
enum class Type {
Invalid = 0,
Int,
Double,
String,
LeftParenthesis,
RightParenthesis,
LeftBrace,
RightBrace,
LeftBracket,
RightBracket,
Colon,
Semicolon,
Comma,
Dot,
Number,
Plus,
Minus,
Equals,
Name, // [0-9a-zA-Z_]+ with at least one letter.
};
Type type;
QString value;
ConstUtf8String original;
bool hasLeftWhitespace;
explicit operator bool() const {
return (type != Type::Invalid);
}
};
bool read() {
return reader_.read();
}
bool atEnd() const {
return reader_.atEnd();
}
Token getAnyToken();
Token getToken(Token::Type typeCondition);
bool putBack();
bool failed() const {
return failed_;
}
// Log error to std::cerr with 'code' at the current position in file.
LogStream logError(int code) const;
LogStream logErrorUnexpectedToken() const;
~BasicTokenizedFile();
private:
using Type = Token::Type;
void skipWhitespaces();
// Reads a token, including complex tokens, like double numbers.
Type readToken();
// Read exactly one token, applying condition on the whitespaces.
enum class StartWithWhitespace {
Allow,
Deny,
};
Type readOneToken(StartWithWhitespace condition);
// helpers
Type readNameOrNumber();
Type readString();
Type readSingleLetter();
Type saveToken(Type type, const QString &value = QString());
Type uniteLastTokens(Type type);
CleanFileReader reader_;
QList<Token> tokens_;
int currentToken_ = 0;
int lineNumber_ = 1;
bool failed_ = false;
// Where the last (currently read) token has started.
const char *tokenStart_ = nullptr;
// Did the last (currently read) token start with a whitespace.
bool tokenStartWhitespace_ = false;
const QMap<char, Type> singleLetterTokens_ = {
{ '(', Type::LeftParenthesis },
{ ')', Type::RightParenthesis },
{ '{', Type::LeftBrace },
{ '}', Type::RightBrace },
{ '[', Type::LeftBracket },
{ ']', Type::RightBracket },
{ ':', Type::Colon },
{ ';', Type::Semicolon },
{ ',', Type::Comma },
{ '.', Type::Dot },
{ '#', Type::Number },
{ '+', Type::Plus },
{ '-', Type::Minus },
{ '=', Type::Equals },
};
};
LogStream operator<<(LogStream &&stream, BasicTokenizedFile::Token::Type type);
template <>
LogStream operator<< <BasicTokenizedFile::Token::Type>(LogStream &&stream, BasicTokenizedFile::Token::Type &&value) = delete;
template <>
LogStream operator<< <const BasicTokenizedFile::Token::Type&>(LogStream &&stream, const BasicTokenizedFile::Token::Type &value) = delete;
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,54 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/common/checked_utf8_string.h"
#include <iostream>
#include <QtCore/QTextCodec>
#include "codegen/common/const_utf8_string.h"
namespace codegen {
namespace common {
CheckedUtf8String::CheckedUtf8String(const char *string, int size) {
if (size < 0) {
size = strlen(string);
}
if (!size) { // Valid empty string
return;
}
QTextCodec::ConverterState state;
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
string_ = codec->toUnicode(string, size, &state);
if (state.invalidChars > 0) {
valid_ = false;
}
}
CheckedUtf8String::CheckedUtf8String(const QByteArray &string) : CheckedUtf8String(string.constData(), string.size()) {
}
CheckedUtf8String::CheckedUtf8String(const ConstUtf8String &string) : CheckedUtf8String(string.data(), string.size()) {
}
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,57 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
class QByteArray;
namespace codegen {
namespace common {
class ConstUtf8String;
// Parses a char sequence to a QString using UTF-8 codec.
// You can check for invalid UTF-8 sequence by isValid() method.
class CheckedUtf8String {
public:
CheckedUtf8String(const CheckedUtf8String &other) = default;
CheckedUtf8String &operator=(const CheckedUtf8String &other) = default;
explicit CheckedUtf8String(const char *string, int size = -1);
explicit CheckedUtf8String(const QByteArray &string);
explicit CheckedUtf8String(const ConstUtf8String &string);
bool isValid() const {
return valid_;
}
const QString &toString() const {
return string_;
}
private:
QString string_;
bool valid_ = true;
};
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,169 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/common/clean_file.h"
#include <iostream>
#include <QtCore/QDir>
#include "codegen/common/logging.h"
namespace codegen {
namespace common {
namespace {
constexpr int kErrorFileNotFound = 101;
constexpr int kErrorFileTooLarge = 102;
constexpr int kErrorFileNotOpened = 103;
constexpr int kErrorUnexpectedEndOfFile = 104;
bool readFile(const QString &filepath, QByteArray *outResult) {
QFile f(filepath);
if (!f.exists()) {
logError(kErrorFileNotFound, filepath) << ": error: file does not exist.";
return false;
}
auto limit = CleanFile::MaxSize;
if (f.size() > limit) {
logError(kErrorFileTooLarge, filepath) << "' is too large, size=" << f.size() << " > maxsize=" << limit;
return false;
}
if (!f.open(QIODevice::ReadOnly)) {
logError(kErrorFileNotOpened, filepath) << "' for read.";
return false;
}
*outResult = f.readAll();
return true;
}
} // namespace
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() {
if (read_) {
if (!readFile(filepath_, &content_)) {
return false;
}
}
filepath_ = QFileInfo(filepath_).absoluteFilePath();
enum class InsideComment {
None,
SingleLine,
MultiLine,
};
auto insideComment = InsideComment::None;
bool insideString = false;
const char *begin = content_.cbegin(), *end = content_.cend(), *offset = begin;
auto feedContent = [this, &offset, end](const char *ch) {
if (ch > offset) {
if (result_.isEmpty()) result_.reserve(end - offset - 2);
result_.append(offset, ch - offset);
offset = ch;
}
};
auto feedComment = [this, &offset, end](const char *ch) {
if (ch > offset) {
// comments_.push_back({ content_.size(), QByteArray(offset, ch - offset) });
if (result_.isEmpty()) result_.reserve(end - offset - 2);
result_.append(' ');
offset = ch;
}
};
for (const char *ch = offset; ch != end;) {
char currentChar = *ch;
char nextChar = (ch + 1 == end) ? 0 : *(ch + 1);
if (insideComment == InsideComment::None && currentChar == '"') {
bool escaped = ((ch > begin) && *(ch - 1) == '\\') && ((ch - 1 < begin) || *(ch - 2) != '\\');
if (!escaped) {
insideString = !insideString;
}
}
if (insideString) {
++ch;
continue;
}
if (insideComment == InsideComment::None && currentChar == '/' && nextChar == '/') {
feedContent(ch);
insideComment = InsideComment::SingleLine;
ch += 2;
} else if (insideComment == InsideComment::SingleLine && currentChar == '\r' && nextChar == '\n') {
feedComment(ch);
ch += 2;
insideComment = InsideComment::None;
} else if (insideComment == InsideComment::SingleLine && currentChar == '\n') {
feedComment(ch);
++ch;
insideComment = InsideComment::None;
} else if (insideComment == InsideComment::None && currentChar == '/' && nextChar == '*') {
feedContent(ch);
ch += 2;
insideComment = InsideComment::MultiLine;
} else if (insideComment == InsideComment::MultiLine && currentChar == '*' && nextChar == '/') {
ch += 2;
feedComment(ch);
insideComment = InsideComment::None;
} else if (insideComment == InsideComment::MultiLine && currentChar == '\r' && nextChar == '\n') {
feedComment(ch);
ch += 2;
feedContent(ch);
} else if (insideComment == InsideComment::MultiLine && currentChar == '\n') {
feedComment(ch);
++ch;
feedContent(ch);
} else {
++ch;
}
}
if (insideComment == InsideComment::MultiLine) {
common::logError(kErrorUnexpectedEndOfFile, filepath_);
return false;
}
if (insideComment == InsideComment::None && end > offset) {
if (result_.isEmpty()) {
result_ = content_;
} else {
result_.append(offset, end - offset);
}
}
return true;
}
LogStream CleanFile::logError(int code, int line) const {
return common::logError(code, filepath_, line);
}
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,67 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QByteArray>
#include <QtCore/QVector>
#include "codegen/common/logging.h"
namespace codegen {
namespace common {
// Reads a file removing all C-style comments.
class CleanFile {
public:
explicit CleanFile(const QString &filepath);
explicit CleanFile(const QByteArray &content, const QString &filepath = QString());
CleanFile(const CleanFile &other) = delete;
CleanFile &operator=(const CleanFile &other) = delete;
bool read();
const char *data() const {
return result_.constData();
}
const char *end() const {
return result_.constEnd();
}
static constexpr int MaxSize = 10 * 1024 * 1024;
// Log error to std::cerr with 'code' at line number 'line' in data().
LogStream logError(int code, int line) const;
private:
QString filepath_;
QByteArray content_, result_;
bool read_;
//struct Comment {
// int offset;
// QByteArray content;
//};
//QVector<Comment> comments_;
};
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,80 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include "codegen/common/clean_file.h"
namespace codegen {
namespace common {
// Wrapper allows you to read forward the CleanFile without overflow checks.
class CleanFileReader {
public:
explicit CleanFileReader(const QString &filepath) : file_(filepath) {
}
explicit CleanFileReader(const QByteArray &content, const QString &filepath = QString()) : file_(content, filepath) {
}
bool read() {
if (!file_.read()) {
return false;
}
pos_ = file_.data();
end_ = file_.end();
return true;
}
bool atEnd() const {
return (pos_ == end_);
}
char currentChar() const {
return atEnd() ? 0 : *pos_;
}
bool skipChar() {
if (atEnd()) {
return false;
}
++pos_;
return true;
}
const char *currentPtr() const {
return pos_;
}
int charsLeft() const {
return (end_ - pos_);
}
// Log error to std::cerr with 'code' at line number 'line' in data().
LogStream logError(int code, int line) const {
return std::forward<LogStream>(file_.logError(code, line));
}
private:
CleanFile file_;
const char *pos_ = nullptr;
const char *end_ = nullptr;
};
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,75 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <string>
#include <QtCore/QString>
#include <QtCore/QByteArray>
namespace codegen {
namespace common {
// This is a simple wrapper around (const char*, size).
// Not null-terminated! It does not hold any ownership.
class ConstUtf8String {
public:
explicit ConstUtf8String(const char *string, int size = -1) : string_(string) {
if (size < 0) {
size = strlen(string);
}
size_ = size;
}
ConstUtf8String(const char *string, const char *end) : ConstUtf8String(string, end - string) {
}
QByteArray toByteArray() const {
return QByteArray(string_, size_);
}
std::string toStdString() const {
return std::string(string_, size_);
}
QString toStringUnchecked() const {
return QString::fromUtf8(string_, size_);
}
bool empty() const {
return size_ == 0;
}
const char *data() const {
return string_;
}
int size() const {
return size_;
}
const char *end() const {
return data() + size();
}
ConstUtf8String mid(int pos, int size = -1) {
return ConstUtf8String(string_ + pos, std::max(std::min(size, size_ - pos), 0));
}
private:
const char *string_;
int size_;
};
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,135 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/common/cpp_file.h"
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
namespace codegen {
namespace common {
namespace {
void writeLicense(QTextStream &stream, const ProjectInfo &project) {
stream << "\
/*\n\
WARNING! All changes made in this file will be lost!\n\
Created from '" << project.source << "' by '" << project.name << "'\n\
\n\
This file is part of Telegram Desktop,\n\
the official desktop version of Telegram messaging app, see https://telegram.org\n\
\n\
Telegram Desktop is free software: you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation, either version 3 of the License, or\n\
(at your option) any later version.\n\
\n\
It is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
*/\n";
}
} // namespace
CppFile::CppFile(const QString &path, const ProjectInfo &project)
: stream_(&content_)
, forceReGenerate_(project.forceReGenerate) {
bool cpp = path.toLower().endsWith(".cpp");
QFileInfo info(path);
info.dir().mkpath(".");
filepath_ = info.absoluteFilePath();
writeLicense(stream_, project);
if (cpp) {
if (!project.precompiledHeader.isEmpty()) {
include(project.precompiledHeader);
}
include(info.baseName() + ".h").newline();
} else {
stream() << "#pragma once";
newline().newline();
}
}
CppFile &CppFile::include(const QString &header) {
stream() << "#include \"" << header << "\"";
return newline();
}
CppFile &CppFile::pushNamespace(const QString &name) {
namespaces_.push_back(name);
stream() << "namespace";
if (!name.isEmpty()) {
stream() << ' ' << name;
}
stream() << " {";
return newline();
}
CppFile &CppFile::popNamespace() {
if (namespaces_.isEmpty()) {
return *this;
}
auto name = namespaces_.back();
namespaces_.pop_back();
stream() << "} // namespace";
if (!name.isEmpty()) {
stream() << ' ' << name;
}
return newline();
}
bool CppFile::finalize() {
while (!namespaces_.isEmpty()) {
popNamespace();
}
stream_.flush();
QFile file(filepath_);
if (!forceReGenerate_ && file.open(QIODevice::ReadOnly)) {
if (file.readAll() == content_) {
file.close();
return true;
}
file.close();
}
if (!file.open(QIODevice::WriteOnly)) {
return false;
}
if (file.write(content_) != content_.size()) {
return false;
}
return true;
}
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,70 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QVector>
#include <QtCore/QTextStream>
namespace codegen {
namespace common {
struct ProjectInfo {
QString name;
QString source;
QString precompiledHeader;
bool forceReGenerate;
};
// Creates a file with license header and codegen warning.
class CppFile {
public:
// If "basepath" is empty the folder containing "path" will be chosen.
// File ending with .cpp will be treated as source, otherwise like header.
CppFile(const QString &path, const ProjectInfo &project);
QTextStream &stream() {
return stream_;
}
CppFile &newline() {
stream() << "\n";
return *this;
}
CppFile &include(const QString &header);
// Empty name adds anonymous namespace.
CppFile &pushNamespace(const QString &name = QString());
CppFile &popNamespace();
bool finalize();
private:
QString filepath_;
QByteArray content_;
QTextStream stream_;
QVector<QString> namespaces_;
bool forceReGenerate_;
};
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,47 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/common/logging.h"
#include <iostream>
#include <QtCore/QDir>
namespace codegen {
namespace common {
namespace {
std::string relativeLocalPath(const QString &filepath) {
auto name = QFile::encodeName(QDir().relativeFilePath(filepath));
return name.constData();
}
} // namespace
LogStream logError(int code, const QString &filepath, int line) {
std::cerr << relativeLocalPath(filepath);
if (line > 0) {
std::cerr << '(' << line << ')';
}
std::cerr << ": error " << code << ": ";
return LogStream(std::cerr);
}
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,72 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <iostream>
namespace codegen {
namespace common {
// Wrapper around std::ostream that adds '\n' to the end of the logging line.
class LogStream {
public:
enum NullType {
Null,
};
explicit LogStream(NullType) : final_(false) {
}
explicit LogStream(std::ostream &stream) : stream_(&stream) {
}
LogStream(LogStream &&other) : stream_(other.stream_), final_(other.final_) {
other.final_ = false;
}
std::ostream *stream() const {
return stream_;
}
~LogStream() {
if (final_) {
*stream_ << '\n';
}
}
private:
std::ostream *stream_ = nullptr;
bool final_ = true;
};
template <typename T>
LogStream operator<<(LogStream &&stream, T &&value) {
if (auto ostream = stream.stream()) {
*ostream << std::forward<T>(value);
}
return std::forward<LogStream>(stream);
}
// Outputs file name, line number and error code to std::err. Usage:
// logError(kErrorFileTooLarge, filepath) << "file too large, size=" << size;
LogStream logError(int code, const QString &filepath, int line = 0);
static constexpr int kErrorInternal = 666;
} // namespace common
} // namespace codegen

View File

@ -0,0 +1,110 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/numbers/generator.h"
#include <QtCore/QDir>
#include <QtCore/QSet>
#include <functional>
namespace codegen {
namespace numbers {
namespace {
} // namespace
Generator::Generator(const Rules &rules, const QString &destBasePath, const common::ProjectInfo &project)
: rules_(rules)
, basePath_(destBasePath)
, project_(project) {
}
bool Generator::writeHeader() {
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
header_->stream() << "QVector<int> phoneNumberParse(const QString &number);\n";
return header_->finalize();
}
bool Generator::writeSource() {
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();
}
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,50 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include <QtCore/QSet>
#include "codegen/common/cpp_file.h"
#include "codegen/numbers/parsed_file.h"
namespace codegen {
namespace numbers {
class Generator {
public:
Generator(const Rules &rules, const QString &destBasePath, const common::ProjectInfo &project);
Generator(const Generator &other) = delete;
Generator &operator=(const Generator &other) = delete;
bool writeHeader();
bool writeSource();
private:
const Rules &rules_;
QString basePath_;
const common::ProjectInfo &project_;
std::unique_ptr<common::CppFile> source_, header_;
};
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,36 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include <QtCore/QCoreApplication>
#include "codegen/numbers/options.h"
#include "codegen/numbers/processor.h"
int main(int argc, char *argv[]) {
QCoreApplication app(argc, argv);
auto options = codegen::numbers::parseOptions();
if (options.inputPath.isEmpty()) {
return -1;
}
codegen::numbers::Processor processor(options);
return processor.launch();
}

View File

@ -0,0 +1,74 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/numbers/options.h"
#include <ostream>
#include <QtCore/QCoreApplication>
#include "codegen/common/logging.h"
namespace codegen {
namespace numbers {
namespace {
constexpr int kErrorOutputPathExpected = 902;
constexpr int kErrorInputPathExpected = 903;
constexpr int kErrorSingleInputPathExpected = 904;
} // namespace
using common::logError;
Options parseOptions() {
Options result;
auto args(QCoreApplication::instance()->arguments());
for (int i = 1, count = args.size(); i < count; ++i) { // skip first
const auto &arg(args.at(i));
// Output path
if (arg == "-o") {
if (++i == count) {
logError(kErrorOutputPathExpected, "Command Line") << "output path expected after -o";
return Options();
} else {
result.outputPath = args.at(i);
}
} else if (arg.startsWith("-o")) {
result.outputPath = arg.mid(2);
// Input path
} else {
if (result.inputPath.isEmpty()) {
result.inputPath = arg;
} else {
logError(kErrorSingleInputPathExpected, "Command Line") << "only one input path expected";
return Options();
}
}
}
if (result.inputPath.isEmpty()) {
logError(kErrorInputPathExpected, "Command Line") << "input path expected";
return Options();
}
return result;
}
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,38 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QStringList>
namespace codegen {
namespace numbers {
struct Options {
QString outputPath = ".";
QString inputPath;
};
// Parsing failed if inputPath is empty in the result.
Options parseOptions();
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,145 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/numbers/parsed_file.h"
#include <iostream>
#include <QtCore/QMap>
#include <QtCore/QDir>
#include <QtCore/QRegularExpression>
#include "codegen/common/basic_tokenized_file.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 BasicType = BasicToken::Type;
namespace codegen {
namespace numbers {
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
ParsedFile::ParsedFile(const Options &options)
: content_(replaceStrings(options.inputPath))
, file_(content_, options.inputPath)
, options_(options) {
}
bool ParsedFile::read() {
if (content_.isEmpty() || !file_.read()) {
return false;
}
auto filepath = QFileInfo(options_.inputPath).absoluteFilePath();
do {
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()) {
break;
}
logErrorUnexpectedToken() << "numbers rule";
} while (!failed());
if (failed()) {
result_.data.clear();
}
return !failed();
}
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,74 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <string>
#include "codegen/common/basic_tokenized_file.h"
#include "codegen/numbers/options.h"
namespace codegen {
namespace numbers {
using Rule = QVector<int>;
struct Rules {
QMap<QString, Rule> data;
};
// Parses an input file to the internal struct.
class ParsedFile {
public:
explicit ParsedFile(const Options &options);
ParsedFile(const ParsedFile &other) = delete;
ParsedFile &operator=(const ParsedFile &other) = delete;
bool read();
Rules getResult() {
return result_;
}
private:
bool failed() const {
return failed_ || file_.failed();
}
// Log error to std::cerr with 'code' at the current position in file.
common::LogStream logError(int code) {
failed_ = true;
return file_.logError(code);
}
common::LogStream logErrorUnexpectedToken() {
failed_ = true;
return file_.logErrorUnexpectedToken();
}
QByteArray content_;
common::BasicTokenizedFile file_;
Options options_;
bool failed_ = false;
Rules result_;
};
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,86 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/numbers/processor.h"
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include "codegen/common/cpp_file.h"
#include "codegen/numbers/parsed_file.h"
#include "codegen/numbers/generator.h"
namespace codegen {
namespace numbers {
namespace {
constexpr int kErrorCantWritePath = 851;
} // namespace
Processor::Processor(const Options &options)
: parser_(std::make_unique<ParsedFile>(options))
, options_(options) {
}
int Processor::launch() {
if (!parser_->read()) {
return -1;
}
auto result = parser_->getResult();
if (!write(result)) {
return -1;
}
return 0;
}
bool Processor::write(const Rules &rules) const {
QDir dir(options_.outputPath);
if (!dir.mkpath(".")) {
common::logError(kErrorCantWritePath, "Command Line") << "can not open path for writing: " << dir.absolutePath().toStdString();
return false;
}
QFileInfo srcFile(options_.inputPath);
QString dstFilePath = dir.absolutePath() + "/numbers";
common::ProjectInfo project = {
"codegen_style",
srcFile.fileName(),
"stdafx.h",
false, // forceReGenerate
};
Generator generator(rules, dstFilePath, project);
if (!generator.writeHeader()) {
return false;
}
if (!generator.writeSource()) {
return false;
}
return true;
}
Processor::~Processor() = default;
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,53 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include "codegen/numbers/options.h"
namespace codegen {
namespace numbers {
class ParsedFile;
struct Rules;
// Walks through a file, parses it and generates number formatter.
class Processor {
public:
explicit Processor(const Options &options);
Processor(const Processor &other) = delete;
Processor &operator=(const Processor &other) = delete;
// Returns 0 on success.
int launch();
~Processor();
private:
bool write(const Rules &rules) const;
std::unique_ptr<ParsedFile> parser_;
const Options &options_;
};
} // namespace numbers
} // namespace codegen

View File

@ -0,0 +1,553 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/generator.h"
#include <memory>
#include <functional>
#include <QtCore/QDir>
#include <QtCore/QSet>
#include "codegen/style/parsed_file.h"
using Module = codegen::style::structure::Module;
using Struct = codegen::style::structure::Struct;
using Variable = codegen::style::structure::Variable;
using Tag = codegen::style::structure::TypeTag;
namespace codegen {
namespace style {
namespace {
char hexChar(uchar ch) {
if (ch < 10) {
return '0' + ch;
} else if (ch < 16) {
return 'a' + (ch - 10);
}
return '0';
}
char hexSecondChar(char ch) {
return hexChar((*reinterpret_cast<uchar*>(&ch)) << 4);
}
char hexFirstChar(char ch) {
return hexChar((*reinterpret_cast<uchar*>(&ch)) & 0x0F);
}
QString stringToEncodedString(const std::string &str) {
QString result;
result.reserve(str.size() * 4);
for (uchar ch : str) {
if (ch == '\n') {
result.append("\\n");
} else if (ch == '\t') {
result.append("\\t");
} else if (ch == '"' || ch == '\\') {
result.append('\\').append(ch);
} else if (ch < 32 || ch > 127) {
result.append("\\x").append(hexFirstChar(ch)).append(hexSecondChar(ch));
} else {
result.append(ch);
}
}
return '"' + result + '"';
}
QString pxValueName(int value) {
QString result = "px";
if (value < 0) {
value = -value;
result += 'm';
}
return result + QString::number(value);
}
} // namespace
Generator::Generator(const structure::Module &module, const QString &destBasePath, const common::ProjectInfo &project)
: module_(module)
, basePath_(destBasePath)
, baseName_(QFileInfo(basePath_).baseName())
, project_(project) {
}
bool Generator::writeHeader() {
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
header_->include("ui/style_core.h").newline();
if (!writeHeaderStyleNamespace()) {
return false;
}
if (!writeRefsDeclarations()) {
return false;
}
return header_->finalize();
}
bool Generator::writeSource() {
source_ = std::make_unique<common::CppFile>(basePath_ + ".cpp", project_);
writeIncludesInSource();
if (module_.hasVariables()) {
source_->pushNamespace().newline();
source_->stream() << "\
bool inited = false;\n\
\n\
class Module_" << baseName_ << " : public style::internal::ModuleBase {\n\
public:\n\
Module_" << baseName_ << "() { style::internal::registerModule(this); }\n\
~Module_" << baseName_ << "() { style::internal::unregisterModule(this); }\n\
\n\
void start() override {\n\
style::internal::init_" << baseName_ << "();\n\
}\n\
void stop() override {\n\
}\n\
};\n\
Module_" << baseName_ << " registrator;\n";
if (!writeVariableDefinitions()) {
return false;
}
source_->newline().popNamespace();
source_->newline().pushNamespace("st");
if (!writeRefsDefinition()) {
return false;
}
source_->popNamespace().newline();
source_->newline().pushNamespace("style").pushNamespace("internal").newline();
if (!writeVariableInit()) {
return false;
}
}
return source_->finalize();
}
// Empty result means an error.
QString Generator::typeToString(structure::Type type) const {
switch (type.tag) {
case Tag::Invalid: return QString();
case Tag::Int: return "int";
case Tag::Double: return "double";
case Tag::Pixels: return "int";
case Tag::String: return "QString";
case Tag::Color: return "style::color";
case Tag::Point: return "style::point";
case Tag::Sprite: return "style::sprite";
case Tag::Size: return "style::size";
case Tag::Transition: return "style::transition";
case Tag::Cursor: return "style::cursor";
case Tag::Align: return "style::align";
case Tag::Margins: return "style::margins";
case Tag::Font: return "style::font";
case Tag::Struct: return "style::" + type.name.back();
}
return QString();
}
// Empty result means an error.
QString Generator::typeToDefaultValue(structure::Type type) const {
switch (type.tag) {
case Tag::Invalid: return QString();
case Tag::Int: return "0";
case Tag::Double: return "0.";
case Tag::Pixels: return "0";
case Tag::String: return "QString()";
case Tag::Color: return "{ Qt::Uninitialized }";
case Tag::Point: return "{ 0, 0 }";
case Tag::Sprite: return "{ 0, 0, 0, 0 }";
case Tag::Size: return "{ 0, 0 }";
case Tag::Transition: return "anim::linear";
case Tag::Cursor: return "style::cur_default";
case Tag::Align: return "style::al_topleft";
case Tag::Margins: return "{ 0, 0, 0, 0 }";
case Tag::Font: return "{ Qt::Uninitialized }";
case Tag::Struct: {
if (auto realType = module_.findStruct(type.name)) {
QStringList fields;
for (auto field : realType->fields) {
fields.push_back(typeToDefaultValue(field.type));
}
return "{ " + fields.join(", ") + " }";
}
return QString();
} break;
}
return QString();
}
// Empty result means an error.
QString Generator::valueAssignmentCode(structure::Value value) const {
auto copy = value.copyOf();
if (!copy.isEmpty()) {
return "st::" + copy.back();
}
switch (value.type().tag) {
case Tag::Invalid: return QString();
case Tag::Int: return QString("%1").arg(value.Int());
case Tag::Double: return QString("%1").arg(value.Double());
case Tag::Pixels: return pxValueName(value.Int());
case Tag::String: return QString("qsl(%1)").arg(stringToEncodedString(value.String()));
case Tag::Color: return QString("{ %1, %2, %3, %4 }").arg(value.Color().red).arg(value.Color().green).arg(value.Color().blue).arg(value.Color().alpha);
case Tag::Point: {
auto v(value.Point());
return QString("{ %1, %2 }").arg(pxValueName(v.x)).arg(pxValueName(v.y));
}
case Tag::Sprite: {
auto v(value.Sprite());
return QString("{ %1, %2, %3, %4 }").arg(pxValueName(v.left)).arg(pxValueName(v.top)).arg(pxValueName(v.width)).arg(pxValueName(v.height));
}
case Tag::Size: {
auto v(value.Size());
return QString("{ %1, %2 }").arg(pxValueName(v.width)).arg(pxValueName(v.height));
}
case Tag::Transition: return QString("anim::%1").arg(value.String().c_str());
case Tag::Cursor: return QString("style::cur_%1").arg(value.String().c_str());
case Tag::Align: return QString("style::al_%1").arg(value.String().c_str());
case Tag::Margins: {
auto v(value.Margins());
return QString("{ %1, %2, %3, %4 }").arg(pxValueName(v.left)).arg(pxValueName(v.top)).arg(pxValueName(v.right)).arg(pxValueName(v.bottom));
}
case Tag::Font: {
auto v(value.Font());
QString family = "0";
if (!v.family.empty()) {
auto familyIndex = fontFamilyValues_.value(v.family, -1);
if (familyIndex < 0) {
return QString();
} else {
family = QString("font%1index").arg(familyIndex);
}
}
return QString("{ %1, %2, %3 }").arg(pxValueName(v.size)).arg(v.flags).arg(family);
}
case Tag::Struct: {
if (!value.Fields()) return QString();
QStringList fields;
for (auto field : *value.Fields()) {
fields.push_back(valueAssignmentCode(field.variable.value));
}
return "{ " + fields.join(", ") + " }";
} break;
}
return QString();
}
bool Generator::writeHeaderStyleNamespace() {
if (!module_.hasStructs() && !module_.hasVariables()) {
return true;
}
header_->pushNamespace("style");
if (module_.hasVariables()) {
header_->pushNamespace("internal").newline();
header_->stream() << "void init_" << baseName_ << "();\n\n";
header_->popNamespace();
}
if (module_.hasStructs()) {
header_->newline();
if (!writeStructsDefinitions()) {
return false;
}
}
header_->popNamespace().newline();
return true;
}
bool Generator::writeStructsDefinitions() {
if (!module_.hasStructs()) {
return true;
}
bool result = module_.enumStructs([this](const Struct &value) -> bool {
header_->stream() << "struct " << value.name.back() << " {\n";
for (const auto &field : value.fields) {
auto type = typeToString(field.type);
if (type.isEmpty()) {
return false;
}
header_->stream() << "\t" << type << " " << field.name.back() << ";\n";
}
header_->stream() << "};\n\n";
return true;
});
return result;
}
bool Generator::writeRefsDeclarations() {
if (!module_.hasVariables()) {
return true;
}
header_->pushNamespace("st");
bool result = module_.enumVariables([this](const Variable &value) -> bool {
auto name = value.name.back();
auto type = typeToString(value.value.type());
if (type.isEmpty()) {
return false;
}
header_->stream() << "extern const " << type << " &" << name << ";\n";
return true;
});
header_->popNamespace();
return result;
}
bool Generator::writeIncludesInSource() {
if (!module_.hasIncludes()) {
return true;
}
bool result = module_.enumIncludes([this](const Module &module) -> bool {
source_->include("style_" + QFileInfo(module.filepath()).baseName() + ".h");
return true;
});
source_->newline();
return result;
}
bool Generator::writeVariableDefinitions() {
if (!module_.hasVariables()) {
return true;
}
source_->newline();
bool result = module_.enumVariables([this](const Variable &variable) -> bool {
auto name = variable.name.back();
auto type = typeToString(variable.value.type());
if (type.isEmpty()) {
return false;
}
source_->stream() << type << " _" << name << " = " << typeToDefaultValue(variable.value.type()) << ";\n";
return true;
});
return result;
}
bool Generator::writeRefsDefinition() {
if (!module_.hasVariables()) {
return true;
}
source_->newline();
bool result = module_.enumVariables([this](const Variable &variable) -> bool {
auto name = variable.name.back();
auto type = typeToString(variable.value.type());
if (type.isEmpty()) {
return false;
}
source_->stream() << "const " << type << " &" << name << "(_" << name << ");\n";
return true;
});
return result;
}
bool Generator::writeVariableInit() {
if (!module_.hasVariables()) {
return true;
}
if (!collectUniqueValues()) {
return false;
}
bool hasUniqueValues = (!pxValues_.isEmpty() || !fontFamilyValues_.isEmpty());
if (hasUniqueValues) {
source_->pushNamespace();
if (!writePxValues()) {
return false;
}
if (!writeFontFamilyValues()) {
return false;
}
source_->popNamespace().newline();
}
source_->stream() << "\
void init_" << baseName_ << "() {\n\
if (inited) return;\n\
inited = true;\n\n";
if (module_.hasIncludes()) {
bool writtenAtLeastOne = false;
bool result = module_.enumIncludes([this,&writtenAtLeastOne](const Module &module) -> bool {
if (module.hasVariables()) {
source_->stream() << "\tinit_style_" + QFileInfo(module.filepath()).baseName() + "();\n";
writtenAtLeastOne = true;
}
return true;
});
if (!result) {
return false;
}
if (writtenAtLeastOne) {
source_->newline();
}
}
if (hasUniqueValues) {
if (!pxValues_.isEmpty()) {
source_->stream() << "\tinitPxValues();\n";
}
if (!fontFamilyValues_.isEmpty()) {
source_->stream() << "\tinitFontFamilyValues();\n";
}
source_->newline();
}
bool result = module_.enumVariables([this](const Variable &variable) -> bool {
auto name = variable.name.back();
auto value = valueAssignmentCode(variable.value);
if (value.isEmpty()) {
return false;
}
source_->stream() << "\t_" << name << " = " << value << ";\n";
return true;
});
source_->stream() << "\
}\n\n";
return result;
}
bool Generator::writePxValues() {
if (pxValues_.isEmpty()) {
return true;
}
for (auto i = pxValues_.cbegin(), e = pxValues_.cend(); i != e; ++i) {
source_->stream() << "int " << pxValueName(i.key()) << " = " << i.key() << ";\n";
}
source_->stream() << "\
void initPxValues() {\n\
if (cRetina()) return;\n\
\n\
switch (cScale()) {\n";
for (int i = 1, scalesCount = scales.size(); i < scalesCount; ++i) {
source_->stream() << "\tcase " << scaleNames.at(i) << ":\n";
for (auto it = pxValues_.cbegin(), e = pxValues_.cend(); it != e; ++it) {
auto value = it.key();
int adjusted = structure::data::pxAdjust(value, scales.at(i));
if (adjusted != value) {
source_->stream() << "\t\t" << pxValueName(value) << " = " << adjusted << ";\n";
}
}
source_->stream() << "\tbreak;\n";
}
source_->stream() << "\
}\n\
}\n\n";
return true;
}
bool Generator::writeFontFamilyValues() {
if (fontFamilyValues_.isEmpty()) {
return true;
}
for (auto i = fontFamilyValues_.cbegin(), e = fontFamilyValues_.cend(); i != e; ++i) {
source_->stream() << "int font" << i.value() << "index;\n";
}
source_->stream() << "void initFontFamilyValues() {\n";
for (auto i = fontFamilyValues_.cbegin(), e = fontFamilyValues_.cend(); i != e; ++i) {
auto family = stringToEncodedString(i.key());
source_->stream() << "\tfont" << i.value() << "index = style::internal::registerFontFamily(" << family << ");\n";
}
source_->stream() << "}\n\n";
return true;
}
bool Generator::collectUniqueValues() {
int fontFamilyIndex = 0;
std::function<bool(const Variable&)> collector = [this, &collector, &fontFamilyIndex](const Variable &variable) {
auto value = variable.value;
switch (value.type().tag) {
case Tag::Invalid:
case Tag::Int:
case Tag::Double:
case Tag::String:
case Tag::Color:
case Tag::Transition:
case Tag::Cursor:
case Tag::Align: break;
case Tag::Pixels: pxValues_.insert(value.Int(), true); break;
case Tag::Point: {
auto v(value.Point());
pxValues_.insert(v.x, true);
pxValues_.insert(v.y, true);
} break;
case Tag::Sprite: {
auto v(value.Sprite());
pxValues_.insert(v.left, true);
pxValues_.insert(v.top, true);
pxValues_.insert(v.width, true);
pxValues_.insert(v.height, true);
} break;
case Tag::Size: {
auto v(value.Size());
pxValues_.insert(v.width, true);
pxValues_.insert(v.height, true);
} break;
case Tag::Margins: {
auto v(value.Margins());
pxValues_.insert(v.left, true);
pxValues_.insert(v.top, true);
pxValues_.insert(v.right, true);
pxValues_.insert(v.bottom, true);
} break;
case Tag::Font: {
auto v(value.Font());
pxValues_.insert(v.size, true);
if (!v.family.empty() && !fontFamilyValues_.contains(v.family)) {
fontFamilyValues_.insert(v.family, ++fontFamilyIndex);
}
} break;
case Tag::Struct: {
auto fields = variable.value.Fields();
if (!fields) {
return false;
}
for (auto field : *fields) {
if (!collector(field.variable)) {
return false;
}
}
} break;
}
return true;
};
return module_.enumVariables(collector);
}
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,76 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include <QtCore/QSet>
#include "codegen/common/cpp_file.h"
#include "codegen/style/structure_types.h"
namespace codegen {
namespace style {
namespace structure {
class Module;
} // namespace structure
class Generator {
public:
Generator(const structure::Module &module, const QString &destBasePath, const common::ProjectInfo &project);
Generator(const Generator &other) = delete;
Generator &operator=(const Generator &other) = delete;
bool writeHeader();
bool writeSource();
private:
QString typeToString(structure::Type type) const;
QString typeToDefaultValue(structure::Type type) const;
QString valueAssignmentCode(structure::Value value) const;
bool writeHeaderStyleNamespace();
bool writeStructsDefinitions();
bool writeRefsDeclarations();
bool writeIncludesInSource();
bool writeVariableDefinitions();
bool writeRefsDefinition();
bool writeVariableInit();
bool writePxValues();
bool writeFontFamilyValues();
bool collectUniqueValues();
const structure::Module &module_;
QString basePath_, baseName_;
const common::ProjectInfo &project_;
std::unique_ptr<common::CppFile> source_, header_;
QMap<int, bool> pxValues_;
QMap<std::string, int> fontFamilyValues_;
std::vector<int> scales = { 4, 5, 6, 8 }; // scale / 4 gives our 1.00, 1.25, 1.50, 2.00
std::vector<const char *>scaleNames = { "dbisOne", "dbisOneAndQuarter", "dbisOneAndHalf", "dbisTwo" };
};
} // namespace style
} // namespace codegen

View File

@ -1,3 +1,36 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include <QtCore/QCoreApplication>
#include "codegen/style/options.h"
#include "codegen/style/processor.h"
int main(int argc, char *argv[]) {
return 0;
QCoreApplication app(argc, argv);
auto options = codegen::style::parseOptions();
if (options.inputPath.isEmpty()) {
return -1;
}
codegen::style::Processor processor(options);
return processor.launch();
}

View File

@ -0,0 +1,101 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/module.h"
namespace codegen {
namespace style {
namespace structure {
namespace {
QString fullNameKey(const FullName &name) {
return name.join('.');
}
} // namespace
Module::Module(const QString &fullpath) : fullpath_(fullpath) {
}
void Module::addIncluded(std::unique_ptr<Module> &&value) {
included_.push_back(std::move(value));
}
bool Module::addStruct(const Struct &value) {
if (findStruct(value.name)) {
return false;
}
structsByName_.insert(fullNameKey(value.name), structs_.size());
structs_.push_back(value);
return true;
}
const Struct *Module::findStruct(const FullName &name) const {
if (auto result = findStructInModule(name, *this)) {
return result;
}
for (const auto &module : included_) {
if (auto result = findStructInModule(name, *module)) {
return result;
}
}
return nullptr;
}
bool Module::addVariable(const Variable &value) {
if (findVariable(value.name)) {
return false;
}
variablesByName_.insert(fullNameKey(value.name), variables_.size());
variables_.push_back(value);
return true;
}
const Variable *Module::findVariable(const FullName &name) const {
if (auto result = findVariableInModule(name, *this)) {
return result;
}
for (const auto &module : included_) {
if (auto result = findVariableInModule(name, *module)) {
return result;
}
}
return nullptr;
}
const Struct *Module::findStructInModule(const FullName &name, const Module &module) const {
auto index = module.structsByName_.value(fullNameKey(name), -1);
if (index < 0) {
return nullptr;
}
return &module.structs_.at(index);
}
const Variable *Module::findVariableInModule(const FullName &name, const Module &module) const {
auto index = module.variablesByName_.value(fullNameKey(name), -1);
if (index < 0) {
return nullptr;
}
return &module.variables_.at(index);
}
} // namespace structure
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,112 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <vector>
#include "codegen/style/structure_types.h"
namespace codegen {
namespace style {
namespace structure {
class Module {
public:
explicit Module(const QString &fullpath);
QString filepath() const {
return fullpath_;
}
void addIncluded(std::unique_ptr<Module> &&value);
bool hasIncludes() const {
return !included_.empty();
}
template <typename F>
bool enumIncludes(F functor) const {
for (const auto &module : included_) {
if (!functor(*module)) {
return false;
}
}
return true;
}
// Returns false if there is a struct with such name already.
bool addStruct(const Struct &value);
// Returns nullptr if there is no such struct in result_ or any of included modules.
const Struct *findStruct(const FullName &name) const;
bool hasStructs() const {
return !structs_.isEmpty();
}
template <typename F>
bool enumStructs(F functor) const {
for (const auto &value : structs_) {
if (!functor(value)) {
return false;
}
}
return true;
}
// Returns false if there is a variable with such name already.
bool addVariable(const Variable &value);
// Returns nullptr if there is no such variable in result_ or any of included modules.
const Variable *findVariable(const FullName &name) const;
bool hasVariables() const {
return !variables_.isEmpty();
}
template <typename F>
bool enumVariables(F functor) const {
for (const auto &value : variables_) {
if (!functor(value)) {
return false;
}
}
return true;
}
explicit operator bool() const {
return !fullpath_.isEmpty();
}
private:
QString fullpath_;
std::vector<std::unique_ptr<Module>> included_;
QList<Struct> structs_;
QList<Variable> variables_;
QMap<QString, int> structsByName_;
QMap<QString, int> variablesByName_;
const Struct *findStructInModule(const FullName &name, const Module &module) const;
const Variable *findVariableInModule(const FullName &name, const Module &module) const;
};
} // namespace structure
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,90 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/options.h"
#include <ostream>
#include <QtCore/QCoreApplication>
#include "codegen/common/logging.h"
namespace codegen {
namespace style {
namespace {
constexpr int kErrorIncludePathExpected = 901;
constexpr int kErrorOutputPathExpected = 902;
constexpr int kErrorInputPathExpected = 903;
constexpr int kErrorSingleInputPathExpected = 904;
} // namespace
using common::logError;
Options parseOptions() {
Options result;
auto args(QCoreApplication::instance()->arguments());
for (int i = 1, count = args.size(); i < count; ++i) { // skip first
const auto &arg(args.at(i));
// Rebuild all dependencies
if (arg == "--rebuild") {
result.rebuildDependencies = true;
// Include paths
} else if (arg == "-I") {
if (++i == count) {
logError(kErrorIncludePathExpected, "Command Line") << "include path expected after -I";
return Options();
} else {
result.includePaths.push_back(args.at(i));
}
} else if (arg.startsWith("-I")) {
result.includePaths.push_back(arg.mid(2));
// Output path
} else if (arg == "-o") {
if (++i == count) {
logError(kErrorOutputPathExpected, "Command Line") << "output path expected after -o";
return Options();
} else {
result.outputPath = args.at(i);
}
} else if (arg.startsWith("-o")) {
result.outputPath = arg.mid(2);
// Input path
} else {
if (result.inputPath.isEmpty()) {
result.inputPath = arg;
} else {
logError(kErrorSingleInputPathExpected, "Command Line") << "only one input path expected";
return Options();
}
}
}
if (result.inputPath.isEmpty()) {
logError(kErrorInputPathExpected, "Command Line") << "input path expected";
return Options();
}
return result;
}
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,40 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QStringList>
namespace codegen {
namespace style {
struct Options {
QStringList includePaths = { "." };
QString outputPath = ".";
QString inputPath;
bool rebuildDependencies = false;
};
// Parsing failed if inputPath is empty in the result.
Options parseOptions();
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,763 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/parsed_file.h"
#include <iostream>
#include <QtCore/QMap>
#include <QtCore/QDir>
#include <QtCore/QRegularExpression>
#include "codegen/common/basic_tokenized_file.h"
#include "codegen/common/logging.h"
using BasicToken = codegen::common::BasicTokenizedFile::Token;
using BasicType = BasicToken::Type;
namespace codegen {
namespace style {
using structure::logFullName;
namespace {
constexpr int kErrorInIncluded = 801;
constexpr int kErrorTypeMismatch = 802;
constexpr int kErrorUnknownField = 803;
constexpr int kErrorIdentifierNotFound = 804;
constexpr int kErrorAlreadyDefined = 805;
constexpr int kErrorBadString = 806;
QString findInputFile(const Options &options) {
for (const auto &dir : options.includePaths) {
QString tryPath = QDir(dir).absolutePath() + '/' + options.inputPath;
if (QFileInfo(tryPath).exists()) {
return tryPath;
}
}
return options.inputPath;
}
QString tokenValue(const BasicToken &token) {
if (token.type == BasicType::String) {
return token.value;
}
return token.original.toStringUnchecked();
}
bool isValidColor(const QString &str) {
auto len = str.size();
if (len != 3 && len != 4 && len != 6 && len != 8) {
return false;
}
for (auto ch : str) {
auto code = ch.unicode();
if ((code < '0' || code > '9') && (code < 'a' || code > 'f')) {
return false;
}
}
return true;
}
uchar readHexUchar(QChar ch) {
auto code = ch.unicode();
return (code >= '0' && code <= '9') ? ((code - '0') & 0xFF) : ((code + 10 - 'a') & 0xFF);
}
uchar readHexUchar(QChar char1, QChar char2) {
return ((readHexUchar(char1) & 0x0F) << 4) | (readHexUchar(char2) & 0x0F);
}
structure::data::color convertWebColor(const QString &str) {
uchar r = 0, g = 0, b = 0, a = 255;
if (isValidColor(str)) {
auto len = str.size();
if (len == 3 || len == 4) {
r = readHexUchar(str.at(0), str.at(0));
g = readHexUchar(str.at(1), str.at(1));
b = readHexUchar(str.at(2), str.at(2));
if (len == 4) a = readHexUchar(str.at(3), str.at(3));
} else {
r = readHexUchar(str.at(0), str.at(1));
g = readHexUchar(str.at(2), str.at(3));
b = readHexUchar(str.at(4), str.at(5));
if (len == 8) a = readHexUchar(str.at(6), str.at(7));
}
}
return { r, g, b, a };
}
structure::data::color convertIntColor(int r, int g, int b, int a) {
return { uchar(r & 0xFF), uchar(g & 0xFF), uchar(b & 0xFF), uchar(a & 0xFF) };
}
std::string logType(const structure::Type &type) {
if (type.tag == structure::TypeTag::Struct) {
return "struct " + logFullName(type.name);
}
static auto builtInTypes = new QMap<structure::TypeTag, std::string> {
{ structure::TypeTag::Int , "int" },
{ structure::TypeTag::Double , "double" },
{ structure::TypeTag::Pixels , "pixels" },
{ structure::TypeTag::String , "string" },
{ structure::TypeTag::Color , "color" },
{ structure::TypeTag::Point , "point" },
{ structure::TypeTag::Sprite , "sprite" },
{ structure::TypeTag::Size , "size" },
{ structure::TypeTag::Transition, "transition" },
{ structure::TypeTag::Cursor , "cursor" },
{ structure::TypeTag::Align , "align" },
{ structure::TypeTag::Margins , "margins" },
{ structure::TypeTag::Font , "font" },
};
return builtInTypes->value(type.tag, "invalid");
}
bool validateAnsiString(const QString &value) {
for (auto ch : value) {
if (ch.unicode() > 127) {
return false;
}
}
return true;
}
bool validateTransitionString(const QString &value) {
return QRegularExpression("^[a-zA-Z_]+$").match(value).hasMatch();
}
bool validateCursorString(const QString &value) {
return QRegularExpression("^[a-z_]+$").match(value).hasMatch();
}
bool validateAlignString(const QString &value) {
return QRegularExpression("^[a-z_]+$").match(value).hasMatch();
}
} // namespace
ParsedFile::ParsedFile(const Options &options)
: filePath_(findInputFile(options))
, file_(filePath_)
, options_(options) {
}
bool ParsedFile::read() {
if (!file_.read()) {
return false;
}
auto absolutePath = QFileInfo(filePath_).absoluteFilePath();
module_ = std::make_unique<structure::Module>(absolutePath);
do {
if (auto startToken = file_.getToken(BasicType::Name)) {
if (tokenValue(startToken) == "using") {
if (auto includedResult = readIncluded()) {
module_->addIncluded(std::move(includedResult));
continue;
}
} else if (auto braceOpen = file_.getToken(BasicType::LeftBrace)) {
if (auto structResult = readStruct(tokenValue(startToken))) {
if (module_->addStruct(structResult)) {
continue;
}
logError(kErrorAlreadyDefined) << "struct '" << logFullName(structResult.name) << "' already defined";
break;
}
} else if (auto colonToken = file_.getToken(BasicType::Colon)) {
if (auto variableResult = readVariable(tokenValue(startToken))) {
if (module_->addVariable(variableResult)) {
continue;
}
logError(kErrorAlreadyDefined) << "variable '" << logFullName(variableResult.name) << "' already defined";
break;
}
}
}
if (file_.atEnd()) {
break;
}
logErrorUnexpectedToken() << "using keyword, or struct definition, or variable definition";
} while (!failed());
if (failed()) {
module_ = nullptr;
}
return !failed();
}
common::LogStream ParsedFile::logErrorTypeMismatch() {
return logError(kErrorTypeMismatch) << "type mismatch: ";
}
ParsedFile::ModulePtr ParsedFile::readIncluded() {
if (auto usingFile = assertNextToken(BasicType::String)) {
if (assertNextToken(BasicType::Semicolon)) {
ParsedFile included(includedOptions(tokenValue(usingFile)));
if (included.read()) {
return included.getResult();
} else {
logError(kErrorInIncluded) << "error while parsing '" << tokenValue(usingFile).toStdString() << "'";
}
}
}
return nullptr;
}
structure::Struct ParsedFile::readStruct(const QString &name) {
structure::Struct result = { composeFullName(name) };
do {
if (auto fieldName = file_.getToken(BasicType::Name)) {
if (auto field = readStructField(tokenValue(fieldName))) {
result.fields.push_back(field);
}
} else if (assertNextToken(BasicType::RightBrace)) {
if (result.fields.isEmpty()) {
logErrorUnexpectedToken() << "at least one field in struct";
}
break;
}
} while (!failed());
return result;
}
structure::Variable ParsedFile::readVariable(const QString &name) {
structure::Variable result = { composeFullName(name) };
if (auto value = readValue()) {
result.value = value;
if (value.type().tag != structure::TypeTag::Struct) {
assertNextToken(BasicType::Semicolon);
}
}
return result;
}
structure::StructField ParsedFile::readStructField(const QString &name) {
structure::StructField result = { composeFullName(name) };
if (auto colonToken = assertNextToken(BasicType::Colon)) {
if (auto type = readType()) {
result.type = type;
assertNextToken(BasicType::Semicolon);
}
}
return result;
}
structure::Type ParsedFile::readType() {
structure::Type result;
if (auto nameToken = assertNextToken(BasicType::Name)) {
auto name = tokenValue(nameToken);
if (auto builtInType = typeNames_.value(name.toStdString())) {
result = builtInType;
} else {
auto fullName = composeFullName(name);
if (module_->findStruct(fullName)) {
result.tag = structure::TypeTag::Struct;
result.name = fullName;
} else {
logError(kErrorIdentifierNotFound) << "type name '" << logFullName(fullName) << "' not found";
}
}
}
return result;
}
structure::Value ParsedFile::readValue() {
if (auto colorValue = readColorValue()) {
return colorValue;
} else if (auto pointValue = readPointValue()) {
return pointValue;
} else if (auto spriteValue = readSpriteValue()) {
return spriteValue;
} else if (auto sizeValue = readSizeValue()) {
return sizeValue;
} else if (auto transitionValue = readTransitionValue()) {
return transitionValue;
} else if (auto cursorValue = readCursorValue()) {
return cursorValue;
} else if (auto alignValue = readAlignValue()) {
return alignValue;
} else if (auto marginsValue = readMarginsValue()) {
return marginsValue;
} else if (auto fontValue = readFontValue()) {
return fontValue;
} else if (auto numericValue = readNumericValue()) {
return numericValue;
} else if (auto stringValue = readStringValue()) {
return stringValue;
} else if (auto structValue = readStructValue()) {
return structValue;
} else if (auto copyValue = readCopyValue()) {
return copyValue;
} else {
logErrorUnexpectedToken() << "variable value";
}
return {};
}
structure::Value ParsedFile::readStructValue() {
if (auto structName = file_.getToken(BasicType::Name)) {
if (auto result = defaultConstructedStruct(composeFullName(tokenValue(structName)))) {
if (file_.getToken(BasicType::LeftParenthesis)) {
if (!readStructParents(result)) {
return {};
}
}
if (assertNextToken(BasicType::LeftBrace)) {
readStructValueInner(result);
}
return result;
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::defaultConstructedStruct(const structure::FullName &structName) {
if (auto pattern = module_->findStruct(structName)) {
QList<structure::data::field> fields;
fields.reserve(pattern->fields.size());
for (const auto &fieldType : pattern->fields) {
fields.push_back({
{ // variable
fieldType.name,
{ fieldType.type, Qt::Uninitialized }, // value
},
structure::data::field::Status::Uninitialized, // status
});
}
return { structName, fields };
}
return {};
}
void ParsedFile::applyStructParent(structure::Value &result, const structure::FullName &parentName) {
if (auto parent = module_->findVariable(parentName)) {
if (parent->value.type() != result.type()) {
logErrorTypeMismatch() << "parent '" << logFullName(parentName) << "' has type '" << logType(parent->value.type()) << "' while child value has type " << logType(result.type());
return;
}
const auto *srcFields(parent->value.Fields());
auto *dstFields(result.Fields());
if (!srcFields || !dstFields) {
logAssert(false) << "struct data check failed";
return;
}
logAssert(srcFields->size() == dstFields->size()) << "struct size check failed";
for (int i = 0, s = srcFields->size(); i != s; ++i) {
const auto &srcField(srcFields->at(i));
auto &dstField((*dstFields)[i]);
using Status = structure::data::field::Status;
if (srcField.status == Status::Explicit ||
dstField.status == Status::Uninitialized) {
const auto &srcValue(srcField.variable.value);
auto &dstValue(dstField.variable.value);
logAssert(srcValue.type() == dstValue.type()) << "struct field type check failed";
dstValue = srcValue;
dstField.status = Status::Implicit;
}
}
} else {
logError(kErrorIdentifierNotFound) << "parent '" << logFullName(parentName) << "' not found";
}
}
bool ParsedFile::readStructValueInner(structure::Value &result) {
do {
if (auto fieldName = file_.getToken(BasicType::Name)) {
if (!assertNextToken(BasicType::Colon)) {
return false;
}
if (auto field = readVariable(tokenValue(fieldName))) {
if (!assignStructField(result, field)) {
return false;
}
}
} else if (assertNextToken(BasicType::RightBrace)) {
return true;
}
} while (!failed());
return false;
}
bool ParsedFile::assignStructField(structure::Value &result, const structure::Variable &field) {
auto *fields = result.Fields();
if (!fields) {
logAssert(false) << "struct data check failed";
return false;
}
for (auto &already : *fields) {
if (already.variable.name == field.name) {
if (already.variable.value.type() == field.value.type()) {
already.variable.value = field.value;
already.status = structure::data::field::Status::Explicit;
return true;
} else {
logErrorTypeMismatch() << "field '" << logFullName(already.variable.name) << "' has type '" << logType(already.variable.value.type()) << "' while value has type '" << logType(field.value.type()) << "'";
return false;
}
}
}
logError(kErrorUnknownField) << "field '" << logFullName(field.name) << "' was not found in struct of type '" << logType(result.type()) << "'";
return false;
}
bool ParsedFile::readStructParents(structure::Value &result) {
do {
if (auto parentName = assertNextToken(BasicType::Name)) {
applyStructParent(result, composeFullName(tokenValue(parentName)));
if (file_.getToken(BasicType::RightParenthesis)) {
return true;
} else {
assertNextToken(BasicType::Comma);
}
} else {
logErrorUnexpectedToken() << "struct variable parent";
}
} while (!failed());
return false;
}
structure::Value ParsedFile::readPositiveValue() {
auto numericToken = file_.getAnyToken();
if (numericToken.type == BasicType::Int) {
return { structure::TypeTag::Int, tokenValue(numericToken).toInt() };
} else if (numericToken.type == BasicType::Double) {
return { structure::TypeTag::Double, tokenValue(numericToken).toDouble() };
} else if (numericToken.type == BasicType::Name) {
auto value = tokenValue(numericToken);
auto match = QRegularExpression("^\\d+px$").match(value);
if (match.hasMatch()) {
return { structure::TypeTag::Pixels, value.mid(0, value.size() - 2).toInt() };
}
}
file_.putBack();
return {};
}
structure::Value ParsedFile::readNumericValue() {
if (auto value = readPositiveValue()) {
return value;
} else if (auto minusToken = file_.getToken(BasicType::Minus)) {
if (auto positiveValue = readNumericValue()) {
return { positiveValue.type().tag, -positiveValue.Int() };
}
logErrorUnexpectedToken() << "numeric value";
}
return {};
}
structure::Value ParsedFile::readStringValue() {
if (auto stringToken = file_.getToken(BasicType::String)) {
auto value = tokenValue(stringToken);
if (validateAnsiString(value)) {
return { structure::TypeTag::String, stringToken.value.toStdString() };
}
logError(kErrorBadString) << "unicode symbols are not supported";
}
return {};
}
structure::Value ParsedFile::readColorValue() {
if (auto numberSign = file_.getToken(BasicType::Number)) {
auto color = file_.getAnyToken();
if (color.type == BasicType::Int || color.type == BasicType::Name) {
auto chars = tokenValue(color).toLower();
if (isValidColor(chars)) {
return { convertWebColor(chars) };
}
} else {
logErrorUnexpectedToken() << "color value in #ccc, #ccca, #cccccc or #ccccccaa format";
}
} else if (auto rgbaToken = file_.getToken(BasicType::Name)) {
if (tokenValue(rgbaToken) == "rgba") {
assertNextToken(BasicType::LeftParenthesis);
auto r = readNumericValue(); assertNextToken(BasicType::Comma);
auto g = readNumericValue(); assertNextToken(BasicType::Comma);
auto b = readNumericValue(); assertNextToken(BasicType::Comma);
auto a = readNumericValue();
if (r.type().tag != structure::TypeTag::Int || r.Int() < 0 || r.Int() > 255 ||
g.type().tag != structure::TypeTag::Int || g.Int() < 0 || g.Int() > 255 ||
b.type().tag != structure::TypeTag::Int || b.Int() < 0 || b.Int() > 255 ||
a.type().tag != structure::TypeTag::Int || a.Int() < 0 || a.Int() > 255) {
logErrorTypeMismatch() << "expected four 0-255 values for the rgba color";
}
assertNextToken(BasicType::RightParenthesis);
return { convertIntColor(r.Int(), g.Int(), b.Int(), a.Int()) };
} else if (tokenValue(rgbaToken) == "rgb") {
assertNextToken(BasicType::LeftParenthesis);
auto r = readNumericValue(); assertNextToken(BasicType::Comma);
auto g = readNumericValue(); assertNextToken(BasicType::Comma);
auto b = readNumericValue();
if (r.type().tag != structure::TypeTag::Int || r.Int() < 0 || r.Int() > 255 ||
g.type().tag != structure::TypeTag::Int || g.Int() < 0 || g.Int() > 255 ||
b.type().tag != structure::TypeTag::Int || b.Int() < 0 || b.Int() > 255) {
logErrorTypeMismatch() << "expected three int values for the rgb color";
}
assertNextToken(BasicType::RightParenthesis);
return { convertIntColor(r.Int(), g.Int(), b.Int(), 255) };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readPointValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "point") {
assertNextToken(BasicType::LeftParenthesis);
auto x = readNumericValue(); assertNextToken(BasicType::Comma);
auto y = readNumericValue();
if (x.type().tag != structure::TypeTag::Pixels ||
y.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected two px values for the point";
}
assertNextToken(BasicType::RightParenthesis);
return { structure::data::point { x.Int(), y.Int() } };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readSpriteValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "sprite") {
assertNextToken(BasicType::LeftParenthesis);
auto x = readNumericValue(); assertNextToken(BasicType::Comma);
auto y = readNumericValue(); assertNextToken(BasicType::Comma);
auto w = readNumericValue(); assertNextToken(BasicType::Comma);
auto h = readNumericValue();
if (x.type().tag != structure::TypeTag::Pixels ||
y.type().tag != structure::TypeTag::Pixels ||
w.type().tag != structure::TypeTag::Pixels ||
h.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected four px values for the sprite";
}
assertNextToken(BasicType::RightParenthesis);
return { structure::data::sprite { x.Int(), y.Int(), w.Int(), h.Int() } };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readSizeValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "size") {
assertNextToken(BasicType::LeftParenthesis);
auto w = readNumericValue(); assertNextToken(BasicType::Comma);
auto h = readNumericValue();
if (w.type().tag != structure::TypeTag::Pixels ||
h.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected two px values for the size";
}
assertNextToken(BasicType::RightParenthesis);
return { structure::data::size { w.Int(), h.Int() } };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readTransitionValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "transition") {
assertNextToken(BasicType::LeftParenthesis);
auto transition = tokenValue(assertNextToken(BasicType::Name));
assertNextToken(BasicType::RightParenthesis);
if (validateTransitionString(transition)) {
return { structure::TypeTag::Transition, transition.toStdString() };
} else {
logError(kErrorBadString) << "bad transition value";
}
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readCursorValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "cursor") {
assertNextToken(BasicType::LeftParenthesis);
auto cursor = tokenValue(assertNextToken(BasicType::Name));
assertNextToken(BasicType::RightParenthesis);
if (validateCursorString(cursor)) {
return { structure::TypeTag::Cursor, cursor.toStdString() };
} else {
logError(kErrorBadString) << "bad cursor string";
}
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readAlignValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "align") {
assertNextToken(BasicType::LeftParenthesis);
auto align = tokenValue(assertNextToken(BasicType::Name));
assertNextToken(BasicType::RightParenthesis);
if (validateAlignString(align)) {
return { structure::TypeTag::Align, align.toStdString() };
} else {
logError(kErrorBadString) << "bad align string";
}
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readMarginsValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "margins") {
assertNextToken(BasicType::LeftParenthesis);
auto l = readNumericValue(); assertNextToken(BasicType::Comma);
auto t = readNumericValue(); assertNextToken(BasicType::Comma);
auto r = readNumericValue(); assertNextToken(BasicType::Comma);
auto b = readNumericValue();
if (l.type().tag != structure::TypeTag::Pixels ||
t.type().tag != structure::TypeTag::Pixels ||
r.type().tag != structure::TypeTag::Pixels ||
b.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "expected four px values for the margins";
}
assertNextToken(BasicType::RightParenthesis);
return { structure::data::margins { l.Int(), t.Int(), r.Int(), b.Int() } };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readFontValue() {
if (auto font = file_.getToken(BasicType::Name)) {
if (tokenValue(font) == "font") {
assertNextToken(BasicType::LeftParenthesis);
int flags = 0;
structure::Value family, size;
do {
if (auto formatToken = file_.getToken(BasicType::Name)) {
if (tokenValue(formatToken) == "bold") {
flags |= structure::data::font::Bold;
} else if (tokenValue(formatToken) == "italic") {
flags |= structure::data::font::Italic;
} else if (tokenValue(formatToken) == "underline") {
flags |= structure::data::font::Underline;
} else {
file_.putBack();
}
}
if (auto familyValue = readStringValue()) {
family = familyValue;
} else if (auto sizeValue = readNumericValue()) {
size = sizeValue;
} else if (auto copyValue = readCopyValue()) {
if (copyValue.type().tag == structure::TypeTag::String) {
family = copyValue;
} else if (copyValue.type().tag == structure::TypeTag::Pixels) {
size = copyValue;
} else {
logErrorUnexpectedToken() << "font family, font size or ')'";
}
} else if (file_.getToken(BasicType::RightParenthesis)) {
break;
} else {
logErrorUnexpectedToken() << "font family, font size or ')'";
}
} while (!failed());
if (size.type().tag != structure::TypeTag::Pixels) {
logErrorTypeMismatch() << "px value for the font size expected";
}
return { structure::data::font { family.String(), size.Int(), flags } };
}
file_.putBack();
}
return {};
}
structure::Value ParsedFile::readCopyValue() {
if (auto copyName = file_.getToken(BasicType::Name)) {
structure::FullName name = { tokenValue(copyName) };
if (auto variable = module_->findVariable(name)) {
return variable->value.makeCopy(variable->name);
}
logError(kErrorIdentifierNotFound) << "identifier '" << logFullName(name) << "' not found";
}
return {};
}
BasicToken ParsedFile::assertNextToken(BasicToken::Type type) {
auto result = file_.getToken(type);
if (!result) {
logErrorUnexpectedToken() << type;
}
return result;
}
Options ParsedFile::includedOptions(const QString &filepath) {
auto result = options_;
result.inputPath = filepath;
result.includePaths[0] = QFileInfo(filePath_).dir().absolutePath();
return result;
}
// Compose context-dependent full name.
structure::FullName ParsedFile::composeFullName(const QString &name) {
return { name };
}
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,135 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <string>
#include "codegen/common/basic_tokenized_file.h"
#include "codegen/style/options.h"
#include "codegen/style/module.h"
namespace codegen {
namespace style {
// Parses an input file to the internal struct.
class ParsedFile {
public:
explicit ParsedFile(const Options &options);
ParsedFile(const ParsedFile &other) = delete;
ParsedFile &operator=(const ParsedFile &other) = delete;
bool read();
using ModulePtr = std::unique_ptr<structure::Module>;
ModulePtr getResult() {
return std::move(module_);
}
private:
bool failed() const {
return failed_ || file_.failed();
}
// Log error to std::cerr with 'code' at the current position in file.
common::LogStream logError(int code) {
failed_ = true;
return file_.logError(code);
}
common::LogStream logErrorUnexpectedToken() {
failed_ = true;
return file_.logErrorUnexpectedToken();
}
common::LogStream logErrorTypeMismatch();
common::LogStream logAssert(bool assertion) {
if (!assertion) {
return logError(common::kErrorInternal) << "internal - ";
}
return common::LogStream(common::LogStream::Null);
}
// Helper methods for context-dependent reading.
ModulePtr readIncluded();
structure::Struct readStruct(const QString &name);
structure::Variable readVariable(const QString &name);
structure::StructField readStructField(const QString &name);
structure::Type readType();
structure::Value readValue();
structure::Value readStructValue();
structure::Value defaultConstructedStruct(const structure::FullName &name);
void applyStructParent(structure::Value &result, const structure::FullName &parentName);
bool readStructValueInner(structure::Value &result);
bool assignStructField(structure::Value &result, const structure::Variable &field);
bool readStructParents(structure::Value &result);
// Simple methods for reading value types.
structure::Value readPositiveValue();
structure::Value readNumericValue();
structure::Value readStringValue();
structure::Value readColorValue();
structure::Value readPointValue();
structure::Value readSpriteValue();
structure::Value readSizeValue();
structure::Value readTransitionValue();
structure::Value readCursorValue();
structure::Value readAlignValue();
structure::Value readMarginsValue();
structure::Value readFontValue();
structure::Value readCopyValue();
// Read next token and fire unexpected token error if it is not of "type".
using BasicToken = common::BasicTokenizedFile::Token;
BasicToken assertNextToken(BasicToken::Type type);
// Look through include directories in options_ and find absolute include path.
Options includedOptions(const QString &filepath);
// Compose context-dependent full name.
structure::FullName composeFullName(const QString &name);
QString filePath_;
common::BasicTokenizedFile file_;
Options options_;
bool failed_ = false;
ModulePtr module_;
QMap<std::string, structure::Type> typeNames_ = {
{ "int" , { structure::TypeTag::Int } },
{ "double" , { structure::TypeTag::Double } },
{ "pixels" , { structure::TypeTag::Pixels } },
{ "string" , { structure::TypeTag::String } },
{ "color" , { structure::TypeTag::Color } },
{ "point" , { structure::TypeTag::Point } },
{ "sprite" , { structure::TypeTag::Sprite } },
{ "size" , { structure::TypeTag::Size } },
{ "transition", { structure::TypeTag::Transition } },
{ "cursor" , { structure::TypeTag::Cursor } },
{ "align" , { structure::TypeTag::Align } },
{ "margins" , { structure::TypeTag::Margins } },
{ "font" , { structure::TypeTag::Font } },
};
};
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,103 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/processor.h"
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include "codegen/common/cpp_file.h"
#include "codegen/style/parsed_file.h"
#include "codegen/style/generator.h"
#include "codegen/style/sprite_generator.h"
namespace codegen {
namespace style {
namespace {
constexpr int kErrorCantWritePath = 851;
QString destFileBaseName(const structure::Module &module) {
return "style_" + QFileInfo(module.filepath()).baseName();
}
} // namespace
Processor::Processor(const Options &options)
: parser_(std::make_unique<ParsedFile>(options))
, options_(options) {
}
int Processor::launch() {
if (!parser_->read()) {
return -1;
}
auto module = parser_->getResult();
if (options_.rebuildDependencies) {
bool result = module->enumIncludes([this](const structure::Module &included) -> bool {
return write(included);
});
if (!result) {
return -1;
}
} else if (!write(*module)) {
return -1;
}
return 0;
}
bool Processor::write(const structure::Module &module) const {
QDir dir(options_.outputPath);
if (!dir.mkpath(".")) {
common::logError(kErrorCantWritePath, "Command Line") << "can not open path for writing: " << dir.absolutePath().toStdString();
return false;
}
QFileInfo srcFile(module.filepath());
QString dstFilePath = dir.absolutePath() + '/' + destFileBaseName(module);
common::ProjectInfo project = {
"codegen_style",
srcFile.fileName(),
"stdafx.h",
!options_.rebuildDependencies, // forceReGenerate
};
SpriteGenerator spriteGenerator(module);
if (!spriteGenerator.writeSprites()) {
return false;
}
Generator generator(module, dstFilePath, project);
if (!generator.writeHeader()) {
return false;
}
if (!generator.writeSource()) {
return false;
}
return true;
}
Processor::~Processor() = default;
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,60 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include "codegen/style/options.h"
namespace codegen {
namespace style {
namespace structure {
class Module;
} // namespace structure
class ParsedFile;
// Walks through a file, parses it and parses dependency files if necessary.
// Uses Generator class to produce the final output.
class Processor {
public:
explicit Processor(const Options &options);
Processor(const Processor &other) = delete;
Processor &operator=(const Processor &other) = delete;
// Returns 0 on success.
int launch();
~Processor();
private:
bool write(const structure::Module &module) const;
std::unique_ptr<ParsedFile> parser_;
const Options &options_;
// List of files we need to generate with other instance of Generator.
// It is not empty only if rebuild_ flag is true.
QStringList dependenciesToGenerate_;
};
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,180 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/sprite_generator.h"
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QBuffer>
#include <QtGui/QPainter>
#include <QtGui/QColor>
#include <functional>
#include "codegen/style/parsed_file.h"
using Module = codegen::style::structure::Module;
using Struct = codegen::style::structure::Struct;
using Variable = codegen::style::structure::Variable;
using Tag = codegen::style::structure::TypeTag;
namespace codegen {
namespace style {
using structure::logFullName;
namespace {
constexpr int kErrorFileNotFound = 881;
constexpr int kErrorSpritesIntersect = 882;
constexpr int kErrorCouldNotGenerate = 886;
constexpr int kErrorCouldNotSerialize = 886;
constexpr int kErrorCouldNotOpen = 886;
constexpr int kErrorCouldNotWrite = 886;
} // namespace
SpriteGenerator::SpriteGenerator(const structure::Module &module)
: module_(module)
, basePath_(QFileInfo(module.filepath()).dir().absolutePath()) {
}
bool SpriteGenerator::writeSprites() {
if (!collectSprites()) {
return false;
}
if (sprites_.isEmpty()) {
return true;
}
sprite2x_ = QImage(basePath_ + "/art/sprite_200x.png");
if (sprite2x_.isNull()) {
common::logError(kErrorFileNotFound, "/art/sprite_200x.png") << "sprite file was not found";
return false;
}
std::vector<int> sizes = { 5, 6 };
std::vector<const char *> postfixes = { "125", "150" };
for (int i = 0, l = sizes.size(); i < l; ++i) {
auto sprite = generateSprite(sizes[i]);
QString filepath = basePath_ + "/art/sprite_" + postfixes[i] + "x.png";
if (sprite.isNull()) {
common::logError(kErrorCouldNotGenerate, filepath) << "could not generate sprite file";
return false;
}
QByteArray spriteData;
{
QBuffer spriteBuffer(&spriteData);
if (!sprite.save(&spriteBuffer, "PNG")) {
common::logError(kErrorCouldNotSerialize, filepath) << "could not serialize sprite file";
return false;
}
}
QFile file(filepath);
if (file.open(QIODevice::ReadOnly)) {
if (file.readAll() == spriteData) {
continue;
}
file.close();
}
if (!file.open(QIODevice::WriteOnly)) {
common::logError(kErrorCouldNotOpen, filepath) << "could not open sprite file for write";
return false;
}
if (file.write(spriteData) != spriteData.size()) {
common::logError(kErrorCouldNotWrite, filepath) << "could not write sprite file";
return false;
}
// Touch resource file.
filepath = basePath_ + "/telegram.qrc";
QFile qrc(filepath);
if (qrc.open(QIODevice::ReadOnly)) {
auto qrcContent = qrc.readAll();
qrc.close();
if (!qrc.open(QIODevice::WriteOnly)) {
common::logError(kErrorCouldNotOpen, filepath) << "could not open .qrc file for write";
return false;
}
if (qrc.write(qrcContent) != qrcContent.size()) {
common::logError(kErrorCouldNotWrite, filepath) << "could not write .qrc file";
return false;
}
}
}
return true;
}
bool SpriteGenerator::collectSprites() {
std::function<bool(const Variable&)> collector = [this, &collector](const Variable &variable) {
auto value = variable.value;
if (value.type().tag == Tag::Sprite) {
auto v(value.Sprite());
if (!v.width || !v.height) return true;
QRect vRect(v.left, v.top, v.width, v.height);
bool found = false;
for (auto var : sprites_) {
auto sprite = var.value.Sprite();
QRect spriteRect(sprite.left, sprite.top, sprite.width, sprite.height);
if (spriteRect == vRect) {
found = true;
} else if (spriteRect.intersects(vRect)) {
common::logError(kErrorSpritesIntersect, module_.filepath()) << "sprite '" << logFullName(variable.name) << "' intersects with '" << logFullName(var.name) << "'";
return false;
}
}
if (!found) {
sprites_.push_back(variable);
}
} else if (value.type().tag == Tag::Struct) {
auto fields = variable.value.Fields();
if (!fields) {
return false;
}
for (auto field : *fields) {
if (!collector(field.variable)) {
return false;
}
}
}
return true;
};
return module_.enumVariables(collector);
}
QImage SpriteGenerator::generateSprite(int scale) {
auto convert = [scale](int value) -> int { return structure::data::pxAdjust(value, scale); };
QImage result(convert(sprite2x_.width() / 2), convert(sprite2x_.height() / 2), sprite2x_.format());
{
QPainter p(&result);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, result.width(), result.height(), QColor(0, 0, 0, 0));
for (auto variable : sprites_) {
auto sprite = variable.value.Sprite();
auto copy = sprite2x_.copy(sprite.left * 2, sprite.top * 2, sprite.width * 2, sprite.height * 2);
copy = copy.scaled(convert(sprite.width), convert(sprite.height), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
p.drawImage(convert(sprite.left), convert(sprite.top), copy);
}
}
return result;
}
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,56 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include <QtCore/QSet>
#include <QtGui/QImage>
#include "codegen/style/structure_types.h"
namespace codegen {
namespace style {
namespace structure {
class Module;
} // namespace structure
class SpriteGenerator {
public:
SpriteGenerator(const structure::Module &module);
SpriteGenerator(const SpriteGenerator &other) = delete;
SpriteGenerator &operator=(const SpriteGenerator &other) = delete;
bool writeSprites();
private:
bool collectSprites();
QImage generateSprite(int scale); // scale = 5 for 125% and 6 for 150%.
const structure::Module &module_;
QString basePath_;
QImage sprite2x_;
QList<structure::Variable> sprites_;
};
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,206 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "codegen/style/structure_types.h"
namespace codegen {
namespace style {
namespace structure {
struct Value::DataTypes {
class TInt : public DataBase {
public:
TInt(int value) : value_(value) {
}
int Int() const override { return value_; }
private:
int value_;
};
class TDouble : public DataBase {
public:
TDouble(double value) : value_(value) {
}
double Double() const override { return value_; }
private:
double value_;
};
class TString : public DataBase {
public:
TString(std::string value) : value_(value) {
}
std::string String() const override { return value_; }
private:
std::string value_;
};
class TPoint : public DataBase {
public:
TPoint(data::point value) : value_(value) {
}
data::point Point() const override { return value_; }
private:
data::point value_;
};
class TSprite : public DataBase {
public:
TSprite(data::sprite value) : value_(value) {
}
data::sprite Sprite() const override { return value_; }
private:
data::sprite value_;
};
class TSize : public DataBase {
public:
TSize(data::size value) : value_(value) {
}
data::size Size() const override { return value_; }
private:
data::size value_;
};
class TColor : public DataBase {
public:
TColor(data::color value) : value_(value) {
}
data::color Color() const override { return value_; }
private:
data::color value_;
};
class TMargins : public DataBase {
public:
TMargins(data::margins value) : value_(value) {
}
data::margins Margins() const override { return value_; }
private:
data::margins value_;
};
class TFont : public DataBase {
public:
TFont(data::font value) : value_(value) {
}
data::font Font() const override { return value_; }
private:
data::font value_;
};
class TFields : public DataBase {
public:
TFields(data::fields value) : value_(value) {
}
const data::fields *Fields() const override { return &value_; }
data::fields *Fields() override { return &value_; }
private:
data::fields value_;
};
};
Value::Value() : Value(TypeTag::Invalid, std::make_shared<DataBase>()) {
}
Value::Value(data::point value) : Value(TypeTag::Point, std::make_shared<DataTypes::TPoint>(value)) {
}
Value::Value(data::sprite value) : Value(TypeTag::Sprite, std::make_shared<DataTypes::TSprite>(value)) {
}
Value::Value(data::size value) : Value(TypeTag::Size, std::make_shared<DataTypes::TSize>(value)) {
}
Value::Value(data::color value) : Value(TypeTag::Color, std::make_shared<DataTypes::TColor>(value)) {
}
Value::Value(data::margins value) : Value(TypeTag::Margins, std::make_shared<DataTypes::TMargins>(value)) {
}
Value::Value(data::font value) : Value(TypeTag::Font, std::make_shared<DataTypes::TFont>(value)) {
}
Value::Value(const FullName &type, data::fields value)
: type_ { TypeTag::Struct, type }
, data_(std::make_shared<DataTypes::TFields>(value)) {
}
Value::Value(TypeTag type, double value) : Value(type, std::make_shared<DataTypes::TDouble>(value)) {
if (type_.tag != TypeTag::Double) {
type_.tag = TypeTag::Invalid;
data_ = std::make_shared<DataBase>();
}
}
Value::Value(TypeTag type, int value) : Value(type, std::make_shared<DataTypes::TInt>(value)) {
if (type_.tag != TypeTag::Int && type_.tag != TypeTag::Pixels) {
type_.tag = TypeTag::Invalid;
data_ = std::make_shared<DataBase>();
}
}
Value::Value(TypeTag type, std::string value) : Value(type, std::make_shared<DataTypes::TString>(value)) {
if (type_.tag != TypeTag::String &&
type_.tag != TypeTag::Transition &&
type_.tag != TypeTag::Cursor &&
type_.tag != TypeTag::Align) {
type_.tag = TypeTag::Invalid;
data_ = std::make_shared<DataBase>();
}
}
Value::Value(Type type, Qt::Initialization) : type_(type) {
switch (type_.tag) {
case TypeTag::Invalid: data_ = std::make_shared<DataBase>(); break;
case TypeTag::Int: data_ = std::make_shared<DataTypes::TInt>(0); break;
case TypeTag::Double: data_ = std::make_shared<DataTypes::TDouble>(0.); break;
case TypeTag::Pixels: data_ = std::make_shared<DataTypes::TInt>(0); break;
case TypeTag::String: data_ = std::make_shared<DataTypes::TString>(""); break;
case TypeTag::Color: data_ = std::make_shared<DataTypes::TColor>(data::color { 0, 0, 0, 255 }); break;
case TypeTag::Point: data_ = std::make_shared<DataTypes::TPoint>(data::point { 0, 0 }); break;
case TypeTag::Sprite: data_ = std::make_shared<DataTypes::TSprite>(data::sprite { 0, 0, 0, 0 }); break;
case TypeTag::Size: data_ = std::make_shared<DataTypes::TSize>(data::size { 0, 0 }); break;
case TypeTag::Transition: data_ = std::make_shared<DataTypes::TString>("linear"); break;
case TypeTag::Cursor: data_ = std::make_shared<DataTypes::TString>("default"); break;
case TypeTag::Align: data_ = std::make_shared<DataTypes::TString>("topleft"); break;
case TypeTag::Margins: data_ = std::make_shared<DataTypes::TMargins>(data::margins { 0, 0, 0, 0 }); break;
case TypeTag::Font: data_ = std::make_shared<DataTypes::TFont>(data::font { "", 13, 0 }); break;
case TypeTag::Struct: data_ = std::make_shared<DataTypes::TFields>(data::fields {}); break;
}
}
Value::Value(TypeTag type, std::shared_ptr<DataBase> &&data) : type_ { type }, data_(std::move(data)) {
}
} // namespace structure
} // namespace style
} // namespace codegen

View File

@ -0,0 +1,227 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
#include <memory>
#include <QtCore/QString>
#include <QtCore/QStringList>
namespace codegen {
namespace style {
namespace structure {
// List of names, like overview.document.bg
using FullName = QStringList;
inline std::string logFullName(const FullName &name) {
return name.join('.').toStdString();
}
struct Variable;
enum class TypeTag {
Invalid,
Int,
Double,
Pixels,
String,
Color,
Point,
Sprite,
Size,
Transition,
Cursor,
Align,
Margins,
Font,
Struct,
};
struct Type {
TypeTag tag;
FullName name; // only for type == ClassType::Struct
explicit operator bool() const {
return (tag != TypeTag::Invalid);
}
};
inline bool operator==(const Type &a, const Type &b) {
return (a.tag == b.tag) && (a.name == b.name);
}
inline bool operator!=(const Type &a, const Type &b) {
return !(a == b);
}
namespace data {
inline int pxAdjust(int value, int scale) {
return qRound((value * scale / 4.) + (value > 0 ? -0.01 : 0.01));
}
struct point {
int x, y;
};
struct sprite {
int left, top, width, height;
};
struct size {
int width, height;
};
struct color {
uchar red, green, blue, alpha;
};
struct margins {
int left, top, right, bottom;
};
struct font {
enum Flag {
Bold = 0x01,
Italic = 0x02,
Underline = 0x04,
};
std::string family;
int size;
int flags;
};
struct field; // defined after Variable is defined
using fields = QList<field>;
} // namespace data
class Value {
public:
Value();
Value(data::point value);
Value(data::sprite value);
Value(data::size value);
Value(data::color value);
Value(data::margins value);
Value(data::font value);
Value(const FullName &type, data::fields value);
// Can be only double.
Value(TypeTag type, double value);
// Can be int / pixels.
Value(TypeTag type, int value);
// Can be string / transition / cursor / align.
Value(TypeTag type, std::string value);
// Default constructed value (uninitialized).
Value(Type type, Qt::Initialization);
Type type() const { return type_; }
int Int() const { return data_->Int(); }
double Double() const { return data_->Double(); }
std::string String() const { return data_->String(); }
data::point Point() const { return data_->Point(); }
data::sprite Sprite() const { return data_->Sprite(); };
data::size Size() const { return data_->Size(); };
data::color Color() const { return data_->Color(); };
data::margins Margins() const { return data_->Margins(); };
data::font Font() const { return data_->Font(); };
const data::fields *Fields() const { return data_->Fields(); };
data::fields *Fields() { return data_->Fields(); };
explicit operator bool() const {
return type_.tag != TypeTag::Invalid;
}
Value makeCopy(const FullName &copyOf) const {
Value result(*this);
result.copyOf_ = copyOf;
return result;
}
const FullName &copyOf() const {
return copyOf_;
}
private:
class DataBase {
public:
virtual int Int() const { return 0; }
virtual double Double() const { return 0.; }
virtual std::string String() const { return std::string(); }
virtual data::point Point() const { return {}; };
virtual data::sprite Sprite() const { return {}; };
virtual data::size Size() const { return {}; };
virtual data::color Color() const { return {}; };
virtual data::margins Margins() const { return {}; };
virtual data::font Font() const { return {}; };
virtual const data::fields *Fields() const { return nullptr; };
virtual data::fields *Fields() { return nullptr; };
virtual ~DataBase() {
}
};
struct DataTypes;
Value(TypeTag type, std::shared_ptr<DataBase> &&data);
Type type_;
std::shared_ptr<DataBase> data_;
FullName copyOf_; // for copies of existing named values
};
struct Variable {
FullName name;
Value value;
explicit operator bool() const {
return !name.isEmpty();
}
};
namespace data {
struct field {
enum class Status {
Uninitialized,
Implicit,
Explicit
};
Variable variable;
Status status;
};
} // namespace data
struct StructField {
FullName name;
Type type;
explicit operator bool() const {
return !name.isEmpty();
}
};
struct Struct {
FullName name;
QList<StructField> fields;
explicit operator bool() const {
return !name.isEmpty();
}
};
} // namespace structure
} // namespace style
} // namespace codegen

View File

@ -45,52 +45,22 @@ uint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
// Base types compile-time check
#ifdef TDESKTOP_CUSTOM_NULLPTR
NullPointerClass nullptr;
#endif
namespace {
template <typename T, int N>
class _TypeSizeCheckerHelper {
public:
_TypeSizeCheckerHelper() {
int _BadTypeSize[N ? -1 : 1];
(void)sizeof(_BadTypeSize);
}
};
template <typename T>
class _TypeSizeCheckerHelper<T, 0> {
public:
_TypeSizeCheckerHelper() {
}
};
template <typename T, int N>
class _TypeSizeChecker {
_TypeSizeCheckerHelper<T, N - sizeof(T)> checker;
};
void _typesCheck() {
_TypeSizeChecker<char, 1>();
_TypeSizeChecker<uchar, 1>();
_TypeSizeChecker<int16, 2>();
_TypeSizeChecker<uint16, 2>();
_TypeSizeChecker<int32, 4>();
_TypeSizeChecker<uint32, 4>();
_TypeSizeChecker<int64, 8>();
_TypeSizeChecker<uint64, 8>();
_TypeSizeChecker<float32, 4>();
_TypeSizeChecker<float64, 8>();
_TypeSizeChecker<mtpPrime, 4>();
_TypeSizeChecker<MTPint, 4>();
_TypeSizeChecker<MTPlong, 8>();
_TypeSizeChecker<MTPint128, 16>();
_TypeSizeChecker<MTPint256, 32>();
_TypeSizeChecker<MTPdouble, 8>();
}
}
static_assert(sizeof(char) == 1, "Basic types size check failed");
static_assert(sizeof(uchar) == 1, "Basic types size check failed");
static_assert(sizeof(int16) == 2, "Basic types size check failed");
static_assert(sizeof(uint16) == 2, "Basic types size check failed");
static_assert(sizeof(int32) == 4, "Basic types size check failed");
static_assert(sizeof(uint32) == 4, "Basic types size check failed");
static_assert(sizeof(int64) == 8, "Basic types size check failed");
static_assert(sizeof(uint64) == 8, "Basic types size check failed");
static_assert(sizeof(float32) == 4, "Basic types size check failed");
static_assert(sizeof(float64) == 8, "Basic types size check failed");
static_assert(sizeof(mtpPrime) == 4, "Basic types size check failed");
static_assert(sizeof(MTPint) == 4, "Basic types size check failed");
static_assert(sizeof(MTPlong) == 8, "Basic types size check failed");
static_assert(sizeof(MTPint128) == 16, "Basic types size check failed");
static_assert(sizeof(MTPint256) == 32, "Basic types size check failed");
static_assert(sizeof(MTPdouble) == 8, "Basic types size check failed");
// Unixtime functions

View File

@ -813,8 +813,7 @@ inline QSharedPointer<T> MakeShared(Args&&... args) {
template <typename T>
class NeverFreedPointer {
public:
explicit NeverFreedPointer() {
}
NeverFreedPointer() = default;
NeverFreedPointer(const NeverFreedPointer<T> &other) = delete;
NeverFreedPointer &operator=(const NeverFreedPointer<T> &other) = delete;
@ -861,7 +860,7 @@ public:
}
private:
T *_p = nullptr;
T *_p;
};

View File

@ -2876,7 +2876,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
}
if (rtl()) selx = width() - selx - st::rbEmoji.width;
p.setOpacity(skip ? qMax(1., selx / (skip * st::rbEmoji.width)) : 1.);
p.setOpacity(skip ? qMax(1., selx / float64(skip * st::rbEmoji.width)) : 1.);
p.fillRect(selx, _iconsTop + st::rbEmoji.height - st::stickerIconPadding, st::rbEmoji.width, st::stickerIconSel, st::stickerIconSelColor);
float64 o_left = snap(float64(_iconsX.current()) / st::stickerIconLeft.pxWidth(), 0., 1.);

View File

@ -7401,9 +7401,9 @@ void HistoryMessage::draw(Painter &p, const QRect &r, TextSelection selection, u
}
}
uint64 animms = App::main() ? App::main()->animActiveTimeStart(this) : 0;
if (animms > 0 && animms <= ms) {
animms = ms - animms;
uint64 fullAnimMs = App::main() ? App::main()->animActiveTimeStart(this) : 0;
if (fullAnimMs > 0 && fullAnimMs <= ms) {
int animms = ms - fullAnimMs;
if (animms > st::activeFadeInDuration + st::activeFadeOutDuration) {
App::main()->stopAnimActive();
} else {
@ -8192,9 +8192,9 @@ void HistoryService::draw(Painter &p, const QRect &r, TextSelection selection, u
height -= unreadbarh;
}
uint64 animms = App::main() ? App::main()->animActiveTimeStart(this) : 0;
if (animms > 0 && animms <= ms) {
animms = ms - animms;
uint64 fullAnimMs = App::main() ? App::main()->animActiveTimeStart(this) : 0;
if (fullAnimMs > 0 && fullAnimMs <= ms) {
int animms = ms - fullAnimMs;
if (animms > st::activeFadeInDuration + st::activeFadeOutDuration) {
App::main()->stopAnimActive();
} else {

View File

@ -29,34 +29,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace InlineBots {
namespace {
using ResultsByLoaderMap = QMap<FileLoader*, Result*>;
NeverFreedPointer<ResultsByLoaderMap> ResultsByLoader;
void regLoader(FileLoader *loader, Result *result) {
ResultsByLoader.createIfNull([]() -> ResultsByLoaderMap* {
return new ResultsByLoaderMap();
});
ResultsByLoader->insert(loader, result);
}
void unregLoader(FileLoader *loader) {
if (!ResultsByLoader) {
return;
}
ResultsByLoader->remove(loader);
}
} // namespace
Result *getResultFromLoader(FileLoader *loader) {
if (!ResultsByLoader) {
return nullptr;
}
return ResultsByLoader->value(loader, nullptr);
}
Result::Result(const Creator &creator) : _queryId(creator.queryId), _type(creator.type) {
}

View File

@ -43,7 +43,7 @@ private:
public:
// Constructor is public only for std::make_unique<>() to work.
// Constructor is public only for std_::make_unique<>() to work.
// You should use create() static method instead.
explicit Result(const Creator &creator);
static std_::unique_ptr<Result> create(uint64 queryId, const MTPBotInlineResult &mtpData);
@ -120,6 +120,5 @@ private:
std_::unique_ptr<internal::SendData> sendData;
};
Result *getResultFromLoader(FileLoader *loader);
} // namespace InlineBots

View File

@ -48,27 +48,6 @@ namespace {
return result;
}
FileKey fromFilePart(const QString &val) {
FileKey result = 0;
int32 i = val.size();
if (i != 0x10) return 0;
while (i > 0) {
--i;
result <<= 4;
uint16 ch = val.at(i).unicode();
if (ch >= 'A' && ch <= 'F') {
result |= (ch - 'A') + 0x0A;
} else if (ch >= '0' && ch <= '9') {
result |= (ch - '0');
} else {
return 0;
}
}
return result;
}
QString _basePath, _userBasePath;
bool _started = false;
@ -325,45 +304,6 @@ namespace {
}
};
bool fileExists(const QString &name, int options = UserPath | SafePath) {
if (options & UserPath) {
if (!_userWorking()) return false;
} else {
if (!_working()) return false;
}
// detect order of read attempts
QString toTry[2];
toTry[0] = ((options & UserPath) ? _userBasePath : _basePath) + name + '0';
if (options & SafePath) {
QFileInfo toTry0(toTry[0]);
if (toTry0.exists()) {
toTry[1] = ((options & UserPath) ? _userBasePath : _basePath) + name + '1';
QFileInfo toTry1(toTry[1]);
if (toTry1.exists()) {
QDateTime mod0 = toTry0.lastModified(), mod1 = toTry1.lastModified();
if (mod0 < mod1) {
qSwap(toTry[0], toTry[1]);
}
} else {
toTry[1] = QString();
}
} else {
toTry[0][toTry[0].size() - 1] = '1';
}
}
for (int32 i = 0; i < 2; ++i) {
QString fname(toTry[i]);
if (fname.isEmpty()) break;
if (QFileInfo(fname).exists()) return true;
}
return false;
}
bool fileExists(const FileKey &fkey, int options = UserPath | SafePath) {
return fileExists(toFilePart(fkey), options);
}
bool readFile(FileReadDescriptor &result, const QString &name, int options = UserPath | SafePath) {
if (options & UserPath) {
if (!_userWorking()) return false;

View File

@ -794,7 +794,7 @@ void objc_openFile(const QString &f, bool openwith) {
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
NSRect fullRect = { { 0., 0. }, { st::macAccessory.width() * 1., st::macAccessory.height() * 1. } };
NSRect fullRect = { { 0., 0. }, { st::macAccessoryWidth, st::macAccessoryHeight } };
NSView *accessory = [[NSView alloc] initWithFrame:fullRect];
[accessory setAutoresizesSubviews:YES];
@ -861,7 +861,7 @@ void objc_openFile(const QString &f, bool openwith) {
NSImageView *badIcon = [[NSImageView alloc] init];
NSImage *badImage = [NSImage imageNamed:NSImageNameCaution];
[badIcon setImage:badImage];
[badIcon setFrame:NSMakeRect(0, 0, st::macCautionIconSize.width(), st::macCautionIconSize.height())];
[badIcon setFrame:NSMakeRect(0, 0, st::macCautionIconSize, st::macCautionIconSize)];
NSRect badFrame = [badLabel frame], badIconFrame = [badIcon frame];
badFrame.origin.x = (fullRect.size.width - badFrame.size.width + badIconFrame.size.width) / 2.;

View File

@ -375,7 +375,7 @@ void BoxButton::resizeToText() {
resize(_textWidth - _st.width, _st.height);
} else {
if (_st.width < _textWidth + (_st.height - _st.font->height)) {
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.height - _st.font->height), 1.));
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.height - _st.font->height), 1));
_textWidth = _st.font->width(_text);
}
resize(_st.width, _st.height);

View File

@ -250,7 +250,7 @@ Checkbox::Checkbox(QWidget *parent, const QString &text, bool checked, const sty
resize(_textWidth - _st.width, _st.height);
} else {
if (_st.width < _st.textPosition.x() + _textWidth + (_st.textPosition.x() - _st.diameter)) {
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1.));
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1));
_textWidth = _st.font->width(_text);
}
resize(_st.width, _st.height);
@ -392,7 +392,7 @@ Radiobutton::Radiobutton(QWidget *parent, const QString &group, int32 value, con
resize(_textWidth - _st.width, _st.height);
} else {
if (_st.width < _st.textPosition.x() + _textWidth + (_st.textPosition.x() - _st.diameter)) {
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1.));
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1));
_textWidth = _st.font->width(_text);
}
resize(_st.width, _st.height);

View File

@ -21,5 +21,5 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma once
#include "ui/style_core.h"
#include "GeneratedFiles/style_classes.h"
#include "GeneratedFiles/style_auto.h"
#include "styles/style_basic_types.h"
#include "styles/style_basic.h"

View File

@ -20,13 +20,63 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#include "stdafx.h"
namespace style {
namespace {
typedef QMap<QString, uint32> FontFamilyMap;
FontFamilyMap _fontFamilyMap;
using ModulesList = QList<internal::ModuleBase*>;
NeverFreedPointer<ModulesList> styleModules;
typedef QMap<QString, int> FontFamilyMap;
FontFamilyMap fontFamilyMap;
typedef QVector<QString> FontFamilies;
FontFamilies _fontFamilies;
typedef QMap<uint32, FontData*> FontDatas;
FontDatas fontsMap;
typedef QMap<uint32, ColorData*> ColorDatas;
ColorDatas colorsMap;
int spriteWidthValue = 0;
QPixmap *spriteData = nullptr;
inline uint32 fontKey(int size, uint32 flags, int family) {
return (((uint32(family) << 10) | uint32(size)) << 3) | flags;
}
namespace style {
FontData::FontData(uint32 size, uint32 flags, uint32 family, Font *other) : f(_fontFamilies[family]), m(f), _size(size), _flags(flags), _family(family) {
} // namespace
namespace internal {
void registerModule(ModuleBase *module) {
styleModules.makeIfNull();
styleModules->push_back(module);
}
void unregisterModule(ModuleBase *module) {
styleModules->removeOne(module);
if (styleModules->isEmpty()) {
styleModules.clear();
}
}
int registerFontFamily(const QString &family) {
auto result = fontFamilyMap.value(family, -1);
if (result < 0) {
result = _fontFamilies.size();
fontFamilyMap.insert(family, result);
_fontFamilies.push_back(family);
}
return result;
}
int spriteWidth() {
return spriteWidthValue;
}
} // namespace internal
FontData::FontData(int size, uint32 flags, int family, Font *other) : f(_fontFamilies[family]), m(f), _size(size), _flags(flags), _family(family) {
if (other) {
memcpy(modified, other, sizeof(modified));
} else {
@ -60,7 +110,7 @@ namespace style {
return otherFlagsFont(FontUnderline, set);
}
uint32 FontData::size() const {
int FontData::size() const {
return _size;
}
@ -68,7 +118,7 @@ namespace style {
return _flags;
}
uint32 FontData::family() const {
int FontData::family() const {
return _family;
}
@ -80,34 +130,34 @@ namespace style {
return modified[newFlags];
}
Font::Font(uint32 size, uint32 flags, const QString &family) {
if (_fontFamilyMap.isEmpty()) {
Font::Font(int size, uint32 flags, const QString &family) {
if (fontFamilyMap.isEmpty()) {
for (uint32 i = 0, s = style::_fontFamilies.size(); i != s; ++i) {
_fontFamilyMap.insert(style::_fontFamilies.at(i), i);
fontFamilyMap.insert(style::_fontFamilies.at(i), i);
}
}
FontFamilyMap::const_iterator i = _fontFamilyMap.constFind(family);
if (i == _fontFamilyMap.cend()) {
auto i = fontFamilyMap.constFind(family);
if (i == fontFamilyMap.cend()) {
style::_fontFamilies.push_back(family);
i = _fontFamilyMap.insert(family, style::_fontFamilies.size() - 1);
i = fontFamilyMap.insert(family, style::_fontFamilies.size() - 1);
}
init(size, flags, i.value(), 0);
}
Font::Font(uint32 size, uint32 flags, uint32 family) {
Font::Font(int size, uint32 flags, int family) {
init(size, flags, family, 0);
}
Font::Font(uint32 size, uint32 flags, uint32 family, Font *modified) {
Font::Font(int size, uint32 flags, int family, Font *modified) {
init(size, flags, family, modified);
}
void Font::init(uint32 size, uint32 flags, uint32 family, Font *modified) {
uint32 key = _fontKey(size, flags, family);
FontDatas::const_iterator i = _fontsMap.constFind(key);
if (i == _fontsMap.cend()) {
i = _fontsMap.insert(key, new FontData(size, flags, family, modified));
void Font::init(int size, uint32 flags, int family, Font *modified) {
uint32 key = fontKey(size, flags, family);
auto i = fontsMap.constFind(key);
if (i == fontsMap.cend()) {
i = fontsMap.insert(key, new FontData(size, flags, family, modified));
}
ptr = i.value();
}
@ -141,9 +191,9 @@ namespace style {
}
void Color::init(uchar r, uchar g, uchar b, uchar a) {
uint32 key = colorKey(r, g, b, a);
ColorDatas::const_iterator i = _colorsMap.constFind(key);
if (i == _colorsMap.cend()) {
i = _colorsMap.insert(key, new ColorData(r, g, b, a));
auto i = colorsMap.constFind(key);
if (i == colorsMap.cend()) {
i = colorsMap.insert(key, new ColorData(r, g, b, a));
}
ptr = i.value();
}
@ -163,16 +213,57 @@ namespace style {
b = QBrush(color);
}
void stopManager() {
for (FontDatas::const_iterator i = _fontsMap.cbegin(), e = _fontsMap.cend(); i != e; ++i) {
delete i.value();
void startManager() {
if (cRetina()) {
cSetRealScale(dbisOne);
}
_fontsMap.clear();
for (ColorDatas::const_iterator i = _colorsMap.cbegin(), e = _colorsMap.cend(); i != e; ++i) {
delete i.value();
internal::registerFontFamily(qsl("Open Sans"));
QString spriteFilePostfix;
if (cRetina() || cScale() == dbisTwo) {
spriteFilePostfix = qsl("_200x");
} else if (cScale() == dbisOneAndQuarter) {
spriteFilePostfix = qsl("_125x");
} else if (cScale() == dbisOneAndHalf) {
spriteFilePostfix = qsl("_150x");
}
_colorsMap.clear();
QString spriteFile = qsl(":/gui/art/sprite") + spriteFilePostfix + qsl(".png");
if (rtl()) {
spriteData = new QPixmap(QPixmap::fromImage(QImage(spriteFile).mirrored(true, false)));
} else {
spriteData = new QPixmap(spriteFile);
}
if (cRetina()) spriteData->setDevicePixelRatio(cRetinaFactor());
spriteWidthValue = spriteData->width();
if (styleModules) {
for_const (auto module, *styleModules) {
module->start();
}
}
_fontFamilies.push_back(qsl("Open Sans"));
}
void stopManager() {
if (styleModules) {
for_const (auto module, *styleModules) {
module->stop();
}
}
for (auto fontData : fontsMap) {
delete fontData;
}
fontsMap.clear();
for (auto colorData : colorsMap) {
delete colorData;
}
colorsMap.clear();
}
const QPixmap &spritePixmap() {
return *spriteData;
}
};

View File

@ -46,14 +46,31 @@ inline QRect centerrect(const QRect &inRect, const QRect &rect) {
}
namespace style {
namespace internal {
// Objects of derived classes are created in global scope.
// They call [un]registerModule() in [de|con]structor.
class ModuleBase {
public:
virtual void start() = 0;
virtual void stop() = 0;
};
void registerModule(ModuleBase *module);
void unregisterModule(ModuleBase *module);
int registerFontFamily(const QString &family);
int spriteWidth();
} // namespace internal
class FontData;
class Font {
public:
Font(Qt::Initialization = Qt::Uninitialized) : ptr(0) {
}
Font(uint32 size, uint32 flags, const QString &family);
Font(uint32 size, uint32 flags = 0, uint32 family = 0);
Font(int size, uint32 flags, const QString &family);
Font(int size, uint32 flags = 0, int family = 0);
Font &operator=(const Font &other) {
ptr = other.ptr;
@ -76,36 +93,24 @@ namespace style {
private:
FontData *ptr;
void init(uint32 size, uint32 flags, uint32 family, Font *modified);
void init(int size, uint32 flags, int family, Font *modified);
friend void startManager();
Font(FontData *p) : ptr(p) {
}
Font(uint32 size, uint32 flags, uint32 family, Font *modified);
Font(int size, uint32 flags, int family, Font *modified);
friend class FontData;
};
enum FontFlagBits {
FontBoldBit,
FontItalicBit,
FontUnderlineBit,
FontFlagsBits
};
enum FontFlags {
FontBold = (1 << FontBoldBit),
FontItalic = (1 << FontItalicBit),
FontUnderline = (1 << FontUnderlineBit),
FontBold = 0x01,
FontItalic = 0x02,
FontUnderline = 0x04,
FontDifferentFlags = (1 << FontFlagsBits)
FontDifferentFlags = 0x08,
};
inline uint32 _fontKey(uint32 size, uint32 flags, uint32 family) {
return (((family << 10) | size) << FontFlagsBits) | flags;
}
class FontData {
public:
@ -126,9 +131,9 @@ namespace style {
Font italic(bool set = true) const;
Font underline(bool set = true) const;
uint32 size() const;
int size() const;
uint32 flags() const;
uint32 family() const;
int family() const;
QFont f;
QFontMetrics m;
@ -138,10 +143,12 @@ namespace style {
mutable Font modified[FontDifferentFlags];
Font otherFlagsFont(uint32 flag, bool set) const;
FontData(uint32 size, uint32 flags, uint32 family, Font *other);
FontData(int size, uint32 flags, int family, Font *other);
friend class Font;
uint32 _size, _flags, _family;
int _size;
uint32 _flags;
int _family;
};
@ -159,7 +166,7 @@ namespace style {
class ColorData;
class Color {
public:
Color(Qt::Initialization = Qt::Uninitialized) : ptr(0), owner(false) {
Color(Qt::Initialization = Qt::Uninitialized) {
}
Color(const Color &c);
Color(const QColor &c);
@ -185,8 +192,8 @@ namespace style {
}
private:
ColorData *ptr;
bool owner;
ColorData *ptr = nullptr;
bool owner = false;
void init(uchar r, uchar g, uchar b, uchar a);
@ -233,17 +240,6 @@ namespace style {
return ptr->p;
}
typedef QVector<QString> FontFamilies;
extern FontFamilies _fontFamilies;
typedef QMap<uint32, FontData*> FontDatas;
extern FontDatas _fontsMap;
typedef QMap<uint32, ColorData*> ColorDatas;
extern ColorDatas _colorsMap;
extern int _spriteWidth;
typedef float64 number;
typedef QString string;
typedef QRect rect;
@ -252,7 +248,7 @@ namespace style {
public:
sprite() {
}
sprite(int left, int top, int width, int height) : rect(rtl() ? (_spriteWidth - left - width) : left, top, width, height) {
sprite(int left, int top, int width, int height) : rect(rtl() ? (internal::spriteWidth() - left - width) : left, top, width, height) {
}
inline int pxWidth() const {
return rect::width() / cIntRetinaFactor();
@ -314,8 +310,9 @@ namespace style {
void startManager();
void stopManager();
const QPixmap &spritePixmap();
};
} // namespace style
inline QRect centersprite(const QRect &inRect, const style::sprite &sprite) {
return centerrect(inRect, QRect(QPoint(0, 0), sprite.pxSize()));

View File

@ -1591,7 +1591,7 @@ public:
if (_wLeft < si.width) {
lineText = lineText.mid(0, currentBlock->from() - _localFrom) + _Elide;
lineLength = currentBlock->from() + _Elide.size() - _lineStart;
_selection.to = _selection.to = qMin(_selection.to, currentBlock->from());
_selection.to = qMin(_selection.to, currentBlock->from());
setElideBidi(currentBlock->from(), _Elide.size());
elideSaveBlock(blockIndex - 1, _endBlock, currentBlock->from(), elideWidth);
return;

View File

@ -5,15 +5,15 @@ CONFIG += plugin static c++11
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
OBJECTS_DIR = ./../DebugIntermediate
MOC_DIR = ./GenFiles/Debug
RCC_DIR = ./GenFiles
MOC_DIR = ./GeneratedFiles/Debug
RCC_DIR = ./GeneratedFiles
DESTDIR = ./../Debug
}
CONFIG(release, debug|release) {
DEFINES += CUSTOM_API_ID
OBJECTS_DIR = ./../ReleaseIntermediate
MOC_DIR = ./GenFiles/Release
RCC_DIR = ./GenFiles
MOC_DIR = ./GeneratedFiles/Release
RCC_DIR = ./GeneratedFiles
DESTDIR = ./../Release
}
@ -29,43 +29,29 @@ linux {
HEADERS += ./SourceFiles/pspecific_linux.h
}
style_auto_cpp.target = ./GeneratedFiles/style_auto.cpp
style_auto_cpp.depends = FORCE
style_auto_cpp.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/Resources/art/
style_auto_cpp.depends = ./../../Telegram/Resources/style.txt
codegen_style.target = style_target
codegen_style.depends = FORCE
codegen_style.commands = ./../codegen/Debug/codegen_style "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" "./../../Telegram/Resources/all_files.style" --rebuild
style_auto_h.target = ./GeneratedFiles/style_auto.h
style_auto_h.depends = FORCE
style_auto_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/Resources/art/
style_auto_h.depends = ./../../Telegram/Resources/style.txt
codegen_numbers.target = numbers_target
codegen_numbers.depends = ./../../Telegram/Resources/numbers.txt
style_classes_h.target = ./GeneratedFiles/style_classes.h
style_classes_h.depends = FORCE
style_classes_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/Resources/art/
style_classes_h.depends = ./../../Telegram/Resources/style_classes.txt
CONFIG(debug, debug|release) {
#codegen_style.commands = cd ../../Telegram && ./../Linux/codegen/Debug/codegen_style "-I./SourceFiles" "-o./../Linux/DebugIntermediate/GeneratedFiles/styles" "./Resources/all_files.style" --rebuild && cd ../Linux/DebugIntermediate
codegen_numbers.commands = cd ../../Telegram && ./../Linux/codegen/Debug/codegen_numbers "-o./../Linux/DebugIntermediate/GeneratedFiles" "./Resources/numbers.txt" && cd ../Linux/DebugIntermediate
}
CONFIG(release, debug|release) {
#codegen_style.commands = cd ../../Telegram && ./../Linux/codegen/Debug/codegen_style "-I./SourceFiles" "-o./../Linux/ReleaseIntermediate/GeneratedFiles/styles" "./Resources/all_files.style" --rebuild && cd ../Linux/ReleaseIntermediate
codegen_numbers.commands = cd ../../Telegram && ./../Linux/codegen/Debug/codegen_numbers "-o./../Linux/ReleaseIntermediate/GeneratedFiles" "./Resources/numbers.txt" && cd ../Linux/ReleaseIntermediate
}
numbers_cpp.target = ./GeneratedFiles/numbers.cpp
numbers_cpp.depends = FORCE
numbers_cpp.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/Resources/art/
numbers_cpp.depends = ./../../Telegram/Resources/numbers.txt
codegen_lang.target = lang_target
codegen_lang.depends = ./../../Telegram/Resources/lang.strings
codegen_lang.commands = mkdir -p ./GeneratedFiles && ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.strings -lang_out ./GeneratedFiles/lang_auto
lang_auto_cpp.target = ./GeneratedFiles/lang_auto.cpp
lang_auto_cpp.depends = FORCE
lang_auto_cpp.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.strings -lang_out ./../../Telegram/GeneratedFiles/lang_auto
lang_auto_cpp.depends = ./../../Telegram/Resources/lang.strings
QMAKE_EXTRA_TARGETS += codegen_style codegen_numbers codegen_lang
lang_auto_h.target = ./GeneratedFiles/lang_auto.h
lang_auto_h.depends = FORCE
lang_auto_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.strings -lang_out ./../../Telegram/GeneratedFiles/lang_auto
lang_auto_h.depends = ./../../Telegram/Resources/lang.strings
hook.depends = style_auto_cpp style_auto_h style_classes_h numbers_cpp lang_auto_cpp lang_auto_h
CONFIG(debug,debug|release):hook.target = Makefile.Debug
CONFIG(release,debug|release):hook.target = Makefile.Release
QMAKE_EXTRA_TARGETS += style_auto_cpp style_auto_h style_classes_h numbers_cpp lang_auto_cpp lang_auto_h hook
PRE_TARGETDEPS += ./GeneratedFiles/style_auto.cpp ./GeneratedFiles/style_auto.h ./GeneratedFiles/style_classes.h ./GeneratedFiles/numbers.cpp ./GeneratedFiles/lang_auto.h ./GeneratedFiles/lang_auto.cpp
PRE_TARGETDEPS += style_target numbers_target lang_target
unix {
linux-g++:QMAKE_TARGET.arch = $$QMAKE_HOST.arch
@ -81,8 +67,9 @@ unix {
SOURCES += \
./GeneratedFiles/lang_auto.cpp \
./GeneratedFiles/style_auto.cpp \
./GeneratedFiles/numbers.cpp \
./GeneratedFiles/styles/style_basic.cpp \
./GeneratedFiles/styles/style_basic_types.cpp \
./SourceFiles/main.cpp \
./SourceFiles/stdafx.cpp \
./SourceFiles/apiwrap.cpp \
@ -193,8 +180,9 @@ SOURCES += \
HEADERS += \
./GeneratedFiles/lang_auto.h \
./GeneratedFiles/style_auto.h \
./GeneratedFiles/style_classes.h \
./GeneratedFiles/numbers.h \
./GeneratedFiles/styles/style_basic.h \
./GeneratedFiles/styles/style_basic_types.h \
./SourceFiles/stdafx.h \
./SourceFiles/apiwrap.h \
./SourceFiles/app.h \
@ -214,7 +202,6 @@ HEADERS += \
./SourceFiles/layerwidget.h \
./SourceFiles/layout.h \
./SourceFiles/mediaview.h \
./SourceFiles/numbers.h \
./SourceFiles/overviewwidget.h \
./SourceFiles/passcodewidget.h \
./SourceFiles/profilewidget.h \
@ -400,8 +387,9 @@ RESOURCES += \
./Resources/telegram_emojis.qrc
OTHER_FILES += \
./Resources/style_classes.txt \
./Resources/style.txt \
./Resources/basic_types.style \
./Resources/basic.style \
./Resources/all_files.style \
./Resources/lang.strings \
./Resources/langs/lang_it.strings \
./Resources/langs/lang_es.strings \

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,9 @@
<Extensions>cpp;moc</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
<Filter Include="GeneratedFiles\styles">
<UniqueIdentifier>{3397dfda-79f1-4a4c-940b-be26b001baf5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SourceFiles\main.cpp">
@ -108,9 +111,6 @@
<ClCompile Include="SourceFiles\mainwidget.cpp">
<Filter>SourceFiles</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\style_auto.cpp">
<Filter>GeneratedFiles</Filter>
</ClCompile>
<ClCompile Include="SourceFiles\app.cpp">
<Filter>SourceFiles</Filter>
</ClCompile>
@ -1077,6 +1077,12 @@
<ClCompile Include="SourceFiles\ui\text\text_block.cpp">
<Filter>SourceFiles\ui\text</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\styles\style_basic.cpp">
<Filter>GeneratedFiles\styles</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\styles\style_basic_types.cpp">
<Filter>GeneratedFiles\styles</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SourceFiles\stdafx.h">
@ -1085,12 +1091,6 @@
<ClInclude Include="SourceFiles\logs.h">
<Filter>SourceFiles</Filter>
</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">
<Filter>SourceFiles</Filter>
</ClInclude>
@ -1118,9 +1118,6 @@
<ClInclude Include="SourceFiles\pspecific_mac_p.h">
<Filter>SourceFiles</Filter>
</ClInclude>
<ClInclude Include="SourceFiles\numbers.h">
<Filter>SourceFiles</Filter>
</ClInclude>
<ClInclude Include="SourceFiles\config.h">
<Filter>Version</Filter>
</ClInclude>
@ -1235,6 +1232,15 @@
<ClInclude Include="SourceFiles\ui\text\text_block.h">
<Filter>SourceFiles\ui\text</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\styles\style_basic.h">
<Filter>GeneratedFiles\styles</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\styles\style_basic_types.h">
<Filter>GeneratedFiles\styles</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\numbers.h">
<Filter>GeneratedFiles</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="SourceFiles\application.h">
@ -1375,12 +1381,6 @@
<CustomBuild Include="Resources\numbers.txt">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="Resources\style.txt">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="Resources\style_classes.txt">
<Filter>Resources</Filter>
</CustomBuild>
<CustomBuild Include="Resources\telegram.qrc">
<Filter>Resources</Filter>
</CustomBuild>
@ -1535,4 +1535,15 @@
<Filter>Version</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<CodegenStyleItem Include="Resources\all_files.style">
<Filter>Resources</Filter>
</CodegenStyleItem>
<CodegenStyleItem Include="Resources\basic.style">
<Filter>Resources</Filter>
</CodegenStyleItem>
<CodegenStyleItem Include="Resources\basic_types.style">
<Filter>Resources</Filter>
</CodegenStyleItem>
</ItemGroup>
</Project>

View File

@ -23,7 +23,6 @@
isa = PBXAggregateTarget;
buildConfigurationList = 07C3AF3D194CCC310016CFF1 /* Build configuration list for PBXAggregateTarget "Meta Compile" */;
buildPhases = (
07C3AF3A194CCC310016CFF1 /* Meta Style */,
07C3AF3B194CCC310016CFF1 /* Meta Lang */,
);
dependencies = (
@ -51,6 +50,9 @@
0732E4A9199E262300D50FE7 /* overviewwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0732E4A7199E262300D50FE7 /* overviewwidget.cpp */; };
0732E4AC199E268A00D50FE7 /* moc_overviewwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0732E4AB199E268A00D50FE7 /* moc_overviewwidget.cpp */; };
074756191A1372C600CA07F7 /* moc_basic_types.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 074756181A1372C600CA07F7 /* moc_basic_types.cpp */; };
0747FF7E1CC6435100096FC3 /* style_basic_types.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0747FF7A1CC6435100096FC3 /* style_basic_types.cpp */; };
0747FF7F1CC6435100096FC3 /* style_basic.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0747FF7C1CC6435100096FC3 /* style_basic.cpp */; };
0747FF851CC6458B00096FC3 /* numbers.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0747FF831CC6458B00096FC3 /* numbers.cpp */; };
074968D01A44D14C00394F46 /* languagebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 074968CE1A44D14C00394F46 /* languagebox.cpp */; };
074968D21A44D1DF00394F46 /* moc_languagebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 074968D11A44D1DF00394F46 /* moc_languagebox.cpp */; };
0749CE69194D723400345D61 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; };
@ -77,9 +79,7 @@
077A4AF81CA41C38002188D2 /* connection_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AEE1CA41C38002188D2 /* connection_auto.cpp */; };
077A4AF91CA41C38002188D2 /* connection_http.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF01CA41C38002188D2 /* connection_http.cpp */; };
077A4AFA1CA41C38002188D2 /* connection_tcp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF21CA41C38002188D2 /* connection_tcp.cpp */; };
077A4AFB1CA41C38002188D2 /* generate.py in Resources */ = {isa = PBXBuildFile; fileRef = 077A4AF41CA41C38002188D2 /* generate.py */; };
077A4AFC1CA41C38002188D2 /* rsa_public_key.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF51CA41C38002188D2 /* rsa_public_key.cpp */; };
077A4AFD1CA41C38002188D2 /* scheme.tl in Resources */ = {isa = PBXBuildFile; fileRef = 077A4AF61CA41C38002188D2 /* scheme.tl */; };
077A4B031CA41EE2002188D2 /* moc_connection_abstract.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AFF1CA41EE2002188D2 /* moc_connection_abstract.cpp */; };
077A4B041CA41EE2002188D2 /* moc_connection_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4B001CA41EE2002188D2 /* moc_connection_auto.cpp */; };
077A4B051CA41EE2002188D2 /* moc_connection_http.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4B011CA41EE2002188D2 /* moc_connection_http.cpp */; };
@ -90,8 +90,6 @@
07A6933519927B160099CB9F /* moc_mediaview.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07A6933419927B160099CB9F /* moc_mediaview.cpp */; };
07AF95F41AFD03B90060B057 /* qrc_telegram_emojis.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07AF95F21AFD03B90060B057 /* qrc_telegram_emojis.cpp */; };
07AF95F51AFD03B90060B057 /* qrc_telegram_mac.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07AF95F31AFD03B90060B057 /* qrc_telegram_mac.cpp */; };
07AF95F91AFD03C80060B057 /* telegram_emojis.qrc in Resources */ = {isa = PBXBuildFile; fileRef = 07AF95F71AFD03C80060B057 /* telegram_emojis.qrc */; };
07AF95FA1AFD03C80060B057 /* telegram_mac.qrc in Resources */ = {isa = PBXBuildFile; fileRef = 07AF95F81AFD03C80060B057 /* telegram_mac.qrc */; };
07B604321B46A0EC00CA29FE /* playerwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07B604301B46A0EC00CA29FE /* playerwidget.cpp */; };
07B604351B46A20900CA29FE /* moc_playerwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07B604341B46A20900CA29FE /* moc_playerwidget.cpp */; };
07B817091CB9A235006F7869 /* dialogs_indexed_list.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07B817021CB9A235006F7869 /* dialogs_indexed_list.cpp */; };
@ -122,7 +120,6 @@
07DB674D1AD07C9200A51329 /* abstractbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DB67491AD07C9200A51329 /* abstractbox.cpp */; };
07DB674E1AD07C9200A51329 /* sessionsbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DB674B1AD07C9200A51329 /* sessionsbox.cpp */; };
07DB67511AD07CB800A51329 /* intropwdcheck.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DB674F1AD07CB800A51329 /* intropwdcheck.cpp */; };
07DC42A01B5EA15300B6B888 /* numbers.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DC429F1B5EA15300B6B888 /* numbers.cpp */; };
07DE92A01AA4923300A18F6F /* passcodewidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE929F1AA4923200A18F6F /* passcodewidget.cpp */; };
07DE92A71AA4925B00A18F6F /* autolockbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE92A31AA4925B00A18F6F /* autolockbox.cpp */; };
07DE92A81AA4925B00A18F6F /* passcodebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE92A51AA4925B00A18F6F /* passcodebox.cpp */; };
@ -251,7 +248,6 @@
E8B28580819B882A5964561A /* moc_addcontactbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 81780025807318AEA3B8A6FF /* moc_addcontactbox.cpp */; settings = {ATTRIBUTES = (); }; };
E8D95529CED88F18818C9A8B /* introwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0771C4C94B623FC34BF62983 /* introwidget.cpp */; settings = {ATTRIBUTES = (); }; };
E97B3CFAB59B49BACFFC5F7C /* moc_title.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 1080B6D395843B8F76A2E45E /* moc_title.cpp */; settings = {ATTRIBUTES = (); }; };
E9F1CE7F9B18C7C85A50E62D /* style_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 99B8D38F7F5858601230911E /* style_auto.cpp */; settings = {ATTRIBUTES = (); }; };
EBE29731916DB43BF49FE7A4 /* aboutbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C194EDD00F76216057D48A5C /* aboutbox.cpp */; settings = {ATTRIBUTES = (); }; };
ED2557A57C6782721DC494AF /* moc_connectionbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = FEC58F9D8A0963E5A9D4BE6F /* moc_connectionbox.cpp */; settings = {ATTRIBUTES = (); }; };
F26454630C80841CBDCFE1CA /* Foundation.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = FCC237CA5AD60B9BA4447615 /* Foundation.framework */; };
@ -275,6 +271,34 @@
remoteGlobalIDString = 07084678195445A600B5AE3A;
remoteInfo = Updater;
};
0747FF1F1CC63E7E00096FC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0747FF1B1CC63E7E00096FC3 /* codegen_style.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 0747FE5A1CC62B8500096FC3;
remoteInfo = codegen_style;
};
0747FF2B1CC63E9900096FC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0747FF271CC63E9900096FC3 /* codegen_numbers.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 0747FEE61CC63AD900096FC3;
remoteInfo = codegen_numbers;
};
0747FF701CC63FF300096FC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0747FF1B1CC63E7E00096FC3 /* codegen_style.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 0747FE591CC62B8500096FC3;
remoteInfo = codegen_style;
};
0747FF721CC63FFD00096FC3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0747FF271CC63E9900096FC3 /* codegen_numbers.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 0747FEE51CC63AD900096FC3;
remoteInfo = codegen_numbers;
};
07C3AF22194335970016CFF1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6DB9C3763D02B1415CD9D565 /* Project object */;
@ -324,6 +348,15 @@
0732E4A8199E262300D50FE7 /* overviewwidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = overviewwidget.h; path = SourceFiles/overviewwidget.h; sourceTree = SOURCE_ROOT; };
0732E4AB199E268A00D50FE7 /* moc_overviewwidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_overviewwidget.cpp; path = GeneratedFiles/Debug/moc_overviewwidget.cpp; sourceTree = SOURCE_ROOT; };
074756181A1372C600CA07F7 /* moc_basic_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_basic_types.cpp; path = GeneratedFiles/Debug/moc_basic_types.cpp; sourceTree = SOURCE_ROOT; };
0747FF1B1CC63E7E00096FC3 /* codegen_style.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = codegen_style.xcodeproj; path = build/xcode/codegen_style/codegen_style.xcodeproj; sourceTree = SOURCE_ROOT; };
0747FF271CC63E9900096FC3 /* codegen_numbers.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = codegen_numbers.xcodeproj; path = build/xcode/codegen_numbers/codegen_numbers.xcodeproj; sourceTree = SOURCE_ROOT; };
0747FF7A1CC6435100096FC3 /* style_basic_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = style_basic_types.cpp; path = GeneratedFiles/styles/style_basic_types.cpp; sourceTree = SOURCE_ROOT; };
0747FF7B1CC6435100096FC3 /* style_basic_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = style_basic_types.h; path = GeneratedFiles/styles/style_basic_types.h; sourceTree = SOURCE_ROOT; };
0747FF7C1CC6435100096FC3 /* style_basic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = style_basic.cpp; path = GeneratedFiles/styles/style_basic.cpp; sourceTree = SOURCE_ROOT; };
0747FF7D1CC6435100096FC3 /* style_basic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = style_basic.h; path = GeneratedFiles/styles/style_basic.h; sourceTree = SOURCE_ROOT; };
0747FF811CC644FF00096FC3 /* numbers.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = numbers.txt; path = Resources/numbers.txt; sourceTree = SOURCE_ROOT; };
0747FF831CC6458B00096FC3 /* numbers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = numbers.cpp; path = GeneratedFiles/numbers.cpp; sourceTree = SOURCE_ROOT; };
0747FF841CC6458B00096FC3 /* numbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = numbers.h; path = GeneratedFiles/numbers.h; sourceTree = SOURCE_ROOT; };
074968CC1A44D13400394F46 /* lang_it.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = lang_it.strings; path = Resources/langs/lang_it.strings; sourceTree = SOURCE_ROOT; };
074968CE1A44D14C00394F46 /* languagebox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = languagebox.cpp; path = SourceFiles/boxes/languagebox.cpp; sourceTree = SOURCE_ROOT; };
074968CF1A44D14C00394F46 /* languagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = languagebox.h; path = SourceFiles/boxes/languagebox.h; sourceTree = SOURCE_ROOT; };
@ -448,8 +481,6 @@
07DB674C1AD07C9200A51329 /* sessionsbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sessionsbox.h; path = SourceFiles/boxes/sessionsbox.h; sourceTree = SOURCE_ROOT; };
07DB674F1AD07CB800A51329 /* intropwdcheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = intropwdcheck.cpp; path = SourceFiles/intro/intropwdcheck.cpp; sourceTree = SOURCE_ROOT; };
07DB67501AD07CB800A51329 /* intropwdcheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intropwdcheck.h; path = SourceFiles/intro/intropwdcheck.h; sourceTree = SOURCE_ROOT; };
07DC429D1B5EA0E600B6B888 /* numbers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = numbers.h; path = SourceFiles/numbers.h; sourceTree = SOURCE_ROOT; };
07DC429F1B5EA15300B6B888 /* numbers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = numbers.cpp; path = GeneratedFiles/numbers.cpp; sourceTree = SOURCE_ROOT; };
07DE929F1AA4923200A18F6F /* passcodewidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = passcodewidget.cpp; path = SourceFiles/passcodewidget.cpp; sourceTree = SOURCE_ROOT; };
07DE92A21AA4924400A18F6F /* passcodewidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = passcodewidget.h; path = SourceFiles/passcodewidget.h; sourceTree = SOURCE_ROOT; };
07DE92A31AA4925B00A18F6F /* autolockbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = autolockbox.cpp; path = SourceFiles/boxes/autolockbox.cpp; sourceTree = SOURCE_ROOT; };
@ -507,7 +538,6 @@
34E1DF19219C52D7DB20224A /* flatlabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = flatlabel.h; path = SourceFiles/ui/flatlabel.h; sourceTree = "<absolute>"; };
36BDA5D01BED543A92886669 /* Telegram.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = Telegram.pro; sourceTree = "<absolute>"; };
36F718DC72345A84987DB0F6 /* flatbutton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = flatbutton.h; path = SourceFiles/ui/flatbutton.h; sourceTree = "<absolute>"; };
39C1ADF085370E033CB7E7E1 /* style_classes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = style_classes.h; path = GeneratedFiles/style_classes.h; sourceTree = "<absolute>"; };
3A220FD1AE5AD9FE3DC073A4 /* moc_mainwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mainwidget.cpp; path = GeneratedFiles/Debug/moc_mainwidget.cpp; sourceTree = "<absolute>"; };
3B3ED09AB00290D78CF1181B /* moc_dialogswidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_dialogswidget.cpp; path = GeneratedFiles/Debug/moc_dialogswidget.cpp; sourceTree = "<absolute>"; };
3BBB805F6180E363BF89151A /* qtaudio_coreaudio */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtaudio_coreaudio; path = "/usr/local/Qt-5.5.1/plugins/audio/libqtaudio_coreaudio$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
@ -592,7 +622,6 @@
96ACDDE3DCB798B97F9EA2F4 /* file_download.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = file_download.h; path = SourceFiles/mtproto/file_download.h; sourceTree = "<absolute>"; };
9742F24EE18EA44D52824F1E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
974DB34EEB8F83B91614C0B0 /* logs.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = logs.cpp; path = SourceFiles/logs.cpp; sourceTree = "<absolute>"; };
99B8D38F7F5858601230911E /* style_auto.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = style_auto.cpp; path = GeneratedFiles/style_auto.cpp; sourceTree = "<absolute>"; };
9A55B8F7C143D66AD9EAE304 /* qgenericbearer */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qgenericbearer; path = "/usr/local/Qt-5.5.1/plugins/bearer/libqgenericbearer$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
9A69B711DE4B9C89BA803750 /* moc_aboutbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_aboutbox.cpp; path = GeneratedFiles/Debug/moc_aboutbox.cpp; sourceTree = "<absolute>"; };
9AB1479D7D63386FD2046620 /* flatinput.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = flatinput.cpp; path = SourceFiles/ui/flatinput.cpp; sourceTree = "<absolute>"; };
@ -601,7 +630,6 @@
9D9F4744B2F9FF22569D4535 /* moc_countryinput.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_countryinput.cpp; path = GeneratedFiles/Debug/moc_countryinput.cpp; sourceTree = "<absolute>"; };
9DFF62A901D70814B8A323D4 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
9E0704DE8650D7952DC6B7AE /* moc_photosendbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_photosendbox.cpp; path = GeneratedFiles/Debug/moc_photosendbox.cpp; sourceTree = "<absolute>"; };
9EFD7CB36012BFC00CC79434 /* style_auto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = style_auto.h; path = GeneratedFiles/style_auto.h; sourceTree = "<absolute>"; };
A0090709DE1B155085362C36 /* introcode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introcode.cpp; path = SourceFiles/intro/introcode.cpp; sourceTree = "<absolute>"; };
A1479F94376F9732B57C69DB /* moc_animation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_animation.cpp; path = GeneratedFiles/Debug/moc_animation.cpp; sourceTree = "<absolute>"; };
A1A67BEAA744704B29168D39 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
@ -763,6 +791,42 @@
name = minizip;
sourceTree = "<group>";
};
0747FE4F1CC62AE400096FC3 /* codegen */ = {
isa = PBXGroup;
children = (
0747FF271CC63E9900096FC3 /* codegen_numbers.xcodeproj */,
0747FF1B1CC63E7E00096FC3 /* codegen_style.xcodeproj */,
);
name = codegen;
sourceTree = "<group>";
};
0747FF1C1CC63E7E00096FC3 /* Products */ = {
isa = PBXGroup;
children = (
0747FF201CC63E7E00096FC3 /* codegen_style */,
);
name = Products;
sourceTree = "<group>";
};
0747FF281CC63E9900096FC3 /* Products */ = {
isa = PBXGroup;
children = (
0747FF2C1CC63E9900096FC3 /* codegen_numbers */,
);
name = Products;
sourceTree = "<group>";
};
0747FF791CC6434300096FC3 /* styles */ = {
isa = PBXGroup;
children = (
0747FF7A1CC6435100096FC3 /* style_basic_types.cpp */,
0747FF7B1CC6435100096FC3 /* style_basic_types.h */,
0747FF7C1CC6435100096FC3 /* style_basic.cpp */,
0747FF7D1CC6435100096FC3 /* style_basic.h */,
);
name = styles;
sourceTree = "<group>";
};
074968CB1A44D0B800394F46 /* langs */ = {
isa = PBXGroup;
children = (
@ -832,14 +896,15 @@
isa = PBXGroup;
children = (
074968CB1A44D0B800394F46 /* langs */,
07D7EABC1A597DD000838BA2 /* Localizable.strings */,
07C3AF24194335ED0016CFF1 /* Images.xcassets */,
07080BCB1A4357F300741A51 /* lang.strings */,
0747FF811CC644FF00096FC3 /* numbers.txt */,
07C3AF2919433ABF0016CFF1 /* style_classes.txt */,
07C3AF2A19433ABF0016CFF1 /* style.txt */,
07AF95F71AFD03C80060B057 /* telegram_emojis.qrc */,
07AF95F81AFD03C80060B057 /* telegram_mac.qrc */,
1292B92B4848460640F6A391 /* telegram.qrc */,
07C3AF24194335ED0016CFF1 /* Images.xcassets */,
07D7EABC1A597DD000838BA2 /* Localizable.strings */,
);
name = Resources;
sourceTree = "<group>";
@ -936,16 +1001,15 @@
25B08E2869634E9BCBA333A2 /* GeneratedFiles */ = {
isa = PBXGroup;
children = (
0747FF791CC6434300096FC3 /* styles */,
801973D3334D0FCA849CF485 /* Debug */,
07DC429F1B5EA15300B6B888 /* numbers.cpp */,
07080BCD1A43588C00741A51 /* lang_auto.cpp */,
07080BCE1A43588C00741A51 /* lang_auto.h */,
0747FF831CC6458B00096FC3 /* numbers.cpp */,
0747FF841CC6458B00096FC3 /* numbers.h */,
07AF95F21AFD03B90060B057 /* qrc_telegram_emojis.cpp */,
07AF95F31AFD03B90060B057 /* qrc_telegram_mac.cpp */,
D6FF6676816C4E374D374060 /* qrc_telegram.cpp */,
99B8D38F7F5858601230911E /* style_auto.cpp */,
9EFD7CB36012BFC00CC79434 /* style_auto.h */,
39C1ADF085370E033CB7E7E1 /* style_classes.h */,
);
name = GeneratedFiles;
sourceTree = "<Group>";
@ -1067,7 +1131,6 @@
FE8FD20832B4C226E345CFBA /* mainwidget.h */,
07A69330199277BA0099CB9F /* mediaview.cpp */,
07A69331199277BA0099CB9F /* mediaview.h */,
07DC429D1B5EA0E600B6B888 /* numbers.h */,
0732E4A7199E262300D50FE7 /* overviewwidget.cpp */,
0732E4A8199E262300D50FE7 /* overviewwidget.h */,
07DE929F1AA4923200A18F6F /* passcodewidget.cpp */,
@ -1284,7 +1347,7 @@
E8C543AB96796ECAA2E65C57 /* Telegram */ = {
isa = PBXGroup;
children = (
07084684195445A600B5AE3A /* Updater.xcodeproj */,
0747FE4F1CC62AE400096FC3 /* codegen */,
25B08E2869634E9BCBA333A2 /* GeneratedFiles */,
73F2E45FDEB381A085D37A49 /* SourceFiles */,
071AD8691C5E8504008C9E90 /* ThirdParty */,
@ -1292,6 +1355,7 @@
AF39DD055C3EF8226FBE929D /* Frameworks */,
FE0A091FDBFB3E9C31B7A1BD /* Products */,
076B1C611CBFCC0F002C0BC2 /* Resources */,
07084684195445A600B5AE3A /* Updater.xcodeproj */,
);
name = Telegram;
sourceTree = "<Group>";
@ -1311,6 +1375,8 @@
isa = PBXNativeTarget;
buildConfigurationList = 6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "Telegram" */;
buildPhases = (
0747FF741CC6408600096FC3 /* Generate styles */,
0747FF801CC6437300096FC3 /* Generate numbers */,
F7E50F631C51CD5B5DC0BC43 /* Compile Sources */,
D1C883685E82D5676953459A /* Link Binary With Libraries */,
07C3AF341948FC3B0016CFF1 /* Force Resources Directory */,
@ -1321,6 +1387,8 @@
buildRules = (
);
dependencies = (
0747FF731CC63FFD00096FC3 /* PBXTargetDependency */,
0747FF711CC63FF300096FC3 /* PBXTargetDependency */,
69BB0D15D494AAF597C8D2CF /* PBXTargetDependency */,
);
name = Telegram;
@ -1358,6 +1426,14 @@
productRefGroup = FE0A091FDBFB3E9C31B7A1BD /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 0747FF281CC63E9900096FC3 /* Products */;
ProjectRef = 0747FF271CC63E9900096FC3 /* codegen_numbers.xcodeproj */;
},
{
ProductGroup = 0747FF1C1CC63E7E00096FC3 /* Products */;
ProjectRef = 0747FF1B1CC63E7E00096FC3 /* codegen_style.xcodeproj */;
},
{
ProductGroup = 07084685195445A600B5AE3A /* Products */;
ProjectRef = 07084684195445A600B5AE3A /* Updater.xcodeproj */;
@ -1380,6 +1456,20 @@
remoteRef = 07084688195445A700B5AE3A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0747FF201CC63E7E00096FC3 /* codegen_style */ = {
isa = PBXReferenceProxy;
fileType = "compiled.mach-o.executable";
path = codegen_style;
remoteRef = 0747FF1F1CC63E7E00096FC3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
0747FF2C1CC63E9900096FC3 /* codegen_numbers */ = {
isa = PBXReferenceProxy;
fileType = "compiled.mach-o.executable";
path = codegen_numbers;
remoteRef = 0747FF2B1CC63E9900096FC3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@ -1387,12 +1477,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
077A4AFB1CA41C38002188D2 /* generate.py in Resources */,
0749CE69194D723400345D61 /* Images.xcassets in Resources */,
07AF95FA1AFD03C80060B057 /* telegram_mac.qrc in Resources */,
07D7EABA1A597DD000838BA2 /* Localizable.strings in Resources */,
077A4AFD1CA41C38002188D2 /* scheme.tl in Resources */,
07AF95F91AFD03C80060B057 /* telegram_emojis.qrc in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1413,6 +1499,34 @@
shellPath = /bin/sh;
shellScript = "mkdir -p \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app/Contents/Helpers\" && cp \"./../../Libraries/crashpad/crashpad/out/Release/crashpad_handler\" \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app/Contents/Helpers/\"";
};
0747FF741CC6408600096FC3 /* Generate styles */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Generate styles";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./../Mac/codegen/$CONFIGURATION/codegen_style \"-I./SourceFiles\" \"-o./GeneratedFiles/styles\" ./Resources/all_files.style --rebuild";
};
0747FF801CC6437300096FC3 /* Generate numbers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Generate numbers";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./../Mac/codegen/$CONFIGURATION/codegen_numbers \"-o./GeneratedFiles\" ./Resources/numbers.txt";
};
07489B6B1A28949600348CD9 /* Build Updater */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -1441,20 +1555,6 @@
shellPath = /bin/sh;
shellScript = "mkdir -p \"$CONFIGURATION_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources\"";
};
07C3AF3A194CCC310016CFF1 /* Meta Style */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Meta Style";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "open ../Mac/DebugStyle/MetaStyle.app --args -classes_in \"../../Telegram/Resources/style_classes.txt\" -classes_out \"../../Telegram/GeneratedFiles/style_classes.h\" -styles_in \"../../Telegram/Resources/style.txt\" -styles_out \"../../Telegram/GeneratedFiles/style_auto.h\" -path_to_sprites \"../../Telegram/Resources/art/\"";
};
07C3AF3B194CCC310016CFF1 /* Meta Lang */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -1535,7 +1635,6 @@
8F65F0D95B1F0CEB859F2FB3 /* boxshadow.cpp in Compile Sources */,
07C8FE021CB66D97007A8702 /* inline_bot_layout_item.cpp in Compile Sources */,
D7EF8F129FCCE9AB3F3F081F /* button.cpp in Compile Sources */,
07DC42A01B5EA15300B6B888 /* numbers.cpp in Compile Sources */,
C03447C9A7D9FF73463B8BB5 /* countryinput.cpp in Compile Sources */,
07BE850F1A2093C9008ACB9F /* localstorage.cpp in Compile Sources */,
CDB0266A8B7CB20A95266BCD /* emoji_config.cpp in Compile Sources */,
@ -1557,7 +1656,6 @@
077A4B061CA41EE2002188D2 /* moc_connection_tcp.cpp in Compile Sources */,
FCE6518C548DF7BC82228A4A /* twidget.cpp in Compile Sources */,
071AD8D21C5E8E6D008C9E90 /* zip.c in Compile Sources */,
E9F1CE7F9B18C7C85A50E62D /* style_auto.cpp in Compile Sources */,
EBE29731916DB43BF49FE7A4 /* aboutbox.cpp in Compile Sources */,
4426AF526AAD86D6F73CE36F /* addcontactbox.cpp in Compile Sources */,
07D7034B19B8755A00C4EED2 /* audio.cpp in Compile Sources */,
@ -1601,6 +1699,7 @@
0710CA051B0B9404001B4272 /* moc_stickersetbox.cpp in Compile Sources */,
07DE92A71AA4925B00A18F6F /* autolockbox.cpp in Compile Sources */,
07D8509919F8320900623D75 /* usernamebox.cpp in Compile Sources */,
0747FF7E1CC6435100096FC3 /* style_basic_types.cpp in Compile Sources */,
A469EC9C4C367E0B773A9BB7 /* moc_settingswidget.cpp in Compile Sources */,
FD2FE0C564A7389A2E609EC7 /* moc_sysbuttons.cpp in Compile Sources */,
E97B3CFAB59B49BACFFC5F7C /* moc_title.cpp in Compile Sources */,
@ -1615,6 +1714,7 @@
07080BCF1A43588C00741A51 /* lang_auto.cpp in Compile Sources */,
07539B1D1A1416AF00083EFC /* moc_history.cpp in Compile Sources */,
07C8FE121CB80915007A8702 /* moc_toast_manager.cpp in Compile Sources */,
0747FF851CC6458B00096FC3 /* numbers.cpp in Compile Sources */,
077A4AFC1CA41C38002188D2 /* rsa_public_key.cpp in Compile Sources */,
2A500B102B7CE80F3EB6E13E /* moc_file_download.cpp in Compile Sources */,
07A6933519927B160099CB9F /* moc_mediaview.cpp in Compile Sources */,
@ -1664,6 +1764,7 @@
0F7872E39EA570249D420912 /* moc_introwidget.cpp in Compile Sources */,
4F27F5F76AA3F78C8CA27339 /* moc_introcode.cpp in Compile Sources */,
07D8509519F5C97E00623D75 /* scheme_auto.cpp in Compile Sources */,
0747FF7F1CC6435100096FC3 /* style_basic.cpp in Compile Sources */,
0250AB6761AC71A2E3155EEA /* moc_introphone.cpp in Compile Sources */,
07D8509419F5C97E00623D75 /* core_types.cpp in Compile Sources */,
2EF5D0AC9A18F9FE9B8A1ACA /* moc_introsignup.cpp in Compile Sources */,
@ -1678,6 +1779,16 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
0747FF711CC63FF300096FC3 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = codegen_style;
targetProxy = 0747FF701CC63FF300096FC3 /* PBXContainerItemProxy */;
};
0747FF731CC63FFD00096FC3 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = codegen_numbers;
targetProxy = 0747FF721CC63FFD00096FC3 /* PBXContainerItemProxy */;
};
07C3AF42194CCC510016CFF1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 07C3AF39194CCC310016CFF1 /* Meta Compile */;
@ -1773,7 +1884,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = SourceFiles/stdafx.h;
GCC_STRICT_ALIASING = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@ -1915,7 +2025,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = SourceFiles/stdafx.h;
GCC_STRICT_ALIASING = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;

View File

@ -411,8 +411,6 @@ GeneratedFiles/Debug/moc_settingswidget.cpp: SourceFiles/ui/flatbutton.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/sysbuttons.h \
SourceFiles/settingswidget.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/settingswidget.h -o GeneratedFiles/Debug/moc_settingswidget.cpp
@ -587,8 +585,6 @@ GeneratedFiles/Debug/moc_popupmenu.cpp: ../../Libraries/QtStatic/qtbase/include/
GeneratedFiles/Debug/moc_countryinput.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/animation.h \
@ -618,8 +614,6 @@ GeneratedFiles/Debug/moc_flatbutton.cpp: SourceFiles/ui/button.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatbutton.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/ui/flatbutton.h -o GeneratedFiles/Debug/moc_flatbutton.cpp
@ -631,8 +625,6 @@ GeneratedFiles/Debug/moc_flatcheckbox.cpp: SourceFiles/ui/button.h \
GeneratedFiles/Debug/moc_flatinput.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/animation.h \
SourceFiles/core/basic_types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
@ -643,15 +635,11 @@ GeneratedFiles/Debug/moc_flatinput.cpp: ../../Libraries/QtStatic/qtbase/include/
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/ui/flatinput.h -o GeneratedFiles/Debug/moc_flatinput.cpp
GeneratedFiles/Debug/moc_flatlabel.cpp: SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatlabel.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/ui/flatlabel.h -o GeneratedFiles/Debug/moc_flatlabel.cpp
GeneratedFiles/Debug/moc_flattextarea.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QTextEdit \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/animation.h \
SourceFiles/core/basic_types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
@ -663,8 +651,6 @@ GeneratedFiles/Debug/moc_flattextarea.cpp: ../../Libraries/QtStatic/qtbase/inclu
GeneratedFiles/Debug/moc_scrollarea.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QScrollArea \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/scrollarea.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/ui/scrollarea.h -o GeneratedFiles/Debug/moc_scrollarea.cpp
@ -706,8 +692,6 @@ GeneratedFiles/Debug/moc_connectionbox.cpp: SourceFiles/boxes/abstractbox.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/animation.h \
SourceFiles/core/basic_types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
@ -727,8 +711,6 @@ GeneratedFiles/Debug/moc_downloadpathbox.cpp: SourceFiles/boxes/abstractbox.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/animation.h \
SourceFiles/core/basic_types.h \
../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \
@ -793,8 +775,6 @@ GeneratedFiles/Debug/moc_introwidget.cpp: ../../Libraries/QtStatic/qtbase/includ
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/intro/introwidget.h
/usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/introwidget.h -o GeneratedFiles/Debug/moc_introwidget.cpp
@ -810,8 +790,6 @@ GeneratedFiles/Debug/moc_introcode.cpp: ../../Libraries/QtStatic/qtbase/include/
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/intro/introwidget.h \
@ -830,8 +808,6 @@ GeneratedFiles/Debug/moc_introphone.cpp: ../../Libraries/QtStatic/qtbase/include
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/countryinput.h \
@ -854,8 +830,6 @@ GeneratedFiles/Debug/moc_intropwdcheck.cpp: ../../Libraries/QtStatic/qtbase/incl
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/ui/countryinput.h \
@ -878,8 +852,6 @@ GeneratedFiles/Debug/moc_introsignup.cpp: ../../Libraries/QtStatic/qtbase/includ
../../Libraries/QtStatic/qtbase/include/QtCore/QTimer \
../../Libraries/QtStatic/qtbase/include/QtGui/QColor \
SourceFiles/ui/style.h \
GeneratedFiles/style_classes.h \
GeneratedFiles/style_auto.h \
SourceFiles/ui/flatinput.h \
../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \
SourceFiles/intro/introwidget.h \

View File

@ -0,0 +1,45 @@
QT += core gui
TARGET = codegen_numbers
CONFIG += console static c++14
CONFIG -= app_bundle
CONFIG(debug, debug|release) {
OBJECTS_DIR = ./
DESTDIR = ./../../../codegen/Debug
}
CONFIG(release, debug|release) {
OBJECTS_DIR = ./
DESTDIR = ./../../../codegen/Release
}
INCLUDEPATH += ./../../../SourceFiles
QMAKE_CFLAGS_WARN_ON += -Wno-missing-field-initializers
QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers
TEMPLATE = app
SOURCES += \
./../../../SourceFiles/codegen/common/basic_tokenized_file.cpp \
./../../../SourceFiles/codegen/common/checked_utf8_string.cpp \
./../../../SourceFiles/codegen/common/clean_file.cpp \
./../../../SourceFiles/codegen/common/cpp_file.cpp \
./../../../SourceFiles/codegen/common/logging.cpp \
./../../../SourceFiles/codegen/numbers/generator.cpp \
./../../../SourceFiles/codegen/numbers/main.cpp \
./../../../SourceFiles/codegen/numbers/options.cpp \
./../../../SourceFiles/codegen/numbers/parsed_file.cpp \
./../../../SourceFiles/codegen/numbers/processor.cpp
HEADERS += \
./../../../SourceFiles/codegen/common/basic_tokenized_file.h \
./../../../SourceFiles/codegen/common/checked_utf8_string.h \
./../../../SourceFiles/codegen/common/clean_file.h \
./../../../SourceFiles/codegen/common/clean_file_reader.h \
./../../../SourceFiles/codegen/common/cpp_file.h \
./../../../SourceFiles/codegen/common/logging.h \
./../../../SourceFiles/codegen/numbers/generator.h \
./../../../SourceFiles/codegen/numbers/options.h \
./../../../SourceFiles/codegen/numbers/parsed_file.h \
./../../../SourceFiles/codegen/numbers/processor.h

View File

@ -0,0 +1,51 @@
QT += core gui
TARGET = codegen_style
CONFIG += console static c++14
CONFIG -= app_bundle
CONFIG(debug, debug|release) {
OBJECTS_DIR = ./
DESTDIR = ./../../../codegen/Debug
}
CONFIG(release, debug|release) {
OBJECTS_DIR = ./
DESTDIR = ./../../../codegen/Release
}
INCLUDEPATH += ./../../../SourceFiles
QMAKE_CFLAGS_WARN_ON += -Wno-missing-field-initializers
QMAKE_CXXFLAGS_WARN_ON += -Wno-missing-field-initializers
TEMPLATE = app
SOURCES += \
./../../../SourceFiles/codegen/common/basic_tokenized_file.cpp \
./../../../SourceFiles/codegen/common/checked_utf8_string.cpp \
./../../../SourceFiles/codegen/common/clean_file.cpp \
./../../../SourceFiles/codegen/common/cpp_file.cpp \
./../../../SourceFiles/codegen/common/logging.cpp \
./../../../SourceFiles/codegen/style/generator.cpp \
./../../../SourceFiles/codegen/style/main.cpp \
./../../../SourceFiles/codegen/style/module.cpp \
./../../../SourceFiles/codegen/style/options.cpp \
./../../../SourceFiles/codegen/style/parsed_file.cpp \
./../../../SourceFiles/codegen/style/processor.cpp \
./../../../SourceFiles/codegen/style/sprite_generator.cpp \
./../../../SourceFiles/codegen/style/structure_types.cpp
HEADERS += \
./../../../SourceFiles/codegen/common/basic_tokenized_file.h \
./../../../SourceFiles/codegen/common/checked_utf8_string.h \
./../../../SourceFiles/codegen/common/clean_file.h \
./../../../SourceFiles/codegen/common/clean_file_reader.h \
./../../../SourceFiles/codegen/common/cpp_file.h \
./../../../SourceFiles/codegen/common/logging.h \
./../../../SourceFiles/codegen/style/generator.h \
./../../../SourceFiles/codegen/style/module.h \
./../../../SourceFiles/codegen/style/options.h \
./../../../SourceFiles/codegen/style/parsed_file.h \
./../../../SourceFiles/codegen/style/processor.h \
./../../../SourceFiles/codegen/style/sprite_generator.h \
./../../../SourceFiles/codegen/style/structure_types.h

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\clean_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\cpp_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\logging.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\generator.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\main.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\options.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\parsed_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\processor.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file_reader.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\const_utf8_string.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\cpp_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\logging.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\generator.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\options.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\parsed_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\processor.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7C25BFBD-7930-4DE2-AF33-27CE1CC521E6}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.24730.2</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\codegen\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\codegen\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(QTDIR)\include;.\..\..\..\SourceFiles;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w44062 /wd4127 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;qtmaind.lib;qtharfbuzzngd.lib;qtpcred.lib;qtfreetyped.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat />
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(QTDIR)\include;.\..\..\..\SourceFiles;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w44062 /wd4127 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;qtmain.lib;qtharfbuzzng.lib;qtpcre.lib;qtfreetype.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_Win32="QtStatic" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;cxx;c;def</Extensions>
</Filter>
<Filter Include="src\common">
<UniqueIdentifier>{77524fac-2d55-437d-810f-c271326c7f95}</UniqueIdentifier>
</Filter>
<Filter Include="src\numbers">
<UniqueIdentifier>{48ba9931-338f-4476-8d83-600d0ac4440e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\clean_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\cpp_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\logging.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\main.cpp">
<Filter>src\numbers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\options.cpp">
<Filter>src\numbers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\processor.cpp">
<Filter>src\numbers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\parsed_file.cpp">
<Filter>src\numbers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\numbers\generator.cpp">
<Filter>src\numbers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file_reader.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\const_utf8_string.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\cpp_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\logging.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\options.h">
<Filter>src\numbers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\processor.h">
<Filter>src\numbers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\parsed_file.h">
<Filter>src\numbers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\numbers\generator.h">
<Filter>src\numbers</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="CodegenStyleItem">
<Targets>GenerateStyleCode</Targets>
</AvailableItemName>
</ItemGroup>
<ItemGroup>
<StyleFile Include="%(CodegenStyleItem.Identity)" />
</ItemGroup>
<Target
Name="GenerateStyleCode"
BeforeTargets="ClCompile"
Inputs="%(CodegenStyleItem.Identity)"
Outputs=".\GeneratedFiles\styles\style_%(CodegenStyleItem.Filename).h;.\GeneratedFiles\styles\style_%(CodegenStyleItem.Filename).cpp">
<Message Text="Generating style: %(CodegenStyleItem.Identity)" />
<Exec Command="$(SolutionDir)$(Platform)\codegen\$(Configuration)\codegen_style.exe &quot;-I.\SourceFiles&quot; &quot;-o.\GeneratedFiles\styles&quot; %(CodegenStyleItem.Identity)"/>
</Target>
</Project>

View File

@ -11,7 +11,35 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\clean_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\cpp_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\common\logging.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\generator.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\processor.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\module.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\options.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\parsed_file.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\main.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\sprite_generator.cpp" />
<ClCompile Include="..\..\..\SourceFiles\codegen\style\structure_types.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file_reader.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\const_utf8_string.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\cpp_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\common\logging.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\generator.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\processor.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\options.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\module.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\parsed_file.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\sprite_generator.h" />
<ClInclude Include="..\..\..\SourceFiles\codegen\style\structure_types.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E4DF8176-4DEF-4859-962F-B497E3E7A323}</ProjectGuid>
@ -41,45 +69,50 @@
<_ProjectFileVersion>14.0.24730.2</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(SolutionDir)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\codegen\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)$(Platform)\obj\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<OutDir>$(SolutionDir)$(Platform)\codegen\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)$(Platform)\obj\$(ProjectName)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNICODE;WIN32;QT_CORE_LIB;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(QTDIR)\include;.\..\..\..\SourceFiles;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w44062 /wd4127 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR)\plugins;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;qtmaind.lib;qtharfbuzzngd.lib;qtpcred.lib;qtfreetyped.lib;imageformats\qwebpd.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;qtmaind.lib;qtharfbuzzngd.lib;qtpcred.lib;qtfreetyped.lib;imageformats\qwebpd.lib;Qt5Cored.lib;Qt5Guid.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>UNICODE;WIN32;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(QTDIR)\include;.\..\..\..\SourceFiles;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>EnableAllWarnings</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<AdditionalOptions>/w44062 /wd4127 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;qtmain.lib;qtharfbuzzng.lib;qtpcre.lib;qtfreetype.lib;imageformats\qwebp.lib;Qt5Core.lib;Qt5Gui.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -1,28 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<Filter Include="src">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;cxx;c;def</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h</Extensions>
<Filter Include="src\common">
<UniqueIdentifier>{e722d237-774c-46d8-91c4-732e0c12d848}</UniqueIdentifier>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>moc;h;cpp</Extensions>
<SourceControlFiles>False</SourceControlFiles>
<Filter Include="src\style">
<UniqueIdentifier>{fbf050c2-2ecd-4469-a24f-1dcf27e2520f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\main.cpp">
<Filter>Source Files</Filter>
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\logging.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\clean_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\options.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\parsed_file.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\structure_types.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\module.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\common\cpp_file.cpp">
<Filter>src\common</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\processor.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\generator.cpp">
<Filter>src\style</Filter>
</ClCompile>
<ClCompile Include="..\..\..\SourceFiles\codegen\style\sprite_generator.cpp">
<Filter>src\style</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\checked_utf8_string.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\logging.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\const_utf8_string.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\clean_file_reader.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\basic_tokenized_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\options.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\parsed_file.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\structure_types.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\module.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\common\cpp_file.h">
<Filter>src\common</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\processor.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\generator.h">
<Filter>src\style</Filter>
</ClInclude>
<ClInclude Include="..\..\..\SourceFiles\codegen\style\sprite_generator.h">
<Filter>src\style</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<ItemType Name="CodegenStyleItem" DisplayName="Style File" />
<ContentType Name="CodegenStyleContent" ItemType="CodegenStyleItem" DisplayName="Style File" />
<FileExtension Name="*.style" ContentType="CodegenStyleContent" />
</ProjectSchemaDefinitions>

View File

@ -0,0 +1,371 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0747FEFC1CC63B6100096FC3 /* basic_tokenized_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEF01CC63B6100096FC3 /* basic_tokenized_file.cpp */; };
0747FEFD1CC63B6100096FC3 /* checked_utf8_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEF21CC63B6100096FC3 /* checked_utf8_string.cpp */; };
0747FEFE1CC63B6100096FC3 /* clean_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEF51CC63B6100096FC3 /* clean_file.cpp */; };
0747FEFF1CC63B6100096FC3 /* cpp_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEF81CC63B6100096FC3 /* cpp_file.cpp */; };
0747FF001CC63B6100096FC3 /* logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEFA1CC63B6100096FC3 /* logging.cpp */; };
0747FF0D1CC63BAC00096FC3 /* generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FF041CC63BAC00096FC3 /* generator.cpp */; };
0747FF0E1CC63BAC00096FC3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FF061CC63BAC00096FC3 /* main.cpp */; };
0747FF0F1CC63BAC00096FC3 /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FF071CC63BAC00096FC3 /* options.cpp */; };
0747FF101CC63BAC00096FC3 /* parsed_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FF091CC63BAC00096FC3 /* parsed_file.cpp */; };
0747FF111CC63BAC00096FC3 /* processor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FF0B1CC63BAC00096FC3 /* processor.cpp */; };
0747FF141CC63BD800096FC3 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FF131CC63BD800096FC3 /* CoreFoundation.framework */; };
0747FF161CC63D4500096FC3 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FF151CC63D4500096FC3 /* CoreServices.framework */; };
0747FF181CC63D4F00096FC3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FF171CC63D4F00096FC3 /* Cocoa.framework */; };
0747FF1A1CC63DA100096FC3 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FF191CC63DA100096FC3 /* CoreText.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
0747FEE41CC63AD900096FC3 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0747FEE61CC63AD900096FC3 /* codegen_numbers */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = codegen_numbers; sourceTree = BUILT_PRODUCTS_DIR; };
0747FEF01CC63B6100096FC3 /* basic_tokenized_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basic_tokenized_file.cpp; path = ../../../SourceFiles/codegen/common/basic_tokenized_file.cpp; sourceTree = "<group>"; };
0747FEF11CC63B6100096FC3 /* basic_tokenized_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = basic_tokenized_file.h; path = ../../../SourceFiles/codegen/common/basic_tokenized_file.h; sourceTree = "<group>"; };
0747FEF21CC63B6100096FC3 /* checked_utf8_string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checked_utf8_string.cpp; path = ../../../SourceFiles/codegen/common/checked_utf8_string.cpp; sourceTree = "<group>"; };
0747FEF31CC63B6100096FC3 /* checked_utf8_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = checked_utf8_string.h; path = ../../../SourceFiles/codegen/common/checked_utf8_string.h; sourceTree = "<group>"; };
0747FEF41CC63B6100096FC3 /* clean_file_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clean_file_reader.h; path = ../../../SourceFiles/codegen/common/clean_file_reader.h; sourceTree = "<group>"; };
0747FEF51CC63B6100096FC3 /* clean_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = clean_file.cpp; path = ../../../SourceFiles/codegen/common/clean_file.cpp; sourceTree = "<group>"; };
0747FEF61CC63B6100096FC3 /* clean_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clean_file.h; path = ../../../SourceFiles/codegen/common/clean_file.h; sourceTree = "<group>"; };
0747FEF71CC63B6100096FC3 /* const_utf8_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = const_utf8_string.h; path = ../../../SourceFiles/codegen/common/const_utf8_string.h; sourceTree = "<group>"; };
0747FEF81CC63B6100096FC3 /* cpp_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpp_file.cpp; path = ../../../SourceFiles/codegen/common/cpp_file.cpp; sourceTree = "<group>"; };
0747FEF91CC63B6100096FC3 /* cpp_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpp_file.h; path = ../../../SourceFiles/codegen/common/cpp_file.h; sourceTree = "<group>"; };
0747FEFA1CC63B6100096FC3 /* logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = logging.cpp; path = ../../../SourceFiles/codegen/common/logging.cpp; sourceTree = "<group>"; };
0747FEFB1CC63B6100096FC3 /* logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = logging.h; path = ../../../SourceFiles/codegen/common/logging.h; sourceTree = "<group>"; };
0747FF041CC63BAC00096FC3 /* generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = generator.cpp; path = ../../../SourceFiles/codegen/numbers/generator.cpp; sourceTree = "<group>"; };
0747FF051CC63BAC00096FC3 /* generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = generator.h; path = ../../../SourceFiles/codegen/numbers/generator.h; sourceTree = "<group>"; };
0747FF061CC63BAC00096FC3 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../../SourceFiles/codegen/numbers/main.cpp; sourceTree = "<group>"; };
0747FF071CC63BAC00096FC3 /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options.cpp; path = ../../../SourceFiles/codegen/numbers/options.cpp; sourceTree = "<group>"; };
0747FF081CC63BAC00096FC3 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = options.h; path = ../../../SourceFiles/codegen/numbers/options.h; sourceTree = "<group>"; };
0747FF091CC63BAC00096FC3 /* parsed_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = parsed_file.cpp; path = ../../../SourceFiles/codegen/numbers/parsed_file.cpp; sourceTree = "<group>"; };
0747FF0A1CC63BAC00096FC3 /* parsed_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parsed_file.h; path = ../../../SourceFiles/codegen/numbers/parsed_file.h; sourceTree = "<group>"; };
0747FF0B1CC63BAC00096FC3 /* processor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = processor.cpp; path = ../../../SourceFiles/codegen/numbers/processor.cpp; sourceTree = "<group>"; };
0747FF0C1CC63BAC00096FC3 /* processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = processor.h; path = ../../../SourceFiles/codegen/numbers/processor.h; sourceTree = "<group>"; };
0747FF131CC63BD800096FC3 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
0747FF151CC63D4500096FC3 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
0747FF171CC63D4F00096FC3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
0747FF191CC63DA100096FC3 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0747FEE31CC63AD900096FC3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0747FF1A1CC63DA100096FC3 /* CoreText.framework in Frameworks */,
0747FF181CC63D4F00096FC3 /* Cocoa.framework in Frameworks */,
0747FF161CC63D4500096FC3 /* CoreServices.framework in Frameworks */,
0747FF141CC63BD800096FC3 /* CoreFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0747FEDD1CC63AD900096FC3 = {
isa = PBXGroup;
children = (
0747FF021CC63B7500096FC3 /* src */,
0747FF381CC63EFF00096FC3 /* Frameworks */,
0747FEE71CC63AD900096FC3 /* Products */,
);
sourceTree = "<group>";
};
0747FEE71CC63AD900096FC3 /* Products */ = {
isa = PBXGroup;
children = (
0747FEE61CC63AD900096FC3 /* codegen_numbers */,
);
name = Products;
sourceTree = "<group>";
};
0747FF021CC63B7500096FC3 /* src */ = {
isa = PBXGroup;
children = (
0747FF031CC63B7E00096FC3 /* common */,
0747FF121CC63BB100096FC3 /* numbers */,
);
name = src;
sourceTree = "<group>";
};
0747FF031CC63B7E00096FC3 /* common */ = {
isa = PBXGroup;
children = (
0747FEF01CC63B6100096FC3 /* basic_tokenized_file.cpp */,
0747FEF11CC63B6100096FC3 /* basic_tokenized_file.h */,
0747FEF21CC63B6100096FC3 /* checked_utf8_string.cpp */,
0747FEF31CC63B6100096FC3 /* checked_utf8_string.h */,
0747FEF41CC63B6100096FC3 /* clean_file_reader.h */,
0747FEF51CC63B6100096FC3 /* clean_file.cpp */,
0747FEF61CC63B6100096FC3 /* clean_file.h */,
0747FEF71CC63B6100096FC3 /* const_utf8_string.h */,
0747FEF81CC63B6100096FC3 /* cpp_file.cpp */,
0747FEF91CC63B6100096FC3 /* cpp_file.h */,
0747FEFA1CC63B6100096FC3 /* logging.cpp */,
0747FEFB1CC63B6100096FC3 /* logging.h */,
);
name = common;
sourceTree = "<group>";
};
0747FF121CC63BB100096FC3 /* numbers */ = {
isa = PBXGroup;
children = (
0747FF041CC63BAC00096FC3 /* generator.cpp */,
0747FF051CC63BAC00096FC3 /* generator.h */,
0747FF061CC63BAC00096FC3 /* main.cpp */,
0747FF071CC63BAC00096FC3 /* options.cpp */,
0747FF081CC63BAC00096FC3 /* options.h */,
0747FF091CC63BAC00096FC3 /* parsed_file.cpp */,
0747FF0A1CC63BAC00096FC3 /* parsed_file.h */,
0747FF0B1CC63BAC00096FC3 /* processor.cpp */,
0747FF0C1CC63BAC00096FC3 /* processor.h */,
);
name = numbers;
sourceTree = "<group>";
};
0747FF381CC63EFF00096FC3 /* Frameworks */ = {
isa = PBXGroup;
children = (
0747FF191CC63DA100096FC3 /* CoreText.framework */,
0747FF171CC63D4F00096FC3 /* Cocoa.framework */,
0747FF151CC63D4500096FC3 /* CoreServices.framework */,
0747FF131CC63BD800096FC3 /* CoreFoundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0747FEE51CC63AD900096FC3 /* codegen_numbers */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0747FEED1CC63AD900096FC3 /* Build configuration list for PBXNativeTarget "codegen_numbers" */;
buildPhases = (
0747FEE21CC63AD900096FC3 /* Sources */,
0747FEE31CC63AD900096FC3 /* Frameworks */,
0747FEE41CC63AD900096FC3 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = codegen_numbers;
productName = codegen_numbers;
productReference = 0747FEE61CC63AD900096FC3 /* codegen_numbers */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0747FEDE1CC63AD900096FC3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Telegram Desktop";
TargetAttributes = {
0747FEE51CC63AD900096FC3 = {
CreatedOnToolsVersion = 7.3;
};
};
};
buildConfigurationList = 0747FEE11CC63AD900096FC3 /* Build configuration list for PBXProject "codegen_numbers" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 0747FEDD1CC63AD900096FC3;
productRefGroup = 0747FEE71CC63AD900096FC3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0747FEE51CC63AD900096FC3 /* codegen_numbers */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
0747FEE21CC63AD900096FC3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0747FF101CC63BAC00096FC3 /* parsed_file.cpp in Sources */,
0747FF0F1CC63BAC00096FC3 /* options.cpp in Sources */,
0747FEFC1CC63B6100096FC3 /* basic_tokenized_file.cpp in Sources */,
0747FEFD1CC63B6100096FC3 /* checked_utf8_string.cpp in Sources */,
0747FF111CC63BAC00096FC3 /* processor.cpp in Sources */,
0747FF001CC63B6100096FC3 /* logging.cpp in Sources */,
0747FEFE1CC63B6100096FC3 /* clean_file.cpp in Sources */,
0747FF0E1CC63BAC00096FC3 /* main.cpp in Sources */,
0747FEFF1CC63B6100096FC3 /* cpp_file.cpp in Sources */,
0747FF0D1CC63BAC00096FC3 /* generator.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
0747FEEB1CC63AD900096FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"/usr/local/Qt-5.5.1/include",
../../../SourceFiles,
);
LIBRARY_SEARCH_PATHS = "/usr/local/Qt-5.5.1/lib";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
OBJROOT = "./../../../../Mac/obj/codegen_numbers/$(CONFIGURATION)";
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-lQt5Core_debug",
"-lqtpcre_debug",
"-lz",
);
SDKROOT = macosx;
SYMROOT = ./../../../../Mac/codegen/;
};
name = Debug;
};
0747FEEC1CC63AD900096FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"/usr/local/Qt-5.5.1/include",
../../../SourceFiles,
);
LIBRARY_SEARCH_PATHS = "/usr/local/Qt-5.5.1/lib";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
OBJROOT = "./../../../../Mac/obj/codegen_numbers/$(CONFIGURATION)";
OTHER_LDFLAGS = (
"-lQt5Core",
"-lqtpcre",
"-lz",
);
SDKROOT = macosx;
SYMROOT = ./../../../../Mac/codegen/;
};
name = Release;
};
0747FEEE1CC63AD900096FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
0747FEEF1CC63AD900096FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0747FEE11CC63AD900096FC3 /* Build configuration list for PBXProject "codegen_numbers" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0747FEEB1CC63AD900096FC3 /* Debug */,
0747FEEC1CC63AD900096FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0747FEED1CC63AD900096FC3 /* Build configuration list for PBXNativeTarget "codegen_numbers" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0747FEEE1CC63AD900096FC3 /* Debug */,
0747FEEF1CC63AD900096FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0747FEDE1CC63AD900096FC3 /* Project object */;
}

View File

@ -0,0 +1,413 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0747FEA01CC633AA00096FC3 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FE9F1CC633AA00096FC3 /* CoreFoundation.framework */; };
0747FEA41CC6344000096FC3 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FEA31CC6344000096FC3 /* CoreServices.framework */; };
0747FEA61CC6345000096FC3 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FEA51CC6345000096FC3 /* OpenGL.framework */; };
0747FEA81CC6350000096FC3 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FEA71CC6350000096FC3 /* CoreGraphics.framework */; };
0747FEAA1CC6351200096FC3 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FEA91CC6351200096FC3 /* CoreText.framework */; };
0747FEAD1CC6360700096FC3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0747FEAC1CC6360700096FC3 /* Cocoa.framework */; };
0747FEBE1CC63A1400096FC3 /* basic_tokenized_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEB21CC63A1400096FC3 /* basic_tokenized_file.cpp */; };
0747FEBF1CC63A1400096FC3 /* checked_utf8_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEB41CC63A1400096FC3 /* checked_utf8_string.cpp */; };
0747FEC01CC63A1400096FC3 /* clean_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEB71CC63A1400096FC3 /* clean_file.cpp */; };
0747FEC11CC63A1400096FC3 /* cpp_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEBA1CC63A1400096FC3 /* cpp_file.cpp */; };
0747FEC21CC63A1400096FC3 /* logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEBC1CC63A1400096FC3 /* logging.cpp */; };
0747FED41CC63A9800096FC3 /* generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEC51CC63A9800096FC3 /* generator.cpp */; };
0747FED51CC63A9800096FC3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEC71CC63A9800096FC3 /* main.cpp */; };
0747FED61CC63A9800096FC3 /* module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FEC81CC63A9800096FC3 /* module.cpp */; };
0747FED71CC63A9800096FC3 /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FECA1CC63A9800096FC3 /* options.cpp */; };
0747FED81CC63A9800096FC3 /* parsed_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FECC1CC63A9800096FC3 /* parsed_file.cpp */; };
0747FED91CC63A9800096FC3 /* processor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FECE1CC63A9800096FC3 /* processor.cpp */; };
0747FEDA1CC63A9800096FC3 /* sprite_generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FED01CC63A9800096FC3 /* sprite_generator.cpp */; };
0747FEDB1CC63A9800096FC3 /* structure_types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0747FED21CC63A9800096FC3 /* structure_types.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
0747FE581CC62B8500096FC3 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0747FE5A1CC62B8500096FC3 /* codegen_style */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = codegen_style; sourceTree = BUILT_PRODUCTS_DIR; };
0747FE9F1CC633AA00096FC3 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
0747FEA11CC633EE00096FC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
0747FEA31CC6344000096FC3 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
0747FEA51CC6345000096FC3 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
0747FEA71CC6350000096FC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
0747FEA91CC6351200096FC3 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
0747FEAC1CC6360700096FC3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
0747FEB21CC63A1400096FC3 /* basic_tokenized_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = basic_tokenized_file.cpp; path = ../../../SourceFiles/codegen/common/basic_tokenized_file.cpp; sourceTree = "<group>"; };
0747FEB31CC63A1400096FC3 /* basic_tokenized_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = basic_tokenized_file.h; path = ../../../SourceFiles/codegen/common/basic_tokenized_file.h; sourceTree = "<group>"; };
0747FEB41CC63A1400096FC3 /* checked_utf8_string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checked_utf8_string.cpp; path = ../../../SourceFiles/codegen/common/checked_utf8_string.cpp; sourceTree = "<group>"; };
0747FEB51CC63A1400096FC3 /* checked_utf8_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = checked_utf8_string.h; path = ../../../SourceFiles/codegen/common/checked_utf8_string.h; sourceTree = "<group>"; };
0747FEB61CC63A1400096FC3 /* clean_file_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clean_file_reader.h; path = ../../../SourceFiles/codegen/common/clean_file_reader.h; sourceTree = "<group>"; };
0747FEB71CC63A1400096FC3 /* clean_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = clean_file.cpp; path = ../../../SourceFiles/codegen/common/clean_file.cpp; sourceTree = "<group>"; };
0747FEB81CC63A1400096FC3 /* clean_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clean_file.h; path = ../../../SourceFiles/codegen/common/clean_file.h; sourceTree = "<group>"; };
0747FEB91CC63A1400096FC3 /* const_utf8_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = const_utf8_string.h; path = ../../../SourceFiles/codegen/common/const_utf8_string.h; sourceTree = "<group>"; };
0747FEBA1CC63A1400096FC3 /* cpp_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpp_file.cpp; path = ../../../SourceFiles/codegen/common/cpp_file.cpp; sourceTree = "<group>"; };
0747FEBB1CC63A1400096FC3 /* cpp_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cpp_file.h; path = ../../../SourceFiles/codegen/common/cpp_file.h; sourceTree = "<group>"; };
0747FEBC1CC63A1400096FC3 /* logging.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = logging.cpp; path = ../../../SourceFiles/codegen/common/logging.cpp; sourceTree = "<group>"; };
0747FEBD1CC63A1400096FC3 /* logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = logging.h; path = ../../../SourceFiles/codegen/common/logging.h; sourceTree = "<group>"; };
0747FEC51CC63A9800096FC3 /* generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = generator.cpp; path = ../../../SourceFiles/codegen/style/generator.cpp; sourceTree = "<group>"; };
0747FEC61CC63A9800096FC3 /* generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = generator.h; path = ../../../SourceFiles/codegen/style/generator.h; sourceTree = "<group>"; };
0747FEC71CC63A9800096FC3 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../../SourceFiles/codegen/style/main.cpp; sourceTree = "<group>"; };
0747FEC81CC63A9800096FC3 /* module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = module.cpp; path = ../../../SourceFiles/codegen/style/module.cpp; sourceTree = "<group>"; };
0747FEC91CC63A9800096FC3 /* module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = module.h; path = ../../../SourceFiles/codegen/style/module.h; sourceTree = "<group>"; };
0747FECA1CC63A9800096FC3 /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options.cpp; path = ../../../SourceFiles/codegen/style/options.cpp; sourceTree = "<group>"; };
0747FECB1CC63A9800096FC3 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = options.h; path = ../../../SourceFiles/codegen/style/options.h; sourceTree = "<group>"; };
0747FECC1CC63A9800096FC3 /* parsed_file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = parsed_file.cpp; path = ../../../SourceFiles/codegen/style/parsed_file.cpp; sourceTree = "<group>"; };
0747FECD1CC63A9800096FC3 /* parsed_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parsed_file.h; path = ../../../SourceFiles/codegen/style/parsed_file.h; sourceTree = "<group>"; };
0747FECE1CC63A9800096FC3 /* processor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = processor.cpp; path = ../../../SourceFiles/codegen/style/processor.cpp; sourceTree = "<group>"; };
0747FECF1CC63A9800096FC3 /* processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = processor.h; path = ../../../SourceFiles/codegen/style/processor.h; sourceTree = "<group>"; };
0747FED01CC63A9800096FC3 /* sprite_generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sprite_generator.cpp; path = ../../../SourceFiles/codegen/style/sprite_generator.cpp; sourceTree = "<group>"; };
0747FED11CC63A9800096FC3 /* sprite_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sprite_generator.h; path = ../../../SourceFiles/codegen/style/sprite_generator.h; sourceTree = "<group>"; };
0747FED21CC63A9800096FC3 /* structure_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = structure_types.cpp; path = ../../../SourceFiles/codegen/style/structure_types.cpp; sourceTree = "<group>"; };
0747FED31CC63A9800096FC3 /* structure_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = structure_types.h; path = ../../../SourceFiles/codegen/style/structure_types.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0747FE571CC62B8500096FC3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0747FEAD1CC6360700096FC3 /* Cocoa.framework in Frameworks */,
0747FEAA1CC6351200096FC3 /* CoreText.framework in Frameworks */,
0747FEA81CC6350000096FC3 /* CoreGraphics.framework in Frameworks */,
0747FEA61CC6345000096FC3 /* OpenGL.framework in Frameworks */,
0747FEA41CC6344000096FC3 /* CoreServices.framework in Frameworks */,
0747FEA01CC633AA00096FC3 /* CoreFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0747FE511CC62B8500096FC3 = {
isa = PBXGroup;
children = (
0747FEC31CC63A5100096FC3 /* src */,
0747FEAB1CC6353900096FC3 /* Frameworks */,
0747FE5B1CC62B8500096FC3 /* Products */,
);
sourceTree = "<group>";
};
0747FE5B1CC62B8500096FC3 /* Products */ = {
isa = PBXGroup;
children = (
0747FE5A1CC62B8500096FC3 /* codegen_style */,
);
name = Products;
sourceTree = "<group>";
};
0747FEAB1CC6353900096FC3 /* Frameworks */ = {
isa = PBXGroup;
children = (
0747FEAC1CC6360700096FC3 /* Cocoa.framework */,
0747FEA91CC6351200096FC3 /* CoreText.framework */,
0747FEA71CC6350000096FC3 /* CoreGraphics.framework */,
0747FEA51CC6345000096FC3 /* OpenGL.framework */,
0747FEA31CC6344000096FC3 /* CoreServices.framework */,
0747FEA11CC633EE00096FC3 /* Foundation.framework */,
0747FE9F1CC633AA00096FC3 /* CoreFoundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0747FEC31CC63A5100096FC3 /* src */ = {
isa = PBXGroup;
children = (
0747FEC41CC63A6300096FC3 /* common */,
0747FEDC1CC63AA700096FC3 /* style */,
);
name = src;
sourceTree = "<group>";
};
0747FEC41CC63A6300096FC3 /* common */ = {
isa = PBXGroup;
children = (
0747FEB21CC63A1400096FC3 /* basic_tokenized_file.cpp */,
0747FEB31CC63A1400096FC3 /* basic_tokenized_file.h */,
0747FEB41CC63A1400096FC3 /* checked_utf8_string.cpp */,
0747FEB51CC63A1400096FC3 /* checked_utf8_string.h */,
0747FEB61CC63A1400096FC3 /* clean_file_reader.h */,
0747FEB71CC63A1400096FC3 /* clean_file.cpp */,
0747FEB81CC63A1400096FC3 /* clean_file.h */,
0747FEB91CC63A1400096FC3 /* const_utf8_string.h */,
0747FEBA1CC63A1400096FC3 /* cpp_file.cpp */,
0747FEBB1CC63A1400096FC3 /* cpp_file.h */,
0747FEBC1CC63A1400096FC3 /* logging.cpp */,
0747FEBD1CC63A1400096FC3 /* logging.h */,
);
name = common;
sourceTree = "<group>";
};
0747FEDC1CC63AA700096FC3 /* style */ = {
isa = PBXGroup;
children = (
0747FEC51CC63A9800096FC3 /* generator.cpp */,
0747FEC61CC63A9800096FC3 /* generator.h */,
0747FEC71CC63A9800096FC3 /* main.cpp */,
0747FEC81CC63A9800096FC3 /* module.cpp */,
0747FEC91CC63A9800096FC3 /* module.h */,
0747FECA1CC63A9800096FC3 /* options.cpp */,
0747FECB1CC63A9800096FC3 /* options.h */,
0747FECC1CC63A9800096FC3 /* parsed_file.cpp */,
0747FECD1CC63A9800096FC3 /* parsed_file.h */,
0747FECE1CC63A9800096FC3 /* processor.cpp */,
0747FECF1CC63A9800096FC3 /* processor.h */,
0747FED01CC63A9800096FC3 /* sprite_generator.cpp */,
0747FED11CC63A9800096FC3 /* sprite_generator.h */,
0747FED21CC63A9800096FC3 /* structure_types.cpp */,
0747FED31CC63A9800096FC3 /* structure_types.h */,
);
name = style;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0747FE591CC62B8500096FC3 /* codegen_style */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0747FE611CC62B8500096FC3 /* Build configuration list for PBXNativeTarget "codegen_style" */;
buildPhases = (
0747FE561CC62B8500096FC3 /* Sources */,
0747FE571CC62B8500096FC3 /* Frameworks */,
0747FE581CC62B8500096FC3 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = codegen_style;
productName = codegen_style;
productReference = 0747FE5A1CC62B8500096FC3 /* codegen_style */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0747FE521CC62B8500096FC3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Telegram Desktop";
TargetAttributes = {
0747FE591CC62B8500096FC3 = {
CreatedOnToolsVersion = 7.3;
};
};
};
buildConfigurationList = 0747FE551CC62B8500096FC3 /* Build configuration list for PBXProject "codegen_style" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 0747FE511CC62B8500096FC3;
productRefGroup = 0747FE5B1CC62B8500096FC3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0747FE591CC62B8500096FC3 /* codegen_style */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
0747FE561CC62B8500096FC3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0747FEBF1CC63A1400096FC3 /* checked_utf8_string.cpp in Sources */,
0747FED61CC63A9800096FC3 /* module.cpp in Sources */,
0747FEDA1CC63A9800096FC3 /* sprite_generator.cpp in Sources */,
0747FED71CC63A9800096FC3 /* options.cpp in Sources */,
0747FEC01CC63A1400096FC3 /* clean_file.cpp in Sources */,
0747FEDB1CC63A9800096FC3 /* structure_types.cpp in Sources */,
0747FED81CC63A9800096FC3 /* parsed_file.cpp in Sources */,
0747FEC11CC63A1400096FC3 /* cpp_file.cpp in Sources */,
0747FEBE1CC63A1400096FC3 /* basic_tokenized_file.cpp in Sources */,
0747FED51CC63A9800096FC3 /* main.cpp in Sources */,
0747FED91CC63A9800096FC3 /* processor.cpp in Sources */,
0747FEC21CC63A1400096FC3 /* logging.cpp in Sources */,
0747FED41CC63A9800096FC3 /* generator.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
0747FE5F1CC62B8500096FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"/usr/local/Qt-5.5.1/include",
../../../SourceFiles,
);
LIBRARY_SEARCH_PATHS = "/usr/local/Qt-5.5.1/lib";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
OBJROOT = "./../../../../Mac/obj/codegen_style/$(CONFIGURATION)";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-Wall",
"-DQT_GUI_LIB",
"-DQT_CORE_LIB",
);
OTHER_LDFLAGS = (
"-lQt5Core_debug",
"-lQt5Gui_debug",
"-lqtpcre_debug",
"-lqtharfbuzzng_debug",
"-lz",
);
SDKROOT = macosx;
SYMROOT = ./../../../../Mac/codegen/;
};
name = Debug;
};
0747FE601CC62B8500096FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"/usr/local/Qt-5.5.1/include",
../../../SourceFiles,
);
LIBRARY_SEARCH_PATHS = "/usr/local/Qt-5.5.1/lib";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
OBJROOT = "./../../../../Mac/obj/codegen_style/$(CONFIGURATION)";
OTHER_CFLAGS = (
"-Wall",
"-DQT_GUI_LIB",
"-DQT_CORE_LIB",
);
OTHER_LDFLAGS = (
"-lQt5Core",
"-lQt5Gui",
"-lqtharfbuzzng",
"-lqtpcre",
"-lz",
);
SDKROOT = macosx;
SYMROOT = ./../../../../Mac/codegen/;
};
name = Release;
};
0747FE621CC62B8500096FC3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
0747FE631CC62B8500096FC3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0747FE551CC62B8500096FC3 /* Build configuration list for PBXProject "codegen_style" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0747FE5F1CC62B8500096FC3 /* Debug */,
0747FE601CC62B8500096FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0747FE611CC62B8500096FC3 /* Build configuration list for PBXNativeTarget "codegen_style" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0747FE621CC62B8500096FC3 /* Debug */,
0747FE631CC62B8500096FC3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0747FE521CC62B8500096FC3 /* Project object */;
}