Akonadi

private/protocolgen/main.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Daniel Vrátil <dvratil@kde.og>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include <QCommandLineParser>
8#include <QCoreApplication>
9
10#include "cppgenerator.h"
11#include "xmlparser.h"
12
13#include <iostream>
14
15int main(int argc, char **argv)
16{
17 QCoreApplication app(argc, argv);
18
19 QCommandLineParser parser;
20 parser.addPositionalArgument(QStringLiteral("file"), QStringLiteral("File"));
21 parser.addHelpOption();
22 parser.process(app);
23
24 const auto args = parser.positionalArguments();
25 if (args.isEmpty()) {
26 std::cerr << "No file specified" << std::endl;
27 return 1;
28 }
29
30 XmlParser xmlParser;
31 if (!xmlParser.parse(args[0])) {
32 return -1;
33 }
34
35 CppGenerator cppGenerator;
36 if (!cppGenerator.generate(xmlParser.tree())) {
37 return -2;
38 } else {
39 return 0;
40 }
41}
QCommandLineOption addHelpOption()
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax)
QStringList positionalArguments() const const
void process(const QCoreApplication &app)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:03:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.