OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / libs / valgrind / xmlprotocol / announcethread.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 "announcethread.h"
36 #include "frame.h"
37
38 #include <QtCore/QSharedData>
39 #include <QtCore/QVector>
40
41 #include <algorithm>
42
43 using namespace Valgrind;
44 using namespace Valgrind::XmlProtocol;
45
46 class AnnounceThread::Private : public QSharedData
47 {
48 public:
49     Private()
50         : hThreadId( -1 )
51     {
52     }
53
54     qint64 hThreadId;
55     QVector<Frame> stack;
56 };
57
58 AnnounceThread::AnnounceThread()
59     : d(new Private)
60 {
61 }
62
63 AnnounceThread::AnnounceThread(const AnnounceThread &other)
64     : d(other.d)
65 {
66 }
67
68 AnnounceThread::~AnnounceThread()
69 {
70 }
71
72 void AnnounceThread::swap(AnnounceThread &other)
73 {
74     qSwap(d, other.d);
75 }
76
77 AnnounceThread &AnnounceThread::operator=(const AnnounceThread &other)
78 {
79     AnnounceThread tmp(other);
80     swap(tmp);
81     return *this;
82 }
83
84 bool AnnounceThread::operator==(const AnnounceThread &other) const
85 {
86     return d->stack == other.d->stack
87             && d->hThreadId == other.d->hThreadId;
88 }
89
90 qint64 AnnounceThread::helgrindThreadId() const
91 {
92     return d->hThreadId;
93 }
94
95 void AnnounceThread::setHelgrindThreadId(qint64 id)
96 {
97     d->hThreadId = id;
98 }
99
100 QVector<Frame> AnnounceThread::stack() const
101 {
102     return d->stack;
103 }
104
105 void AnnounceThread::setStack(const QVector<Frame> &stack)
106 {
107     d->stack = stack;
108 }