From c552070230c4ad9c92b516c28658b5c74c57e46b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Jun 2015 18:12:09 +0200 Subject: Outline of parsing and serialization for manifest object model --- tests/manifest/driver.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/manifest/driver.cxx (limited to 'tests/manifest/driver.cxx') diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx new file mode 100644 index 0000000..ff6005c --- /dev/null +++ b/tests/manifest/driver.cxx @@ -0,0 +1,46 @@ +// file : tests/manifest/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include +#include + +#include +#include +#include + +using namespace std; +using namespace bpkg; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " " << endl; + return 1; + } + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1], ifstream::in | ifstream::binary); + + manifest_parser p (ifs, argv[1]); + manifests ms (p); + + manifest_serializer s (cout, "stdout"); + ms.serialize (s); + } + catch (const ios_base::failure&) + { + cerr << "io failure" << endl; + return 1; + } + catch (const std::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} -- cgit v1.1