/src/libreoffice/connectivity/source/inc/file/FTable.hxx
Line | Count | Source |
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 <connectivity/sdbcx/VTable.hxx> |
23 | | #include <file/FConnection.hxx> |
24 | | #include <file/filedllapi.hxx> |
25 | | #include <tools/stream.hxx> |
26 | | #include <connectivity/FValue.hxx> |
27 | | #include <TResultSetHelper.hxx> |
28 | | |
29 | | namespace connectivity::file |
30 | | { |
31 | | typedef connectivity::sdbcx::OTable OTable_TYPEDEF; |
32 | | |
33 | | class OOO_DLLPUBLIC_FILE OFileTable : public OTable_TYPEDEF |
34 | | { |
35 | | protected: |
36 | | OConnection* m_pConnection; |
37 | | std::unique_ptr<SvStream> m_pFileStream; |
38 | | ::rtl::Reference<OSQLColumns> m_aColumns; |
39 | | sal_Int32 m_nFilePos; // current IResultSetHelper::Movement |
40 | | std::unique_ptr<sal_uInt8[]> m_pBuffer; |
41 | | sal_uInt16 m_nBufferSize; // size of the ReadBuffer, if pBuffer != NULL |
42 | | bool m_bWriteable; // svstream can't say if we are writeable |
43 | | // so we have to |
44 | | |
45 | | virtual void FileClose(); |
46 | | virtual ~OFileTable( ) override; |
47 | | public: |
48 | | virtual void refreshColumns() override; |
49 | | virtual void refreshKeys() override; |
50 | | virtual void refreshIndexes() override; |
51 | | public: |
52 | | OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection); |
53 | | OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, |
54 | | const OUString& Name, |
55 | | const OUString& Type, |
56 | | const OUString& Description, |
57 | | const OUString& SchemaName, |
58 | | const OUString& CatalogName |
59 | | ); |
60 | | |
61 | | //XInterface |
62 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; |
63 | | // ::cppu::OComponentHelper |
64 | | virtual void SAL_CALL disposing() override; |
65 | | |
66 | 0 | OConnection* getConnection() const { return m_pConnection;} |
67 | 0 | virtual sal_Int32 getCurrentLastPos() const {return -1;} |
68 | | |
69 | | virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; |
70 | | virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) = 0; |
71 | | |
72 | 0 | const ::rtl::Reference<OSQLColumns>& getTableColumns() const {return m_aColumns;} |
73 | | virtual bool InsertRow(OValueRefVector& rRow, const css::uno::Reference< css::container::XIndexAccess>& _xCols); |
74 | | virtual bool DeleteRow(const OSQLColumns& _rCols); |
75 | | virtual bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const css::uno::Reference< css::container::XIndexAccess>& _xCols); |
76 | | virtual void addColumn(const css::uno::Reference< css::beans::XPropertySet>& descriptor); |
77 | | virtual void dropColumn(sal_Int32 _nPos); |
78 | | // refresh the header of file based tables to see changes done by someone |
79 | | virtual void refreshHeader(); |
80 | | |
81 | 0 | OUString SAL_CALL getName() override { return m_Name; } |
82 | | |
83 | 0 | const OUString& getSchema() const { return m_SchemaName; } |
84 | 0 | bool isReadOnly() const { return !m_bWriteable; } |
85 | | // m_pFileStream && !m_pFileStream->IsWritable(); } |
86 | | |
87 | 0 | sal_Int32 getFilePos() const { return m_nFilePos; } |
88 | | |
89 | | public: |
90 | | // helper |
91 | | |
92 | | // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified |
93 | | // (NULL or non-NULL is returned) |
94 | | static std::unique_ptr<SvStream> createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode); |
95 | | }; |
96 | | |
97 | | } |
98 | | |
99 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |