getCSVFromVector: optimize and add tests
Optimization: avoid copy; simpifiled unnessary branches; reduced
temperary string being created when doing string concatenation.
Added unit test for this function.
Tested: unit test
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I8c334dc4f087e262bb3e8613e86cfc2a93d525a0
diff --git a/user_mgr.hpp b/user_mgr.hpp
index 23278ed..5c1553b 100644
--- a/user_mgr.hpp
+++ b/user_mgr.hpp
@@ -21,8 +21,11 @@
#include <xyz/openbmc_project/User/AccountPolicy/server.hpp>
#include <xyz/openbmc_project/User/Manager/server.hpp>
+#include <span>
+#include <string>
#include <unordered_map>
#include <variant>
+#include <vector>
namespace phosphor
{
@@ -59,6 +62,8 @@
using DbusUserObj = std::map<DbusUserObjPath, DbusUserObjValue>;
+std::string getCSVFromVector(std::span<const std::string> vec);
+
/** @class UserMgr
* @brief Responsible for managing user accounts over the D-Bus interface.
*/