2010-10-14 01:27:31 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-11 01:19:14 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _RSCTREE_HXX
|
|
|
|
#define _RSCTREE_HXX
|
|
|
|
|
|
|
|
#include <tools/link.hxx>
|
|
|
|
#include <rsctools.hxx>
|
|
|
|
|
|
|
|
/****************** C L A S S E S ****************************************/
|
|
|
|
class BiNode
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
BiNode* pLeft; // left subtree
|
|
|
|
BiNode* pRight; // right subtree
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Wandelt eine doppelt verkettete Liste in
|
|
|
|
// einen binaeren Baum um
|
|
|
|
BiNode * ChangeDLListBTree( BiNode * pList );
|
|
|
|
|
|
|
|
BiNode();
|
|
|
|
virtual ~BiNode();
|
|
|
|
|
|
|
|
|
|
|
|
// Wandelt einen binaeren Baum in eine doppelt
|
|
|
|
// verkettete Liste um
|
|
|
|
BiNode* ChangeBTreeDLList();
|
|
|
|
|
|
|
|
BiNode * Left() const { return pLeft ; };
|
|
|
|
BiNode * Right() const{ return pRight ; };
|
|
|
|
void EnumNodes( Link aLink ) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
class NameNode : public BiNode
|
|
|
|
{
|
|
|
|
void SubOrderTree( NameNode * pOrderNode );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// pCmp ist Zeiger auf Namen
|
|
|
|
NameNode* Search( const void * pCmp ) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NameNode* Left() const { return (NameNode *)pLeft ; };
|
|
|
|
NameNode* Right() const{ return (NameNode *)pRight ; };
|
|
|
|
NameNode* Search( const NameNode * pName ) const;
|
|
|
|
// insert a new node in the b-tree
|
2010-07-28 21:56:19 -05:00
|
|
|
sal_Bool Insert( NameNode * pTN, sal_uInt32 * nDepth );
|
|
|
|
sal_Bool Insert( NameNode* pTN );
|
2000-09-18 11:07:07 -05:00
|
|
|
virtual COMPARE Compare( const NameNode * ) const;
|
|
|
|
virtual COMPARE Compare( const void * ) const;
|
|
|
|
NameNode* SearchParent( const NameNode * ) const;
|
|
|
|
// return ist neue Root
|
|
|
|
NameNode* Remove( NameNode * );
|
|
|
|
void OrderTree();
|
|
|
|
};
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
class IdNode : public NameNode
|
|
|
|
{
|
|
|
|
virtual COMPARE Compare( const NameNode * ) const;
|
|
|
|
virtual COMPARE Compare( const void * ) const;
|
2006-06-19 23:45:14 -05:00
|
|
|
protected:
|
|
|
|
using NameNode::Search;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2005-01-03 10:24:07 -06:00
|
|
|
IdNode* Search( sal_uInt32 nTypName ) const;
|
|
|
|
virtual sal_uInt32 GetId() const;
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
class StringNode : public NameNode
|
|
|
|
{
|
|
|
|
virtual COMPARE Compare( const NameNode * ) const;
|
|
|
|
virtual COMPARE Compare( const void * ) const;
|
|
|
|
|
|
|
|
protected:
|
2006-06-19 23:45:14 -05:00
|
|
|
using NameNode::Search;
|
|
|
|
|
2011-12-10 16:38:20 -06:00
|
|
|
rtl::OString m_aName;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
public:
|
2011-12-10 16:38:20 -06:00
|
|
|
StringNode() {}
|
|
|
|
StringNode(const rtl::OString& rStr) { m_aName = rStr; }
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
StringNode* Search( const char * ) const;
|
2011-12-10 16:38:20 -06:00
|
|
|
rtl::OString GetName() const { return m_aName; }
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _RSCTREE_HXX
|
2010-10-14 01:27:31 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|