12 return isalnum((
int)
c) ||
c ==
'_' ||
c ==
')' ||
c ==
'(' ;
19 std::string::size_type i =
name.size() - 1;
21 std::string::value_type
c =
name[i];
36 std::string::size_type spos = std::string::npos;
37 std::string::size_type start = 0;
38 while ((spos =
name.find(
"const", start)) != std::string::npos) {
41 std::string::size_type after = spos+5;
45 }
else if (after ==
name.size()) {
50 std::string::size_type i = 5;
51 while (
name[spos+i] ==
' ') ++i;
59 std::string::size_type i =
name.size();
61 if (!isspace(
name[i]))
74 std::string::size_type tmplt_start = cppname.find(
'<');
75 std::string::size_type type_stop = cppname.rfind(
'>');
76 if (cppname.find(
"::", type_stop+1) != std::string::npos)
77 type_stop = cppname.find(
' ', type_stop+1);
78 if (tmplt_start != std::string::npos) {
80 std::string pre = cppname.substr(0, tmplt_start);
82 std::string post =
"";
83 if (type_stop != std::string::npos) {
84 post = cppname.substr(type_stop+1, std::string::npos);
88 type_stop = type_stop == std::string::npos ? std::string::npos : type_stop+1;
89 return pre + cppname.substr(tmplt_start, type_stop) + post;
92 std::string clean_name = cppname;
99 const std::string& cppname,
bool template_strip,
bool const_strip)
103 std::string
name = cppname.substr(0, i);
106 if (
name.back() ==
']') {
109 }
else if (template_strip &&
name.back() ==
'>') {
127 if (cppname.empty() || cppname.back() !=
'>')
131 for (std::string::size_type pos = cppname.size()-1; 0 < pos; --pos) {
132 std::string::value_type
c = cppname[pos];
141 return cppname.substr(0, pos);
151 std::string::size_type pos = 0;
152 while ((pos = cppscope.find(
"::", pos)) != std::string::npos) {
153 cppscope.replace(pos, 2,
".");
166 for (std::string::size_type pos =
name.size()-1; 0 < pos; --pos) {
167 std::string::value_type
c =
name[pos];
176 else if (tpl_open == 0 &&
c ==
':' &&
name[pos-1] ==
':') {
178 return name.substr(0, pos-1);
190 std::vector<std::string> result;
192 if (sig.empty() || sig ==
"()")
196 std::string::size_type start = 1;
197 for (std::string::size_type pos = 1; pos < sig.size()-1; ++pos) {
198 std::string::value_type
c = sig[pos];
207 else if (tpl_open == 0 &&
c ==
',') {
209 result.push_back(sig.substr(start, pos-start));
215 result.push_back(sig.substr(start, sig.rfind(
")")-start));
static void rstrip(std::string &name)
static std::string::size_type find_qualifier_index(const std::string &name)
static void erase_const(std::string &name)
static bool is_varchar(char c)
std::string remove_const(const std::string &cppname)
std::string template_base(const std::string &cppname)
void cppscope_to_pyscope(std::string &cppscope)
std::string clean_type(const std::string &cppname, bool template_strip=true, bool const_strip=true)
std::string extract_namespace(const std::string &name)
std::vector< std::string > extract_arg_types(const std::string &sig)