diff --git a/libwccl/wcclfile.cpp b/libwccl/wcclfile.cpp index 9509c5d329659e3eaaaf9959adcb0b2552d7ea12..377018eac2942fa1233fa489cf27f53188458d86 100644 --- a/libwccl/wcclfile.cpp +++ b/libwccl/wcclfile.cpp @@ -38,6 +38,12 @@ boost::shared_ptr<const TagRuleSequence> WcclFile::get_tag_rules_ptr() const std::ostream& WcclFile::write_to(std::ostream& os) const { + if (has_lexicons()) { + foreach(const Lexicons::map_t::value_type& v, lexicons_->get_lexicons()) { + os << "import(\"" << v.second->file_name() << ", \"" + << v.second->name() << "\")\n"; + } + } foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) { os << s->to_string(tagset_) << '\n'; } diff --git a/libwccl/wcclfile.h b/libwccl/wcclfile.h index 2919b49c5ff142fc56846cf422727c10c0b7cd18..f287a813ba0d4c5cdb5e0e007d3277279526d70a 100644 --- a/libwccl/wcclfile.h +++ b/libwccl/wcclfile.h @@ -77,6 +77,7 @@ public: void import_lexicon(const boost::shared_ptr<Lexicon>& lexicon); bool has_lexicon(const std::string& name) const; + bool has_lexicons() const; boost::shared_ptr<const Lexicon> get_lexicon_ptr(const std::string& name) const; const Lexicon& get_lexicon(const std::string& name) const; boost::shared_ptr<const Lexicons> get_lexicons_ptr() const; @@ -307,6 +308,12 @@ bool WcclFile::has_lexicon(const std::string& name) const return lexicons_->has_lexicon(name); } +inline +bool WcclFile::has_lexicons() const +{ + return lexicons_; +} + inline boost::shared_ptr<const Lexicon> WcclFile::get_lexicon_ptr(const std::string& name) const {