OSDN Git Service

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