-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (33 loc) · 1.22 KB
/
main.cpp
File metadata and controls
37 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* This file is part of the Tome of Concurrency book.
* (C) Mirko Boehm <mirko@kde.org>
* Licensed under the GPLv3.
*/
#include <iostream>
#include <QCoreApplication>
#include <QFileInfo>
#include "Exception.h"
#include "Helpers.h"
#include "Process.h"
int main(int argc, char *argv[])
{
using namespace std;
try {
QCoreApplication a(argc, argv);
const QString copyrightnote = u("%1 - process special instructions in markdown articles to include code samples\n"
"* Author: Mirko Boehm <mirko@kde.org>\n"
"* Licensed under the GPLv3.").arg(a.applicationName());
std::wcout << copyrightnote.toStdWString() << endl;
if (argc != 3) {
const QString usage = u(
"\nUsage:\n"
"%1 <inputfile> <outputfile>\n").arg(a.applicationName());
throw Exception(usage);
}
const QString inputfile = QString::fromLocal8Bit(argv[1]);
const QString outputfile = QString::fromLocal8Bit(argv[2]);
process(inputfile, outputfile);
} catch(const Exception& ex) {
wcout << ex.message().toStdWString() <<endl;
return 1;
}
}