kernel/qurlinfo.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7class QUrlInfoPrivate -
8{ -
9public: -
10 QUrlInfoPrivate() : -
11 permissions(0), -
12 size(0), -
13 isDir(false), -
14 isFile(true), -
15 isSymLink(false), -
16 isWritable(true), -
17 isReadable(true), -
18 isExecutable(false) -
19 {}
never executed: }
0
20 -
21 QString name; -
22 int permissions; -
23 QString owner; -
24 QString group; -
25 qint64 size; -
26 -
27 QDateTime lastModified; -
28 QDateTime lastRead; -
29 bool isDir; -
30 bool isFile; -
31 bool isSymLink; -
32 bool isWritable; -
33 bool isReadable; -
34 bool isExecutable; -
35}; -
36QUrlInfo::QUrlInfo() -
37{ -
38 d = 0; -
39}
never executed: }
0
40 -
41 -
42 -
43 -
44 -
45QUrlInfo::QUrlInfo(const QUrlInfo &ui) -
46{ -
47 if (ui.d) {
never evaluated: ui.d
0
48 d = new QUrlInfoPrivate; -
49 *d = *ui.d; -
50 } else {
never executed: }
0
51 d = 0; -
52 }
never executed: }
0
53} -
54QUrlInfo::QUrlInfo(const QString &name, int permissions, const QString &owner, -
55 const QString &group, qint64 size, const QDateTime &lastModified, -
56 const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, -
57 bool isWritable, bool isReadable, bool isExecutable) -
58{ -
59 d = new QUrlInfoPrivate; -
60 d->name = name; -
61 d->permissions = permissions; -
62 d->owner = owner; -
63 d->group = group; -
64 d->size = size; -
65 d->lastModified = lastModified; -
66 d->lastRead = lastRead; -
67 d->isDir = isDir; -
68 d->isFile = isFile; -
69 d->isSymLink = isSymLink; -
70 d->isWritable = isWritable; -
71 d->isReadable = isReadable; -
72 d->isExecutable = isExecutable; -
73}
never executed: }
0
74QUrlInfo::QUrlInfo(const QUrl &url, int permissions, const QString &owner, -
75 const QString &group, qint64 size, const QDateTime &lastModified, -
76 const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, -
77 bool isWritable, bool isReadable, bool isExecutable) -
78{ -
79 d = new QUrlInfoPrivate; -
80 d->name = QFileInfo(url.path()).fileName(); -
81 d->permissions = permissions; -
82 d->owner = owner; -
83 d->group = group; -
84 d->size = size; -
85 d->lastModified = lastModified; -
86 d->lastRead = lastRead; -
87 d->isDir = isDir; -
88 d->isFile = isFile; -
89 d->isSymLink = isSymLink; -
90 d->isWritable = isWritable; -
91 d->isReadable = isReadable; -
92 d->isExecutable = isExecutable; -
93}
never executed: }
0
94void QUrlInfo::setName(const QString &name) -
95{ -
96 if (!d)
never evaluated: !d
0
97 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
98 d->name = name; -
99}
never executed: }
0
100void QUrlInfo::setDir(bool b) -
101{ -
102 if (!d)
never evaluated: !d
0
103 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
104 d->isDir = b; -
105}
never executed: }
0
106void QUrlInfo::setFile(bool b) -
107{ -
108 if (!d)
never evaluated: !d
0
109 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
110 d->isFile = b; -
111}
never executed: }
0
112void QUrlInfo::setSymLink(bool b) -
113{ -
114 if (!d)
never evaluated: !d
0
115 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
116 d->isSymLink = b; -
117}
never executed: }
0
118void QUrlInfo::setWritable(bool b) -
119{ -
120 if (!d)
never evaluated: !d
0
121 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
122 d->isWritable = b; -
123}
never executed: }
0
124void QUrlInfo::setReadable(bool b) -
125{ -
126 if (!d)
never evaluated: !d
0
127 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
128 d->isReadable = b; -
129}
never executed: }
0
130void QUrlInfo::setOwner(const QString &s) -
131{ -
132 if (!d)
never evaluated: !d
0
133 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
134 d->owner = s; -
135}
never executed: }
0
136void QUrlInfo::setGroup(const QString &s) -
137{ -
138 if (!d)
never evaluated: !d
0
139 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
140 d->group = s; -
141}
never executed: }
0
142void QUrlInfo::setSize(qint64 size) -
143{ -
144 if (!d)
never evaluated: !d
0
145 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
146 d->size = size; -
147}
never executed: }
0
148void QUrlInfo::setPermissions(int p) -
149{ -
150 if (!d)
never evaluated: !d
0
151 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
152 d->permissions = p; -
153}
never executed: }
0
154void QUrlInfo::setLastModified(const QDateTime &dt) -
155{ -
156 if (!d)
never evaluated: !d
0
157 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
158 d->lastModified = dt; -
159}
never executed: }
0
160void QUrlInfo::setLastRead(const QDateTime &dt) -
161{ -
162 if (!d)
never evaluated: !d
0
163 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
164 d->lastRead = dt; -
165}
never executed: }
0
166 -
167 -
168 -
169 -
170 -
171QUrlInfo::~QUrlInfo() -
172{ -
173 delete d; -
174}
never executed: }
0
175 -
176 -
177 -
178 -
179 -
180QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui) -
181{ -
182 if (ui.d) {
never evaluated: ui.d
0
183 if (!d)
never evaluated: !d
0
184 d= new QUrlInfoPrivate;
never executed: d= new QUrlInfoPrivate;
0
185 *d = *ui.d; -
186 } else {
never executed: }
0
187 delete d; -
188 d = 0; -
189 }
never executed: }
0
190 return *this;
never executed: return *this;
0
191} -
192 -
193 -
194 -
195 -
196 -
197 -
198 -
199QString QUrlInfo::name() const -
200{ -
201 if (!d)
never evaluated: !d
0
202 return QString();
never executed: return QString();
0
203 return d->name;
never executed: return d->name;
0
204} -
205int QUrlInfo::permissions() const -
206{ -
207 if (!d)
never evaluated: !d
0
208 return 0;
never executed: return 0;
0
209 return d->permissions;
never executed: return d->permissions;
0
210} -
211 -
212 -
213 -
214 -
215 -
216 -
217 -
218QString QUrlInfo::owner() const -
219{ -
220 if (!d)
never evaluated: !d
0
221 return QString();
never executed: return QString();
0
222 return d->owner;
never executed: return d->owner;
0
223} -
224 -
225 -
226 -
227 -
228 -
229 -
230 -
231QString QUrlInfo::group() const -
232{ -
233 if (!d)
never evaluated: !d
0
234 return QString();
never executed: return QString();
0
235 return d->group;
never executed: return d->group;
0
236} -
237 -
238 -
239 -
240 -
241 -
242 -
243 -
244qint64 QUrlInfo::size() const -
245{ -
246 if (!d)
never evaluated: !d
0
247 return 0;
never executed: return 0;
0
248 return d->size;
never executed: return d->size;
0
249} -
250 -
251 -
252 -
253 -
254 -
255 -
256 -
257QDateTime QUrlInfo::lastModified() const -
258{ -
259 if (!d)
never evaluated: !d
0
260 return QDateTime();
never executed: return QDateTime();
0
261 return d->lastModified;
never executed: return d->lastModified;
0
262} -
263 -
264 -
265 -
266 -
267 -
268 -
269 -
270QDateTime QUrlInfo::lastRead() const -
271{ -
272 if (!d)
never evaluated: !d
0
273 return QDateTime();
never executed: return QDateTime();
0
274 return d->lastRead;
never executed: return d->lastRead;
0
275} -
276 -
277 -
278 -
279 -
280 -
281 -
282 -
283bool QUrlInfo::isDir() const -
284{ -
285 if (!d)
never evaluated: !d
0
286 return false;
never executed: return false;
0
287 return d->isDir;
never executed: return d->isDir;
0
288} -
289 -
290 -
291 -
292 -
293 -
294 -
295 -
296bool QUrlInfo::isFile() const -
297{ -
298 if (!d)
never evaluated: !d
0
299 return false;
never executed: return false;
0
300 return d->isFile;
never executed: return d->isFile;
0
301} -
302 -
303 -
304 -
305 -
306 -
307 -
308 -
309bool QUrlInfo::isSymLink() const -
310{ -
311 if (!d)
never evaluated: !d
0
312 return false;
never executed: return false;
0
313 return d->isSymLink;
never executed: return d->isSymLink;
0
314} -
315 -
316 -
317 -
318 -
319 -
320 -
321 -
322bool QUrlInfo::isWritable() const -
323{ -
324 if (!d)
never evaluated: !d
0
325 return false;
never executed: return false;
0
326 return d->isWritable;
never executed: return d->isWritable;
0
327} -
328 -
329 -
330 -
331 -
332 -
333 -
334 -
335bool QUrlInfo::isReadable() const -
336{ -
337 if (!d)
never evaluated: !d
0
338 return false;
never executed: return false;
0
339 return d->isReadable;
never executed: return d->isReadable;
0
340} -
341 -
342 -
343 -
344 -
345 -
346 -
347 -
348bool QUrlInfo::isExecutable() const -
349{ -
350 if (!d)
never evaluated: !d
0
351 return false;
never executed: return false;
0
352 return d->isExecutable;
never executed: return d->isExecutable;
0
353} -
354bool QUrlInfo::greaterThan(const QUrlInfo &i1, const QUrlInfo &i2, -
355 int sortBy) -
356{ -
357 switch (sortBy) { -
358 case QDir::Name: -
359 return i1.name() > i2.name();
never executed: return i1.name() > i2.name();
0
360 case QDir::Time: -
361 return i1.lastModified() > i2.lastModified();
never executed: return i1.lastModified() > i2.lastModified();
0
362 case QDir::Size: -
363 return i1.size() > i2.size();
never executed: return i1.size() > i2.size();
0
364 default: -
365 return false;
never executed: return false;
0
366 } -
367}
never executed: }
0
368 -
369 -
370 -
371 -
372 -
373 -
374 -
375bool QUrlInfo::lessThan(const QUrlInfo &i1, const QUrlInfo &i2, -
376 int sortBy) -
377{ -
378 return !greaterThan(i1, i2, sortBy);
never executed: return !greaterThan(i1, i2, sortBy);
0
379} -
380 -
381 -
382 -
383 -
384 -
385 -
386 -
387bool QUrlInfo::equal(const QUrlInfo &i1, const QUrlInfo &i2, -
388 int sortBy) -
389{ -
390 switch (sortBy) { -
391 case QDir::Name: -
392 return i1.name() == i2.name();
never executed: return i1.name() == i2.name();
0
393 case QDir::Time: -
394 return i1.lastModified() == i2.lastModified();
never executed: return i1.lastModified() == i2.lastModified();
0
395 case QDir::Size: -
396 return i1.size() == i2.size();
never executed: return i1.size() == i2.size();
0
397 default: -
398 return false;
never executed: return false;
0
399 } -
400}
never executed: }
0
401bool QUrlInfo::operator==(const QUrlInfo &other) const -
402{ -
403 if (!d)
never evaluated: !d
0
404 return other.d == 0;
never executed: return other.d == 0;
0
405 if (!other.d)
never evaluated: !other.d
0
406 return false;
never executed: return false;
0
407 -
408 return (d->name == other.d->name && 0
409 d->permissions == other.d->permissions && 0
410 d->owner == other.d->owner && 0
411 d->group == other.d->group && 0
412 d->size == other.d->size && 0
413 d->lastModified == other.d->lastModified && 0
414 d->lastRead == other.d->lastRead && 0
415 d->isDir == other.d->isDir && 0
416 d->isFile == other.d->isFile && 0
417 d->isSymLink == other.d->isSymLink && 0
418 d->isWritable == other.d->isWritable && 0
419 d->isReadable == other.d->isReadable && 0
420 d->isExecutable == other.d->isExecutable);
never executed: return (d->name == other.d->name && d->permissions == other.d->permissions && d->owner == other.d->owner && d->group == other.d->group && d->size == other.d->size && d->lastModified == other.d->lastModified && d->lastRead == other.d->lastRead && d->isDir == other.d->isDir && d->isFile == other.d->isFile && d->isSymLink == other.d->isSymLink && d->isWritable == other.d->isWritable && d->isReadable == other.d->isReadable && d->isExecutable == other.d->isExecutable);
0
421} -
422bool QUrlInfo::isValid() const -
423{ -
424 return d != 0;
never executed: return d != 0;
0
425} -
426 -
427 -
428 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial