diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-02-13 08:59:55 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-02-13 08:59:55 +0000 |
commit | 6c9ddd803f8944af59778da38460cfe6cda3d32d (patch) | |
tree | 6126f0f5be716d9b35df7205feabda19c041c506 /xmlhelp/source/cxxhelp/inc | |
parent | 0162fbb76ca95af2e98ee1445e1eb57e001b2c9e (diff) |
CWS-TOOLING: integrate CWS ab66
2009-01-26 13:58:36 +0100 ab r266922 : #i98368# Fixed extension path handling for images
2009-01-08 13:04:55 +0100 ab r265997 : #i95412# Added missing dtor
2009-01-08 11:56:40 +0100 ab r265991 : #i95412# Applied patch
Diffstat (limited to 'xmlhelp/source/cxxhelp/inc')
-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 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx | 122 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx | 132 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx | 393 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/Query.hxx | 508 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx | 133 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/Search.hxx | 116 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx | 134 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx | 12 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx | 71 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx | 18 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx | 92 |
16 files changed, 285 insertions, 1956 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 diff --git a/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx b/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx deleted file mode 100644 index 52e8e1560102..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx +++ /dev/null @@ -1,122 +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: ConceptData.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_CONCEPTDATA_HXX_ -#define _XMLSEARCH_QE_CONCEPTDATA_HXX_ - -#include <rtl/ref.hxx> -#include <sal/types.h> -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif - - -namespace xmlsearch { - - namespace qe { - - - class RoleFiller; - class Query; - class ContextTables; - - class ConceptData - { - public: - - ConceptData( sal_Int32 id = 0, - sal_Int32 role = 0, - double score = 0.0, - sal_Int32 queryNo = 0, - sal_Int32 nColumns = 0, - ContextTables* contextTables = 0 ); - - virtual ~ConceptData(); - - void acquire() { ++m_nRefcount; } - void release() { if( ! --m_nRefcount ) delete this; } - - bool cEquals( ConceptData* r ) { return concept_ == r->concept_; } - bool crEquals( ConceptData* r ) { return cEquals( r ) && role_ == r->role_; } - bool crqEquals( ConceptData* r ) { return crEquals( r ) && queryNo_ == r->queryNo_; } - bool compareWith( ConceptData* r ) { return - (concept_ < r->concept_) || - (cEquals( r ) && role_ < r->role_) || - (crEquals( r ) && penalty_ < r->penalty_); } - - void addLast( ConceptData* r ); - - sal_Int32 getConcept() const { return concept_; } - - sal_Int32 getQueryMask() const - { - return ( next_.is() ? next_->getQueryMask() : 0 ) | ( 1 << queryNo_ ); - } - - void runBy( std::vector< Query* >& queries ); - - virtual void generateFillers( std::vector< RoleFiller* >& array, sal_Int32 last ); - - sal_Int32 getConcept() { return concept_; } - - sal_uInt8 getRole() { return role_; } - - sal_uInt8 getQuery() { return queryNo_; } - - double getScore() { return penalty_; } - - double getPenalty() { return penalty_; } - - - protected: - - static const sal_Int32 ProxPerTerm; - - sal_uInt8 queryNo_,nColumns_,role_; - - sal_Int32 concept_,proximity_; - - double penalty_; - - sal_uInt32 m_nRefcount; - - ContextTables* ctx_; - rtl::Reference< ConceptData > next_; - std::vector< rtl::Reference< RoleFiller > > roleFillers_; - }; - - - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx b/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx deleted file mode 100644 index b3752990ec49..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx +++ /dev/null @@ -1,132 +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: ContextTables.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_CONTEXTTABLES_HXX_ -#define _XMLSEARCH_QE_CONTEXTTABLES_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - - -namespace xmlsearch { - - namespace qe { - - /* forward declaration */ - - class ContextTables; - - - /******************************************************************************/ - - - class Tables - { - public: - - Tables( ContextTables* p ); - - ~Tables(); - - void setTables( ContextTables* p ); - - - private: - - sal_Int32 initialWordsCachedL_,destsCachedL_,linkTypesCachedL_,seqNumbersCachedL_; - sal_Int32 *initialWordsCached_,*destsCached_,*linkTypesCached_,*seqNumbersCached_; - - }; // end class Tables - - - /******************************************************************************/ - - - class ContextTables - { - friend class Tables; - - public: - - ContextTables( const std::vector< sal_Int32 >& offsets, - sal_Int32 contextDataL,sal_Int8 *contextData, - sal_Int32 linkNamesL,rtl::OUString *linkNames ); - - ~ContextTables(); - - void setMicroindex( sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 linkCode( const rtl::OUString& linkName_ ); - - bool* getIgnoredElementsSet( sal_Int32& len, /*out*/ - const sal_Int32 ignoredElementsL, - const rtl::OUString* ignoredElements ); - - bool notIgnored( sal_Int32 ctx, - sal_Int32 ignoredElementsL,bool* ignoredElements ); - - sal_Int32 firstParentWithCode( const sal_Int32 pos,const sal_Int32 linkCode_ ); - - void resetContextSearch(); - - sal_Int32 wordContextLin(sal_Int32 wordNumber); - - private: - - sal_Int32 nTextNodes_,initialWordsIndex_,lastDocNo_; - sal_Int32 initialWordsL_,destsL_,linkTypesL_,seqNumbersL_,markersL_; - sal_Int32 *initialWords_,*dests_,*linkTypes_,*seqNumbers_,*markers_; - - sal_Int32 contextDataL_; - sal_Int8 *contextData_; // no - - sal_Int32 linkNamesL_; - rtl::OUString *linkNames_; // no - - std::vector<Tables*> cache_; - std::vector< sal_Int32 > kTable_,auxArray_; - - const std::vector< sal_Int32 >& offsets_; - - }; // end class ContextTables - - - /******************************************************************************/ - - } // end namespace qe - -} // end namespace xmlsearch - - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx index 27e545af06cf..08d4f508505d 100644 --- a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx +++ b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx @@ -1,286 +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 <qe/XmlIndex.hxx> -#include <qe/ConceptData.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 NextDocGenerator - { - public: - - NextDocGenerator( ConceptData* cd,XmlIndex* env ); - - ~NextDocGenerator() { delete iterator_; } - - sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) - { - return ( document_ = ( iterator_ ? iterator_->first() : NonnegativeIntegerGenerator::END ) ); - } - - sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) - { - if( iterator_ ) - return document_ = iterator_->next(); - - throw xmlsearch::excep::XmlSearchException( rtl::OUString::createFromAscii( "NextDocGenerator::next ->" ) ); - } - - sal_Int32 getDocument() { return document_; } - - sal_Int32 getConcept() { return concept_; } - - sal_Int32 getQueryMask() { return queryMask_; } - - rtl::Reference< ConceptData > getTerms() { return terms_; } - - bool smallerThan( NextDocGenerator* other ) - { - return - (document_ < other->document_) - || - (document_ == other->document_ && concept_ < other->concept_); - } - - - private: - - sal_Int32 document_,concept_,queryMask_; - rtl::Reference< ConceptData > terms_; - NonnegativeIntegerGenerator* iterator_; - }; - - - class NextDocGeneratorHeap - { - public: - - NextDocGeneratorHeap() - : nonEmpty_( false ), - heapSize_( 0 ), - free_( 0 ) - - { - } - - ~NextDocGeneratorHeap() - { - reset(); - } - - void reset(); - - void addGenerator( NextDocGenerator* gen ); - - void start(); - - bool isNonEmpty() const { return nonEmpty_; } - - void step() throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 getDocument() { return heap_[0]->getDocument(); } - - sal_Int32 getConcept() { return heap_[0]->getConcept(); } - - sal_Int32 getQueryMask() { return heap_[0]->getQueryMask(); } - - rtl::Reference< ConceptData > getTerms() { return heap_[0]->getTerms(); } - - bool atDocument( sal_Int32 document ); - - - private: - - bool nonEmpty_; - - sal_Int32 heapSize_,free_; - - std::vector< NextDocGenerator* > heap_; - - void heapify( sal_Int32 i ); - }; - - - - class RoleFiller - { - public: - - static RoleFiller* STOP() { return &roleFiller_; } - - RoleFiller(); - - RoleFiller( sal_Int32 nColumns, - ConceptData* first, - sal_Int32 role, - sal_Int32 pos, - sal_Int32 parentContext, - sal_Int32 limit ); - - ~RoleFiller(); - - void acquire() { ++m_nRefcount; } - void release() { if( ! --m_nRefcount ) delete this; } - - void scoreList( Query* ,sal_Int32 ); - - sal_Int32 getConcept(); - - void use( std::vector< RoleFiller*>& place,sal_Int32 query ); - - 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_; - - ConceptData* conceptData_; - - double penalty( Query* query,sal_Int32 nColumns ); - - void makeQueryHit( Query* query,sal_Int32 doc,double penalty_ ); - - void considerReplacementWith( RoleFiller* replacement ); - - double getScore() { return conceptData_->getScore(); } - }; - - - - class ConceptGroupGenerator - : public xmlsearch::util::CompressorIterator - { - public: - - static const sal_Int32 NConceptsInGroup; - - ConceptGroupGenerator(); - - ConceptGroupGenerator( sal_Int32 dataL,sal_Int8* data,sal_Int32 index,sal_Int32 k ); - - virtual ~ConceptGroupGenerator(); - - void init( sal_Int32 bytesL,sal_Int8* bytes,sal_Int32 index,sal_Int32 k ); - - bool next() throw( xmlsearch::excep::XmlSearchException ); - - void generateFillers( std::vector< RoleFiller* >& array ); - - sal_Int32 position() { return last_; } - - void value( sal_Int32 value_ ) { last_ += value_; } - - sal_Int32 decodeConcepts( sal_Int32 k, sal_Int32 shift, sal_Int32 *concepts ) throw( xmlsearch::excep::XmlSearchException ); - - void addTerms( sal_Int32 index, ConceptData* terms ); - - private: - - static const sal_Int32 BitsInLabel; - - sal_Int32 last_,k1_,k2_; - std::vector< rtl::Reference< ConceptData > > table_; - xmlsearch::util::Decompressor* bits_; - rtl::Reference< ConceptData> cData_; - }; - - - class GeneratorHeap - { - public: - - GeneratorHeap() - : heapSize_( 0 ), - free_( 0 ) - { } - - ~GeneratorHeap() { reset(); } - - bool start( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - bool next( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - void reset(); - - void addGenerator( ConceptGroupGenerator* cd ); - - private: - - sal_Int32 heapSize_,free_; - - std::vector< ConceptGroupGenerator* > heap_; - - void buildHeap(); - - void heapify( sal_Int32 root ); - - }; - - - - } -} - -#endif +/*************************************************************************
+ *
+ * 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 index 1d7cbb22f079..336bc9628252 100644 --- a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx +++ b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx @@ -1,330 +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 <qe/XmlIndex.hxx> - - -namespace xmlsearch { - - namespace qe { - - class QueryResults; - class Search; - class ConceptData; - class RoleFiller; - class ContextTables; - - - 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* getMatches( sal_Int32& matchesL ); - - 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 HitStore - { - public: - - HitStore( double, sal_Int32,sal_Int32 ); - - ~HitStore(); - - QueryHit* firstBestQueryHit(); - - QueryHit* nextBestQueryHit(); - - bool goodEnough( double penalty,sal_Int32 begin,sal_Int32 end ); - - QueryHit* createQueryHit( double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end ); - - double getCurrentStandard() { return standard_; } - - - private: - - const sal_Int32 limit_,nColumns_; - - sal_Int32 index_,free_; - - double standard_; - - std::vector< QueryHit* > heap_; - - void heapify( sal_Int32 ); - - void quicksort( sal_Int32 p,sal_Int32 r ); - - sal_Int32 partition( sal_Int32 p,sal_Int32 r ); - }; - - - - class Query - { - public: - - Query( XmlIndex* env, - sal_Int32 nColumns, - sal_Int32 nHits, - sal_Int32 missingPenaltiesL, - double* missingPenalties ); - - virtual ~Query(); - - void missingTerms( sal_Int32 nMissingTerms ); - - virtual void addControlConceptData( Search*,sal_Int32 ) { } - - virtual bool zoned() const { return false; } - - virtual ConceptData* makeConceptData( sal_Int32 col,sal_Int32 concept,double penalty,sal_Int32 queryNo ); - - void getHits( std::vector< QueryHitData* >& data,sal_Int32 nHits ); - - double lookupPenalty( sal_Int32 pattern ) { return penalties_[ pattern ]; } - - RoleFiller* getRoleFillers() { return roleFillerList_; } - - void resetForNextDocument(); - - void saveRoleFillers( RoleFiller* roleFillerList ) { roleFillerList_ = roleFillerList; } - - bool vote(); - - sal_Int32 getNColumns() { return nColumns_; } - - QueryHit* maybeCreateQueryHit( double penalty, - sal_Int32 doc, sal_Int32 begin, sal_Int32 end, sal_Int32 parentContext); - - void setIgnoredElements( const sal_Int32 ignoredElementsL,const rtl::OUString* ignoredElements ); - - double getOutOufOrderPenalty() { return 0.25; } - - double getGapPenalty() { return 0.005; } - - void updateEstimate( sal_Int32 role,double penalty ); - - - protected: - - XmlIndex* env_; - ContextTables* ctx_; - HitStore store_; - - sal_Int32 nHitsRequested_,nColumns_; - double currentStandard_; - - sal_Int32 missingPenaltyL_,upperboundTemplateL_,penaltiesL_; - double *missingPenalty_,*upperboundTemplate_,*penalties_; - - sal_Int32 ignoredElementsL_; - bool *ignoredElements_; - - - private: - - bool vote_; - double missingTermsPenalty_; - - // for use with Start/Stop - - RoleFiller *roleFillerList_; - - void makePenaltiesTable(); - - double computePenalty( sal_Int32 ); - - }; - - - - class PrefixTranslator - { - public: - - static PrefixTranslator* makePrefixTranslator( const rtl::OUString*,sal_Int32 ) - { - return 0; - } - }; - - - - - class QueryResults; - - - - class QueryHitIterator - { - public: - - QueryHitIterator( const QueryResults* result ); - - ~QueryHitIterator(); - - bool next(); - - QueryHitData* getHit( const PrefixTranslator* ) const; - - private: - - bool accessible_; - sal_Int32 index_; - const QueryResults* result_; - }; - - - } - -} - - -#endif +/*************************************************************************
+ *
+ * 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 deleted file mode 100644 index cb5cb1c67c73..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx +++ /dev/null @@ -1,133 +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: QueryProcessor.hxx,v $ - * $Revision: 1.3.26.1 $ - * - * 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_QUERYPROCESSOR_HXX_ -#define _XMLSEARCH_QE_QUERYPROCESSOR_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <qe/Query.hxx> -#include <qe/Search.hxx> - - -namespace xmlsearch { - - namespace qe { - - - class QueryStatement - { - public: - - QueryStatement( sal_Int32 nHits, - const std::vector< rtl::OUString >& terms, - const rtl::OUString& scope ) - : nHits_( nHits ), - terms_( terms ), - scope_( scope ) - { - } - - ~QueryStatement() - { - } - - - sal_Int32 getHitCount() const { return nHits_; } - - const std::vector< rtl::OUString >& getTerms() const { return terms_; } - - const rtl::OUString getScope() const { return scope_; } - - - private: - - sal_Int32 nHits_; - std::vector< rtl::OUString > terms_; - rtl::OUString scope_; - - }; - - - - class QueryResults - { - friend class QueryHitIterator; - - public: - - QueryResults( Query*, sal_Int32 ); - - ~QueryResults(); - - QueryHitIterator* makeQueryHitIterator() const - { - return new QueryHitIterator( this ); - } - - - private: - - std::vector< QueryHitData* > queryHits_; - }; - - - - class QueryProcessor - { - public: - - QueryProcessor( const rtl::OUString& installDir ) - throw( xmlsearch::excep::IOException ); - - ~QueryProcessor(); - - QueryResults* processQuery( const QueryStatement& ment ); - - private: - - static const double INFLpenalty; - - Query* processQuery( Search&,const QueryStatement& ); - - QueryResults* makeQueryResults( Query*,sal_Int32 nHits ); - - XmlIndex env_; - }; - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/Search.hxx b/xmlhelp/source/cxxhelp/inc/qe/Search.hxx deleted file mode 100644 index f77fe60bf9e8..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/Search.hxx +++ /dev/null @@ -1,116 +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: Search.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_SEARCH_HXX_ -#define _XMLSEARCH_QE_SEARCH_HXX_ - - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ref.hxx> -#include <rtl/ustring.hxx> -#include <qe/Query.hxx> -#include <qe/XmlIndex.hxx> -#ifndef _XMLSEARCH_DB_CONTEXTTABLES_HXX_ -#include <qe/ContextTables.hxx> -#endif -#include <qe/ConceptData.hxx> -#include <qe/DocGenerator.hxx> - - -class QueryFactoryImpl; - - -namespace xmlsearch { - - namespace qe { - - - class RoleFiller; - - - class Search - { - public: - - Search( XmlIndex* env ); - ~Search(); - - Query* addQuery( const rtl::OUString& context, - sal_Int32 nValidTerms,sal_Int32 nMissingTerms,sal_Int32 nHits, - double variantPenalty, - const std::vector< sal_Int32 >& primary, - const std::vector< std::vector< sal_Int32 > >& columns ); - - void startSearch(); - - - private: - - XmlIndex* env_; - QueryFactoryImpl* queryFactory_; - NextDocGeneratorHeap nextDocGenHeap_; - GeneratorHeap genHeap_; - ConceptGroupGenerator firstGenerator_; - std::vector< Query* > queries_; - ConceptData** conceptVisitor_; - std::vector< rtl::Reference< ConceptData > > conceptData_; - sal_Int32 free2_,limit_,document_,max_,base_,startingIndex_,nConcepts_; - sal_Int32 *concepts_; - std::vector<sal_Int32> docConcepts_,queryMasks_,maxConcepts_,kTable_,offsets_; - - sal_Int32 dataL_; - sal_Int8 *data_; - - void addTerm( sal_Int32 col,sal_Int32 concept,double score ); - - sal_Int32 partition( sal_Int32 p,sal_Int32 r ); - - void quicksort( sal_Int32 p,sal_Int32 r ); - - void searchDocument(); - - sal_Int32 nextDocument( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - bool openDocumentIndex( sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - ConceptGroupGenerator* makeGenerator( sal_Int32 group ) throw( xmlsearch::excep::XmlSearchException ); //t - - sal_Int32 indexOf( sal_Int32 concept ) throw( xmlsearch::excep::XmlSearchException ); - }; - - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx b/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx deleted file mode 100644 index ba9664032bf9..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx +++ /dev/null @@ -1,134 +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: XmlIndex.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_XMLINDEX_HXX_ -#define _XMLSEARCH_QE_XMLINDEX_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <qe/ContextTables.hxx> -#include <db/BtreeDict.hxx> -#include <util/IndexAccessor.hxx> - - -namespace xmlsearch { - - namespace qe { - - - class QueryHit; - class QueryHitData; - class NonnegativeIntegerGenerator; - - - class XmlIndex - { - public: - - XmlIndex( const rtl::OUString& indexDir ) - throw( xmlsearch::excep::IOException ); - - ~XmlIndex(); - - ContextTables* getContextInfo() { return contextTables_; } - - - sal_Int32 fetch( const rtl::OUString& key ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.fetch( key ); - } - - rtl::OUString fetch( sal_Int32 key ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.fetch( key ); - } - - std::vector< sal_Int32 > withPrefix( const rtl::OUString& prefix ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.withPrefix( prefix ); - } - - bool occursInText( sal_Int32 concept ); - - void reset(); - - void resetContextSearch() { contextTables_->resetContextSearch(); } - - NonnegativeIntegerGenerator* getDocumentIterator( sal_Int32 concept ); - - rtl::OUString documentName( sal_Int32 docNumber ) throw( xmlsearch::excep::XmlSearchException ); - - QueryHitData* hitToData( QueryHit* ); - - sal_Int8* getPositions( sal_Int32&,sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 getDocumentIndex( sal_Int32 docNo ) { return microIndexOffsets_[ docNo ] - currentBatchOffset_; } - - - private: - - sal_Int32 currentBatchOffset_,maxDocNumberInCache_; - - xmlsearch::util::IndexAccessor indexAccessor_; - xmlsearch::util::RandomAccessStream* positionsFile_; - xmlsearch::db::BtreeDict dict_; - - ContextTables* contextTables_; - - sal_Int32 allListsL_; - sal_Int8* allLists_; - - bool allInCache_; - sal_Int32 positionsL_; - sal_Int8 *positions_; - - sal_Int32 contextsDataL_; - sal_Int8 *contextsData_; - - sal_Int32 linkNamesL_; - rtl::OUString* linkNames_; - - std::vector< sal_Int32 > concepts_,offsets_,documents_,microIndexOffsets_,titles_,contextsOffsets_; - - void readMicroindexes( sal_Int32 docNo ) throw( xmlsearch::excep::IOException ); - }; - - - } - -} - - - -#endif - diff --git a/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx index d31a9d03d1b4..246d647603ee 100644 --- a/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx +++ b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx @@ -58,18 +58,6 @@ namespace xmlsearch { 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_; diff --git a/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx b/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx deleted file mode 100644 index 1a14383af980..000000000000 --- a/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx +++ /dev/null @@ -1,71 +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: DBEnvImpl.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_DBENVIMPL_HXX_ -#define _XMLSEARCH_DB_DBENVIMPL_HXX_ -#endif - - -#include <rtl/ustring.hxx> -#include <db/DBEnv.hxx> -#include <util/RandomAccessStream.hxx> -#include <db/Block.hxx> -#include <util/IndexAccessor.hxx> - -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 index fcc5ee35ba00..2f68133d7f6f 100644 --- a/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx +++ b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx @@ -60,35 +60,17 @@ namespace xmlsearch { 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 ); - }; diff --git a/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx b/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx deleted file mode 100644 index edae2cb85724..000000000000 --- a/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx +++ /dev/null @@ -1,92 +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: IndexAccessor.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_INDEXACCESSOR_HXX_ -#define _XMLSEARCH_UTIL_INDEXACCESSOR_HXX_ - - -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - class IndexAccessor - { - public: - - enum ACCESSKIND { READ, - WRITE, - READWRITE }; - - - IndexAccessor( const rtl::OUString& dirName ) - { - if( dirName.getLength() ) - { - if( dirName.getStr()[dirName.getLength()-1] != sal_Unicode( '/' ) ) - dirName_ = ( dirName + rtl::OUString::createFromAscii( "/" ) ) ; - else - dirName_ = dirName; - } - } - - - ~IndexAccessor() - { - } - - - IndexAccessor( const IndexAccessor& accessor ) - { - dirName_ = accessor.dirName_; - } - - - RandomAccessStream* getStream( const rtl::OUString& fileName, - const rtl::OUString& how ) const; - - - sal_Int32 readByteArray( sal_Int8*& data, const rtl::OUString& fileName ) - throw( xmlsearch::excep::IOException ); - - private: - - rtl::OUString dirName_; - - }; - - } -} - - -#endif |