[Account.hpp] gnc_account_get_all_parents returns reversed path vector

This commit is contained in:
Christopher Lam 2025-01-19 22:32:27 +08:00
parent 7a17d329ec
commit a2d7868dce
2 changed files with 11 additions and 0 deletions

View File

@ -3242,6 +3242,15 @@ xaccAccountGetName (const Account *acc)
return GET_PRIVATE(acc)->accountName;
}
std::vector<const Account*>
gnc_account_get_all_parents (const Account *account)
{
std::vector<const Account*> rv;
for (auto a = account; !gnc_account_is_root (a); a = gnc_account_get_parent (a))
rv.push_back (a);
return rv;
}
gchar *
gnc_account_get_full_name(const Account *account)
{

View File

@ -61,6 +61,8 @@ void gnc_account_foreach_split_until_date (const Account *acc, time64 end_date,
* @result Split* or nullptr if not found */
Split* gnc_account_find_split (const Account*, std::function<bool(const Split*)>, bool);
std::vector<const Account*> gnc_account_get_all_parents (const Account *account);
#endif /* GNC_COMMODITY_HPP */
/** @} */
/** @} */