You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
#include "load.h"
|
|
|
|
namespace Lib_Load{
|
|
void Load::set_sections(vector<string> vec_sections){
|
|
this->vec_sections = vec_sections;
|
|
}
|
|
map<string, string> Load::get_load_data(string str_flag_load) {
|
|
string cmd = "";
|
|
string response = "";
|
|
string key = "";
|
|
string value = "";
|
|
map<string, string> map_data;
|
|
for (const string §ion: this->vec_sections) {
|
|
cmd = "ubconfig --default --source " + str_flag_load + " get " + section;
|
|
response = process.call_all_sections(cmd);
|
|
vector<string> vec_str_key_value = Utils::split(response, '\n');
|
|
for (const string ¶m: vec_str_key_value) {
|
|
if ((param.find("(null)") == std::string::npos) && (param.length() != 0 )) {
|
|
if (param.find("=") != std::string::npos) {
|
|
size_t index = param.find("=");
|
|
key = param.substr(0, index);
|
|
value = param.substr(index + 1, param.length());
|
|
map_data[key] = value;
|
|
cout << key << "=" << value << endl;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
return map_data;
|
|
}
|
|
|
|
} |