• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kjs
 

kjs

  • kjs
scope_chain.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 2003 Apple Computer, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  */
21 
22 #ifndef KJS_SCOPE_CHAIN_H
23 #define KJS_SCOPE_CHAIN_H
24 
25 #include "global.h"
26 
27 namespace KJS {
28 
29  class ObjectImp;
30 
34  class KJS_EXPORT ScopeChainNode {
35  public:
36  ScopeChainNode(ScopeChainNode *n, ObjectImp *o)
37  : next(n), object(o), refCount(1) { }
38 
39  ScopeChainNode *next;
40  ObjectImp *object;
41  int refCount;
42  };
43 
47  class KJS_EXPORT ScopeChain {
48  public:
49  ScopeChain() : _node(0) { }
50  ~ScopeChain() { deref(); }
51 
52  ScopeChain(const ScopeChain &c) : _node(c._node)
53  { if (_node) ++_node->refCount; }
54  ScopeChain &operator=(const ScopeChain &);
55 
56  bool isEmpty() const { return !_node; }
57  ObjectImp *top() const { return _node->object; }
58  ObjectImp *bottom() const { const ScopeChainNode *n = _node;
59  while (n->next) n = n->next;
60  return n->object; }
61 
62  void clear() { deref(); _node = 0; }
63  void push(ObjectImp *);
64  void pop();
65 
66  void mark();
67 
68  private:
69  ScopeChainNode *_node;
70 
71  void deref() { if (_node && --_node->refCount == 0) release(); }
72  void ref() const;
73 
74  void release();
75  };
76 
77 } // namespace KJS
78 
79 #endif // KJS_SCOPE_CHAIN_H
KJS::ScopeChain
A scope chain object.
Definition: scope_chain.h:47
KJS
Definition: array_instance.h:28
KJS::ScopeChainNode
A scope chain node.
Definition: scope_chain.h:34

kjs

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

kjs

Skip menu "kjs"
  • 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
Generated for kjs by doxygen 1.8.11
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |