14 return isalnum((
int)
c) ||
c ==
'_' ||
c ==
')' ||
18static inline std::string::size_type
21 std::string::size_type i =
name.size() - 1;
22 bool arr_open =
false;
24 std::string::value_type
c =
name[i];
27 name.substr(i - 4, 5) ==
"const")
31 }
else if (
c ==
']') {
33 }
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] ==
' ')
69 std::string::size_type i =
name.size();
71 if (!isspace(
name[i - 1]))
82 std::string::size_type tmplt_start = cppname.find(
'<');
83 std::string::size_type type_stop = cppname.rfind(
'>');
84 if (cppname.find(
"::", type_stop + 1) !=
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) +
101 std::string clean_name = cppname;
112 std::string
name = cppname.substr(0, i);
115 if (
name.back() ==
']') {
118 }
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);
166 std::string cpd = cleanName.substr(idx, std::string::npos);
169 if (!cpd.empty() && cpd.back() ==
']') {
170 if (cpd.front() ==
'[')
173 std::ostringstream scpd;
174 scpd << cpd.substr(0, cpd.find(
'[')) <<
"[]";
179 if (!cpd.empty() && cpd[0] ==
' ')
180 return cpd.substr(1, cpd.length() - 1);
188 std::string::size_type pos = 0;
189 while ((pos = cppscope.find(
"::", pos)) != std::string::npos) {
190 cppscope.replace(pos, 2,
".");
198 for (
char&
c : cppscope) {
199 for (
char needle : {
':',
'>',
'<',
' ',
',',
'&',
'=',
'*',
'-'})
212 for (std::string::size_type pos =
name.size() - 1; 0 < pos; --pos) {
213 std::string::value_type
c =
name[pos];
218 else if (
c ==
'<' &&
name[pos + 1] !=
'<')
222 else if (tpl_open == 0 &&
c ==
':' &&
name[pos - 1] ==
':') {
224 return name.substr(0, pos - 1);
233std::vector<std::string>
236 std::vector<std::string>
result;
238 if (sig.empty() || sig ==
"()")
242 std::string::size_type start = 1;
243 for (std::string::size_type pos = 1; pos < sig.size() - 1; ++pos) {
244 std::string::value_type
c = sig[pos];
249 else if (
c ==
'<' && sig[pos + 1] !=
'<')
253 else if (tpl_open == 0 &&
c ==
',') {
255 result.push_back(sig.substr(start, pos - start));
261 result.push_back(sig.substr(start, sig.rfind(
")") - start));
270 if (cleanName[cleanName.size() - 1] ==
']') {
271 std::string::size_type idx = cleanName.rfind(
'[');
272 if (idx != std::string::npos) {
273 const std::string asize = cleanName.substr(idx + 1, cleanName.size() - 2);
274 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 extract_namespace(const std::string &name)
std::string remove_const(const std::string &cppname)
std::vector< std::string > extract_arg_types(const std::string &sig)
std::string clean_type(const std::string &cppname, bool template_strip=true, bool const_strip=true)
Py_ssize_t array_size(const std::string &name)
std::string compound(const std::string &name)
void cppscope_to_pyscope(std::string &cppscope)
void cppscope_to_legalname(std::string &cppscope)
std::string template_base(const std::string &cppname)