LibreOffice Module connectivity (master) 1
ETable.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <file/FTable.hxx>
23#include <flat/EConnection.hxx>
25#include <file/quotedstring.hxx>
27#include <com/sun/star/util/XNumberFormatter.hpp>
28
29namespace connectivity::flat
30 {
32 class OFlatConnection;
33
34 typedef std::pair<sal_Int32, sal_Int32> TRowPositionInFile;
35
37 {
38 // maps a row position to a file position
39 // row n is positions [m_aRowPosToFilePos[n]->first, m_aRowPosToFilePos[n]->second) in file
40 // "real" row indexes start at 1; for the purposes of m_aRowPosToFilePos, row 0 is headers
41 std::vector<TRowPositionInFile>
43 std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset
44 std::vector<sal_Int32> m_aPrecisions; // same as aboth
45 std::vector<sal_Int32> m_aScales;
47 css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter;
48 css::util::Date m_aNullDate;
49 sal_Int32 m_nRowPos;
50 sal_Int32 m_nMaxRowCount; // will be set if stream is once eof
51 sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
52 sal_Unicode m_cFieldDelimiter; // look at the name
54 private:
55 void fillColumns(const css::lang::Locale& _aLocale);
56 bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty = false);
57 void setRowPos(std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos);
58 void impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2,
59 sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName,
60 const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass);
62 {
63#if OSL_DEBUG_LEVEL > 0
64 OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
65 assert(pConnection);
66#else
67 OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
68#endif
69 return pConnection;
70 }
71 public:
72 virtual void refreshColumns() override;
73
74 public:
75 // DECLARE_CTY_DEFAULTS( OFlatTable_BASE);
76 OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection,
77 const OUString& Name,
78 const OUString& Type,
79 const OUString& Description = OUString(),
80 const OUString& SchemaName = OUString(),
81 const OUString& CatalogName = OUString()
82 );
83
84 void construct() override; // can throw any exception
85
86 virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override;
87 virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
88 virtual void refreshHeader() override;
89
90 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
91 //XTypeProvider
92 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
93 virtual void SAL_CALL disposing() override;
94
95 OUString getEntry() const;
96 };
97
98}
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OConnection * m_pConnection
Definition: FTable.hxx:36
void setRowPos(std::vector< TRowPositionInFile >::size_type rowNum, const TRowPositionInFile &rowPos)
Definition: ETable.cxx:932
bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty=false)
Definition: ETable.cxx:851
virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32 &nCurPos) override
Definition: ETable.cxx:700
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: ETable.cxx:538
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: ETable.cxx:516
virtual void refreshColumns() override
Definition: ETable.cxx:492
OFlatConnection * getFlatConnection()
Definition: ETable.hxx:61
virtual void refreshHeader() override
Definition: ETable.cxx:682
void fillColumns(const css::lang::Locale &_aLocale)
Definition: ETable.cxx:62
virtual void SAL_CALL disposing() override
Definition: ETable.cxx:509
QuotedTokenizedString m_aCurrentLine
Definition: ETable.hxx:46
virtual bool fetchRow(OValueRefRow &_rRow, const OSQLColumns &_rCols, bool bRetrieveData) override
Definition: ETable.cxx:552
std::vector< sal_Int32 > m_aPrecisions
Definition: ETable.hxx:44
sal_Unicode m_cStringDelimiter
Definition: ETable.hxx:51
css::util::Date m_aNullDate
Definition: ETable.hxx:48
css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter
Definition: ETable.hxx:47
OFlatTable(sdbcx::OCollection *_pTables, OFlatConnection *_pConnection, const OUString &Name, const OUString &Type, const OUString &Description=OUString(), const OUString &SchemaName=OUString(), const OUString &CatalogName=OUString())
Definition: ETable.cxx:389
std::vector< sal_Int32 > m_aTypes
Definition: ETable.hxx:43
void impl_fillColumnInfo_nothrow(QuotedTokenizedString const &aFirstLine, sal_Int32 &nStartPosFirstLine, sal_Int32 &nStartPosFirstLine2, sal_Int32 &io_nType, sal_Int32 &io_nPrecisions, sal_Int32 &io_nScales, OUString &o_sTypeName, const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass &aCharClass)
Definition: ETable.cxx:196
std::vector< TRowPositionInFile > m_aRowPosToFilePos
Definition: ETable.hxx:42
std::vector< sal_Int32 > m_aScales
Definition: ETable.hxx:45
void construct() override
Definition: ETable.cxx:409
OUString getEntry() const
Definition: ETable.cxx:448
Type
file::OFileTable OFlatTable_BASE
Definition: ETable.hxx:31
std::pair< sal_Int32, sal_Int32 > TRowPositionInFile
Definition: ETable.hxx:32
sal_uInt16 sal_Unicode