// CHINT_test.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include "epm_handler_common.h" #include "util.h" #include "test.h" #include "unidefs.h" #include #include "property\nr.h" #include #include using namespace std; //template void readFile(const string&filename) { ifstream ifstr; string mystr; ifstr.open(filename); if(ifstr.fail()) { string error = "Unable to open" + filename; throw invalid_argument(error); } if(ifstr.eof()) { ifstr.close(); }else { string error = "Unable to colse" + filename; throw runtime_error(error); } } bool isEmpty(const char str) { if (str && str != '\0') { return false; } return true; } bool isEmpty(string &str) { if (str.empty()) { return true; } str.erase(0, str.find_first_not_of(" ")); str.erase(str.find_last_not_of(" ")+1); return str.empty(); } /* inline std::string format_string(const char *format,Args...args) { constexpr sizt_t oldLen = BUFSIZ; char buffer[oldlen]; // 默认栈上的缓冲区 size_t newlen = snprintf(&buffer[0], oldlen, format, args...); newlen++; // 算上终止符'\0' if (newlen > oldlen) { // 默认缓冲区不够大,从堆上分配 std::vector newbuffer(newlen); snprintf(newbuffer.data(), newlen, format, args...); return std::string(newbuffer.data()); } return buffer; } */ std::string format(const char *pszFmt, ...) { std::string str; va_list args; va_start(args, pszFmt); { int nLength = _vscprintf(pszFmt, args); nLength += 1; //上面返回的长度是包含\0,这里加上 std::vector vectorChars(nLength); _vsnprintf(vectorChars.data(), nLength, pszFmt, args); str.assign(vectorChars.data()); } va_end(args); return str; } int queryResult(string queryName,map fields) { int size = fields.size(); cout << "个数:" << size<first.c_str()); string id = it->first; cout<<"ID:"<second.c_str()); id = it->second; cout<<"ID:"<>tags2[i]; } POM_AM__set_application_bypass(true); printf("父ID:%s\r\n",item_id); ITKCALL(AOM_ask_value_string(item2,"item_id",&item_id)); printf("子ID:%s\r\n",item_id); ITKCALL(AOM_set_value_tags(item1,"representation_for",r_cnt2,tags2)); POM_AM__set_application_bypass(false); printf("成功\r\n"); } LINFO<<"设计任务回传结束"; ITK_exit_module(true); return 0; }