Skip to content
Skip to link menu
Trinity API Reference
Trinity API Reference
khtml
khtml
khtml
dom
dom_misc.h
1
/*
2
* This file is part of the DOM implementation for KDE.
3
*
4
* (C) 1999 Lars Knoll (knoll@kde.org)
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
15
*
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
20
*
21
*/
22
#ifndef _DOM_RefCountImpl_h_
23
#define _DOM_RefCountImpl_h_
24
25
#include <kdelibs_export.h>
26
27
namespace
DOM
{
28
29
/*
30
* This implements the reference counting scheme used for all internal
31
* DOM objects.
32
*
33
* Other objects should overload deleteMe() to fit their needs. The default
34
* implementation deletes the object if the ref count drops to 0.
35
*/
36
class
KHTML_EXPORT DomShared
37
{
38
public
:
39
DomShared() : _ref( 0 ) {}
40
virtual
~DomShared();
41
42
/* Overload this function if you want a different deletion behavior
43
*/
44
virtual
bool
deleteMe();
45
46
void
ref() { _ref++; }
47
void
deref() {
if
(_ref) _ref--;
if
(!_ref && deleteMe())
delete
this
; }
48
bool
hasOneRef()
const
{
return
_ref == 1; }
49
unsigned
int
refCount()
const
{
return
_ref; }
50
51
protected
:
52
// the number of DOMObjects referencing this Node
53
// An implementation object will delete itself, if it has
54
// no DOMObject referencing it, and deleteMe() returns true.
55
unsigned
int
_ref;
56
};
57
58
}
// namespace
59
60
#endif
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition:
design.h:56
khtml
Skip menu "khtml"
Main Page
Namespace List
Class Hierarchy
Alphabetical List
Class List
File List
Namespace Members
Class Members
Related Pages
khtml
Skip menu "khtml"
arts
dcop
dnssd
interfaces
interface
library
kspeech
ktexteditor
kabc
kate
kcmshell
kdecore
kded
kdefx
kdeprint
kdesu
kdeui
kdoctools
khtml
kimgio
kinit
kio
bookmarks
httpfilter
kfile
kio
kioexec
kpasswdserver
kssl
kioslave
http
kjs
kmdi
kmdi
knewstuff
kparts
krandr
kresources
kspell2
kunittest
kutils
kwallet
libkmid
libkscreensaver