14 return isalnum((
int)
c) ||
c ==
'_' ||
c ==
')' ||
c ==
'(' ;
21 std::string::size_type i =
name.size() - 1;
22 bool arr_open =
false;
24 std::string::value_type
c =
name[i];
30 }
else if (
c ==
']') {
32 }
else if (
c ==
'[') {
46 std::string::size_type spos = std::string::npos;
47 std::string::size_type start = 0;
48 while ((spos =
name.find(
"const", start)) != std::string::npos) {
51 std::string::size_type after = spos+5;
55 }
else if (after ==
name.size()) {
60 std::string::size_type i = 5;
61 while (
name[spos+i] ==
' ') ++i;
69 std::string::size_type i =
name.size();
71 if (!isspace(
name[i-1]))
83 std::string::size_type tmplt_start = cppname.find(
'<');
84 std::string::size_type type_stop = cppname.rfind(
'>');
85 if (cppname.find(
"::", type_stop+1) != std::string::npos)
86 type_stop = cppname.find(
' ', type_stop+1);
87 if (tmplt_start != std::string::npos && cppname[tmplt_start+1] !=
'<') {
89 std::string pre = cppname.substr(0, tmplt_start);
91 std::string post =
"";
92 if (type_stop != std::string::npos && type_stop != cppname.size()-1) {
93 post = cppname.substr(type_stop+1, std::string::npos);
97 return pre + cppname.substr(tmplt_start, type_stop+1-tmplt_start) + post;
100 std::string clean_name = cppname;
107 const std::string& cppname,
bool template_strip,
bool const_strip)
111 std::string
name = cppname.substr(0, i);
114 if (
name.back() ==
']') {
117 }
else if (template_strip &&
name.back() ==
'>') {
135 if (cppname.empty() || cppname.back() !=
'>')
139 for (std::string::size_type pos = cppname.size()-1; 0 < pos; --pos) {
140 std::string::value_type
c = cppname[pos];
145 else if (
c ==
'<' && cppname[pos+1] !=
'<')
149 return cppname.substr(0, pos);
162 const std::string& cpd = cleanName.substr(idx, std::string::npos);
165 if (!cpd.empty() && cpd.back() ==
']') {
166 if (cpd.front() ==
'[')
169 std::ostringstream scpd;
170 scpd << cpd.substr(0, cpd.find(
'[')) <<
"[]";
181 std::string::size_type pos = 0;
182 while ((pos = cppscope.find(
"::", pos)) != std::string::npos) {
183 cppscope.replace(pos, 2,
".");
192 for (
char&
c : cppscope) {
193 for (
char needle : {
':',
'>',
'<',
' ',
',',
'&',
'=',
'*'})
194 if (
c == needle)
c =
'_';
206 for (std::string::size_type pos =
name.size()-1; 0 < pos; --pos) {
207 std::string::value_type
c =
name[pos];
212 else if (
c ==
'<' &&
name[pos+1] !=
'<')
216 else if (tpl_open == 0 &&
c ==
':' &&
name[pos-1] ==
':') {
218 return name.substr(0, pos-1);
230 std::vector<std::string>
result;
232 if (sig.empty() || sig ==
"()")
236 std::string::size_type start = 1;
237 for (std::string::size_type pos = 1; pos < sig.size()-1; ++pos) {
238 std::string::value_type
c = sig[pos];
243 else if (
c ==
'<' && sig[pos+1] !=
'<')
247 else if (tpl_open == 0 &&
c ==
',') {
249 result.push_back(sig.substr(start, pos-start));
255 result.push_back(sig.substr(start, sig.rfind(
")")-start));
265 if (cleanName[cleanName.size()-1] ==
']') {
266 std::string::size_type idx = cleanName.rfind(
'[');
267 if (idx != std::string::npos) {
268 const std::string asize = cleanName.substr(idx+1, cleanName.size()-2);
269 return strtoul(asize.c_str(),
nullptr, 0);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
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)
void cppscope_to_legalname(std::string &cppscope)
std::string template_base(const std::string &cppname)
void cppscope_to_pyscope(std::string &cppscope)
Py_ssize_t array_size(const std::string &name)
std::string clean_type(const std::string &cppname, bool template_strip=true, bool const_strip=true)
std::string compound(const std::string &name)
std::string extract_namespace(const std::string &name)
std::vector< std::string > extract_arg_types(const std::string &sig)