1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rsctree.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <tools/link.hxx>
34 #include <rsctools.hxx>
36 /****************** C L A S S E S ****************************************/
40 BiNode
* pLeft
; // left subtree
41 BiNode
* pRight
; // right subtree
45 // Wandelt eine doppelt verkettete Liste in
46 // einen binaeren Baum um
47 BiNode
* ChangeDLListBTree( BiNode
* pList
);
53 // Wandelt einen binaeren Baum in eine doppelt
54 // verkettete Liste um
55 BiNode
* ChangeBTreeDLList();
57 BiNode
* Left() const { return pLeft
; };
58 BiNode
* Right() const{ return pRight
; };
59 void EnumNodes( Link aLink
) const;
62 /*************************************************************************/
63 class NameNode
: public BiNode
65 void SubOrderTree( NameNode
* pOrderNode
);
68 // pCmp ist Zeiger auf Namen
69 NameNode
* Search( const void * pCmp
) const;
72 NameNode
* Left() const { return (NameNode
*)pLeft
; };
73 NameNode
* Right() const{ return (NameNode
*)pRight
; };
74 NameNode
* Search( const NameNode
* pName
) const;
75 // insert a new node in the b-tree
76 BOOL
Insert( NameNode
* pTN
, sal_uInt32
* nDepth
);
77 BOOL
Insert( NameNode
* pTN
);
78 virtual COMPARE
Compare( const NameNode
* ) const;
79 virtual COMPARE
Compare( const void * ) const;
80 NameNode
* SearchParent( const NameNode
* ) const;
81 // return ist neue Root
82 NameNode
* Remove( NameNode
* );
84 BOOL
IsOrderTree() const;
88 /*************************************************************************/
89 class IdNode
: public NameNode
91 virtual COMPARE
Compare( const NameNode
* ) const;
92 virtual COMPARE
Compare( const void * ) const;
94 using NameNode::Search
;
98 IdNode
* Search( sal_uInt32 nTypName
) const;
99 virtual sal_uInt32
GetId() const;
102 /*************************************************************************/
103 class StringNode
: public NameNode
105 virtual COMPARE
Compare( const NameNode
* ) const;
106 virtual COMPARE
Compare( const void * ) const;
109 using NameNode::Search
;
115 StringNode( const ByteString
& rStr
) { aName
= rStr
; }
117 StringNode
* Search( const char * ) const;
118 ByteString
GetName() const { return aName
; }
121 #endif // _RSCTREE_HXX