8 namespace linuxdeploy {
9 namespace desktopfile {
10 class DesktopFileEntry {
12 // opaque data class pattern
15 std::shared_ptr<PrivateData> d;
18 // default constructor
21 // construct from key and value
22 explicit DesktopFileEntry(std::string key, std::string value);
25 DesktopFileEntry(const DesktopFileEntry& other);
27 // copy assignment constructor
28 DesktopFileEntry& operator=(const DesktopFileEntry& other);
30 // move assignment operator
31 DesktopFileEntry& operator=(DesktopFileEntry&& other) noexcept;
34 bool operator==(const DesktopFileEntry& other) const;
36 // inequality operator
37 bool operator!=(const DesktopFileEntry& other) const;
40 // checks whether a key and value have been set
44 const std::string& key() const;
46 // return entry's value
47 const std::string& value() const;
50 // convert value to integer
51 // throws BadLexicalCastError in case of type errors
52 int32_t asInt() const;
54 // convert value to long
55 // throws BadLexicalCastError in case of type errors
56 int64_t asLong() const;
58 // convert value to double
59 // throws BadLexicalCastError in case of type errors
60 double asDouble() const;
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;