digiKam
trackreader.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2006-09-19
7  * Description : Track file reader
8  *
9  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010-2014 by Michael G. Hansen <mike at mghansen dot de>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_TRACK_READER_H
26 #define DIGIKAM_TRACK_READER_H
27 
28 // Qt includes
29 
30 #include <QXmlDefaultHandler>
31 
32 // local includes
33 
34 #include "trackmanager.h"
35 #include "digikam_export.h"
36 
37 class TestTracks;
38 
39 namespace Digikam
40 {
41 
42 class DIGIKAM_EXPORT TrackReader : public QXmlDefaultHandler
43 {
44 public:
45 
47  {
48  public:
49 
50  explicit TrackReadResult()
51  : track (),
52  isValid (false),
53  loadError()
54  {
55  }
56 
58  bool isValid;
59  QString loadError;
60 
62  };
63 
64 public:
65 
66  explicit TrackReader(TrackReadResult* const dataTarget);
67  ~TrackReader() override;
68 
69  bool characters(const QString& ch) override;
70 
71  bool endElement(const QString& namespaceURI,
72  const QString& localName,
73  const QString& qName) override;
74 
75  bool startElement(const QString& namespaceURI,
76  const QString& localName,
77  const QString& qName,
78  const QXmlAttributes& atts) override;
79 
80  static TrackReadResult loadTrackFile(const QUrl& url);
81  static QDateTime ParseTime(const QString& tstring);
82 
83 private:
84 
85  void rebuildElementPath();
86 
87  static QString myQName(const QString& namespaceURI, const QString& localName);
88 
89 private:
90 
91  class Private;
92  const QScopedPointer<Private> d;
93 
94  friend class ::TestTracks;
95 };
96 
97 } // namespace Digikam
98 
99 #endif // DIGIKAM_TRACK_READER_H
Definition: trackmanager.h:100
Definition: trackreader.h:47
bool isValid
Definition: trackreader.h:58
QList< TrackReadResult > List
Definition: trackreader.h:61
QString loadError
Definition: trackreader.h:59
TrackReadResult()
Definition: trackreader.h:50
TrackManager::Track track
Definition: trackreader.h:57
Definition: trackreader.h:43
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43