OSDN Git Service

c2a3f14b21ed1c25b9c2cdcd0ff1242e8cf969b1
[qt-creator-jp/qt-creator-jp.git] / src / libs / valgrind / xmlprotocol / frame.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Author: Frank Osterfeld, KDAB (frank.osterfeld@kdab.com)
8 **
9 ** Contact: Nokia Corporation (qt-info@nokia.com)
10 **
11 ** No Commercial Usage
12 **
13 ** This file contains pre-release code and may not be distributed.
14 ** You may use this file in accordance with the terms and conditions
15 ** contained in the Technology Preview License Agreement accompanying
16 ** this package.
17 **
18 ** GNU Lesser General Public License Usage
19 **
20 ** Alternatively, this file may be used under the terms of the GNU Lesser
21 ** General Public License version 2.1 as published by the Free Software
22 ** Foundation and appearing in the file LICENSE.LGPL included in the
23 ** packaging of this file.  Please review the following information to
24 ** ensure the GNU Lesser General Public License version 2.1 requirements
25 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26 **
27 ** In addition, as a special exception, Nokia gives you certain additional
28 ** rights.  These rights are described in the Nokia Qt LGPL Exception
29 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30 **
31 ** If you have questions regarding the use of this file, please contact
32 ** Nokia at qt-info@nokia.com.
33 **
34 **************************************************************************/
35
36 #include "frame.h"
37
38 #include <QtCore/QString>
39 #include <QtCore/QtAlgorithms>
40
41 using namespace Valgrind;
42 using namespace Valgrind::XmlProtocol;
43
44 class Frame::Private : public QSharedData {
45 public:
46     explicit Private() :
47         ip(0), line( -1 )
48     {}
49
50     bool operator==(const Private &other) const
51     {
52         return ip == other.ip
53                 && object == other.object
54                 && functionName == other.functionName
55                 && file == other.file
56                 && directory == other.directory
57                 && line == other.line;
58     }
59
60     quint64 ip;
61     QString object;
62     QString functionName;
63     QString file;
64     QString directory;
65     int line;
66 };
67
68 Frame::Frame() : d(new Private)
69 {
70 }
71
72 Frame::~Frame()
73 {
74 }
75
76 Frame::Frame(const Frame &other) :
77     d( other.d )
78 {
79 }
80
81 Frame &Frame::operator=(const Frame &other)
82 {
83     Frame tmp(other);
84     swap(tmp);
85     return *this;
86 }
87
88 bool Frame::operator==( const Frame &other ) const
89 {
90     return *d == *other.d;
91 }
92
93 bool Frame::operator!=(const Frame &other) const
94 {
95     return !(*this == other);
96 }
97
98 void Frame::swap(Frame &other)
99 {
100     qSwap(d, other.d);
101 }
102
103 quint64 Frame::instructionPointer() const
104 {
105     return d->ip;
106 }
107
108 void Frame::setInstructionPointer(quint64 ip)
109 {
110     d->ip = ip;
111 }
112
113 QString Frame::object() const
114 {
115     return d->object;
116 }
117
118 void Frame::setObject(const QString &obj)
119 {
120     d->object = obj;
121 }
122
123 QString Frame::functionName() const
124 {
125     return d->functionName;
126 }
127
128 void Frame::setFunctionName(const QString &functionName)
129 {
130     d->functionName = functionName;
131 }
132
133 QString Frame::file() const
134 {
135     return d->file;
136 }
137
138 void Frame::setFile(const QString &file)
139 {
140     d->file = file;
141 }
142
143 QString Frame::directory() const
144 {
145     return d->directory;
146 }
147
148 void Frame::setDirectory(const QString &directory)
149 {
150     d->directory = directory;
151 }
152
153 int Frame::line() const
154 {
155     return d->line;
156 }
157
158 void Frame::setLine(int line)
159 {
160     d->line = line;
161 }