Skip to content

Commit

Permalink
add helper get packer by app name
Browse files Browse the repository at this point in the history
  • Loading branch information
Forairaaaaa committed Jul 23, 2024
1 parent 32da1a5 commit dc9ff48
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/app_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,14 @@ bool APP_Register::isAppInstalled(APP_PACKER_BASE* appPacker)
}
return false;
}

APP_PACKER_BASE* APP_Register::getInstalledAppByName(const std::string& appName)
{
/* Iterate the shit out */
for (const auto& i : _app_packer_list)
{
if (i->getAppName() == appName)
return i;
}
return nullptr;
}
8 changes: 8 additions & 0 deletions src/app/app_register.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@ namespace MOONCAKE
* @return false
*/
bool isAppInstalled(APP_PACKER_BASE* appPacker);

/**
* @brief Get installed app packer by app name
*
* @param appName
* @return APP_PACKER_BASE*
*/
APP_PACKER_BASE* getInstalledAppByName(const std::string& appName);
};
} // namespace MOONCAKE
11 changes: 11 additions & 0 deletions src/mooncake.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ namespace MOONCAKE
*/
inline std::vector<APP_PACKER_BASE*>& getInstalledAppList() { return _data.app_register->getInstalledAppList(); }

/**
* @brief Get installed app packer by app name
*
* @param appName
* @return APP_PACKER_BASE*
*/
inline APP_PACKER_BASE* getInstalledAppByName(const std::string& appName)
{
return _data.app_register->getInstalledAppByName(appName);
}

/* Framework wrap to the App manager */

/**
Expand Down

0 comments on commit dc9ff48

Please sign in to comment.