• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • dom
dom_misc.h
Go to the documentation of this file.
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 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 <khtml_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::DomShared::DomShared
DomShared()
Definition: dom_misc.h:39
DOM::DomShared::deref
void deref()
Definition: dom_misc.h:47
DOM::DomShared::hasOneRef
bool hasOneRef() const
Definition: dom_misc.h:48
DOM::DomShared::_ref
unsigned int _ref
Definition: dom_misc.h:55
DOM::DomShared
Definition: dom_misc.h:36
DOM::DomShared::ref
void ref()
Definition: dom_misc.h:46
khtml_export.h
DOM::DomShared::refCount
unsigned int refCount() const
Definition: dom_misc.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal