OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / valgrind / xmlprotocol / stack.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 (info@qt.nokia.com)
10 **
11 **
12 ** GNU Lesser General Public License Usage
13 **
14 ** This file may be used under the terms of the GNU Lesser General Public
15 ** License version 2.1 as published by the Free Software Foundation and
16 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
17 ** Please review the following information to ensure the GNU Lesser General
18 ** Public License version 2.1 requirements will be met:
19 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 **
21 ** In addition, as a special exception, Nokia gives you certain additional
22 ** rights. These rights are described in the Nokia Qt LGPL Exception
23 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
24 **
25 ** Other Usage
26 **
27 ** Alternatively, this file may be used in accordance with the terms and
28 ** conditions contained in a signed written agreement between you and Nokia.
29 **
30 ** If you have questions regarding the use of this file, please contact
31 ** Nokia at qt-info@nokia.com.
32 **
33 **************************************************************************/
34
35 #include "stack.h"
36 #include "frame.h"
37
38 #include <QtCore/QSharedData>
39 #include <QtCore/QString>
40 #include <QtCore/QVector>
41
42 #include <algorithm>
43
44 using namespace Valgrind;
45 using namespace Valgrind::XmlProtocol;
46
47 class Stack::Private : public QSharedData
48 {
49 public:
50     Private()
51         : line(-1)
52         , hthreadid(-1)
53     {
54     }
55
56     QString auxwhat;
57     QString file;
58     QString dir;
59     qint64 line;
60     qint64 hthreadid;
61     QVector<Frame> frames;
62 };
63
64 Stack::Stack()
65     : d(new Private)
66 {
67 }
68
69 Stack::Stack(const Stack &other)
70     : d(other.d)
71 {
72 }
73
74 Stack::~Stack()
75 {
76 }
77
78 void Stack::swap(Stack &other)
79 {
80     qSwap(d, other.d);
81 }
82
83 Stack &Stack::operator=(const Stack &other)
84 {
85     Stack tmp(other);
86     swap(tmp);
87     return *this;
88 }
89
90 bool Stack::operator==(const Stack &other) const
91 {
92     return d->frames == other.d->frames
93             && d->auxwhat == other.d->auxwhat
94             && d->file == other.d->file
95             && d->dir == other.d->dir
96             && d->line == other.d->line
97             && d->hthreadid == other.d->hthreadid;
98 }
99
100 QString Stack::auxWhat() const
101 {
102     return d->auxwhat;
103 }
104
105 void Stack::setAuxWhat(const QString &auxwhat)
106 {
107     d->auxwhat = auxwhat;
108 }
109
110 QVector<Frame> Stack::frames() const
111 {
112     return d->frames;
113 }
114
115 void Stack::setFrames(const QVector<Frame> &frames)
116 {
117     d->frames = frames;
118 }
119
120 QString Stack::file() const
121 {
122     return d->file;
123 }
124
125 void Stack::setFile(const QString &file)
126 {
127     d->file = file;
128 }
129
130 QString Stack::directory() const
131 {
132     return d->dir;
133 }
134
135 void Stack::setDirectory(const QString &directory)
136 {
137     d->dir = directory;
138 }
139
140 qint64 Stack::line() const
141 {
142     return d->line;
143 }
144
145 void Stack::setLine(qint64 line)
146 {
147     d->line = line;
148 }
149
150 qint64 Stack::helgrindThreadId() const
151 {
152     return d->hthreadid;
153 }
154
155 void Stack::setHelgrindThreadId(qint64 id)
156 {
157     d->hthreadid = id;
158 }