mirror of https://github.com/procxx/kepka.git
Generate necessary includes in codegen tools
This commit is contained in:
parent
a777dc40db
commit
d646c8bde1
|
|
@ -74,8 +74,11 @@ CppFile::CppFile(const QString &path, const ProjectInfo &project)
|
|||
}
|
||||
}
|
||||
|
||||
CppFile &CppFile::include(const QString &header) {
|
||||
stream() << "#include \"" << header << "\"";
|
||||
CppFile &CppFile::include(const QString &header, bool global ) {
|
||||
if (global)
|
||||
stream() << QString("#include <%1>").arg(header);
|
||||
else
|
||||
stream() << QString("#include \"%1\"").arg(header);
|
||||
return newline();
|
||||
}
|
||||
|
||||
|
|
@ -129,4 +132,4 @@ bool CppFile::finalize() {
|
|||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace codegen
|
||||
} // namespace codegen
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
stream() << "\n";
|
||||
return *this;
|
||||
}
|
||||
CppFile &include(const QString &header);
|
||||
CppFile &include(const QString &header, bool global = false);
|
||||
|
||||
// Empty name adds anonymous namespace.
|
||||
CppFile &pushNamespace(const QString &name = QString());
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ bool Generator::writeImages() {
|
|||
bool Generator::writeSource() {
|
||||
source_ = std::make_unique<common::CppFile>(outputPath_ + ".cpp", project_);
|
||||
|
||||
source_->include("ui/emoji_config.h").newline();
|
||||
source_->include("emoji_suggestions_data.h").newline();
|
||||
source_->pushNamespace("Ui").pushNamespace("Emoji").pushNamespace();
|
||||
source_->stream() << "\
|
||||
|
|
@ -379,6 +380,9 @@ void Init() {\n\
|
|||
|
||||
bool Generator::writeHeader() {
|
||||
auto header = std::make_unique<common::CppFile>(outputPath_ + ".h", project_);
|
||||
|
||||
header->include("QChar", true);
|
||||
header->include("settings.h");
|
||||
header->pushNamespace("Ui").pushNamespace("Emoji").pushNamespace("internal");
|
||||
header->stream() << "\
|
||||
\n\
|
||||
|
|
|
|||
|
|
@ -115,6 +115,11 @@ Generator::Generator(const LangPack &langpack, const QString &destBasePath, cons
|
|||
|
||||
bool Generator::writeHeader() {
|
||||
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
|
||||
|
||||
header_->include("utility", true);
|
||||
header_->include("QString", true);
|
||||
header_->include("QLatin1String", true);
|
||||
|
||||
header_->include("lang/lang_tag.h").newline().pushNamespace("Lang").stream() << "\
|
||||
\n\
|
||||
constexpr auto kTagsCount = " << langpack_.tags.size() << ";\n\
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ Generator::Generator(const Rules &rules, const QString &destBasePath, const comm
|
|||
bool Generator::writeHeader() {
|
||||
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
|
||||
|
||||
header_->include("QString", true);
|
||||
header_->stream() << "QVector<int> phoneNumberParse(const QString &number);\n";
|
||||
|
||||
return header_->finalize();
|
||||
|
|
@ -47,6 +48,7 @@ bool Generator::writeHeader() {
|
|||
bool Generator::writeSource() {
|
||||
source_ = std::make_unique<common::CppFile>(basePath_ + ".cpp", project_);
|
||||
|
||||
source_->include("QVector", true);
|
||||
source_->stream() << "\
|
||||
QVector<int> phoneNumberParse(const QString &number) {\n\
|
||||
QVector<int> result;\n\
|
||||
|
|
|
|||
|
|
@ -989,6 +989,7 @@ GNU General Public License for more details.\n\
|
|||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n\
|
||||
#include "base/assertion.h"\n\
|
||||
#include "scheme.h"\n\
|
||||
\n\
|
||||
// Creator proxy class definition\n\
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ Generator::Generator(const structure::Module &module, const QString &destBasePat
|
|||
bool Generator::writeHeader() {
|
||||
header_ = std::make_unique<common::CppFile>(basePath_ + ".h", project_);
|
||||
|
||||
header_->include("styles/style_basic.h").newline();
|
||||
header_->include("ui/style/style_core.h").newline();
|
||||
|
||||
if (!writeHeaderStyleNamespace()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue