From 5e527213a2430bb3018e5eebd909aef294edf9b5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- examples/cxx/tree/compression/driver.cxx | 124 ------------------------------- 1 file changed, 124 deletions(-) delete mode 100644 examples/cxx/tree/compression/driver.cxx (limited to 'examples/cxx/tree/compression/driver.cxx') diff --git a/examples/cxx/tree/compression/driver.cxx b/examples/cxx/tree/compression/driver.cxx deleted file mode 100644 index 34238b1..0000000 --- a/examples/cxx/tree/compression/driver.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// file : examples/cxx/tree/compression/driver.cxx -// copyright : not copyrighted - public domain - -#include // std::auto_ptr -#include -#include - -#include - -#include "library.hxx" - -#include "compressed-input-source.hxx" -#include "compressed-format-target.hxx" - -using namespace std; - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " library.xml.gz" << endl; - return 1; - } - - int r (0); - - // We need to initialize the Xerces-C++ runtime because we are - // using the Xerces-C++ input/output interfaces. - // - xercesc::XMLPlatformUtils::Initialize (); - - try - { - using namespace library; - - // Read in the XML file and obtain its object model. - // - ifstream ifs; - ifs.exceptions (ifstream::badbit | ifstream::failbit); - ifs.open (argv[1], ifstream::in | ifstream::binary); - - compressed_input_source cis (ifs, compressed_input_source::gzip, argv[1]); - - std::auto_ptr c ( - catalog_ (cis, xml_schema::flags::dont_initialize)); - - - // Let's print what we've got. - // - for (catalog::book_const_iterator bi (c->book ().begin ()); - bi != c->book ().end (); - ++bi) - { - cerr << endl - << "ID : " << bi->id () << endl - << "ISBN : " << bi->isbn () << endl - << "Title : " << bi->title () << endl - << "Genre : " << bi->genre () << endl; - - for (book::author_const_iterator ai (bi->author ().begin ()); - ai != bi->author ().end (); - ++ai) - { - cerr << "Author : " << ai->name () << endl; - cerr << " Born : " << ai->born () << endl; - - if (ai->died ()) - cerr << " Died : " << *ai->died () << endl; - - if (ai->recommends ()) - cerr << " Recommends : " << (*ai->recommends ())->title () << endl; - } - - cerr << "Available : " << std::boolalpha << bi->available () << endl; - } - - // Prepare namespace mapping and schema location information. - // - xml_schema::namespace_infomap map; - - map["lib"].name = "http://www.codesynthesis.com/library"; - map["lib"].schema = "library.xsd"; - - ofstream ofs; - ofs.exceptions (ofstream::badbit | ofstream::failbit | ofstream::eofbit); - ofs.open ("out.xml.gz", ofstream::out | ofstream::binary); - - compressed_format_target cft (ofs, compressed_format_target::gzip); - - // Write it out. - // - catalog_ (cft, *c, map, "UTF-8", xml_schema::flags::dont_initialize); - - // Write out the compression stream trailer. If we don't do this - // explicitly, it will be done automatically in the cft's destructor - // but then any exceptions that might be throws will be ignored. - // - cft.close(); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - r = 1; - } - catch (const compression_failure& e) - { - cerr << "compression failure: " << e.message () << endl; - r = 1; - } - catch (const decompression_failure& e) - { - cerr << "decompression failure: " << e.message () << endl; - r = 1; - } - catch (const ios_base::failure&) - { - cerr << "file open or read/write failure" << endl; - r = 1; - } - - xercesc::XMLPlatformUtils::Terminate (); - return r; -} -- cgit v1.1