2022-10-05 17:11:31 +00:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
#ifndef GENERATOROPTIONS_H
|
|
|
|
#define GENERATOROPTIONS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2022-11-21 17:31:49 +00:00
|
|
|
namespace qtprotoccommon {
|
2022-10-05 17:11:31 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\ingroup generator
|
|
|
|
\private
|
|
|
|
\brief The GeneratorOptions class
|
|
|
|
*/
|
|
|
|
class Options
|
|
|
|
{
|
|
|
|
Options();
|
|
|
|
|
|
|
|
static Options &mutableInstance();
|
|
|
|
public:
|
2024-09-08 11:10:37 +00:00
|
|
|
enum class HeaderGuardType {
|
|
|
|
Pragma,
|
|
|
|
ProtoFilename,
|
|
|
|
};
|
2023-04-24 12:01:36 +00:00
|
|
|
enum GeneratorType {
|
|
|
|
QtProtobufGen = 0,
|
|
|
|
QtGrpcGen
|
|
|
|
};
|
2022-10-05 17:11:31 +00:00
|
|
|
~Options();
|
|
|
|
Options(const Options &) = delete;
|
|
|
|
Options &operator=(const Options &) = delete;
|
|
|
|
Options(Options &&) = delete;
|
|
|
|
Options &operator=(Options &&) = delete;
|
|
|
|
|
|
|
|
static const Options &instance();
|
2023-04-24 12:01:36 +00:00
|
|
|
static void setFromString(const std::string &options, GeneratorType type = QtProtobufGen);
|
2022-10-05 17:11:31 +00:00
|
|
|
|
2024-09-03 16:01:37 +00:00
|
|
|
bool hasQml() const { return m_qml; }
|
2022-10-05 17:11:31 +00:00
|
|
|
bool generateComments() const { return m_generateComments; }
|
|
|
|
bool isFolder() const { return m_isFolder; }
|
|
|
|
bool generateFieldEnum() const { return m_generateFieldEnum; }
|
|
|
|
const std::string &extraNamespace() const { return m_extraNamespace; }
|
|
|
|
const std::string &exportMacro() const { return m_exportMacro; }
|
2024-02-03 10:25:33 +00:00
|
|
|
const std::string &exportMacroFilename() const { return m_exportMacroFilename; }
|
|
|
|
bool generateMacroExportFile() const { return m_generateMacroExportFile; }
|
2024-09-08 11:10:37 +00:00
|
|
|
HeaderGuardType headerGuard() const { return m_headerGuard; }
|
2022-10-05 17:11:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_generateComments;
|
|
|
|
bool m_isFolder;
|
|
|
|
bool m_generateFieldEnum;
|
|
|
|
std::string m_extraNamespace;
|
|
|
|
std::string m_exportMacro;
|
2024-02-03 10:25:33 +00:00
|
|
|
std::string m_exportMacroFilename;
|
|
|
|
bool m_generateMacroExportFile;
|
2023-04-24 12:01:36 +00:00
|
|
|
bool m_qml;
|
2024-09-08 11:10:37 +00:00
|
|
|
HeaderGuardType m_headerGuard = Options::HeaderGuardType::ProtoFilename;
|
2022-10-05 17:11:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // GENERATOROPTIONS_H
|