1
/* This file is part of KDevelop
2
Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
22
#include <language/languageexport.h>
23
#include <language/editor/rangeinrevision.h>
30
* @brief Represents a data access in some code
32
* This class provides the position of a data access in the code
33
* and tells us whether it's writing or reading the data.
35
class KDEVPLATFORMLANGUAGE_EXPORT DataAccess
38
/** Defines the flags that will tell what this data access is about */
41
Read = 1, /**< This data access reads data */
42
Write = 2,/**< This data access writes data */
43
Call = 4 /**< This call is modifying some outsider data*/
45
Q_DECLARE_FLAGS(DataAccessFlags, DataAccessFlag)
47
/** Constructs a DataAccess instance with its @p cur position and
48
* its @p flags DataAccessFlags that will tell us how is it modifying the data.
49
* In case it's a Write, a @p range can be provided
51
DataAccess(const CursorInRevision& cur, DataAccessFlags flags, const KDevelop::RangeInRevision& range);
53
/** Checks the flags and returns if it's reading the data */
56
/** Checks the flags and returns if it's writing the data */
59
/** Checks the flags and returns if it's just some call */
62
/** @returns the cursor */
63
KDevelop::CursorInRevision pos() const;
65
/** @returns the flags that specify how is this access interacting with the data */
66
DataAccessFlags flags() const;
68
/** @returns the range that contains the written value in case it's a Write access */
69
KDevelop::RangeInRevision value() const;
72
DataAccessFlags m_flags;
73
KDevelop::CursorInRevision m_pos;
74
KDevelop::RangeInRevision m_value;