xo-reflect: + FunctionTdxInfo::make_canonical_name()
This commit is contained in:
parent
6fc1fff9dc
commit
f4db0eefce
2 changed files with 27 additions and 5 deletions
|
|
@ -148,18 +148,21 @@ namespace xo {
|
|||
return true;
|
||||
}
|
||||
|
||||
/** construct canonical description for this type
|
||||
* will be like
|
||||
* Retval(*)(Arg1,..,Argn)
|
||||
**/
|
||||
std::string make_canonical_name() const;
|
||||
|
||||
public:
|
||||
/** function return value **/
|
||||
TypeDescr retval_td_ = nullptr;
|
||||
/** function arguments, in positional order **/
|
||||
std::vector<TypeDescr> arg_td_v_;
|
||||
/** true iff function promises never to throw **/
|
||||
bool is_noexcept_ = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
}; /*FunctionTdxInfo*/
|
||||
|
||||
namespace xo {
|
||||
namespace reflect {
|
||||
class TypeDescrExtra;
|
||||
|
||||
/* run-time description for a native c++ type */
|
||||
|
|
|
|||
|
|
@ -15,6 +15,25 @@ namespace xo {
|
|||
uint32_t
|
||||
TypeId::s_next_id = 1;
|
||||
|
||||
std::string
|
||||
FunctionTdxInfo::make_canonical_name() const
|
||||
{
|
||||
std::ostringstream ss;
|
||||
|
||||
ss << retval_td_->canonical_name();
|
||||
ss << "(*)(";
|
||||
for (std::size_t i = 0, n = arg_td_v_.size(); i < n; ++i) {
|
||||
if (i > 0)
|
||||
ss << ",";
|
||||
ss << arg_td_v_[i]->canonical_name();
|
||||
}
|
||||
ss << ")";
|
||||
|
||||
return ss.str();
|
||||
} /*make_canonical_name*/
|
||||
|
||||
// ----- TypeDescrBase -----
|
||||
|
||||
std::unordered_map<FunctionTdxInfo, TypeDescrBase*>
|
||||
TypeDescrBase::s_function_type_map;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue