diff options
Diffstat (limited to 'connectivity/source/drivers/dbase/dindexnode.cxx')
-rw-r--r-- | connectivity/source/drivers/dbase/dindexnode.cxx | 239 |
1 files changed, 98 insertions, 141 deletions
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 5e153e2f6111..b2fea12ab294 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,13 +94,11 @@ ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent) ONDXPage::~ONDXPage() { delete[] ppNodes; - // delete aParent; - // delete aChild; } //------------------------------------------------------------------ void ONDXPage::QueryDelete() { - // Ablegen im GarbageCollector + // Store in GarbageCollector if (IsModified() && rIndex.m_pFileStream) (*rIndex.m_pFileStream) << *this; @@ -138,7 +137,7 @@ ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex) //------------------------------------------------------------------ sal_uInt16 ONDXPage::FindPos(const ONDXKey& rKey) const { - // sucht nach Platz fuer den vorgegeben key auf einer Seite + // searches the position for the given key in a page sal_uInt16 i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; @@ -149,11 +148,10 @@ sal_uInt16 ONDXPage::FindPos(const ONDXKey& rKey) const //------------------------------------------------------------------ sal_Bool ONDXPage::Find(const ONDXKey& rKey) { - // sucht den vorgegeben key - // Besonderheit: gelangt der Algorithmus ans Ende - // wird immer die aktuelle Seite und die Knotenposition vermerkt - // auf die die Bedingung <= zutrifft - // dieses findet beim Insert besondere Beachtung + // searches the given key + // Speciality: At the end of the method + // the actual page and the position of the node, fulfilling the '<=' condition, are saved + // This is considered at insert. sal_uInt16 i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; @@ -162,7 +160,7 @@ sal_Bool ONDXPage::Find(const ONDXKey& rKey) if (!IsLeaf()) { - // weiter absteigen + // descend further ONDXPagePtr aPage = (i==0) ? GetChild(&rIndex) : ((*this)[i-1]).GetChild(&rIndex, this); bResult = aPage.Is() && aPage->Find(rKey); } @@ -184,8 +182,8 @@ sal_Bool ONDXPage::Find(const ONDXKey& rKey) //------------------------------------------------------------------ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) { - // beim Erzeugen eines Index koennen auch mehrere Knoten eingefuegt werden - // diese sin dann aufsteigend sortiert + // When creating an index there can be multiple nodes added, + // these are sorted ascending sal_Bool bAppend = nRowsLeft > 0; if (IsFull()) { @@ -195,17 +193,16 @@ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) aSplitNode = rNode; else { - // merken des letzten Knotens + // Save the last node aSplitNode = (*this)[nCount-1]; if(rNode.GetKey() <= aSplitNode.GetKey()) { - // und damit habe ich im folgenden praktisch eine Node weniger + // this practically reduces the number of nodes by 1 if (IsLeaf() && this == &rIndex.m_aCurLeaf) { - // geht davon aus, dass der Knoten, auf dem die Bedingung (<=) - // zutrifft, als m_nCurNode gesetzt ist - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + // assumes, that the node, for which the condition (<=) holds, is stored in m_nCurNode + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(rIndex.m_nCurNode + 1, rNode); } else // Position unbekannt @@ -213,11 +210,11 @@ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) sal_uInt16 nPos = NODE_NOTFOUND; while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()) ; - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(nPos, rNode); } - // konnte der neue Knoten eingefuegt werden + // can the new node be inserted if (!bResult) { nCount++; @@ -231,10 +228,10 @@ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) sal_uInt32 nNewPagePos = rIndex.GetPageCount(); sal_uInt32 nNewPageCount = nNewPagePos + 1; - // Herausgeloesten Knoten beim Vater einfuegen + // insert extracted node into parent node if (!HasParent()) { - // Kein Vater, dann neue Wurzel + // No parent, then new root ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1); aNewRoot->SetChild(this); @@ -243,29 +240,27 @@ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.SetPageCount(++nNewPageCount); } - // neues blatt erzeugen und Seite aufteilen + // create new leaf and divide page ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,aParent); rIndex.SetPageCount(nNewPageCount); - // wieviele Knoten weren noch eingefuegt - // kommen noch ausreichend, dann koennen die Seiten bis zum Rand vollgestopft werden - + // How many nodes are being inserted? + // Enough, then we can fill the page to the brim ONDXNode aInnerNode; if (!IsLeaf() || nRowsLeft < (sal_uInt32)(rIndex.GetMaxNodes() / 2)) aInnerNode = Split(*aNewPage); else { aInnerNode = (*this)[nCount - 1]; - //aInnerNode = aSplitNode; - // Knoten zeigt auf neue Seite + // Node points to the new page aInnerNode.SetChild(aNewPage); - // innere Knoten haben keine Recordnummer + // Inner nodes have no record number if (rIndex.isUnique()) aInnerNode.GetKey().ResetRecord(); - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to the page of the extracted node if (!IsLeaf()) aNewPage->SetChild(aInnerNode.GetChild()); } @@ -277,15 +272,15 @@ sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.m_aCurLeaf = aNewPage; rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1; - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + // free not needed pages, there are no references to those on the page + // afterwards 'this' can't be valid anymore!!! ReleaseFull(); } - // Einfuegen des herausgeloesten Knotens + // Insert extracted node return aTempParent->Insert(aInnerNode); } - else // Seite einfach weiter auffuellen + else // Fill the page up { if (bAppend) { @@ -314,7 +309,7 @@ sal_Bool ONDXPage::Insert(sal_uInt16 nPos, ONDXNode& rNode) if (nCount) { ++nCount; - // nach rechts verschieben + // shift right for (sal_uInt16 i = std::min((sal_uInt16)(nMaxCount-1), (sal_uInt16)(nCount-1)); nPos < i; --i) (*this)[i] = (*this)[i-1]; } @@ -322,7 +317,7 @@ sal_Bool ONDXPage::Insert(sal_uInt16 nPos, ONDXNode& rNode) if (nCount < nMaxCount) nCount++; - // einfuegen an der Position + // insert at the position ONDXNode& rInsertNode = (*this)[nPos]; rInsertNode = rNode; if (rInsertNode.GetChild().Is()) @@ -345,11 +340,11 @@ sal_Bool ONDXPage::Append(ONDXNode& rNode) //------------------------------------------------------------------ void ONDXPage::Release(sal_Bool bSave) { - // freigeben der Pages + // free pages if (aChild.Is()) aChild->Release(bSave); - // Pointer freigeben + // free pointer aChild.Clear(); for (sal_uInt16 i = 0; i < rIndex.getHeader().db_maxkeys;i++) @@ -369,8 +364,8 @@ void ONDXPage::ReleaseFull(sal_Bool bSave) if (aTempParent.Is()) { - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + // Free pages not needed, there will be no reference anymore to the pages + // afterwards 'this' can't be valid anymore!!! sal_uInt16 nParentPos = aTempParent->Search(this); if (nParentPos != NODE_NOTFOUND) (*aTempParent)[nParentPos].GetChild().Clear(); @@ -383,77 +378,47 @@ sal_Bool ONDXPage::Delete(sal_uInt16 nNodePos) { if (IsLeaf()) { - // Letztes Element wird geloescht + // The last element will not be deleted if (nNodePos == (nCount - 1)) { ONDXNode aNode = (*this)[nNodePos]; - // beim Parent muss nun der KeyValue ausgetauscht werden + // parent's KeyValue has to be replaced if (HasParent()) aParent->SearchAndReplace(aNode.GetKey(), (*this)[nNodePos-1].GetKey()); } } - // Loeschen des Knoten + // Delete the node Remove(nNodePos); - // Unterlauf + // Underflow if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2)) { - // Feststellen, welcher Knoten auf die Seite zeigt + // determine, which node points to the page sal_uInt16 nParentNodePos = aParent->Search(this); - // letzte Element auf Vaterseite - // -> zusammenlegen mit vorletzter Seite + // last element on parent-page -> merge with secondlast page if (nParentNodePos == (aParent->Count() - 1)) { if (!nParentNodePos) - // zusammenlegen mit linken nachbarn + // merge with left neighbour Merge(nParentNodePos,aParent->GetChild(&rIndex)); else Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent)); } - // sonst Seite mit naechster Seite zusammenlegen + // otherwise merge page with next page else { - // zusammenlegen mit rechten nachbarn + // merge with right neighbour Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent))); nParentNodePos++; } if (HasParent() && !(*aParent)[nParentNodePos].HasChild()) aParent->Delete(nParentNodePos); -/* - // letzte Element auf Vaterseite - // -> zusammenlegen mit vorletzter Seite - if (nParentNodePos == (aParent->Count() - 1)) - { - if (!nParentNodePos) - // zusammenlegen mit linken nachbarn - Merge(nParentNodePos,aParent->GetChild(&rIndex)); - else - Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent)); - } - // sonst Seite mit naechster Seite zusammenlegen - else if(nParentNodePos != NODE_NOTFOUND) - { - // zusammenlegen mit rechten nachbarn - Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent))); - nParentNodePos++; - } - else // Sonderbehandlung - { - // Page ist aChild Page vom Parent => erste Page aus ppNodes an aChild anhaengen - Merge(0,(*aParent)[0].GetChild(&rIndex,aParent)); - nParentNodePos = 0; - } - - if (HasParent() && !(*aParent)[nParentNodePos].HasChild()) - aParent->Delete(nParentNodePos); -*/ - } else if (IsRoot()) - // Sicherstellen das die Position der Wurzel festgehalten wird + // make sure that the position of the root is kept rIndex.SetRootPos(nPagePos); return sal_True; } @@ -463,15 +428,15 @@ sal_Bool ONDXPage::Delete(sal_uInt16 nNodePos) ONDXNode ONDXPage::Split(ONDXPage& rPage) { DBG_ASSERT(IsFull(), "Falsches Splitting"); - /* Aufteilen einer Seite auf zwei - Blatt: - Seite 1 behaelt (n - (n/2)) - Seite 2 erhaelt (n/2) - Knoten n/2 wird dupliziert - Innerer Knoten: - Seite 1 behaelt (n+1)/2 - Seite 2 erhaelt (n/2-1) - Knoten ((n+1)/2 + 1) : wird herausgenommen + /* devide one page into two + leaf: + Page 1 is (n - (n/2)) + Page 2 is (n/2) + Node n/2 will be duplicated + inner node: + Page 1 is (n+1)/2 + Page 2 is (n/2-1) + Node ((n+1)/2 + 1) : will be taken out */ ONDXNode aResultNode; if (IsLeaf()) @@ -479,8 +444,7 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage) for (sal_uInt16 i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++) rPage.Insert(j++,(*this)[i]); - // dieser Knoten enthaelt einen Schluessel der noch einmal im Tree vorkommt - // und ersetzt werden muss + // this node contains a key that already exists in the tree and must be replaced ONDXNode aLastNode = (*this)[nCount - 1]; nCount = nCount - (nCount / 2); aResultNode = (*this)[nCount - 1]; @@ -497,13 +461,13 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage) aResultNode = (*this)[(nCount + 1) / 2]; nCount = (nCount + 1) / 2; - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to page with extraced node rPage.SetChild(aResultNode.GetChild()); } - // Knoten zeigt auf neue Seite + // node points to new page aResultNode.SetChild(&rPage); - // innere Knoten haben keine Recordnummer + // inner nodes have no record number if (rIndex.isUnique()) aResultNode.GetKey().ResetRecord(); bModified = sal_True; @@ -516,25 +480,25 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) DBG_ASSERT(HasParent(), "kein Vater vorhanden"); DBG_ASSERT(nParentNodePos != NODE_NOTFOUND, "Falscher Indexaufbau"); - /* Zusammenlegen zweier Seiten */ + /* Merge 2 pages */ ONDXNode aResultNode; sal_uInt16 nMaxNodes = rIndex.GetMaxNodes(), nMaxNodes_2 = nMaxNodes / 2; - // Feststellen ob Seite rechter oder linker Nachbar - sal_Bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // sal_True, wenn xPage die rechte Seite ist + // Determine if page is right or left neighbour + sal_Bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // sal_True, whenn xPage the right side is sal_uInt16 nNewCount = (*xPage).Count() + Count(); if (IsLeaf()) { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < (nMaxNodes_2 * 2)) { sal_uInt16 nLastNode = bRight ? Count() - 1 : xPage->Count() - 1; if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) while (xPage->Count()) { Append((*xPage)[0]); @@ -544,26 +508,24 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // xPage ist die linke Page und THIS die rechte + // xPage is the left page and THIS the right one while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); xPage->Remove(xPage->Count()-1); } - // alte Position von xPage beim Parent mit this ersetzen + // replace old position of xPage in parent with this if (nParentNodePos) (*aParent)[nParentNodePos-1].SetChild(this,aParent); - else // oder als rechten Knoten setzen + else // or set as right node aParent->SetChild(this); aParent->SetModified(sal_True); } - // Child beziehung beim Vaterknoten aufheben + // cancel Child-relationship at parent node (*aParent)[nParentNodePos].SetChild(); - // Austauschen des KnotenWertes, nur wenn geaenderte Page - // die linke ist, ansonsten werde - + // replace the Node-value, only if changed page is the left one, otherwise become if(aParent->IsRoot() && aParent->Count() == 1) { (*aParent)[0].SetChild(); @@ -577,47 +539,46 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) aParent->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey()); xPage->SetModified(sal_False); - xPage->ReleaseFull(); // wird nicht mehr benoetigt + xPage->ReleaseFull(); // is not needed anymore } - // Ausgleichen der Elemente nNewCount >= (nMaxNodes_2 * 2) + // balance the elements nNewCount >= (nMaxNodes_2 * 2) else { if (bRight) { - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) ONDXNode aReplaceNode = (*this)[nCount - 1]; while (nCount < nMaxNodes_2) { Append((*xPage)[0]); xPage->Remove(0); } - // Austauschen des KnotenWertes: Setzt alten letzten Wert durch den letzten von xPage + // Replace the node values: replace old last value by the last of xPage aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey()); } else { - // alle Knoten aus this vor die xPage Knoten einfuegen + // insert all nodes from this in front of the xPage nodes ONDXNode aReplaceNode = (*this)[nCount - 1]; while (xPage->Count() < nMaxNodes_2) { xPage->Insert(0,(*this)[nCount-1]); Remove(nCount-1); } - // Austauschen des KnotenWertes + // Replace the node value aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey()); } } } else // !IsLeaf() { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < nMaxNodes_2 * 2) { if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child von xPage + // Parent node will be integrated; is initialized with Child from xPage (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent); Append((*aParent)[nParentNodePos]); for (sal_uInt16 i = 0 ; i < xPage->Count(); i++) @@ -626,10 +587,9 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child - (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent merkt sich mein Child - Insert(0,(*aParent)[nParentNodePos]); // Node vom Parent bei mir einfuegen + // Parent-node will be integrated; is initialized with child + (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent memorizes my child + Insert(0,(*aParent)[nParentNodePos]); // insert parent node into myself while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); @@ -643,7 +603,7 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) aParent->SetChild(this); } - // danach wird der Vaterknoten zurueckgesetzt + // afterwards parent node will be reset (*aParent)[nParentNodePos].SetChild(); aParent->SetModified(sal_True); @@ -657,15 +617,15 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) SetModified(sal_True); } else if(nParentNodePos) - // Austauschen des KnotenWertes - // beim Append wird der Bereich erweitert, beim INsert verweist der alte Knoten von xPage auf this - // deshalb muss der Knoten auch hier aktualisiert werden + // replace the node value + // for Append the range will be enlarged, for Insert the old node from xPage will reference to this + // thats why the node must be updated here aParent->SearchAndReplace((*aParent)[nParentNodePos-1].GetKey(),(*aParent)[nParentNodePos].GetKey()); xPage->SetModified(sal_False); xPage->ReleaseFull(); } - // Ausgleichen der Elemente + // balance the elements else { if (bRight) @@ -704,7 +664,7 @@ void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) //------------------------------------------------------------------ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { - rStream >> aKey.nRecord; // schluessel + rStream >> aKey.nRecord; // key if (rIndex.getHeader().db_keytype) { @@ -723,7 +683,6 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) aBuf.ReleaseBufferAccess(); aBuf.EraseTrailingChars(); - // aKey = ONDXKey((aBuf,rIndex.GetDBFConnection()->GetCharacterSet()) ,aKey.nRecord); aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord); } rStream >> aChild; @@ -739,9 +698,9 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const { const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) - rStream << (sal_uInt32)aKey.nRecord; // schluessel + rStream << (sal_uInt32)aKey.nRecord; // key else - rStream << (sal_uInt32)0; // schluessel + rStream << (sal_uInt32)0; // key if (rIndex.getHeader().db_keytype) // double { @@ -790,7 +749,6 @@ sal_Bool ONDXKey::IsText(sal_Int32 eType) //------------------------------------------------------------------ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const { - // DBG_ASSERT(is(), "Falscher Indexzugriff"); StringCompare eResult; if (getValue().isNull()) @@ -818,7 +776,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; } - // Record vergleich, wenn Index !Unique + // compare record, if index !Unique if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; @@ -890,7 +848,6 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) rStream >> nValue >> rPage.aChild; rPage.nCount = sal_uInt16(nValue); -// DBG_ASSERT(rPage.nCount && rPage.nCount < rPage.GetIndex().GetMaxNodes(), "Falscher Count"); for (sal_uInt16 i = 0; i < rPage.nCount; i++) rPage[i].Read(rStream, rPage.GetIndex()); return rStream; @@ -899,7 +856,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) //------------------------------------------------------------------ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) { - // Seite existiert noch nicht + // Page doesn't exist yet sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE; if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) { @@ -942,7 +899,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r //------------------------------------------------------------------ void ONDXPage::PrintPage() { - DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", + OSL_TRACE("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos()); for (sal_uInt16 i = 0; i < nCount; i++) @@ -954,18 +911,18 @@ void ONDXPage::PrintPage() if (rKey.getValue().isNull()) { - DBG_TRACE2("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); } else if (rIndex.getHeader().db_keytype) { - DBG_TRACE3("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); } else { - DBG_TRACE3("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); } } - DBG_TRACE("SDB: -----------------------------------------------\n"); + OSL_TRACE("SDB: -----------------------------------------------\n"); if (!IsLeaf()) { #if OSL_DEBUG_LEVEL > 1 @@ -977,7 +934,7 @@ void ONDXPage::PrintPage() } #endif } - DBG_TRACE("SDB: ===============================================\n"); + OSL_TRACE("SDB: ===============================================\n"); } #endif // ----------------------------------------------------------------------------- @@ -989,7 +946,7 @@ sal_Bool ONDXPage::IsFull() const //------------------------------------------------------------------ sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch) { - // binare Suche spaeter + // binary search later sal_uInt16 i = NODE_NOTFOUND; while (++i < Count()) if ((*this)[i].GetKey() == rSearch) @@ -1006,12 +963,11 @@ sal_uInt16 ONDXPage::Search(const ONDXPage* pPage) if (((*this)[i]).GetChild() == pPage) break; - // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst - // auf die Page zeigt + // if not found, then we assume, that the page itself points to the page return (i < Count()) ? i : NODE_NOTFOUND; } // ----------------------------------------------------------------------------- -// laeuft rekursiv +// runs recursively void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { @@ -1057,3 +1013,4 @@ void ONDXPage::Remove(sal_uInt16 nPos) } // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |