diff options
author | Andreas Bille <abi@openoffice.org> | 2001-06-06 13:48:47 +0000 |
---|---|---|
committer | Andreas Bille <abi@openoffice.org> | 2001-06-06 13:48:47 +0000 |
commit | 5c84308b9aee0d929e44c78bebd3812d382e8717 (patch) | |
tree | 3790ba07ea87bc337d4442d7113480a650f79f89 /xmlhelp/source/cxxhelp/qe | |
parent | e075a939a9eba716c7dc2eee03a9ae9c3f25bf5a (diff) |
Memory management
no double transformation of documents
jar files stay open
direct access to package api
Diffstat (limited to 'xmlhelp/source/cxxhelp/qe')
-rw-r--r-- | xmlhelp/source/cxxhelp/qe/DocGenerator.cxx | 13 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx | 44 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/qe/Search.cxx | 14 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/qe/XmlIndex.cxx | 19 |
4 files changed, 16 insertions, 74 deletions
diff --git a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx index edeeab84393b..b215c72b64ad 100644 --- a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx +++ b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DocGenerator.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: abi $ $Date: 2001-05-10 15:25:32 $ + * last change: $Author: abi $ $Date: 2001-06-06 14:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,7 +103,6 @@ RoleFiller::RoleFiller( sal_Int32 nColumns, fixedRole_( sal_uInt8( role & 0xF ) ), // primary/constitutive concept/role fillers_( nColumns ) { - // cout << "RoleFiller constructed" << nColumns << ' ' << role << ' ' << pos << endl; filled_ = sal_Int16( 1 << fixedRole_ ); begin_ = pos; // offset in file // _end = _begin + first.getConceptLength(); @@ -397,7 +396,6 @@ bool ConceptGroupGenerator::next() throw( excep::XmlSearchException ) while( bits_->readNext( k1_,this ) ) { sal_Int32 bla = bits_->read( k2_ ); -// cout << bla << endl; if( cData_ = table_[ bla ] ) return true; } @@ -441,7 +439,8 @@ void GeneratorHeap::reset() { for( sal_Int32 i = 0; i < heapSize_; ++i ) { - delete heap_[i]; heap_[i] = 0; + delete heap_[i]; + heap_[i] = 0; } free_ = 0; } @@ -453,10 +452,6 @@ void GeneratorHeap::addGenerator( ConceptGroupGenerator* cd ) { heap_.push_back( 0 ); } - else - { -// delete heap_[free_]; - } heap_[free_++] = cd; } diff --git a/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx b/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx index 95d4ededafcc..77ea417b50a0 100644 --- a/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx +++ b/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryProcessor.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-22 14:57:12 $ + * last change: $Author: abi $ $Date: 2001-06-06 14:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,11 +98,6 @@ QueryResults* QueryProcessor::processQuery( const QueryStatement& ment ) } -#ifdef ABIDEBUG -extern ostream& operator<<( ostream& out,const rtl::OUString& bla ); -#endif - - Query* QueryProcessor::processQuery( Search& search,const QueryStatement& ment ) { sal_Int32 nValidTerms = 0, nMissingTerms = 0, nContentTerms = 0; @@ -139,19 +134,14 @@ Query* QueryProcessor::processQuery( Search& search,const QueryStatement& ment ) } else if( str[lgt-1] == sal_Unicode( '*' ) ) { -// cout << term.copy( 0,lgt - 1 ) << endl; ids = env_->withPrefix( term.copy( 0,lgt - 1 ) ); // goes to BtreeDict::withPrefix variantPenalty = 0.0; -// for( int i = 0; i < ids.size(); ++i ) -// cout << ids[i] << endl; } else { sal_Int32 formID; id = env_->fetch( term ); - // cout << id << endl; - // std::vector< rtl::OUString > variants( morph_->getVariants( term ) ); std::vector< rtl::OUString > variants; @@ -179,30 +169,6 @@ Query* QueryProcessor::processQuery( Search& search,const QueryStatement& ment ) } } -// try -// { -// cout << env_->documentName( 1 ) << endl; -// } -// catch( const excep::XmlSearchException& e ) -// { -// cout << e.getMessage() << endl; -// } - -#ifdef ABIDEBUG -// cout << scope <<endl; -// cout << nValidTerms << endl; -// cout << nMissingTerms << endl; -// cout << nHits << endl; -// for( int a = 0; a < primary.size(); ++a ) -// { -// // cout << primary[a] << endl; -// for( int b = 0; b < columns[a].size(); ++b ) -// cout << columns[a][b] << endl; -// } -// exit( 1 ); -#endif - - return search.addQuery( scope, nValidTerms,nMissingTerms,nHits, variantPenalty, @@ -219,6 +185,12 @@ QueryResults::QueryResults( Query* query, sal_Int32 nHits ) } +QueryResults::~QueryResults() +{ + for( sal_Int32 i = 0; i < queryHits_.size(); ++i ) + delete queryHits_[i]; +} + QueryResults* QueryProcessor::makeQueryResults( Query* query,sal_Int32 nHits ) { diff --git a/xmlhelp/source/cxxhelp/qe/Search.cxx b/xmlhelp/source/cxxhelp/qe/Search.cxx index b643ec099574..7143ae593f7a 100644 --- a/xmlhelp/source/cxxhelp/qe/Search.cxx +++ b/xmlhelp/source/cxxhelp/qe/Search.cxx @@ -2,9 +2,9 @@ * * $RCSfile: Search.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-11 12:39:12 $ + * last change: $Author: abi $ $Date: 2001-06-06 14:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -421,7 +421,6 @@ void Search::startSearch() } catch( ... ) { - printf( "Search::startSearch -> catched exception \n" ); } } @@ -534,11 +533,6 @@ sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlse // and, with more care, creation of some GroupGenerators can be avoided // saturating queries with lots of good hits will lead to best results - -// printf( "docNo = %d",document_); -// print_rtl_OUString( ( rtl::OUString::createFromAscii( " docName = ") + -// env_->documentName( document_) ) ); - sal_Int32 voteMask = 0; Query* query; for( i = 0; i < queries_.size(); ++i ) @@ -623,7 +617,6 @@ bool Search::openDocumentIndex( sal_Int32 docNo ) throw( excep::XmlSearchExcepti firstGenerator_.init( dataL_,data_,base_ += 2,k2 ); // decode concept table nConcepts_ = firstGenerator_.decodeConcepts( kk & 0x3F,0,concepts_ ); -// cout << "false" << endl; return false; case 2: // multi group, no extents @@ -644,15 +637,12 @@ bool Search::openDocumentIndex( sal_Int32 docNo ) throw( excep::XmlSearchExcepti base_ += 1 + compr.bytesRead(); limit_ = maxConcepts_.size(); } -// cout << "true" << endl; return true; case 1: // single group, extents case 3: // multi group, extents throw excep::XmlSearchException( rtl::OUString::createFromAscii( "extents not yet implemented\n" ) ); } - -// cout << "false1" << endl; return false; } diff --git a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx index 636fa103e6ed..eaaab16a9614 100644 --- a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx +++ b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XmlIndex.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-22 14:57:12 $ + * last change: $Author: abi $ $Date: 2001-06-06 14:48:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -227,22 +227,8 @@ sal_Int32 binarySearch( const std::vector<sal_Int32>& arr,sal_Int32 value ) NonnegativeIntegerGenerator* XmlIndex::getDocumentIterator( sal_Int32 concept ) { -// #ifdef ABIDEBUG -// cout << concept << endl; -// #endif - sal_Int32 index = binarySearch( concepts_,concept ); -#ifdef ABIDEBUG -// cout << index << " " << allListsL_ << " " << allLists_ << endl; - -// for( int i = 0; i < allListsL_; ++i ) -// cout << "_allList[" << i << "] = " << sal_Int32( allLists_[i] ) << endl; - -// for( int i = 0; i < offsets_.size(); ++i ) -// cout << "offsets[" << i << "] = " << offsets_[i] << endl; -#endif - if( index >= 0 ) return new util::ConceptList( allLists_,allListsL_,offsets_[index] ); else @@ -342,7 +328,6 @@ QueryHitData* XmlIndex::hitToData( QueryHit* hit ) termsL,terms ); contextTables_->setMicroindex( document ); contextTables_->resetContextSearch(); -// contextTables_->hitLocation(terms, matches, result); return res; } |