From 930fb98d267c6c82150f0e7069a76f30064de1b4 Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(win7-laptop)> Date: Thu, 9 Feb 2012 10:23:08 +0100 Subject: [PATCH] Conditional poliqarp build. --- libcorpus2_whole/io/documentreader.cpp | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/libcorpus2_whole/io/documentreader.cpp b/libcorpus2_whole/io/documentreader.cpp index df651de..e335a8d 100644 --- a/libcorpus2_whole/io/documentreader.cpp +++ b/libcorpus2_whole/io/documentreader.cpp @@ -17,8 +17,9 @@ or FITNESS FOR A PARTICULAR PURPOSE. #include <libcorpus2_whole/io/documentreader.h> #include <libcorpus2_whole/io/cclrelreader.h> +#ifdef WITH_POLIQARP #include <libcorpus2_whole/io/poliqarpdocumentreader.h> - +#endif namespace Corpus2 { @@ -27,33 +28,34 @@ namespace whole{ DocumentReader::DocumentReader(const Tagset& tagset, const std::string& corpus_type, const std::string& corpus_file_path) : corpus_type_(corpus_type), tagset_(tagset), corpus_path_(corpus_file_path) { - if (corpus_type_ == "poliqarp") { - reader = boost::shared_ptr<PoliqarpDocumentReader>( - new PoliqarpDocumentReader(tagset_, corpus_path_)); - } - else if (corpus_type_ == "document") { + if (corpus_type_ == "document") { corpus_file.open(corpus_file_path.c_str()); - } - else { +#ifdef WITH_POLIQARP + } else if (corpus_type_ == "poliqarp") { + reader = boost::shared_ptr<PoliqarpDocumentReader>( + new PoliqarpDocumentReader(tagset_, corpus_path_)); +#endif + } else { throw Corpus2Error(corpus_type_ + " is an unknown reader type!"); } } boost::shared_ptr<Document> DocumentReader::read() { - std::string line; +#ifdef WITH_POLIQARP if (corpus_type_ == "poliqarp") { return this->reader->read(); } +#endif if (corpus_type_ == "document") { if (std::getline(corpus_file, line)) { return get_cclrel_reader(line)->read(); - } - else { + } else { return boost::make_shared<Document>("End"); } } + throw Corpus2Error(corpus_type_ + " is an unknown reader type!"); } @@ -77,9 +79,6 @@ boost::shared_ptr<DocumentReaderI> DocumentReader::get_cclrel_reader(std::string return boost::shared_ptr<CclRelReader>( new CclRelReader(tagset_, ann_path, rel_path)); - - - } -- GitLab