LibreOffice Module sot (master) 1
stgavl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SOT_SOURCE_SDSTOR_STGAVL_HXX
21#define INCLUDED_SOT_SOURCE_SDSTOR_STGAVL_HXX
22
23#include <sal/types.h>
24
25// This is an abstract base class for nodes.
26// Especially, the compare function must be implemented.
27
29{
30 friend class StgAvlIterator;
31private:
32 sal_Int32 Locate( StgAvlNode const *, StgAvlNode**, StgAvlNode**, StgAvlNode** );
33 short Adjust( StgAvlNode**, StgAvlNode const * );
38 void StgEnum( short& );
39 static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, bool );
40protected:
41 short m_nId; // iterator ID
42 short m_nBalance; // indicates tree balance
44 StgAvlNode();
45public:
46 virtual ~StgAvlNode();
47 StgAvlNode* Find( StgAvlNode const * );
48 static bool Insert( StgAvlNode**, StgAvlNode* );
49 static bool Remove( StgAvlNode**, StgAvlNode*, bool bDel );
50 virtual sal_Int32 Compare( const StgAvlNode* ) const = 0;
51};
52
53// The iterator class provides single stepping through an AVL tree.
54
56 StgAvlNode* m_pRoot; // root entry (parent)
57 short m_nCur; // current element
58 StgAvlNode* Find( short );
59public:
60 explicit StgAvlIterator( StgAvlNode* );
63};
64
65#endif
66
67/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StgAvlNode * First()
Definition: stgavl.cxx:400
StgAvlNode * m_pRoot
Definition: stgavl.hxx:56
StgAvlNode * Next()
Definition: stgavl.cxx:406
short m_nCur
Definition: stgavl.hxx:57
StgAvlIterator(StgAvlNode *)
Definition: stgavl.cxx:377
StgAvlNode * Find(short)
Definition: stgavl.cxx:388
short Adjust(StgAvlNode **, StgAvlNode const *)
Definition: stgavl.cxx:92
StgAvlNode * RotRL()
Definition: stgavl.cxx:189
short m_nBalance
Definition: stgavl.hxx:42
StgAvlNode * RotLL()
Definition: stgavl.cxx:135
void StgEnum(short &)
Definition: stgavl.cxx:273
virtual sal_Int32 Compare(const StgAvlNode *) const =0
StgAvlNode * RotLR()
Definition: stgavl.cxx:147
StgAvlNode * RotRR()
Definition: stgavl.cxx:178
short m_nId
Definition: stgavl.hxx:41
static StgAvlNode * Rem(StgAvlNode **, StgAvlNode *, bool)
Definition: stgavl.cxx:219
static bool Remove(StgAvlNode **, StgAvlNode *, bool bDel)
Definition: stgavl.cxx:340
StgAvlNode * Find(StgAvlNode const *)
Definition: stgavl.cxx:36
sal_Int32 Locate(StgAvlNode const *, StgAvlNode **, StgAvlNode **, StgAvlNode **)
Definition: stgavl.cxx:56
static bool Insert(StgAvlNode **, StgAvlNode *)
Definition: stgavl.cxx:285
virtual ~StgAvlNode()
Definition: stgavl.cxx:30
StgAvlNode()
Definition: stgavl.cxx:24
StgAvlNode * m_pLeft
Definition: stgavl.hxx:43
StgAvlNode * m_pRight
Definition: stgavl.hxx:43