8 #include "desktopfile.h"
9 #include "desktopfileentry.h"
11 namespace linuxdeploy {
12 namespace desktopfile {
13 class DesktopFileReader {
15 // opaque data class pattern
18 std::shared_ptr<PrivateData> d;
21 // default constructor
24 // construct from path
25 explicit DesktopFileReader(std::string path);
27 // construct from existing istream
28 explicit DesktopFileReader(std::istream& is);
31 DesktopFileReader(const DesktopFileReader& other);
33 // copy assignment constructor
34 DesktopFileReader& operator=(const DesktopFileReader& other);
36 // move assignment operator
37 DesktopFileReader& operator=(DesktopFileReader&& other) noexcept;
40 bool operator==(const DesktopFileReader& other) const;
42 // inequality operator
43 bool operator!=(const DesktopFileReader& other) const;
46 // checks whether parsed data is available
49 // returns desktop file path
50 std::string path() const;
52 // get a specific section from the parsed data
53 // throws std::range_error if section does not exist
54 DesktopFile::section_t operator[](const std::string& name) const;
56 // get copy of internal data storage
57 // can be handed to a DesktopFileWriter instance, or to manually hack on the data
58 DesktopFile::sections_t data() const;