void CL_Gdh::printMatchingKeys(const std::set<std::string>& key_set, const std::string& prefix_in) { std::string prefix_out; std::string prefix=prefix_init(prefix_in); GDH_PRINT_IF_MATCH(key_set,"datatype",m_datatype_str); GDH_PRINT_IF_MATCH(key_set,"uuid" ,m_uuid_str); GDH_PRINT_IF_MATCH(key_set,"date" ,m_datetime_str); GDH_PRINT_IF_MATCH(key_set,"locale" ,m_locale_str); for (int i=0;i<m_params.size();i++) { CL_Param* param=getParam(i); if (key_set.find(param->m_name.c_str())!=key_set.end()) { GDH_PRINT(param->m_name.c_str(),param->valueAsString()); } } if (1) { for (int i=0;i<m_gdh_leaves.size();i++) { prefix_out=prefix_idx(prefix,i); m_gdh_leaves[i]->printMatchingKeys(key_set,prefix_out); } } }
/** load cty database from filename */ int load_ctydata(char *filename) { FILE *fd; char buf[181] = ""; char *loc; if ((fd = fopen(filename, "r")) == NULL) return -1; dxcc_init(); prefix_init(); // set default for empty country dxcc_add("Not Specified : --: --: --: -00.00: 00.00: 0.0: :"); while (fgets(buf, sizeof(buf), fd) != NULL) { g_strchomp(buf); /* drop CR and/or NL and */ if (*buf == '\0') /* ignore empty lines */ continue; if (buf[0] != ' ') { // data line dxcc_add(buf); } else // prefix line { loc = strtok(buf, " ,;"); while (loc != NULL) { prefix_add (loc); loc = strtok(NULL, " ,;"); } } } fclose(fd); return 0; }
void CL_Gdh::print(const std::string& prefix_in) { std::string prefix=prefix_in; std::string prefix_out; prefix=prefix_init(prefix_in); GDH_PRINT("datatype",m_datatype_str); GDH_PRINT("uuid" ,m_uuid_str); GDH_PRINT("date" ,m_datetime_str); GDH_PRINT("locale" ,m_locale_str); for (int i=0;i<m_params.size();i++) { CL_Param* param=getParam(i); GDH_PRINT(param->m_name.c_str(),param->valueAsString()); } if (1) { for (int i=0;i<m_gdh_leaves.size();i++) { prefix_out=prefix_idx(prefix,i); m_gdh_leaves[i]->print(prefix_out); } } }