45 , xValue(
std::move(aVal))
109 ppNodes[
i].GetChild()->Release(
false);
143 while (i < nCount && rKey > ((*
this)[
i]).GetKey())
157 while (i < nCount && rKey > ((*
this)[
i]).GetKey())
160 bool bResult =
false;
166 bResult = aPage.
Is() && aPage->
Find(rKey);
176 bResult = rKey == ((*this)[
i]).GetKey();
188 bool bAppend = nRowsLeft > 0;
197 aSplitNode = (*this)[
nCount-1];
229 sal_uInt32 nNewPageCount = nNewPagePos + 1;
251 aInnerNode =
Split(*aNewPage);
254 aInnerNode = (*this)[
nCount - 1];
268 aNewPage->
Append(aSplitNode);
281 return aTempParent->
Insert(aInnerNode);
297 return Insert(nNodePos, rNode);
306 if (
nPos >= nMaxCount)
313 for (sal_uInt16
i = std::min(
static_cast<sal_uInt16
>(nMaxCount-1),
static_cast<sal_uInt16
>(
nCount-1));
nPos <
i; --
i)
314 (*
this)[
i] = (*this)[
i-1];
353 ppNodes[
i].GetChild()->Release(bSave);
365 if (aTempParent.
Is())
369 sal_uInt16 nParentPos = aTempParent->
Search(
this);
371 (*aTempParent)[nParentPos].GetChild().Clear();
382 if (nNodePos == (
nCount - 1))
389 (*
this)[nNodePos-1].GetKey());
448 aResultNode = (*this)[
nCount - 1];
452 aResultNode.GetKey());
459 aResultNode = (*this)[(
nCount + 1) / 2];
483 nMaxNodes_2 = nMaxNodes / 2;
486 bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey());
487 sal_uInt16 nNewCount = (*xPage).Count() +
Count();
492 if (nNewCount < (nMaxNodes_2 * 2))
494 sal_uInt16 nLastNode = bRight ?
Count() - 1 : xPage->
Count() - 1;
497 DBG_ASSERT(xPage !=
this,
"xPage and THIS must not be the same: infinite loop");
499 while (xPage->
Count())
507 DBG_ASSERT(xPage !=
this,
"xPage and THIS must not be the same: infinite loop");
509 while (xPage->
Count())
516 (*aParent)[nParentNodePos-1].SetChild(
this,
aParent);
524 (*aParent)[nParentNodePos].SetChild();
528 (*aParent)[0].SetChild();
548 while (
nCount < nMaxNodes_2)
560 while (xPage->
Count() < nMaxNodes_2)
573 if (nNewCount < nMaxNodes_2 * 2)
577 DBG_ASSERT(xPage !=
this,
"xPage and THIS must not be the same: infinite loop");
581 for (sal_uInt16
i = 0 ;
i < xPage->
Count();
i++)
586 DBG_ASSERT(xPage !=
this,
"xPage and THIS must not be the same: infinite loop");
590 while (xPage->
Count())
598 (*aParent)[nParentNodePos-1].SetChild(
this,
aParent);
604 (*aParent)[nParentNodePos].SetChild();
609 (*aParent).SetChild();
616 else if(nParentNodePos)
630 while (
nCount < nMaxNodes_2)
634 (*aParent)[nParentNodePos] = (*xPage)[0];
638 (*aParent)[nParentNodePos].SetChild(xPage,
aParent);
642 while (
nCount < nMaxNodes_2)
646 (*aParent)[nParentNodePos] = (*xPage)[xPage->
Count()-1];
650 (*aParent)[nParentNodePos].SetChild(
this,
aParent);
676 sal_Int32 nContentLen =
aBuf.getLength();
677 while (nContentLen &&
aBuf[nContentLen-1] ==
' ')
697 SAL_WARN(
"connectivity.dbase",
"this key length cannot possibly be right?");
710 std::unique_ptr<sal_uInt8[]> pBuf(
new sal_uInt8[nLen]);
711 memset(&pBuf[0], 0x20, nLen);
716 strncpy(
reinterpret_cast<char *
>(&pBuf[0]), aText.getStr(),
717 std::min<size_t>(nLen, aText.getLength()));
740 return eType == DataType::VARCHAR ||
eType == DataType::CHAR;
770 nRes = (
m >
n) ? 1 : (
m <
n) ? -1 : 0;
814 rRef.mpPage =
nullptr;
815 nPagePos = rRef.nPagePos;
820 , nPagePos(rRef.nPagePos)
853 *
this = std::move(aTemp);
864 rOther.mpPage =
nullptr;
876 for (sal_uInt16
i = 0;
i < rPage.
nCount;
i++)
903 rPage[
i].
Write(rStream, rPage);
910 std::size_t nRemainSize = nBufferSize - nTell;
911 if ( nRemainSize <= nBufferSize )
913 std::unique_ptr<char[]> pEmptyData(
new char[nRemainSize] );
914 memset(pEmptyData.get(), 0x00, nRemainSize);
915 rStream.
WriteBytes(pEmptyData.get(), nRemainSize);
922#if OSL_DEBUG_LEVEL > 1
951 SAL_WARN(
"connectivity.dbase",
"SDB: -----------------------------------------------");
954#if OSL_DEBUG_LEVEL > 1
963 SAL_WARN(
"connectivity.dbase",
"SDB: ===============================================");
978 if ((*
this)[
i].GetKey() == rSearch)
1000 OSL_ENSURE(rSearch != rReplace,
"Invalid here:rSearch == rReplace");
1001 if (rSearch == rReplace)
1017 (*pPage)[
nPos].GetKey() = rReplace;
1040 (*
this)[
i] = (*this)[
i+1];
SvStream & WriteDouble(const double &rDouble)
virtual sal_uInt64 TellEnd()
SvStream & ReadDouble(double &rDouble)
sal_uInt16 GetBufferSize() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
bool SetStreamSize(sal_uInt64 nSize)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
OUString getString() const
void setBound(bool _bBound)
void SetPageCount(sal_uInt32 nCount)
bool UseCollector() const
void SetRootPos(sal_uInt32 nPos)
const NDXHeader & getHeader() const
ONDXPage * CreatePage(sal_uInt32 nPagePos, ONDXPage *pParent=nullptr, bool bLoad=false)
sal_uInt32 GetPageCount() const
std::unique_ptr< SvStream > m_pFileStream
sal_uInt16 GetMaxNodes() const
virtual const ORowSetValue & getValue() const override
virtual void setValue(const ORowSetValue &_rVal) override
int Compare(const ONDXKey &rKey) const
static bool IsText(sal_Int32 eType)
sal_uInt32 GetRecord() const
const ONDXKey & GetKey() const
void SetChild(ONDXPagePtr aCh=ONDXPagePtr(), ONDXPage *=nullptr)
void Read(SvStream &rStream, ODbaseIndex const &)
ONDXPagePtr & GetChild(ODbaseIndex *pIndex=nullptr, ONDXPage *=nullptr)
void Write(SvStream &rStream, const ONDXPage &rPage) const
ONDXPagePtr & operator=(ONDXPagePtr const &rRef)
sal_uInt32 GetPagePos() const
bool Append(ONDXNode &rNode)
ONDXPagePtr & GetChild(ODbaseIndex const *pIndex=nullptr)
void SetChild(ONDXPagePtr aCh)
sal_uInt32 GetPagePos() const
sal_uInt16 Search(const ONDXKey &rSearch)
ONDXNode Split(ONDXPage &rPage)
ONDXPage(ODbaseIndex &rIndex, sal_uInt32 nPos, ONDXPage *)
void SetParent(ONDXPagePtr aPa)
ONDXNode & operator[](sal_uInt16 nPos)
bool Find(const ONDXKey &)
sal_uInt16 FindPos(const ONDXKey &rKey) const
void SearchAndReplace(const ONDXKey &rSearch, ONDXKey const &rReplace)
void Merge(sal_uInt16 nParentNodePos, const ONDXPagePtr &xPage)
void SetModified(bool bMod)
bool Insert(ONDXNode &rNode, sal_uInt32 nRowsLeft=0)
std::unique_ptr< ONDXNode[]> ppNodes
void Release(bool bSave=true)
friend SvStream & WriteONDXPage(SvStream &rStream, const ONDXPage &)
OConnection * getConnection() const
sal_Int32 getDBType() const
#define DBG_ASSERT(sCon, aError)
#define SAL_WARN(area, stream)
OUString getString(const Any &_rAny)
SvStream & operator>>(SvStream &rStream, ODbaseIndex &)
SvStream & WriteONDXPage(SvStream &rStream, const ONDXPage &rPage)
SvStream & WriteONDXPagePtr(SvStream &rStream, const ONDXPagePtr &)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nUnits)