From 16ccce72d8c2763051806a5fc9caa574fa1dcc61 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Oct 2010 16:10:03 -0300 Subject: Don't export functions not used outsise libpyside and move them to an private header. --- libpyside/dynamicqmetaobject.cpp | 1 + libpyside/pyside.cpp | 4 +- libpyside/qproperty.cpp | 29 ++++---- libpyside/qproperty.h | 103 ----------------------------- libpyside/qproperty_p.h | 139 +++++++++++++++++++++++++++++++++++++++ libpyside/signalmanager.cpp | 6 +- 6 files changed, 161 insertions(+), 121 deletions(-) create mode 100644 libpyside/qproperty_p.h (limited to 'libpyside') diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 89a35ef2a..ce3ba3b99 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -34,6 +34,7 @@ #include "qsignal.h" #include "qproperty.h" +#include "qproperty_p.h" #define MAX_SIGNALS_COUNT 50 #define MAX_SLOTS_COUNT 50 diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index bb22fa789..ebc17cf5f 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -23,6 +23,7 @@ #include "pyside.h" #include "signalmanager.h" +#include "qproperty_p.h" #include "qproperty.h" #include "qsignal.h" #include @@ -33,7 +34,6 @@ extern "C" void init_signal(PyObject* module); extern "C" void init_slot(PyObject* module); -extern "C" void init_qproperty(PyObject* module); static QStack cleanupFunctionList; @@ -44,7 +44,7 @@ void init(PyObject *module) { init_signal(module); init_slot(module); - init_qproperty(module); + initQProperty(module); // Init signal manager, so it will register some meta types used by QVariant. SignalManager::instance(); } diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp index 32ff8a87b..d7c4d81ee 100644 --- a/libpyside/qproperty.cpp +++ b/libpyside/qproperty.cpp @@ -25,6 +25,7 @@ #include #include "qproperty.h" +#include "qproperty_p.h" #include "dynamicqmetaobject_p.h" #define QPROPERTY_CLASS_NAME "Property" @@ -32,6 +33,9 @@ namespace PySide { +// aux function +static char* translateTypeName(PyObject*); + extern "C" { @@ -52,11 +56,8 @@ typedef struct { bool final; } QPropertyData; -static int qproperty_init(PyObject*, PyObject*, PyObject*); -static void qproperty_free(void*); - -//aux -static char* translate_type_name(PyObject*); +static int qpropertyTpInit(PyObject*, PyObject*, PyObject*); +static void qpropertyFree(void*); PyTypeObject QProperty_Type = { PyObject_HEAD_INIT(0) @@ -95,10 +96,10 @@ PyTypeObject QProperty_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - (initproc)qproperty_init, /*tp_init */ + qpropertyTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ - qproperty_free, /*tp_free */ + qpropertyFree, /*tp_free */ 0, /*tp_is_gc */ 0, /*tp_bases */ 0, /*tp_mro */ @@ -108,7 +109,9 @@ PyTypeObject QProperty_Type = { 0, /*tp_del */ }; -void init_qproperty(PyObject* module) +} // extern "C" + +void initQProperty(PyObject* module) { if (PyType_Ready(&QProperty_Type) < 0) return; @@ -117,9 +120,7 @@ void init_qproperty(PyObject* module) PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type)); } -} // extern "C" - -int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds) +int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds) { PyObject* type = 0; QPropertyData *data = reinterpret_cast(self); @@ -141,11 +142,11 @@ int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds) if (!data->fset && data->fget) data->constant = true; - data->typeName = translate_type_name(type); + data->typeName = translateTypeName(type); return 1; } -void qproperty_free(void *self) +void qpropertyFree(void *self) { PyObject *pySelf = reinterpret_cast(self); QPropertyData *data = reinterpret_cast(self); @@ -226,7 +227,7 @@ PyObject* qpropertyGetObject(PyObject* source, PyObject* name) return 0; } -char* translate_type_name(PyObject* type) +char* translateTypeName(PyObject* type) { if (PyType_Check(type)) { char *typeName = NULL; diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h index 645a46855..bb256b4c0 100644 --- a/libpyside/qproperty.h +++ b/libpyside/qproperty.h @@ -58,26 +58,6 @@ PYSIDE_API int qpropertySet(PyObject* self, PyObject* source, PyObject* value); **/ PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source); -/** - * This function call reset property function - * This function does not check the property object type - * - * @param self The property object - * @param source The QObject witch has the property - * @return Return 0 if ok or -1 if this function fail - **/ -PYSIDE_API int qpropertyReset(PyObject* self, PyObject* source); - - -/** - * This function return the property type - * This function does not check the property object type - * - * @param self The property object - * @return Return the property type name - **/ -PYSIDE_API const char* qpropertyGetType(PyObject* self); - /** * This function search in the source object for desired property * @@ -87,89 +67,6 @@ PYSIDE_API const char* qpropertyGetType(PyObject* self); **/ PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name); - -/** - * This function check if property has read function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsReadable(PyObject* self); - -/** - * This function check if property has write function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsWritable(PyObject* self); - -/** - * This function check if property has reset function - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyHasReset(PyObject* self); - -/** - * This function check if property has the flag DESIGNABLE setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsDesignable(PyObject* self); - -/** - * This function check if property has the flag SCRIPTABLE setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsScriptable(PyObject* self); - -/** - * This function check if property has the flag STORED setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsStored(PyObject* self); - -/** - * This function check if property has the flag USER setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsUser(PyObject* self); - -/** - * This function check if property has the flag CONSTANT setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsConstant(PyObject* self); - -/** - * This function check if property has the flag FINAL setted - * This function does not check the property object type - * - * @param self The property object - * @return Return a boolean value - **/ -PYSIDE_API bool qpropertyIsFinal(PyObject* self); - - } //namespace PySide #endif diff --git a/libpyside/qproperty_p.h b/libpyside/qproperty_p.h new file mode 100644 index 000000000..dbd6dd107 --- /dev/null +++ b/libpyside/qproperty_p.h @@ -0,0 +1,139 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PYSIDE_QPROPERTY_P_H +#define PYSIDE_QPROPERTY_P_H + +#include + +namespace PySide +{ + +/** + * Init PySide QProperty support system + */ +void initQProperty(PyObject* module); + +/** + * This function call reset property function + * This function does not check the property object type + * + * @param self The property object + * @param source The QObject witch has the property + * @return Return 0 if ok or -1 if this function fail + **/ +int qpropertyReset(PyObject* self, PyObject* source); + + +/** + * This function return the property type + * This function does not check the property object type + * + * @param self The property object + * @return Return the property type name + **/ +const char* qpropertyGetType(PyObject* self); + +/** + * This function check if property has read function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsReadable(PyObject* self); + +/** + * This function check if property has write function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsWritable(PyObject* self); + +/** + * This function check if property has reset function + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyHasReset(PyObject* self); + +/** + * This function check if property has the flag DESIGNABLE setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsDesignable(PyObject* self); + +/** + * This function check if property has the flag SCRIPTABLE setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsScriptable(PyObject* self); + +/** + * This function check if property has the flag STORED setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsStored(PyObject* self); + +/** + * This function check if property has the flag USER setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsUser(PyObject* self); + +/** + * This function check if property has the flag CONSTANT setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsConstant(PyObject* self); + +/** + * This function check if property has the flag FINAL setted + * This function does not check the property object type + * + * @param self The property object + * @return Return a boolean value + **/ +bool qpropertyIsFinal(PyObject* self); + +} // namespace PySide + +#endif diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index c770fbac0..3f0a0a536 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -21,8 +21,6 @@ */ #include "signalmanager.h" -#include "qproperty.h" -#include "pyside.h" #include #include @@ -35,6 +33,10 @@ #include #include +#include "qproperty.h" +#include "qproperty_p.h" +#include "pyside.h" + #if QSLOT_CODE != 1 || QSIGNAL_CODE != 2 #error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value! #endif -- cgit v1.2.3