cid#1640468 Dereference after null check
[LibreOffice.git] / connectivity / source / inc / TSkipDeletedSet.hxx
blobefe142af548c93a91f676ddbf921c8fe169ddaea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include "TResultSetHelper.hxx"
22 #include <vector>
23 #include <connectivity/dbtoolsdllapi.hxx>
25 namespace connectivity
27 /**
28 the class OSkipDeletedSet supports a general method to skip deleted rows
30 class OOO_DLLPUBLIC_DBTOOLS OSkipDeletedSet
32 std::vector<sal_Int32> m_aBookmarksPositions;// vector of iterators to position map, the order is the logical position
33 IResultSetHelper* m_pHelper; // used for moving in the resultset
34 bool m_bDeletedVisible;
36 bool moveAbsolute(sal_Int32 _nOffset,bool _bRetrieveData);
37 public:
38 OSkipDeletedSet(IResultSetHelper* _pHelper);
39 ~OSkipDeletedSet();
41 /**
42 skipDeleted moves the resultset to the position defined by the parameters
43 it guarantees that the row isn't deleted
44 @param
45 IResultSetHelper::Movement _eCursorPosition in which direction the resultset should be moved
46 sal_Int32 _nOffset the position relative to the movement
47 sal_Bool _bRetrieveData is true when the current row should be filled which data
48 @return
49 true when the movement was successful otherwise false
51 bool skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, bool _bRetrieveData);
52 /**
53 clear the map and the vector used in this class
55 void clear();
56 /**
57 getMappedPosition returns the mapped position of a logical position
58 @param
59 sal_Int32 _nBookmark the logical position
61 @return the mapped position
63 sal_Int32 getMappedPosition(sal_Int32 _nBookmark) const;
64 /**
65 insertNewPosition adds a new position to the map
66 @param
67 sal_Int32 _nPos the logical position
69 void insertNewPosition(sal_Int32 _nPos);
70 /**
71 deletePosition deletes this position from the map and decrement all following positions
72 @param
73 sal_Int32 _nPos the logical position
75 void deletePosition(sal_Int32 _nPos);
76 void SetDeletedVisible(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; }
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */