Move type definitions into class

This commit is contained in:
TheAssassin
2018-11-09 02:14:48 +01:00
parent 4bb1ef124b
commit be1b2c95d4
2 changed files with 9 additions and 8 deletions

View File

@@ -14,12 +14,6 @@ namespace bf = boost::filesystem;
namespace linuxdeploy {
namespace core {
namespace desktopfile {
// describes a single section
typedef std::unordered_map<std::string, DesktopFileEntry> section_t;
// describes all sections in the desktop file
typedef std::unordered_map<std::string, section_t> sections_t;
class DesktopFileReader::PrivateData {
public:
bf::path path;
@@ -152,7 +146,7 @@ namespace linuxdeploy {
return d->path;
}
section_t DesktopFileReader::operator[](const std::string& name) {
DesktopFileReader::section_t DesktopFileReader::operator[](const std::string& name) {
auto it = d->sections.find(name);
// the map would lazy-initialize a new entry in case the section doesn't exist

View File

@@ -21,6 +21,13 @@ namespace linuxdeploy {
std::shared_ptr<PrivateData> d;
public:
// describes a single section
typedef std::unordered_map<std::string, DesktopFileEntry> section_t;
// describes all sections in the desktop file
typedef std::unordered_map<std::string, section_t> sections_t;
public:
// default constructor
DesktopFileReader();
@@ -55,7 +62,7 @@ namespace linuxdeploy {
// get a specific section from the parsed data
// throws std::range_error if section does not exist
std::unordered_map<std::string, DesktopFileEntry> operator[](const std::string& name);
section_t operator[](const std::string& name);
};
}
}