parent
							
								
									9227ac6216
								
							
						
					
					
						commit
						04a4399222
					
				| @ -1,33 +1,39 @@ | |||||||
| #include "load.h" | #include "load.h" | ||||||
| 
 | 
 | ||||||
| namespace Lib_Load{ | namespace Lib_Load{ | ||||||
|     void Load::set_sections(vector<string> vec_sections){ |     void Load::set_sections(string sections){ | ||||||
|         this->vec_sections = vec_sections; |         this->sections = sections; | ||||||
|     } |     } | ||||||
|     map<string, string> Load::get_load_data(string str_flag_load) { |     void Load::set_count_error(int count_error) { | ||||||
|  |         process.set_count_error(count_error); | ||||||
|  |     } | ||||||
|  |     string Load::get_cmd_error() { | ||||||
|  |         return process.get_cmd_error(); | ||||||
|  |     } | ||||||
|  |     map<string, string>& Load::get_load_data(std::map <string, string> &map_temp, string str_flag_load) { | ||||||
|         string cmd = ""; |         string cmd = ""; | ||||||
|         string response = ""; |         string response = ""; | ||||||
|         string key = ""; |         string key = ""; | ||||||
|         string value = ""; |         string value = ""; | ||||||
|         map<string, string> map_data; |         cmd = "ubconfig  --default --source " + str_flag_load + " get " + this->sections; | ||||||
|         for (const string §ion: this->vec_sections) { |         response = process.call_all_sections(cmd); | ||||||
|             cmd = "ubconfig  --default --source " + str_flag_load + " get " + section; |         vector<string> vec_str_key_value = Utils::split(response, '\n'); | ||||||
|             response = process.call_all_sections(cmd); |         for (const string ¶m: vec_str_key_value) { | ||||||
|             vector<string> vec_str_key_value = Utils::split(response, '\n'); |             if ((param.find("(null)") == std::string::npos) && (param.length() != 0 )) {  | ||||||
|             for (const string ¶m: vec_str_key_value) { |                 if (param.find("=") != std::string::npos) { | ||||||
|                 if ((param.find("(null)") == std::string::npos) && (param.length() != 0 )) {  |                     size_t index = param.find("="); | ||||||
|                     if (param.find("=") != std::string::npos) { |                     key = param.substr(0, index); | ||||||
|                         size_t index = param.find("="); |                     value = param.substr(index + 1, param.length()); | ||||||
|                         key = param.substr(0, index); |                     Utils::str_replace_all(value, " \"",""); | ||||||
|                         value = param.substr(index + 1, param.length()); |                     Utils::str_replace_all(value, "\"",""); | ||||||
|                         map_data[key] = value; |                     map_temp[key] = value; | ||||||
|                         cout << key << "=" << value << endl; |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
| 
 |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return map_data; |         return map_temp; | ||||||
|  |     } | ||||||
|  |     int Load::get_count_error() { | ||||||
|  |         return process.get_count_error(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
| } | } | ||||||
					Loading…
					
					
				
		Reference in new issue
	
	