Rename KShared

pull/1/head
Timothy Pearson 11 years ago
parent c64839178e
commit 8f78d8aa94

@ -139,7 +139,7 @@ fixes for gcc2.96 compatiblility
2002/3/11 11:01:00 jim
3.0beta1: versioning to KDE3.0beta2; mapped types
for KSharedPtr descendants; KParts modified - now
for TDESharedPtr descendants; KParts modified - now
works; KTrader added; support for long long added;
created PyKDE2generic and revised build system;
new examples; removed inaccessible member classes;

@ -68,7 +68,7 @@ Jonathan Gardner, Hans-Peter Janssen, Marc Schmitt
(let me know if I've left out any names)
Daniel Naber
For bug reports and testing (KSharedPtr related)
For bug reports and testing (TDESharedPtr related)
Roberto Alsina
For an interim KDE3.1.1 compatible release

@ -144,7 +144,7 @@ postProcess = {
["-p ", "tdecore", "-o", "fixSignal", "tdecorepart0.*"]],
# "tdesu": None,
"tdefx": None,
"tdeui": None, #[["-p ", "tdeui", "-o", "shpix", "siptdeuiKSharedPixmap.cpp"]],
"tdeui": None, #[["-p ", "tdeui", "-o", "shpix", "siptdeuiTDESharedPixmap.cpp"]],
"tderesources": None,
"kabc": None,
"kio": None,

@ -680,8 +680,8 @@
<tr ><td><a href="tdeio/KServiceType.html">KServiceType</A></td></tr>
<tr ><td><a href="tdeio/KServiceTypeProfile.html">KServiceTypeProfile</A></td></tr>
<tr ><td><a href="tdecore/KSessionManaged.html">KSessionManaged</A></td></tr>
<tr ><td><a href="tdecore/KShared.html">KShared</A></td></tr>
<tr ><td><a href="tdecore/KSharedConfig.html">KSharedConfig</A></td></tr>
<tr ><td><a href="tdecore/TDEShared.html">TDEShared</A></td></tr>
<tr ><td><a href="tdecore/TDESharedConfig.html">TDESharedConfig</A></td></tr>
<tr ><td><a href="tdecore/KShell.html">KShell</A></td></tr>
<tr ><td><a href="tdeio/KShellCompletion.html">KShellCompletion</A></td></tr>
<tr ><td><a href="tdecore/KShellProcess.html">KShellProcess</A></td></tr>

@ -31,7 +31,7 @@
<td>KSycocaEntry <a href = "sip/glossary.html#abstract">(<i>abstract</i>)</a></td>
</tr>
<tr><td>Inherits</td>
<td>KShared </td>
<td>TDEShared </td>
</tr>
</table>
<h3>methods</h3><ul>

@ -31,7 +31,7 @@
<td>KLockFile</td>
</tr>
<tr><td>Inherits</td>
<td>KShared </td>
<td>TDEShared </td>
</tr>
</table>
<h3>enums</h3><ul>

@ -31,7 +31,7 @@
<td>KMountPoint</td>
</tr>
<tr><td>Inherits</td>
<td>KShared </td>
<td>TDEShared </td>
</tr>
</table>
<h3>enums</h3><ul>

@ -3,7 +3,7 @@
"http://www.w3.org/TR/html4/loose.dtd"">
<html>
<head>
<title>class KShared</title>
<title>class TDEShared</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="wabbit dumphtml">
</head>
@ -12,7 +12,7 @@
<hr>
<table width="100%"><tr>
<td width ="70%">
<h1>class KShared</h1><hr>
<h1>class TDEShared</h1><hr>
</td>
<td width="30%" valign="top" align="right">
<table>
@ -28,32 +28,32 @@
<td width="30%" align=left>tdecore</td>
</tr>
<tr><td>Class</td>
<td>KShared</td>
<td>TDEShared</td>
</tr>
<tr><td>Inherits</td>
<td> </td>
</tr>
</table>
<h3>methods</h3><ul>
<li><b>KShared</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a KShared instance</i></td></tr>
<li><b>TDEShared</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a TDEShared instance</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>KShared</b> (a0)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a KShared instance</i></td></tr>
<li><b>TDEShared</b> (a0)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a TDEShared instance</i></td></tr>
</table><table><tr bgcolor="#fff0ff"><th>Argument</th><th>Type</th><th>Default</th></tr>
<tr><td>a0</td><td>KShared</td><td></td></tr>
<tr><td>a0</td><td>TDEShared</td><td></td></tr>
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>_KShared_count</b> ()
<li><b>_TDEShared_count</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(int)</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>_KShared_ref</b> ()
<li><b>_TDEShared_ref</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>nothing</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>_KShared_unref</b> ()
<li><b>_TDEShared_unref</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>nothing</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>~KShared</b> ()
<li><b>~TDEShared</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>nothing</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
</ul>

@ -3,7 +3,7 @@
"http://www.w3.org/TR/html4/loose.dtd"">
<html>
<head>
<title>class KSharedConfig</title>
<title>class TDESharedConfig</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="wabbit dumphtml">
</head>
@ -12,7 +12,7 @@
<hr>
<table width="100%"><tr>
<td width ="70%">
<h1>class KSharedConfig</h1><hr>
<h1>class TDESharedConfig</h1><hr>
</td>
<td width="30%" valign="top" align="right">
<table>
@ -28,15 +28,15 @@
<td width="30%" align=left>tdecore</td>
</tr>
<tr><td>Class</td>
<td>KSharedConfig</td>
<td>TDESharedConfig</td>
</tr>
<tr><td>Inherits</td>
<td>TDEConfig, KShared </td>
<td>TDEConfig, TDEShared </td>
</tr>
</table>
<h3>methods</h3><ul>
<li><b>KSharedConfig</b> (fileName, immutable, useKDEGlobals)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a KSharedConfig instance</i></td></tr>
<li><b>TDESharedConfig</b> (fileName, immutable, useKDEGlobals)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a TDESharedConfig instance</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
</table><table><tr bgcolor="#fff0ff"><th>Argument</th><th>Type</th><th>Default</th></tr>
<tr><td>fileName</td><td>TQString</td><td></td></tr>
@ -45,7 +45,7 @@
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>openConfig</b> (fileName, immutable = 0, bUseKDEGlobals = 1)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(KSharedConfig.Ptr)</i></td></tr>
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(TDESharedConfig.Ptr)</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
<tr><td><i>static</i></td></tr>
</table><table><tr bgcolor="#fff0ff"><th>Argument</th><th>Type</th><th>Default</th></tr>
@ -54,7 +54,7 @@
<tr><td>bUseKDEGlobals</td><td>bool</td><td>1</td></tr>
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>~KSharedConfig</b> ()
<li><b>~TDESharedConfig</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>nothing</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>

@ -39,7 +39,7 @@
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a KTimezone instance</i></td></tr>
<tr><td>In versions KDE 3.5.0 and above only</td></tr>
</table><table><tr bgcolor="#fff0ff"><th>Argument</th><th>Type</th><th>Default</th></tr>
<tr><td>db</td><td>KSharedPtr<KTimezoneSource></td><td></td></tr>
<tr><td>db</td><td>TDESharedPtr<KTimezoneSource></td><td></td></tr>
<tr><td>name</td><td>TQString</td><td></td></tr>
<tr><td>countryCode</td><td>TQString</td><td>TQString ()</td></tr>
<tr><td>latitude</td><td>float</td><td>KTimezone .UNKNOWN</td></tr>

@ -31,7 +31,7 @@
<td>KTimezoneSource</td>
</tr>
<tr><td>Inherits</td>
<td>KShared </td>
<td>TDEShared </td>
</tr>
</table>
<h3>methods</h3><ul>

@ -46,7 +46,7 @@
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a TDEConfigSkeleton instance</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
</table><table><tr bgcolor="#fff0ff"><th>Argument</th><th>Type</th><th>Default</th></tr>
<tr><td>config</td><td>KSharedConfig.Ptr</td><td></td></tr>
<tr><td>config</td><td>TDESharedConfig.Ptr</td><td></td></tr>
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>addItem</b> (a0, name = TQString .null)

@ -82,7 +82,7 @@
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>sharedConfig</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(KSharedConfig)</i></td></tr>
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(TDESharedConfig)</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
<tr><td><i>static</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>

@ -94,7 +94,7 @@
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>sharedConfig</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(KSharedConfig)</i></td></tr>
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(TDESharedConfig)</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
</ul>

@ -137,8 +137,8 @@
<tr ><td><a href="KSelectionOwner.html">KSelectionOwner</a></td></tr>
<tr ><td><a href="KSelectionWatcher.html">KSelectionWatcher</a></td></tr>
<tr ><td><a href="KSessionManaged.html">KSessionManaged</a></td></tr>
<tr ><td><a href="KShared.html">KShared</a></td></tr>
<tr ><td><a href="KSharedConfig.html">KSharedConfig</a></td></tr>
<tr ><td><a href="TDEShared.html">TDEShared</a></td></tr>
<tr ><td><a href="TDESharedConfig.html">TDESharedConfig</a></td></tr>
<tr ><td><a href="KShell.html">KShell</a></td></tr>
<tr ><td><a href="KShellProcess.html">KShellProcess</a></td></tr>
<tr ><td><a href="KShortcut.html">KShortcut</a></td></tr>

@ -31,7 +31,7 @@
<td>KRES.ResourcePageInfo</td>
</tr>
<tr><td>Inherits</td>
<td>KShared </td>
<td>TDEShared </td>
</tr>
</table>
<h3>methods</h3><ul>

@ -168,7 +168,7 @@
</table>
</td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>sharedConfig</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(KSharedConfig.Ptr)</i></td></tr>
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>(TDESharedConfig.Ptr)</i></td></tr>
<tr><td>In versions KDE 3.2.0 and above only</td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>type</b> ()

@ -3,7 +3,7 @@
"http://www.w3.org/TR/html4/loose.dtd"">
<html>
<head>
<title>class KSharedPixmap</title>
<title>class TDESharedPixmap</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="wabbit dumphtml">
</head>
@ -12,7 +12,7 @@
<hr>
<table width="100%"><tr>
<td width ="70%">
<h1>class KSharedPixmap</h1><hr>
<h1>class TDESharedPixmap</h1><hr>
</td>
<td width="30%" valign="top" align="right">
<table>
@ -27,15 +27,15 @@
<td width="30%" align=left>tdeui</td>
</tr>
<tr><td>Class</td>
<td>KSharedPixmap</td>
<td>TDESharedPixmap</td>
</tr>
<tr><td>Inherits</td>
<td>TQWidget, KPixmap </td>
</tr>
</table>
<h3>methods</h3><ul>
<li><b>KSharedPixmap</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a KSharedPixmap instance</i></td></tr>
<li><b>TDESharedPixmap</b> ()
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>a TDESharedPixmap instance</i></td></tr>
</table></td><td width="50%"><table><tr><td></td></tr></table></td></tr></table></li><hr>
<li><b>done</b> (success)
<table width = "100%"><tr><td width="50%" valign="top"><table><tr><td>returns <i>nothing</i></td></tr>

@ -6,7 +6,7 @@ uisampler.py - demos of most of the tdeui widgets,
including dialogs, menus (KAction, KStdAction, etc)
widgets, and xml ui definition
mimetest.py - tests KSharedPtr related classes/methods
mimetest.py - tests TDESharedPtr related classes/methods
such as KMimetype, KService, etc
menudemo.py

@ -1,5 +1,5 @@
"""
This program tests/demos some of the KSharedPtr related classes and
This program tests/demos some of the TDESharedPtr related classes and
methods (KMimeType, KService, etc). It generally tests the *::List
methods for these classes (eg KService::List) since that also tests
the *::Ptr mapped type code (eg KService::Ptr) at the same time.
@ -253,7 +253,7 @@ class KMimeTypeTab (TQWidget):
#-------------------- main ------------------------------------------------
description = "Test/demo KSharedPtr related methods/classes"
description = "Test/demo TDESharedPtr related methods/classes"
version = "1.0"
aboutData = TDEAboutData ("", "",\
version, description, TDEAboutData.License_GPL,\

@ -88,8 +88,8 @@ tdecore,KSelectionOwner,,,
tdecore,KSelectionWatcher,,,
tdecore,TDEServerSocket,,,
tdecore,KSessionManaged,,,
tdecore,KShared,,,
tdecore,KSharedConfig,,,
tdecore,TDEShared,,,
tdecore,TDESharedConfig,,,
tdecore,KShell,,,
tdecore,KShellProcess,,,
tdecore,KShortcut,,,

@ -221,7 +221,7 @@ def miscKIntValidator (parent):
def miscKPixmapIO (parent):
parent.currentPageObj = PageNotImpl (parent)
def miscKSharedPixmap (parent):
def miscTDESharedPixmap (parent):
parent.currentPageObj = PageNotImpl (parent)
def miscKSystemTray (parent):

@ -114,7 +114,7 @@ listItems = {"Dialogs":
"KFloatValidator": [],\
"KIntValidator": [],\
"KPixmapIO": [],\
"KSharedPixmap": [],\
"TDESharedPixmap": [],\
"KSystemTray": [],\
"KThemeBase": ["KThemeCache", "KThemePixmap", "KThemeStyle"],\
"QXEmbed": []}}

@ -15,128 +15,128 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers perfectly. So just
* use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->KShared::_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->TDEShared::_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->KShared::_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->TDEShared::_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->KShared::_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->TDEShared::_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->KShared::_KShared_unref();
if ( ptr ) ptr->TDEShared::_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->KShared::_KShared_ref();
if ( ptr ) ptr->TDEShared::_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->KShared::_KShared_unref();
if ( ptr ) ptr->TDEShared::_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->KShared::_KShared_ref();
if ( ptr ) ptr->TDEShared::_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -163,7 +163,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->KShared::_KShared_count(); } // for debugging purposes
int count() const { return ptr->TDEShared::_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,128 +15,128 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers perfectly. So just
* use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -163,7 +163,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,128 +15,128 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers perfectly. So just
* use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -163,7 +163,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,128 +15,128 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers perfectly. So just
* use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.22 2003/08/20 08:01:42 coolo Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -163,7 +163,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
class KShared {
class TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
* @version $Id: ksharedptr.h,v 1.23 2004/02/04 12:16:03 raabe Exp $
*/
template< class T >
struct KSharedPtr
struct TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -15,132 +15,132 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSharedPTR_H
#define KSharedPTR_H
#ifndef TDESharedPTR_H
#define TDESharedPTR_H
#include "tdelibs_export.h"
/**
* Reference counting for shared objects. If you derive your object
* from this class, then you may use it in conjunction with
* KSharedPtr to control the lifetime of your object.
* TDESharedPtr to control the lifetime of your object.
*
* Specifically, all classes that derive from KShared have an internal
* Specifically, all classes that derive from TDEShared have an internal
* counter keeping track of how many other objects have a reference to
* their object. If used with KSharedPtr, then your object will
* their object. If used with TDESharedPtr, then your object will
* not be deleted until all references to the object have been
* released.
*
* You should probably not ever use any of the methods in this class
* directly -- let the KSharedPtr take care of that. Just derive
* your class from KShared and forget about it.
* directly -- let the TDESharedPtr take care of that. Just derive
* your class from TDEShared and forget about it.
*
* @author Waldo Bastian <bastian@kde.org>
*/
class TDECORE_EXPORT KShared {
class TDECORE_EXPORT TDEShared {
public:
/**
* Standard constructor. This will initialize the reference count
* on this object to 0.
*/
KShared() : count(0) { }
TDEShared() : count(0) { }
/**
* Copy constructor. This will @em not actually copy the objects
* but it will initialize the reference count on this object to 0.
*/
KShared( const KShared & ) : count(0) { }
TDEShared( const TDEShared & ) : count(0) { }
/**
* Overloaded assignment operator.
*/
KShared &operator=(const KShared & ) { return *this; }
TDEShared &operator=(const TDEShared & ) { return *this; }
/**
* Increases the reference count by one.
*/
void _KShared_ref() const { count++; }
void _TDEShared_ref() const { count++; }
/**
* Releases a reference (decreases the reference count by one). If
* the count goes to 0, this object will delete itself.
*/
void _KShared_unref() const { if (!--count) delete this; }
void _TDEShared_unref() const { if (!--count) delete this; }
/**
* Return the current number of references held.
*
* @return Number of references
*/
int _KShared_count() const { return count; }
int _TDEShared_count() const { return count; }
protected:
virtual ~KShared() { }
virtual ~TDEShared() { }
private:
mutable int count;
};
/**
* Can be used to control the lifetime of an object that has derived
* KShared. As long a someone holds a KSharedPtr on some KShared
* TDEShared. As long a someone holds a TDESharedPtr on some TDEShared
* object it won't become deleted but is deleted once its reference
* count is 0. This struct emulates C++ pointers virtually perfectly.
* So just use it like a simple C++ pointer.
*
* KShared and KSharedPtr are preferred over TQShared / TQSharedPtr
* TDEShared and TDESharedPtr are preferred over TQShared / TQSharedPtr
* since they are more safe.
*
* WARNING: Please note that this class template provides an implicit
* conversion to T*. Do *not* change this pointer or the pointee (don't
* call delete on it, for instance) behind KSharedPtr's back.
* call delete on it, for instance) behind TDESharedPtr's back.
*
* @author Waldo Bastian <bastian@kde.org>
*/
template< class T >
class KSharedPtr
class TDESharedPtr
{
public:
/**
* Creates a null pointer.
*/
KSharedPtr()
TDESharedPtr()
: ptr(0) { }
/**
* Creates a new pointer.
* @param t the pointer
*/
KSharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( T* t )
: ptr(t) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Copies a pointer.
* @param p the pointer to copy
*/
KSharedPtr( const KSharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_KShared_ref(); }
TDESharedPtr( const TDESharedPtr& p )
: ptr(p.ptr) { if ( ptr ) ptr->_TDEShared_ref(); }
/**
* Unreferences the object that this pointer points to. If it was
* the last reference, the object will be deleted.
*/
~KSharedPtr() { if ( ptr ) ptr->_KShared_unref(); }
~TDESharedPtr() { if ( ptr ) ptr->_TDEShared_unref(); }
KSharedPtr<T>& operator= ( const KSharedPtr<T>& p ) {
TDESharedPtr<T>& operator= ( const TDESharedPtr<T>& p ) {
if ( ptr == p.ptr ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p.ptr;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
KSharedPtr<T>& operator= ( T* p ) {
TDESharedPtr<T>& operator= ( T* p ) {
if ( ptr == p ) return *this;
if ( ptr ) ptr->_KShared_unref();
if ( ptr ) ptr->_TDEShared_unref();
ptr = p;
if ( ptr ) ptr->_KShared_ref();
if ( ptr ) ptr->_TDEShared_ref();
return *this;
}
bool operator== ( const KSharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const KSharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const TDESharedPtr<T>& p ) const { return ( ptr == p.ptr ); }
bool operator!= ( const TDESharedPtr<T>& p ) const { return ( ptr != p.ptr ); }
bool operator== ( const T* p ) const { return ( ptr == p ); }
bool operator!= ( const T* p ) const { return ( ptr != p ); }
bool operator!() const { return ( ptr == 0 ); }
@ -167,7 +167,7 @@ public:
* Returns the number of references.
* @return the number of references
*/
int count() const { return ptr->_KShared_count(); } // for debugging purposes
int count() const { return ptr->_TDEShared_count(); } // for debugging purposes
private:
T* ptr;
};

@ -184,7 +184,7 @@ def qtNoTr (filelist):
def shpix ():
# if concatenated, the sip*.cpp file doesn't exist
fn = ['siptdeuiKSharedPixmap.cpp']
fn = ['siptdeuiTDESharedPixmap.cpp']
if not os.path.exists (os.path.join (opPath, fn [0])):
files = os.listdir (opPath)
fn = []
@ -206,9 +206,9 @@ def shpix ():
state = None
for ln in range (0, len (buff)):
line = buff [ln]
if string.find (line, "sipKSharedPixmap::resolution") >= 0:
if string.find (line, "sipTDESharedPixmap::resolution") >= 0:
state = "res"
elif string.find (line, "sipKSharedPixmap::setResolution") >= 0:
elif string.find (line, "sipTDESharedPixmap::setResolution") >= 0:
state = "setRes"
else:
state = None

@ -33,7 +33,7 @@ class KMimeType : KServiceType
public:
typedef KSharedPtr<KMimeType> Ptr;
typedef TDESharedPtr<KMimeType> Ptr;
typedef TQValueList<KMimeType::Ptr> List;
public:
@ -252,7 +252,7 @@ protected:
if (!sipCpp)
return NULL;
KSharedPtr<KMimeType> *cPtr = (KSharedPtr<KMimeType> *)sipCpp;
TDESharedPtr<KMimeType> *cPtr = (TDESharedPtr<KMimeType> *)sipCpp;
KMimeType *cpp = new KMimeType (*cPtr->data ());
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KMimeType, sipTransferObj);
@ -274,7 +274,7 @@ protected:
return 0;
}
*sipCppPtr = new KSharedPtr<KMimeType> (cpp);
*sipCppPtr = new TDESharedPtr<KMimeType> (cpp);
return 1;
%End

@ -32,7 +32,7 @@ class KProtocolInfo : KSycocaEntry
public:
typedef KSharedPtr<KProtocolInfo> Ptr;
typedef TDESharedPtr<KProtocolInfo> Ptr;
public:
KProtocolInfo (const TQString&);
@ -187,7 +187,7 @@ protected:
if (!sipCpp)
return NULL;
KSharedPtr<KProtocolInfo> *cPtr = new KSharedPtr<KProtocolInfo>(*(KSharedPtr<KProtocolInfo> *)sipCpp);
TDESharedPtr<KProtocolInfo> *cPtr = new TDESharedPtr<KProtocolInfo>(*(TDESharedPtr<KProtocolInfo> *)sipCpp);
KProtocolInfo *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KProtocolInfo, sipTransferObj);
@ -209,7 +209,7 @@ protected:
return 0;
}
*sipCppPtr = new KSharedPtr<KProtocolInfo> (cpp);
*sipCppPtr = new TDESharedPtr<KProtocolInfo> (cpp);
return 1;
%End

@ -32,7 +32,7 @@ class KService : KSycocaEntry
public:
//ig typedef KSharedPtr<KService> Ptr;
//ig typedef TDESharedPtr<KService> Ptr;
//ig typedef TQValueList<KService::Ptr> List;
public:
@ -164,7 +164,7 @@ protected:
%TypeHeaderCode
#include <ksharedptr.h>
#include <kservice.h>
//typedef KSharedPtr<KService> SvcPtr;
//typedef TDESharedPtr<KService> SvcPtr;
//typedef KService::Ptr SvcPtr;
%End
@ -174,7 +174,7 @@ protected:
if (!sipCpp)
return NULL;
KSharedPtr<KService> *cPtr = new KSharedPtr<KService> (*(KSharedPtr<KService> *)sipCpp);
TDESharedPtr<KService> *cPtr = new TDESharedPtr<KService> (*(TDESharedPtr<KService> *)sipCpp);
KService *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KService, sipTransferObj);
@ -196,7 +196,7 @@ protected:
return 0;
}
*sipCppPtr = new KSharedPtr<KService> (cpp);
*sipCppPtr = new TDESharedPtr<KService> (cpp);
return 1;
%End
@ -209,7 +209,7 @@ protected:
%TypeHeaderCode
#include <tqvaluelist.h>
#include <kservice.h>
//typedef KSharedPtr<KService> Ptr;
//typedef TDESharedPtr<KService> Ptr;
//typedef TQValueList<Ptr> SvcList;
//typedef KService::List SvcList;
typedef TQValueList<KService::Ptr> List;
@ -230,12 +230,12 @@ typedef TQValueList<KService::Ptr> List;
// Get it.
KService::List *cList = (KService::List *)sipCpp;
PyObject *inst;
KSharedPtr<KService> *svc;
TDESharedPtr<KService> *svc;
KService::List::Iterator it;
for( it = cList->begin(); it != cList->end(); ++it )
{
KSharedPtr <KService> svcptr = static_cast<KService::Ptr>(*it);
TDESharedPtr <KService> svcptr = static_cast<KService::Ptr>(*it);
svc = &svcptr;
inst = sipConvertFromType(svc, sipType_KService_Ptr, sipTransferObj);

@ -32,8 +32,8 @@ class KServiceGroup : KSycocaEntry
public:
//ig typedef KSharedPtr<KServiceGroup> Ptr;
//ig typedef KSharedPtr<KSycocaEntry> SPtr;
//ig typedef TDESharedPtr<KServiceGroup> Ptr;
//ig typedef TDESharedPtr<KSycocaEntry> SPtr;
%If ( KDE_3_1_2 - )
//ig typedef TQValueList<KServiceGroup::SPtr> List;
@ -144,7 +144,7 @@ class KServiceSeparator : KSycocaEntry
public:
//ig typedef KSharedPtr<KServiceSeparator> Ptr;
//ig typedef TDESharedPtr<KServiceSeparator> Ptr;
public:
KServiceSeparator ();
@ -173,7 +173,7 @@ public:
if (!sipCpp)
return NULL;
KSharedPtr<KServiceGroup> *cPtr = new KSharedPtr<KServiceGroup> (*(KSharedPtr<KServiceGroup> *)sipCpp);
TDESharedPtr<KServiceGroup> *cPtr = new TDESharedPtr<KServiceGroup> (*(TDESharedPtr<KServiceGroup> *)sipCpp);
KServiceGroup *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KServiceGroup, sipTransferObj);
@ -195,7 +195,7 @@ public:
return 0;
}
*sipCppPtr = new KSharedPtr<KServiceGroup> (cpp);
*sipCppPtr = new TDESharedPtr<KServiceGroup> (cpp);
return 1;
%End
@ -230,12 +230,12 @@ public:
KServiceGroup::List *cList = (KServiceGroup::List *)sipCpp;
PyObject *inst;
KSharedPtr <KSycocaEntry> *svcGroupType;
TDESharedPtr <KSycocaEntry> *svcGroupType;
KServiceGroup::List::Iterator it;
for( it = cList->begin(); it != cList->end(); ++it )
{
KSharedPtr<KSycocaEntry> svcptr = static_cast<KServiceGroup::SPtr>(*it);
TDESharedPtr<KSycocaEntry> svcptr = static_cast<KServiceGroup::SPtr>(*it);
svcGroupType = &svcptr;
inst = sipConvertFromType(svcGroupType, sipType_KSycocaEntry_Ptr, sipTransferObj);

@ -235,12 +235,12 @@ protected:
// Get it.
TQValueList<KServiceType::Ptr> *cList = (TQValueList<KServiceType::Ptr> *)sipCpp;
PyObject *inst;
KSharedPtr <KServiceType> *svc;
TDESharedPtr <KServiceType> *svc;
TQValueList<KServiceType::Ptr>::Iterator it;
for( it = cList->begin(); it != cList->end(); ++it )
{
KSharedPtr <KServiceType> svcptr = static_cast<KServiceType::Ptr>(*it);
TDESharedPtr <KServiceType> svcptr = static_cast<KServiceType::Ptr>(*it);
svc = &svcptr;
inst = sipConvertFromType(svc, sipType_KServiceType_Ptr, sipTransferObj);

@ -24,7 +24,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class KSycocaEntry : KShared
class KSycocaEntry : TDEShared
{
%TypeHeaderCode
#include <tdesycocaentry.h>
@ -36,7 +36,7 @@ public:
virtual KSycocaType sycocaType () const;
public:
//ig typedef KSharedPtr<KSycocaEntry> Ptr;
//ig typedef TDESharedPtr<KSycocaEntry> Ptr;
//ig typedef TQValueList<KSycocaEntry::Ptr> List;
public:
@ -79,7 +79,7 @@ protected:
if (!sipCpp)
return NULL;
KSharedPtr<KSycocaEntry> *cPtr = new KSharedPtr<KSycocaEntry> (*(KSharedPtr<KSycocaEntry> *)sipCpp);
TDESharedPtr<KSycocaEntry> *cPtr = new TDESharedPtr<KSycocaEntry> (*(TDESharedPtr<KSycocaEntry> *)sipCpp);
KSycocaEntry *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KSycocaEntry, sipTransferObj);
@ -101,7 +101,7 @@ protected:
return 0;
}
*sipCppPtr = new KSharedPtr<KSycocaEntry> (cpp);
*sipCppPtr = new TDESharedPtr<KSycocaEntry> (cpp);
return 1;
%End
@ -137,23 +137,23 @@ protected:
KSycocaEntry::List *cList = (KSycocaEntry::List *)sipCpp;
PyObject *inst;
KSharedPtr<KSycocaEntry> *svc;
KSharedPtr <KService> *svcType;
KSharedPtr <KServiceGroup> *svcGroupType;
TDESharedPtr<KSycocaEntry> *svc;
TDESharedPtr <KService> *svcType;
TDESharedPtr <KServiceGroup> *svcGroupType;
KSycocaEntry::List::Iterator it;
for( it = cList->begin(); it != cList->end(); ++it )
{
KSharedPtr<KSycocaEntry> svcptr = static_cast<KSycocaEntry::Ptr>(*it);
TDESharedPtr<KSycocaEntry> svcptr = static_cast<KSycocaEntry::Ptr>(*it);
svc = &svcptr;
if (svc->data ()->sycocaType () == KST_KService)
{
svcType = (KSharedPtr<KService> *)svc;
svcType = (TDESharedPtr<KService> *)svc;
inst = sipConvertFromType(svcType, sipType_KService_Ptr, sipTransferObj);
}
else if (svc->data ()->sycocaType () == KST_KServiceGroup)
{
svcGroupType = (KSharedPtr <KServiceGroup> *) svc;
svcGroupType = (TDESharedPtr <KServiceGroup> *) svc;
inst = sipConvertFromType(svcGroupType, sipType_KServiceGroup_Ptr, sipTransferObj);
}
else

@ -37,7 +37,7 @@ public:
static TDEConfig* config ();
%If ( KDE_3_2_0 - )
static KSharedConfig* sharedConfig ();
static TDESharedConfig* sharedConfig ();
%End
static KIconLoader* iconLoader ();

@ -39,7 +39,7 @@ public:
TDEConfig* config () const;
%If ( KDE_3_2_0 - )
KSharedConfig* sharedConfig () const;
TDESharedConfig* sharedConfig () const;
%End
KIconLoader* iconLoader () const;

@ -26,7 +26,7 @@
%If ( KDE_3_3_0 - )
class KLockFile : KShared
class KLockFile : TDEShared
{
%TypeHeaderCode
#include <klockfile.h>
@ -34,7 +34,7 @@ class KLockFile : KShared
public:
typedef KSharedPtr<KLockFile> Ptr;
typedef TDESharedPtr<KLockFile> Ptr;
KLockFile (const TQString&);
enum LockResult
@ -80,7 +80,7 @@ public:
if (!sipCpp)
return NULL;
KSharedPtr<KLockFile> *cPtr = new KSharedPtr<KLockFile> (*(KSharedPtr<KLockFile> *)sipCpp);
TDESharedPtr<KLockFile> *cPtr = new TDESharedPtr<KLockFile> (*(TDESharedPtr<KLockFile> *)sipCpp);
KLockFile *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KLockFile, sipTransferObj);
@ -102,7 +102,7 @@ public:
return 0;
}
*sipCppPtr = new KSharedPtr<KLockFile> (cpp);
*sipCppPtr = new TDESharedPtr<KLockFile> (cpp);
return 1;
%End

@ -26,7 +26,7 @@
%If ( KDE_3_2_0 - )
class KMountPoint : KShared
class KMountPoint : TDEShared
{
%TypeHeaderCode
#include <kmountpoint.h>
@ -34,7 +34,7 @@ class KMountPoint : KShared
public:
//ig typedef KSharedPtr<KMountPoint> Ptr;
//ig typedef TDESharedPtr<KMountPoint> Ptr;
//ig typedef TQValueList<KMountPoint::Ptr> List;
public:
@ -81,7 +81,7 @@ private:
if (!sipCpp)
return NULL;
KSharedPtr<KMountPoint> *cPtr = new KSharedPtr<KMountPoint> (*(KSharedPtr<KMountPoint> *)sipCpp);
TDESharedPtr<KMountPoint> *cPtr = new TDESharedPtr<KMountPoint> (*(TDESharedPtr<KMountPoint> *)sipCpp);
KMountPoint *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KMountPoint, sipTransferObj);
@ -103,7 +103,7 @@ private:
return 0;
}
*sipCppPtr = new KSharedPtr<KMountPoint> (cpp);
*sipCppPtr = new TDESharedPtr<KMountPoint> (cpp);
return 1;
%End

@ -24,7 +24,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class KShared
class TDEShared
{
%TypeHeaderCode
#include <ksharedptr.h>
@ -32,14 +32,14 @@ class KShared
public:
KShared ();
KShared (const KShared&);
void _KShared_ref ();
void _KShared_unref ();
int _KShared_count ();
TDEShared ();
TDEShared (const TDEShared&);
void _TDEShared_ref ();
void _TDEShared_unref ();
int _TDEShared_count ();
protected:
~KShared ();
~TDEShared ();
}; // class KShared
}; // class TDEShared

@ -26,7 +26,7 @@
%If ( KDE_3_5_0 - )
class KTimezoneSource : KShared
class KTimezoneSource : TDEShared
{
%TypeHeaderCode
#include <ktimezones.h>
@ -56,7 +56,7 @@ public:
static const float UNKNOWN;
static bool isValidLatitude (float);
static bool isValidLongitude (float);
KTimezone (KSharedPtr<KTimezoneSource>, const TQString&, const TQString& = TQString (), float = KTimezone ::UNKNOWN , float = KTimezone ::UNKNOWN , const TQString& = TQString ());
KTimezone (TDESharedPtr<KTimezoneSource>, const TQString&, const TQString& = TQString (), float = KTimezone ::UNKNOWN , float = KTimezone ::UNKNOWN , const TQString& = TQString ());
TQString name () const;
TQString countryCode () const;
float latitude () const;
@ -72,7 +72,7 @@ private:
public:
//force
typedef KSharedPtr<KTimezoneSource> TZSourcePtr;
typedef TDESharedPtr<KTimezoneSource> TZSourcePtr;
//end
}; // class KTimezone
@ -134,8 +134,8 @@ private:
%If (KDE_3_5_0 - )
%MappedType KSharedPtr<KTimezoneSource>
//converts KSharedPtr<KTimezoneSource>
%MappedType TDESharedPtr<KTimezoneSource>
//converts TDESharedPtr<KTimezoneSource>
{
%TypeHeaderCode
#include <ksharedptr.h>
@ -148,7 +148,7 @@ private:
if (!sipCpp)
return NULL;
KSharedPtr<KTimezoneSource> *cPtr = new KSharedPtr<KTimezoneSource> (*(KSharedPtr<KTimezoneSource> *)sipCpp);
TDESharedPtr<KTimezoneSource> *cPtr = new TDESharedPtr<KTimezoneSource> (*(TDESharedPtr<KTimezoneSource> *)sipCpp);
KTimezoneSource *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KTimezoneSource, sipTransferObj);
@ -170,7 +170,7 @@ private:
return 0;
}
*sipCppPtr = new KSharedPtr<KTimezoneSource> (cpp);
*sipCppPtr = new TDESharedPtr<KTimezoneSource> (cpp);
return 1;
%End

@ -79,7 +79,7 @@ protected:
%If ( KDE_3_2_0 - )
class KSharedConfig : TDEConfig, KShared
class TDESharedConfig : TDEConfig, TDEShared
{
%TypeHeaderCode
#include <tdeconfig.h>
@ -87,16 +87,16 @@ class KSharedConfig : TDEConfig, KShared
public:
//ig typedef KSharedPtr<KSharedConfig> Ptr;
//ig typedef TDESharedPtr<TDESharedConfig> Ptr;
public:
static KSharedConfig::Ptr openConfig (const TQString&, bool = 0, bool = 1);
static TDESharedConfig::Ptr openConfig (const TQString&, bool = 0, bool = 1);
private:
KSharedConfig (const TQString&, bool, bool);
~KSharedConfig ();
TDESharedConfig (const TQString&, bool, bool);
~TDESharedConfig ();
}; // class KSharedConfig
}; // class TDESharedConfig
%End
@ -192,8 +192,8 @@ private:
%If (KDE_3_2_0 - )
%MappedType KSharedConfig::Ptr
//converts KSharedConfig
%MappedType TDESharedConfig::Ptr
//converts TDESharedConfig
{
%TypeHeaderCode
#include <ksharedptr.h>
@ -206,9 +206,9 @@ private:
if (!sipCpp)
return NULL;
KSharedPtr<KSharedConfig> *cPtr = new KSharedPtr<KSharedConfig> (*(KSharedPtr<KSharedConfig> *)sipCpp);
KSharedConfig *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_KSharedConfig, sipTransferObj);
TDESharedPtr<TDESharedConfig> *cPtr = new TDESharedPtr<TDESharedConfig> (*(TDESharedPtr<TDESharedConfig> *)sipCpp);
TDESharedConfig *cpp = cPtr->data ();
PyObject *obj = sipConvertFromInstance (cpp, sipClass_TDESharedConfig, sipTransferObj);
return obj;
%End
@ -220,7 +220,7 @@ private:
return PyInstance_Check(sipPy);
int iserr = 0;
KSharedConfig *cpp = (KSharedConfig *)sipForceConvertToType(sipPy, sipType_KSharedConfig, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);
TDESharedConfig *cpp = (TDESharedConfig *)sipForceConvertToType(sipPy, sipType_TDESharedConfig, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);
if (iserr)
{
@ -228,7 +228,7 @@ private:
return 0;
}
*sipCppPtr = new KSharedPtr<KSharedConfig> (cpp);
*sipCppPtr = new TDESharedPtr<TDESharedConfig> (cpp);
return 1;
%End

@ -227,7 +227,7 @@ public:
public:
TDEConfigSkeleton (const TQString& = TQString ::null );
TDEConfigSkeleton (KSharedConfig::Ptr);
TDEConfigSkeleton (TDESharedConfig::Ptr);
void setDefaults ();
void readConfig ();
void writeConfig ();

@ -28,7 +28,7 @@
namespace KRES
{
class ResourcePageInfo : KShared
class ResourcePageInfo : TDEShared
{
%TypeHeaderCode
#include <configpage.h>

@ -28,15 +28,15 @@
namespace KSpell2
{
class Broker : TQObject, KShared
class Broker : TQObject, TDEShared
{
%TypeHeaderCode
#include <broker.h>
%End
public:
typedef KSharedPtr<Broker> Ptr;
static KSpell2::Broker* openBroker (KSharedConfig* = 0);
typedef TDESharedPtr<Broker> Ptr;
static KSpell2::Broker* openBroker (TDESharedConfig* = 0);
public:
KSpell2::DefaultDictionary* defaultDictionary () const;
@ -52,7 +52,7 @@ protected:
void changed ();
private:
Broker (KSharedConfig*);
Broker (TDESharedConfig*);
}; // class Broker

@ -50,10 +50,10 @@ public:
TQStringList currentIgnoreList () const;
bool ignore (const TQString&);
void save ();
KSharedConfig* sharedConfig () const;
TDESharedConfig* sharedConfig () const;
private:
Settings (KSpell2::Broker*, KSharedConfig*);
Settings (KSpell2::Broker*, TDESharedConfig*);
}; // class Settings

@ -161,7 +161,7 @@ protected:
{sipName_KSelectAction, &sipClass_KSelectAction},
{sipName_KSelector, &sipClass_KSelector},
{sipName_KSeparator, &sipClass_KSeparator},
// {sipName_KSharedPixmap, &sipClass_KSharedPixmap},
// {sipName_TDESharedPixmap, &sipClass_TDESharedPixmap},
{sipName_KSqueezedTextLabel, &sipClass_KSqueezedTextLabel},
{sipName_KStatusBar, &sipClass_KStatusBar},
{sipName_KStatusBarLabel, &sipClass_KStatusBarLabel},

@ -80,7 +80,7 @@ public:
TDEConfig* config () const;
%If ( KDE_3_2_0 - )
KSharedConfig::Ptr sharedConfig () const;
TDESharedConfig::Ptr sharedConfig () const;
%End
Type type () const;

@ -65,7 +65,7 @@ signals:
protected:
virtual bool eventFilter (TQObject*, TQEvent*);
//ig virtual void updateBackground (KSharedPixmap*);
//ig virtual void updateBackground (TDESharedPixmap*);
}; // class KRootPixmap

@ -24,7 +24,7 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class KSharedPixmap : TQWidget, KPixmap
class TDESharedPixmap : TQWidget, KPixmap
{
%TypeHeaderCode
#include <tqwidget.h>
@ -36,7 +36,7 @@ class KSharedPixmap : TQWidget, KPixmap
public:
KSharedPixmap ();
TDESharedPixmap ();
%If ( KDE_3_1_2 - )
bool loadFromShared (const TQString&, const TQRect& = TQRect ());
@ -58,5 +58,5 @@ public:
%End
}; // class KSharedPixmap
}; // class TDESharedPixmap

Loading…
Cancel
Save