Skip to content

Commit c00ebf4

Browse files
committed
Replace NULL with nullptr
1 parent 8e69c65 commit c00ebf4

30 files changed

+860
-868
lines changed

src/PythonQt.cpp

+79-80
Large diffs are not rendered by default.

src/PythonQt.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ template<class T1, class T2> int PythonQtUpcastingOffset() {
144144
typedef QObject* PythonQtQObjectCreatorFunctionCB();
145145

146146
//! helper template to create a derived QObject class
147-
template<class T> QObject* PythonQtCreateObject() { return new T(); };
147+
template<class T> QObject* PythonQtCreateObject() { return new T(); }
148148

149149
//! Helper define to convert from QString to Python C-API
150150
#ifdef PY3K
@@ -260,7 +260,7 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
260260

261261
//! Overwrite default handling of stdin using a custom callback. It internally backup
262262
//! the original 'sys.stdin' into 'sys.pythonqt_original_stdin'
263-
void setRedirectStdInCallback(PythonQtInputChangedCB* callback, void * callbackData = 0);
263+
void setRedirectStdInCallback(PythonQtInputChangedCB* callback, void * callbackData = nullptr);
264264

265265
//! Enable or disable stdin custom callback. It resets 'sys.stdin' using either 'sys.pythonqt_stdin'
266266
//! or 'sys.pythonqt_original_stdin'
@@ -319,7 +319,7 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
319319
//! registers a QObject derived class to PythonQt (this is implicitly called by addObject as well)
320320
/* Since Qt4 does not offer a way to detect if a given classname is derived from QObject and thus has a QMetaObject,
321321
you MUST register all your QObject derived classes here when you want them to be detected in signal and slot calls */
322-
void registerClass(const QMetaObject* metaobject, const char* package = NULL, PythonQtQObjectCreatorFunctionCB* wrapperCreator = NULL, PythonQtShellSetInstanceWrapperCB* shell = NULL);
322+
void registerClass(const QMetaObject* metaobject, const char* package = nullptr, PythonQtQObjectCreatorFunctionCB* wrapperCreator = nullptr, PythonQtShellSetInstanceWrapperCB* shell = nullptr);
323323

324324
//! add a wrapper object for the given QMetaType typeName, also does an addClassDecorators() to add constructors for variants
325325
//! (ownership of wrapper is passed to PythonQt)
@@ -329,7 +329,7 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
329329
All slots that take a pointer to typeName as the first argument will be callable from Python on
330330
a variant object that contains such a type.
331331
*/
332-
void registerCPPClass(const char* typeName, const char* parentTypeName = NULL, const char* package = NULL, PythonQtQObjectCreatorFunctionCB* wrapperCreator = NULL, PythonQtShellSetInstanceWrapperCB* shell = NULL);
332+
void registerCPPClass(const char* typeName, const char* parentTypeName = nullptr, const char* package = nullptr, PythonQtQObjectCreatorFunctionCB* wrapperCreator = nullptr, PythonQtShellSetInstanceWrapperCB* shell = nullptr);
333333

334334
//! as an alternative to registerClass, you can tell PythonQt the names of QObject derived classes
335335
//! and it will register the classes when it first sees a pointer to such a derived class
@@ -365,7 +365,7 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
365365

366366
//! evaluates the given script code and returns the result value
367367
QVariant evalScript(PyObject* object, const QString& script, int start = Py_file_input);
368-
368+
369369
//! evaluates the given script code in context of given globals and locals and returns the result value
370370
QVariant evalScript(const QString& script, PyObject* globals, PyObject* locals, int start);
371371

@@ -536,7 +536,7 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
536536
//! the default importer allows to import files from anywhere QFile can read from,
537537
//! including the Qt resource system using ":". Keep in mind that you need to extend
538538
//! "sys.path" with ":" to be able to import from the Qt resources.
539-
void installDefaultImporter() { setImporter(NULL); }
539+
void installDefaultImporter() { setImporter(nullptr); }
540540

541541
//! set paths that the importer should ignore
542542
void setImporterIgnorePaths(const QStringList& paths);
@@ -719,7 +719,7 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
719719
//! registers a QObject derived class to PythonQt (this is implicitly called by addObject as well)
720720
/* Since Qt4 does not offer a way to detect if a given classname is derived from QObject and thus has a QMetaObject,
721721
you MUST register all your QObject derived classes here when you want them to be detected in signal and slot calls */
722-
void registerClass(const QMetaObject* metaobject, const char* package = NULL, PythonQtQObjectCreatorFunctionCB* wrapperCreator = NULL, PythonQtShellSetInstanceWrapperCB* shell = NULL, PyObject* module = NULL, int typeSlots = 0);
722+
void registerClass(const QMetaObject* metaobject, const char* package = nullptr, PythonQtQObjectCreatorFunctionCB* wrapperCreator = nullptr, PythonQtShellSetInstanceWrapperCB* shell = nullptr, PyObject* module = nullptr, int typeSlots = 0);
723723

724724
//! add a wrapper object for the given QMetaType typeName, also does an addClassDecorators() to add constructors for variants
725725
//! (ownership of wrapper is passed to PythonQt)
@@ -729,7 +729,7 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
729729
All slots that take a pointer to typeName as the first argument will be callable from Python on
730730
a variant object that contains such a type.
731731
*/
732-
void registerCPPClass(const char* typeName, const char* parentTypeName = NULL, const char* package = NULL, PythonQtQObjectCreatorFunctionCB* wrapperCreator = NULL, PythonQtShellSetInstanceWrapperCB* shell = NULL, PyObject* module = NULL, int typeSlots = 0);
732+
void registerCPPClass(const char* typeName, const char* parentTypeName = nullptr, const char* package = nullptr, PythonQtQObjectCreatorFunctionCB* wrapperCreator = nullptr, PythonQtShellSetInstanceWrapperCB* shell = nullptr, PyObject* module = nullptr, int typeSlots = 0);
733733

734734
//! as an alternative to registerClass, you can tell PythonQt the names of QObject derived classes
735735
//! and it will register the classes when it first sees a pointer to such a derived class
@@ -748,7 +748,7 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
748748
static PyObject* createNewPythonQtEnumWrapper(const char* enumName, PyObject* parentObject);
749749

750750
//! helper method that creates a PythonQtInstanceWrapper object and registers it in the object map
751-
PythonQtInstanceWrapper* createNewPythonQtInstanceWrapper(QObject* obj, PythonQtClassInfo* info, void* wrappedPtr = NULL);
751+
PythonQtInstanceWrapper* createNewPythonQtInstanceWrapper(QObject* obj, PythonQtClassInfo* info, void* wrappedPtr = nullptr);
752752

753753
//! get the class info for a meta object (if available)
754754
PythonQtClassInfo* getClassInfo(const QMetaObject* meta);
@@ -787,13 +787,13 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
787787
//! get the dynamic meta object for the given wrapper. It will contain the signals/slots that have been added in Python
788788
const QMetaObject* getDynamicMetaObject(PythonQtInstanceWrapper* wrapper, const QMetaObject* prototypeMetaObject);
789789

790-
//! recursively creates the dynamic meta object chain down to the Qt class wrapper.
790+
//! recursively creates the dynamic meta object chain down to the Qt class wrapper.
791791
const QMetaObject* setupDynamicMetaObjectChain(PythonQtClassWrapper* type, const QMetaObject* prototypeMetaObject);
792792

793793
//! builds and returns the dynamic meta object for the given type, derived from prototypeMetaObject.
794794
const QMetaObject* buildDynamicMetaObject(PythonQtClassWrapper* type, const QMetaObject* prototypeMetaObject);
795795

796-
//! redirected from shell classes, tries to call the given meta call on the Python wrapper.
796+
//! redirected from shell classes, tries to call the given meta call on the Python wrapper.
797797
int handleMetaCall(QObject* object, PythonQtInstanceWrapper* wrapper, QMetaObject::Call call, int id, void** args);
798798

799799
//! calls the given method on Python function with same name.
@@ -804,7 +804,7 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
804804
void setupSharedLibrarySuffixes();
805805

806806
//! create a new pythonqt class wrapper and place it in the pythonqt module
807-
void createPythonQtClassWrapper(PythonQtClassInfo* info, const char* package, PyObject* module = NULL);
807+
void createPythonQtClassWrapper(PythonQtClassInfo* info, const char* package, PyObject* module = nullptr);
808808

809809
//! get/create new package module (the returned object is a borrowed reference)
810810
PyObject* packageByName(const char* name);

src/PythonQtBoolResult.cpp

+67-67
Original file line numberDiff line numberDiff line change
@@ -66,54 +66,54 @@ static int PythonQtBoolResult_nonzero(PyObject *obj)
6666

6767
// we override nb_nonzero, so that one can do 'if' expressions to test for a NULL ptr
6868
static PyNumberMethods PythonQtBoolResult_as_number = {
69-
0, /* nb_add */
70-
0, /* nb_subtract */
71-
0, /* nb_multiply */
69+
nullptr, /* nb_add */
70+
nullptr, /* nb_subtract */
71+
nullptr, /* nb_multiply */
7272
#ifndef PY3K
73-
0, /* nb_divide */
73+
nullptr, /* nb_divide */
7474
#endif
75-
0, /* nb_remainder */
76-
0, /* nb_divmod */
77-
0, /* nb_power */
78-
0, /* nb_negative */
79-
0, /* nb_positive */
80-
0, /* nb_absolute */
75+
nullptr, /* nb_remainder */
76+
nullptr, /* nb_divmod */
77+
nullptr, /* nb_power */
78+
nullptr, /* nb_negative */
79+
nullptr, /* nb_positive */
80+
nullptr, /* nb_absolute */
8181
PythonQtBoolResult_nonzero, /* nb_nonzero / nb_bool in Py3K */
82-
0, /* nb_invert */
83-
0, /* nb_lshift */
84-
0, /* nb_rshift */
85-
0, /* nb_and */
86-
0, /* nb_xor */
87-
0, /* nb_or */
88-
#ifndef PY3K
89-
0, /* nb_coerce */
82+
nullptr, /* nb_invert */
83+
nullptr, /* nb_lshift */
84+
nullptr, /* nb_rshift */
85+
nullptr, /* nb_and */
86+
nullptr, /* nb_xor */
87+
nullptr, /* nb_or */
88+
#ifndef PY3K
89+
nullptr, /* nb_coerce */
9090
#endif
91-
0, /* nb_int */
92-
0, /* nb_long / nb_reserved in Py3K */
93-
0, /* nb_float */
91+
nullptr, /* nb_int */
92+
nullptr, /* nb_long / nb_reserved in Py3K */
93+
nullptr, /* nb_float */
9494
#ifndef PY3K
95-
0, /* nb_oct */
96-
0, /* nb_hex */
95+
nullptr, /* nb_oct */
96+
nullptr, /* nb_hex */
9797
#endif
98-
0, /* nb_inplace_add */
99-
0, /* nb_inplace_subtract */
100-
0, /* nb_inplace_multiply */
98+
nullptr, /* nb_inplace_add */
99+
nullptr, /* nb_inplace_subtract */
100+
nullptr, /* nb_inplace_multiply */
101101
#ifndef PY3K
102-
0, /* nb_inplace_divide */
102+
nullptr, /* nb_inplace_divide */
103103
#endif
104-
0, /* nb_inplace_remainder */
105-
0, /* nb_inplace_power */
106-
0, /* nb_inplace_lshift */
107-
0, /* nb_inplace_rshift */
108-
0, /* nb_inplace_and */
109-
0, /* nb_inplace_xor */
110-
0, /* nb_inplace_or */
111-
0, /* nb_floor_divide */
112-
0, /* nb_true_divide */
113-
0, /* nb_inplace_floor_divide */
114-
0, /* nb_inplace_true_divide */
104+
nullptr, /* nb_inplace_remainder */
105+
nullptr, /* nb_inplace_power */
106+
nullptr, /* nb_inplace_lshift */
107+
nullptr, /* nb_inplace_rshift */
108+
nullptr, /* nb_inplace_and */
109+
nullptr, /* nb_inplace_xor */
110+
nullptr, /* nb_inplace_or */
111+
nullptr, /* nb_floor_divide */
112+
nullptr, /* nb_true_divide */
113+
nullptr, /* nb_inplace_floor_divide */
114+
nullptr, /* nb_inplace_true_divide */
115115
#ifdef PY3K
116-
0, /* nb_index in Py3K */
116+
nullptr, /* nb_index in Py3K */
117117
#endif
118118
};
119119

@@ -122,37 +122,37 @@ PyTypeObject PythonQtBoolResult_Type = {
122122
"BoolResult",
123123
sizeof(PythonQtBoolResultObject),
124124
0,
125-
0, /* tp_dealloc */
126-
0, /* tp_print */
127-
0, /* tp_getattr */
128-
0, /* tp_setattr */
129-
0,
125+
nullptr, /* tp_dealloc */
126+
0, /* tp_vectorcall_offset */
127+
nullptr, /* tp_getattr */
128+
nullptr, /* tp_setattr */
129+
nullptr,
130130
(reprfunc)PythonQtBoolResult_repr, /* tp_repr */
131131
&PythonQtBoolResult_as_number, /* tp_as_number */
132-
0, /* tp_as_sequence */
133-
0, /* tp_as_mapping */
134-
0, /* tp_hash */
135-
0, /* tp_call */
136-
0, /* tp_str */
137-
0, /* tp_getattro */
138-
0, /* tp_setattro */
139-
0, /* tp_as_buffer */
132+
nullptr, /* tp_as_sequence */
133+
nullptr, /* tp_as_mapping */
134+
nullptr, /* tp_hash */
135+
nullptr, /* tp_call */
136+
nullptr, /* tp_str */
137+
nullptr, /* tp_getattro */
138+
nullptr, /* tp_setattro */
139+
nullptr, /* tp_as_buffer */
140140
Py_TPFLAGS_DEFAULT,/* tp_flags */
141-
"Result object that is useful for bool* arguments", /* tp_doc */
142-
0, /* tp_traverse */
143-
0, /* tp_clear */
144-
0, /* tp_richcompare */
145-
0, /* tp_weaklistoffset */
146-
0, /* tp_iter */
147-
0, /* tp_iternext */
148-
0, /* tp_methods */
149-
0, /* tp_members */
150-
0, /* tp_getset */
151-
0, /* tp_base */
152-
0, /* tp_dict */
153-
0, /* tp_descr_get */
154-
0, /* tp_descr_set */
155-
0, /* tp_dictoffset */
141+
"Result object that is useful for bool* arguments", /* tp_doc */
142+
nullptr, /* tp_traverse */
143+
nullptr, /* tp_clear */
144+
nullptr, /* tp_richcompare */
145+
0, /* tp_weaklistoffset */
146+
nullptr, /* tp_iter */
147+
nullptr, /* tp_iternext */
148+
nullptr, /* tp_methods */
149+
nullptr, /* tp_members */
150+
nullptr, /* tp_getset */
151+
nullptr, /* tp_base */
152+
nullptr, /* tp_dict */
153+
nullptr, /* tp_descr_get */
154+
nullptr, /* tp_descr_set */
155+
0, /* tp_dictoffset */
156156
(initproc)&PythonQtBoolResult_init, /* tp_init */
157157
};
158158

0 commit comments

Comments
 (0)