src/relpipe-in-ods.cpp
branchv_0
changeset 1 e82aaf24b0fe
parent 0 71b902e1c5ee
--- a/src/relpipe-in-ods.cpp	Sun May 14 00:21:14 2023 +0200
+++ b/src/relpipe-in-ods.cpp	Sun May 14 02:13:46 2023 +0200
@@ -1,6 +1,6 @@
 /**
  * Relational pipes
- * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
+ * Copyright © 2023 František Kučera (Frantovo.cz, GlobalCode.info)
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,8 +21,6 @@
 #include <algorithm>
 #include <unistd.h>
 
-#include <libxml++-2.6/libxml++/libxml++.h>
-
 #include <relpipe/writer/RelationalWriter.h>
 #include <relpipe/writer/RelpipeWriterException.h>
 #include <relpipe/writer/Factory.h>
@@ -30,13 +28,11 @@
 
 #include <relpipe/cli/CLI.h>
 
-#include "XMLTableCommand.h"
-#include "CLIParser.h"
-#include "Configuration.h"
+#include "ODSCommand.h"
 
 using namespace relpipe::cli;
 using namespace relpipe::writer;
-using namespace relpipe::in::xmltable;
+using namespace relpipe::in::ods;
 
 int main(int argc, char** argv) {
 	setlocale(LC_ALL, "");
@@ -46,19 +42,14 @@
 	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
 
 	try {
-		CLIParser cliParser;
-		Configuration configuration = cliParser.parse(cli.arguments());
-		XMLCommand command;
-		command.process(cin, cout, configuration);
+		std::shared_ptr<RelationalWriter> writer(Factory::create(cout));
+		ODSCommand command(writer);
+		command.process(cin);
 		resultCode = CLI::EXIT_CODE_SUCCESS;
 	} catch (RelpipeWriterException& e) {
 		fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessage().c_str());
 		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
 		resultCode = CLI::EXIT_CODE_DATA_ERROR;
-	} catch (RelpipeCLIException& e) {
-		fwprintf(stderr, L"Caught CLI exception: %ls\n", e.getMessage().c_str());
-		fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount());
-		resultCode = e.getExitCode();
 	} // TODO: catch xmlpp::exception
 
 	return resultCode;