Attica

metadata.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #include "metadata.h"
10 
11 #include <QSharedData>
12 
13 using namespace Attica;
14 
15 class Metadata::Private : public QSharedData
16 {
17 public:
18  Error error;
19 
24  int statusCode;
25 
28 
30  int totalItems;
32  int itemsPerPage;
33 
35 
36  Private()
37  // values that make sense for single item jobs
38  : error(NoError)
39  , statusCode(0)
40  , totalItems(1)
41  , itemsPerPage(1)
42  {
43  }
44 };
45 
46 Metadata::Metadata()
47  : d(new Private)
48 {
49 }
50 
51 Metadata::~Metadata()
52 {
53 }
54 
55 Metadata::Metadata(const Attica::Metadata &other)
56  : d(other.d)
57 {
58 }
59 
60 Metadata &Metadata::operator=(const Attica::Metadata &other)
61 {
62  d = other.d;
63  return *this;
64 }
65 
66 Metadata::Error Metadata::error() const
67 {
68  return d->error;
69 }
70 
71 void Metadata::setError(Metadata::Error error)
72 {
73  d->error = error;
74 }
75 
77 {
78  return d->message;
79 }
80 
81 void Metadata::setMessage(const QString &message)
82 {
83  d->message = message;
84 }
85 
87 {
88  return d->resultingId;
89 }
90 
91 void Metadata::setResultingId(const QString &id)
92 {
93  d->resultingId = id;
94 }
95 
97 {
98  return d->statusCode;
99 }
100 
101 void Metadata::setStatusCode(int code)
102 {
103  d->statusCode = code;
104 }
105 
107 {
108  return d->statusString;
109 }
110 
111 void Metadata::setStatusString(const QString &status)
112 {
113  d->statusString = status;
114 }
115 
117 {
118  return d->totalItems;
119 }
120 
121 void Metadata::setTotalItems(int items)
122 {
123  d->totalItems = items;
124 }
125 
127 {
128  return d->itemsPerPage;
129 }
130 
131 void Metadata::setItemsPerPage(int itemsPerPage)
132 {
133  d->itemsPerPage = itemsPerPage;
134 }
135 
QString message()
An optional additional message from the server.
Definition: metadata.cpp:76
Error error() const
Check if the job was successful.
Definition: metadata.cpp:66
QString resultingId()
The resulting ID when a PostJob created a new item.
Definition: metadata.cpp:86
int totalItems()
The number of items returned by this job (only relevant for list jobs)
Definition: metadata.cpp:116
int statusCode() const
The status as integer.
Definition: metadata.cpp:96
Status messages from the server.
Definition: metadata.h:25
int itemsPerPage()
The number of items per page the server was asked for.
Definition: metadata.cpp:126
QString statusString() const
The status of the job, for example "Ok".
Definition: metadata.cpp:106
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.