예제 #1
0
void dehydrator::dehydrate_annotations(const intermediate_model& im,
    const std::string& id, std::ostream& s) const {

    formatters::utility_formatter uf(s);
    bool has_annotations(false);
    const auto& scribble_groups(im.indices().scribble_groups());
    const auto i(scribble_groups.find(id));
    if (i == scribble_groups.end())
        return;

    bool is_first(true);
    const auto scribble(i->second.parent());
    has_annotations = !scribble.entries().empty();
    if (!has_annotations)
        return;

    s << comma_space;
    uf.insert_quoted("annotation");
    s << " : {";

    for (const auto& entry : scribble.entries()) {
        if (!is_first)
            s << ", ";
        uf.insert_quoted(entry.first);
        s << " : ";
        uf.insert_quoted(entry.second);
        is_first = false;
    }
    s << " }";
}
예제 #2
0
std::size_t intermediate_model_hasher::hash(const intermediate_model& v) {
    std::size_t seed(0);

    combine(seed, v.name());
    combine(seed, v.origin_type());
    combine(seed, hash_std_unordered_map_dogen_yarn_name_dogen_yarn_origin_types(v.references()));
    combine(seed, hash_std_unordered_set_dogen_yarn_name(v.leaves()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_module(v.modules()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_concept(v.concepts()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_primitive(v.primitives()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_enumeration(v.enumerations()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_object(v.objects()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_exception(v.exceptions()));
    combine(seed, hash_std_unordered_map_std_string_dogen_yarn_visitor(v.visitors()));
    combine(seed, hash_std_unordered_map_std_string_boost_shared_ptr_dogen_yarn_element(v.injected_elements()));
    combine(seed, v.has_generatable_types());
    combine(seed, v.indices());
    combine(seed, v.root_module());
    combine(seed, v.language());

    return seed;
}