diff options
Diffstat (limited to 'xmlhelp/source/cxxhelp/inc/db')
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/db/Block.hxx | 119 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx | 54 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx | 159 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx | 110 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx | 68 |
5 files changed, 0 insertions, 510 deletions
diff --git a/xmlhelp/source/cxxhelp/inc/db/Block.hxx b/xmlhelp/source/cxxhelp/inc/db/Block.hxx deleted file mode 100644 index ee57708bf2fe..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/Block.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: Block.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _XMLSEARCH_DB_BLOCK_HXX_ -#define _XMLSEARCH_DB_BLOCK_HXX_ - -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - } - - namespace db { - - - class DBEnv; - - - class Block // refcounted class - { - public: - - Block( const DBEnv* ); - virtual ~Block(); - - sal_Int32 getInteger( sal_Int32 i ) const throw( xmlsearch::excep::IllegalIndexException ); - - void trueLeaf() { isLeaf_ = true; } - void falseLeaf() { isLeaf_ = false; } - bool isLeaf() const { return isLeaf_; } - - void setFree( sal_Int32 free ) { free_ = free; } - sal_Int32 getFree() const { return free_; } - - void setNum( sal_Int32 num ) { num_ = num; } - sal_Int32 getNum() const { return num_; } - - void read( util::RandomAccessStream* in ); - - const sal_Int8* getData() const { return data_; } - - - protected: - - const DBEnv* dbenv_; // not owner - - - private: - - bool isLeaf_; - sal_Int32 free_; - sal_Int32 num_; - sal_Int32 dataL_; - sal_Int8* data_; - - // methods - - Block( const Block& ); - Block& operator=( const Block& ); - - }; // end class Block - - - } -} - - -inline sal_Int32 getInteger_( const sal_Int8* v ) -{ - return (((((( (v[0]&0xFF) ) << 8 ) - | (v[1]&0xFF) ) << 8 ) - | (v[2]&0xFF) ) << 8 ) - | (v[3]&0xFF); -} - - - -inline void setInteger_( sal_Int8* v,sal_Int32 value ) -{ - v[0] = sal_Int8((value >> 24) & 0xFF); - v[1] = sal_Int8((value >> 16) & 0xFF); - v[2] = sal_Int8((value >> 8) & 0xFF); - v[3] = sal_Int8( value & 0xFF ); -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx b/xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx deleted file mode 100644 index d11a3c3d18bf..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BlockFactory.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _XMLSEARCH_DB_BLOCKFACTORY_HXX_ -#define _XMLSEARCH_DB_BLOCKFACTORY_HXX_ - -namespace xmlsearch { - - namespace db { - - - class Block; - - - class BlockFactory - { - public: - - virtual ~BlockFactory() { } - virtual Block* makeBlock() const = 0; - }; - - - } -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx b/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx deleted file mode 100644 index 84871c749989..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BlockManager.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _XMLSEARCH_DB_BLOCKMANAGER_HXX_ -#define _XMLSEARCH_DB_BLOCKMANAGER_HXX_ - -#include <rtl/ustring.hxx> -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <db/Block.hxx> -#include <db/BlockFactory.hxx> -#include <db/DBEnv.hxx> -#include <excep/XmlSearchExceptions.hxx> - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - } - - namespace db { - - - class BlockDecoratour // internal class for BlockManager - { - public: - - BlockDecoratour() - : lock_( false ), - modf_( false ), - prev_( 0 ), - next_( 0 ), - block_( 0 ) - { - } - - ~BlockDecoratour() { delete block_; } - - void lock() { lock_ = true; } - void unlock() { lock_ = false; } - bool isLocked() const { return lock_; } - - bool isModf() const { return modf_; } - void modf() { modf_ = true; } - - void next( sal_Int32 parnext ) { next_ = parnext; } - sal_Int32 next() const { return next_; } - void prev( sal_Int32 parprev ) { prev_ = parprev; } - sal_Int32 prev() const { return prev_; } - - void read( DBEnv* dbenv,sal_Int32 blNum ) { dbenv->read( blNum,block_ ); } - void write(DBEnv* dbenv,sal_Int32 blNum ) { dbenv->write( blNum,block_ ); } - - Block* reset() { lock_ = modf_ = false; prev_ = next_ = 0; Block* tmp = block_; block_ = 0; return tmp; } - void add( Block* block ) { delete block_; block_ = block; } - bool is() const { return block_ != 0; } - - const Block* getBlock() const { return block_; } - - private: - - bool lock_; - bool modf_; - sal_Int32 prev_; - sal_Int32 next_; - Block* block_; - - }; - - - - class BlockProcessor - { - public: - - virtual void process( Block* block ) const = 0; - virtual ~BlockProcessor() {} - }; - - - class BlockManager - { - public: - - // Buffered mapping of stream into memory - - BlockManager( DBEnv* ) throw( xmlsearch::excep::IOException ); - virtual ~BlockManager(); - - // From BlockManagerBase - virtual void lock( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual void unlock( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual bool isLocked( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - - virtual void modf( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual void close() throw( xmlsearch::excep::IOException ); - - virtual const Block* accessBlock( sal_Int32 blNum ) throw( xmlsearch::excep::NoSuchBlock ); - virtual void mapBlocks( const BlockProcessor& blProc ); - - - private: - - // types - - xmlsearch::db::DBEnv* dbenv_; - - sal_Int32 oldest_; - sal_Int32 newest_; - BlockDecoratour dummy_; - sal_Int32 blockused_; - std::vector< BlockDecoratour > blockTable_; - - - // private methods - - void moveToFront( sal_Int32 index ); - void mapStorage2Memory( sal_Int32 blNum ) throw( xmlsearch::excep::IOException ); - void remap( sal_Int32 blNum ) throw( xmlsearch::excep::XmlSearchException ); - void add( sal_Int32 blNum ); - }; - - - } -} - - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx b/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx deleted file mode 100644 index 9b5c29606011..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BtreeDict.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _XMLSEARCH_DB_BTREEDICT_HXX_ -#define _XMLSEARCH_DB_BTREEDICT_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <db/BlockManager.hxx> -#include <db/EntryProcessor.hxx> -#include <util/IndexAccessor.hxx> - -namespace xmlsearch { - - namespace db { - - - class DictBlock; - class DBEnv; - - - class BtreeDict - { - public: - - static const sal_Int32 ENTHEADERLEN; - static const sal_Int32 BLOCKSIZE; - static const sal_Int32 HEADERLEN; - static const sal_Int32 DATALEN; - - static const sal_Int32 nBlocksLimit; - static const sal_Int32 MaxKeyLength; - static const sal_Int32 lastPtrIndex; //!!! Careful with that number, Eugene - - BtreeDict( const xmlsearch::util::IndexAccessor& indexAccessor ) - throw( xmlsearch::excep::IOException ); - ~BtreeDict(); - - void lock( sal_Int32 blNum ) const throw( xmlsearch::excep::IllegalIndexException ); - void unlock( sal_Int32 blNum ) const throw( xmlsearch::excep::IllegalIndexException ); - - const DictBlock* accessBlock( sal_Int32 id ) const; - - sal_Int32 fetch( const rtl::OUString& key ) const throw( xmlsearch::excep::XmlSearchException ); - rtl::OUString fetch( sal_Int32 conceptID ) const throw( xmlsearch::excep::XmlSearchException ); - - std::vector< sal_Int32 > withPrefix( const rtl::OUString& prefix ) const throw( xmlsearch::excep::XmlSearchException ); - sal_Int32* get_blocks() const { return blocks_; } - - void test(); - - private: - - mutable BlockManager blockManager_; - sal_Int32 root_; - sal_Int32 blocksL_; - sal_Int32* blocks_; - - sal_Int32 find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen ) const throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen, - sal_Int32 index ) const throw( xmlsearch::excep::XmlSearchException ); - - const DictBlock* child( const DictBlock* bl, - sal_Int32 index) const throw( xmlsearch::excep::XmlSearchException ); - - rtl::OUString findID( sal_Int32 blNum,sal_Int32 id ) const throw( xmlsearch::excep::XmlSearchException ); - - }; - - - } -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx b/xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx deleted file mode 100644 index 8aefc1b0e7d9..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: DBEnv.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _XMLSEARCH_DB_DBENV_HXX_ -#define _XMLSEARCH_DB_DBENV_HXX_ - -namespace xmlsearch { - - namespace db { - - - class Block; - - - // environment class for a DBEnv - - class DBEnv - { - public: - - virtual sal_Int32 getEntryHeaderLen() const = 0; - - virtual sal_Int32 getBlockCount() const = 0; - - virtual sal_Int32 getMaximumBlockCount() const = 0; - - virtual sal_Int32 getDataLen() const = 0; - - virtual sal_Int32 getBlockLen() const = 0; - - virtual void read( sal_Int32 block,Block*& ) const = 0; - - virtual void write( sal_Int32,Block* ) = 0; - }; - - - } - -} - - -#endif |