本文整理汇总了C++中name::to_string方法的典型用法代码示例。如果您正苦于以下问题:C++ name::to_string方法的具体用法?C++ name::to_string怎么用?C++ name::to_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类name
的用法示例。
在下文中一共展示了name::to_string方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize_decl
json serialize_decl(name const & short_name, name const & long_name, environment const & env, options const & o) {
declaration const & d = env.get(long_name);
type_context_old tc(env);
auto fmter = mk_pretty_formatter_factory()(env, o, tc);
expr type = d.get_type();
if (LEAN_COMPLETE_CONSUME_IMPLICIT) {
while (true) {
if (!is_pi(type))
break;
if (!binding_info(type).is_implicit() && !binding_info(type).is_inst_implicit())
break;
std::string q("?");
q += binding_name(type).to_string();
expr m = mk_constant(name(q.c_str()));
type = instantiate(binding_body(type), m);
}
}
json completion;
completion["text"] = short_name.to_string();
interactive_report_type(env, o, type, completion);
add_source_info(env, long_name, completion);
if (auto doc = get_doc_string(env, long_name))
completion["doc"] = *doc;
return completion;
}
示例2: find_file
std::string find_file(search_path const & paths, std::string const & base, optional<unsigned> const & rel, name const & fname,
std::initializer_list<char const *> const & extensions) {
if (!rel) {
return find_file(paths, fname.to_string(get_dir_sep()), extensions);
} else {
auto path = base;
for (unsigned i = 0; i < *rel; i++) {
path += get_dir_sep();
path += "..";
}
for (auto ext : extensions) {
if (auto r = check_file(path, fname.to_string(get_dir_sep()), ext))
return *r;
}
throw lean_file_not_found_exception(fname.to_string());
}
}
示例3: find_file
std::string find_file(std::string const & base, optional<unsigned> const & rel, name const & fname,
std::initializer_list<char const *> const & extensions) {
if (!rel) {
return find_file(fname.to_string(g_sep_str.c_str()), extensions);
} else {
auto path = base;
for (unsigned i = 0; i < *rel; i++) {
path += g_sep;
path += "..";
}
for (auto ext : extensions) {
if (auto r = check_file(path, fname.to_string(g_sep_str.c_str()), ext))
return *r;
}
throw exception(sstream() << "file '" << fname << "' not found at '" << path << "'");
}
}
示例4: get_precedence
static unsigned get_precedence(environment const & env, buffer<token_entry> const & new_tokens, name const & token) {
std::string token_str = token.to_string();
for (auto const & e : new_tokens) {
if (e.m_token == token_str)
return e.m_prec;
}
auto prec = get_expr_precedence(get_token_table(env), token_str.c_str());
if (prec)
return *prec;
else
return 0;
}
示例5: report
virtual void report(io_state_stream const & ios, json & record) const override {
record["full-id"] = m_full_id.to_string();
add_source_info(ios.get_environment(), m_full_id, record);
if (auto doc = get_doc_string(ios.get_environment(), m_full_id))
record["doc"] = *doc;
}
示例6: name_to_file
std::string name_to_file(name const & fname) {
return fname.to_string(get_dir_sep());
}
示例7: name_to_file
std::string name_to_file(name const & fname) {
return fname.to_string(g_sep_str);
}