void extractor::recurse_nested_qnames(const sml::nested_qname& nqn, relationships& rel, bool& is_pointer) const { const auto qn(nqn.type()); if (is_pointer) rel.forward_decls().insert(qn); else rel.names().insert(qn); bool found(false); const auto i(model_.primitives().find(qn)); if (i != model_.primitives().end()) { found = true; is_pointer = false; } if (!found) { const auto j(model_.enumerations().find(qn)); if (j != model_.enumerations().end()) { is_pointer = false; found = true; } } if (!found) { const auto k(model_.objects().find(qn)); if (k == model_.objects().end()) { BOOST_LOG_SEV(lg, error) << qname_could_not_be_found << qn; BOOST_THROW_EXCEPTION(extraction_error(qname_could_not_be_found + boost::lexical_cast<std::string>(qn))); } using sml::value_object; const auto vo(boost::dynamic_pointer_cast<value_object>(k->second)); if (vo) { const auto ac(sml::value_object_types::associative_container); if (vo->type() == ac && nqn.children().size() >= 1) rel.keys().insert(nqn.children().front().type()); const auto sp(sml::value_object_types::smart_pointer); is_pointer = vo->type() == sp; } } const auto sn(qn.simple_name()); if (sn == bool_type || sn == double_type || sn == float_type) rel.requires_stream_manipulators(true); else if (sn == std_.type(std_types::string)) rel.has_std_string(true); else if (sn == boost_.type(boost_types::variant)) rel.has_variant(true); else if (sn == std_.type(std_types::pair)) rel.has_std_pair(true); for (const auto c : nqn.children()) recurse_nested_qnames(c, rel, is_pointer); }
void transformer:: update_model_references(const sml::nested_qname& nqn) { const auto mn(nqn.type().model_name()); const bool is_primitives_model(mn.empty()); const bool is_current_model(mn != context_.model().name().model_name()); if (!is_primitives_model && is_current_model) { sml::qname qn; qn.model_name(mn); const auto p(std::make_pair(qn, sml::origin_types::unknown)); context_.model().references().insert(p); BOOST_LOG_SEV(lg, debug) << "Adding model dependency: " << mn << ". Current model: " << context_.model().name().model_name(); } for (const auto c : nqn.children()) update_model_references(c); }