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