summaryrefslogtreecommitdiff
path: root/hyprpm/src/core/Plugin.hpp
blob: a8c74084822bcd976574b1aceac66d5b5e7b14a6 (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
#pragma once

#include <string>
#include <vector>

struct SPlugin {
    std::string name;
    std::string filename;
    bool        enabled = false;
    bool        failed  = false;
};

struct SPluginRepository {
    std::string          url;
    std::string          rev;
    std::string          name;
    std::string          author;
    std::vector<SPlugin> plugins;
    std::string          hash;
};

enum ePluginRepoIdentifierType {
    IDENTIFIER_URL,
    IDENTIFIER_NAME,
    IDENTIFIER_AUTHOR_NAME
};

struct SPluginRepoIdentifier {
    ePluginRepoIdentifierType    type;
    std::string                  url    = "";
    std::string                  name   = "";
    std::string                  author = "";

    static SPluginRepoIdentifier fromString(const std::string& string);
    static SPluginRepoIdentifier fromUrl(const std::string& Url);
    static SPluginRepoIdentifier fromName(const std::string& name);
    static SPluginRepoIdentifier fromAuthorName(const std::string& author, const std::string& name);
    std::string                  toString() const;
    bool                         matches(const std::string& url, const std::string& name, const std::string& author) const;
};