Credit Andrew - fix bug in render farm usage when using in/out pointers or selection
[goodguy/cinelerra.git] / cinelerra-5.1 / tools / makeappimagetool / includes / desktopfilereader.h
1 #pragma once
2
3 // system includes
4 #include <istream>
5 #include <memory>
6
7 // local includes
8 #include "desktopfile.h"
9 #include "desktopfileentry.h"
10
11 namespace linuxdeploy {
12     namespace desktopfile {
13         class DesktopFileReader {
14         private:
15             // opaque data class pattern
16             class PrivateData;
17
18             std::shared_ptr<PrivateData> d;
19
20         public:
21             // default constructor
22             DesktopFileReader();
23
24             // construct from path
25             explicit DesktopFileReader(std::string path);
26
27             // construct from existing istream
28             explicit DesktopFileReader(std::istream& is);
29
30             // copy constructor
31             DesktopFileReader(const DesktopFileReader& other);
32
33             // copy assignment constructor
34             DesktopFileReader& operator=(const DesktopFileReader& other);
35
36             // move assignment operator
37             DesktopFileReader& operator=(DesktopFileReader&& other) noexcept;
38
39             // equality operator
40             bool operator==(const DesktopFileReader& other) const;
41
42             // inequality operator
43             bool operator!=(const DesktopFileReader& other) const;
44
45         public:
46             // checks whether parsed data is available
47             bool isEmpty() const;
48
49             // returns desktop file path
50             std::string path() const;
51
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;
55
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;
59         };
60     }
61 }