Torc  0.1
server/main.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (C) Mark Kendall 2012-18
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */// Qt
18 
19 #include <QCoreApplication>
20 #include <QThread>
21 
22 // Torc
23 #include "torclocalcontext.h"
24 #include "torcexitcodes.h"
25 #include "torccommandline.h"
26 #include "torcxsdtest.h"
27 
28 int main(int argc, char **argv)
29 {
30  int ret = TORC_EXIT_OK;
31 
32  do
33  {
34  QCoreApplication torc(argc, argv);
35  QCoreApplication::setApplicationName(TORC_REALM);
36  QThread::currentThread()->setObjectName(TORC_MAIN_THREAD);
37 
38  {
39  bool justexit = false;
40  QScopedPointer<TorcCommandLine> cmdline(new TorcCommandLine(TorcCommandLine::Database | TorcCommandLine::LogFile | TorcCommandLine::XSDTest));
41 
42  if (!cmdline.data())
44 
45  ret = cmdline->Evaluate(argc, argv, justexit);
46 
47  if (ret != TORC_EXIT_OK)
48  return ret;
49 
50  if (justexit)
51  return ret;
52 
53  if (!(cmdline.data()->GetValue(QStringLiteral("xsdtest")).toString().isEmpty()))
54  return TorcXSDTest::RunXSDTestSuite(cmdline.data());
55 
56  if (int error = TorcLocalContext::Create(cmdline.data()))
57  return error;
58  }
59 
60  ret = qApp->exec();
62 
63  } while (ret == TORC_EXIT_RESTART);
64 
65  return ret;
66 }
67 
static qint16 Create(TorcCommandLine *CommandLine, bool Init=true)
Torc command line handler.
#define TORC_EXIT_RESTART
Definition: torcexitcodes.h:5
#define TORC_EXIT_UNKOWN_ERROR
Definition: torcexitcodes.h:6
static int RunXSDTestSuite(TorcCommandLine *CommandLine)
Perform XSD test validation of XML files.
Definition: torcxsdtest.cpp:90
int main(int argc, char **argv)
Definition: server/main.cpp:28
static void TearDown(void)
#define TORC_EXIT_OK
Definition: torcexitcodes.h:4
#define TORC_REALM
Definition: torclocaldefs.h:9
#define TORC_MAIN_THREAD
Definition: torclocaldefs.h:10