MatN work for versatile appimage creation for all types of os
[goodguy/cinelerra.git] / cinelerra-5.1 / tools / makeappimagetool / includes / desktopfileentry.h
1 #pragma once
2
3 // system headers
4 #include <memory>
5 #include <string>
6 #include <vector>
7
8 namespace linuxdeploy {
9     namespace desktopfile {
10         class DesktopFileEntry {
11         private:
12             // opaque data class pattern
13             class PrivateData;
14
15             std::shared_ptr<PrivateData> d;
16
17         public:
18             // default constructor
19             DesktopFileEntry();
20
21             // construct from key and value
22             explicit DesktopFileEntry(std::string key, std::string value);
23
24             // copy constructor
25             DesktopFileEntry(const DesktopFileEntry& other);
26
27             // copy assignment constructor
28             DesktopFileEntry& operator=(const DesktopFileEntry& other);
29
30             // move assignment operator
31             DesktopFileEntry& operator=(DesktopFileEntry&& other) noexcept;
32
33             // equality operator
34             bool operator==(const DesktopFileEntry& other) const;
35
36             // inequality operator
37             bool operator!=(const DesktopFileEntry& other) const;
38
39         public:
40             // checks whether a key and value have been set
41             bool isEmpty() const;
42
43             // return entry's key
44             const std::string& key() const;
45
46             // return entry's value
47             const std::string& value() const;
48
49         public:
50             // convert value to integer
51             // throws BadLexicalCastError in case of type errors
52             int32_t asInt() const;
53
54             // convert value to long
55             // throws BadLexicalCastError in case of type errors
56             int64_t asLong() const;
57
58             // convert value to double
59             // throws BadLexicalCastError in case of type errors
60             double asDouble() const;
61
62             // split CSV list value into vector
63             // the separator used to split the string is a semicolon as per desktop file spec
64             std::vector<std::string> parseStringList() const;
65         };
66     }
67 }