summaryrefslogtreecommitdiff
path: root/daemon/bundle.h
blob: cb47cbf96011f1780cbd6e982cc67d6cac5aab5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef BUNDLE_H
#define BUNDLE_H

#include <QLoggingCategory>
#include <QSharedDataPointer>
#include <QString>
#include <QIODevice>

class BundleData;

class Bundle
{
    Q_GADGET

    static QLoggingCategory l;

public:
    enum File {
        MANIFEST,
        INFO,
        FIRMWARE,
        APPLICATION,
        WORKER,
        RESOURCES,
        APPJS
    };

    static Bundle fromPath(const QString &path);

    Bundle();
    Bundle(const Bundle &);
    Bundle &operator=(const Bundle &);
    ~Bundle();

    QString type() const;
    QString path() const;
    bool isValid() const;

    QIODevice *openFile(enum File, QIODevice::OpenMode = 0) const;
    bool fileExists(enum File) const;
    quint32 crcFile(enum File) const;

private:
    QSharedDataPointer<BundleData> b;
};

#endif // BUNDLE_H