~ubuntu-branches/ubuntu/trusty/kdevplatform/trusty-proposed

« back to all changes in this revision

Viewing changes to language/checks/dataaccess.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-05-08 18:15:55 UTC
  • mfrom: (0.3.22)
  • Revision ID: package-import@ubuntu.com-20130508181555-iu9n3sh6azd3rs9s
Tags: 1.5.0-0ubuntu1
* New upstream release
* Add build-dep on libgrantlee-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of KDevelop
 
2
    Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
 
3
 
 
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.
 
7
 
 
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.
 
12
 
 
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.
 
17
*/
 
18
 
 
19
#ifndef DATAACCESS_H
 
20
#define DATAACCESS_H
 
21
 
 
22
#include <language/languageexport.h>
 
23
#include <language/editor/rangeinrevision.h>
 
24
 
 
25
namespace KDevelop
 
26
{
 
27
class Declaration;
 
28
 
 
29
/**
 
30
 * @brief Represents a data access in some code
 
31
 *
 
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.
 
34
 */
 
35
class KDEVPLATFORMLANGUAGE_EXPORT DataAccess
 
36
{
 
37
    public:
 
38
        /** Defines the flags that will tell what this data access is about */
 
39
        enum DataAccessFlag {
 
40
            None = 0,
 
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*/
 
44
        };
 
45
        Q_DECLARE_FLAGS(DataAccessFlags, DataAccessFlag)
 
46
 
 
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
 
50
         */
 
51
        DataAccess(const CursorInRevision& cur, DataAccessFlags flags, const KDevelop::RangeInRevision& range);
 
52
 
 
53
        /** Checks the flags and returns if it's reading the data */
 
54
        bool isRead()  const;
 
55
 
 
56
        /** Checks the flags and returns if it's writing the data */
 
57
        bool isWrite() const;
 
58
 
 
59
        /** Checks the flags and returns if it's just some call */
 
60
        bool isCall() const;
 
61
 
 
62
        /** @returns the cursor */
 
63
        KDevelop::CursorInRevision pos() const;
 
64
 
 
65
        /** @returns the flags that specify how is this access interacting with the data */
 
66
        DataAccessFlags flags() const;
 
67
 
 
68
        /** @returns the range that contains the written value in case it's a Write access */
 
69
        KDevelop::RangeInRevision value() const;
 
70
 
 
71
    private:
 
72
        DataAccessFlags m_flags;
 
73
        KDevelop::CursorInRevision m_pos;
 
74
        KDevelop::RangeInRevision m_value;
 
75
};
 
76
 
 
77
}
 
78
 
 
79
#endif