From 367ff3fb9e3933f6704c98359cdd8d934ace941f Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 24 Aug 2024 20:52:58 +0900 Subject: Rename global classes nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- src/kernel/ntqaccessible.h | 2 +- src/kernel/ntqgif.h | 2 +- src/kernel/ntqgplugin.h | 130 ---------------------- src/kernel/ntqguardedptr.h | 144 ------------------------- src/kernel/ntqinputcontext.h | 2 +- src/kernel/ntqjpegio.h | 2 +- src/kernel/ntqnamespace.h | 2 +- src/kernel/ntqpolygonscanner.h | 2 +- src/kernel/ntqt.h | 18 ++-- src/kernel/qaccel.cpp | 2 +- src/kernel/qapplication.cpp | 2 +- src/kernel/qapplication_x11.cpp | 2 +- src/kernel/qdnd_x11.cpp | 2 +- src/kernel/qgplugin.cpp | 72 ------------- src/kernel/qguardedptr.cpp | 226 --------------------------------------- src/kernel/qinputcontext_p.h | 2 +- src/kernel/qt_kernel.pri | 8 +- src/kernel/qt_pch.h | 2 +- src/kernel/qvariant.cpp | 2 +- src/kernel/tqcolor_p.cpp | 2 +- src/kernel/tqdropsite.h | 2 +- src/kernel/tqfontengine_p.h | 2 +- src/kernel/tqgplugin.cpp | 72 +++++++++++++ src/kernel/tqgplugin.h | 130 ++++++++++++++++++++++ src/kernel/tqguardedptr.cpp | 226 +++++++++++++++++++++++++++++++++++++++ src/kernel/tqguardedptr.h | 144 +++++++++++++++++++++++++ src/kernel/tqimageformatplugin.h | 2 +- src/kernel/tqlocalfs.cpp | 2 +- src/kernel/tqobjectdefs.h | 2 +- src/kernel/tqsignal.cpp | 2 +- src/kernel/tqsimplerichtext.cpp | 2 +- src/kernel/tqsizepolicy.h | 2 +- src/kernel/tqt.h | 2 +- src/kernel/tqtextengine_p.h | 2 +- src/kernel/tqurloperator.cpp | 2 +- src/kernel/tqwidget.cpp | 2 +- 36 files changed, 611 insertions(+), 611 deletions(-) delete mode 100644 src/kernel/ntqgplugin.h delete mode 100644 src/kernel/ntqguardedptr.h delete mode 100644 src/kernel/qgplugin.cpp delete mode 100644 src/kernel/qguardedptr.cpp create mode 100644 src/kernel/tqgplugin.cpp create mode 100644 src/kernel/tqgplugin.h create mode 100644 src/kernel/tqguardedptr.cpp create mode 100644 src/kernel/tqguardedptr.h (limited to 'src/kernel') diff --git a/src/kernel/ntqaccessible.h b/src/kernel/ntqaccessible.h index 4ea410f4c..25b12077e 100644 --- a/src/kernel/ntqaccessible.h +++ b/src/kernel/ntqaccessible.h @@ -43,7 +43,7 @@ #include "tqobject.h" #include #include "tqrect.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #include "tqmemarray.h" #endif // QT_H diff --git a/src/kernel/ntqgif.h b/src/kernel/ntqgif.h index f5fee77be..9d1658a0c 100644 --- a/src/kernel/ntqgif.h +++ b/src/kernel/ntqgif.h @@ -49,7 +49,7 @@ #define TQGIF_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H #ifndef QT_BUILTIN_GIF_READER diff --git a/src/kernel/ntqgplugin.h b/src/kernel/ntqgplugin.h deleted file mode 100644 index 88212515b..000000000 --- a/src/kernel/ntqgplugin.h +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQGPLUGIN_H -#define TQGPLUGIN_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the TQt API. It exists for the convenience -// of a number of TQt sources files. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// -// - -#ifndef QT_H -#include "tqobject.h" -#endif // QT_H - -#ifndef TQT_NO_COMPONENT - -#ifndef TQ_EXTERN_C -#ifdef __cplusplus -#define TQ_EXTERN_C extern "C" -#else -#define TQ_EXTERN_C extern -#endif -#endif - -#ifndef TQ_EXPORT_PLUGIN -#if defined(TQT_THREAD_SUPPORT) -#define QT_THREADED_BUILD 1 -#define Q_PLUGIN_FLAGS_STRING "11" -#else -#define QT_THREADED_BUILD 0 -#define Q_PLUGIN_FLAGS_STRING "01" -#endif - -// this is duplicated at Q_UCM_VERIFICATION_DATA in qcom_p.h -// NOTE: if you change pattern, you MUST change the pattern in -// qcomlibrary.cpp as well. changing the pattern will break all -// backwards compatibility as well (no old plugins will be loaded). -#ifndef Q_PLUGIN_VERIFICATION_DATA -# define Q_PLUGIN_VERIFICATION_DATA \ - static const char *qt_ucm_verification_data = \ - "pattern=" "QT_UCM_VERIFICATION_DATA" "\n" \ - "version=" TQT_VERSION_STR "\n" \ - "flags=" Q_PLUGIN_FLAGS_STRING "\n" \ - "buildkey=" TQT_BUILD_KEY "\0"; -#endif // Q_PLUGIN_VERIFICATION_DATA - -#define Q_PLUGIN_INSTANTIATE( IMPLEMENTATION ) \ - { \ - IMPLEMENTATION *i = new IMPLEMENTATION; \ - return i->iface(); \ - } - -#if defined(TQ_WS_WIN) && defined(Q_CC_BOR) -# define Q_STDCALL __stdcall -#else -# define Q_STDCALL -#endif - -#define TQ_EXPORT_PLUGIN(PLUGIN) \ - Q_PLUGIN_VERIFICATION_DATA \ - TQ_EXTERN_C TQ_EXPORT \ - const char * Q_STDCALL qt_ucm_query_verification_data() \ - { return qt_ucm_verification_data; } \ - TQ_EXTERN_C TQ_EXPORT TQUnknownInterface* Q_STDCALL ucm_instantiate() \ - Q_PLUGIN_INSTANTIATE( PLUGIN ) -#endif - -struct TQUnknownInterface; - -class TQ_EXPORT TQGPlugin : public TQObject -{ - TQ_OBJECT -public: - TQGPlugin( TQUnknownInterface *i ); - ~TQGPlugin(); - - TQUnknownInterface* iface(); - void setIface( TQUnknownInterface *iface ); - -private: - TQGPlugin(); - TQUnknownInterface* _iface; -}; - -#endif // TQT_NO_COMPONENT - -#endif // TQGPLUGIN_H diff --git a/src/kernel/ntqguardedptr.h b/src/kernel/ntqguardedptr.h deleted file mode 100644 index 29ef8b8c7..000000000 --- a/src/kernel/ntqguardedptr.h +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Definition of TQGuardedPtr class -** -** Created : 990929 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQGUARDEDPTR_H -#define TQGUARDEDPTR_H - -#ifndef QT_H -#include "tqobject.h" -#endif // QT_H - -// ### 4.0: rename to something without Private in it. Not really internal. -class TQ_EXPORT TQGuardedPtrPrivate : public TQObject, public TQShared -{ - TQ_OBJECT -public: - TQGuardedPtrPrivate( TQObject* ); - ~TQGuardedPtrPrivate(); - - TQObject* object() const; - void reconnect( TQObject* ); - -private slots: - void objectDestroyed(); - -private: - TQObject* obj; -#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator= - TQGuardedPtrPrivate( const TQGuardedPtrPrivate & ); - TQGuardedPtrPrivate &operator=( const TQGuardedPtrPrivate & ); -#endif -}; - -template -class TQGuardedPtr -{ -public: - TQGuardedPtr() : priv( new TQGuardedPtrPrivate( 0 ) ) {} - - TQGuardedPtr( T* o) { - priv = new TQGuardedPtrPrivate( (TQObject*)o ); - } - - TQGuardedPtr(const TQGuardedPtr &p) { - priv = p.priv; - ref(); - } - - ~TQGuardedPtr() { deref(); } - - TQGuardedPtr &operator=(const TQGuardedPtr &p) { - if ( priv != p.priv ) { - deref(); - priv = p.priv; - ref(); - } - return *this; - } - - TQGuardedPtr &operator=(T* o) { - if ( priv && priv->count == 1 ) { - priv->reconnect( (TQObject*)o ); - } else { - deref(); - priv = new TQGuardedPtrPrivate( (TQObject*)o ); - } - return *this; - } - - bool operator==( const TQGuardedPtr &p ) const { - return (T*)(*this) == (T*) p; - } - - bool operator!= ( const TQGuardedPtr& p ) const { - return !( *this == p ); - } - - bool isNull() const { return !priv || !priv->object(); } - - T* operator->() const { return (T*)(priv?priv->object():0); } - - T& operator*() const { return *((T*)(priv?priv->object():0)); } - - operator T*() const { return (T*)(priv?priv->object():0); } - -private: - - void ref() { if (priv) priv->ref(); } - - void deref() { - if ( priv && priv->deref() ) - delete priv; - } - - TQGuardedPtrPrivate* priv; -}; - - - - -inline TQObject* TQGuardedPtrPrivate::object() const -{ - return obj; -} - -#define Q_DEFINED_QGUARDEDPTR -#include "ntqwinexport.h" -#endif diff --git a/src/kernel/ntqinputcontext.h b/src/kernel/ntqinputcontext.h index 0ab8e728a..426aa796a 100644 --- a/src/kernel/ntqinputcontext.h +++ b/src/kernel/ntqinputcontext.h @@ -40,7 +40,7 @@ #ifndef QT_H #include "tqobject.h" -#include "ntqglobal.h" +#include "tqglobal.h" #include "tqevent.h" #include "tqstring.h" #include "tqptrlist.h" diff --git a/src/kernel/ntqjpegio.h b/src/kernel/ntqjpegio.h index bb27c5dc8..10ae8d7cf 100644 --- a/src/kernel/ntqjpegio.h +++ b/src/kernel/ntqjpegio.h @@ -41,7 +41,7 @@ #ifndef TQJPEGIO_H #define TQJPEGIO_H -#include "ntqglobal.h" +#include "tqglobal.h" #ifndef TQT_NO_IMAGEIO_JPEG diff --git a/src/kernel/ntqnamespace.h b/src/kernel/ntqnamespace.h index dd2cdedab..cace88141 100644 --- a/src/kernel/ntqnamespace.h +++ b/src/kernel/ntqnamespace.h @@ -42,7 +42,7 @@ #define TQNAMESPACE_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H diff --git a/src/kernel/ntqpolygonscanner.h b/src/kernel/ntqpolygonscanner.h index 3d281da7c..2ab2c8e37 100644 --- a/src/kernel/ntqpolygonscanner.h +++ b/src/kernel/ntqpolygonscanner.h @@ -42,7 +42,7 @@ #define TQPOLYGONSCANNER_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H class TQPointArray; diff --git a/src/kernel/ntqt.h b/src/kernel/ntqt.h index 875323a6d..52caddc35 100644 --- a/src/kernel/ntqt.h +++ b/src/kernel/ntqt.h @@ -15,14 +15,14 @@ #ifndef QT_H #define QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #include "ntqfeatures.h" #include "ntqshared.h" #include "tqptrcollection.h" -#include "ntqglist.h" +#include "tqglist.h" #include "tqobjectdefs.h" #include "ntqnamespace.h" -#include "ntqgarray.h" +#include "tqgarray.h" #include "tqmemarray.h" #include "tqcstring.h" #include "tqstring.h" @@ -30,7 +30,7 @@ #include "tqiodevice.h" #include "ntqkeysequence.h" #include "ntqwindowdefs.h" -#include "ntqgdict.h" +#include "tqgdict.h" #include "tqfont.h" #include "tqdatastream.h" #include "tqpair.h" @@ -86,17 +86,17 @@ #include "tqnetworkprotocol.h" #include #include -#include "ntqgcache.h" +#include "tqgcache.h" #include #include #include #include -#include "ntqgplugin.h" +#include "tqgplugin.h" #include #include "ntqrangecontrol.h" #include "tqbuttongroup.h" #include -#include "ntqgvector.h" +#include "tqgvector.h" #include "tqhbox.h" #include #include @@ -139,7 +139,7 @@ #include "tqmutex.h" #include #include -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #include #include "tqsqlfield.h" #include @@ -281,7 +281,7 @@ #include "private/tqlayoutengine_p.h" #include "private/qcomlibrary_p.h" #include "private/qeffects_p.h" -#include "private/qgpluginmanager_p.h" +#include "private/tqgpluginmanager_p.h" #include "private/qinternal_p.h" #include "private/tqsqldriverinterface_p.h" #include "private/tqsqlmanager_p.h" diff --git a/src/kernel/qaccel.cpp b/src/kernel/qaccel.cpp index fabd7dcf4..e2f55f01e 100644 --- a/src/kernel/qaccel.cpp +++ b/src/kernel/qaccel.cpp @@ -47,7 +47,7 @@ #include "tqwidget.h" #include "tqptrlist.h" #include "tqwhatsthis.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #include "tqstatusbar.h" #include "ntqdockwindow.h" #include "tqsignalslotimp.h" diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index d48805c3a..7abbbd56f 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -283,7 +283,7 @@ \headerfile ntqnamespace.h \headerfile ntqwindowdefs.h - \headerfile ntqglobal.h + \headerfile tqglobal.h */ /*! \enum TQt::HANDLE diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index 18a0eb7f0..f3252b296 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -81,7 +81,7 @@ #include "tqsessionmanager.h" #include "tqvaluelist.h" #include "tqdict.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #include "tqclipboard.h" #include "tqwhatsthis.h" // ######## dependency #include "tqsettings.h" diff --git a/src/kernel/qdnd_x11.cpp b/src/kernel/qdnd_x11.cpp index 5194ee878..c35bca0a4 100644 --- a/src/kernel/qdnd_x11.cpp +++ b/src/kernel/qdnd_x11.cpp @@ -48,7 +48,7 @@ #include "tqintdict.h" #include "tqdatetime.h" #include "tqdict.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #include "tqdragobject.h" #include "tqobjectlist.h" #include "ntqcursor.h" diff --git a/src/kernel/qgplugin.cpp b/src/kernel/qgplugin.cpp deleted file mode 100644 index ca5b4131f..000000000 --- a/src/kernel/qgplugin.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqgplugin.h" - -#ifndef TQT_NO_COMPONENT - -#include - -TQGPlugin::TQGPlugin() - : _iface( 0 ) -{ -} - -TQGPlugin::TQGPlugin( TQUnknownInterface *i ) - : _iface( i ) -{ -} - -TQGPlugin::~TQGPlugin() -{ -} - -TQUnknownInterface* TQGPlugin::iface() -{ - Q_ASSERT( _iface ); - TQUnknownInterface *i; - _iface->queryInterface( IID_QUnknown, &i ); - return i; -} - -void TQGPlugin::setIface( TQUnknownInterface *iface ) -{ - _iface = iface; -} - -#endif // TQT_NO_COMPONENT diff --git a/src/kernel/qguardedptr.cpp b/src/kernel/qguardedptr.cpp deleted file mode 100644 index 5102d094b..000000000 --- a/src/kernel/qguardedptr.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQGuardedPtr class -** -** Created : 990929 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqguardedptr.h" - -/*! - \class TQGuardedPtr ntqguardedptr.h - \brief The TQGuardedPtr class is a template class that provides guarded pointers to TQObjects. - - \ingroup objectmodel - \mainclass - - A guarded pointer, \c{TQGuardedPtr}, behaves like a normal C++ - pointer \c{X*}, except that it is automatically set to 0 when - the referenced object is destroyed (unlike normal C++ pointers, - which become "dangling pointers" in such cases). \c X must be a - subclass of TQObject. - - Guarded pointers are useful whenever you need to store a pointer - to a TQObject that is owned by someone else and therefore might be - destroyed while you still hold a reference to it. You can safely - test the pointer for validity. - - Example: - \code - TQGuardedPtr label = new TQLabel( 0, "label" ); - label->setText( "I like guarded pointers" ); - - delete (TQLabel*) label; // simulate somebody destroying the label - - if ( label) - label->show(); - else - tqDebug("The label has been destroyed"); - \endcode - - The program will output \c{The label has been destroyed} rather - than dereferencing an invalid address in \c label->show(). - - The functions and operators available with a TQGuardedPtr are the - same as those available with a normal unguarded pointer, except - the pointer arithmetic operators (++, --, -, and +), which are - normally used only with arrays of objects. Use them like normal - pointers and you will not need to read this class documentation. - - For creating guarded pointers, you can construct or assign to them - from an X* or from another guarded pointer of the same type. You - can compare them with each other using operator==() and - operator!=(), or test for 0 with isNull(). And you can dereference - them using either the \c *x or the \c x->member notation. - - A guarded pointer will automatically cast to an X*, so you can - freely mix guarded and unguarded pointers. This means that if you - have a TQGuardedPtr, you can pass it to a function that - requires a TQWidget*. For this reason, it is of little value to - declare functions to take a TQGuardedPtr as a parameter; just use - normal pointers. Use a TQGuardedPtr when you are storing a pointer - over time. - - Note again that class \e X must inherit TQObject, or a compilation - or link error will result. -*/ - -/*! - \fn TQGuardedPtr::TQGuardedPtr() - - Constructs a 0 guarded pointer. - - \sa isNull() -*/ - -/*! - \fn TQGuardedPtr::TQGuardedPtr( T* p ) - - Constructs a guarded pointer that points to same object as \a p - points to. -*/ - -/*! - \fn TQGuardedPtr::TQGuardedPtr(const TQGuardedPtr &p) - - Copy one guarded pointer from another. The constructed guarded - pointer points to the same object that \a p points to (which may - be 0). -*/ - -/*! - \fn TQGuardedPtr::~TQGuardedPtr() - - Destroys the guarded pointer. Just like a normal pointer, - destroying a guarded pointer does \e not destroy the object being - pointed to. -*/ - -/*! - \fn TQGuardedPtr& TQGuardedPtr::operator=(const TQGuardedPtr &p) - - Assignment operator. This guarded pointer then points to the same - object as \a p points to. -*/ - -/*! - \overload TQGuardedPtr & TQGuardedPtr::operator=(T* p) - - Assignment operator. This guarded pointer then points to the same - object as \a p points to. -*/ - -/*! - \fn bool TQGuardedPtr::operator==( const TQGuardedPtr &p ) const - - Equality operator; implements traditional pointer semantics. - Returns TRUE if both \a p and this guarded pointer are 0, or if - both \a p and this pointer point to the same object; otherwise - returns FALSE. - - \sa operator!=() -*/ - -/*! - \fn bool TQGuardedPtr::operator!= ( const TQGuardedPtr& p ) const - - Inequality operator; implements pointer semantics, the negation of - operator==(). Returns TRUE if \a p and this guarded pointer are - not pointing to the same object; otherwise returns FALSE. -*/ - -/*! - \fn bool TQGuardedPtr::isNull() const - - Returns \c TRUE if the referenced object has been destroyed or if - there is no referenced object; otherwise returns FALSE. -*/ - -/*! - \fn T* TQGuardedPtr::operator->() const - - Overloaded arrow operator; implements pointer semantics. Just use - this operator as you would with a normal C++ pointer. -*/ - -/*! - \fn T& TQGuardedPtr::operator*() const - - Dereference operator; implements pointer semantics. Just use this - operator as you would with a normal C++ pointer. -*/ - -/*! - \fn TQGuardedPtr::operator T*() const - - Cast operator; implements pointer semantics. Because of this - function you can pass a TQGuardedPtr\ to a function where an X* - is required. -*/ - - -/* Internal classes */ - - -TQGuardedPtrPrivate::TQGuardedPtrPrivate( TQObject* o) - : TQObject(0, "_ptrpriv" ), obj( o ) -{ - if ( obj ) - connect( obj, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( objectDestroyed() ) ); -} - - -TQGuardedPtrPrivate::~TQGuardedPtrPrivate() -{ -} - -void TQGuardedPtrPrivate::reconnect( TQObject *o ) -{ - if ( obj == o ) - return; - if ( obj ) - disconnect( obj, TQ_SIGNAL( destroyed() ), - this, TQ_SLOT( objectDestroyed() ) ); - obj = o; - if ( obj ) - connect( obj, TQ_SIGNAL( destroyed() ), - this, TQ_SLOT( objectDestroyed() ) ); -} - -void TQGuardedPtrPrivate::objectDestroyed() -{ - obj = 0; -} diff --git a/src/kernel/qinputcontext_p.h b/src/kernel/qinputcontext_p.h index 0e0f8da0c..37ba52b6c 100644 --- a/src/kernel/qinputcontext_p.h +++ b/src/kernel/qinputcontext_p.h @@ -52,7 +52,7 @@ // // -#include "ntqglobal.h" +#include "tqglobal.h" class TQKeyEvent; class TQWidget; diff --git a/src/kernel/qt_kernel.pri b/src/kernel/qt_kernel.pri index bd93c7c29..a31cab804 100644 --- a/src/kernel/qt_kernel.pri +++ b/src/kernel/qt_kernel.pri @@ -29,7 +29,7 @@ kernel { $$KERNEL_P/tqfontdata_p.h \ $$KERNEL_H/tqfontinfo.h \ $$KERNEL_H/tqfontmetrics.h \ - $$KERNEL_H/ntqguardedptr.h \ + $$KERNEL_H/tqguardedptr.h \ $$KERNEL_H/ntqgif.h \ $$KERNEL_H/tqiconset.h \ $$KERNEL_H/tqimage.h \ @@ -91,7 +91,7 @@ kernel { $$KERNEL_H/ntqvariant.h \ $$KERNEL_P/qrichtext_p.h \ $$KERNEL_P/qinternal_p.h \ - $$KERNEL_H/ntqgplugin.h \ + $$KERNEL_H/tqgplugin.h \ $$KERNEL_H/tqsimplerichtext.h \ $$KERNEL_CPP/qscriptengine_p.h \ $$KERNEL_CPP/tqtextengine_p.h \ @@ -213,7 +213,7 @@ kernel { $$KERNEL_CPP/qfocusdata.cpp \ $$KERNEL_CPP/tqfont.cpp \ $$KERNEL_CPP/tqfontdatabase.cpp \ - $$KERNEL_CPP/qguardedptr.cpp \ + $$KERNEL_CPP/tqguardedptr.cpp \ $$KERNEL_CPP/tqiconset.cpp \ $$KERNEL_CPP/tqimage.cpp \ $$KERNEL_CPP/tqimageformatplugin.cpp \ @@ -260,7 +260,7 @@ kernel { $$KERNEL_CPP/qrichtext.cpp \ $$KERNEL_CPP/qinternal.cpp \ $$KERNEL_CPP/qrichtext_p.cpp \ - $$KERNEL_CPP/qgplugin.cpp \ + $$KERNEL_CPP/tqgplugin.cpp \ $$KERNEL_CPP/tqsimplerichtext.cpp \ $$KERNEL_CPP/qscriptengine.cpp \ $$KERNEL_CPP/tqtextlayout.cpp \ diff --git a/src/kernel/qt_pch.h b/src/kernel/qt_pch.h index 908254769..611076c97 100644 --- a/src/kernel/qt_pch.h +++ b/src/kernel/qt_pch.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include // All moc genereated code has this include #include diff --git a/src/kernel/qvariant.cpp b/src/kernel/qvariant.cpp index ac3157676..884ef1ed5 100644 --- a/src/kernel/qvariant.cpp +++ b/src/kernel/qvariant.cpp @@ -475,7 +475,7 @@ void TQVariant::Private::clear() \value UInt an unsigned int Note that TQt's definition of bool depends on the compiler. - \c ntqglobal.h has the system-dependent definition of bool. + \c tqglobal.h has the system-dependent definition of bool. */ /*! diff --git a/src/kernel/tqcolor_p.cpp b/src/kernel/tqcolor_p.cpp index 0a91f5c90..d1462f43f 100644 --- a/src/kernel/tqcolor_p.cpp +++ b/src/kernel/tqcolor_p.cpp @@ -39,7 +39,7 @@ ** **********************************************************************/ -#include "ntqglobal.h" +#include "tqglobal.h" #if defined(Q_CC_BOR) // needed for qsort() because of a std namespace problem on Borland #include "qplatformdefs.h" diff --git a/src/kernel/tqdropsite.h b/src/kernel/tqdropsite.h index 3e95cdc3f..9ee72b4d8 100644 --- a/src/kernel/tqdropsite.h +++ b/src/kernel/tqdropsite.h @@ -41,7 +41,7 @@ #ifndef QT_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H #endif diff --git a/src/kernel/tqfontengine_p.h b/src/kernel/tqfontengine_p.h index 3dba677ca..559972746 100644 --- a/src/kernel/tqfontengine_p.h +++ b/src/kernel/tqfontengine_p.h @@ -38,7 +38,7 @@ #define TQFONTENGINE_P_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H #ifdef TQ_WS_WIN diff --git a/src/kernel/tqgplugin.cpp b/src/kernel/tqgplugin.cpp new file mode 100644 index 000000000..c0cfd8f47 --- /dev/null +++ b/src/kernel/tqgplugin.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqgplugin.h" + +#ifndef TQT_NO_COMPONENT + +#include + +TQGPlugin::TQGPlugin() + : _iface( 0 ) +{ +} + +TQGPlugin::TQGPlugin( TQUnknownInterface *i ) + : _iface( i ) +{ +} + +TQGPlugin::~TQGPlugin() +{ +} + +TQUnknownInterface* TQGPlugin::iface() +{ + Q_ASSERT( _iface ); + TQUnknownInterface *i; + _iface->queryInterface( IID_QUnknown, &i ); + return i; +} + +void TQGPlugin::setIface( TQUnknownInterface *iface ) +{ + _iface = iface; +} + +#endif // TQT_NO_COMPONENT diff --git a/src/kernel/tqgplugin.h b/src/kernel/tqgplugin.h new file mode 100644 index 000000000..88212515b --- /dev/null +++ b/src/kernel/tqgplugin.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQGPLUGIN_H +#define TQGPLUGIN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the TQt API. It exists for the convenience +// of a number of TQt sources files. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// +// + +#ifndef QT_H +#include "tqobject.h" +#endif // QT_H + +#ifndef TQT_NO_COMPONENT + +#ifndef TQ_EXTERN_C +#ifdef __cplusplus +#define TQ_EXTERN_C extern "C" +#else +#define TQ_EXTERN_C extern +#endif +#endif + +#ifndef TQ_EXPORT_PLUGIN +#if defined(TQT_THREAD_SUPPORT) +#define QT_THREADED_BUILD 1 +#define Q_PLUGIN_FLAGS_STRING "11" +#else +#define QT_THREADED_BUILD 0 +#define Q_PLUGIN_FLAGS_STRING "01" +#endif + +// this is duplicated at Q_UCM_VERIFICATION_DATA in qcom_p.h +// NOTE: if you change pattern, you MUST change the pattern in +// qcomlibrary.cpp as well. changing the pattern will break all +// backwards compatibility as well (no old plugins will be loaded). +#ifndef Q_PLUGIN_VERIFICATION_DATA +# define Q_PLUGIN_VERIFICATION_DATA \ + static const char *qt_ucm_verification_data = \ + "pattern=" "QT_UCM_VERIFICATION_DATA" "\n" \ + "version=" TQT_VERSION_STR "\n" \ + "flags=" Q_PLUGIN_FLAGS_STRING "\n" \ + "buildkey=" TQT_BUILD_KEY "\0"; +#endif // Q_PLUGIN_VERIFICATION_DATA + +#define Q_PLUGIN_INSTANTIATE( IMPLEMENTATION ) \ + { \ + IMPLEMENTATION *i = new IMPLEMENTATION; \ + return i->iface(); \ + } + +#if defined(TQ_WS_WIN) && defined(Q_CC_BOR) +# define Q_STDCALL __stdcall +#else +# define Q_STDCALL +#endif + +#define TQ_EXPORT_PLUGIN(PLUGIN) \ + Q_PLUGIN_VERIFICATION_DATA \ + TQ_EXTERN_C TQ_EXPORT \ + const char * Q_STDCALL qt_ucm_query_verification_data() \ + { return qt_ucm_verification_data; } \ + TQ_EXTERN_C TQ_EXPORT TQUnknownInterface* Q_STDCALL ucm_instantiate() \ + Q_PLUGIN_INSTANTIATE( PLUGIN ) +#endif + +struct TQUnknownInterface; + +class TQ_EXPORT TQGPlugin : public TQObject +{ + TQ_OBJECT +public: + TQGPlugin( TQUnknownInterface *i ); + ~TQGPlugin(); + + TQUnknownInterface* iface(); + void setIface( TQUnknownInterface *iface ); + +private: + TQGPlugin(); + TQUnknownInterface* _iface; +}; + +#endif // TQT_NO_COMPONENT + +#endif // TQGPLUGIN_H diff --git a/src/kernel/tqguardedptr.cpp b/src/kernel/tqguardedptr.cpp new file mode 100644 index 000000000..a08fe1aae --- /dev/null +++ b/src/kernel/tqguardedptr.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Implementation of TQGuardedPtr class +** +** Created : 990929 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqguardedptr.h" + +/*! + \class TQGuardedPtr tqguardedptr.h + \brief The TQGuardedPtr class is a template class that provides guarded pointers to TQObjects. + + \ingroup objectmodel + \mainclass + + A guarded pointer, \c{TQGuardedPtr}, behaves like a normal C++ + pointer \c{X*}, except that it is automatically set to 0 when + the referenced object is destroyed (unlike normal C++ pointers, + which become "dangling pointers" in such cases). \c X must be a + subclass of TQObject. + + Guarded pointers are useful whenever you need to store a pointer + to a TQObject that is owned by someone else and therefore might be + destroyed while you still hold a reference to it. You can safely + test the pointer for validity. + + Example: + \code + TQGuardedPtr label = new TQLabel( 0, "label" ); + label->setText( "I like guarded pointers" ); + + delete (TQLabel*) label; // simulate somebody destroying the label + + if ( label) + label->show(); + else + tqDebug("The label has been destroyed"); + \endcode + + The program will output \c{The label has been destroyed} rather + than dereferencing an invalid address in \c label->show(). + + The functions and operators available with a TQGuardedPtr are the + same as those available with a normal unguarded pointer, except + the pointer arithmetic operators (++, --, -, and +), which are + normally used only with arrays of objects. Use them like normal + pointers and you will not need to read this class documentation. + + For creating guarded pointers, you can construct or assign to them + from an X* or from another guarded pointer of the same type. You + can compare them with each other using operator==() and + operator!=(), or test for 0 with isNull(). And you can dereference + them using either the \c *x or the \c x->member notation. + + A guarded pointer will automatically cast to an X*, so you can + freely mix guarded and unguarded pointers. This means that if you + have a TQGuardedPtr, you can pass it to a function that + requires a TQWidget*. For this reason, it is of little value to + declare functions to take a TQGuardedPtr as a parameter; just use + normal pointers. Use a TQGuardedPtr when you are storing a pointer + over time. + + Note again that class \e X must inherit TQObject, or a compilation + or link error will result. +*/ + +/*! + \fn TQGuardedPtr::TQGuardedPtr() + + Constructs a 0 guarded pointer. + + \sa isNull() +*/ + +/*! + \fn TQGuardedPtr::TQGuardedPtr( T* p ) + + Constructs a guarded pointer that points to same object as \a p + points to. +*/ + +/*! + \fn TQGuardedPtr::TQGuardedPtr(const TQGuardedPtr &p) + + Copy one guarded pointer from another. The constructed guarded + pointer points to the same object that \a p points to (which may + be 0). +*/ + +/*! + \fn TQGuardedPtr::~TQGuardedPtr() + + Destroys the guarded pointer. Just like a normal pointer, + destroying a guarded pointer does \e not destroy the object being + pointed to. +*/ + +/*! + \fn TQGuardedPtr& TQGuardedPtr::operator=(const TQGuardedPtr &p) + + Assignment operator. This guarded pointer then points to the same + object as \a p points to. +*/ + +/*! + \overload TQGuardedPtr & TQGuardedPtr::operator=(T* p) + + Assignment operator. This guarded pointer then points to the same + object as \a p points to. +*/ + +/*! + \fn bool TQGuardedPtr::operator==( const TQGuardedPtr &p ) const + + Equality operator; implements traditional pointer semantics. + Returns TRUE if both \a p and this guarded pointer are 0, or if + both \a p and this pointer point to the same object; otherwise + returns FALSE. + + \sa operator!=() +*/ + +/*! + \fn bool TQGuardedPtr::operator!= ( const TQGuardedPtr& p ) const + + Inequality operator; implements pointer semantics, the negation of + operator==(). Returns TRUE if \a p and this guarded pointer are + not pointing to the same object; otherwise returns FALSE. +*/ + +/*! + \fn bool TQGuardedPtr::isNull() const + + Returns \c TRUE if the referenced object has been destroyed or if + there is no referenced object; otherwise returns FALSE. +*/ + +/*! + \fn T* TQGuardedPtr::operator->() const + + Overloaded arrow operator; implements pointer semantics. Just use + this operator as you would with a normal C++ pointer. +*/ + +/*! + \fn T& TQGuardedPtr::operator*() const + + Dereference operator; implements pointer semantics. Just use this + operator as you would with a normal C++ pointer. +*/ + +/*! + \fn TQGuardedPtr::operator T*() const + + Cast operator; implements pointer semantics. Because of this + function you can pass a TQGuardedPtr\ to a function where an X* + is required. +*/ + + +/* Internal classes */ + + +TQGuardedPtrPrivate::TQGuardedPtrPrivate( TQObject* o) + : TQObject(0, "_ptrpriv" ), obj( o ) +{ + if ( obj ) + connect( obj, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( objectDestroyed() ) ); +} + + +TQGuardedPtrPrivate::~TQGuardedPtrPrivate() +{ +} + +void TQGuardedPtrPrivate::reconnect( TQObject *o ) +{ + if ( obj == o ) + return; + if ( obj ) + disconnect( obj, TQ_SIGNAL( destroyed() ), + this, TQ_SLOT( objectDestroyed() ) ); + obj = o; + if ( obj ) + connect( obj, TQ_SIGNAL( destroyed() ), + this, TQ_SLOT( objectDestroyed() ) ); +} + +void TQGuardedPtrPrivate::objectDestroyed() +{ + obj = 0; +} diff --git a/src/kernel/tqguardedptr.h b/src/kernel/tqguardedptr.h new file mode 100644 index 000000000..29ef8b8c7 --- /dev/null +++ b/src/kernel/tqguardedptr.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Definition of TQGuardedPtr class +** +** Created : 990929 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQGUARDEDPTR_H +#define TQGUARDEDPTR_H + +#ifndef QT_H +#include "tqobject.h" +#endif // QT_H + +// ### 4.0: rename to something without Private in it. Not really internal. +class TQ_EXPORT TQGuardedPtrPrivate : public TQObject, public TQShared +{ + TQ_OBJECT +public: + TQGuardedPtrPrivate( TQObject* ); + ~TQGuardedPtrPrivate(); + + TQObject* object() const; + void reconnect( TQObject* ); + +private slots: + void objectDestroyed(); + +private: + TQObject* obj; +#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator= + TQGuardedPtrPrivate( const TQGuardedPtrPrivate & ); + TQGuardedPtrPrivate &operator=( const TQGuardedPtrPrivate & ); +#endif +}; + +template +class TQGuardedPtr +{ +public: + TQGuardedPtr() : priv( new TQGuardedPtrPrivate( 0 ) ) {} + + TQGuardedPtr( T* o) { + priv = new TQGuardedPtrPrivate( (TQObject*)o ); + } + + TQGuardedPtr(const TQGuardedPtr &p) { + priv = p.priv; + ref(); + } + + ~TQGuardedPtr() { deref(); } + + TQGuardedPtr &operator=(const TQGuardedPtr &p) { + if ( priv != p.priv ) { + deref(); + priv = p.priv; + ref(); + } + return *this; + } + + TQGuardedPtr &operator=(T* o) { + if ( priv && priv->count == 1 ) { + priv->reconnect( (TQObject*)o ); + } else { + deref(); + priv = new TQGuardedPtrPrivate( (TQObject*)o ); + } + return *this; + } + + bool operator==( const TQGuardedPtr &p ) const { + return (T*)(*this) == (T*) p; + } + + bool operator!= ( const TQGuardedPtr& p ) const { + return !( *this == p ); + } + + bool isNull() const { return !priv || !priv->object(); } + + T* operator->() const { return (T*)(priv?priv->object():0); } + + T& operator*() const { return *((T*)(priv?priv->object():0)); } + + operator T*() const { return (T*)(priv?priv->object():0); } + +private: + + void ref() { if (priv) priv->ref(); } + + void deref() { + if ( priv && priv->deref() ) + delete priv; + } + + TQGuardedPtrPrivate* priv; +}; + + + + +inline TQObject* TQGuardedPtrPrivate::object() const +{ + return obj; +} + +#define Q_DEFINED_QGUARDEDPTR +#include "ntqwinexport.h" +#endif diff --git a/src/kernel/tqimageformatplugin.h b/src/kernel/tqimageformatplugin.h index 6940f18b6..83dbad7f2 100644 --- a/src/kernel/tqimageformatplugin.h +++ b/src/kernel/tqimageformatplugin.h @@ -40,7 +40,7 @@ #define TQIMAGEFORMATPLUGIN_H #ifndef QT_H -#include "ntqgplugin.h" +#include "tqgplugin.h" #include "tqstringlist.h" #endif // QT_H diff --git a/src/kernel/tqlocalfs.cpp b/src/kernel/tqlocalfs.cpp index b6b525c8d..5adc77fb2 100644 --- a/src/kernel/tqlocalfs.cpp +++ b/src/kernel/tqlocalfs.cpp @@ -47,7 +47,7 @@ #include "tqurlinfo.h" #include "ntqapplication.h" #include "tqurloperator.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" //#define TQLOCALFS_DEBUG diff --git a/src/kernel/tqobjectdefs.h b/src/kernel/tqobjectdefs.h index ba5e12b88..422299850 100644 --- a/src/kernel/tqobjectdefs.h +++ b/src/kernel/tqobjectdefs.h @@ -42,7 +42,7 @@ #define TQOBJECTDEFS_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H diff --git a/src/kernel/tqsignal.cpp b/src/kernel/tqsignal.cpp index 22e325031..3be5bb960 100644 --- a/src/kernel/tqsignal.cpp +++ b/src/kernel/tqsignal.cpp @@ -40,7 +40,7 @@ #include "tqsignal.h" #include "ntqmetaobject.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" /*! \class TQSignal tqsignal.h diff --git a/src/kernel/tqsimplerichtext.cpp b/src/kernel/tqsimplerichtext.cpp index 2288a5692..eccf9190d 100644 --- a/src/kernel/tqsimplerichtext.cpp +++ b/src/kernel/tqsimplerichtext.cpp @@ -54,7 +54,7 @@ public: void adjustSize(TQPainter *p = 0); }; -// Pull this private function in from qglobal.cpp +// Pull this private function in from tqglobal.cpp extern unsigned int qt_int_sqrt( unsigned int n ); void TQSimpleRichTextData::adjustSize(TQPainter *p) { diff --git a/src/kernel/tqsizepolicy.h b/src/kernel/tqsizepolicy.h index 2c764d33b..f6fac3885 100644 --- a/src/kernel/tqsizepolicy.h +++ b/src/kernel/tqsizepolicy.h @@ -42,7 +42,7 @@ #define TQSIZEPOLICY_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #endif // QT_H // Documentation is in qabstractlayout.cpp. diff --git a/src/kernel/tqt.h b/src/kernel/tqt.h index 723759d55..665f07b1a 100644 --- a/src/kernel/tqt.h +++ b/src/kernel/tqt.h @@ -22,7 +22,7 @@ Boston, MA 02110-1301, USA. #ifndef TQT_H #define TQT_H -#include +#include #define Qt TQt diff --git a/src/kernel/tqtextengine_p.h b/src/kernel/tqtextengine_p.h index 608bc06de..d1a467f2b 100644 --- a/src/kernel/tqtextengine_p.h +++ b/src/kernel/tqtextengine_p.h @@ -38,7 +38,7 @@ #define TQTEXTENGINE_P_H #ifndef QT_H -#include "ntqglobal.h" +#include "tqglobal.h" #include "tqstring.h" #include "ntqnamespace.h" #include diff --git a/src/kernel/tqurloperator.cpp b/src/kernel/tqurloperator.cpp index f7705bc2e..d8567e467 100644 --- a/src/kernel/tqurloperator.cpp +++ b/src/kernel/tqurloperator.cpp @@ -47,7 +47,7 @@ #include "tqmap.h" #include "tqdir.h" #include "tqptrdict.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" //#define TQURLOPERATOR_DEBUG diff --git a/src/kernel/tqwidget.cpp b/src/kernel/tqwidget.cpp index 0b27e2564..1e9a809cb 100644 --- a/src/kernel/tqwidget.cpp +++ b/src/kernel/tqwidget.cpp @@ -55,7 +55,7 @@ #include "ntqcleanuphandler.h" #include "tqstyle.h" #include "ntqmetaobject.h" -#include "ntqguardedptr.h" +#include "tqguardedptr.h" #if defined(TQT_THREAD_SUPPORT) #include "tqthread.h" #endif -- cgit v1.2.1