diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-03-25 14:19:12 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-03-25 14:19:12 +0000 |
commit | ddf5d8d556a445c942b520f709d98c18242f9577 (patch) | |
tree | 04a7f0f39f188c712e69522818ce498183168025 /xmlhelp/source/cxxhelp/inc/util | |
parent | 003d34e3c30c1e7dc1f08f7737cedef79be3b15f (diff) |
INTEGRATION: CWS ucbfixes06 (1.1.2); FILE ADDED
2008/01/21 15:30:20 kso 1.1.2.1: #i85425# - cleanup of CVS module.
Diffstat (limited to 'xmlhelp/source/cxxhelp/inc/util')
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx | 57 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx | 98 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx | 86 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx | 181 |
4 files changed, 422 insertions, 0 deletions
diff --git a/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx b/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx new file mode 100644 index 000000000000..9f1a9009f60d --- /dev/null +++ b/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: CompressorIterator.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2008-03-25 15:18:33 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _XMLSEARCH_UTIL_COMPRESSORITERATOR_HXX_ +#define _XMLSEARCH_UTIL_COMPRESSORITERATOR_HXX_ + + +namespace xmlsearch { + + namespace util { + + class CompressorIterator + { + public: + + virtual void value( sal_Int32 ) = 0; + + }; + + + } + +} + + +#endif diff --git a/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx new file mode 100644 index 000000000000..ccecd2dd1915 --- /dev/null +++ b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ConceptList.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2008-03-25 15:18:44 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _XMLSEARCH_UTIL_CONCEPTLIST_HXX_ +#define _XMLSEARCH_UTIL_CONCEPTLIST_HXX_ + +#ifndef _XMLSEARCH_EXCEP_XMLSEARCHEXCEPTIONS_HXX_ +#include <excep/XmlSearchExceptions.hxx> +#endif +#ifndef _XMLSEARCH_QE_DOCGENERATOR_HXX_ +#include <qe/DocGenerator.hxx> +#endif +#ifndef _XMLSEARCH_UTIL_DECOMPRESSOR_HXX_ +#include <util/Decompressor.hxx> +#endif +#ifndef _XMLSEARCH_UTIL_COMPRESSORITERATOR_HXX_ +#include <util/CompressorIterator.hxx> +#endif + + +namespace xmlsearch { + + namespace util { + + + class CompressorIterator; + + + + class ConceptList + : public CompressorIterator, + public xmlsearch::qe::NonnegativeIntegerGenerator + { + public: + + ConceptList( sal_Int8* array,sal_Int32 arrl,sal_Int32 index ) + : k_( array[index] ), + value_( 0 ), + list_( arrl,array,index + 1 ) { } + + void value( sal_Int32 val ) { value_ += val; } + + sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) + { + value_ = 0; + sal_Int32 ret = list_.readNext( k_,this ) ? value_ : END; + return ret; + } + + sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) + { + return list_.readNext( k_,this) ? value_ : END; + } + + private: + + sal_Int32 k_,value_; + ByteArrayDecompressor list_; + + }; + + } + +} + + +#endif diff --git a/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx b/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx new file mode 100644 index 000000000000..08d4ca28dbba --- /dev/null +++ b/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: DBEnvImpl.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2008-03-25 15:18:57 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _XMLSEARCH_DB_DBENVIMPL_HXX_ +#define _XMLSEARCH_DB_DBENVIMPL_HXX_ +#endif + + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _XMLSEARCH_DB_DBENV_HXX_ +#include <db/DBEnv.hxx> +#endif +#ifndef _XMLEARCH_UTIL_RANDOMACCESSSTREAM_HXX_ +#include <util/RandomAccessStream.hxx> +#endif +#ifndef _XMLSEARCH_DB_BLOCK_HXX_ +#include <db/Block.hxx> +#endif +#ifndef _XMLSEARCH_UTIL_INDEXACCESSOR_HXX_ +#include <util/IndexAccessor.hxx> +#endif + +namespace xmlsearch { + + namespace util { + + + class DBEnvImpl + : public xmlsearch::db::DBEnv + { + public: + + DBEnvImpl( const IndexAccessor& indexDir ); + virtual ~DBEnvImpl(); + + virtual sal_Int32 getEntryHeaderLen() const; + virtual sal_Int32 getBlockCount() const; + virtual sal_Int32 getMaximumBlockCount() const; + virtual sal_Int32 getDataLen() const; + virtual sal_Int32 getBlockLen() const; + virtual void read( sal_Int32 blNum,xmlsearch::db::Block*& block ) const; + virtual void write( sal_Int32 blNum,xmlsearch::db::Block* block ); + + + private: + + xmlsearch::util::RandomAccessStream* file_; + }; + + + } + +} diff --git a/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx new file mode 100644 index 000000000000..5ec1bb0c4e73 --- /dev/null +++ b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: Decompressor.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obo $ $Date: 2008-03-25 15:19:12 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _XMLSEARCH_UTIL_DECOMPRESSOR_HXX_ +#define _XMLSEARCH_UTIL_DECOMPRESSOR_HXX_ + +#ifndef INCLUDED_STL_VECTOR +#include <vector> +#define INCLUDED_STL_VECTOR +#endif +#ifndef _XMLSEARCH_EXCEP_XMLSEARCHEXCEPTIONS_HXX_ +#include <excep/XmlSearchExceptions.hxx> +#endif +#ifndef _XMLEARCH_UTIL_RANDOMACCESSSTREAM_HXX_ +#include <util/RandomAccessStream.hxx> +#endif + + +namespace xmlsearch { + + namespace util { + + + class CompressorIterator; + + + class Decompressor + { + public: + + Decompressor() + : toRead_( 0 ), + path_( 0 ) + { + } + + virtual ~Decompressor() { } + + virtual sal_Int32 getNextByte() = 0; + + sal_Int32 read( sal_Int32 kBits ) throw( xmlsearch::excep::XmlSearchException ); + + sal_Int32 ascendingDecode( sal_Int32 k,sal_Int32 start,sal_Int32 *concepts ) + throw( xmlsearch::excep::XmlSearchException ); + + void ascDecode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( xmlsearch::excep::XmlSearchException ); + + void decode(sal_Int32 k, sal_Int32* array ) throw( xmlsearch::excep::XmlSearchException ); + + void decode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( xmlsearch::excep::XmlSearchException ); + + virtual void initReading() + { + toRead_ = 0; + } + + bool readNext( sal_Int32 k,CompressorIterator* it) throw( xmlsearch::excep::XmlSearchException ); + + private: + + static const sal_Int32 BitsInByte; + static const sal_Int32 NBits; + + sal_Int32 readByte_, toRead_, path_; + + sal_Int32 read() throw( xmlsearch::excep::XmlSearchException ); + + sal_Int32 countZeroes() throw( xmlsearch::excep::XmlSearchException ); + + }; + + + + + class StreamDecompressor + : public Decompressor + { + public: + + StreamDecompressor( RandomAccessStream* in ) + : in_( in ) + { + } + + ~StreamDecompressor() { } + + + virtual sal_Int32 getNextByte(); + + private: + + RandomAccessStream* in_; + + }; + + + + class ByteArrayDecompressor + : public Decompressor + { + public: + + ByteArrayDecompressor( sal_Int32 arrayL,sal_Int8* array,sal_Int32 index ) + { + initReading(array,arrayL,index); + } + + + ~ByteArrayDecompressor() { } + + sal_Int32 bytesRead() + { + return index_ - index0_; + } + + + sal_Int32 getNextByte() throw( xmlsearch::excep::XmlSearchException ) + { + if( arrayL_ <= index_ ) + throw xmlsearch::excep::XmlSearchException( + rtl::OUString::createFromAscii( "ByteArrayDecompressor->getNextByte()" ) ); + return array_[index_++] & 0xFF; + } + + + private: + + sal_Int32 arrayL_; + sal_Int8 *array_; + + sal_Int32 index_,index0_; + + using xmlsearch::util::Decompressor::initReading; + void initReading( sal_Int8* array,sal_Int32 arrayL,sal_Int32 index ) + { + arrayL_ = arrayL; + array_ = array; + index_ = index0_ = index; + Decompressor::initReading(); + } + + }; + + + } + +} + + +#endif |