kernel/qurlinfo.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtNetwork module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qurlinfo_p.h" -
43 -
44#ifndef QT_NO_FTP -
45 -
46#include "qurl.h" -
47#include "qdir.h" -
48#include <limits.h> -
49 -
50QT_BEGIN_NAMESPACE -
51 -
52class QUrlInfoPrivate -
53{ -
54public: -
55 QUrlInfoPrivate() : -
56 permissions(0), -
57 size(0), -
58 isDir(false), -
59 isFile(true), -
60 isSymLink(false), -
61 isWritable(true), -
62 isReadable(true), -
63 isExecutable(false) -
64 {}
never executed: }
0
65 -
66 QString name; -
67 int permissions; -
68 QString owner; -
69 QString group; -
70 qint64 size; -
71 -
72 QDateTime lastModified; -
73 QDateTime lastRead; -
74 bool isDir; -
75 bool isFile; -
76 bool isSymLink; -
77 bool isWritable; -
78 bool isReadable; -
79 bool isExecutable; -
80}; -
81 -
82 -
83/*! -
84 \class QUrlInfo -
85 \brief The QUrlInfo class stores information about URLs. -
86 -
87 \internal -
88 \ingroup io -
89 \ingroup network -
90 \inmodule QtNetwork -
91 -
92 The information about a URL that can be retrieved includes name(), -
93 permissions(), owner(), group(), size(), lastModified(), -
94 lastRead(), isDir(), isFile(), isSymLink(), isWritable(), -
95 isReadable() and isExecutable(). -
96 -
97 You can create your own QUrlInfo objects passing in all the -
98 relevant information in the constructor, and you can modify a -
99 QUrlInfo; for each getter mentioned above there is an equivalent -
100 setter. Note that setting values does not affect the underlying -
101 resource that the QUrlInfo provides information about; for example -
102 if you call setWritable(true) on a read-only resource the only -
103 thing changed is the QUrlInfo object, not the resource. -
104 -
105 \sa QUrl, {FTP Example} -
106*/ -
107 -
108/*! -
109 \enum QUrlInfo::PermissionSpec -
110 -
111 This enum is used by the permissions() function to report the -
112 permissions of a file. -
113 -
114 \value ReadOwner The file is readable by the owner of the file. -
115 \value WriteOwner The file is writable by the owner of the file. -
116 \value ExeOwner The file is executable by the owner of the file. -
117 \value ReadGroup The file is readable by the group. -
118 \value WriteGroup The file is writable by the group. -
119 \value ExeGroup The file is executable by the group. -
120 \value ReadOther The file is readable by anyone. -
121 \value WriteOther The file is writable by anyone. -
122 \value ExeOther The file is executable by anyone. -
123*/ -
124 -
125/*! -
126 Constructs an invalid QUrlInfo object with default values. -
127 -
128 \sa isValid() -
129*/ -
130 -
131QUrlInfo::QUrlInfo() -
132{ -
133 d = 0;
never executed (the execution status of this line is deduced): d = 0;
-
134}
never executed: }
0
135 -
136/*! -
137 Copy constructor, copies \a ui to this URL info object. -
138*/ -
139 -
140QUrlInfo::QUrlInfo(const QUrlInfo &ui) -
141{ -
142 if (ui.d) {
never evaluated: ui.d
0
143 d = new QUrlInfoPrivate;
never executed (the execution status of this line is deduced): d = new QUrlInfoPrivate;
-
144 *d = *ui.d;
never executed (the execution status of this line is deduced): *d = *ui.d;
-
145 } else {
never executed: }
0
146 d = 0;
never executed (the execution status of this line is deduced): d = 0;
-
147 }
never executed: }
0
148} -
149 -
150/*! -
151 Constructs a QUrlInfo object by specifying all the URL's -
152 information. -
153 -
154 The information that is passed is the \a name, file \a -
155 permissions, \a owner and \a group and the file's \a size. Also -
156 passed is the \a lastModified date/time and the \a lastRead -
157 date/time. Flags are also passed, specifically, \a isDir, \a -
158 isFile, \a isSymLink, \a isWritable, \a isReadable and \a -
159 isExecutable. -
160*/ -
161 -
162QUrlInfo::QUrlInfo(const QString &name, int permissions, const QString &owner, -
163 const QString &group, qint64 size, const QDateTime &lastModified, -
164 const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, -
165 bool isWritable, bool isReadable, bool isExecutable) -
166{ -
167 d = new QUrlInfoPrivate;
never executed (the execution status of this line is deduced): d = new QUrlInfoPrivate;
-
168 d->name = name;
never executed (the execution status of this line is deduced): d->name = name;
-
169 d->permissions = permissions;
never executed (the execution status of this line is deduced): d->permissions = permissions;
-
170 d->owner = owner;
never executed (the execution status of this line is deduced): d->owner = owner;
-
171 d->group = group;
never executed (the execution status of this line is deduced): d->group = group;
-
172 d->size = size;
never executed (the execution status of this line is deduced): d->size = size;
-
173 d->lastModified = lastModified;
never executed (the execution status of this line is deduced): d->lastModified = lastModified;
-
174 d->lastRead = lastRead;
never executed (the execution status of this line is deduced): d->lastRead = lastRead;
-
175 d->isDir = isDir;
never executed (the execution status of this line is deduced): d->isDir = isDir;
-
176 d->isFile = isFile;
never executed (the execution status of this line is deduced): d->isFile = isFile;
-
177 d->isSymLink = isSymLink;
never executed (the execution status of this line is deduced): d->isSymLink = isSymLink;
-
178 d->isWritable = isWritable;
never executed (the execution status of this line is deduced): d->isWritable = isWritable;
-
179 d->isReadable = isReadable;
never executed (the execution status of this line is deduced): d->isReadable = isReadable;
-
180 d->isExecutable = isExecutable;
never executed (the execution status of this line is deduced): d->isExecutable = isExecutable;
-
181}
never executed: }
0
182 -
183 -
184/*! -
185 Constructs a QUrlInfo object by specifying all the URL's -
186 information. -
187 -
188 The information that is passed is the \a url, file \a -
189 permissions, \a owner and \a group and the file's \a size. Also -
190 passed is the \a lastModified date/time and the \a lastRead -
191 date/time. Flags are also passed, specifically, \a isDir, \a -
192 isFile, \a isSymLink, \a isWritable, \a isReadable and \a -
193 isExecutable. -
194*/ -
195 -
196QUrlInfo::QUrlInfo(const QUrl &url, int permissions, const QString &owner, -
197 const QString &group, qint64 size, const QDateTime &lastModified, -
198 const QDateTime &lastRead, bool isDir, bool isFile, bool isSymLink, -
199 bool isWritable, bool isReadable, bool isExecutable) -
200{ -
201 d = new QUrlInfoPrivate;
never executed (the execution status of this line is deduced): d = new QUrlInfoPrivate;
-
202 d->name = QFileInfo(url.path()).fileName();
never executed (the execution status of this line is deduced): d->name = QFileInfo(url.path()).fileName();
-
203 d->permissions = permissions;
never executed (the execution status of this line is deduced): d->permissions = permissions;
-
204 d->owner = owner;
never executed (the execution status of this line is deduced): d->owner = owner;
-
205 d->group = group;
never executed (the execution status of this line is deduced): d->group = group;
-
206 d->size = size;
never executed (the execution status of this line is deduced): d->size = size;
-
207 d->lastModified = lastModified;
never executed (the execution status of this line is deduced): d->lastModified = lastModified;
-
208 d->lastRead = lastRead;
never executed (the execution status of this line is deduced): d->lastRead = lastRead;
-
209 d->isDir = isDir;
never executed (the execution status of this line is deduced): d->isDir = isDir;
-
210 d->isFile = isFile;
never executed (the execution status of this line is deduced): d->isFile = isFile;
-
211 d->isSymLink = isSymLink;
never executed (the execution status of this line is deduced): d->isSymLink = isSymLink;
-
212 d->isWritable = isWritable;
never executed (the execution status of this line is deduced): d->isWritable = isWritable;
-
213 d->isReadable = isReadable;
never executed (the execution status of this line is deduced): d->isReadable = isReadable;
-
214 d->isExecutable = isExecutable;
never executed (the execution status of this line is deduced): d->isExecutable = isExecutable;
-
215}
never executed: }
0
216 -
217 -
218/*! -
219 Sets the name of the URL to \a name. The name is the full text, -
220 for example, "http://qt-project.org/doc/qt-5.0/qtcore/qurl.html". -
221 -
222 If you call this function for an invalid URL info, this function -
223 turns it into a valid one. -
224 -
225 \sa isValid() -
226*/ -
227 -
228void QUrlInfo::setName(const QString &name) -
229{ -
230 if (!d)
never evaluated: !d
0
231 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
232 d->name = name;
never executed (the execution status of this line is deduced): d->name = name;
-
233}
never executed: }
0
234 -
235 -
236/*! -
237 If \a b is true then the URL is set to be a directory; if \a b is -
238 false then the URL is set not to be a directory (which normally -
239 means it is a file). (Note that a URL can refer to both a file and -
240 a directory even though most file systems do not support this.) -
241 -
242 If you call this function for an invalid URL info, this function -
243 turns it into a valid one. -
244 -
245 \sa isValid() -
246*/ -
247 -
248void QUrlInfo::setDir(bool b) -
249{ -
250 if (!d)
never evaluated: !d
0
251 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
252 d->isDir = b;
never executed (the execution status of this line is deduced): d->isDir = b;
-
253}
never executed: }
0
254 -
255 -
256/*! -
257 If \a b is true then the URL is set to be a file; if \b is false -
258 then the URL is set not to be a file (which normally means it is a -
259 directory). (Note that a URL can refer to both a file and a -
260 directory even though most file systems do not support this.) -
261 -
262 If you call this function for an invalid URL info, this function -
263 turns it into a valid one. -
264 -
265 \sa isValid() -
266*/ -
267 -
268void QUrlInfo::setFile(bool b) -
269{ -
270 if (!d)
never evaluated: !d
0
271 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
272 d->isFile = b;
never executed (the execution status of this line is deduced): d->isFile = b;
-
273}
never executed: }
0
274 -
275 -
276/*! -
277 Specifies that the URL refers to a symbolic link if \a b is true -
278 and that it does not if \a b is false. -
279 -
280 If you call this function for an invalid URL info, this function -
281 turns it into a valid one. -
282 -
283 \sa isValid() -
284*/ -
285 -
286void QUrlInfo::setSymLink(bool b) -
287{ -
288 if (!d)
never evaluated: !d
0
289 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
290 d->isSymLink = b;
never executed (the execution status of this line is deduced): d->isSymLink = b;
-
291}
never executed: }
0
292 -
293 -
294/*! -
295 Specifies that the URL is writable if \a b is true and not -
296 writable if \a b is false. -
297 -
298 If you call this function for an invalid URL info, this function -
299 turns it into a valid one. -
300 -
301 \sa isValid() -
302*/ -
303 -
304void QUrlInfo::setWritable(bool b) -
305{ -
306 if (!d)
never evaluated: !d
0
307 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
308 d->isWritable = b;
never executed (the execution status of this line is deduced): d->isWritable = b;
-
309}
never executed: }
0
310 -
311 -
312/*! -
313 Specifies that the URL is readable if \a b is true and not -
314 readable if \a b is false. -
315 -
316 If you call this function for an invalid URL info, this function -
317 turns it into a valid one. -
318 -
319 \sa isValid() -
320*/ -
321 -
322void QUrlInfo::setReadable(bool b) -
323{ -
324 if (!d)
never evaluated: !d
0
325 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
326 d->isReadable = b;
never executed (the execution status of this line is deduced): d->isReadable = b;
-
327}
never executed: }
0
328 -
329/*! -
330 Specifies that the owner of the URL is called \a s. -
331 -
332 If you call this function for an invalid URL info, this function -
333 turns it into a valid one. -
334 -
335 \sa isValid() -
336*/ -
337 -
338void QUrlInfo::setOwner(const QString &s) -
339{ -
340 if (!d)
never evaluated: !d
0
341 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
342 d->owner = s;
never executed (the execution status of this line is deduced): d->owner = s;
-
343}
never executed: }
0
344 -
345/*! -
346 Specifies that the owning group of the URL is called \a s. -
347 -
348 If you call this function for an invalid URL info, this function -
349 turns it into a valid one. -
350 -
351 \sa isValid() -
352*/ -
353 -
354void QUrlInfo::setGroup(const QString &s) -
355{ -
356 if (!d)
never evaluated: !d
0
357 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
358 d->group = s;
never executed (the execution status of this line is deduced): d->group = s;
-
359}
never executed: }
0
360 -
361/*! -
362 Specifies the \a size of the URL. -
363 -
364 If you call this function for an invalid URL info, this function -
365 turns it into a valid one. -
366 -
367 \sa isValid() -
368*/ -
369 -
370void QUrlInfo::setSize(qint64 size) -
371{ -
372 if (!d)
never evaluated: !d
0
373 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
374 d->size = size;
never executed (the execution status of this line is deduced): d->size = size;
-
375}
never executed: }
0
376 -
377/*! -
378 Specifies that the URL has access permissions \a p. -
379 -
380 If you call this function for an invalid URL info, this function -
381 turns it into a valid one. -
382 -
383 \sa isValid() -
384*/ -
385 -
386void QUrlInfo::setPermissions(int p) -
387{ -
388 if (!d)
never evaluated: !d
0
389 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
390 d->permissions = p;
never executed (the execution status of this line is deduced): d->permissions = p;
-
391}
never executed: }
0
392 -
393/*! -
394 Specifies that the object the URL refers to was last modified at -
395 \a dt. -
396 -
397 If you call this function for an invalid URL info, this function -
398 turns it into a valid one. -
399 -
400 \sa isValid() -
401*/ -
402 -
403void QUrlInfo::setLastModified(const QDateTime &dt) -
404{ -
405 if (!d)
never evaluated: !d
0
406 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
407 d->lastModified = dt;
never executed (the execution status of this line is deduced): d->lastModified = dt;
-
408}
never executed: }
0
409 -
410/*! -
411 \since 4.4 -
412 -
413 Specifies that the object the URL refers to was last read at -
414 \a dt. -
415 -
416 If you call this function for an invalid URL info, this function -
417 turns it into a valid one. -
418 -
419 \sa isValid() -
420*/ -
421 -
422void QUrlInfo::setLastRead(const QDateTime &dt) -
423{ -
424 if (!d)
never evaluated: !d
0
425 d = new QUrlInfoPrivate;
never executed: d = new QUrlInfoPrivate;
0
426 d->lastRead = dt;
never executed (the execution status of this line is deduced): d->lastRead = dt;
-
427}
never executed: }
0
428 -
429/*! -
430 Destroys the URL info object. -
431*/ -
432 -
433QUrlInfo::~QUrlInfo() -
434{ -
435 delete d;
never executed (the execution status of this line is deduced): delete d;
-
436}
never executed: }
0
437 -
438/*! -
439 Assigns the values of \a ui to this QUrlInfo object. -
440*/ -
441 -
442QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui) -
443{ -
444 if (ui.d) {
never evaluated: ui.d
0
445 if (!d)
never evaluated: !d
0
446 d= new QUrlInfoPrivate;
never executed: d= new QUrlInfoPrivate;
0
447 *d = *ui.d;
never executed (the execution status of this line is deduced): *d = *ui.d;
-
448 } else {
never executed: }
0
449 delete d;
never executed (the execution status of this line is deduced): delete d;
-
450 d = 0;
never executed (the execution status of this line is deduced): d = 0;
-
451 }
never executed: }
0
452 return *this;
never executed: return *this;
0
453} -
454 -
455/*! -
456 Returns the file name of the URL. -
457 -
458 \sa isValid() -
459*/ -
460 -
461QString QUrlInfo::name() const -
462{ -
463 if (!d)
never evaluated: !d
0
464 return QString();
never executed: return QString();
0
465 return d->name;
never executed: return d->name;
0
466} -
467 -
468/*! -
469 Returns the permissions of the URL. You can use the \c PermissionSpec flags -
470 to test for certain permissions. -
471 -
472 \sa isValid() -
473*/ -
474 -
475int QUrlInfo::permissions() const -
476{ -
477 if (!d)
never evaluated: !d
0
478 return 0;
never executed: return 0;
0
479 return d->permissions;
never executed: return d->permissions;
0
480} -
481 -
482/*! -
483 Returns the owner of the URL. -
484 -
485 \sa isValid() -
486*/ -
487 -
488QString QUrlInfo::owner() const -
489{ -
490 if (!d)
never evaluated: !d
0
491 return QString();
never executed: return QString();
0
492 return d->owner;
never executed: return d->owner;
0
493} -
494 -
495/*! -
496 Returns the group of the URL. -
497 -
498 \sa isValid() -
499*/ -
500 -
501QString QUrlInfo::group() const -
502{ -
503 if (!d)
never evaluated: !d
0
504 return QString();
never executed: return QString();
0
505 return d->group;
never executed: return d->group;
0
506} -
507 -
508/*! -
509 Returns the size of the URL. -
510 -
511 \sa isValid() -
512*/ -
513 -
514qint64 QUrlInfo::size() const -
515{ -
516 if (!d)
never evaluated: !d
0
517 return 0;
never executed: return 0;
0
518 return d->size;
never executed: return d->size;
0
519} -
520 -
521/*! -
522 Returns the last modification date of the URL. -
523 -
524 \sa isValid() -
525*/ -
526 -
527QDateTime QUrlInfo::lastModified() const -
528{ -
529 if (!d)
never evaluated: !d
0
530 return QDateTime();
never executed: return QDateTime();
0
531 return d->lastModified;
never executed: return d->lastModified;
0
532} -
533 -
534/*! -
535 Returns the date when the URL was last read. -
536 -
537 \sa isValid() -
538*/ -
539 -
540QDateTime QUrlInfo::lastRead() const -
541{ -
542 if (!d)
never evaluated: !d
0
543 return QDateTime();
never executed: return QDateTime();
0
544 return d->lastRead;
never executed: return d->lastRead;
0
545} -
546 -
547/*! -
548 Returns true if the URL is a directory; otherwise returns false. -
549 -
550 \sa isValid() -
551*/ -
552 -
553bool QUrlInfo::isDir() const -
554{ -
555 if (!d)
never evaluated: !d
0
556 return false;
never executed: return false;
0
557 return d->isDir;
never executed: return d->isDir;
0
558} -
559 -
560/*! -
561 Returns true if the URL is a file; otherwise returns false. -
562 -
563 \sa isValid() -
564*/ -
565 -
566bool QUrlInfo::isFile() const -
567{ -
568 if (!d)
never evaluated: !d
0
569 return false;
never executed: return false;
0
570 return d->isFile;
never executed: return d->isFile;
0
571} -
572 -
573/*! -
574 Returns true if the URL is a symbolic link; otherwise returns false. -
575 -
576 \sa isValid() -
577*/ -
578 -
579bool QUrlInfo::isSymLink() const -
580{ -
581 if (!d)
never evaluated: !d
0
582 return false;
never executed: return false;
0
583 return d->isSymLink;
never executed: return d->isSymLink;
0
584} -
585 -
586/*! -
587 Returns true if the URL is writable; otherwise returns false. -
588 -
589 \sa isValid() -
590*/ -
591 -
592bool QUrlInfo::isWritable() const -
593{ -
594 if (!d)
never evaluated: !d
0
595 return false;
never executed: return false;
0
596 return d->isWritable;
never executed: return d->isWritable;
0
597} -
598 -
599/*! -
600 Returns true if the URL is readable; otherwise returns false. -
601 -
602 \sa isValid() -
603*/ -
604 -
605bool QUrlInfo::isReadable() const -
606{ -
607 if (!d)
never evaluated: !d
0
608 return false;
never executed: return false;
0
609 return d->isReadable;
never executed: return d->isReadable;
0
610} -
611 -
612/*! -
613 Returns true if the URL is executable; otherwise returns false. -
614 -
615 \sa isValid() -
616*/ -
617 -
618bool QUrlInfo::isExecutable() const -
619{ -
620 if (!d)
never evaluated: !d
0
621 return false;
never executed: return false;
0
622 return d->isExecutable;
never executed: return d->isExecutable;
0
623} -
624 -
625/*! -
626 Returns true if \a i1 is greater than \a i2; otherwise returns -
627 false. The objects are compared by the value, which is specified -
628 by \a sortBy. This must be one of QDir::Name, QDir::Time or -
629 QDir::Size. -
630*/ -
631 -
632bool QUrlInfo::greaterThan(const QUrlInfo &i1, const QUrlInfo &i2, -
633 int sortBy) -
634{ -
635 switch (sortBy) { -
636 case QDir::Name: -
637 return i1.name() > i2.name();
never executed: return i1.name() > i2.name();
0
638 case QDir::Time: -
639 return i1.lastModified() > i2.lastModified();
never executed: return i1.lastModified() > i2.lastModified();
0
640 case QDir::Size: -
641 return i1.size() > i2.size();
never executed: return i1.size() > i2.size();
0
642 default: -
643 return false;
never executed: return false;
0
644 } -
645}
never executed: }
0
646 -
647/*! -
648 Returns true if \a i1 is less than \a i2; otherwise returns false. -
649 The objects are compared by the value, which is specified by \a -
650 sortBy. This must be one of QDir::Name, QDir::Time or QDir::Size. -
651*/ -
652 -
653bool QUrlInfo::lessThan(const QUrlInfo &i1, const QUrlInfo &i2, -
654 int sortBy) -
655{ -
656 return !greaterThan(i1, i2, sortBy);
never executed: return !greaterThan(i1, i2, sortBy);
0
657} -
658 -
659/*! -
660 Returns true if \a i1 equals to \a i2; otherwise returns false. -
661 The objects are compared by the value, which is specified by \a -
662 sortBy. This must be one of QDir::Name, QDir::Time or QDir::Size. -
663*/ -
664 -
665bool QUrlInfo::equal(const QUrlInfo &i1, const QUrlInfo &i2, -
666 int sortBy) -
667{ -
668 switch (sortBy) { -
669 case QDir::Name: -
670 return i1.name() == i2.name();
never executed: return i1.name() == i2.name();
0
671 case QDir::Time: -
672 return i1.lastModified() == i2.lastModified();
never executed: return i1.lastModified() == i2.lastModified();
0
673 case QDir::Size: -
674 return i1.size() == i2.size();
never executed: return i1.size() == i2.size();
0
675 default: -
676 return false;
never executed: return false;
0
677 } -
678}
never executed: }
0
679 -
680/*! -
681 Returns true if this QUrlInfo is equal to \a other; otherwise -
682 returns false. -
683 -
684 \sa lessThan(), equal() -
685*/ -
686 -
687bool QUrlInfo::operator==(const QUrlInfo &other) const -
688{ -
689 if (!d)
never evaluated: !d
0
690 return other.d == 0;
never executed: return other.d == 0;
0
691 if (!other.d)
never evaluated: !other.d
0
692 return false;
never executed: return false;
0
693 -
694 return (d->name == other.d->name &&
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
695 d->permissions == other.d->permissions &&
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
696 d->owner == other.d->owner &&
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
697 d->group == other.d->group &&
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
698 d->size == other.d->size &&
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
699 d->lastModified == other.d->lastModified &&
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
700 d->lastRead == other.d->lastRead &&
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
701 d->isDir == other.d->isDir &&
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
702 d->isFile == other.d->isFile &&
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
703 d->isSymLink == other.d->isSymLink &&
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
704 d->isWritable == other.d->isWritable &&
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
705 d->isReadable == other.d->isReadable &&
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
706 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
707} -
708 -
709/*! -
710 \fn bool QUrlInfo::operator!=(const QUrlInfo &other) const -
711 \since 4.2 -
712 -
713 Returns true if this QUrlInfo is not equal to \a other; otherwise -
714 returns false. -
715 -
716 \sa lessThan(), equal() -
717*/ -
718 -
719/*! -
720 Returns true if the URL info is valid; otherwise returns false. -
721 Valid means that the QUrlInfo contains real information. -
722 -
723 You should always check if the URL info is valid before relying on -
724 the values. -
725*/ -
726bool QUrlInfo::isValid() const -
727{ -
728 return d != 0;
never executed: return d != 0;
0
729} -
730 -
731QT_END_NAMESPACE -
732 -
733#endif // QT_NO_FTP -
734 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial