Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pImpl to ModuleItem and remove definitions from header #1193

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 11 additions & 39 deletions include/libdnf5/module/module_item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ struct ModuleItemId {
// @replaces libdnf:module/ModuleItem.hpp:class:ModuleItem
class ModuleItem {
public:
bool operator==(const ModuleItem & rhs) const noexcept { return id.id == rhs.id.id; }
bool operator!=(const ModuleItem & rhs) const noexcept { return id.id != rhs.id.id; }
bool operator<(const ModuleItem & rhs) const noexcept { return id.id < rhs.id.id; }
bool operator==(const ModuleItem & rhs) const noexcept;
bool operator!=(const ModuleItem & rhs) const noexcept;
bool operator<(const ModuleItem & rhs) const noexcept;

~ModuleItem();

Expand Down Expand Up @@ -156,10 +156,10 @@ class ModuleItem {
/// @since 5.0
//
// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getRepoID()
const std::string & get_repo_id() const { return repo_id; };
const std::string & get_repo_id() const;

// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getId()
ModuleItemId get_id() const { return id; };
ModuleItemId get_id() const;

// @replaces libdnf:module/ModuleItem.hpp:method:ModuleItem.getYaml()
std::string get_yaml() const;
Expand All @@ -179,8 +179,8 @@ class ModuleItem {

ModuleItem(const ModuleItem & mpkg);
ModuleItem & operator=(const ModuleItem & mpkg);
ModuleItem(ModuleItem && mpkg);
ModuleItem & operator=(ModuleItem && mpkg);
ModuleItem(ModuleItem && mpkg) noexcept;
ModuleItem & operator=(ModuleItem && mpkg) noexcept;

private:
friend class ModuleQuery;
Expand Down Expand Up @@ -246,43 +246,15 @@ class ModuleItem {
static void create_platform_solvable(
const ModuleSackWeakPtr & module_sack, const std::string & name, const std::string & stream);

// Corresponds to one yaml document
_ModulemdModuleStream * md_stream;
libdnf5::module::ModuleSackWeakPtr get_module_sack() const;

ModuleSackWeakPtr module_sack;
ModuleItemId id;
std::string repo_id;
void set_computed_static_context(const std::string & context);

// For compatibility with older modules that didn't have static contexts
std::string computed_static_context;
class Impl;
std::unique_ptr<Impl> p_impl;
};


inline std::vector<ModuleProfile> ModuleItem::get_profiles(const std::string & name) const {
return get_profiles_internal(name.c_str());
}


inline std::vector<ModuleProfile> ModuleItem::get_profiles() const {
return get_profiles_internal(nullptr);
}


inline std::vector<ModuleDependency> ModuleItem::get_module_dependencies(bool remove_platform) const {
return get_module_dependencies(md_stream, remove_platform);
}


inline std::string ModuleItem::get_module_dependencies_string(bool remove_platform) const {
return get_module_dependencies_string(md_stream, remove_platform);
}


inline std::string ModuleItem::get_name_stream() const {
return get_name_stream(md_stream);
}


} // namespace libdnf5::module


Expand Down
Loading
Loading