OSDN Git Service

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