Adds:
- Export()
Change-Id: If76969aca0d3cb2cae63326109c6802d4ad9c4f3
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
*/
bundle* Detach();
+ /**
+ * @brief Exports bundle to an argument vector.
+ * @since_tizen 6.5
+ * @return The argument vector
+ */
+ std::vector<std::string> Export() const;
+
private:
class Impl;
std::unique_ptr<Impl> impl_;
return h;
}
+std::vector<std::string> Bundle::Export() const {
+ char** argv = nullptr;
+ int argc = bundle_export_to_argv(impl_->handle_, &argv);
+ if (argc < 0) {
+ LOGE("bundle_export_to_argv() is failed");
+ return {};
+ }
+
+ std::vector<std::string> args(1);
+ for (int i = 1; i < argc; ++i)
+ args.push_back(argv[i]);
+
+ bundle_free_exported_argv(argc, &argv);
+ return args;
+}
+
} // namespace tizen_base
bundle.Add("TestKey1", "TestVal");
EXPECT_FALSE(bundle.IsEmpty());
}
+
+TEST(Bundle, Export) {
+ Bundle bundle;
+ bundle.Add("TestKey1", "TestVal1");
+ std::vector<std::string> argv = bundle.Export();
+ EXPECT_NE(argv.size(), 0);
+}