From 86e776c857695253fb26d78d2d13fabf95a2a309 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Wed, 1 May 2024 18:27:39 +0530 Subject: [PATCH] SimpCfg: Rename to get_vector, add some test code --- common/simpcfg.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index a0a80c291..3c07a7778 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -208,7 +208,7 @@ public: template - std::vector get_array(const std::string &group, const std::string &key, const std::vector &defaultValue, const std::string &callerName="") { + std::vector get_vector(const std::string &group, const std::string &key, const std::vector &defaultValue, const std::string &callerName="") { auto gm = mapV[group]; std::vector array; int i = 0; @@ -330,11 +330,16 @@ int main(int argc, char **argv) { sc.get_string("mistral", "system-prefix", "Not found"); sc.get_string("\"mistral\"", "\"system-prefix\"", "Not found"); - sc.get_array("testme", "keyA100", {1, 2, 3}); + sc.get_vector("testme", "keyA100", {1, 2, 3}); + sc.get_vector("testme", "keyA100", { "A", "അ", "अ", "ಅ" }); sc.set_int64("testme", "keyA300-0", 330); sc.set_int64("testme", "keyA300-1", 331); sc.set_int64("testme", "keyA300-2", 332); - sc.get_array("testme", "keyA300", {1, 2, 3}); + sc.set_string("testme", "keyA301-0", "India"); + sc.set_value("testme", "keyA301-1", "World"); + sc.set_string("testme", "keyA301-2", "AkashaGanga"); + sc.get_vector("testme", "keyA300", {1, 2, 3}); + sc.get_vector("testme", "keyA301", { "yes 1", "No 2", "very well 3" }); return 0; } #endif