diff --git a/.vs/BOMToSapOpt/v14/.suo b/.vs/BOMToSapOpt/v14/.suo index afdb091..e42e71a 100644 Binary files a/.vs/BOMToSapOpt/v14/.suo and b/.vs/BOMToSapOpt/v14/.suo differ diff --git a/BOMToSapOpt.opensdf b/BOMToSapOpt.opensdf new file mode 100644 index 0000000..ee34093 Binary files /dev/null and b/BOMToSapOpt.opensdf differ diff --git a/BOMToSapOpt.sdf b/BOMToSapOpt.sdf index d4b72dd..afcfa10 100644 Binary files a/BOMToSapOpt.sdf and b/BOMToSapOpt.sdf differ diff --git a/BOMToSapOpt0.sdf b/BOMToSapOpt0.sdf new file mode 100644 index 0000000..88e53ad Binary files /dev/null and b/BOMToSapOpt0.sdf differ diff --git a/DFL_BOM_WL_TOERP/BOMSendSap.cpp b/DFL_BOM_WL_TOERP/BOMSendSap.cpp index 1229c12..917194b 100644 --- a/DFL_BOM_WL_TOERP/BOMSendSap.cpp +++ b/DFL_BOM_WL_TOERP/BOMSendSap.cpp @@ -36,12 +36,18 @@ #include "ocilib.h" #include #include -#include "util.h" #include #include "dfl_custom.h" #include "CRUL_server_call_httpserver.h" +#include "util.h" +//#include "SendSap.h" using namespace std; // +char* getNotNullMsg(char* msg); +void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists); +void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; +char* getUnti(char* unti); + struct FlowBean { vector flowList; tag_t flow_split = NULLTAG; @@ -53,10 +59,6 @@ struct FlowBean { boolean isOther = false; vector flow_combine_list; }; -char* getNotNullMsg(char* msg); -void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists); -void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; -char* getUnti(char* unti); FlowBean getClone(FlowBean oldBean) { FlowBean newBean; newBean.isMain = false; @@ -83,7 +85,7 @@ void printfMsg(ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP ns1Rsp, string& sen msg = U2G(msg); logMsg.append(returnMsg.MATNR).append("|") .append(returnMsg.TYPE).append("|").append(msg); - if (strcmp(returnMsg.TYPE, "E") == 0) { + if (tc_strcmp(returnMsg.TYPE, "E") == 0) { sendMsg.append("\n").append(returnMsg.MATNR).append(": ").append(msg); } log(logMsg.c_str()); @@ -94,7 +96,7 @@ void printfMsg(ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP ns1Rsp) { //_ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_RSP_USCOREBASEINFO *info = ns1Rsp.RSP_USCOREBASEINFO; //char* id = info[0].REQ_USCORETRACE_USCOREID; _ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_ZTABLE_USCORERETURN* returnTable = ns1Rsp.ZTABLE_USCORERETURN; - log("出厂编号RETURN:{}", num);/**/ + log("出厂编号RETURN:%d\n", num);/**/ for (int i = 0; i < num; i++) { _ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_ZTABLE_USCORERETURN returnMsg = returnTable[i]; //System.out.println(z.getSERNR() + "|" + z.getTYPE() + "|" + z.getMESSAGE()); @@ -162,8 +164,10 @@ void sendBom(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list, string bat SplitStr(msg, "soap1.1\"", vecMsg); string lastMsg = vecMsg[1].substr(11); string str = callHttpserver2(lastMsg); - log("BOM XML MSG:{}", lastMsg);/* xml信息*/ - log("return MSG :{}", str); + string logmsg = "BOM XML MSG:"; + log2(logmsg.append(lastMsg));/* xml信息*/ + logmsg = "return MSG :"; + log2(logmsg.append(str)); soap_print_fault(&proxy, stderr); log("xlt:[%d]", xlt); //printfMsg(ns1Rsp, sendMsg); @@ -178,7 +182,7 @@ void isMain(FlowBean& bean, vector& mainLines, vector& endLines, char* idmte; tag_t gxRev; ITKCALL(AOM_ask_value_tag(b, "bl_line_object", &gxRev)); - AOM_ask_value_string(gxRev, "item_id", &idmte); + ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte)); log("=====flowList=====%s====\n", idmte); } vector lists2 = bean.flow_combine_list; @@ -328,14 +332,14 @@ void sendFactoryNo(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_IT void getFactoryNoList(char* projectNo, char* groupName, char* wbs, tag_t* factoryNos, int num, tag_t ccp, vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM>& list) { char* zt2_MaterialNo, *zt2_TankNo, *zt2_Site; - AOM_UIF_ask_value(ccp, "zt2_MaterialNo", &zt2_MaterialNo); - AOM_UIF_ask_value(ccp, "zt2_TankNo", &zt2_TankNo); - AOM_UIF_ask_value(ccp, "zt2_Site", &zt2_Site); + ITKCALL(AOM_UIF_ask_value(ccp, "zt2_MaterialNo", &zt2_MaterialNo)); + ITKCALL(AOM_UIF_ask_value(ccp, "zt2_TankNo", &zt2_TankNo)); + ITKCALL(AOM_UIF_ask_value(ccp, "zt2_Site", &zt2_Site)); //_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM for (int i = 0, len = num; i < len; i++) { tag_t factoryNo = factoryNos[i]; char* itemId; - AOM_ask_value_string(factoryNo, "item_id", &itemId); + ITKCALL(AOM_ask_value_string(factoryNo, "item_id", &itemId)); _ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM item_factoryNo; int index = i + 1; char fileDate[128] = ""; @@ -375,7 +379,8 @@ vector addLastRev(map> items2) { } return revLast; } -tag_t getProcessTag(tag_t mantr) { +// +tag_t getProcessTag(tag_t mantr, char* groupName) { int n_references = 0; int* levels = 0; tag_t* references_tag, processTag = NULLTAG; @@ -383,9 +388,20 @@ tag_t getProcessTag(tag_t mantr) { //通过引用关系查找到变更单 ITKCALL(WSOM_where_referenced(mantr, 1, &n_references, &levels, &references_tag, &relation_type_name)); for (int n = 0; n < n_references; n++) { - log("relation_type_name [%s]\n", relation_type_name[n]); - if (strcmp(relation_type_name[n], "IMAN_METarget") == 0) { - processTag = references_tag[n]; + log("relation_type_name===>%s\n", relation_type_name[n]); + if (strcmp(relation_type_name[n], "IMAN_METarget") == 0) {//IMAN_METarget + // + char *os = NULL; + ITKCALL(AOM_ask_value_string(references_tag[n], "object_string", &os)); + tag_t group = NULLTAG; + char *gname = NULL; + ITKCALL(AOM_ask_value_tag(references_tag[n], "owning_group", &group)); + ITKCALL(AOM_ask_value_string(group, "name", &gname)); + log("gname:%s===>%s\n", os, gname); + if (tc_strcmp(gname, groupName) == 0) { + processTag = references_tag[n]; + break; + } } } return processTag; @@ -394,7 +410,7 @@ boolean isTcm2(tag_t mantr) { int releaseCount = 0; tag_t* releaseTags = NULL; //判断子件是否发布 - AOM_ask_value_tags(mantr, "release_status_list", &releaseCount, &releaseTags); + ITKCALL(AOM_ask_value_tags(mantr, "release_status_list", &releaseCount, &releaseTags)); if (releaseCount > 0) { return true; } @@ -409,7 +425,7 @@ vector getFlowStartsYH(int num, tag_t* c_line_tags) { int sucCnt = 0, preCnt = 0; ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0successors", &sucCnt, &successors)); - AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors); + ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors)); log("sucCnt %d preCnt%d \n", sucCnt, preCnt); if (preCnt == 0 && sucCnt > 0) { starts.push_back(gxLine); @@ -422,8 +438,8 @@ void readGXFlow(tag_t gxLine, vector& flowBeans, FlowBean& currentFlow boolean isMainFlow, boolean top) { tag_t* successors, *Mfg0predecessors; int sucCnt = 0, preCnt = 0; - AOM_ask_value_tags(gxLine, "Mfg0successors", &sucCnt, &successors); - AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors); + ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0successors", &sucCnt, &successors)); + ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors)); currentFlow.flowList.push_back(gxLine); if (preCnt > 1) { @@ -495,7 +511,7 @@ char* getGXNR(tag_t gxLine) { return (char*)""; } char* bl_sequence_no; - AOM_ask_value_string(gxLine, "bl_sequence_no", &bl_sequence_no); + ITKCALL(AOM_ask_value_string(gxLine, "bl_sequence_no", &bl_sequence_no)); //String seq = gxLine.getProperty("bl_sequence_no"); int seqI = 0; if (strcmp(bl_sequence_no, "") != 0) { @@ -576,13 +592,13 @@ _ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM getGXInfo(FlowBea _ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM sub; char* zt2_WorkCenter, *zt2_ControlCode, *object_name, *zt2_ClassificationCode, *zt2_ArtificialTime, *zt2_MachineTime, *zt2_ReadinessTime; - AOM_ask_value_string(gxRev, "zt2_WorkCenter", &zt2_WorkCenter); - AOM_UIF_ask_value(gxLine, "zt2_ControlCode", &zt2_ControlCode); - AOM_UIF_ask_value(gxRev, "object_name", &object_name); - AOM_UIF_ask_value(gxRev, "zt2_ClassificationCode", &zt2_ClassificationCode); - AOM_UIF_ask_value(gxLine, "zt2_ArtificialTime", &zt2_ArtificialTime); - AOM_UIF_ask_value(gxLine, "zt2_MachineTime", &zt2_MachineTime); - AOM_UIF_ask_value(gxLine, "zt2_ReadinessTime", &zt2_ReadinessTime); + ITKCALL(AOM_ask_value_string(gxRev, "zt2_WorkCenter", &zt2_WorkCenter)); + ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ControlCode", &zt2_ControlCode)); + ITKCALL(AOM_UIF_ask_value(gxRev, "object_name", &object_name)); + ITKCALL(AOM_UIF_ask_value(gxRev, "zt2_ClassificationCode", &zt2_ClassificationCode)); + ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ArtificialTime", &zt2_ArtificialTime)); + ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_MachineTime", &zt2_MachineTime)); + ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ReadinessTime", &zt2_ReadinessTime)); sub.VORNR = getGXNR(gxLine);// 工序 sub.ARBPL = zt2_WorkCenter;// (gxRev.getTCProperty("zt2_WorkCenter").getStringValue());// 工作中心 sub.STEUS = zt2_ControlCode;// (gxLine.getProperty("zt2_ControlCode"));// 控制码 @@ -616,8 +632,8 @@ void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag, char* groupName, char* now, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist) { //"zt2_MaterialNo", "zt2_WBSNo" char* zt2_MaterialNo, *zt2_WBSNo; - AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo); - AOM_ask_value_string(partRev, "zt2_WBSNo", &zt2_WBSNo); + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + ITKCALL(AOM_ask_value_string(partRev, "zt2_WBSNo", &zt2_WBSNo)); if (isTcm2(rev) && flag) return; if (gy_meops.count(zt2_MaterialNo) > 0) @@ -653,8 +669,8 @@ void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag, vector startLines = getFlowStartsYH(c_line_count, c_line_tags); tag_t part2; char* zt2_unit2; - ITEM_ask_item_of_rev(partRev, &part2); - AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2); + ITKCALL(ITEM_ask_item_of_rev(partRev, &part2)); + ITKCALL(AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2)); char* unit = getUnti(zt2_unit2); if (startLines.size() > 0) { char* itemID; @@ -667,7 +683,7 @@ void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag, char* idmte; tag_t gxRev; ITKCALL(AOM_ask_value_tag(startLines[i], "bl_line_object", &gxRev)); - AOM_ask_value_string(gxRev, "item_id", &idmte); + ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte)); log("=====idmte=====%s====\n", idmte); readGXFlow(startLines[i], flowBeans, firstBean, i == 0, true); for (int i = 0; i < firstBean.flowList.size(); i++) { @@ -675,7 +691,7 @@ void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag, char* idmte; tag_t gxRev; ITKCALL(AOM_ask_value_tag(b, "bl_line_object", &gxRev)); - AOM_ask_value_string(gxRev, "item_id", &idmte); + ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte)); log("=====ffirstBean.flowList=====%s====\n", idmte); } }// 打印流信息 @@ -737,15 +753,15 @@ void recurZYZZSAPYH(tag_t line, tag_t rev, vector& bomISExist, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist) { char* zt2_Diagram, *item_id, *object_name, *zt2_MaterialNo, *zt2_WBSNo; //"zt2_Diagram","item_id","object_name","zt2_MaterialNo","zt2_WBSNo" - AOM_ask_value_string(rev, "zt2_Diagram", &zt2_Diagram); - AOM_ask_value_string(rev, "item_id", &item_id); - AOM_ask_value_string(rev, "object_name", &object_name); - AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo); - AOM_ask_value_string(rev, "zt2_WBSNo", &zt2_WBSNo); + ITKCALL(AOM_ask_value_string(rev, "zt2_Diagram", &zt2_Diagram)); + ITKCALL(AOM_ask_value_string(rev, "item_id", &item_id)); + ITKCALL(AOM_ask_value_string(rev, "object_name", &object_name)); + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo)); + ITKCALL(AOM_ask_value_string(rev, "zt2_WBSNo", &zt2_WBSNo)); string x = zt2_MaterialNo; log("item_id = [%s] \n", item_id); if (x.rfind("99", 0) == 0) { - tag_t meops = getProcessTag(rev); + tag_t meops = getProcessTag(rev, groupName); if (meops != NULLTAG) { if (!isTcm2(meops)) { set_meops.push_back(meops); @@ -772,8 +788,8 @@ void recurZYZZSAPYH(tag_t line, tag_t rev, vector& bomISExist, } tag_t item; char* zt2_unit; - ITEM_ask_item_of_rev(rev, &item); - AOM_ask_value_string(item, "zt2_unit", &zt2_unit); + ITKCALL(ITEM_ask_item_of_rev(rev, &item)); + ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit)); char* unit = getUnti(zt2_unit); log("str = [%s] \n", unit); head.PSPNR = zt2_WBSNo; @@ -798,14 +814,14 @@ void recurZYZZSAPYH(tag_t line, tag_t rev, vector& bomISExist, tag_t c_line_tag = c_line_tags[i], rev2; ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &rev2)); char* prop0, *prop1, *prop2, *prop3, *prop4, *zt2_unit2; - AOM_ask_value_string(rev2, "zt2_Diagram", &prop0); - AOM_ask_value_string(rev2, "item_id", &prop1); - AOM_ask_value_string(rev2, "object_name", &prop2); - AOM_ask_value_string(rev2, "zt2_SapState", &prop3); - AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop4); + ITKCALL(AOM_ask_value_string(rev2, "zt2_Diagram", &prop0)); + ITKCALL(AOM_ask_value_string(rev2, "item_id", &prop1)); + ITKCALL(AOM_ask_value_string(rev2, "object_name", &prop2)); + ITKCALL(AOM_ask_value_string(rev2, "zt2_SapState", &prop3)); + ITKCALL(AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop4)); tag_t part2; - ITEM_ask_item_of_rev(rev2, &part2); - AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2); + ITKCALL(ITEM_ask_item_of_rev(rev2, &part2)); + ITKCALL(AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2)); char* unit22 = getUnti(zt2_unit2); items_item.IDNRK = prop4; char* unit = unit22; @@ -814,10 +830,10 @@ void recurZYZZSAPYH(tag_t line, tag_t rev, vector& bomISExist, items_item.POSTP = (char*)"L"; char* bl_sequence_no, *bl_quantity, *ZT2_ClassificationNo, *ZT2_Remark; //"bl_sequence_no", "bl_quantity", "ZT2_ClassificationNo", "ZT2_Remark" - AOM_ask_value_string(c_line_tag, "bl_sequence_no", &bl_sequence_no); - AOM_ask_value_string(c_line_tag, "bl_quantity", &bl_quantity); - AOM_ask_value_string(c_line_tag, "ZT2_ClassificationNo", &ZT2_ClassificationNo); - AOM_ask_value_string(c_line_tag, "ZT2_Remark", &ZT2_Remark); + ITKCALL(AOM_ask_value_string(c_line_tag, "bl_sequence_no", &bl_sequence_no)); + ITKCALL(AOM_ask_value_string(c_line_tag, "bl_quantity", &bl_quantity)); + ITKCALL(AOM_ask_value_string(c_line_tag, "ZT2_ClassificationNo", &ZT2_ClassificationNo)); + ITKCALL(AOM_ask_value_string(c_line_tag, "ZT2_Remark", &ZT2_Remark)); items_item.POSNR = bl_sequence_no; //string sss = bl_quantity;//line2.getProperty("bl_quantity"); log("bl_quantity ===== %s\n", bl_quantity); @@ -1086,11 +1102,11 @@ void readBomInfoYH(tag_t ccp, vector schemes, ITK__convert_tag_to_uid(ccp, &parnetUid); head.STKTX = parnetUid; - tag_t meops = getProcessTag(ccp); //c产成品工艺 + tag_t meops = getProcessTag(ccp, groupName); //c产成品工艺 if (meops != NULLTAG) { char* itemId; - AOM_ask_value_string(meops, "item_id", &itemId); + ITKCALL(AOM_ask_value_string(meops, "item_id", &itemId)); log("processId %s \n", itemId); readBopInfo1YH(meops, ccp, true, gy_meops, needTCM_meops, groupName, now, proclist); } @@ -1098,12 +1114,12 @@ void readBomInfoYH(tag_t ccp, vector schemes, vector vecc; tag_t item, lastRev = NULLTAG; split(zt2_MaterialNo, "-", &vecc); - ITEM_find_item(vecc[0].c_str(), &item); - ITEM_ask_latest_rev(item, &lastRev); + ITKCALL(ITEM_find_item(vecc[0].c_str(), &item)); + ITKCALL(ITEM_ask_latest_rev(item, &lastRev)); //log("vecc[0].c_str()%s\n", vecc[0].c_str()); if (lastRev != NULLTAG) { log("1"); - tag_t meops2 = getProcessTag(lastRev); + tag_t meops2 = getProcessTag(lastRev, groupName); readBopInfo1YH(meops2, ccp, false, gy_meops, needTCM_meops, groupName, now, proclist); } } @@ -1112,8 +1128,8 @@ void readBomInfoYH(tag_t ccp, vector schemes, for (int i = 0; i < schemes.size(); i++) { tag_t rev2 = schemes[i]; char* prop1, *propp2; - AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop1); - AOM_ask_value_string(rev2, "object_name", &propp2); + ITKCALL(AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop1)); + ITKCALL(AOM_ask_value_string(rev2, "object_name", &propp2)); _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item; char* flm = getFLMDb2(prop1, groupName, flmMap); items_item.SORTF = flm; @@ -1131,8 +1147,8 @@ void readBomInfoYH(tag_t ccp, vector schemes, } char* zt2_unit22; tag_t part22; - ITEM_ask_item_of_rev(rev2, &part22); - AOM_ask_value_string(part22, "zt2_unit", &zt2_unit22); + ITKCALL(ITEM_ask_item_of_rev(rev2, &part22)); + ITKCALL(AOM_ask_value_string(part22, "zt2_unit", &zt2_unit22)); char* unit22 = getUnti(zt2_unit22); items_item.MEINS = unit22; items_items[i] = items_item; @@ -1187,7 +1203,7 @@ void logCcbh(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> li msg.append("ZPSPID = ").append(getNotNullMsg(list_Factory.ZPSPID)).append(" "); msg.append("ZZD = ").append(getNotNullMsg(list_Factory.ZZD)).append("\n"); } - log(" 出厂编号信息:\n {} \n\n", msg); + log(" 出厂编号信息:%s\n", msg.c_str()); } /** * 记录工艺路线信息日志 @@ -1241,7 +1257,9 @@ void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> } msg.append("]\n"); } - log(" 开始记录PROCESS信息====> \n {} \n\n", msg); + string logmsg = " 开始记录PROCESS信息====>"; + //log(" 开始记录PROCESS信息====>%s", msg.c_str()); + log2(logmsg.append(msg)); } /** * 记录BOM信息日志 @@ -1275,7 +1293,9 @@ void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists) { } msg.append("]\n"); } - log(" 开始记录BOM信息====> \n {} \n\n", msg); + string logmsg = " 开始记录BOM信息====>"; + //log(" 开始记录BOM信息====>%s", msg.c_str()); + log2(logmsg.append(msg)); } /** * 记录传递信息到DETAILS表中 回传用 @@ -1287,13 +1307,18 @@ void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists) { */ void logBatabase(_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg, map &isExistTag, map> ccpTagMap, - char *code, string batchNum, char *groupId, char*wbsNo) { - char* topUid = bomMsg.HEAD.STKTX, *itemId, *topMatnrNo; + char *code, string batchNum, char *groupId, char*wbsNo, char* alterstatus) { + log("logBatabase===0"); + char topUid[32] = "", *itemId = NULL, *topMatnrNo = NULL; string materialNoTmp = ""; + tc_strcpy(topUid, bomMsg.HEAD.STKTX); + log("topUid===%s", topUid); if (ccpTagMap.count(topUid) == 0) { + log("logBatabase===1"); materialNoTmp = bomMsg.HEAD.MATNR; } else { + log("logBatabase===2"); vector ccps = ccpTagMap[topUid]; for (int i = 0; i < ccps.size(); i++) { if (i > 0) { @@ -1305,20 +1330,40 @@ void logBatabase(_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg, } } if (isExistTag.count(topUid) == 0) { + log("logBatabase===3"); //插入详情数据表 - tag_t topTag; + tag_t topTag = NULLTAG, partTag = NULLTAG; ITK__convert_uid_to_tag(topUid, &topTag); - AOM_ask_value_string(topTag, "item_id", &itemId); - AOM_ask_value_string(topTag, "zt2_MaterialNo", &topMatnrNo); + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(topTag, &type)); + if (tc_strcmp(type, "ZT2_Design3DRevision") == 0) { + int num = 0; + tag_t *comps = NULL; + ITKCALL(AOM_ask_value_tags(topTag, "representation_for", &num, &comps)); + for (int i = 0; i < num; i++) { + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(comps[i], &type2)); + if (tc_strcmp(type2, "Part Revision") == 0) { + partTag = comps[i]; + break; + } + } + } + else { + ITK__convert_uid_to_tag(topUid, &partTag); + } + ITKCALL(AOM_ask_value_string(topTag, "item_id", &itemId)); + ITKCALL(AOM_ask_value_string(partTag, "zt2_MaterialNo", &topMatnrNo)); isExistTag[topUid] = materialNoTmp.c_str(); - string insertSql = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,plmstatus) VALUES ('%s','%s','PLM开始传递',SYSDATE,'%s','%s','%s','%s','%s','%s','未处理') "; + string insertSql = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,plmstatus,plmalterstatus) VALUES ('%s','%s','PLM开始传递',SYSDATE,'%s','%s','%s','%s','%s','%s','未处理','%s') "; char selectRxfs[3000]; - sprintf(selectRxfs, insertSql.c_str(), code, batchNum.c_str(), groupId, materialNoTmp.c_str(), itemId, topUid, topMatnrNo, wbsNo); + sprintf(selectRxfs, insertSql.c_str(), code, batchNum.c_str(), groupId, materialNoTmp.c_str(), itemId, topUid, bomMsg.HEAD.MATNR, wbsNo, alterstatus); log("selectRecord2 ===> %s\n", selectRxfs); ExecuteSQLNoInputParam(selectRxfs); ExecuteSQLNoInputParam((char*)"commit"); } else { + log("logBatabase===4"); string updateSql = "update CHINT_BOM_TO_SAP_DETIALS set productmaterialno = '%s' where batchnumber = '%s'"; char selectRxfs[3000]; sprintf(selectRxfs, updateSql.c_str(), materialNoTmp.c_str(), batchNum.c_str()); @@ -1326,7 +1371,7 @@ void logBatabase(_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg, ExecuteSQLNoInputParam(selectRxfs); ExecuteSQLNoInputParam((char*)"commit"); } - log("========="); + log("logBatabase===5"); return; } /** @@ -1362,7 +1407,7 @@ void startSplitSend(char*groupId, int url_num = 0; char** url_vals = NULL; //首选项配置组对应的拆分方法 - PREF_ask_char_values("CHINT_SAPBOM_SPLIT", &url_num, &url_vals); + ITKCALL(PREF_ask_char_values("CHINT_SAPBOM_SPLIT", &url_num, &url_vals)); int cfNum = 1; // 拆分传递的数量 int type = 0; //0产成品维度 1 BOM for (int j = 0; j < url_num; j++) { @@ -1377,7 +1422,20 @@ void startSplitSend(char*groupId, } } } - log("====url_vals===={} {} \n", cfNum, mapList.size()); + log("====url_vals====%d %zd\n", cfNum, mapList.size()); + url_num = 0; + char** rule_vals = NULL; + char alterstatus[2] = "N"; + //是否需要修改状态 + ITKCALL(PREF_ask_char_values("CHINT_BOMTOSAP_STATUS_RULE", &url_num, &rule_vals)); + for (int i = 0; i < url_num; i++) { + vector vec; + Split(rule_vals[i], ":", vec); + if (tc_strcmp(vec[0].c_str(), groupId) == 0) { + tc_strcpy(alterstatus, vec[1].c_str()); + break; + } + } int batchNum = 1; int numberCnt = 0; map ccpMap; @@ -1415,7 +1473,7 @@ void startSplitSend(char*groupId, for (int i = 0; i < list.size(); i++) { log("i.size() ===> %d \n", i); _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i]; - logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo); + logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus); } log(" start SEND ===\n"); sendBom(list, batchMsg); @@ -1433,7 +1491,7 @@ void startSplitSend(char*groupId, for (int i = 0; i < list.size(); i++) { log("i.size() ===> %d \n", i); _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i]; - logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo); + logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus); //log("i.size() ===> %d \n", i); } log(" start SEND ==="); @@ -1462,7 +1520,7 @@ void startSplitSend(char*groupId, batchMsg.append(code).append("-").append(numMsg); for (int i = 0; i < list.size(); i++) { _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i]; - logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo); + logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus); } sendBom(list, batchMsg); batchNum = batchNum + 1; @@ -1477,7 +1535,7 @@ void startSplitSend(char*groupId, batchMsg.append(code).append("-").append(numMsg); for (int i = 0; i < list.size(); i++) { _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i]; - logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo); + logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus); } sendBom(list, batchMsg); batchNum = batchNum + 1; @@ -1565,6 +1623,7 @@ void sendNotice(char *code, string errMsg, char *wbsNo, char *userName, char* pr */ void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, char* wbs, char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName) { + log("************** getCcpAndBom **************"); //记录是否有重复的出厂编号 vector isCheck_FactoryNos; //记录产成品 对应的 电气BOM集合 @@ -1610,22 +1669,22 @@ void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, cha { char* refType, *grpName, *useUid, *object_name, *zt2_SapState; tag_t refTag = references_tag[i], group, item; - AOM_ask_value_string(refTag, "object_type", &refType); + ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType)); if (strcmp(refType, "Part Revision") != 0) { continue; } ITK__convert_tag_to_uid(refTag, &useUid); //判断不是产成品 并且同一组 - AOM_ask_value_tag(refTag, "owning_group", &group); - AOM_ask_value_string(group, "name", &grpName); + ITKCALL(AOM_ask_value_tag(refTag, "owning_group", &group)); + ITKCALL(AOM_ask_value_string(group, "name", &grpName)); if (strcmp(grpName, groupName) != 0 || strcmp(ccpUid, useUid) == 0) continue; - AOM_UIF_ask_value(refTag, "object_name", &object_name); - AOM_UIF_ask_value(refTag, "zt2_SapState", &zt2_SapState); + ITKCALL(AOM_UIF_ask_value(refTag, "object_name", &object_name)); + ITKCALL(AOM_UIF_ask_value(refTag, "zt2_SapState", &zt2_SapState)); if (strcmp(zt2_SapState, "1") == 0 || strcmp(zt2_SapState, "未传") == 0) { continue; } - ITEM_ask_item_of_rev(refTag, &item); + ITKCALL(ITEM_ask_item_of_rev(refTag, &item)); char* unitUid; ITK__convert_tag_to_uid(item, &unitUid); if (strcmp(unitUid, ccpItemUid) == 0) { @@ -1648,7 +1707,7 @@ void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, cha } } //传递出厂编号的记录日志信息 - log("出厂编号数量 num :{} \n\n\n", list_Factorys.size()); + log("出厂编号数量 num :%zd\n", list_Factorys.size()); logCcbh(list_Factorys); sendFactoryNo(list_Factorys); @@ -1667,10 +1726,10 @@ void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, cha for (it = cPart_schemes.begin(); it != cPart_schemes.end(); it++) { tag_t s = it->first; vector vectorRev = cPart_schemes[s]; - log("vectorRev size 遍历BOM {} \n", vectorRev.size()); + log("vectorRev size 遍历BOM %zd\n", vectorRev.size()); readSchemesYH(vectorRev, s, scheme_boms, bomISExist, rev_meops, groupName, now, errMess, material_revs, gy_meops, needTCM_meops, process_boms, transfer, inCcpMap); - log("scheme_boms {} \n", scheme_boms.size()); + log("scheme_boms %zd\n", scheme_boms.size()); } if (errMess.length() > 0) { errMsgBuf.append("BOM异常:\\n").append(errMess); @@ -1774,58 +1833,3 @@ void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, cha // set_default_logger(file_logger); // log("begin connor_import_object"); //} - -/** -* 根据产成品获取出厂编号 和电气设计下的BOM -* @param ccpVector 产成品的集合 -* @param groupName 用户所在的组 -* @param projectUid 项目的UID -* @param code 传递的编号code -* @param userName 用户ID -*/ -int readBomMsg(vector ccpVector, char * groupName, char* projectUid, char*code, char *userName) { - char* revUid; - int ifail = ITK_ok, num = 0; - //startLog(); - //链接TC数据库 - - string errorBuff; - tag_t project; - time_t now = time(0); - tm* p = localtime(&now); - char fileDate[128] = ""; - sprintf_s(fileDate, "%04d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday); - string nowTime = fileDate; - - tag_t ccp; - ITK__convert_uid_to_tag(projectUid, &project); - - char* projectNo, *zt2_WBSNo, *objectName; - //project.getProperty("zt2_ProjectNo"); - AOM_ask_value_string(project, "zt2_ProjectNo", &projectNo); - AOM_ask_value_string(project, "object_name", &objectName); - AOM_ask_value_string(project, "zt2_WBSNo", &zt2_WBSNo); - log("ccpVector%d\n", ccpVector.size()); - - //查询传递类型 - char* transfer = (char*)"电气设计"; - string sql = "select transfer from CHINT_BOM_TO_SAP_SUM where code = "; - sql.append(code); - int outputColumn1 = 0, outputValueCount1 = 0; - char*** outputValue1 = NULL; - log("search3 ===> :{}\n", sql.c_str()); - QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1); - if (outputValueCount1 > 0) { - transfer = outputValue1[0][0]; - } - log("transfer ===> :{}\n", transfer); - getCcpAndBom(ccpVector, projectNo, groupName, zt2_WBSNo - , fileDate, errorBuff, code, transfer, userName, objectName); - /*log("errorBuff ===>%s\n", errorBuff.c_str()); - *((char**)returnValue) = (char*)MEM_alloc((strlen(errorBuff.c_str()) + 1) * sizeof(char)); - tc_strcpy(*((char**)returnValue), errorBuff.c_str());*/ - - log("end connor_import_object"); - //spdlog::drop_all(); - return ITK_ok; -} \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/BomSapWh.cxx b/DFL_BOM_WL_TOERP/BomSapWh.cxx new file mode 100644 index 0000000..ea74e15 --- /dev/null +++ b/DFL_BOM_WL_TOERP/BomSapWh.cxx @@ -0,0 +1,319 @@ + +#include "tinyxml/tinyxml.h" +#include "CRUL_server_call_httpserver.h" +#include "SendSap.h" + +void sendSAP(char* url, char* data) { + CURL *curl; + CURLcode res; + curl = curl_easy_init(); + if (curl) { + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); + struct curl_slist *headers = NULL; + headers = curl_slist_append(headers, "Content-Type: application/xml"); + if (tc_strstr(url, "192.168.0.184") != NULL || tc_strstr(url, "gfpot01") != NULL) { + headers = curl_slist_append(headers, "Authorization: Basic cG9fcmZjOjFxYXohUUFa");//"po_rfc", "1qaz!QAZ" + } + else { + headers = curl_slist_append(headers, "Authorization: Basic c2hwbG06c2FwQDIwMTk=");//"shplm", "sap@2019" + } + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); + res = curl_easy_perform(curl); + } + curl_easy_cleanup(curl); +} + +void getProcess(tag_t rev, tag_t partRev, char* now, char* groupName, map gy_meops, TiXmlElement * BOPLIST, TiXmlElement * SONLIST, int valueOf) { + if (isTcm2(rev)) { + return; + } + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + if (gy_meops.count(zt2_MaterialNo)) { + return; + } + gy_meops[zt2_MaterialNo] = rev; + + tag_t ebom_window = NULLTAG, line = NULLTAG; + ITKCALL(BOM_create_window(&ebom_window)); + ITKCALL(BOM_set_window_top_line(ebom_window, NULL, rev, NULLTAG, &line)); + int c_line_count = 0; + tag_t *c_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags)); + + char *item_id = NULL, *item_revision_id = NULL, *object_name = NULL, *zt2_unit = NULL; + ITKCALL(ITEM_ask_rev_id2(rev, &item_id)); + ITKCALL(AOM_ask_value_string(rev, "item_revision_id", &item_revision_id)); + ITKCALL(AOM_ask_value_string(rev, "object_name", &object_name)); + string tcid = ""; + tcid.append(item_id).append("/").append(item_revision_id); + TiXmlElement *BOPCONTENTS = addElement(BOPLIST, "BOPCONTENTS", ""); + addElement(BOPCONTENTS, "BOPTCID", tcid.c_str()); + addElement(BOPCONTENTS, "BOPNAME", object_name); + addElement(BOPCONTENTS, "BOPTYPE", "S1"); + addElement(BOPCONTENTS, "WLBM", zt2_MaterialNo); + addElement(BOPCONTENTS, "PLANT", groupName); + addElement(BOPCONTENTS, "VERWE", "1"); + addElement(BOPCONTENTS, "STATU", "4"); + addElement(BOPCONTENTS, "DATUV", now); + addElement(BOPCONTENTS, "PLNAL", "1"); + addElement(BOPCONTENTS, "VERWE", tcid.c_str()); + addElement(BOPCONTENTS, "OTHER1", ""); + addElement(BOPCONTENTS, "OTHER2", ""); + TiXmlElement *BOPFILELIST = addElement(BOPCONTENTS, "BOPFILELIST", ""); + int dataset_count = 0; + tag_t *datasets = NULL; + ITKCALL(AOM_ask_value_tags(rev, "IMAN_specification", &dataset_count, &datasets)); + vector lists2; + lists2.push_back("PDF"); + lists2.push_back("MS Word"); + lists2.push_back("MS WordX"); + lists2.push_back("MS Excel"); + lists2.push_back("MS ExcelX"); + for (int i = 0; i < dataset_count; i++) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(datasets[i], &type)); + if (find(lists2.begin(), lists2.end(), type) == lists2.end()) { + char *name = NULL, *uid = NULL; + ITKCALL(AOM_ask_value_string(datasets[i], "object_name", &name)); + ITKCALL(POM_tag_to_uid(datasets[i], &uid)); + TiXmlElement *FILECONTENTS = addElement(BOPFILELIST, "FILECONTENTS", ""); + addElement(FILECONTENTS, "FILEID", item_id); + addElement(FILECONTENTS, "FILENAME", name); + addElement(FILECONTENTS, "FILETYPE", "文件"); + addElement(FILECONTENTS, "FIILUID", uid); + addElement(FILECONTENTS, "OTHER1", "OTHER1"); + addElement(FILECONTENTS, "OTHER2", "OTHER2"); + } + } +} + +tag_t getPRevision(tag_t rev) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(rev, &type)); + if (tc_strcmp(type, "Part Revision") == 0) { + char *zt2_ifpbom = NULL; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_ifpbom", &zt2_ifpbom)); + if (tc_strcmp(zt2_ifpbom, "P") == 0) { + return rev; + } + tag_t* designs = NULL; + int num = 0; + ITKCALL(AOM_ask_value_tags(rev, "TC_Is_Represented_By", &num, &designs)); + if (num > 0) { + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo)); + tag_t* matnrs = NULL; + num = 0; + ITKCALL(AOM_ask_value_tags(designs[0], "representation_for", &num, &matnrs)); + for (int i = 0; i < num; i++) { + char *zt2_MaterialNo2 = NULL, *zt2_ifpbom2 = NULL; + ITKCALL(AOM_ask_value_string(matnrs[i], "zt2_MaterialNo", &zt2_MaterialNo2)); + ITKCALL(AOM_UIF_ask_value(matnrs[i], "zt2_ifpbom", &zt2_ifpbom2)); + if (tc_strcmp(zt2_ifpbom2, "P") == 0 && tc_strcmp(zt2_MaterialNo2, zt2_MaterialNo) == 0) { + tag_t item = NULLTAG, *revisions = NULL; + int count = 0; + ITKCALL(ITEM_ask_item_of_rev(matnrs[i], &item)); + ITKCALL(AOM_ask_value_tags(item, "revision_list", &count, &revisions)); + for (int j = count - 1; j >= 0; j--) { + if (isTcm2(revisions[j])) { + return revisions[j]; + } + } + } + } + } + } + return rev; +} + +TiXmlElement* addElement(TiXmlElement *PARENT, const char* name, const char* val) { + TiXmlElement *CHILD = new TiXmlElement(name); + PARENT->LinkEndChild(CHILD); + if (tc_strlen(val) > 0) { + TiXmlText *materialText = new TiXmlText(val); + CHILD->LinkEndChild(materialText); + } + + return CHILD; +} + +void getWbsMsg(tag_t pRev, char* groupName, vector& wbsList, TiXmlElement *WBSLIST) { + char *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL; + ITKCALL(AOM_ask_value_string(pRev, "zt2_WBSNo", &zt2_WBSNo)); + if (!zt2_WBSNo || tc_strlen(zt2_WBSNo) == 0 || find(wbsList.begin(), wbsList.end(), zt2_WBSNo) == wbsList.end()) { + return; + } + ITKCALL(AOM_ask_value_string(pRev, "zt2_MaterialNo", &zt2_MaterialNo)); + TiXmlElement *WBSCONTENTS = addElement(WBSLIST, "WBSCONTENTS", ""); + addElement(WBSCONTENTS, "WBS", zt2_WBSNo); + addElement(WBSCONTENTS, "PLANT", groupName); + addElement(WBSCONTENTS, "MATERIALNO", zt2_MaterialNo); + + wbsList.push_back(zt2_WBSNo); +} + +void checkMatnr(string& errMessage, tag_t matnrRev) { + char *os = NULL, *zt2_State = NULL; + ITKCALL(AOM_ask_value_string(matnrRev, "object_string", &os)); + ITKCALL(AOM_ask_value_string(matnrRev, "zt2_State", &zt2_State)); + if (tc_strcmp(zt2_State, "封存") == 0 || tc_strcmp(zt2_State, "D1") == 0) { + errMessage.append("物料:").append(os).append("已封存,无法传递SAP\n"); + } + char **zt2_SZFactory = NULL, **zt2_SZProcuretype = NULL, **zt2_SZSealedornot = NULL; + int num1 = 0, num2 = 0, num3 = 0; + ITKCALL(AOM_ask_value_strings(matnrRev, "zt2_SZFactory", &num1, &zt2_SZFactory)); + ITKCALL(AOM_ask_value_strings(matnrRev, "zt2_SZProcuretype", &num2, &zt2_SZProcuretype)); + ITKCALL(AOM_ask_value_strings(matnrRev, "zt2_SZSealedornot", &num3, &zt2_SZSealedornot)); + boolean flag = false; + for (int i = 0; i < num1; i++) { + if (tc_strcmp(zt2_SZFactory[i], "M060") == 0) { + flag = true; + if (num2 > i && tc_strcmp(zt2_SZProcuretype[i], "/") == 0) { + errMessage.append("物料:").append(os).append(" 不可用,无法传递SAP\n"); + } + if (num3 > i && tc_strcmp(zt2_SZSealedornot[i], "Y") == 0) { + errMessage.append("物料:").append(os).append(" 已封存,无法传递SAP\n"); + } + } + } + if (!flag) { + errMessage.append("物料:").append(os).append(" 没有维护物料视图,无法传递SAP\n"); + } +} + +void expandAllBomPart(tag_t pRev, tag_t line, TiXmlElement *XmlINTERGRATIONLIST, char* groupName, char* now, vector wbsList, string& errMsg, map gy_meops) { + TiXmlElement *WBSLIST = XmlINTERGRATIONLIST->FirstChildElement("WBSLIST"); + if (WBSLIST == NULL) { + WBSLIST = addElement(XmlINTERGRATIONLIST, "WBSLIST", ""); + } + getWbsMsg(pRev, groupName, wbsList, WBSLIST); + tag_t* tzs = NULL; + int num = 0; + ITKCALL(AOM_ask_value_tags(pRev, "TC_Is_Represented_By", &num, &tzs)); + int c_line_count = 0; + tag_t *c_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags)); + if (c_line_count == 0) { + return; + } + TiXmlElement *WLLIST = XmlINTERGRATIONLIST->FirstChildElement("WLLIST"); + if (WLLIST == NULL) { + WLLIST = addElement(XmlINTERGRATIONLIST, "WLLIST", ""); + } + TiXmlElement *WLCONTENTS = addElement(WLLIST, "WLCONTENTS", ""); + // + char *item_id = NULL, *item_revision_id = NULL, *zt2_MaterialNo = NULL, *zt2_unit = NULL; + ITKCALL(ITEM_ask_rev_id2(pRev, &item_id)); + ITKCALL(AOM_ask_value_string(pRev, "item_revision_id", &item_revision_id)); + string tcid = ""; + tcid.append(item_id).append("/").append(item_revision_id); + addElement(WLCONTENTS, "TCID", tcid.c_str()); + // + ITKCALL(AOM_ask_value_string(pRev, "zt2_MaterialNo", &zt2_MaterialNo)); + addElement(WLCONTENTS, "WLBM", zt2_MaterialNo); + // + TiXmlElement *BOMCONTENTS = addElement(WLCONTENTS, "BOMCONTENTS", ""); + addElement(WLCONTENTS, "WLFILELIST", ""); + addElement(WLCONTENTS, "BOPLIST", ""); + + //if (c_line_count > 0) + addElement(BOMCONTENTS, "PARENTTCID", tcid.c_str()); + addElement(BOMCONTENTS, "PARENTWLBM", zt2_MaterialNo); + addElement(BOMCONTENTS, "PLANT", groupName); + addElement(BOMCONTENTS, "DATUV", now); + addElement(BOMCONTENTS, "STLAN", "1"); + addElement(BOMCONTENTS, "STLAL", "1"); + char *zt2_Quantity = NULL; + ITKCALL(AOM_ask_value_string(pRev, "zt2_Quantity", &zt2_Quantity)); + addElement(BOMCONTENTS, "QUANTITY", zt2_Quantity); + tag_t item; + ITKCALL(ITEM_ask_item_of_rev(pRev, &item)); + ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit)); + char* unit = getUnti(zt2_unit); + log("str = [%s] \n", unit); + addElement(BOMCONTENTS, "QUIT", zt2_unit); + + string maxSeq = "10"; + TiXmlElement *SONLIST = addElement(BOMCONTENTS, "SONLIST", ""); + for (int i = 0; i < c_line_count; i++) { + tag_t c_line_tag = c_line_tags[i], designRev = NULLTAG; + char *type2 = NULL; + ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &designRev)); + ITKCALL(WSOM_ask_object_type2(designRev, &type2)); + if (tc_strcmp(type2, "ZT2_XNZJBRevision") == 0) { + + } + TiXmlElement *SONCONTENTS = addElement(SONLIST, "SONCONTENTS", ""); + tag_t rev2 = getBOMPart(c_line_tag, groupName), item2; + char *item_id2 = NULL, *item_revision_id2 = NULL, *zt2_MaterialNo2 = NULL, *zt2_unit2 = NULL, *bl_sequence_no = NULL, *ZT2_Remark = NULL; + ITKCALL(AOM_ask_value_string(rev2, "item_id", &item_id2)); + ITKCALL(AOM_ask_value_string(rev2, "item_revision_id", &item_revision_id2)); + ITKCALL(AOM_ask_value_string(rev2, "zt2_MaterialNo", &zt2_MaterialNo2)); + ITKCALL(ITEM_ask_item_of_rev(rev2, &item2)); + ITKCALL(AOM_ask_value_string(item2, "zt2_unit", &zt2_unit2)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "bl_sequence_no", &bl_sequence_no)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "ZT2_Remark", &ZT2_Remark)); + checkMatnr(errMsg, rev2); + string tcid2 = ""; + tcid2.append(item_id2).append("/").append(item_revision_id2); + addElement(SONCONTENTS, "TCID", tcid2.c_str()); + addElement(SONCONTENTS, "WLBM", zt2_MaterialNo2); + addElement(SONCONTENTS, "DATUV", now); + char *menge = NULL;// = getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, codeRemark, errMsg); + menge = (char*)MEM_alloc((16 + 1) * sizeof(char)); + tc_strcpy(menge, getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, "1", errMsg)); + char* unit22 = getUnti(zt2_unit2); + addElement(SONCONTENTS, "QUE", menge); + addElement(SONCONTENTS, "QUIT", unit22); + addElement(SONCONTENTS, "SORTF", ""); + addElement(SONCONTENTS, "SEQID", bl_sequence_no); + addElement(SONCONTENTS, "POSTP", "L"); + addElement(SONCONTENTS, "REMARK", ZT2_Remark); + addElement(SONCONTENTS, "OTHER1", ""); + addElement(SONCONTENTS, "OTHER2", ""); + if (i == c_line_count - 1) { + maxSeq = bl_sequence_no; + } + expandAllBomPart(rev2, c_line_tag, XmlINTERGRATIONLIST, groupName, now, wbsList, errMsg, gy_meops); + } + tag_t meops = getProcessTag(pRev, groupName); + int valueOf = stoi(maxSeq); + if (pRev != NULLTAG && meops != NULLTAG) { + char *os = NULL, *pos = NULL; + ITKCALL(AOM_ask_value_string(pRev, "object_string", &os)); + ITKCALL(AOM_ask_value_string(meops, "object_string", &pos)); + log("物料[%s]工艺信息:%s", os, pos); + TiXmlElement *BOPLIST = addElement(WLCONTENTS, "BOPLIST", ""); + getProcess(meops, pRev, now, groupName, gy_meops, BOPLIST, SONLIST, valueOf); + } +} + +void BomSapWh(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName) { + log("************** BomSapWh **************"); + + for (int len = 0; len < ccpVector.size(); len++) { + tag_t rev = ccpVector[len]; + tag_t prev = getPRevision(rev); + tag_t ebom_window = NULLTAG, line = NULLTAG; + ITKCALL(BOM_create_window(&ebom_window)); + ITKCALL(BOM_set_window_top_line(ebom_window, NULL, prev, NULLTAG, &line)); + + TiXmlDocument XmlDocument; + XmlDocument.Parse(""); + TiXmlElement* XmlRoot = XmlDocument.RootElement(); + TiXmlElement *XmlREQ = XmlRoot->FirstChildElement("Body")->FirstChildElement(); + TiXmlElement *XmlINTERGRATIONLIST = new TiXmlElement("XmlINTERGRATIONLIST"); + XmlREQ->LinkEndChild(XmlINTERGRATIONLIST); + + vector wbsList; + map gy_meops; + string errMsg = ""; + expandAllBomPart(prev, line, XmlINTERGRATIONLIST, groupName, now, wbsList, errMsg, gy_meops); + } +} \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj b/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj index b4d3069..30c3a23 100644 --- a/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj +++ b/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj @@ -167,6 +167,7 @@ + @@ -174,11 +175,17 @@ + + + + + + @@ -224,12 +231,15 @@ + + + diff --git a/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj.filters b/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj.filters index 62caee6..c3c0ebd 100644 --- a/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj.filters +++ b/DFL_BOM_WL_TOERP/DFL_BOM_WL_TOERP.vcxproj.filters @@ -16,6 +16,9 @@ {9e65382d-9aa6-4ad3-838e-793ff9f1a7a4} + + {45cfac24-b5fa-4037-af01-39a7548bcf71} + @@ -63,6 +66,27 @@ webservice + + 婧愭枃浠 + + + 婧愭枃浠 + + + 婧愭枃浠 + + + tinyxml + + + tinyxml + + + tinyxml + + + tinyxml + @@ -212,6 +236,15 @@ webservice + + 澶存枃浠 + + + tinyxml + + + tinyxml + diff --git a/DFL_BOM_WL_TOERP/GetBOMProp.cpp b/DFL_BOM_WL_TOERP/GetBOMProp.cpp index b1f0866..d310c64 100644 --- a/DFL_BOM_WL_TOERP/GetBOMProp.cpp +++ b/DFL_BOM_WL_TOERP/GetBOMProp.cpp @@ -21,7 +21,9 @@ #include "spdlog/spdlog.h" #include "spdlog/sinks/basic_file_sink.h" #include "ocilib.h" +#include "SAPZYGG2.h" #include "util.h" +//#include "SendSap.h" using namespace spdlog; #define PREF_ML_DB "Meling_dbinfo" using namespace std; @@ -71,6 +73,101 @@ string uploadMinio(string jarName, string logPath) { //return; } +/** +* 鏍规嵁浜ф垚鍝佽幏鍙栧嚭鍘傜紪鍙 鍜岀數姘旇璁′笅鐨凚OM +* @param ccpVector 浜ф垚鍝佺殑闆嗗悎 +* @param groupName 鐢ㄦ埛鎵鍦ㄧ殑缁 +* @param projectUid 椤圭洰鐨刄ID +* @param code 浼犻掔殑缂栧彿code +* @param userName 鐢ㄦ埛ID +*/ +int readBomMsg(vector ccpVector, char * groupName, char* projectUid, char*code, char *userName) { + char* revUid; + int ifail = ITK_ok, num = 0; + //startLog(); + //閾炬帴TC鏁版嵁搴 + + string errorBuff; + tag_t project; + time_t now = time(0); + tm* p = localtime(&now); + char fileDate[128] = ""; + sprintf_s(fileDate, "%04d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday); + string nowTime = fileDate; + + tag_t ccp; + ITK__convert_uid_to_tag(projectUid, &project); + + char* projectNo, *zt2_WBSNo, *objectName; + //project.getProperty("zt2_ProjectNo"); + ITKCALL(AOM_ask_value_string(project, "zt2_ProjectNo", &projectNo)); + ITKCALL(AOM_ask_value_string(project, "object_name", &objectName)); + ITKCALL(AOM_ask_value_string(project, "zt2_WBSNo", &zt2_WBSNo)); + log("ccpVector%d\n", ccpVector.size()); + + //鏌ヨ浼犻掔被鍨 + char* transfer = (char*)"鐢垫皵璁捐"; + string sql = "select transfer from CHINT_BOM_TO_SAP_SUM where code = "; + sql.append(code); + int outputColumn1 = 0, outputValueCount1 = 0; + char*** outputValue1 = NULL; + log("search3 ===> :%s\n", sql.c_str()); + QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1); + if (outputValueCount1 > 0) { + transfer = outputValue1[0][0]; + } + log("transfer ===> :%s\n", transfer); + int pref_cnt = 0; + char **pref = NULL; + ITKCALL(PREF_ask_char_values("CHINT_TYBOMTOSAP", &pref_cnt, &pref)); + string fa = ""; + for (int i = 0; i < pref_cnt; i++) { + vector v1, v2; + Split(pref[i], ":", v1); + Split(v1[1], ";", v2); + for (int j = 0; j < v2.size(); j++) { + if (tc_strcmp(v2[j].c_str(), groupName) == 0) { + fa = v1[0]; + break; + } + } + if (fa.size() > 0) + break; + } + log("fa ===>%s\n", fa.c_str()); + if (tc_strcmp(fa.c_str(), "C") == 0) { + SAPZZNewOp(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, (char*)fa.c_str()); + } + else if (tc_strcmp(transfer, "澹充綋鏂规浼犻") == 0) { + getKTBom(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, objectName); + } + else if (tc_strcmp(transfer, "浜ф垚鍝丅OM浼犻") == 0 && tc_strcmp(fa.c_str(), "D") == 0) { + SAPZYGG2(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, objectName); + } + else if (tc_strcmp(transfer, "浜ф垚鍝丅OM浼犻") == 0 && tc_strcmp(fa.c_str(), "B") == 0) { + SAPZYGG2(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, objectName); + } + else if (tc_strcmp(transfer, "浜ф垚鍝丅OM浼犻") == 0 && tc_strcmp(fa.c_str(), "E") == 0) { + SAPZZNewOp(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, (char*)fa.c_str()); + } + else { + getCcpAndBom(ccpVector, projectNo, groupName, zt2_WBSNo, + fileDate, errorBuff, code, transfer, userName, objectName); + } + /*log("errorBuff ===>%s\n", errorBuff.c_str()); + *((char**)returnValue) = (char*)MEM_alloc((strlen(errorBuff.c_str()) + 1) * sizeof(char)); + tc_strcpy(*((char**)returnValue), errorBuff.c_str());*/ + + log("end connor_import_object"); + //spdlog::drop_all(); + return ITK_ok; +} + int ITK_user_main(int argc, char* argv[]) { int ifail = ITK_ok; @@ -104,7 +201,7 @@ int ITK_user_main(int argc, char* argv[]) } int url_num = 0; char** url_vals = NULL; - PREF_ask_char_values("database_tc", &url_num, &url_vals); + ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals)); string url = url_vals[0]; url.append("/").append(url_vals[2]); diff --git a/DFL_BOM_WL_TOERP/SAPZYGG2.cxx b/DFL_BOM_WL_TOERP/SAPZYGG2.cxx new file mode 100644 index 0000000..83ffa81 --- /dev/null +++ b/DFL_BOM_WL_TOERP/SAPZYGG2.cxx @@ -0,0 +1,975 @@ + +//#include +//#include +//#include +#include "SendSap.h" + + +boolean vecContains(vector vec, string str) { + for (int i = 0; i < vec.size(); i++) { + if (tc_strcmp(vec[i].c_str(), str.c_str()) == 0) { + return true; + } + } + return false; +} + +int getIcsId(char* codeRemark, char* property) { + tag_t ico = NULLTAG, *attributeList = NULL; + int cnt = 0, *attrIDs; + ITKCALL(ICS_class_ask_attributes(codeRemark, &cnt, &attributeList, &attrIDs)); + for (int i = 0; i < cnt; i++) { + char *unctName = NULL, *shortName = NULL, *unctUnit = NULL; + int unctFormat = 0; + ITKCALL(ICS_describe_unct(attrIDs[i], &unctName, &shortName, &unctUnit, &unctFormat)); + if (tc_strcmp(unctName, property) == 0) { + return attrIDs[i]; + } + } + return -1; +} + +/* +* 根据分类属性查询分类对象 +* SAPUtil.getICSComp(String codeRemark, int icsId, String value, TCSession session) +*/ +tag_t getICSComp(char* codeRemark, int unct, char* query) { + if (unct == -1) { + return NULLTAG; + } + tag_t ico = NULLTAG, *results = NULL; + string qstr = "="; + qstr.append(query); + char* queries = (char*)qstr.c_str(); + int cnt = 0; + ITKCALL(ICS_find_class(codeRemark, &ico)); + ITKCALL(ICS_search_instances(ico, NULLTAG, 1, &unct, &queries, &cnt, &results)); + printf("ICS_search_instances:%d\n", cnt); + if (cnt > 0) { + tag_t wso = NULLTAG; + ITKCALL(ICS_ask_classified_wsobject(results[0], &wso)); + return wso; + } + return NULLTAG; +} +/* +* 根据材料标记获得物料 +* SAPUtil.getClassPart +*/ +tag_t getClassPart(tag_t rev, char* codeRemark, int unct, map& by_materials) { + char* zt2_MaterialMark = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialMark", &zt2_MaterialMark)); + if (!zt2_MaterialMark || tc_strlen(zt2_MaterialMark) == 0) { + return NULLTAG; + } + if (by_materials.count(zt2_MaterialMark) > 0) { + tag_t comp = by_materials[zt2_MaterialMark]; + if (comp == NULLTAG) { + tag_t *contexts2 = NULL; + int num = 0; + ITKCALL(AOM_ask_value_tags(rev, "ZT2_Material", &num, &contexts2)); + if (num > 0) + return contexts2[0]; + log("查询不到[材料标记]为[%s]的原材料\n", zt2_MaterialMark); + return NULLTAG; + } + return by_materials[zt2_MaterialMark]; + } + else { + tag_t comp = getICSComp(codeRemark, unct, zt2_MaterialMark); + if (comp == NULLTAG) { + tag_t *contexts2 = NULL; + int num = 0; + ITKCALL(AOM_ask_value_tags(rev, "ZT2_Material", &num, &contexts2)); + if (num > 0) + return contexts2[0]; + log("查询不到[材料标记]为[%s]的原材料\n", zt2_MaterialMark); + return NULLTAG; + } + else { + by_materials[zt2_MaterialMark] = comp; + return comp; + } + } + return NULLTAG; +} + +tag_t getClassPartDB(tag_t rev, char* groupName, map& by_materials, map& materials, string& errMsg) { + char* zt2_MaterialMark = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialMark", &zt2_MaterialMark)); + if (!zt2_MaterialMark || tc_strlen(zt2_MaterialMark) == 0) { + return NULLTAG; + } + string sql = "select materialno,materialutilization,materialunit FROM \"CHINT_"; + if (tc_strcmp(groupName, "M046") == 0) { + sql.append("M043"); + } + else { + sql.append(groupName); + } + sql.append("_MATERIAL\" where materialmark='").append(zt2_MaterialMark).append("'"); + int outputColumn1 = 0, outputValueCount1 = 0; + char*** outputValue1 = NULL; + log("search3 ===> %s\n", sql.c_str()); + QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1); + if (outputValueCount1 == 0) { + log("查询不到[材料标记]为[%s]的原材料\n", zt2_MaterialMark); + errMsg.append("查询不到[材料标记]为[").append(zt2_MaterialMark).append("]的原材料\n"); + return NULLTAG; + } + materials[zt2_MaterialMark] = outputValue1[0][1]; + tag_t find = NULLTAG; + ITKCALL(ITEM_find_item(outputValue1[0][0], &find)); + if (find == NULLTAG) { + log("tc中查询不到[ID]为[%s]的原材料\n", zt2_MaterialMark); + errMsg.append("tc中查询不到[ID]为[").append(zt2_MaterialMark).append("]的原材料\n"); + return NULLTAG; + } + by_materials[zt2_MaterialMark] = find; + return find; +} +//物料信息排序,zt2_MaterialNo为3开头的在前 +void getSort(vector& materials) { + if (materials.size() < 2) + return; + vector flowInt; + map> flows; + for (char* b : materials) { + int size = 1; + if (b && tc_strlen(b) > 0 && b[0] == '3') { + size = 0; + } + if (flows.count(size) > 0) { + flows[size].push_back(b); + } + else { + vector flow; + flow.push_back(b); + flowInt.push_back(size); + flows[size] = flow; + } + } + materials.clear(); + sort(flowInt.rbegin(), flowInt.rend()); + for (vector::iterator it = flowInt.begin(); it != flowInt.end(); it++) { + cout << *it << " "; + if (flows.count(*it) > 0) { + vector beans = flows[*it]; + for (int x = 0; x < beans.size(); x++) { + materials.push_back(beans[x]); + } + } + } +} +/* +* 获得Part Revision +* SAPUtil.getSAPPart(TCComponentBOMLine line, TCSession session, String groupName, + StringBuffer buff) +*/ +tag_t getSAPPart(tag_t rev, char* groupName) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(rev, &type)); + if (tc_strcmp(type, "Part Revision") == 0) { + return rev; + } + int num = 0; + tag_t *comps = NULL; + vector parts; + ITKCALL(AOM_ask_value_tags(rev, "representation_for", &num, &comps)); + for (int i = 0; i < num; i++) { + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(comps[i], &type2)); + if (tc_strcmp(type, "Part Revision") == 0 && isTcm2(comps[i])) { + parts.push_back(comps[i]); + } + } + if (parts.size() == 1) { + return parts[0]; + } + else if (parts.size() > 1 && tc_strcmp(groupName, "M034") == 0) { + return NULLTAG; + } + + char* spec = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_Specifications", &spec)); + for (int i = 0; i < parts.size(); i++) { + char* zt2_Specifications = NULL; + ITKCALL(AOM_ask_value_string(parts[i], "zt2_Specifications", &zt2_Specifications)); + if (tc_strcmp(zt2_Specifications, spec) == 0) { + return parts[i]; + } + } + return NULLTAG; +} +/* +* 获得Part Revision +* SAPUtil.getSAPPart(TCComponentBOMLine line, TCSession session, String groupName, +StringBuffer buff) +*/ +tag_t getBOMPart(tag_t line, char* groupName) { + tag_t rev = NULLTAG; + ITKCALL(AOM_ask_value_tag(line, "bl_line_object", &rev)); + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(rev, &type)); + //log("getBOMPart1==>%s", type); + if (tc_strcmp(type, "Part Revision") == 0) { + return rev; + } + int num = 0; + tag_t *comps = NULL; + vector parts; + ITKCALL(AOM_ask_value_tags(rev, "representation_for", &num, &comps)); + for (int i = 0; i < num; i++) { + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(comps[i], &type2)); + //log("getBOMPart2==>%s", type2); + if (tc_strcmp(type2, "Part Revision") == 0 && isTcm2(comps[i])) { + parts.push_back(comps[i]); + } + } + //log("getBOMPart3==>%zd", parts.size()); + if (parts.size() == 1) { + return parts[0]; + } + else if (parts.size() > 1 && tc_strcmp(groupName, "M034") == 0) { + return NULLTAG; + } + + char* spec = NULL; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_Specifications", &spec)); + for (int i = 0; i < parts.size(); i++) { + char* zt2_Specifications = NULL; + ITKCALL(AOM_UIF_ask_value(parts[i], "zt2_Specifications", &zt2_Specifications)); + if (tc_strcmp(zt2_Specifications, spec) == 0) { + return parts[i]; + } + } + char* zt2_TYJNo = NULL, *item_id = NULL; + ITKCALL(AOM_UIF_ask_value(line, "ZT2_TYSpecifications", &zt2_TYJNo)); + if (zt2_TYJNo && tc_strlen(zt2_TYJNo) > 0) { + tag_t query_tag = NULLTAG; + ITKCALL(QRY_find2("chint_query_material", &query_tag)); + if (query_tag == NULL) { + return NULLTAG; + } + ITKCALL(AOM_UIF_ask_value(rev, "item_id", &item_id)); + char *zt2_DrawingNo = NULL; + string qs = "*"; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_DrawingNo", &zt2_DrawingNo)); + if (zt2_DrawingNo && tc_strlen(zt2_DrawingNo) > 0 && tc_strcmp(item_id, zt2_DrawingNo) != 0) { + qs.append(zt2_DrawingNo); + } + else { + qs.append(item_id); + } + qs.append("*").append(zt2_TYJNo).append("*"); + char **qkey = NULL, **qvalue = NULL, *qprop = (char*)qs.c_str(); + int num_found = 0; + tag_t *qresult = NULL; + qkey = (char **)MEM_alloc(1 * sizeof(char*)); + qvalue = (char **)MEM_alloc(1 * sizeof(char*)); + qkey[0] = (char *)MEM_alloc((tc_strlen("描述") + 1)*sizeof(char)); + qvalue[0] = (char *)MEM_alloc((tc_strlen(qprop) + 1)*sizeof(char)); + tc_strcpy(qkey[0], "描述"); + tc_strcpy(qvalue[0], qprop); + ITKCALL(QRY_execute(query_tag, 1, qkey, qvalue, &num_found, &qresult)); + log("chint_query_material 描述:%s==>%d", qprop, num_found); + map map_revs; + vector materials; + for (int i = 0; i < num_found; i++) { + if (isTcm2(qresult[i])) { + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_UIF_ask_value(qresult[i], "zt2_MaterialNo", &zt2_MaterialNo)); + map_revs[zt2_MaterialNo] = qresult[i]; + materials.push_back(zt2_MaterialNo); + } + } + if (materials.size() > 0) { + getSort(materials); + for (int i = 0; i < materials.size(); i++) { + string sql = "select FeatureList from CcemVW_GoodsFeature where GoodsCode = '"; + sql.append(materials[i]).append("'"); + int outputColumn1 = 0, outputValueCount1 = 0; + char*** outputValue1 = NULL; + QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1); + if (outputValueCount1 > 0) { + vector vec; + Split(outputValue1[0][0], ",", vec); + for (int j = 0; j < vec.size(); j++) { + string s = vec[j].substr(0, 5); + if (tc_strcmp(s.c_str(), "F064:") == 0) { + string temp = s.substr(5, s.size() - 5); + if (map_revs.count(temp) > 0) { + return map_revs[temp]; + } + break; + } + } + } + } + } + } + + return NULLTAG; +} + +/* +* 获得图纸对象 +* SAPUtil.getZYDesign(TCComponentItemRevision rev) +*/ +tag_t getZYDesign(tag_t rev) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(rev, &type)); + if (tc_strcmp(type, "ZT2_Design3DRevision") == 0) { + return rev; + } + else if (tc_strcmp(type, "Part Revision") == 0) { + int num = 0; + tag_t *comps = NULL; + ITKCALL(AOM_ask_value_tags(rev, "TC_Is_Represented_By", &num, &comps)); + if (num > 0) { + return comps[0]; + } + } + return NULLTAG; +} + +string getICSProperty(tag_t comp, char* codeRemark, char* prop) { + tag_t ico = NULLTAG, *results = NULL; + ITKCALL(ICS_find_class(codeRemark, &ico)); + ITKCALL(ICS_ask_classification_object(comp, &ico)); + if (ico == NULLTAG) { + return ""; + } + int n_attrs = 0; + char** attr_names = NULL, ** attr_vals = NULL; + ITKCALL(ICS_ask_attributes_of_classification_obj(ico, &n_attrs, &attr_names, &attr_vals)); + for (int i = 0; i < n_attrs; i++) { + if (tc_strcmp(attr_names[i], prop) == 0) { + return attr_vals[i]; + } + } + return ""; +} + +char* getZYMENGE(double dw, tag_t material, char* codeMark) { + //double dw = stod(zt2_zt2_DesignWeight); + double lyl = -1, res = 0; + string lylStr = getICSProperty(material, codeMark, "材料利用率"); + if (lylStr.size() == 0) { + lyl = 0.85; + } + else { + lyl = stod(lylStr); + } + if (lyl > 0) { + res = dw / lyl; + } + char buffer[16]; + sprintf(buffer, "%.3f", res); + log("MENGE1:%f==%s", res, buffer); + return buffer; +} + +char* getZYSAPMENGE(tag_t design, tag_t part, tag_t line, boolean isBottom, char* codeMark, string& errMsg) { + //log("getZYSAPMENGE"); + char *os = NULL; + ITKCALL(AOM_UIF_ask_value(line, "object_string", &os)); + if (isBottom) { + char* ZT2_TYSpecifications = NULL, *ZT2_TYWeight = NULL; + ITKCALL(AOM_UIF_ask_value(line, "ZT2_TYSpecifications", &ZT2_TYSpecifications)); + if (ZT2_TYSpecifications && tc_strlen(ZT2_TYSpecifications) > 0) { + ITKCALL(AOM_UIF_ask_value(line, "ZT2_TYWeight", &ZT2_TYWeight)); + if (!ZT2_TYWeight || tc_strlen(ZT2_TYWeight) == 0) { + //log("getZYSAPMENGE1"); + errMsg.append(os).append("未填写通用件重量;"); + return "0"; + } + else { + //log("getZYSAPMENGE2"); + return getZYMENGE(stod(ZT2_TYWeight), part, codeMark); + } + } + else {// 非通用件 + double zt2_DesignWeight = 0; + ITKCALL(AOM_ask_value_double(design, "zt2_DesignWeight", &zt2_DesignWeight)); + char* ss = getZYMENGE(zt2_DesignWeight, part, codeMark); + if (tc_strlen(ss) == 0) { + //log("getZYSAPMENGE3"); + errMsg.append(os).append("未填写重量(zt2_DesignWeight);"); + return "0"; + } + //log("getZYSAPMENGE4"); + return ss; + } + } + else { + char* bl_quantity = NULL; + ITKCALL(AOM_UIF_ask_value(line, "bl_quantity", &bl_quantity)); + if (!bl_quantity || tc_strlen(bl_quantity) == 0) { + //log("getZYSAPMENGE5"); + errMsg.append(os).append("数量未填写(bl_quantity)"); + return "0"; + } + //log("getZYSAPMENGE6"); + double dw = stod(bl_quantity); + char buffer[16]; + sprintf(buffer, "%.3f", dw); + log("MENGE2:%f==%s", dw, buffer); + return buffer; + } +} + +char* getZYSAPMENGE2(string lylStr, tag_t design, tag_t line, boolean isBottom, string& errMsg) { + log("lylStr:%s", lylStr.c_str()); + double lyl = -1; + if (lylStr.size() > 0) { + lyl = stod(lylStr.c_str()); + } + else { + lyl = 0.85; + } + if (isBottom) { + char* ZT2_TYSpecifications = NULL, *ZT2_TYWeight = NULL; + ITKCALL(AOM_UIF_ask_value(line, "ZT2_TYSpecifications", &ZT2_TYSpecifications)); + if (ZT2_TYSpecifications && tc_strlen(ZT2_TYSpecifications) > 0) { + ITKCALL(AOM_UIF_ask_value(line, "ZT2_TYWeight", &ZT2_TYWeight)); + if (!ZT2_TYWeight || tc_strlen(ZT2_TYWeight) == 0) { + return "0"; + } + } + else {// 非通用件 + ITKCALL(AOM_UIF_ask_value(design, "zt2_DesignWeight", &ZT2_TYWeight)); + if (!ZT2_TYWeight || tc_strlen(ZT2_TYWeight) == 0) { + char *os = NULL; + ITKCALL(AOM_ask_value_string(design, "object_string", &os)); + errMsg.append(os).append("设计重量为空\n"); + return "0"; + } + } + double dw = stod(ZT2_TYWeight) / lyl; + char buffer[16]; + sprintf(buffer, "%.3f", dw); + log("MENGE3:%f==%s", dw, buffer); + return buffer; + } + else { + char* bl_quantity = NULL; + ITKCALL(AOM_UIF_ask_value(line, "bl_quantity", &bl_quantity)); + if (!bl_quantity || tc_strlen(bl_quantity) == 0) { + return "0"; + } + double dw = stod(bl_quantity); + char buffer[16]; + sprintf(buffer, "%.3f", dw); + log("MENGE4:%f==%s", dw, buffer); + return buffer; + } +} +/* +* 中压通用BOM传递SAP 新 +* SAPUtil.recurZYGGSAPNoProc +*/ +void recurZYGGSAPNoProc(tag_t rev, tag_t partRev, char *groupName, tag_t line, map& gy_meops, vector& needTCM_meops, + char* now, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist, vector& bomIsExist, + vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>& list, char* codeRemark, int unct, map& by_materials, + boolean isZT, string& errMsg, map>& inCcpMap, vector ccpMaterialMap, vector matr) { + char *line_os = NULL; + ITKCALL(AOM_ask_value_string(line, "object_string", &line_os)); + log("recurZYGGSAPNoProc line:%s\n", line_os); + tag_t designRev = getZYDesign(rev); + tag_t meops = NULLTAG; + if (designRev != NULLTAG) { + meops = getProcessTag(designRev, groupName); + } + //log("1"); + int bvr_count = 0; + tag_t *bvr_list = NULL; + ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));//designRev + boolean isLj = false; //判断是否零件 + if (bvr_count == 0) { + isLj = true; + } + //tag_t partRev = getBOMPart(line, groupName); + if (partRev == NULLTAG) { + //rev = getSAPPart(designRev, groupName); + partRev = getBOMPart(line, groupName); + } + // 如果图纸下没有物料,则,判断此图纸版本上的属性zt2_Diagram属性,如果此属性为是 + //(LOV值,真实值为Y),则不传递此图纸,物料检查也不要报错,跳过此图纸以及子件 + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(rev, &type)); + if (tc_strcmp(type, "ZT2_Design3DRevision") == 0 && partRev == NULLTAG) { + char *zt2_Diagram = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_Diagram", &zt2_Diagram)); + if (tc_strcmp(zt2_Diagram, "Y") == 0 || tc_strcmp(zt2_Diagram, "是") == 0) { + return; + } + } + int c_line_count = 0; + tag_t *c_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags)); + char *zt2_Source = NULL; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_Source", &zt2_Source)); + log("zt2_Source =>%s", zt2_Source); + boolean equals = (zt2_Source && (tc_strcmp(zt2_Source, "外购") == 0 || tc_strcmp(zt2_Source, "S2") == 0)); + if (partRev != NULL) { + if (meops == NULL) { + if (!equals && c_line_count > 0) { + log("自制获取工艺路线"); + //java中getMrProcess方法已注释只返回null,因此该逻辑已无实际意义 + /*TCComponentMEProcessRevision mrProcess = getMrProcess(groupID, session); + TXTUtil.writeTXT(txtPath, "图纸[" + rev + "]工艺信息:" + mrProcess); + if (mrProcess != null) { + SAPUtil.readBopInfo1(mrProcess, partRev, session, now, + txtPath, proclist, groupName, gy_meops, needTCM_meops, false); + }*/ + } + } + else { + readBopInfo1YH(meops, partRev, true, gy_meops, needTCM_meops, groupName, now, proclist); + } + } + if (equals) { + if (partRev == NULLTAG) { + return; + } + bvr_count = 0; + tag_t *part_bvr = NULL; + ITKCALL(ITEM_rev_list_bom_view_revs(partRev, &bvr_count, &part_bvr)); + if (bvr_count > 0) { + tag_t part_window = NULLTAG, part_line = NULLTAG; + ITKCALL(BOM_create_window(&part_window)); + ITKCALL(BOM_set_window_top_line(part_window, NULL, partRev, NULLTAG, &part_line)); + int part_line_count = 0; + tag_t *part_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(part_line, &part_line_count, &part_line_tags)); + recurZYGGSAPNoProc(partRev, partRev, groupName, part_line, gy_meops, needTCM_meops, now, proclist, bomIsExist, + list, codeRemark, unct, by_materials, isZT, errMsg, inCcpMap, ccpMaterialMap, matr); + ITKCALL(BOM_close_window(part_window)); + } + return; + } + if (partRev != NULLTAG) { + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + if (vecContains(bomIsExist, zt2_MaterialNo)) { + log("%s已存在,过滤\n", zt2_MaterialNo); + return; + } + bomIsExist.push_back(zt2_MaterialNo); + } + if (c_line_count == 0) { + //char* zt2_Source = NULL; + //ITKCALL(AOM_UIF_ask_value(rev, "zt2_Source", &zt2_Source)); + if (tc_strcmp(type, "ZT2_Design3DRevision") == 0 && (tc_strcmp(zt2_Source, "自制") == 0 || tc_strcmp(zt2_Source, "S1") == 0) + && tc_strcmp(groupName, "M035") != 0) { + tag_t comp = NULLTAG; + map materials; + if (matr.size() > 1 && tc_strcmp(matr[1].c_str(), "DB") == 0) { + comp = getClassPartDB(rev, groupName, by_materials, materials, errMsg); + } + else { + comp = getClassPart(rev, codeRemark, unct, by_materials); + } + char* os = NULL, *sortno = NULL; + boolean isHaveProcess = false; + if (meops != NULL) { + tag_t meop_window = NULLTAG, meop_line = NULLTAG; + ITKCALL(BOM_create_window(&meop_window)); + ITKCALL(BOM_set_window_top_line(meop_window, NULL, meops, NULLTAG, &meop_line)); + int meop_line_count = 0; + tag_t *meop_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(meop_line, &meop_line_count, &meop_line_tags)); + for (int i = 0; i < meop_line_count; i++) { + char *bl_sequence_no = NULL; + ITKCALL(AOM_UIF_ask_value(meop_line_tags[i], "bl_sequence_no", &bl_sequence_no)); + if (tc_strcmp(bl_sequence_no, "10") == 0) { + tag_t rev2 = NULLTAG; + ITKCALL(AOM_ask_value_tag(meop_line_tags[i], "bl_line_object", &rev2)); + ITKCALL(AOM_UIF_ask_value(rev2, "zt2_ClassificationCode", &sortno)); + break; + } + } + ITKCALL(BOM_close_window(meop_window)); + isHaveProcess = true; + } + if (!sortno || tc_strlen(sortno) == 0) { + ITKCALL(AOM_ask_value_string(line, "ZT2_ClassificationNo", &sortno)); + } + log("工序编码 =>%s", sortno); + char *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL, *zt2_unit = NULL; + ITKCALL(AOM_UIF_ask_value(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + log("zt2_MaterialNo ==>%s", zt2_MaterialNo); + ITKCALL(AOM_UIF_ask_value(partRev, "zt2_WBSNo", &zt2_WBSNo)); + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items = + new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[1]; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item; + tag_t item = NULLTAG; + ITKCALL(ITEM_ask_item_of_rev(partRev, &item)); + ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit)); + //char* unit = getUnti(zt2_unit); + log("str = [%s] \n", zt2_unit); + head.PSPNR = zt2_WBSNo; + head.MATNR = zt2_MaterialNo; + head.BMEIN = zt2_unit; + head.STLAN = (char*)"1"; + head.STLAL = (char*)"1"; + head.BMENG = (char*)"1"; + head.WERKS = groupName; + head.DATUV = now; + char* parnetUid; + ITK__convert_tag_to_uid(partRev, &parnetUid); + head.STKTX = parnetUid; + inCcpMap[parnetUid] = ccpMaterialMap; + + items_item.DATUV = now; + items_item.POSTP = (char*)"L"; + items_item.POSNR = "0010"; + if (!isLj) { + if (!isHaveProcess) { + errMsg.append(line_os).append("缺少工艺路线\n"); + } + else if (!sortno || tc_strlen(sortno) == 0) { + char* mos = NULL; + ITKCALL(AOM_ask_value_string(meops, "object_string", &mos)); + errMsg.append("请维护").append(mos).append("工艺路线的工序编码\n"); + } + } + if (comp != NULLTAG) { + tag_t crev = NULLTAG; + ITKCALL(ITEM_ask_latest_rev(comp, &crev)); + ITKCALL(AOM_ask_value_string(crev, "object_string", &os)); + log("原材料 =>%s", os); + //tag_t item2; + char *zt2_MaterialNo2 = NULL, *zt2_unit2 = NULL; + ITKCALL(AOM_UIF_ask_value(crev, "zt2_MaterialNo", &zt2_MaterialNo2)); + //ITKCALL(ITEM_ask_item_of_rev(comp, &item2)); + ITKCALL(AOM_ask_value_string(comp, "zt2_unit", &zt2_unit2)); + items_item.IDNRK = zt2_MaterialNo2; + //char* unit22 = getUnti(zt2_unit2); + items_item.MEINS = zt2_unit2; + char *menge = NULL; + menge = (char*)MEM_alloc((16 + 1) * sizeof(char)); + if (matr.size() > 1 && tc_strcmp(matr[1].c_str(), "DB") == 0) { + char *zt2_MaterialMark = NULL; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_MaterialMark", &zt2_MaterialMark)); + if (materials.count(zt2_MaterialMark) > 0) { + tc_strcpy(menge, getZYSAPMENGE2(materials[zt2_MaterialMark], rev, line, true, errMsg)); + } + else { + tc_strcpy(menge, getZYSAPMENGE(rev, crev, line, true, codeRemark, errMsg)); + } + } + else { + tc_strcpy(menge, getZYSAPMENGE(rev, crev, line, true, codeRemark, errMsg)); + } + items_item.MENGE = menge; + //MEM_free(menge); + } + else { + char* mos = NULL; + ITKCALL(AOM_ask_value_string(rev, "object_string", &mos)); + errMsg.append(mos).append("未能匹配到对应的原材料\n"); + items_item.IDNRK = ""; + items_item.MEINS = ""; + items_item.MENGE = ""; + } + items_item.SORTF = sortno; + items_item.POTX1 = ""; + + items_items[0] = items_item; + items.ITEM = items_items; + items.__sizeITEM = 1;/**/ + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list1; + list1.HEAD = head; + //log("list1.HEAD %s ", list1.HEAD.BMEIN); + list1.ITEMS = items; + log("list %zd ", list.size()); + list.push_back(list1); + } + return; + } + if (partRev == NULLTAG) { + ITKCALL(AOM_ask_value_tag(line, "bl_line_object", &partRev)); + } + + char *os = NULL, *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL, *zt2_unit = NULL; + ITKCALL(AOM_ask_value_string(partRev, "object_string", &os)); + ITKCALL(AOM_UIF_ask_value(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + log("zt2_MaterialNo ==>%s", zt2_MaterialNo); + ITKCALL(AOM_UIF_ask_value(partRev, "zt2_WBSNo", &zt2_WBSNo)); + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head; + tag_t item; + ITKCALL(ITEM_ask_item_of_rev(partRev, &item)); + ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit)); + char* unit = getUnti(zt2_unit); + log("str = [%s] \n", unit); + head.PSPNR = zt2_WBSNo; + head.MATNR = zt2_MaterialNo; + head.BMEIN = unit; + head.STLAN = (char*)"1"; + head.STLAL = (char*)"1"; + head.BMENG = (char*)"1"; + head.WERKS = groupName; + head.DATUV = now; + //log("head.MENGE ===>%s", head.MENGE); + char* parnetUid; + ITK__convert_tag_to_uid(partRev, &parnetUid); + head.STKTX = parnetUid; + inCcpMap[parnetUid] = ccpMaterialMap; + + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items = + new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[c_line_count]; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items; + for (int i = 0; i < c_line_count; i++) { + string buff; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item; + tag_t c_line_tag = c_line_tags[i], rev2; + ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &rev2)); + tag_t item2, part2 = getBOMPart(c_line_tag, groupName); + char *zt2_MaterialNo2 = NULL, *zt2_unit2 = NULL, *bl_sequence_no = NULL, *sortno = NULL, *ZT2_Remark = NULL, *zt2_SapState = NULL, *type2 = NULL; + // 如果图纸下没有物料,则,判断此图纸版本上的属性zt2_Diagram属性,如果此属性为是 + //(LOV值,真实值为Y),则不传递此图纸,物料检查也不要报错,跳过此图纸以及子件 + ITKCALL(WSOM_ask_object_type2(rev2, &type2)); + if (tc_strcmp(type2, "ZT2_Design3DRevision") == 0) { + + } + ITKCALL(AOM_UIF_ask_value(part2, "zt2_MaterialNo", &zt2_MaterialNo2)); + ITKCALL(ITEM_ask_item_of_rev(rev2, &item2)); + ITKCALL(AOM_ask_value_string(item2, "zt2_unit", &zt2_unit2)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "bl_sequence_no", &bl_sequence_no)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "ZT2_ClassificationNo", &sortno)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "ZT2_Remark", &ZT2_Remark)); + ITKCALL(AOM_UIF_ask_value(rev2, "zt2_SapState", &zt2_SapState)); + + char *menge = NULL;// = getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, codeRemark, errMsg); + menge = (char*)MEM_alloc((16 + 1) * sizeof(char)); + tc_strcpy(menge, getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, codeRemark, buff)); + log("menge ===>%s", menge); + char* unit22 = getUnti(zt2_unit2); + items_item.IDNRK = zt2_MaterialNo2; + //char* unit = unit22; + items_item.MEINS = unit22; + items_item.DATUV = now; + items_item.POSTP = (char*)"L"; + items_item.POSNR = bl_sequence_no; + items_item.MENGE = menge; + items_item.SORTF = sortno; + items_item.POTX1 = ZT2_Remark; + log("items_item.MENGE ===>%s", items_item.MENGE); + //MEM_free(menge); + + items_items[i] = items_item; + char* os2 = NULL; + ITKCALL(AOM_ask_value_string(rev2, "object_string", &os2)); + string msg; + msg.append(os2).append("(父项:").append(os).append("):").append(buff); + log("buff ===>%s", buff.c_str()); + if (buff.length() > 0 && tc_strstr(errMsg.c_str(), msg.c_str()) == NULL) { + errMsg.append("\\n").append(msg); + } + if ((tc_strcmp(zt2_SapState, "已传") == 0 || tc_strcmp(zt2_SapState, "2") == 0) && !isZT) { + continue; + } + recurZYGGSAPNoProc(rev2, part2, groupName, c_line_tag, gy_meops, needTCM_meops, now, proclist, bomIsExist, + list, codeRemark, unct, by_materials, isZT, errMsg, inCcpMap, ccpMaterialMap, matr); + } + items.ITEM = items_items; + items.__sizeITEM = c_line_count; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list1; + list1.HEAD = head; + log("list1.HEAD %s ", list1.HEAD.BMEIN); + list1.ITEMS = items; + list.push_back(list1); +} +/* +* 产成品BOM传递 +* SAPZYGG2Operation +*/ +void SAPZYGG2(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName) { + log("************** SAPZYGG2 **************"); + int pref_cnt = 0; + char **pref = NULL; + string codeRemark = "ICM0801"; + vector matr; + ITKCALL(PREF_ask_char_values("CHINT_ORG_TechnologyClassification", &pref_cnt, &pref)); + for (int i = 0; i < pref_cnt; i++) { + vector v1, v2; + Split(pref[i], ":", v1); + if (tc_strcmp(v1[0].c_str(), groupName) != 0) { + continue; + } + Split(v1[1], ";", v2); + if (v2.size() == 4) { + codeRemark = v2[2]; + Split(v2[2], "\\", matr); + } + else if (v2.size() > 2) { + codeRemark = v2[2]; + } + } + //记录是否有重复的出厂编号 + vector isCheck_FactoryNos; + //记录产成品 对应的 电气BOM集合 + map> cPart_schemes; + map> mapList; + map> inCcpMap;//记录单元对应的产成品物料编码 + string sendMsg; + for (int len = 0; len < ccpVector.size(); len++) { + vector elcBoms; + tag_t rev = ccpVector[len], *factoryNos; + char* revUid; + ITK__convert_tag_to_uid(rev, &revUid); + log("产成品UID:%s", revUid); + ITKCALL(AOM_refresh(rev, FALSE)); + int num = 0; + ITKCALL(AOM_ask_value_tags(rev, "ZT2_FactoryNumber", &num, &factoryNos)); + log("出厂编号数量 num :%d\n", num); + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo)); + + vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys; + getFactoryNoList(projectNo, groupName, wbs, factoryNos, num, rev, list_Factorys); + //传递出厂编号的记录日志信息 + log("出厂编号数量:%zd", list_Factorys.size()); + logCcbh(list_Factorys); + sendFactoryNo(list_Factorys); + tag_t designRev = NULLTAG; + if (num > 0) { + int n_references = 0; + int* levels = 0; + tag_t* references_tag; + char** relation_type_name = NULL; + //通过出厂编号查找到图纸 + ITKCALL(WSOM_where_referenced(factoryNos[0], 1, &n_references, &levels, &references_tag, &relation_type_name)); + for (int i = 0; i < n_references; i++) { + if (tc_strcmp(relation_type_name[i], "ZT2_FactoryNumber") == 0) { + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(references_tag[i], &type2)); + if (tc_strcmp(type2, "ZT2_Design3DRevision") == 0) { + designRev = references_tag[i]; + break; + } + } + } + } + + tag_t ebom_window = NULLTAG, line = NULLTAG; + ITKCALL(BOM_create_window(&ebom_window)); + if (designRev == NULLTAG) { + ITKCALL(BOM_set_window_top_line(ebom_window, NULL, rev, NULLTAG, &line)); + } + else { + ITKCALL(BOM_set_window_top_line(ebom_window, NULL, designRev, NULLTAG, &line)); + } + vector <_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list; + vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + map gy_meops; //避免重复工艺路线 + vector needTCM_meops;//没用上 + vector bomIsExist; + map by_materials; + int unct = getIcsId((char*)codeRemark.c_str(), "材料标记"); + + //tag_t partRev = getBOMPart(line, groupName); + char *ccpMaterialNo = NULL; + ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &ccpMaterialNo)); + tag_t meops = getProcessTag(rev, groupName); + if (meops != NULLTAG) { + readBopInfo1YH(meops, rev, true, gy_meops, needTCM_meops, groupName, now, proclist); + } + else if (meops == NULLTAG && tc_strcmp(groupName, "M040") == 0) { + vector split; + tag_t find = NULLTAG; + Split(zt2_MaterialNo, "-", split); + ITKCALL(ITEM_find_item(split[0].c_str(), &find)); + if (find != NULLTAG) { + meops = getProcessTag(find, groupName); + if (meops != NULLTAG) { + readBopInfo1YH(meops, rev, true, gy_meops, needTCM_meops, groupName, now, proclist); + } + } + } + if (inCcpMap.count(revUid) > 0) { + log("folderName =>%s", zt2_MaterialNo); + inCcpMap[revUid].push_back(ccpMaterialNo); + continue; + } + vector ccpMaterialMap; + ccpMaterialMap.push_back(ccpMaterialNo); + inCcpMap[revUid] = ccpMaterialMap; + string errMsg = ""; + recurZYGGSAPNoProc(designRev, rev, groupName, line, gy_meops, needTCM_meops, now, proclist, bomIsExist, + list, (char*)codeRemark.c_str(), unct, by_materials, false, errMsg, inCcpMap, ccpMaterialMap, matr); + //log("errMsg =>%s", errMsg.c_str()); + string logmsg = "errMsg =>"; + //log2(logmsg.append(errMsg)); + logmsg.append(errMsg); + printf("%s\n", logmsg.c_str()); + info(logmsg.c_str()); + if (errMsg.length() > 0) { + errMsgBuf.append("BOM异常:\\n").append(errMsg); + // + string updateSum = "update CHINT_BOM_TO_SAP_SUM set \"DATASTATUS\" = '数据检查有问题' ,SAPRESULT = 'PLM检查未通过',PLMRESULT = '已发送飞书通知' where code = '%s' "; + char selectRxfs[800]; + string timel; + sprintf(selectRxfs, updateSum.c_str(), code); + log("selectRecord2 ===> %s\n", selectRxfs); + ExecuteSQLNoInputParam(selectRxfs); + ExecuteSQLNoInputParam((char*)"commit"); + + //错误数据已发送飞书提醒 + sendNotice(code, errMsgBuf, wbs, userName, projectName); + return; + } + char *zt2_BOMScheme = NULL; + ITKCALL(AOM_UIF_ask_value(rev, "zt2_BOMScheme", &zt2_BOMScheme)); + if (list.size() > 0 && strcmp(zt2_BOMScheme, "汇总") == 0) { + char* zt2_Quantity; + ITKCALL(AOM_ask_value_string(rev, "zt2_Quantity", &zt2_Quantity)); + if (strstr(zt2_Quantity, "") != 0) { + int quantity = atoi(zt2_Quantity); + if (quantity == 0) { + quantity = 1; + } + int size = list.size(); + char* s = new char[10]; + _itoa(quantity, s, 10); + list[size - 1].HEAD.BMENG = s; + //head.BMENG = (char*)to_string(quantity).c_str(); + } + } + if (list.size() > 0) { + //logBomMsg(list); + mapList[rev] = list; + } + if (proclist.size() > 0) { + logProcessMsg(proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + sendProcess(proclist, sendMsg);//proclists.push_back(proclist);//sendProcess(proclist); + } + + ITKCALL(BOM_close_window(ebom_window)); + } + if (mapList.size() > 0) { + //传递BOM + //logBomMsg(list); + //sendBom(list, sendMsg); + startSplitSend(groupName, mapList, code, wbs, inCcpMap); + //sendBom(list); + } + else { + string time1 = getPlmTime(code); + string updateSum = "update CHINT_BOM_TO_SAP_SUM set datastatus = '没有合法BOM',organizationaltime = '%s',taskstauts = '组织完成',PLMFINISHTIME = SYSDATE where code = '%s' "; + char selectRxfs[800]; + string timel; + sprintf(selectRxfs, updateSum.c_str(), time1.c_str(), code); + log("selectRecord2 ===> %s\n", selectRxfs); + ExecuteSQLNoInputParam(selectRxfs); + ExecuteSQLNoInputParam((char*)"commit"); + } + + +} \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/SAPZYGG2.h b/DFL_BOM_WL_TOERP/SAPZYGG2.h new file mode 100644 index 0000000..2733c22 --- /dev/null +++ b/DFL_BOM_WL_TOERP/SAPZYGG2.h @@ -0,0 +1,9 @@ +#pragma once + +//#include "util.h" +#include +#include +//#include + +void SAPZYGG2(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName); \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/SAPZZNewOp.cxx b/DFL_BOM_WL_TOERP/SAPZZNewOp.cxx new file mode 100644 index 0000000..da0ea14 --- /dev/null +++ b/DFL_BOM_WL_TOERP/SAPZZNewOp.cxx @@ -0,0 +1,655 @@ + +#include "SendSap.h" + +tag_t getZZDesign(tag_t part, char* groupName) { + int num = 0; + tag_t *comps = NULL; + ITKCALL(AOM_ask_value_tags(part, "ZT2_FactoryNumber", &num, &comps)); + for (int i = 0; i < num; i++) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(comps[i], &type)); + if (tc_strcmp(type, "ZT2_FactoryNo") == 0 && tc_strcmp(groupName, "M040") != 0) { + int n_references = 0; + int* levels = 0; + tag_t* references_tag, processTag = NULLTAG; + char** relation_type_name = NULL; + ITKCALL(WSOM_where_referenced(comps[i], 1, &n_references, &levels, &references_tag, &relation_type_name)); + for (int j = 0; j < n_references; j++) { + if (tc_strcmp(relation_type_name[j], "ZT2_FactoryNumber") != 0) { + continue; + } + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(references_tag[j], &type2)); + if (tc_strcmp(type2, "ZT2_Design3DRevision") != 0) { + continue; + } + tag_t item = NULLTAG, rev = NULLTAG; + ITKCALL(ITEM_ask_item_of_rev(references_tag[j], &item)); + ITKCALL(ITEM_ask_latest_rev(item, &rev)); + return rev; + } + } + } +} + +void recurBYZZSAP(tag_t line, tag_t zzRev, tag_t partRev, char* groupName, map& gy_meops, + vector& needTCM_meops, vector bomIsExist, vector set_meops, char* transfer, char* fa, + vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>& list, + char* now, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist, int level, string& errMsg) { + int line_count = 0; + tag_t *line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(line, &line_count, &line_tags)); + tag_t meop = getProcessTag(zzRev, groupName); + if (meop != NULLTAG && !isTcm2(meop) && find(set_meops.begin(), set_meops.end(), meop) == set_meops.end()) { + set_meops.push_back(meop); + } + // 如果图纸下没有物料,则,判断此图纸版本上的属性zt2_Diagram属性 + //如果此属性为是(LOV值,真实值为Y),则不传递此图纸,物料检查也不要报错,跳过此图纸以及子件 + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(zzRev, &type)); + if (tc_strcmp(type, "ZT2_Design3DRevision") == 0 && partRev == NULLTAG) { + char *zt2_Diagram = NULL; + ITKCALL(AOM_ask_value_string(zzRev, "zt2_Diagram", &zt2_Diagram)); + if (tc_strcmp(zt2_Diagram, "Y") == 0 || tc_strcmp(zt2_Diagram, "是") == 0) { + return; + } + } + char *zt2_Source = NULL; + ITKCALL(AOM_UIF_ask_value(zzRev, "zt2_Source", &zt2_Source)); + boolean equals = tc_strcmp(zt2_Source, "外购") == 0; + int c_line_count = 0; + tag_t *c_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags)); + if (partRev != NULLTAG) { + if (meop == NULLTAG) { + if (!equals && (tc_strcmp(transfer, "C") == 0 || tc_strcmp(transfer, "E") == 0 && c_line_count > 0)) { + //java中getMrProcess方法已注释只返回null,因此该逻辑已无实际意义 + + } + } + else { + if (level == 1) { + readBopInfo1YH(meop, zzRev, false, gy_meops, needTCM_meops, groupName, now, proclist); + } + else { + readBopInfo1YH(meop, zzRev, true, gy_meops, needTCM_meops, groupName, now, proclist); + } + } + } + if (equals) { + if (partRev == NULLTAG) + return; + int bvr_count = 0; + tag_t *part_bvr = NULL; + ITKCALL(ITEM_rev_list_bom_view_revs(partRev, &bvr_count, &part_bvr)); + if (bvr_count > 0) { + tag_t part_window = NULLTAG, part_line = NULLTAG; + ITKCALL(BOM_create_window(&part_window)); + ITKCALL(BOM_set_window_top_line(part_window, NULL, partRev, NULLTAG, &part_line)); + int part_line_count = 0; + tag_t *part_line_tags = NULL; + ITKCALL(BOM_line_ask_all_child_lines(part_line, &part_line_count, &part_line_tags)); + recurBYZZSAP(part_line, zzRev, partRev, groupName, gy_meops, needTCM_meops, bomIsExist, set_meops, transfer, fa, + list, now, proclist, level, errMsg); + ITKCALL(BOM_close_window(part_window)); + } + return; + } + if (partRev != NULLTAG) { + char *zt2_MaterialNo = NULL; + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + if (vecContains(bomIsExist, zt2_MaterialNo)) { + log("%s已存在,过滤\n", zt2_MaterialNo); + return; + } + bomIsExist.push_back(zt2_MaterialNo); + } + if (c_line_count == 0) { + return; + } + char *os = NULL; + ITKCALL(AOM_ask_value_string(partRev, "object_string", &os)); + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head; + if (partRev != NULLTAG) { + char *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL, *zt2_unit = NULL; + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo)); + ITKCALL(AOM_ask_value_string(partRev, "zt2_WBSNo", &zt2_WBSNo)); + tag_t item; + ITKCALL(ITEM_ask_item_of_rev(partRev, &item)); + ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit)); + char* unit = getUnti(zt2_unit); + log("str = [%s] \n", unit); + head.PSPNR = zt2_WBSNo; + head.MATNR = zt2_MaterialNo; + head.BMEIN = unit; + char* parnetUid; + ITK__convert_tag_to_uid(partRev, &parnetUid); + head.STKTX = parnetUid; + } + head.STLAN = (char*)"1"; + head.STLAL = (char*)"1"; + head.BMENG = (char*)"1"; + head.WERKS = groupName; + head.DATUV = now; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items = + new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[c_line_count]; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items; + for (int i = 0; i < c_line_count; i++) { + string buff; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item; + tag_t c_line_tag = c_line_tags[i], rev2; + ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &rev2)); + tag_t partRev2 = getBOMPart(rev2, groupName); + int c_line_count2 = 0; + tag_t *c_line_tags2 = NULL; + ITKCALL(BOM_line_ask_all_child_lines(c_line_tag, &c_line_count2, &c_line_tags2)); + + boolean isContinue = true; + char *type2 = NULL; + ITKCALL(WSOM_ask_object_type2(rev2, &type2)); + if (tc_strcmp(type2, "ZT2_Design3DRevision") == 0) { + if (partRev2 == NULLTAG) { + char *zt2_Diagram = NULL; + ITKCALL(AOM_ask_value_string(rev2, "zt2_Diagram", &zt2_Diagram)); + if (tc_strcmp(zt2_Diagram, "Y") == 0 || tc_strcmp(zt2_Diagram, "是") == 0) { + continue; + } + } + int pcnt = 0; + tag_t *ps = NULL; + ITKCALL(AOM_ask_value_tags(rev2, "representation_for", &pcnt, &ps)); + if (tc_strcmp(fa, "B") == 0) { + if (c_line_count2 == 0 && pcnt > 1) { + isContinue = false; + } + } + else if (c_line_count2 == 0 && pcnt >= 1) { + isContinue = false; + } + } + char *zt2_MaterialNo2 = NULL, *zt2_unit2 = NULL; + if (partRev2 != NULLTAG) { + ITKCALL(AOM_UIF_ask_value(partRev2, "zt2_MaterialNo", &zt2_MaterialNo2)); + tag_t item2 = NULLTAG; + ITKCALL(ITEM_ask_item_of_rev(partRev2, &item2)); + ITKCALL(AOM_ask_value_string(item2, "zt2_unit", &zt2_unit2)); + char* unit22 = getUnti(zt2_unit2); + //char* unit = unit22; + items_item.IDNRK = zt2_MaterialNo2; + items_item.MEINS = unit22; + char *zt2_State = NULL; + ITKCALL(AOM_UIF_ask_value(partRev2, "zt2_State", &zt2_State)); + if (tc_strcmp(zt2_State, "封存") == 0 || tc_strcmp(zt2_State, "D1") == 0) { + buff.append("物料:").append(zt2_MaterialNo2).append("已封存,无法传递SAP;"); + } + } + + char *bl_sequence_no = NULL, *sortno = NULL, *ZT2_Remark = NULL, *zt2_SapState = NULL; + ITKCALL(AOM_UIF_ask_value(c_line_tag, "bl_sequence_no", &bl_sequence_no)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "ZT2_ClassificationNo", &sortno)); + ITKCALL(AOM_UIF_ask_value(c_line_tag, "ZT2_Remark", &ZT2_Remark)); + ITKCALL(AOM_UIF_ask_value(rev2, "zt2_SapState", &zt2_SapState)); + + char *menge = NULL;// = getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, codeRemark, errMsg); + menge = (char*)MEM_alloc((16 + 1) * sizeof(char)); + tc_strcpy(menge, getZYSAPMENGE(rev2, NULLTAG, c_line_tag, false, "ICM0801", errMsg)); + items_item.DATUV = now; + items_item.POSTP = (char*)"L"; + items_item.POSNR = bl_sequence_no; + items_item.MENGE = menge; + items_item.SORTF = sortno; + if (!sortno || tc_strlen(sortno) == 0) { + buff.append("BOM行缺少投料信息;"); + } + items_item.POTX1 = ZT2_Remark; + + items_items[i] = items_item; + char* os2 = NULL; + ITKCALL(AOM_ask_value_string(rev2, "object_string", &os2)); + string msg; + msg.append(os2).append("(父项:").append(os).append("):").append(buff); + log("buff ===== %s\n", buff.c_str()); + if (buff.length() > 0 && strstr(errMsg.c_str(), msg.c_str()) == NULL) { + errMsg.append("\n").append(msg); + } + if (tc_strcmp(zt2_SapState, "已传") == 0 && isContinue) { + continue; + } + recurBYZZSAP(c_line_tag, rev2, partRev2, groupName, gy_meops, needTCM_meops, bomIsExist, set_meops, transfer, fa, + list, now, proclist, level, errMsg); + } + items.ITEM = items_items; + items.__sizeITEM = c_line_count; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list1; + list1.HEAD = head; + log("list1.HEAD %s\n ", list1.HEAD.BMEIN); + list1.ITEMS = items; + list.push_back(list1); +} + +char* getZYCCPSortNo(tag_t comp) { + int ref_cnt = 0; + tag_t *refs = NULLTAG; + ITKCALL(AOM_ask_value_tags(comp, "IMAN_reference", &ref_cnt, &refs)); + for (int i = 0; i < ref_cnt; i++) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(refs[i], &type)); + if (tc_strcmp(type, "MEOPRevision") == 0) { + char *zt2_ClassificationCode = NULL; + ITKCALL(AOM_UIF_ask_value(refs[i], "zt2_ClassificationCode", &zt2_ClassificationCode)); + return zt2_ClassificationCode; + } + } + /* + * 没有时根据ZT2_Design3Drevision的zt2_DrawingNo属性(去掉后面的“-XXX”)查找对象, + * 获取对象的引用中MEOPRevision类型对象,获取属性zt2_ClassificationCode + */ + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(comp, &type)); + if (tc_strcmp(type, "ZT2_Design3Drevision") == 0) { + char *drawingNo = NULL; + ITKCALL(AOM_ask_value_string(comp, "zt2_DrawingNo", &drawingNo)); + if (!drawingNo || tc_strlen(drawingNo) == 0) { + return ""; + } + tag_t query_tag = NULLTAG; + ITKCALL(QRY_find2("chint_query_TYDH", &query_tag)); + if (query_tag == NULL) { + return NULLTAG; + } + char **qkey = NULL, **qvalue = NULL;// (char*)qs.c_str(); + int num_found = 0; + tag_t *qresult = NULL; + qkey = (char **)MEM_alloc(1 * sizeof(char*)); + qvalue = (char **)MEM_alloc(1 * sizeof(char*)); + qkey[0] = (char *)MEM_alloc((tc_strlen("DrawingNo") + 1)*sizeof(char)); + tc_strcpy(qkey[0], "DrawingNo"); + vector v1; + Split(drawingNo, "-", v1); + if (v1.size() > 1) { + //int size = tc_strlen(drawingNo) - tc_strlen(v1[v1.size() - 1].c_str() - 1); + //fields["DrawingNo"] = v1[0]; + qvalue[0] = (char *)MEM_alloc((tc_strlen(v1[0].c_str()) + 1)*sizeof(char)); + tc_strcpy(qvalue[0], v1[0].c_str()); + } + else { + //fields["DrawingNo"] = drawingNo; + qvalue[0] = (char *)MEM_alloc((tc_strlen(drawingNo) + 1)*sizeof(char)); + tc_strcpy(qvalue[0], drawingNo); + } + ITKCALL(QRY_execute(query_tag, 1, qkey, qvalue, &num_found, &qresult)); + if (num_found == 1) { + int ref_cnt = 0; + tag_t *refs = NULL; + ITKCALL(AOM_ask_value_tags(qresult[0], "IMAN_reference", &ref_cnt, &refs)); + for (int i = 0; i < ref_cnt; i++) { + char *type = NULL; + ITKCALL(WSOM_ask_object_type2(refs[i], &type)); + if (tc_strcmp(type, "MEOPRevision") == 0) { + char *zt2_ClassificationCode = NULL; + ITKCALL(AOM_UIF_ask_value(refs[i], "zt2_ClassificationCode", &zt2_ClassificationCode)); + return zt2_ClassificationCode; + } + } + } + } + return ""; +} + +void SAPZZNewOp(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* type) { + + log("************** SAPZZNewOp **************"); + map> mapList; + string sendMsg; + map> inCcpMap;//记录单元对应的产成品物料编码 + for (int len = 0; len < ccpVector.size(); len++) { + char* revUid; + tag_t rev = ccpVector[len]; + ITK__convert_tag_to_uid(rev, &revUid); + log("产成品UID:%s\n", revUid); + tag_t partRev = getSAPPart(ccpVector[len], groupName); + char *ccpMaterialNo = NULL; + ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &ccpMaterialNo)); + char *os = NULL; + ITKCALL(AOM_UIF_ask_value(partRev, "object_string", &os)); + tag_t zzRev = getZZDesign(partRev, groupName); + if (zzRev == NULLTAG && tc_strcmp(type, "E") != 0) { + errMsgBuf.append("总装图 ").append(os).append(" 未关联出厂编号!!变压器跳过、互感电容走中压;"); + return; + } + if (tc_strcmp(type, "E") == 0) { + zzRev = getZYDesign(partRev); + } + if (zzRev == NULLTAG) { + return; + } + tag_t window = NULLTAG, line = NULLTAG; + ITKCALL(BOM_create_window(&window)); + ITKCALL(BOM_set_window_top_line(window, NULL, zzRev, NULLTAG, &line)); + vector <_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list; + vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + map gy_meops; //避免重复工艺路线 + vector needTCM_meops;//没用上 + vector bomIsExist; + map by_materials; + vector set_meops; + string errMsg = ""; + if (inCcpMap.count(revUid) > 0) { + //log("folderName = {} \n", zt2_MaterialNo); + inCcpMap[revUid].push_back(ccpMaterialNo); + continue; + } + vector ccpMaterialMap; + ccpMaterialMap.push_back(ccpMaterialNo); + inCcpMap[revUid] = ccpMaterialMap; + + recurBYZZSAP(line, zzRev, partRev, groupName, gy_meops, needTCM_meops, bomIsExist, set_meops, transfer, type, + list, now, proclist, 1, errMsg); + //log("errMsg =>%s", errMsg.c_str()); + string logmsg = "errMsg =>"; + //log2(logmsg.append(errMsg)); + logmsg.append(errMsg); + printf("%s\n", logmsg.c_str()); + info(logmsg.c_str()); + if (list.size() > 0) { + //logBomMsg(list); + mapList[partRev] = list; + } + if (proclist.size() > 0) { + logProcessMsg(proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + sendProcess(proclist, sendMsg);//proclists.push_back(proclist);//sendProcess(proclist); + } + ITKCALL(BOM_close_window(window)); + } + if (mapList.size() > 0) { + //传递BOM + //logBomMsg(list); + //sendBom(list, sendMsg); + startSplitSend(groupName, mapList, code, wbs, inCcpMap); + //sendBom(list); + } + else { + string time1 = getPlmTime(code); + string updateSum = "update CHINT_BOM_TO_SAP_SUM set datastatus = '没有合法BOM',organizationaltime = '%s',taskstauts = '组织完成',PLMFINISHTIME = SYSDATE where code = '%s' "; + char selectRxfs[800]; + string timel; + sprintf(selectRxfs, updateSum.c_str(), time1.c_str(), code); + log("selectRecord2 ===> %s\n", selectRxfs); + ExecuteSQLNoInputParam(selectRxfs); + ExecuteSQLNoInputParam((char*)"commit"); + } +} + +/** +* 壳体方案传递SAP +* @param ccpVector 产成品的集合 +* @param projectNo 项目编号 +* @param groupName 用户所在的组 +* @param wbs 项目的WBS号 +* @param now 当前时间 +* @param errMsgBuf 错误信息 +* @param code 传递的编号code +* @param transfer 传递类型 电气设计 +* @param userName 用户名称 +* @param projectName 项目名称 +*/ +void getKTBom(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName) { + log("************** getKTBom **************"); + //记录是否有重复的出厂编号 + vector isCheck_FactoryNos; + //记录产成品 对应的 电气BOM集合 + map> cPart_schemes; + vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys; + map> mapList; + map> inCcpMap;//记录单元对应的产成品物料编码 + boolean isCheckProduct = tc_strcmp(groupName, "M035") == 0; + string sendMsg = ""; + for (int len = 0; len < ccpVector.size(); len++) { + tag_t cPart = ccpVector[len], *factoryNos; + char* ccpUid; + ITK__convert_tag_to_uid(cPart, &ccpUid); + log("产成品UID:%s\n", ccpUid); + ITKCALL(AOM_refresh(cPart, FALSE)); + int num = 0; + ITKCALL(AOM_ask_value_tags(cPart, "ZT2_FactoryNumber", &num, &factoryNos)); + if (num > 0 && cPart_schemes.count(cPart) == 0) { + getFactoryNoList(projectNo, groupName, wbs, factoryNos, num, cPart, list_Factorys); + map> items2; + for (int i = 0; i < num; i++) { + tag_t factoryNo = factoryNos[i]; + if (std::find(isCheck_FactoryNos.begin(), isCheck_FactoryNos.end(), factoryNo) != isCheck_FactoryNos.end()) + continue; + isCheck_FactoryNos.push_back(factoryNos[i]); + + int n_references = 0; + int* levels = 0; + tag_t* references_tag; + char** relation_type_name = NULL; + //通过引用关系查找到变更单 + ITKCALL(WSOM_where_referenced(factoryNo, 1, &n_references, &levels, &references_tag, &relation_type_name)); + tag_t ccpItem; + char* ccpItemUid; + ITEM_ask_item_of_rev(cPart, &ccpItem); + ITK__convert_tag_to_uid(ccpItem, &ccpItemUid); + for (int j = 0; j < n_references; j++) { + char* refType, *grpName, *useUid, *object_name, *zt2_SapState; + tag_t refTag = references_tag[i], group, item; + ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType)); + if (strcmp(refType, "Part Revision") != 0) { + continue; + } + ITK__convert_tag_to_uid(refTag, &useUid); + //判断不是产成品 并且同一组 + ITKCALL(AOM_ask_value_tag(refTag, "owning_group", &group)); + ITKCALL(AOM_ask_value_string(group, "name", &grpName)); + if (strcmp(grpName, groupName) != 0 || strcmp(ccpUid, useUid) == 0) + continue; + ITKCALL(AOM_UIF_ask_value(refTag, "object_name", &object_name)); + ITKCALL(AOM_UIF_ask_value(refTag, "zt2_SapState", &zt2_SapState)); + if (strcmp(zt2_SapState, "1") == 0 || strcmp(zt2_SapState, "未传") == 0) { + continue; + } + ITKCALL(ITEM_ask_item_of_rev(refTag, &item)); + char* unitUid; + ITK__convert_tag_to_uid(item, &unitUid); + if (strcmp(unitUid, ccpItemUid) == 0) { + continue; + } + log("useUid %s object_name %s \n", useUid, object_name); + if (items2.count(item) > 0) { + items2[item].push_back(refTag); + } + else { + vector revs2; + revs2.push_back(refTag); + items2[item] = revs2; + } + } + } + vector rev2 = addLastRev(items2); + cPart_schemes[cPart] = rev2; + } + if (isCheckProduct) { + + } + //} + //传递出厂编号的记录日志信息 + log("出厂编号数量 num :%zd\n", list_Factorys.size()); + logCcbh(list_Factorys); + sendFactoryNo(list_Factorys); + + vector <_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list; + vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + map gy_meops; //避免重复工艺路线 + vector needTCM_meops;//没用上 + //for (int len = 0; len < ccpVector.size(); len++) { + //list.clear(); + //proclist.clear(); + //tag_t cPart = ccpVector[len]; + vector revs = cPart_schemes[cPart]; + // 有关联 + if (cPart_schemes.count(cPart) != 0 && revs.size() > 0) { + char *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL, *zt2_unit2 = NULL; + ITKCALL(AOM_UIF_ask_value(cPart, "zt2_MaterialNo", &zt2_MaterialNo)); + ITKCALL(AOM_UIF_ask_value(cPart, "zt2_WBSNo", &zt2_WBSNo)); + tag_t item2 = NULLTAG; + ITKCALL(ITEM_ask_item_of_rev(cPart, &item2)); + ITKCALL(AOM_ask_value_string(item2, "zt2_unit", &zt2_unit2)); + char* unit = getUnti(zt2_unit2); + tag_t meops = getProcessTag(cPart, groupName); + if (meops == NULLTAG) { + vector v1; + Split(zt2_MaterialNo, "-", v1); + tag_t query_tag = NULLTAG; + ITKCALL(QRY_find2("chint_query_item", &query_tag)); + char **qkey = NULL, **qvalue = NULL, *qprop = (char*)v1[0].c_str(); + int num_found = 0; + tag_t *qresult = NULL; + qkey = (char **)MEM_alloc(1 * sizeof(char*)); + qvalue = (char **)MEM_alloc(1 * sizeof(char*)); + qkey[0] = (char *)MEM_alloc((tc_strlen("ID") + 1)*sizeof(char)); + qvalue[0] = (char *)MEM_alloc((tc_strlen(qprop) + 1)*sizeof(char)); + tc_strcpy(qkey[0], "ID"); + tc_strcpy(qvalue[0], qprop); + ITKCALL(QRY_execute(query_tag, 1, qkey, qvalue, &num_found, &qresult)); + log("chint_query_item ID:%s==>%d", qprop, num_found); + if (num_found > 0) { + tag_t found_rev = NULLTAG; + ITKCALL(ITEM_ask_latest_rev(qresult[0], &found_rev)); + meops = getProcessTag(found_rev, groupName); + } + } + if (meops != NULLTAG) { + readBopInfo1YH(meops, cPart, true, gy_meops, needTCM_meops, groupName, now, proclist); + } + int c_line_count = 0; + tag_t *c_line_tags = NULL, ebom_window = NULLTAG, line = NULLTAG; + ITKCALL(BOM_create_window(&ebom_window)); + ITKCALL(BOM_set_window_top_line(ebom_window, NULL, meops, NULLTAG, &line)); + ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags)); + char *ktSortno = NULL; + if (c_line_count > 0) { + tag_t rev = NULLTAG; + ITKCALL(AOM_ask_value_tag(c_line_tags[0], "bl_revision", &rev)); + ITKCALL(AOM_UIF_ask_value(rev, "zt2_ClassificationCode", &ktSortno)); + } + ITKCALL(BOM_close_window(ebom_window)); + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head; + log("str = [%s] \n", unit); + head.PSPNR = zt2_WBSNo; + head.MATNR = zt2_MaterialNo; + head.BMEIN = unit; + head.STLAN = (char*)"1"; + head.STLAL = (char*)"1"; + head.BMENG = (char*)"1"; + head.WERKS = groupName; + head.DATUV = now; + char* parnetUid; + ITK__convert_tag_to_uid(cPart, &parnetUid); + head.STKTX = parnetUid; + char *type = NULL, *zt2_BOMScheme = NULL; + ITKCALL(WSOM_ask_object_type2(cPart, &type)); + ITKCALL(AOM_UIF_ask_value(cPart, "zt2_BOMScheme", &zt2_BOMScheme)); + if (strcmp(type, "Part Revision") == 0 && strcmp(zt2_BOMScheme, "汇总") == 0) { + char *zt2_Quantity = NULL; + ITKCALL(AOM_UIF_ask_value(cPart, "zt2_Quantity", &zt2_Quantity)); + string bmeng = zt2_Quantity; + if (tc_strcmp(groupName, "M041") != 0) { + if (!zt2_Quantity || tc_strlen(zt2_Quantity) == 0 || strcmp(zt2_Quantity, "0") == 0) { + bmeng = "1"; + } + } + head.BMENG = (char*)bmeng.c_str(); + } + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items = + new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[revs.size()]; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items; + for (int i = 0; i < revs.size(); i++) { + tag_t schem = revs[i]; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item; + tag_t item22 = NULLTAG; + char *zt2_unit22 = NULL, *zt2_MaterialNo2 = NULL, *object_name = NULL; + ITKCALL(ITEM_ask_item_of_rev(schem, &item22)); + ITKCALL(AOM_ask_value_string(item22, "zt2_unit", &zt2_unit22)); + ITKCALL(AOM_UIF_ask_value(schem, "zt2_MaterialNo", &zt2_MaterialNo2)); + ITKCALL(AOM_UIF_ask_value(schem, "object_name", &object_name)); + char* unit22 = getUnti(zt2_unit22); + items_item.MEINS = unit22; + items_item.DATUV = now; + items_item.POSTP = (char*)"L"; + char posnr[5] = ""; + sprintf(posnr, "%04d", (i + 1) * 10); + items_item.POSNR = posnr; + items_item.IDNRK = zt2_MaterialNo2; + items_item.MENGE = "1"; + if (tc_strstr(object_name, "壳体") != NULL) { + items_item.SORTF = ktSortno; + } + else if (tc_strstr(object_name, "二次规范书") != NULL) { + tag_t meops2 = getProcessTag(schem, groupName); + if (meops2 != NULLTAG) { + int c_line_count2 = 0; + tag_t *c_line_tags2 = NULL, ebom_window2 = NULLTAG, line2 = NULLTAG; + ITKCALL(BOM_create_window(&ebom_window2)); + ITKCALL(BOM_set_window_top_line(ebom_window2, NULL, meops2, NULLTAG, &line2)); + ITKCALL(BOM_line_ask_all_child_lines(line2, &c_line_count2, &c_line_tags2)); + char *ktSortno2 = NULL; + if (c_line_count2 > 0) { + tag_t rev = NULLTAG; + ITKCALL(AOM_ask_value_tag(c_line_tags2[0], "bl_revision", &rev)); + ITKCALL(AOM_UIF_ask_value(rev, "zt2_ClassificationCode", &ktSortno2)); + items_item.SORTF = ktSortno2; + } + else { + items_item.SORTF = ""; + } + ITKCALL(BOM_close_window(ebom_window2)); + } + else { + items_item.SORTF = ""; + } + } + else { + items_item.SORTF = getZYCCPSortNo(schem); + } + items_item.POTX1 = ""; + items_items[i] = items_item; + } + items.ITEM = items_items; + items.__sizeITEM = c_line_count; + _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list1; + list1.HEAD = head; + log("list1.HEAD %s\n ", list1.HEAD.BMEIN); + list1.ITEMS = items; + list.push_back(list1); + + if (list.size() > 0) { + //logBomMsg(list); + mapList[cPart] = list; + } + if (proclist.size() > 0) { + logProcessMsg(proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist; + sendProcess(proclist, sendMsg);//proclists.push_back(proclist);//sendProcess(proclist); + } + } + } + if (mapList.size() > 0) { + //传递BOM + //logBomMsg(list); + //sendBom(list, sendMsg); + startSplitSend(groupName, mapList, code, wbs, inCcpMap); + //sendBom(list); + } + else { + string time1 = getPlmTime(code); + string updateSum = "update CHINT_BOM_TO_SAP_SUM set datastatus = '没有合法BOM',organizationaltime = '%s',taskstauts = '组织完成',PLMFINISHTIME = SYSDATE where code = '%s' "; + char selectRxfs[800]; + string timel; + sprintf(selectRxfs, updateSum.c_str(), time1.c_str(), code); + log("selectRecord2 ===> %s\n", selectRxfs); + ExecuteSQLNoInputParam(selectRxfs); + ExecuteSQLNoInputParam((char*)"commit"); + } +} \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/SendSap.h b/DFL_BOM_WL_TOERP/SendSap.h new file mode 100644 index 0000000..aa62faa --- /dev/null +++ b/DFL_BOM_WL_TOERP/SendSap.h @@ -0,0 +1,40 @@ +#pragma once +/* +#include "util.h" +#include "dfl_custom.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include */ +#include +#include +#include "soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.h" +#include "soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.h" +#include "soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.h" +#include "ocilib.h" +#include "dfl_custom.h" +#include "util.h" +using namespace std; + +tag_t getProcessTag(tag_t mantr, char* groupName); +boolean isTcm2(tag_t mantr); +void getFactoryNoList(char* projectNo, char* groupName, char* wbs, + tag_t* factoryNos, int num, tag_t ccp, vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM>& list); +void logCcbh(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys); +void sendFactoryNo(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys); +void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag, + map& gy_meops, vector& needTCM_meops, + char* groupName, char* now, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist); +char* getUnti(char* unti); +void startSplitSend(char*groupId, + map> mapList, + char *code, char *wbsNo, map> inCcpMap); +string getPlmTime(char *code); +void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist); +void sendProcess(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist, string& sendMsg); +void sendNotice(char *code, string errMsg, char *wbsNo, char *userName, char* projectName); \ No newline at end of file diff --git a/DFL_BOM_WL_TOERP/dfl_custom.h b/DFL_BOM_WL_TOERP/dfl_custom.h index 48b8143..cb18dff 100644 --- a/DFL_BOM_WL_TOERP/dfl_custom.h +++ b/DFL_BOM_WL_TOERP/dfl_custom.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #define EPM_HANDLER_COMMON @@ -18,9 +19,27 @@ using namespace std; #define ERROR_QRY_NOT_FOUND (EMH_USER_error_base + 120) -int readBomMsg(vector uidList,char * groupName,char* groupUid, char*code, char*userName); +//int readBomMsg(vector uidList,char * groupName,char* groupUid, char*code, char*userName); +void getCcpAndBom(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName); void Split(string strArg, string spliter, vector& ans); +tag_t getSAPPart(tag_t rev, char* groupName); +tag_t getZYDesign(tag_t rev); +boolean vecContains(vector vec, string str); +char* getZYSAPMENGE(tag_t design, tag_t part, tag_t line, boolean isBottom, char* codeMark, string& errMsg); +tag_t getBOMPart(tag_t line, char* groupName); +vector addLastRev(map> items2); + +void SAPZYGG2(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName); + +void SAPZZNewOp(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* type); + +void getKTBom(vector ccpVector, char* projectNo, char* groupName, char* wbs, + char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName); + typedef struct { string ID; }DFL_ID; diff --git a/DFL_BOM_WL_TOERP/tinyxml/tinystr.cpp b/DFL_BOM_WL_TOERP/tinyxml/tinystr.cpp new file mode 100644 index 0000000..0665768 --- /dev/null +++ b/DFL_BOM_WL_TOERP/tinyxml/tinystr.cpp @@ -0,0 +1,111 @@ +/* +www.sourceforge.net/projects/tinyxml + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TIXML_USE_STL + +#include "tinystr.h" + +// Error value for find primitive +const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); + + +// Null rep. +TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; + + +void TiXmlString::reserve (size_type cap) +{ + if (cap > capacity()) + { + TiXmlString tmp; + tmp.init(length(), cap); + memcpy(tmp.start(), data(), length()); + swap(tmp); + } +} + + +TiXmlString& TiXmlString::assign(const char* str, size_type len) +{ + size_type cap = capacity(); + if (len > cap || cap > 3*(len + 8)) + { + TiXmlString tmp; + tmp.init(len); + memcpy(tmp.start(), str, len); + swap(tmp); + } + else + { + memmove(start(), str, len); + set_size(len); + } + return *this; +} + + +TiXmlString& TiXmlString::append(const char* str, size_type len) +{ + size_type newsize = length() + len; + if (newsize > capacity()) + { + reserve (newsize + capacity()); + } + memmove(finish(), str, len); + set_size(newsize); + return *this; +} + + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) +{ + TiXmlString tmp; + tmp.reserve(a.length() + b.length()); + tmp += a; + tmp += b; + return tmp; +} + +TiXmlString operator + (const TiXmlString & a, const char* b) +{ + TiXmlString tmp; + TiXmlString::size_type b_len = static_cast( strlen(b) ); + tmp.reserve(a.length() + b_len); + tmp += a; + tmp.append(b, b_len); + return tmp; +} + +TiXmlString operator + (const char* a, const TiXmlString & b) +{ + TiXmlString tmp; + TiXmlString::size_type a_len = static_cast( strlen(a) ); + tmp.reserve(a_len + b.length()); + tmp.append(a, a_len); + tmp += b; + return tmp; +} + + +#endif // TIXML_USE_STL diff --git a/DFL_BOM_WL_TOERP/tinyxml/tinystr.h b/DFL_BOM_WL_TOERP/tinyxml/tinystr.h new file mode 100644 index 0000000..89cca33 --- /dev/null +++ b/DFL_BOM_WL_TOERP/tinyxml/tinystr.h @@ -0,0 +1,305 @@ +/* +www.sourceforge.net/projects/tinyxml + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TIXML_USE_STL + +#ifndef TIXML_STRING_INCLUDED +#define TIXML_STRING_INCLUDED + +#include +#include + +/* The support for explicit isn't that universal, and it isn't really + required - it is used to check that the TiXmlString class isn't incorrectly + used. Be nice to old compilers and macro it here: +*/ +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + #define TIXML_EXPLICIT explicit +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + #define TIXML_EXPLICIT explicit +#else + #define TIXML_EXPLICIT +#endif + + +/* + TiXmlString is an emulation of a subset of the std::string template. + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. + Only the member functions relevant to the TinyXML project have been implemented. + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase + a string and there's no more room, we allocate a buffer twice as big as we need. +*/ +class TiXmlString +{ + public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString & copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) + { + init( static_cast( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + TiXmlString& operator = (const char * copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + TiXmlString& operator = (const TiXmlString & copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char * suffix) + { + return append(suffix, static_cast( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString & suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char * c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char * data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + + private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast( rep_ ) ); + } + } + + Rep * rep_; + static Rep nullrep_; + +} ; + + +inline bool operator == (const TiXmlString & a, const TiXmlString & b) +{ + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare +} +inline bool operator < (const TiXmlString & a, const TiXmlString & b) +{ + return strcmp(a.c_str(), b.c_str()) < 0; +} + +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } + +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString & a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString & b); + + +/* + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. + Only the operators that we need for TinyXML have been developped. +*/ +class TiXmlOutStream : public TiXmlString +{ +public : + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const TiXmlString & in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const char * in) + { + *this += in; + return *this; + } + +} ; + +#endif // TIXML_STRING_INCLUDED +#endif // TIXML_USE_STL diff --git a/DFL_BOM_WL_TOERP/tinyxml/tinyxml.cpp b/DFL_BOM_WL_TOERP/tinyxml/tinyxml.cpp new file mode 100644 index 0000000..fb3ed5a --- /dev/null +++ b/DFL_BOM_WL_TOERP/tinyxml/tinyxml.cpp @@ -0,0 +1,1886 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#include + +#ifdef TIXML_USE_STL +#include +#include +#endif + +#include "tinyxml.h" + +FILE* TiXmlFOpen( const char* filename, const char* mode ); + +bool TiXmlBase::condenseWhiteSpace = true; + +// Microsoft compiler security +FILE* TiXmlFOpen( const char* filename, const char* mode ) +{ + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + FILE* fp = 0; + errno_t err = fopen_s( &fp, filename, mode ); + if ( !err && fp ) + return fp; + return 0; + #else + return fopen( filename, mode ); + #endif +} + +void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) +{ + int i=0; + + while( i<(int)str.length() ) + { + unsigned char c = (unsigned char) str[i]; + + if ( c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) + { + // Hexadecimal character reference. + // Pass through unchanged. + // © -- copyright symbol, for example. + // + // The -1 is a bug fix from Rob Laveaux. It keeps + // an overflow from happening if there is no ';'. + // There are actually 2 ways to exit this loop - + // while fails (error case) and break (semicolon found). + // However, there is no mechanism (currently) for + // this function to return an error. + while ( i<(int)str.length()-1 ) + { + outString->append( str.c_str() + i, 1 ); + ++i; + if ( str[i] == ';' ) + break; + } + } + else if ( c == '&' ) + { + outString->append( entity[0].str, entity[0].strLength ); + ++i; + } + else if ( c == '<' ) + { + outString->append( entity[1].str, entity[1].strLength ); + ++i; + } + else if ( c == '>' ) + { + outString->append( entity[2].str, entity[2].strLength ); + ++i; + } + else if ( c == '\"' ) + { + outString->append( entity[3].str, entity[3].strLength ); + ++i; + } + else if ( c == '\'' ) + { + outString->append( entity[4].str, entity[4].strLength ); + ++i; + } + else if ( c < 32 ) + { + // Easy pass at non-alpha/numeric/symbol + // Below 32 is symbolic. + char buf[ 32 ]; + + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); + #else + sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); + #endif + + //*ME: warning C4267: convert 'size_t' to 'int' + //*ME: Int-Cast to make compiler happy ... + outString->append( buf, (int)strlen( buf ) ); + ++i; + } + else + { + //char realc = (char) c; + //outString->append( &realc, 1 ); + *outString += (char) c; // somewhat more efficient function call. + ++i; + } + } +} + + +TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() +{ + parent = 0; + type = _type; + firstChild = 0; + lastChild = 0; + prev = 0; + next = 0; +} + + +TiXmlNode::~TiXmlNode() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } +} + + +void TiXmlNode::CopyTo( TiXmlNode* target ) const +{ + target->SetValue (value.c_str() ); + target->userData = userData; + target->location = location; +} + + +void TiXmlNode::Clear() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } + + firstChild = 0; + lastChild = 0; +} + + +TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) +{ + assert( node->parent == 0 || node->parent == this ); + assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); + + if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + delete node; + if ( GetDocument() ) + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + node->parent = this; + + node->prev = lastChild; + node->next = 0; + + if ( lastChild ) + lastChild->next = node; + else + firstChild = node; // it was an empty list. + + lastChild = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) +{ + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + + return LinkEndChild( node ); +} + + +TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) +{ + if ( !beforeThis || beforeThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->next = beforeThis; + node->prev = beforeThis->prev; + if ( beforeThis->prev ) + { + beforeThis->prev->next = node; + } + else + { + assert( firstChild == beforeThis ); + firstChild = node; + } + beforeThis->prev = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) +{ + if ( !afterThis || afterThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->prev = afterThis; + node->next = afterThis->next; + if ( afterThis->next ) + { + afterThis->next->prev = node; + } + else + { + assert( lastChild == afterThis ); + lastChild = node; + } + afterThis->next = node; + return node; +} + + +TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) +{ + if ( !replaceThis ) + return 0; + + if ( replaceThis->parent != this ) + return 0; + + if ( withThis.ToDocument() ) { + // A document can never be a child. Thanks to Noam. + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = withThis.Clone(); + if ( !node ) + return 0; + + node->next = replaceThis->next; + node->prev = replaceThis->prev; + + if ( replaceThis->next ) + replaceThis->next->prev = node; + else + lastChild = node; + + if ( replaceThis->prev ) + replaceThis->prev->next = node; + else + firstChild = node; + + delete replaceThis; + node->parent = this; + return node; +} + + +bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) +{ + if ( !removeThis ) { + return false; + } + + if ( removeThis->parent != this ) + { + assert( 0 ); + return false; + } + + if ( removeThis->next ) + removeThis->next->prev = removeThis->prev; + else + lastChild = removeThis->prev; + + if ( removeThis->prev ) + removeThis->prev->next = removeThis->next; + else + firstChild = removeThis->next; + + //delete removeThis; kk 不要删除 + return true; +} + +const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = firstChild; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = lastChild; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild(); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling(); + } +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild( val ); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling( val ); + } +} + + +const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = next; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = prev; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +void TiXmlElement::RemoveAttribute( const char * name ) +{ + #ifdef TIXML_USE_STL + TIXML_STRING str( name ); + TiXmlAttribute* node = attributeSet.Find( str ); + #else + TiXmlAttribute* node = attributeSet.Find( name ); + #endif + if ( node ) + { + attributeSet.Remove( node ); + delete node; + } +} + +const TiXmlElement* TiXmlNode::FirstChildElement() const +{ + const TiXmlNode* node; + + for ( node = FirstChild(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const +{ + const TiXmlNode* node; + + for ( node = FirstChild( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement() const +{ + const TiXmlNode* node; + + for ( node = NextSibling(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const +{ + const TiXmlNode* node; + + for ( node = NextSibling( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlDocument* TiXmlNode::GetDocument() const +{ + const TiXmlNode* node; + + for( node = this; node; node = node->parent ) + { + if ( node->ToDocument() ) + return node->ToDocument(); + } + return 0; +} + + +TiXmlElement::TiXmlElement (const char * _value) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} + + +#ifdef TIXML_USE_STL +TiXmlElement::TiXmlElement( const std::string& _value ) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} +#endif + + +TiXmlElement::TiXmlElement( const TiXmlElement& copy) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + copy.CopyTo( this ); +} + + +TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) +{ + ClearThis(); + base.CopyTo( this ); + return *this; +} + + +TiXmlElement::~TiXmlElement() +{ + ClearThis(); +} + + +void TiXmlElement::ClearThis() +{ + Clear(); + while( attributeSet.First() ) + { + TiXmlAttribute* node = attributeSet.First(); + attributeSet.Remove( node ); + delete node; + } +} + + +const char* TiXmlElement::Attribute( const char* name ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( node ) + return node->Value(); + return 0; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( attrib ) + return &attrib->ValueStr(); + return 0; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) { + result = attrib->Value(); + if ( i ) { + attrib->QueryIntValue( i ); + } + } + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) { + result = &attrib->ValueStr(); + if ( i ) { + attrib->QueryIntValue( i ); + } + } + return result; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) { + result = attrib->Value(); + if ( d ) { + attrib->QueryDoubleValue( d ); + } + } + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) { + result = &attrib->ValueStr(); + if ( d ) { + attrib->QueryDoubleValue( d ); + } + } + return result; +} +#endif + + +int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryIntValue( ival ); +} + + +int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + int ival = 0; + int result = node->QueryIntValue( &ival ); + *value = (unsigned)ival; + return result; +} + + +int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + int result = TIXML_WRONG_TYPE; + if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) + { + *bval = true; + result = TIXML_SUCCESS; + } + else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) + { + *bval = false; + result = TIXML_SUCCESS; + } + return result; +} + + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryIntValue( ival ); +} +#endif + + +int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryDoubleValue( dval ); +} + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryDoubleValue( dval ); +} +#endif + + +void TiXmlElement::SetAttribute( const char * name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetIntValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetIntValue( val ); + } +} +#endif + + +void TiXmlElement::SetDoubleAttribute( const char * name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetDoubleValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetDoubleValue( val ); + } +} +#endif + + +void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); + if ( attrib ) { + attrib->SetValue( cvalue ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); + if ( attrib ) { + attrib->SetValue( _value ); + } +} +#endif + + +void TiXmlElement::Print( FILE* cfile, int depth ) const +{ + int i; + assert( cfile ); + for ( i=0; iNext() ) + { + fprintf( cfile, " " ); + attrib->Print( cfile, depth ); + } + + // There are 3 different formatting approaches: + // 1) An element without children is printed as a node + // 2) An element with only a text child is printed as text + // 3) An element with children is printed on multiple lines. + TiXmlNode* node; + if ( !firstChild ) + { + fprintf( cfile, " />" ); + } + else if ( firstChild == lastChild && firstChild->ToText() ) + { + fprintf( cfile, ">" ); + firstChild->Print( cfile, depth + 1 ); + fprintf( cfile, "", value.c_str() ); + } + else + { + fprintf( cfile, ">" ); + + for ( node = firstChild; node; node=node->NextSibling() ) + { + if ( !node->ToText() ) + { + fprintf( cfile, "\n" ); + } + node->Print( cfile, depth+1 ); + } + fprintf( cfile, "\n" ); + for( i=0; i", value.c_str() ); + } +} + + +void TiXmlElement::CopyTo( TiXmlElement* target ) const +{ + // superclass: + TiXmlNode::CopyTo( target ); + + // Element class: + // Clone the attributes, then clone the children. + const TiXmlAttribute* attribute = 0; + for( attribute = attributeSet.First(); + attribute; + attribute = attribute->Next() ) + { + target->SetAttribute( attribute->Name(), attribute->Value() ); + } + + TiXmlNode* node = 0; + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + +bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this, attributeSet.First() ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + break; + } + } + return visitor->VisitExit( *this ); +} + + +TiXmlNode* TiXmlElement::Clone() const +{ + TiXmlElement* clone = new TiXmlElement( Value() ); + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +const char* TiXmlElement::GetText() const +{ + const TiXmlNode* child = this->FirstChild(); + if ( child ) { + const TiXmlText* childText = child->ToText(); + if ( childText ) { + return childText->Value(); + } + } + return 0; +} + + +TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = true; + ClearError(); +} + +TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = true; + value = documentName; + ClearError(); +} + + +#ifdef TIXML_USE_STL +TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = true; + value = documentName; + ClearError(); +} +#endif + + +TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + copy.CopyTo( this ); +} + + +TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) +{ + Clear(); + copy.CopyTo( this ); + return *this; +} + + +bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) +{ + return LoadFile( Value(), encoding ); +} + + +bool TiXmlDocument::SaveFile() const +{ + return SaveFile( Value() ); +} + +bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) +{ + TIXML_STRING filename( _filename ); + value = filename; + + // reading in binary mode so that tinyxml can normalize the EOL + FILE* file = TiXmlFOpen( value.c_str (), "rb" ); + + if ( file ) + { + bool result = LoadFile( file, encoding ); + fclose( file ); + return result; + } + else + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } +} + +bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) +{ + if ( !file ) + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Delete the existing data: + Clear(); + location.Clear(); + + // Get the file size, so we can pre-allocate the string. HUGE speed impact. + long length = 0; + fseek( file, 0, SEEK_END ); + length = ftell( file ); + fseek( file, 0, SEEK_SET ); + + // Strange case, but good to handle up front. + if ( length <= 0 ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Subtle bug here. TinyXml did use fgets. But from the XML spec: + // 2.11 End-of-Line Handling + // + // + // ...the XML processor MUST behave as if it normalized all line breaks in external + // parsed entities (including the document entity) on input, before parsing, by translating + // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to + // a single #xA character. + // + // + // It is not clear fgets does that, and certainly isn't clear it works cross platform. + // Generally, you expect fgets to translate from the convention of the OS to the c/unix + // convention, and not work generally. + + /* + while( fgets( buf, sizeof(buf), file ) ) + { + data += buf; + } + */ + + char* buf = new char[ length+1 ]; + buf[0] = 0; + + if ( fread( buf, length, 1, file ) != 1 ) { + delete [] buf; + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Process the buffer in place to normalize new lines. (See comment above.) + // Copies from the 'p' to 'q' pointer, where p can advance faster if + // a newline-carriage return is hit. + // + // Wikipedia: + // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or + // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... + // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others + // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS + // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 + + const char* p = buf; // the read head + char* q = buf; // the write head + const char CR = 0x0d; + const char LF = 0x0a; + + buf[length] = 0; + while( *p ) { + assert( p < (buf+length) ); + assert( q <= (buf+length) ); + assert( q <= p ); + + if ( *p == CR ) { + *q++ = LF; + p++; + if ( *p == LF ) { // check for CR+LF (and skip LF) + p++; + } + } + else { + *q++ = *p++; + } + } + assert( q <= (buf+length) ); + *q = 0; + + Parse( buf, 0, encoding ); + + delete [] buf; + return !Error(); +} + + +bool TiXmlDocument::SaveFile( const char * filename ) const +{ + // The old c stuff lives on... + FILE* fp = TiXmlFOpen( filename, "w" ); + if ( fp ) + { + bool result = SaveFile( fp ); + fclose( fp ); + return result; + } + return false; +} + + +bool TiXmlDocument::SaveFile( FILE* fp ) const +{ + if ( useMicrosoftBOM ) + { + const unsigned char TIXML_UTF_LEAD_0 = 0xefU; + const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; + const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + + fputc( TIXML_UTF_LEAD_0, fp ); + fputc( TIXML_UTF_LEAD_1, fp ); + fputc( TIXML_UTF_LEAD_2, fp ); + } + Print( fp, 0 ); + return (ferror(fp) == 0); +} + + +void TiXmlDocument::CopyTo( TiXmlDocument* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->error = error; + target->errorId = errorId; + target->errorDesc = errorDesc; + target->tabsize = tabsize; + target->errorLocation = errorLocation; + target->useMicrosoftBOM = useMicrosoftBOM; + + TiXmlNode* node = 0; + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + + +TiXmlNode* TiXmlDocument::Clone() const +{ + TiXmlDocument* clone = new TiXmlDocument(); + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlDocument::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + node->Print( cfile, depth ); + fprintf( cfile, "\n" ); + } +} + + +bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + break; + } + } + return visitor->VisitExit( *this ); +} + + +const TiXmlAttribute* TiXmlAttribute::Next() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + return 0; + return next; +} + +/* +TiXmlAttribute* TiXmlAttribute::Next() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + return 0; + return next; +} +*/ + +const TiXmlAttribute* TiXmlAttribute::Previous() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + return 0; + return prev; +} + +/* +TiXmlAttribute* TiXmlAttribute::Previous() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + return 0; + return prev; +} +*/ + +void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + TIXML_STRING n, v; + + EncodeString( name, &n ); + EncodeString( value, &v ); + + if (value.find ('\"') == TIXML_STRING::npos) { + if ( cfile ) { + fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); + } + if ( str ) { + (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; + } + } + else { + if ( cfile ) { + fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); + } + if ( str ) { + (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; + } + } +} + + +int TiXmlAttribute::QueryIntValue( int* ival ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; +} + +int TiXmlAttribute::QueryDoubleValue( double* dval ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; +} + +void TiXmlAttribute::SetIntValue( int _value ) +{ + char buf [64]; + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); + #else + sprintf (buf, "%d", _value); + #endif + SetValue (buf); +} + +void TiXmlAttribute::SetDoubleValue( double _value ) +{ + char buf [256]; + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); + #else + sprintf (buf, "%g", _value); + #endif + SetValue (buf); +} + +int TiXmlAttribute::IntValue() const +{ + return atoi (value.c_str ()); +} + +double TiXmlAttribute::DoubleValue() const +{ + return atof (value.c_str ()); +} + + +TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) +{ + copy.CopyTo( this ); +} + + +TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) +{ + Clear(); + base.CopyTo( this ); + return *this; +} + + +void TiXmlComment::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlComment::CopyTo( TiXmlComment* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlComment::Clone() const +{ + TiXmlComment* clone = new TiXmlComment(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlText::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + if ( cdata ) + { + int i; + fprintf( cfile, "\n" ); + for ( i=0; i\n", value.c_str() ); // unformatted output + } + else + { + TIXML_STRING buffer; + EncodeString( value, &buffer ); + fprintf( cfile, "%s", buffer.c_str() ); + } +} + + +void TiXmlText::CopyTo( TiXmlText* target ) const +{ + TiXmlNode::CopyTo( target ); + target->cdata = cdata; +} + + +bool TiXmlText::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlText::Clone() const +{ + TiXmlText* clone = 0; + clone = new TiXmlText( "" ); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +TiXmlDeclaration::TiXmlDeclaration( const char * _version, + const char * _encoding, + const char * _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} + + +#ifdef TIXML_USE_STL +TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} +#endif + + +TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + copy.CopyTo( this ); +} + + +TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) +{ + Clear(); + copy.CopyTo( this ); + return *this; +} + + +void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + if ( cfile ) fprintf( cfile, "" ); + if ( str ) (*str) += "?>"; +} + + +void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->version = version; + target->encoding = encoding; + target->standalone = standalone; +} + + +bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlDeclaration::Clone() const +{ + TiXmlDeclaration* clone = new TiXmlDeclaration(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlUnknown::Print( FILE* cfile, int depth ) const +{ + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlUnknown::Clone() const +{ + TiXmlUnknown* clone = new TiXmlUnknown(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +TiXmlAttributeSet::TiXmlAttributeSet() +{ + sentinel.next = &sentinel; + sentinel.prev = &sentinel; +} + + +TiXmlAttributeSet::~TiXmlAttributeSet() +{ + assert( sentinel.next == &sentinel ); + assert( sentinel.prev == &sentinel ); +} + + +void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) +{ + #ifdef TIXML_USE_STL + assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. + #else + assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. + #endif + + addMe->next = &sentinel; + addMe->prev = sentinel.prev; + + sentinel.prev->next = addMe; + sentinel.prev = addMe; +} + +void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) +{ + TiXmlAttribute* node; + + for( node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node == removeMe ) + { + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = 0; + node->prev = 0; + return; + } + } + assert( 0 ); // we tried to remove a non-linked attribute. +} + + +#ifdef TIXML_USE_STL +TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node->name == name ) + return node; + } + return 0; +} + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + if ( !attrib ) { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + return attrib; +} +#endif + + +TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( strcmp( node->name.c_str(), name ) == 0 ) + return node; + } + return 0; +} + + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + if ( !attrib ) { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + return attrib; +} + + +#ifdef TIXML_USE_STL +std::istream& operator>> (std::istream & in, TiXmlNode & base) +{ + TIXML_STRING tag; + tag.reserve( 8 * 1000 ); + base.StreamIn( &in, &tag ); + + base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); + return in; +} +#endif + + +#ifdef TIXML_USE_STL +std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out << printer.Str(); + + return out; +} + + +std::string& operator<< (std::string& out, const TiXmlNode& base ) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out.append( printer.Str() ); + + return out; +} +#endif + + +TiXmlHandle TiXmlHandle::FirstChild() const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild(); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild( value ); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement() const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement(); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement( value ); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild(); + for ( i=0; + child && iNextSibling(), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild( value ); + for ( i=0; + child && iNextSibling( value ), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement(); + for ( i=0; + child && iNextSiblingElement(), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement( value ); + for ( i=0; + child && iNextSiblingElement( value ), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) +{ + DoIndent(); + buffer += "<"; + buffer += element.Value(); + + for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) + { + buffer += " "; + attrib->Print( 0, 0, &buffer ); + } + + if ( !element.FirstChild() ) + { + buffer += " />"; + DoLineBreak(); + } + else + { + buffer += ">"; + if ( element.FirstChild()->ToText() + && element.LastChild() == element.FirstChild() + && element.FirstChild()->ToText()->CDATA() == false ) + { + simpleTextPrint = true; + // no DoLineBreak()! + } + else + { + DoLineBreak(); + } + } + ++depth; + return true; +} + + +bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) +{ + --depth; + if ( !element.FirstChild() ) + { + // nothing. + } + else + { + if ( simpleTextPrint ) + { + simpleTextPrint = false; + } + else + { + DoIndent(); + } + buffer += ""; + DoLineBreak(); + } + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlText& text ) +{ + if ( text.CDATA() ) + { + DoIndent(); + buffer += ""; + DoLineBreak(); + } + else if ( simpleTextPrint ) + { + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + } + else + { + DoIndent(); + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + DoLineBreak(); + } + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) +{ + DoIndent(); + declaration.Print( 0, 0, &buffer ); + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlComment& comment ) +{ + DoIndent(); + buffer += ""; + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) +{ + DoIndent(); + buffer += "<"; + buffer += unknown.Value(); + buffer += ">"; + DoLineBreak(); + return true; +} + diff --git a/DFL_BOM_WL_TOERP/tinyxml/tinyxml.h b/DFL_BOM_WL_TOERP/tinyxml/tinyxml.h new file mode 100644 index 0000000..a3589e5 --- /dev/null +++ b/DFL_BOM_WL_TOERP/tinyxml/tinyxml.h @@ -0,0 +1,1805 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include +#include +#include +#include +#include + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL + #include + #include + #include + #define TIXML_STRING std::string +#else + #include "tinystr.h" + #define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 6; +const int TIXML_PATCH_VERSION = 2; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its sibilings will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknown node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } + + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: + #ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + + #endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + TINYXML_DOCUMENT, + TINYXML_ELEMENT, + TINYXML_COMMENT, + TINYXML_UNKNOWN, + TINYXML_TEXT, + TINYXML_DECLARATION, + TINYXML_TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } + + #ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif + + const TIXML_STRING& ValueTStr() const { return value; } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, + TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + + TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* FindOrCreate( const char* _name ); + +# ifdef TIXML_USE_STL + TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* FindOrCreate( const std::string& _name ); +# endif + + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char * in_value); + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif + + TiXmlElement( const TiXmlElement& ); + + TiXmlElement& operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). + int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; + /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). + Note that '1', 'true', or 'yes' are considered true, while '0', 'false' + and 'no' are considered false. + */ + int QueryBoolAttribute( const char* name, bool* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } + + #ifdef TIXML_USE_STL + /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). + int QueryStringAttribute( const char* name, std::string* _value ) const { + const char* cstr = Attribute( name ); + if ( cstr ) { + *_value = std::string( cstr ); + return TIXML_SUCCESS; + } + return TIXML_NO_ATTRIBUTE; + } + + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types that contain spaces. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + + int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); + + #ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + ///< STL std::string form. + void SetDoubleAttribute( const std::string& name, double value ); + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char * name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char * name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char * name ); + #ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. + #endif + + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + + void CopyTo( TiXmlElement* target ) const; + void ClearThis(); // like clear, but initializes 'this' object as well + + // Used to be public [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + /* [internal use] + Reads the "value" of the element -- another element, or text. + This should terminate with the current end tag. + */ + const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + +private: + TiXmlAttributeSet attributeSet; +}; + + +/** An XML comment. +*/ +class TiXmlComment : public TiXmlNode +{ +public: + /// Constructs an empty comment. + TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} + /// Construct a comment from text. + TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { + SetValue( _value ); + } + TiXmlComment( const TiXmlComment& ); + TiXmlComment& operator=( const TiXmlComment& base ); + + virtual ~TiXmlComment() {} + + /// Returns a copy of this Comment. + virtual TiXmlNode* Clone() const; + // Write this Comment to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: at the ! of the !-- + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlComment* target ) const; + + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif +// virtual void StreamOut( TIXML_OSTREAM * out ) const; + +private: + +}; + + +/** XML text. A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCDATA() and query it with CDATA(). +*/ +class TiXmlText : public TiXmlNode +{ + friend class TiXmlElement; +public: + /** Constructor for text element. By default, it is treated as + normal, encoded text. If you want it be output as a CDATA text + element, set the parameter _cdata to 'true' + */ + TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + virtual ~TiXmlText() {} + + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + #endif + + TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } + TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } + + // Write this text object to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /// Queries whether this represents text using a CDATA section. + bool CDATA() const { return cdata; } + /// Turns on or off a CDATA representation of text. + void SetCDATA( bool _cdata ) { cdata = _cdata; } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + /// [internal use] Creates a new Element and returns it. + virtual TiXmlNode* Clone() const; + void CopyTo( TiXmlText* target ) const; + + bool Blank() const; // returns true if all white space and new lines + // [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + bool cdata; // true if this should be input and output as a CDATA style text element +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXml will happily read or write files without a declaration, + however. There are 3 possible attributes to the declaration: + version, encoding, and standalone. + + Note: In this version of the code, the attributes are + handled as special cases, not generic attributes, simply + because there can only be at most 3 and they are always the same. +*/ +class TiXmlDeclaration : public TiXmlNode +{ +public: + /// Construct an empty declaration. + TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ); +#endif + + /// Construct. + TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ); + + TiXmlDeclaration( const TiXmlDeclaration& copy ); + TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); + + virtual ~TiXmlDeclaration() {} + + /// Version. Will return an empty string if none was found. + const char *Version() const { return version.c_str (); } + /// Encoding. Will return an empty string if none was found. + const char *Encoding() const { return encoding.c_str (); } + /// Is this a standalone document? + const char *Standalone() const { return standalone.c_str (); } + + /// Creates a copy of this Declaration and returns it. + virtual TiXmlNode* Clone() const; + // Print this declaration to a FILE stream. + virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlDeclaration* target ) const; + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + + TIXML_STRING version; + TIXML_STRING encoding; + TIXML_STRING standalone; +}; + + +/** Any tag that tinyXml doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into TiXmlUnknowns. +*/ +class TiXmlUnknown : public TiXmlNode +{ +public: + TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} + virtual ~TiXmlUnknown() {} + + TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } + TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } + + /// Creates a copy of this Unknown and returns it. + virtual TiXmlNode* Clone() const; + // Print this Unknown to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected: + void CopyTo( TiXmlUnknown* target ) const; + + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + +}; + + +/** Always the top level node. A document binds together all the + XML pieces. It can be saved, loaded, and printed to the screen. + The 'value' of a document node is the xml file name. +*/ +class TiXmlDocument : public TiXmlNode +{ +public: + /// Create an empty document, that has no name. + TiXmlDocument(); + /// Create a document with a name. The name of the document is also the filename of the xml. + TiXmlDocument( const char * documentName ); + + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlDocument( const std::string& documentName ); + #endif + + TiXmlDocument( const TiXmlDocument& copy ); + TiXmlDocument& operator=( const TiXmlDocument& copy ); + + virtual ~TiXmlDocument() {} + + /** Load a file using the current document value. + Returns true if successful. Will delete any existing + document data before loading. + */ + bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the current document value. Returns true if successful. + bool SaveFile() const; + /// Load a file using the given filename. Returns true if successful. + bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given filename. Returns true if successful. + bool SaveFile( const char * filename ) const; + /** Load a file using the given FILE*. Returns true if successful. Note that this method + doesn't stream - the entire object pointed at by the FILE* + will be interpreted as an XML file. TinyXML doesn't stream in XML from the current + file location. Streaming may be added in the future. + */ + bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given FILE*. Returns true if successful. + bool SaveFile( FILE* ) const; + + #ifdef TIXML_USE_STL + bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. + { + return LoadFile( filename.c_str(), encoding ); + } + bool SaveFile( const std::string& filename ) const ///< STL std::string version. + { + return SaveFile( filename.c_str() ); + } + #endif + + /** Parse the given null terminated block of xml data. Passing in an encoding to this + method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml + to use that encoding, regardless of what TinyXml might otherwise try to detect. + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + + /** Get the root element -- the only top level element -- of the document. + In well formed XML, there should only be one. TinyXml is tolerant of + multiple elements at the document level. + */ + const TiXmlElement* RootElement() const { return FirstChildElement(); } + TiXmlElement* RootElement() { return FirstChildElement(); } + + /** If an error occurs, Error will be set to true. Also, + - The ErrorId() will contain the integer identifier of the error (not generally useful) + - The ErrorDesc() method will return the name of the error. (very useful) + - The ErrorRow() and ErrorCol() will return the location of the error (if known) + */ + bool Error() const { return error; } + + /// Contains a textual (english) description of the error if one occurs. + const char * ErrorDesc() const { return errorDesc.c_str (); } + + /** Generally, you probably want the error string ( ErrorDesc() ). But if you + prefer the ErrorId, this function will fetch it. + */ + int ErrorId() const { return errorId; } + + /** Returns the location (if known) of the error. The first column is column 1, + and the first row is row 1. A value of 0 means the row and column wasn't applicable + (memory errors, for example, have no row/column) or the parser lost the error. (An + error in the error reporting, in that case.) + + @sa SetTabSize, Row, Column + */ + int ErrorRow() const { return errorLocation.row+1; } + int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() + + /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) + to report the correct values for row and column. It does not change the output + or input in any way. + + By calling this method, with a tab size + greater than 0, the row and column of each node and attribute is stored + when the file is loaded. Very useful for tracking the DOM back in to + the source file. + + The tab size is required for calculating the location of nodes. If not + set, the default of 4 is used. The tabsize is set per document. Setting + the tabsize to 0 disables row/column tracking. + + Note that row and column tracking is not supported when using operator>>. + + The tab size needs to be enabled before the parse or load. Correct usage: + @verbatim + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Load( "myfile.xml" ); + @endverbatim + + @sa Row, Column + */ + void SetTabSize( int _tabsize ) { tabsize = _tabsize; } + + int TabSize() const { return tabsize; } + + /** If you have handled the error, it can be reset with this call. The error + state is automatically cleared if you Parse a new XML block. + */ + void ClearError() { error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; + } + + /** Write the document to standard out using formatted printing ("pretty print"). */ + void Print() const { Print( stdout, 0 ); } + + /* Write the document to a string using formatted printing ("pretty print"). This + will allocate a character array (new char[]) and return it as a pointer. The + calling code pust call delete[] on the return char* to avoid a memory leak. + */ + //char* PrintToMemory() const; + + /// Print this Document to a FILE stream. + virtual void Print( FILE* cfile, int depth = 0 ) const; + // [internal use] + void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + + virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + // [internal use] + virtual TiXmlNode* Clone() const; + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + void CopyTo( TiXmlDocument* target ) const; + + bool error; + int errorId; + TIXML_STRING errorDesc; + int tabsize; + TiXmlCursor errorLocation; + bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. +}; + + +/** + A TiXmlHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + TiXmlElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + TiXmlElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + TiXmlElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + TiXmlElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + TiXmlHandle docHandle( &document ); + TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + TiXmlHandle handleCopy = handle; + @endverbatim + + What they should not be used for is iteration: + + @verbatim + int i=0; + while ( true ) + { + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); + if ( !child ) + break; + // do something + ++i; + } + @endverbatim + + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs + to. Instead, prefer: + + @verbatim + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); + + for( child; child; child=child->NextSiblingElement() ) + { + // do something + } + @endverbatim +*/ +class TiXmlHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } + /// Copy constructor + TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } + TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } + + /// Return a handle to the first child node. + TiXmlHandle FirstChild() const; + /// Return a handle to the first child node with the given name. + TiXmlHandle FirstChild( const char * value ) const; + /// Return a handle to the first child element. + TiXmlHandle FirstChildElement() const; + /// Return a handle to the first child element with the given name. + TiXmlHandle FirstChildElement( const char * value ) const; + + /** Return a handle to the "index" child with the given name. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( const char* value, int index ) const; + /** Return a handle to the "index" child. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( int index ) const; + /** Return a handle to the "index" child element with the given name. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( const char* value, int index ) const; + /** Return a handle to the "index" child element. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( int index ) const; + + #ifdef TIXML_USE_STL + TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } + TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } + + TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } + TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } + #endif + + /** Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* ToNode() const { return node; } + /** Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } + /** Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } + /** Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } + + /** @deprecated use ToNode. + Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* Node() const { return ToNode(); } + /** @deprecated use ToElement. + Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* Element() const { return ToElement(); } + /** @deprecated use ToText() + Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* Text() const { return ToText(); } + /** @deprecated use ToUnknown() + Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* Unknown() const { return ToUnknown(); } + +private: + TiXmlNode* node; +}; + + +/** Print to memory functionality. The TiXmlPrinter is useful when you need to: + + -# Print to memory (especially in non-STL mode) + -# Control formatting (line endings, etc.) + + When constructed, the TiXmlPrinter is in its default "pretty printing" mode. + Before calling Accept() you can call methods to control the printing + of the XML document. After TiXmlNode::Accept() is called, the printed document can + be accessed via the CStr(), Str(), and Size() methods. + + TiXmlPrinter uses the Visitor API. + @verbatim + TiXmlPrinter printer; + printer.SetIndent( "\t" ); + + doc.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + @endverbatim +*/ +class TiXmlPrinter : public TiXmlVisitor +{ +public: + TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), + buffer(), indent( " " ), lineBreak( "\n" ) {} + + virtual bool VisitEnter( const TiXmlDocument& doc ); + virtual bool VisitExit( const TiXmlDocument& doc ); + + virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); + virtual bool VisitExit( const TiXmlElement& element ); + + virtual bool Visit( const TiXmlDeclaration& declaration ); + virtual bool Visit( const TiXmlText& text ); + virtual bool Visit( const TiXmlComment& comment ); + virtual bool Visit( const TiXmlUnknown& unknown ); + + /** Set the indent characters for printing. By default 4 spaces + but tab (\t) is also useful, or null/empty string for no indentation. + */ + void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } + /// Query the indention string. + const char* Indent() { return indent.c_str(); } + /** Set the line breaking string. By default set to newline (\n). + Some operating systems prefer other characters, or can be + set to the null/empty string for no indenation. + */ + void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } + /// Query the current line breaking string. + const char* LineBreak() { return lineBreak.c_str(); } + + /** Switch over to "stream printing" which is the most dense formatting without + linebreaks. Common when the XML is needed for network transmission. + */ + void SetStreamPrinting() { indent = ""; + lineBreak = ""; + } + /// Return the result. + const char* CStr() { return buffer.c_str(); } + /// Return the length of the result string. + size_t Size() { return buffer.size(); } + + #ifdef TIXML_USE_STL + /// Return the result. + const std::string& Str() { return buffer; } + #endif + +private: + void DoIndent() { + for( int i=0; i +#include + +#include "tinyxml.h" + +//#define DEBUG_PARSER +#if defined( DEBUG_PARSER ) +# if defined( DEBUG ) && defined( _MSC_VER ) +# include +# define TIXML_LOG OutputDebugString +# else +# define TIXML_LOG printf +# endif +#endif + +// Note tha "PutString" hardcodes the same list. This +// is less flexible than it appears. Changing the entries +// or order will break putstring. +TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = +{ + { "&", 5, '&' }, + { "<", 4, '<' }, + { ">", 4, '>' }, + { """, 6, '\"' }, + { "'", 6, '\'' } +}; + +// Bunch of unicode info at: +// http://www.unicode.org/faq/utf_bom.html +// Including the basic of this table, which determines the #bytes in the +// sequence from the lead byte. 1 placed for invalid sequences -- +// although the result will be junk, pass it through as much as possible. +// Beware of the non-characters in UTF-8: +// ef bb bf (Microsoft "lead bytes") +// ef bf be +// ef bf bf + +const unsigned char TIXML_UTF_LEAD_0 = 0xefU; +const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; +const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + +const int TiXmlBase::utf8ByteTable[256] = +{ + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte + 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid +}; + + +void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) +{ + const unsigned long BYTE_MASK = 0xBF; + const unsigned long BYTE_MARK = 0x80; + const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + + if (input < 0x80) + *length = 1; + else if ( input < 0x800 ) + *length = 2; + else if ( input < 0x10000 ) + *length = 3; + else if ( input < 0x200000 ) + *length = 4; + else + { *length = 0; return; } // This code won't covert this correctly anyway. + + output += *length; + + // Scary scary fall throughs. + switch (*length) + { + case 4: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 3: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 2: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 1: + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); + } +} + + +/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + +// if ( encoding == TIXML_ENCODING_UTF8 ) +// { + if ( anyByte < 127 ) + return isalpha( anyByte ); + else + return 1; // What else to do? The unicode set is huge...get the english ones right. +// } +// else +// { +// return isalpha( anyByte ); +// } +} + + +/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + +// if ( encoding == TIXML_ENCODING_UTF8 ) +// { + if ( anyByte < 127 ) + return isalnum( anyByte ); + else + return 1; // What else to do? The unicode set is huge...get the english ones right. +// } +// else +// { +// return isalnum( anyByte ); +// } +} + + +class TiXmlParsingData +{ + friend class TiXmlDocument; + public: + void Stamp( const char* now, TiXmlEncoding encoding ); + + const TiXmlCursor& Cursor() const { return cursor; } + + private: + // Only used by the document! + TiXmlParsingData( const char* start, int _tabsize, int row, int col ) + { + assert( start ); + stamp = start; + tabsize = _tabsize; + cursor.row = row; + cursor.col = col; + } + + TiXmlCursor cursor; + const char* stamp; + int tabsize; +}; + + +void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) +{ + assert( now ); + + // Do nothing if the tabsize is 0. + if ( tabsize < 1 ) + { + return; + } + + // Get the current row, column. + int row = cursor.row; + int col = cursor.col; + const char* p = stamp; + assert( p ); + + while ( p < now ) + { + // Treat p as unsigned, so we have a happy compiler. + const unsigned char* pU = (const unsigned char*)p; + + // Code contributed by Fletcher Dunn: (modified by lee) + switch (*pU) { + case 0: + // We *should* never get here, but in case we do, don't + // advance past the terminating null character, ever + return; + + case '\r': + // bump down to the next line + ++row; + col = 0; + // Eat the character + ++p; + + // Check for \r\n sequence, and treat this as a single character + if (*p == '\n') { + ++p; + } + break; + + case '\n': + // bump down to the next line + ++row; + col = 0; + + // Eat the character + ++p; + + // Check for \n\r sequence, and treat this as a single + // character. (Yes, this bizarre thing does occur still + // on some arcane platforms...) + if (*p == '\r') { + ++p; + } + break; + + case '\t': + // Eat the character + ++p; + + // Skip to next tab stop + col = (col / tabsize + 1) * tabsize; + break; + + case TIXML_UTF_LEAD_0: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( *(p+1) && *(p+2) ) + { + // In these cases, don't advance the column. These are + // 0-width spaces. + if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) + p += 3; + else + { p +=3; ++col; } // A normal character. + } + } + else + { + ++p; + ++col; + } + break; + + default: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // Eat the 1 to 4 byte utf8 character. + int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; + if ( step == 0 ) + step = 1; // Error case from bad encoding, but handle gracefully. + p += step; + + // Just advance one column, of course. + ++col; + } + else + { + ++p; + ++col; + } + break; + } + } + cursor.row = row; + cursor.col = col; + assert( cursor.row >= -1 ); + assert( cursor.col >= -1 ); + stamp = p; + assert( stamp ); +} + + +const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) +{ + if ( !p || !*p ) + { + return 0; + } + if ( encoding == TIXML_ENCODING_UTF8 ) + { + while ( *p ) + { + const unsigned char* pU = (const unsigned char*)p; + + // Skip the stupid Microsoft UTF-8 Byte order marks + if ( *(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==TIXML_UTF_LEAD_1 + && *(pU+2)==TIXML_UTF_LEAD_2 ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbeU ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbfU ) + { + p += 3; + continue; + } + + if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. + ++p; + else + break; + } + } + else + { + while ( *p && IsWhiteSpace( *p ) ) + ++p; + } + + return p; +} + +#ifdef TIXML_USE_STL +/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) +{ + for( ;; ) + { + if ( !in->good() ) return false; + + int c = in->peek(); + // At this scope, we can't get to a document. So fail silently. + if ( !IsWhiteSpace( c ) || c <= 0 ) + return true; + + *tag += (char) in->get(); + } +} + +/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) +{ + //assert( character > 0 && character < 128 ); // else it won't work in utf-8 + while ( in->good() ) + { + int c = in->peek(); + if ( c == character ) + return true; + if ( c <= 0 ) // Silent failure: can't get document at this scope + return false; + + in->get(); + *tag += (char) c; + } + return false; +} +#endif + +// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The +// "assign" optimization removes over 10% of the execution time. +// +const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) +{ + // Oddly, not supported on some comilers, + //name->clear(); + // So use this: + *name = ""; + assert( p ); + + // Names start with letters or underscores. + // Of course, in unicode, tinyxml has no idea what a letter *is*. The + // algorithm is generous. + // + // After that, they can be letters, underscores, numbers, + // hyphens, or colons. (Colons are valid ony for namespaces, + // but tinyxml can't tell namespaces from names.) + if ( p && *p + && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) + { + const char* start = p; + while( p && *p + && ( IsAlphaNum( (unsigned char ) *p, encoding ) + || *p == '_' + || *p == '-' + || *p == '.' + || *p == ':' ) ) + { + //(*name) += *p; // expensive + ++p; + } + if ( p-start > 0 ) { + name->assign( start, p-start ); + } + return p; + } + return 0; +} + +const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) +{ + // Presume an entity, and pull it out. + TIXML_STRING ent; + int i; + *length = 0; + + if ( *(p+1) && *(p+1) == '#' && *(p+2) ) + { + unsigned long ucs = 0; + ptrdiff_t delta = 0; + unsigned mult = 1; + + if ( *(p+2) == 'x' ) + { + // Hexadecimal. + if ( !*(p+3) ) return 0; + + const char* q = p+3; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != 'x' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else if ( *q >= 'a' && *q <= 'f' ) + ucs += mult * (*q - 'a' + 10); + else if ( *q >= 'A' && *q <= 'F' ) + ucs += mult * (*q - 'A' + 10 ); + else + return 0; + mult *= 16; + --q; + } + } + else + { + // Decimal. + if ( !*(p+2) ) return 0; + + const char* q = p+2; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != '#' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else + return 0; + mult *= 10; + --q; + } + } + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8( ucs, value, length ); + } + else + { + *value = (char)ucs; + *length = 1; + } + return p + delta + 1; + } + + // Now try to match it. + for( i=0; iappend( cArr, len ); + } + } + else + { + bool whitespace = false; + + // Remove leading white space: + p = SkipWhiteSpace( p, encoding ); + while ( p && *p + && !StringEqual( p, endTag, caseInsensitive, encoding ) ) + { + if ( *p == '\r' || *p == '\n' ) + { + whitespace = true; + ++p; + } + else if ( IsWhiteSpace( *p ) ) + { + whitespace = true; + ++p; + } + else + { + // If we've found whitespace, add it before the + // new character. Any whitespace just becomes a space. + if ( whitespace ) + { + (*text) += ' '; + whitespace = false; + } + int len; + char cArr[4] = { 0, 0, 0, 0 }; + p = GetChar( p, cArr, &len, encoding ); + if ( len == 1 ) + (*text) += cArr[0]; // more efficient + else + text->append( cArr, len ); + } + } + } + if ( p && *p ) + p += strlen( endTag ); + return ( p && *p ) ? p : 0; +} + +#ifdef TIXML_USE_STL + +void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + // The basic issue with a document is that we don't know what we're + // streaming. Read something presumed to be a tag (and hope), then + // identify it, and call the appropriate stream method on the tag. + // + // This "pre-streaming" will never read the closing ">" so the + // sub-tag can orient itself. + + if ( !StreamTo( in, '<', tag ) ) + { + SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + while ( in->good() ) + { + int tagIndex = (int) tag->length(); + while ( in->good() && in->peek() != '>' ) + { + int c = in->get(); + if ( c <= 0 ) + { + SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + break; + } + (*tag) += (char) c; + } + + if ( in->good() ) + { + // We now have something we presume to be a node of + // some sort. Identify it, and call the node to + // continue streaming. + TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); + + if ( node ) + { + node->StreamIn( in, tag ); + bool isElement = node->ToElement() != 0; + delete node; + node = 0; + + // If this is the root element, we're done. Parsing will be + // done by the >> operator. + if ( isElement ) + { + return; + } + } + else + { + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + } + } + // We should have returned sooner. + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); +} + +#endif + +const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) +{ + ClearError(); + + // Parse away, at the document level. Since a document + // contains nothing but other tags, most of what happens + // here is skipping white space. + if ( !p || !*p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + // Note that, for a document, this needs to come + // before the while space skip, so that parsing + // starts from the pointer we are given. + location.Clear(); + if ( prevData ) + { + location.row = prevData->cursor.row; + location.col = prevData->cursor.col; + } + else + { + location.row = 0; + location.col = 0; + } + TiXmlParsingData data( p, TabSize(), location.row, location.col ); + location = data.Cursor(); + + if ( encoding == TIXML_ENCODING_UNKNOWN ) + { + // Check for the Microsoft UTF-8 lead bytes. + const unsigned char* pU = (const unsigned char*)p; + if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 + && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 + && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) + { + encoding = TIXML_ENCODING_UTF8; + useMicrosoftBOM = true; + } + } + + p = SkipWhiteSpace( p, encoding ); + if ( !p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + while ( p && *p ) + { + TiXmlNode* node = Identify( p, encoding ); + if ( node ) + { + p = node->Parse( p, &data, encoding ); + LinkEndChild( node ); + } + else + { + break; + } + + // Did we get encoding info? + if ( encoding == TIXML_ENCODING_UNKNOWN + && node->ToDeclaration() ) + { + TiXmlDeclaration* dec = node->ToDeclaration(); + const char* enc = dec->Encoding(); + assert( enc ); + + if ( *enc == 0 ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice + else + encoding = TIXML_ENCODING_LEGACY; + } + + p = SkipWhiteSpace( p, encoding ); + } + + // Was this empty? + if ( !firstChild ) { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); + return 0; + } + + // All is well. + return p; +} + +void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + // The first error in a chain is more accurate - don't set again! + if ( error ) + return; + + assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); + error = true; + errorId = err; + errorDesc = errorString[ errorId ]; + + errorLocation.Clear(); + if ( pError && data ) + { + data->Stamp( pError, encoding ); + errorLocation = data->Cursor(); + } +} + + +TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) +{ + TiXmlNode* returnNode = 0; + + p = SkipWhiteSpace( p, encoding ); + if( !p || !*p || *p != '<' ) + { + return 0; + } + + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p ) + { + return 0; + } + + // What is this thing? + // - Elements start with a letter or underscore, but xml is reserved. + // - Comments: "; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + if ( document ) + document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); + return 0; + } + p += strlen( startTag ); + + // [ 1475201 ] TinyXML parses entities in comments + // Oops - ReadText doesn't work, because we don't want to parse the entities. + // p = ReadText( p, &value, false, endTag, false, encoding ); + // + // from the XML spec: + /* + [Definition: Comments may appear anywhere in a document outside other markup; in addition, + they may appear within the document type declaration at places allowed by the grammar. + They are not part of the document's character data; an XML processor MAY, but need not, + make it possible for an application to retrieve the text of comments. For compatibility, + the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity + references MUST NOT be recognized within comments. + + An example of a comment: + + + */ + + value = ""; + // Keep all the white space. + while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) + { + value.append( p, 1 ); + ++p; + } + if ( p && *p ) + p += strlen( endTag ); + + return p; +} + + +const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p ) return 0; + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + // Read the name, the '=' and the value. + const char* pErr = p; + p = ReadName( p, &name, encoding ); + if ( !p || !*p ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); + return 0; + } + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p || *p != '=' ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + + ++p; // skip '=' + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + + const char* end; + const char SINGLE_QUOTE = '\''; + const char DOUBLE_QUOTE = '\"'; + + if ( *p == SINGLE_QUOTE ) + { + ++p; + end = "\'"; // single quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else if ( *p == DOUBLE_QUOTE ) + { + ++p; + end = "\""; // double quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else + { + // All attribute values should be in single or double quotes. + // But this is such a common error that the parser will try + // its best, even without them. + value = ""; + while ( p && *p // existence + && !IsWhiteSpace( *p ) // whitespace + && *p != '/' && *p != '>' ) // tag end + { + if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { + // [ 1451649 ] Attribute values with trailing quotes not handled correctly + // We did not have an opening quote but seem to have a + // closing one. Give up and throw an error. + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + value += *p; + ++p; + } + } + return p; +} + +#ifdef TIXML_USE_STL +void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + while ( in->good() ) + { + int c = in->peek(); + if ( !cdata && (c == '<' ) ) + { + return; + } + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + (*tag) += (char) c; + in->get(); // "commits" the peek made above + + if ( cdata && c == '>' && tag->size() >= 3 ) { + size_t len = tag->size(); + if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { + // terminator of cdata. + return; + } + } + } +} +#endif + +const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + value = ""; + TiXmlDocument* document = GetDocument(); + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + + const char* const startTag = ""; + + if ( cdata || StringEqual( p, startTag, false, encoding ) ) + { + cdata = true; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + if ( document ) + document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); + return 0; + } + p += strlen( startTag ); + + // Keep all the white space, ignore the encoding, etc. + while ( p && *p + && !StringEqual( p, endTag, false, encoding ) + ) + { + value += *p; + ++p; + } + + TIXML_STRING dummy; + p = ReadText( p, &dummy, false, endTag, false, encoding ); + return p; + } + else + { + bool ignoreWhite = true; + + const char* end = "<"; + p = ReadText( p, &value, ignoreWhite, end, false, encoding ); + if ( p && *p ) + return p-1; // don't truncate the '<' + return 0; + } +} + +#ifdef TIXML_USE_STL +void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + while ( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + (*tag) += (char) c; + + if ( c == '>' ) + { + // All is well. + return; + } + } +} +#endif + +const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) +{ + p = SkipWhiteSpace( p, _encoding ); + // Find the beginning, find the end, and look for + // the stuff in-between. + TiXmlDocument* document = GetDocument(); + if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); + return 0; + } + if ( data ) + { + data->Stamp( p, _encoding ); + location = data->Cursor(); + } + p += 5; + + version = ""; + encoding = ""; + standalone = ""; + + while ( p && *p ) + { + if ( *p == '>' ) + { + ++p; + return p; + } + + p = SkipWhiteSpace( p, _encoding ); + if ( StringEqual( p, "version", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + version = attrib.Value(); + } + else if ( StringEqual( p, "encoding", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + encoding = attrib.Value(); + } + else if ( StringEqual( p, "standalone", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + standalone = attrib.Value(); + } + else + { + // Read over whatever it is. + while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) + ++p; + } + } + return 0; +} + +bool TiXmlText::Blank() const +{ + for ( unsigned i=0; i椤圭洰鈥淶:\TC_install\ZhengTai\c\GetBOMProp\DFL_BOM_WL_TOERP\DFL_BOM_WL_TOERP.vcxproj鈥濆湪鑺傜偣 2 涓(Build 涓洰鏍)銆 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(392,5): warning MSB8028: The intermediate directory (x64\Release\) contains files shared from another project (DFL_BOM_WL_TOERP1.vcxproj, DFL_BOM_WL_TOERP.vcxproj, GetBomMessage.vcxproj, GetBOMProp.vcxproj, GetBOMProp2.vcxproj). This can lead to incorrect clean and rebuild behavior. 1>ClCompile: - D:\VS2015\VC\bin\x86_amd64\CL.exe /c /IZ:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\build\..\lib\native\include\ /IZ:\TC_install\ZhengTai\c\sdplog\include /I"Z:\TC_install\ZhengTai\c\libcurl-vc15-x64-release-dll-ipv6-sspi-schannel\include" /IZ:\TC_install\YSR\c\clib\OCI\include /IZ:\TC_install\jingdiao\c\tclib\include /IZ:\TC_install\jingdiao\c\tclib\include_cpp /IZ:\TC_install\ZhengTai\c\libxl\include /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D WIN32 /D NDEBUG /D _CONSOLE /D IPLIB=none /D _UNICODE /D UNICODE /Gm- /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Release\\" /Fd"x64\Release\vc140.pdb" /Gd /TP /errorReport:prompt /D _CRT_SECURE_NO_WARNINGS BOMSendSap.cpp + D:\VS2015\VC\bin\x86_amd64\CL.exe /c /IZ:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\build\..\lib\native\include\ /IZ:\TC_install\ZhengTai\c\sdplog\include /I"Z:\TC_install\ZhengTai\c\libcurl-vc15-x64-release-dll-ipv6-sspi-schannel\include" /IZ:\TC_install\YSR\c\clib\OCI\include /IZ:\TC_install\jingdiao\c\tclib\include /IZ:\TC_install\jingdiao\c\tclib\include_cpp /IZ:\TC_install\ZhengTai\c\libxl\include /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D WIN32 /D NDEBUG /D _CONSOLE /D IPLIB=none /D _UNICODE /D UNICODE /Gm- /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Release\\" /Fd"x64\Release\vc140.pdb" /Gd /TP /errorReport:prompt /D _CRT_SECURE_NO_WARNINGS BOMSendSap.cpp GetBOMProp.cpp SAPZYGG2.cxx BOMSendSap.cpp 1>D:\VS2015\VC\include\xlocale(341): warning C4530: 浣跨敤浜 C++ 寮傚父澶勭悊绋嬪簭锛屼絾鏈惎鐢ㄥ睍寮璇箟銆傝鎸囧畾 /EHsc 1>Z:\TC_install\jingdiao\c\tclib\include\pom/pom/pom.h(806): warning C4819: 璇ユ枃浠跺寘鍚笉鑳藉湪褰撳墠浠g爜椤(936)涓〃绀虹殑瀛楃銆傝灏嗚鏂囦欢淇濆瓨涓 Unicode 鏍煎紡浠ラ槻姝㈡暟鎹涪澶 @@ -41,54 +41,195 @@ 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\epm/EPMTask.hxx(1086): warning C4251: 鈥淭eamcenter::EPMTask::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::EPMTask鈥濈殑瀹㈡埛绔娇鐢 1>Z:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\lib\native\include\spdlog/fmt/bundled/core.h(327): warning C4566: 鐢遍氱敤瀛楃鍚嶇О鈥淺u00B5鈥濊〃绀虹殑瀛楃涓嶈兘鍦ㄥ綋鍓嶄唬鐮侀〉(936)涓〃绀哄嚭鏉 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/Item.hxx(347): warning C4251: 鈥淭eamcenter::Item::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::Item鈥濈殑瀹㈡埛绔娇鐢 - 1>BOMSendSap.cpp(149): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(190): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(201): warning C4244: 鈥滃垵濮嬪寲鈥: 浠庘淿_int64鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(233): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(282): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(316): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(331): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(151): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(194): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(205): warning C4244: 鈥滃垵濮嬪寲鈥: 浠庘淿_int64鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(237): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(286): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(320): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(335): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(332): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(336): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(333): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(337): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(384): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. + 1>BOMSendSap.cpp(389): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/workspaceobject.h(887): note: 鍙傝鈥淲SOM_where_referenced鈥濈殑澹版槑 - 1>BOMSendSap.cpp(463): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(552): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(606): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(580): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(479): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(568): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(622): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(596): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(581): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(597): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(582): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(598): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(583): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(599): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(584): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(600): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(585): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(601): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(708): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(660): warning C4101: 鈥渋temID鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 - 1>BOMSendSap.cpp(963): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(910): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(724): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(676): warning C4101: 鈥渋temID鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 + 1>BOMSendSap.cpp(979): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(926): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(922): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. + 1>BOMSendSap.cpp(938): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/workspaceobject.h(887): note: 鍙傝鈥淲SOM_where_referenced鈥濈殑澹版槑 - 1>BOMSendSap.cpp(1146): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(1160): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 - 1>BOMSendSap.cpp(1059): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(1162): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(1176): warning C4267: 鈥=鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>BOMSendSap.cpp(1075): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(1602): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. + 1>BOMSendSap.cpp(1661): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/workspaceobject.h(887): note: 鍙傝鈥淲SOM_where_referenced鈥濈殑澹版槑 - 1>BOMSendSap.cpp(1623): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(1682): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(1624): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + 1>BOMSendSap.cpp(1683): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. Z:\TC_install\jingdiao\c\tclib\include\tccore/aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 - 1>BOMSendSap.cpp(1787): warning C4101: 鈥渞evUid鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 - 1>BOMSendSap.cpp(1800): warning C4101: 鈥渃cp鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 + 1>D:\VS2015\VC\include\exception(361): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc + GetBOMProp.cpp + 1>D:\VS2015\VC\include\xlocale(341): warning C4530: 浣跨敤浜 C++ 寮傚父澶勭悊绋嬪簭锛屼絾鏈惎鐢ㄥ睍寮璇箟銆傝鎸囧畾 /EHsc + 1>Z:\TC_install\jingdiao\c\tclib\include\pom/pom/pom.h(806): warning C4819: 璇ユ枃浠跺寘鍚笉鑳藉湪褰撳墠浠g爜椤(936)涓〃绀虹殑瀛楃銆傝灏嗚鏂囦欢淇濆瓨涓 Unicode 鏍煎紡浠ラ槻姝㈡暟鎹涪澶 + 1>Z:\TC_install\jingdiao\c\tclib\include\pom/pom/pom.h(5417): warning C4819: 璇ユ枃浠跺寘鍚笉鑳藉湪褰撳墠浠g爜椤(936)涓〃绀虹殑瀛楃銆傝灏嗚鏂囦欢淇濆瓨涓 Unicode 鏍煎紡浠ラ槻姝㈡暟鎹涪澶 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\base_utils/IFail.hxx(114): warning C4251: 鈥淚Fail::m_message鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淚Fail鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\lib\native\include\spdlog/fmt/bundled/core.h(327): warning C4566: 鐢遍氱敤瀛楃鍚嶇О鈥淺u00B5鈥濊〃绀虹殑瀛楃涓嶈兘鍦ㄥ綋鍓嶄唬鐮侀〉(936)涓〃绀哄嚭鏉 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RootObject.hxx(90): warning C4251: 鈥淭eamcenter::RootObject::m_typeName鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RootObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RootObject.hxx(95): warning C4251: 鈥淭eamcenter::RootObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RootObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/OperationInput.hxx(414): warning C4251: 鈥淭eamcenter::OperationInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::OperationInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BulkInput.hxx(120): warning C4251: 鈥淭eamcenter::BulkInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BulkInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BulkData.hxx(123): warning C4251: 鈥淭eamcenter::BulkData::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BulkData鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/DeepCopyData.hxx(93): warning C4251: 鈥淭eamcenter::DeepCopyData::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::DeepCopyData鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/CreateInput.hxx(140): warning C4251: 鈥淭eamcenter::CreateInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::CreateInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/SaveAsInput.hxx(93): warning C4251: 鈥淭eamcenter::SaveAsInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::SaveAsInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BusinessObject.hxx(666): warning C4251: 鈥淭eamcenter::BusinessObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BusinessObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\extensionframework/OperationDispatcher.hxx(439): warning C4251: 鈥淭eamcenter::OperationDispatcher::m_boName鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::OperationDispatcher鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/POM_object.hxx(253): warning C4251: 鈥淭eamcenter::POM_object::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::POM_object鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore\imantype.hxx(225): warning C4251: 鈥淭eamcenter::ImanType::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ImanType鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(55): warning C4251: 鈥淭eamcenter::FeatureKeyCheck::featureKey鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheck鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(74): warning C4251: 鈥淭eamcenter::FeatureKeyCheckAND::featureKeyChecks鈥: class鈥渟td::vector>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheckAND鈥濈殑瀹㈡埛绔娇鐢 + with + [ + _Ty=Teamcenter::FeatureKeyCheck * + ] + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(95): warning C4251: 鈥淭eamcenter::FeatureKeyCheckOR::featureKeyChecks鈥: class鈥渟td::vector>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheckOR鈥濈殑瀹㈡埛绔娇鐢 + with + [ + _Ty=Teamcenter::FeatureKeyCheck * + ] + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/ReviseInput.hxx(93): warning C4251: 鈥淭eamcenter::ReviseInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ReviseInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RuntimeBusinessObject.hxx(93): warning C4251: 鈥淭eamcenter::RuntimeBusinessObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RuntimeBusinessObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tc/Fnd0BaseProvider.hxx(103): warning C4251: 鈥淭eamcenter::Fnd0BaseProvider::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::Fnd0BaseProvider鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/POM_application_object.hxx(149): warning C4251: 鈥淭eamcenter::POM_application_object::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::POM_application_object鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/WorkspaceObject.hxx(567): warning C4251: 鈥淭eamcenter::WorkspaceObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::WorkspaceObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/ItemRevision.hxx(518): warning C4251: 鈥淭eamcenter::ItemRevision::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ItemRevision鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\epm/EPMTask.hxx(1086): warning C4251: 鈥淭eamcenter::EPMTask::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::EPMTask鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/Item.hxx(347): warning C4251: 鈥淭eamcenter::Item::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::Item鈥濈殑瀹㈡埛绔娇鐢 + 1>GetBOMProp.cpp(85): warning C4101: 鈥渞evUid鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 + 1>GetBOMProp.cpp(98): warning C4101: 鈥渃cp鈥: 鏈紩鐢ㄧ殑灞閮ㄥ彉閲 + 1>D:\VS2015\VC\include\limits(214): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc + SAPZYGG2.cxx + 1>Z:\TC_install\jingdiao\c\tclib\include\pom/pom/pom.h(806): warning C4819: 璇ユ枃浠跺寘鍚笉鑳藉湪褰撳墠浠g爜椤(936)涓〃绀虹殑瀛楃銆傝灏嗚鏂囦欢淇濆瓨涓 Unicode 鏍煎紡浠ラ槻姝㈡暟鎹涪澶 + 1>Z:\TC_install\jingdiao\c\tclib\include\pom/pom/pom.h(5417): warning C4819: 璇ユ枃浠跺寘鍚笉鑳藉湪褰撳墠浠g爜椤(936)涓〃绀虹殑瀛楃銆傝灏嗚鏂囦欢淇濆瓨涓 Unicode 鏍煎紡浠ラ槻姝㈡暟鎹涪澶 + 1>D:\VS2015\VC\include\xlocale(341): warning C4530: 浣跨敤浜 C++ 寮傚父澶勭悊绋嬪簭锛屼絾鏈惎鐢ㄥ睍寮璇箟銆傝鎸囧畾 /EHsc + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RootObject.hxx(90): warning C4251: 鈥淭eamcenter::RootObject::m_typeName鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RootObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RootObject.hxx(95): warning C4251: 鈥淭eamcenter::RootObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RootObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/OperationInput.hxx(414): warning C4251: 鈥淭eamcenter::OperationInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::OperationInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BulkInput.hxx(120): warning C4251: 鈥淭eamcenter::BulkInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BulkInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BulkData.hxx(123): warning C4251: 鈥淭eamcenter::BulkData::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BulkData鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/DeepCopyData.hxx(93): warning C4251: 鈥淭eamcenter::DeepCopyData::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::DeepCopyData鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/CreateInput.hxx(140): warning C4251: 鈥淭eamcenter::CreateInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::CreateInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/SaveAsInput.hxx(93): warning C4251: 鈥淭eamcenter::SaveAsInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::SaveAsInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/BusinessObject.hxx(666): warning C4251: 鈥淭eamcenter::BusinessObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::BusinessObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\extensionframework/OperationDispatcher.hxx(439): warning C4251: 鈥淭eamcenter::OperationDispatcher::m_boName鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::OperationDispatcher鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/POM_object.hxx(253): warning C4251: 鈥淭eamcenter::POM_object::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::POM_object鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore\imantype.hxx(225): warning C4251: 鈥淭eamcenter::ImanType::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ImanType鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\base_utils/IFail.hxx(114): warning C4251: 鈥淚Fail::m_message鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淚Fail鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(55): warning C4251: 鈥淭eamcenter::FeatureKeyCheck::featureKey鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheck鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(74): warning C4251: 鈥淭eamcenter::FeatureKeyCheckAND::featureKeyChecks鈥: class鈥渟td::vector>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheckAND鈥濈殑瀹㈡埛绔娇鐢 + with + [ + _Ty=Teamcenter::FeatureKeyCheck * + ] + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/FeatureKeyCheck.hxx(95): warning C4251: 鈥淭eamcenter::FeatureKeyCheckOR::featureKeyChecks鈥: class鈥渟td::vector>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::FeatureKeyCheckOR鈥濈殑瀹㈡埛绔娇鐢 + with + [ + _Ty=Teamcenter::FeatureKeyCheck * + ] + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/ReviseInput.hxx(93): warning C4251: 鈥淭eamcenter::ReviseInput::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ReviseInput鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\metaframework/RuntimeBusinessObject.hxx(93): warning C4251: 鈥淭eamcenter::RuntimeBusinessObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::RuntimeBusinessObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tc/Fnd0BaseProvider.hxx(103): warning C4251: 鈥淭eamcenter::Fnd0BaseProvider::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::Fnd0BaseProvider鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/POM_application_object.hxx(149): warning C4251: 鈥淭eamcenter::POM_application_object::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::POM_application_object鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/WorkspaceObject.hxx(567): warning C4251: 鈥淭eamcenter::WorkspaceObject::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::WorkspaceObject鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/ItemRevision.hxx(518): warning C4251: 鈥淭eamcenter::ItemRevision::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::ItemRevision鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\epm/EPMTask.hxx(1086): warning C4251: 鈥淭eamcenter::EPMTask::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::EPMTask鈥濈殑瀹㈡埛绔娇鐢 + 1>Z:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\lib\native\include\spdlog/fmt/bundled/core.h(327): warning C4566: 鐢遍氱敤瀛楃鍚嶇О鈥淺u00B5鈥濊〃绀虹殑瀛楃涓嶈兘鍦ㄥ綋鍓嶄唬鐮侀〉(936)涓〃绀哄嚭鏉 + 1>Z:\TC_install\jingdiao\c\tclib\include_cpp\tccore/Item.hxx(347): warning C4251: 鈥淭eamcenter::Item::name鈥: class鈥渟td::basic_string,std::allocator>鈥濋渶瑕佹湁 dll 鎺ュ彛鐢 class鈥淭eamcenter::Item鈥濈殑瀹㈡埛绔娇鐢 + 1>SAPZYGG2.cxx(46): warning C4996: 'ICS_search_instances': "ICS_search_instances" deprecated in Teamcenter "11.2.2"; Use "ICS_ico_search" instead. + Z:\TC_install\jingdiao\c\tclib\include\ics/ics.h(187): note: 鍙傝鈥淚CS_search_instances鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(271): warning C4267: 鈥滃弬鏁扳: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>SAPZYGG2.cxx(272): warning C4267: 鈥滃弬鏁扳: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>SAPZYGG2.cxx(239): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(242): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(248): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(255): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(258): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(282): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(377): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(380): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(382): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(408): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(434): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(436): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(442): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(458): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(513): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(586): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(590): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(602): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(604): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(648): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(658): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(701): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(703): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(740): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(743): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(744): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(745): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(746): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(938): warning C4267: 鈥滃垵濮嬪寲鈥: 浠庘渟ize_t鈥濊浆鎹㈠埌鈥渋nt鈥濓紝鍙兘涓㈠け鏁版嵁 + 1>SAPZYGG2.cxx(848): warning C4996: 'WSOM_where_referenced': "WSOM_where_referenced" deprecated in Teamcenter "11.3"; Use "WSOM_where_referenced2" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore/workspaceobject.h(887): note: 鍙傝鈥淲SOM_where_referenced鈥濈殑澹版槑 + 1>SAPZYGG2.cxx(929): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead. + Z:\TC_install\jingdiao\c\tclib\include\tccore\aom_prop.h(833): note: 鍙傝鈥淎OM_UIF_ask_value鈥濈殑澹版槑 1>D:\VS2015\VC\include\exception(361): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc Link: D:\VS2015\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"Z:\TC_install\ZhengTai\c\GetBOMProp\x64\Release\BOMToSapOpt.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:Z:\TC_install\ZhengTai\c\sdplog\lib /LIBPATH:Z:\TC_install\jingdiao\c\tclib\lib /LIBPATH:Z:\TC_install\ZhengTai\c\libxl\lib "Z:\TC_install\ZhengTai\c\GetBOMProp\packages\sqdlog.1.0.0\build\..\lib\native\lib\*.lib" "Z:\TC_install\ZhengTai\c\sdplog\lib\*.lib" "Z:\TC_install\jingdiao\c\tclib\lib\*.lib" Z:\TC_install\jingdiao\c\tclib\lib\itk_main.obj "Z:\TC_install\ZhengTai\c\libxl\lib\*.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB:libuser_exits.ar.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug /PDB:"Z:\TC_install\ZhengTai\c\GetBOMProp\x64\Release\BOMToSapOpt.pdb" /SUBSYSTEM:CONSOLE /HEAP:"30000000","9000000" /STACK:"30000000","9000000" /OPT:REF /OPT:ICF /LTCG:incremental /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"Z:\TC_install\ZhengTai\c\GetBOMProp\x64\Release\BOMToSapOpt.lib" /MACHINE:X64 x64\Release\ado.obj @@ -100,6 +241,8 @@ x64\Release\GetBOMProp.obj x64\Release\ocilib.obj x64\Release\readBomMsg.obj + x64\Release\SAPZYGG2.obj + x64\Release\SAPZZNewOp.obj x64\Release\soapC.obj x64\Release\soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.obj x64\Release\soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj @@ -107,9 +250,9 @@ x64\Release\stdsoap2.obj x64\Release\util.obj 姝e湪鐢熸垚浠g爜 - 4 of 7986 functions ( 0.1%) were compiled, the rest were copied from previous compilation. - 0 functions were new in current compilation - 2 functions had inline decision re-evaluated but remain unchanged + 13 of 8278 functions ( 0.2%) were compiled, the rest were copied from previous compilation. + 1 functions were new in current compilation + 109 functions had inline decision re-evaluated but remain unchanged 宸插畬鎴愪唬鐮佺殑鐢熸垚 1>itk_main.obj : warning LNK4099: 鏈壘鍒 PDB鈥渧c160.pdb鈥(浣跨敤鈥渋tk_main.obj鈥濇垨鍦ㄢ淶:\TC_install\ZhengTai\c\GetBOMProp\x64\Release\vc160.pdb鈥濅腑瀵绘壘)锛涙鍦ㄩ摼鎺ュ璞★紝濡傚悓娌℃湁璋冭瘯淇℃伅涓鏍 DFL_BOM_WL_TOERP.vcxproj -> Z:\TC_install\ZhengTai\c\GetBOMProp\x64\Release\BOMToSapOpt.exe @@ -117,4 +260,4 @@ 宸叉垚鍔熺敓鎴愩 -宸茬敤鏃堕棿 00:00:12.84 +宸茬敤鏃堕棿 00:00:20.12 diff --git a/DFL_BOM_WL_TOERP/x64/Release/EBomToPBom.obj b/DFL_BOM_WL_TOERP/x64/Release/EBomToPBom.obj index 1ec5bc5..2b96a6d 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/EBomToPBom.obj and b/DFL_BOM_WL_TOERP/x64/Release/EBomToPBom.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/GetBOMProp.obj b/DFL_BOM_WL_TOERP/x64/Release/GetBOMProp.obj index a0431a0..667b1ee 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/GetBOMProp.obj and b/DFL_BOM_WL_TOERP/x64/Release/GetBOMProp.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/SAPZYGG2.obj b/DFL_BOM_WL_TOERP/x64/Release/SAPZYGG2.obj new file mode 100644 index 0000000..18fbbd3 Binary files /dev/null and b/DFL_BOM_WL_TOERP/x64/Release/SAPZYGG2.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/SAPZZNewOp.obj b/DFL_BOM_WL_TOERP/x64/Release/SAPZZNewOp.obj new file mode 100644 index 0000000..75a2531 Binary files /dev/null and b/DFL_BOM_WL_TOERP/x64/Release/SAPZZNewOp.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/ado.obj b/DFL_BOM_WL_TOERP/x64/Release/ado.obj index c765dab..024c7d4 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/ado.obj and b/DFL_BOM_WL_TOERP/x64/Release/ado.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/createProcessTmp.obj b/DFL_BOM_WL_TOERP/x64/Release/createProcessTmp.obj index 88b87d8..7da83bb 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/createProcessTmp.obj and b/DFL_BOM_WL_TOERP/x64/Release/createProcessTmp.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/msado15.tlh b/DFL_BOM_WL_TOERP/x64/Release/msado15.tlh index 0f61174..1e385ac 100644 --- a/DFL_BOM_WL_TOERP/x64/Release/msado15.tlh +++ b/DFL_BOM_WL_TOERP/x64/Release/msado15.tlh @@ -3,7 +3,7 @@ // z:\tc_install\zhengtai\c\getbomprop\dfl_bom_wl_toerp\x64\release\msado15.tlh // // C++ source equivalent of type library c:\program files\common files\system\ado\msado15.dll -// compiler-generated file created 03/08/24 at 10:11:29 - DO NOT EDIT! +// compiler-generated file created 03/29/24 at 14:46:06 - DO NOT EDIT! #pragma once #pragma pack(push, 8) diff --git a/DFL_BOM_WL_TOERP/x64/Release/msado15.tli b/DFL_BOM_WL_TOERP/x64/Release/msado15.tli index d2dc602..24586ca 100644 --- a/DFL_BOM_WL_TOERP/x64/Release/msado15.tli +++ b/DFL_BOM_WL_TOERP/x64/Release/msado15.tli @@ -3,7 +3,7 @@ // z:\tc_install\zhengtai\c\getbomprop\dfl_bom_wl_toerp\x64\release\msado15.tli // // Wrapper implementations for type library c:\program files\common files\system\ado\msado15.dll -// compiler-generated file created 03/08/24 at 10:11:29 - DO NOT EDIT! +// compiler-generated file created 03/29/24 at 14:46:06 - DO NOT EDIT! #pragma once diff --git a/DFL_BOM_WL_TOERP/x64/Release/ocilib.obj b/DFL_BOM_WL_TOERP/x64/Release/ocilib.obj index 3931fb0..1711d2e 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/ocilib.obj and b/DFL_BOM_WL_TOERP/x64/Release/ocilib.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/readBomMsg.obj b/DFL_BOM_WL_TOERP/x64/Release/readBomMsg.obj index f37455c..8594c6d 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/readBomMsg.obj and b/DFL_BOM_WL_TOERP/x64/Release/readBomMsg.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/soapC.obj b/DFL_BOM_WL_TOERP/x64/Release/soapC.obj index 873ade9..7e54ee2 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/soapC.obj and b/DFL_BOM_WL_TOERP/x64/Release/soapC.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.obj b/DFL_BOM_WL_TOERP/x64/Release/soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.obj index c4df243..ceac3d7 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.obj and b/DFL_BOM_WL_TOERP/x64/Release/soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj b/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj index 7f4e677..5824f1a 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj and b/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj b/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj index 3da97a0..552adeb 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj and b/DFL_BOM_WL_TOERP/x64/Release/soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/stdsoap2.obj b/DFL_BOM_WL_TOERP/x64/Release/stdsoap2.obj index fcda3b8..eba0e51 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/stdsoap2.obj and b/DFL_BOM_WL_TOERP/x64/Release/stdsoap2.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/util.obj b/DFL_BOM_WL_TOERP/x64/Release/util.obj index f76238e..e7cb2ae 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/util.obj and b/DFL_BOM_WL_TOERP/x64/Release/util.obj differ diff --git a/DFL_BOM_WL_TOERP/x64/Release/vc140.pdb b/DFL_BOM_WL_TOERP/x64/Release/vc140.pdb index ffec52a..91809bd 100644 Binary files a/DFL_BOM_WL_TOERP/x64/Release/vc140.pdb and b/DFL_BOM_WL_TOERP/x64/Release/vc140.pdb differ diff --git a/x64/Release/BOMToSapOpt.exe b/x64/Release/BOMToSapOpt.exe index 3a85a3e..9bd70e6 100644 Binary files a/x64/Release/BOMToSapOpt.exe and b/x64/Release/BOMToSapOpt.exe differ diff --git a/x64/Release/BOMToSapOpt.iobj b/x64/Release/BOMToSapOpt.iobj index 10e8fd6..1dd1eed 100644 Binary files a/x64/Release/BOMToSapOpt.iobj and b/x64/Release/BOMToSapOpt.iobj differ diff --git a/x64/Release/BOMToSapOpt.ipdb b/x64/Release/BOMToSapOpt.ipdb index 0fdb398..03fd2fc 100644 Binary files a/x64/Release/BOMToSapOpt.ipdb and b/x64/Release/BOMToSapOpt.ipdb differ diff --git a/x64/Release/BOMToSapOpt.pdb b/x64/Release/BOMToSapOpt.pdb index 507297b..56d77cf 100644 Binary files a/x64/Release/BOMToSapOpt.pdb and b/x64/Release/BOMToSapOpt.pdb differ