Beautify director output

This commit is contained in:
William S Fulton 2013-12-23 18:21:52 +00:00
commit 279ebdc0cf
4 changed files with 39 additions and 37 deletions

View file

@ -33,8 +33,8 @@
namespace Swig {
class Director;
SWIGINTERN std::map<void*,Director*>& get_rtdir_map() {
static std::map<void*,Director*> rtdir_map;
SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
static std::map<void *, Director *> rtdir_map;
return rtdir_map;
}
@ -43,15 +43,15 @@ namespace Swig {
}
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
std::map<void*,Director*>::const_iterator pos = get_rtdir_map().find(vptr);
std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
return rtdir;
}
}
# endif /* SWIG_DIRECTOR_RTDIR */
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void*>(ARG))
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void*>(ARG1), ARG2)
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
#else
@ -293,16 +293,16 @@ namespace Swig {
}
/* methods to implement pseudo protected director members */
virtual bool swig_get_inner(const char* /* swig_protected_method_name */) const {
virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const {
return true;
}
virtual void swig_set_inner(const char* /* swig_protected_method_name */, bool /* swig_val */) const {
virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const {
}
/* ownership management */
private:
typedef std::map<void*, GCItem_var> swig_ownership_map;
typedef std::map<void *, GCItem_var> swig_ownership_map;
mutable swig_ownership_map swig_owner;
public:

View file

@ -68,8 +68,8 @@
namespace Swig {
class Director;
SWIGINTERN std::map<void*,Director*>& get_rtdir_map() {
static std::map<void*,Director*> rtdir_map;
SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
static std::map<void *, Director *> rtdir_map;
return rtdir_map;
}
@ -78,15 +78,15 @@ namespace Swig {
}
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
std::map<void*,Director*>::const_iterator pos = get_rtdir_map().find(vptr);
std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
return rtdir;
}
}
# endif /* SWIG_DIRECTOR_RTDIR */
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void*>(ARG))
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void*>(ARG1), ARG2)
# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
#else
@ -196,7 +196,7 @@ namespace Swig {
protected:
std::string swig_msg;
public:
DirectorException(PyObject *error, const char* hdr ="", const char* msg ="")
DirectorException(PyObject *error, const char *hdr ="", const char *msg ="")
: swig_msg(hdr)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
@ -272,12 +272,12 @@ namespace Swig {
/* type mismatch in the return value from a python method call */
class DirectorTypeMismatchException : public Swig::DirectorException {
public:
DirectorTypeMismatchException(PyObject *error, const char* msg="")
DirectorTypeMismatchException(PyObject *error, const char *msg="")
: Swig::DirectorException(error, "SWIG director type mismatch", msg)
{
}
DirectorTypeMismatchException(const char* msg="")
DirectorTypeMismatchException(const char *msg="")
: Swig::DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg)
{
}
@ -296,7 +296,7 @@ namespace Swig {
/* any python exception that occurs during a director method call */
class DirectorMethodException : public Swig::DirectorException {
public:
DirectorMethodException(const char* msg = "")
DirectorMethodException(const char *msg = "")
: DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg)
{
}
@ -311,7 +311,7 @@ namespace Swig {
class DirectorPureVirtualException : public Swig::DirectorException
{
public:
DirectorPureVirtualException(const char* msg = "")
DirectorPureVirtualException(const char *msg = "")
: DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg)
{
}
@ -356,7 +356,7 @@ namespace Swig {
class Director {
private:
/* pointer to the wrapped python object */
PyObject* swig_self;
PyObject *swig_self;
/* flag indicating whether the object is owned by python or c++ */
mutable bool swig_disown_flag;
@ -371,7 +371,7 @@ namespace Swig {
public:
/* wrap a python object, optionally taking ownership */
Director(PyObject* self) : swig_self(self), swig_disown_flag(false) {
Director(PyObject *self) : swig_self(self), swig_disown_flag(false) {
swig_incref();
}
@ -404,16 +404,16 @@ namespace Swig {
}
/* methods to implement pseudo protected director members */
virtual bool swig_get_inner(const char* /* swig_protected_method_name */) const {
virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const {
return true;
}
virtual void swig_set_inner(const char* /* swig_protected_method_name */, bool /* swig_val */) const {
virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const {
}
/* ownership management */
private:
typedef std::map<void*, GCItem_var> swig_ownership_map;
typedef std::map<void *, GCItem_var> swig_ownership_map;
mutable swig_ownership_map swig_owner;
#ifdef __THREAD__
static PyThread_type_lock swig_mutex_own;
@ -461,7 +461,7 @@ namespace Swig {
}
template <typename Type>
static PyObject* swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
static PyObject *swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
{
SwigPyObject *sobj = (SwigPyObject *)pyobj;
sobj->own = 0;

View file

@ -1988,16 +1988,17 @@ public:
But for now, this seems to be the least intrusive way.
*/
Printf(f_directors_h, "\n\n");
Printf(f_directors_h, "/* Internal Director utilities */\n");
Printf(f_directors_h, "\n");
Printf(f_directors_h, "/* Internal director utilities */\n");
Printf(f_directors_h, "public:\n");
Printf(f_directors_h, " bool swig_get_inner(const char* swig_protected_method_name) const {\n");
Printf(f_directors_h, " bool swig_get_inner(const char *swig_protected_method_name) const {\n");
Printf(f_directors_h, " std::map<std::string, bool>::const_iterator iv = swig_inner.find(swig_protected_method_name);\n");
Printf(f_directors_h, " return (iv != swig_inner.end() ? iv->second : false);\n");
Printf(f_directors_h, " }\n\n");
Printf(f_directors_h, " }\n");
Printf(f_directors_h, " void swig_set_inner(const char* swig_protected_method_name, bool val) const\n");
Printf(f_directors_h, " { swig_inner[swig_protected_method_name] = val;}\n\n");
Printf(f_directors_h, " void swig_set_inner(const char *swig_protected_method_name, bool val) const {\n");
Printf(f_directors_h, " swig_inner[swig_protected_method_name] = val;\n");
Printf(f_directors_h, " }\n");
Printf(f_directors_h, "private:\n");
Printf(f_directors_h, " mutable std::map<std::string, bool> swig_inner;\n");
}

View file

@ -3074,22 +3074,23 @@ public:
But for now, this seems to be the least intrusive way.
*/
Printf(f_directors_h, "\n\n");
Printf(f_directors_h, "/* Internal Director utilities */\n");
Printf(f_directors_h, "\n");
Printf(f_directors_h, "/* Internal director utilities */\n");
Printf(f_directors_h, "public:\n");
Printf(f_directors_h, " bool swig_get_inner(const char* swig_protected_method_name) const {\n");
Printf(f_directors_h, " bool swig_get_inner(const char *swig_protected_method_name) const {\n");
Printf(f_directors_h, " std::map<std::string, bool>::const_iterator iv = swig_inner.find(swig_protected_method_name);\n");
Printf(f_directors_h, " return (iv != swig_inner.end() ? iv->second : false);\n");
Printf(f_directors_h, " }\n\n");
Printf(f_directors_h, " }\n");
Printf(f_directors_h, " void swig_set_inner(const char* swig_protected_method_name, bool val) const\n");
Printf(f_directors_h, " { swig_inner[swig_protected_method_name] = val;}\n\n");
Printf(f_directors_h, " void swig_set_inner(const char *swig_protected_method_name, bool val) const {\n");
Printf(f_directors_h, " swig_inner[swig_protected_method_name] = val;\n");
Printf(f_directors_h, " }\n");
Printf(f_directors_h, "private:\n");
Printf(f_directors_h, " mutable std::map<std::string, bool> swig_inner;\n");
}
if (director_method_index) {
Printf(f_directors_h, "\n\n");
Printf(f_directors_h, "\n");
Printf(f_directors_h, "#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)\n");
Printf(f_directors_h, "/* VTable implementation */\n");
Printf(f_directors_h, " PyObject *swig_get_method(size_t method_index, const char *method_name) const {\n");