Branch data Line data Source code
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 : : #ifndef _RSCTREE_HXX
20 : : #define _RSCTREE_HXX
21 : :
22 : : #include <tools/link.hxx>
23 : : #include <rsctools.hxx>
24 : :
25 : : /****************** C L A S S E S ****************************************/
26 : : class BiNode
27 : : {
28 : : protected:
29 : : BiNode* pLeft; // left subtree
30 : : BiNode* pRight; // right subtree
31 : :
32 : : public:
33 : :
34 : : // Wandelt eine doppelt verkettete Liste in
35 : : // einen binaeren Baum um
36 : : BiNode * ChangeDLListBTree( BiNode * pList );
37 : :
38 : : BiNode();
39 : : virtual ~BiNode();
40 : :
41 : :
42 : : // Wandelt einen binaeren Baum in eine doppelt
43 : : // verkettete Liste um
44 : : BiNode* ChangeBTreeDLList();
45 : :
46 : 2575470 : BiNode * Left() const { return pLeft ; };
47 : 14491226 : BiNode * Right() const{ return pRight ; };
48 : : void EnumNodes( Link aLink ) const;
49 : : };
50 : :
51 : : /*************************************************************************/
52 [ - + ]: 1020816 : class NameNode : public BiNode
53 : : {
54 : : void SubOrderTree( NameNode * pOrderNode );
55 : :
56 : : protected:
57 : : // pCmp ist Zeiger auf Namen
58 : : NameNode* Search( const void * pCmp ) const;
59 : :
60 : : public:
61 : 489318 : NameNode* Left() const { return (NameNode *)pLeft ; };
62 : 3820886 : NameNode* Right() const{ return (NameNode *)pRight ; };
63 : : NameNode* Search( const NameNode * pName ) const;
64 : : // insert a new node in the b-tree
65 : : sal_Bool Insert( NameNode * pTN, sal_uInt32 * nDepth );
66 : : sal_Bool Insert( NameNode* pTN );
67 : : virtual COMPARE Compare( const NameNode * ) const;
68 : : virtual COMPARE Compare( const void * ) const;
69 : : NameNode* SearchParent( const NameNode * ) const;
70 : : // return ist neue Root
71 : : NameNode* Remove( NameNode * );
72 : : void OrderTree();
73 : : };
74 : :
75 : : /*************************************************************************/
76 [ - + ]: 1020816 : class IdNode : public NameNode
77 : : {
78 : : virtual COMPARE Compare( const NameNode * ) const;
79 : : virtual COMPARE Compare( const void * ) const;
80 : : protected:
81 : : using NameNode::Search;
82 : :
83 : : public:
84 : :
85 : : IdNode* Search( sal_uInt32 nTypName ) const;
86 : : virtual sal_uInt32 GetId() const;
87 : : };
88 : :
89 : : /*************************************************************************/
90 [ # # ]: 0 : class StringNode : public NameNode
91 : : {
92 : : virtual COMPARE Compare( const NameNode * ) const;
93 : : virtual COMPARE Compare( const void * ) const;
94 : :
95 : : protected:
96 : : using NameNode::Search;
97 : :
98 : : rtl::OString m_aName;
99 : :
100 : : public:
101 : : StringNode() {}
102 : 0 : StringNode(const rtl::OString& rStr) { m_aName = rStr; }
103 : :
104 : : StringNode* Search( const char * ) const;
105 : 0 : rtl::OString GetName() const { return m_aName; }
106 : : };
107 : :
108 : : #endif // _RSCTREE_HXX
109 : :
110 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|