1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include "hsqlbinarynode.hxx"
21 #include "rowinputbinary.hxx"
22 
23 namespace dbahsql
24 {
HsqlBinaryNode(sal_Int32 nPos)25 HsqlBinaryNode::HsqlBinaryNode(sal_Int32 nPos)
26     : m_nPos(nPos)
27 {
28 }
29 
readChildren(HsqlRowInputStream const & input)30 void HsqlBinaryNode::readChildren(HsqlRowInputStream const& input)
31 {
32     SvStream* pStream = input.getInputStream();
33     if (!pStream)
34         return;
35 
36     pStream->Seek(m_nPos + 8); // skip size and balance
37     pStream->ReadInt32(m_nLeft);
38     if (m_nLeft <= 0)
39         m_nLeft = -1;
40     pStream->ReadInt32(m_nRight);
41     if (m_nRight <= 0)
42         m_nRight = -1;
43 }
44 
readRow(HsqlRowInputStream & input,const std::vector<ColumnDefinition> & aColTypes,sal_Int32 nIndexCount)45 std::vector<css::uno::Any> HsqlBinaryNode::readRow(HsqlRowInputStream& input,
46                                                    const std::vector<ColumnDefinition>& aColTypes,
47                                                    sal_Int32 nIndexCount)
48 {
49     // skip first 4 bytes (size), and index nodes, 16 bytes each
50     input.seek(m_nPos + 4 + nIndexCount * 16);
51     return input.readOneRow(aColTypes);
52 }
53 
getLeft() const54 sal_Int32 HsqlBinaryNode::getLeft() const { return m_nLeft; }
getRight() const55 sal_Int32 HsqlBinaryNode::getRight() const { return m_nRight; }
56 };
57 
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
59