summaryrefslogtreecommitdiff
path: root/xmlhelp/source/cxxhelp/inc
diff options
context:
space:
mode:
Diffstat (limited to 'xmlhelp/source/cxxhelp/inc')
-rw-r--r--xmlhelp/source/cxxhelp/inc/db/EntryProcessor.hxx55
-rw-r--r--xmlhelp/source/cxxhelp/inc/excep/XmlSearchExceptions.hxx110
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx0
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx0
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx107
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/Query.hxx178
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx0
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/Search.hxx0
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx0
-rw-r--r--xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx52
-rw-r--r--xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx73
-rw-r--r--xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx154
-rw-r--r--xmlhelp/source/cxxhelp/inc/util/RandomAccessStream.hxx66
13 files changed, 795 insertions, 0 deletions
diff --git a/xmlhelp/source/cxxhelp/inc/db/EntryProcessor.hxx b/xmlhelp/source/cxxhelp/inc/db/EntryProcessor.hxx
new file mode 100644
index 000000000000..66c812ca7000
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/db/EntryProcessor.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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: EntryProcessor.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_ENTRYPROCESSOR_HXX_
+#define _XMLSEARCH_DB_ENTRYPROCESSOR_HXX_
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring>
+#endif
+
+namespace xmlsearch {
+
+ namespace db {
+
+
+ class EntryProcessor
+ {
+ public:
+
+ virtual ~EntryProcessor() = 0;
+ virtual void processEntry( rtl::OUString string,sal_Int32 id ) = 0;
+ };
+
+
+ }
+}
+
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/excep/XmlSearchExceptions.hxx b/xmlhelp/source/cxxhelp/inc/excep/XmlSearchExceptions.hxx
new file mode 100644
index 000000000000..839de7699eef
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/excep/XmlSearchExceptions.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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: XmlSearchExceptions.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_EXCEP_XMLSEARCHEXCEPTIONS_HXX_
+#define _XMLSEARCH_EXCEP_XMLSEARCHEXCEPTIONS_HXX_
+
+#include <rtl/ustring.hxx>
+
+
+namespace xmlsearch {
+
+ namespace excep {
+
+
+ class XmlSearchException
+ {
+ public:
+
+ XmlSearchException( const rtl::OUString& message )
+ : _message( message )
+ {
+ }
+
+ rtl::OUString getMessage() const
+ {
+ return _message;
+ }
+
+
+ private:
+
+ rtl::OUString _message;
+ };
+
+
+ class IOException
+ : public virtual XmlSearchException
+ {
+ public:
+
+ IOException( const rtl::OUString& message )
+ : XmlSearchException( message )
+ {
+ }
+ };
+
+
+ class NoFactoryException
+ : public virtual XmlSearchException
+ {
+ public:
+ NoFactoryException( const rtl::OUString& message )
+ : XmlSearchException( message )
+ {
+ }
+ };
+
+
+ class NoSuchBlock
+ : public virtual XmlSearchException
+ {
+ public:
+ NoSuchBlock( const rtl::OUString& message )
+ : XmlSearchException( message )
+ {
+ }
+ };
+
+
+ class IllegalIndexException
+ : public virtual XmlSearchException
+ {
+ public:
+ IllegalIndexException( const rtl::OUString& message )
+ : XmlSearchException( message )
+ {
+ }
+ };
+
+ }
+}
+
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx b/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx
diff --git a/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx b/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx
diff --git a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx
new file mode 100644
index 000000000000..bdad2d01d43c
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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: DocGenerator.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_QE_DOCGENERATOR_HXX_
+#define _XMLSEARCH_QE_DOCGENERATOR_HXX_
+
+#include <rtl/ref.hxx>
+#ifndef _RTL_USTRING_HXX__
+#include <rtl/ustring.hxx>
+#endif
+#include <excep/XmlSearchExceptions.hxx>
+#include <util/CompressorIterator.hxx>
+#include <util/Decompressor.hxx>
+
+
+namespace xmlsearch {
+
+ namespace qe {
+
+
+ class Query;
+
+
+ class NonnegativeIntegerGenerator
+ {
+ public:
+
+ static const sal_Int32 END;
+
+ virtual ~NonnegativeIntegerGenerator() { };
+ virtual sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) = 0;
+ virtual sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) = 0;
+ };
+
+
+ class RoleFiller
+ {
+ public:
+
+ static RoleFiller* STOP() { return &roleFiller_; }
+
+ RoleFiller();
+
+ ~RoleFiller();
+
+ void acquire() { ++m_nRefcount; }
+ void release() { if( ! --m_nRefcount ) delete this; }
+
+ private:
+
+ static RoleFiller roleFiller_;
+
+ sal_uInt32 m_nRefcount;
+ sal_uInt8 fixedRole_;
+ sal_Int16 filled_;
+ sal_Int32 begin_,end_,parentContext_,limit_;
+
+ RoleFiller* next_;
+ std::vector< RoleFiller* > fillers_;
+ };
+
+
+ class GeneratorHeap
+ {
+ public:
+
+ GeneratorHeap()
+ : heapSize_( 0 ),
+ free_( 0 )
+ { }
+ private:
+
+ sal_Int32 heapSize_,free_;
+ };
+
+
+
+ }
+}
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx
new file mode 100644
index 000000000000..33b0d3153ba4
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * 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: Query.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_QE_QUERY_HXX_
+#define _XMLSEARCH_QE_QUERY_HXX_
+
+#include <sal/types.h>
+#include <rtl/memory.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+
+namespace xmlsearch {
+
+ namespace qe {
+
+ class Search;
+ class RoleFiller;
+
+ class QueryHit
+ {
+ public:
+
+ QueryHit( sal_Int32 nColumns,double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end )
+ : doc_( doc ),
+ begin_( begin ),
+ end_( end ),
+ matchesL_( 2*nColumns ),
+ matches_( new sal_Int32[ 2*nColumns ] ),
+ penalty_( penalty )
+ {
+ rtl_zeroMemory( matches_,sizeof( sal_Int32 ) * matchesL_ );
+ }
+
+ ~QueryHit() { delete[] matches_; }
+
+ sal_Int32 getDocument() const { return doc_; }
+
+ sal_Int32 countOfMatches() const { return matchesL_; }
+
+ sal_Int32 getBegin() const { return begin_; }
+
+ sal_Int32 getEnd() const { return end_; }
+
+ double getPenalty() const { return penalty_; }
+
+ bool betterThan( const QueryHit* o )
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ < o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ < o->begin_;
+ else if( end_ != o->end_ )
+ return end_ < o->end_;
+ else
+ return false;
+ }
+
+ bool worseThan( const QueryHit* o )
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ > o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ > o->begin_;
+ else if( end_ != o->end_ )
+ return end_ > o->end_;
+ else
+ return false;
+ }
+
+ bool worseThan( double penalty,sal_Int32 begin,sal_Int32 end )
+ {
+ if( penalty_ != penalty )
+ return penalty_ > penalty;
+ else if( begin_ != begin )
+ return begin_ > begin;
+ else if( end_ != end )
+ return end_ > end;
+ else
+ return false;
+ }
+
+ bool compareTo( const QueryHit* o ) const
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ < o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ < o->begin_;
+ else if( end_ != o->end_ )
+ return end_ < o->end_;
+ else
+ return false;
+ }
+
+
+ private:
+
+ sal_Int32 doc_,begin_,end_;
+
+ sal_Int32 matchesL_;
+ sal_Int32 *matches_; // ...concept, word number, ...
+
+ double penalty_;
+
+ }; // end class QueryHit
+
+
+
+ class QueryHitData
+ {
+ public:
+
+ QueryHitData( double penalty,const rtl::OUString& document,sal_Int32 termsL, rtl::OUString* terms )
+ : penalty_( penalty ),
+ document_( document ),
+ termsL_( termsL ),
+ terms_( terms ) { }
+
+ ~QueryHitData() { delete[] terms_; }
+
+ rtl::OUString getDocument() const { return document_; }
+
+ double getPenalty() const { return penalty_; }
+
+
+ private:
+
+ double penalty_;
+
+ const rtl::OUString document_;
+
+ sal_Int32 termsL_;
+ rtl::OUString* terms_;
+
+ }; // end class QueryHitData
+
+
+ class PrefixTranslator
+ {
+ public:
+
+ static PrefixTranslator* makePrefixTranslator( const rtl::OUString*,sal_Int32 )
+ {
+ return 0;
+ }
+ };
+ }
+
+}
+
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx b/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx
diff --git a/xmlhelp/source/cxxhelp/inc/qe/Search.hxx b/xmlhelp/source/cxxhelp/inc/qe/Search.hxx
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/Search.hxx
diff --git a/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx b/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx
diff --git a/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx b/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx
new file mode 100644
index 000000000000..c4a88bf92427
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/util/CompressorIterator.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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: CompressorIterator.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_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..246d647603ee
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * 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: ConceptList.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_UTIL_CONCEPTLIST_HXX_
+#define _XMLSEARCH_UTIL_CONCEPTLIST_HXX_
+
+#include <excep/XmlSearchExceptions.hxx>
+#include <qe/DocGenerator.hxx>
+#include <util/Decompressor.hxx>
+#include <util/CompressorIterator.hxx>
+
+
+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; }
+
+ private:
+
+ sal_Int32 k_,value_;
+ ByteArrayDecompressor list_;
+
+ };
+
+ }
+
+}
+
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx
new file mode 100644
index 000000000000..2f68133d7f6f
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * 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: Decompressor.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_UTIL_DECOMPRESSOR_HXX_
+#define _XMLSEARCH_UTIL_DECOMPRESSOR_HXX_
+
+#ifndef INCLUDED_STL_VECTOR
+#include <vector>
+#define INCLUDED_STL_VECTOR
+#endif
+#include <excep/XmlSearchExceptions.hxx>
+#include <util/RandomAccessStream.hxx>
+
+
+namespace xmlsearch {
+
+ namespace util {
+
+
+ class CompressorIterator;
+
+
+ class Decompressor
+ {
+ public:
+
+ Decompressor()
+ : toRead_( 0 ),
+ path_( 0 )
+ {
+ }
+
+ virtual ~Decompressor() { }
+
+ virtual sal_Int32 getNextByte() = 0;
+
+ virtual void initReading()
+ {
+ toRead_ = 0;
+ }
+
+ private:
+
+ static const sal_Int32 BitsInByte;
+ static const sal_Int32 NBits;
+
+ sal_Int32 readByte_, toRead_, path_;
+ };
+
+
+
+
+ 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
diff --git a/xmlhelp/source/cxxhelp/inc/util/RandomAccessStream.hxx b/xmlhelp/source/cxxhelp/inc/util/RandomAccessStream.hxx
new file mode 100644
index 000000000000..49adc24cf164
--- /dev/null
+++ b/xmlhelp/source/cxxhelp/inc/util/RandomAccessStream.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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: RandomAccessStream.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 _XMLEARCH_UTIL_RANDOMACCESSSTREAM_HXX_
+#define _XMLEARCH_UTIL_RANDOMACCESSSTREAM_HXX_
+
+#include <osl/file.hxx>
+
+namespace xmlsearch {
+
+ namespace util {
+
+
+ class RandomAccessStream
+ {
+ public:
+
+ virtual ~RandomAccessStream() { };
+
+ // The calle is responsible for allocating the buffer
+ virtual void seek( sal_Int32 ) = 0;
+ virtual sal_Int32 readBytes( sal_Int8*,sal_Int32 ) = 0;
+ virtual void writeBytes( sal_Int8*, sal_Int32 ) = 0;
+ virtual sal_Int32 length() = 0;
+ virtual void close() = 0;
+
+
+ protected:
+
+ enum OPENFLAG { Read = OpenFlag_Read,
+ Write = OpenFlag_Write,
+ Create = OpenFlag_Create };
+
+ };
+
+
+ }
+}
+
+#endif