update dev300-m58
[ooovba.git] / rsc / inc / rsctree.hxx
blob67a37ff679a9f6e8cfd5b19ecbed925efe0357ca
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rsctree.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
30 #ifndef _RSCTREE_HXX
31 #define _RSCTREE_HXX
33 #include <tools/link.hxx>
34 #include <rsctools.hxx>
36 /****************** C L A S S E S ****************************************/
37 class BiNode
39 protected:
40 BiNode* pLeft; // left subtree
41 BiNode* pRight; // right subtree
43 public:
45 // Wandelt eine doppelt verkettete Liste in
46 // einen binaeren Baum um
47 BiNode * ChangeDLListBTree( BiNode * pList );
49 BiNode();
50 virtual ~BiNode();
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 );
67 protected:
68 // pCmp ist Zeiger auf Namen
69 NameNode* Search( const void * pCmp ) const;
71 public:
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 * );
83 void OrderTree();
84 BOOL IsOrderTree() const;
88 /*************************************************************************/
89 class IdNode : public NameNode
91 virtual COMPARE Compare( const NameNode * ) const;
92 virtual COMPARE Compare( const void * ) const;
93 protected:
94 using NameNode::Search;
96 public:
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;
108 protected:
109 using NameNode::Search;
111 ByteString aName;
113 public:
114 StringNode(){};
115 StringNode( const ByteString & rStr ) { aName = rStr; }
117 StringNode* Search( const char * ) const;
118 ByteString GetName() const { return aName; }
121 #endif // _RSCTREE_HXX