本文整理汇总了C++中intermediate_model::enumerations方法的典型用法代码示例。如果您正苦于以下问题:C++ intermediate_model::enumerations方法的具体用法?C++ intermediate_model::enumerations怎么用?C++ intermediate_model::enumerations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intermediate_model
的用法示例。
在下文中一共展示了intermediate_model::enumerations方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inject_global_module
void containment_expander::inject_global_module(intermediate_model& im) {
BOOST_LOG_SEV(lg, debug) << "Injecting global module for: "
<< im.name().id();
const auto gm(create_global_module(im.origin_type()));
const auto gmn(gm.name());
const auto i(im.modules().find(gmn.id()));
if (i != im.modules().end()) {
const auto id(im.name().id());
BOOST_LOG_SEV(lg, error) << model_already_has_global_module << id;
BOOST_THROW_EXCEPTION(
injection_error(model_already_has_global_module + id));
}
im.modules().insert(std::make_pair(gmn.id(), gm));
add_containing_module_to_non_contained_entities(gmn, im.modules());
add_containing_module_to_non_contained_entities(gmn, im.concepts());
add_containing_module_to_non_contained_entities(gmn, im.primitives());
add_containing_module_to_non_contained_entities(gmn, im.enumerations());
add_containing_module_to_non_contained_entities(gmn, im.objects());
add_containing_module_to_non_contained_entities(gmn, im.exceptions());
add_containing_module_to_non_contained_entities(gmn, im.visitors());
BOOST_LOG_SEV(lg, debug) << "Done injecting global module";
}
示例2: has_elements
bool dehydrator::has_elements(const intermediate_model& im) const {
return
!im.objects().empty() ||
!im.primitives().empty() ||
!im.enumerations().empty() ||
!im.modules().empty();
}
示例3: uf
void dehydrator::
dehydrate_enumerations(const intermediate_model& im, std::ostream& s) const {
using boost::algorithm::join;
formatters::utility_formatter uf(s);
bool output_comma(!im.objects().empty() || !im.concepts().empty() ||
im.modules().empty());
const auto enumerations(to_map(im.enumerations()));
for (const auto& pair : enumerations) {
if (output_comma)
s << comma_space;
const auto& o(pair.second);
s << " { ";
dehydrate_element(im, o, "enumeration", s);
s << comma_space;
/*
* Remove invalid from enumerators.
*/
std::vector<enumerator> enumerators;
enumerators.reserve(o.enumerators().size());
for (const auto& en : o.enumerators()) {
if (en.name() != "invalid")
enumerators.push_back(en);
}
uf.insert_quoted("enumerators");
s << ": [";
bool is_first(true);
for(const auto& en : enumerators) {
if (!is_first)
s << comma_space;
s << " { ";
uf.insert_quoted("simple_name");
s << " : ";
uf.insert_quoted(en.name());
if (!en.documentation().empty()) {
s << comma_space;
uf.insert_quoted("documentation");
s << " : ";
uf.insert_quoted(tidy_up_string(en.documentation()));
}
s << " }";
is_first = false;
}
s << " ]";
s << " }";
output_comma = true;
}
}
示例4: hash
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, v.original_model_name());
combine(seed, v.generation_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, v.is_target());
combine(seed, v.has_generatable_types());
return seed;
}
示例5: inject_global_module
void injector::inject_global_module(intermediate_model& m) {
const auto gm(create_global_module());
const auto gmn(gm.name());
const auto i(m.modules().find(gmn.qualified()));
if (i != m.modules().end()) {
const auto qn(m.name().qualified());
BOOST_LOG_SEV(lg, error) << model_already_has_global_module << qn;
BOOST_THROW_EXCEPTION(injection_error(
model_already_has_global_module + qn));
}
m.modules().insert(std::make_pair(gmn.qualified(), gm));
add_containing_module_to_non_contained_entities(gmn, m.modules());
add_containing_module_to_non_contained_entities(gmn, m.concepts());
add_containing_module_to_non_contained_entities(gmn, m.primitives());
add_containing_module_to_non_contained_entities(gmn, m.enumerations());
add_containing_module_to_non_contained_entities(gmn, m.objects());
add_containing_module_to_non_contained_entities(gmn, m.exceptions());
add_containing_module_to_non_contained_entities(gmn, m.visitors());
}
示例6: elements_traversal
inline void elements_traversal(intermediate_model& m, TraversalVisitor& v) {
for (auto& pair : m.modules())
v(pair.second);
for (auto& pair : m.concepts())
v(pair.second);
for (auto& pair : m.primitives())
v(pair.second);
for (auto& pair : m.enumerations())
v(pair.second);
for (auto& pair : m.objects())
v(pair.second);
for (auto& pair : m.exceptions())
v(pair.second);
for (auto& pair : m.visitors())
v(pair.second);
}
示例7: hash
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;
}