From 92460adce6a793aa3ef56b243077ba82c1cf7c16 Mon Sep 17 00:00:00 2001 From: Nikolay Mladenov Date: Tue, 18 Sep 2007 17:28:23 +0000 Subject: [PATCH] tabs removes, code reformatting [SVN r39370] --- src/object/function.cpp | 2 +- src/object/function_doc_signature.cpp | 67 +++++++++++++++------------ 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/object/function.cpp b/src/object/function.cpp index bf520793..dd65e125 100644 --- a/src/object/function.cpp +++ b/src/object/function.cpp @@ -628,7 +628,7 @@ extern "C" { function* f = downcast(op); list signatures = function_doc_signature_generator::function_doc_signatures(f); - if(!signatures) return python::detail::none(); + if(!signatures) return python::detail::none(); signatures.reverse(); return python::incref( str("\n").join(signatures).ptr()); } diff --git a/src/object/function_doc_signature.cpp b/src/object/function_doc_signature.cpp index 26645fb1..49f2c350 100755 --- a/src/object/function_doc_signature.cpp +++ b/src/object/function_doc_signature.cpp @@ -278,45 +278,53 @@ namespace boost { namespace python { namespace objects { for (fi=funcs.begin(); fi!=funcs.end(); ++fi) { if(*sfi == *fi){ - if((*fi)->doc()){ + if((*fi)->doc()) + { str func_doc = str((*fi)->doc()); - int doc_len = len(func_doc); - bool show_py_signature = doc_len >=int(sizeof(detail::py_signature_tag)/sizeof(char)-1) - && str(detail::py_signature_tag)==func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1); - if(show_py_signature){ - func_doc = str(func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1, _)); - doc_len = len(func_doc); - } - - bool show_cpp_signature = doc_len >=int(sizeof(detail::cpp_signature_tag)/sizeof(char)-1) - && str(detail::cpp_signature_tag)==func_doc.slice(- int(sizeof(detail::cpp_signature_tag)/sizeof(char))+1, _); - if(show_cpp_signature){ - func_doc = str(func_doc.slice(_, 1 - int(sizeof(detail::cpp_signature_tag)/sizeof(char)))); - doc_len = len(func_doc); - } - + int doc_len = len(func_doc); + + bool show_py_signature = doc_len >= int(sizeof(detail::py_signature_tag)/sizeof(char)-1) + && str(detail::py_signature_tag) == func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1); + if(show_py_signature) + { + func_doc = str(func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1, _)); + doc_len = len(func_doc); + } + + bool show_cpp_signature = doc_len >= int(sizeof(detail::cpp_signature_tag)/sizeof(char)-1) + && str(detail::cpp_signature_tag) == func_doc.slice( 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char)), _); + + if(show_cpp_signature) + { + func_doc = str(func_doc.slice(_, 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char)))); + doc_len = len(func_doc); + } + str res="\n"; - str pad = "\n"; + str pad = "\n"; + if(show_py_signature) { str sig = pretty_signature(*fi, n_overloads,false); res+=sig; - if(doc_len || show_cpp_signature )res+=" :"; - pad+= str(" "); + if(doc_len || show_cpp_signature )res+=" :"; + pad+= str(" "); + } + + if(doc_len) + { + if(show_py_signature) + res+=pad; + res+= pad.join(func_doc.split("\n")); } - - if(doc_len){ - if(show_py_signature) - res+=pad; - res+= pad.join(func_doc.split("\n")); - } - if( show_cpp_signature){ - if(len(res)>1) - res+="\n"+pad; + if( show_cpp_signature) + { + if(len(res)>1) + res+="\n"+pad; res+=detail::cpp_signature_tag+pad+" "+pretty_signature(*fi, n_overloads,true); - } + } signatures.append(res); } @@ -325,6 +333,7 @@ namespace boost { namespace python { namespace objects { }else ++n_overloads ; } + return signatures; }