text: /**
  	* \file PnlWdbeLibRec.cpp
  	* API code for job PnlWdbeLibRec (implementation)
  	* \copyright (C) 2016-2020 MPSI Technologies GmbH
  	* \author Alexander Wirthmueller (auto-generation)
  	* \date created: 5 Dec 2020
  	*/
  // IP header --- ABOVE
  
  #include "PnlWdbeLibRec.h"
  
  using namespace std;
  using namespace Sbecore;
  using namespace Xmlio;
  
  /******************************************************************************
   class PnlWdbeLibRec::VecVDo
   ******************************************************************************/
  
  uint PnlWdbeLibRec::VecVDo::getIx(
  			const string& sref
  		) {
  	string s = StrMod::lc(sref);
  
  	if (s == "butminimizeclick") return BUTMINIMIZECLICK;
  	if (s == "butregularizeclick") return BUTREGULARIZECLICK;
  
  	return(0);
  };
  
  string PnlWdbeLibRec::VecVDo::getSref(
  			const uint ix
  		) {
  	if (ix == BUTMINIMIZECLICK) return("ButMinimizeClick");
  	if (ix == BUTREGULARIZECLICK) return("ButRegularizeClick");
  
  	return("");
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::ContInf
   ******************************************************************************/
  
  PnlWdbeLibRec::ContInf::ContInf(
  			const string& TxtRef
  		) :
  			Block()
  		{
  	this->TxtRef = TxtRef;
  
  	mask = {TXTREF};
  };
  
  bool PnlWdbeLibRec::ContInf::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "ContInfWdbeLibRec");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "ContitemInfWdbeLibRec";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxtRef", TxtRef)) add(TXTREF);
  	};
  
  	return basefound;
  };
  
  set<uint> PnlWdbeLibRec::ContInf::comm(
  			const ContInf* comp
  		) {
  	set<uint> items;
  
  	if (TxtRef == comp->TxtRef) insert(items, TXTREF);
  
  	return(items);
  };
  
  set<uint> PnlWdbeLibRec::ContInf::diff(
  			const ContInf* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {TXTREF};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::StatApp
   ******************************************************************************/
  
  PnlWdbeLibRec::StatApp::StatApp(
  			const bool initdoneDetail
  			, const bool initdoneAMakefile
  			, const bool initdoneMNVersion
  		) :
  			Block()
  		{
  	this->initdoneDetail = initdoneDetail;
  	this->initdoneAMakefile = initdoneAMakefile;
  	this->initdoneMNVersion = initdoneMNVersion;
  
  	mask = {INITDONEDETAIL, INITDONEAMAKEFILE, INITDONEMNVERSION};
  };
  
  bool PnlWdbeLibRec::StatApp::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatAppWdbeLibRec");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "StatitemAppWdbeLibRec";
  
  	if (basefound) {
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneDetail", initdoneDetail)) add(INITDONEDETAIL);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneAMakefile", initdoneAMakefile)) add(INITDONEAMAKEFILE);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "initdoneMNVersion", initdoneMNVersion)) add(INITDONEMNVERSION);
  	};
  
  	return basefound;
  };
  
  set<uint> PnlWdbeLibRec::StatApp::comm(
  			const StatApp* comp
  		) {
  	set<uint> items;
  
  	if (initdoneDetail == comp->initdoneDetail) insert(items, INITDONEDETAIL);
  	if (initdoneAMakefile == comp->initdoneAMakefile) insert(items, INITDONEAMAKEFILE);
  	if (initdoneMNVersion == comp->initdoneMNVersion) insert(items, INITDONEMNVERSION);
  
  	return(items);
  };
  
  set<uint> PnlWdbeLibRec::StatApp::diff(
  			const StatApp* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {INITDONEDETAIL, INITDONEAMAKEFILE, INITDONEMNVERSION};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::StatShr
   ******************************************************************************/
  
  PnlWdbeLibRec::StatShr::StatShr(
  			const uint ixWdbeVExpstate
  			, const string& scrJrefDetail
  			, const string& scrJrefAMakefile
  			, const string& scrJrefMNVersion
  			, const bool ButRegularizeActive
  		) :
  			Block()
  		{
  	this->ixWdbeVExpstate = ixWdbeVExpstate;
  	this->scrJrefDetail = scrJrefDetail;
  	this->scrJrefAMakefile = scrJrefAMakefile;
  	this->scrJrefMNVersion = scrJrefMNVersion;
  	this->ButRegularizeActive = ButRegularizeActive;
  
  	mask = {IXWDBEVEXPSTATE, SCRJREFDETAIL, SCRJREFAMAKEFILE, SCRJREFMNVERSION, BUTREGULARIZEACTIVE};
  };
  
  bool PnlWdbeLibRec::StatShr::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	string srefIxWdbeVExpstate;
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatShrWdbeLibRec");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "StatitemShrWdbeLibRec";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "srefIxWdbeVExpstate", srefIxWdbeVExpstate)) {
  			ixWdbeVExpstate = VecWdbeVExpstate::getIx(srefIxWdbeVExpstate);
  			add(IXWDBEVEXPSTATE);
  		};
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefDetail", scrJrefDetail)) add(SCRJREFDETAIL);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefAMakefile", scrJrefAMakefile)) add(SCRJREFAMAKEFILE);
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "scrJrefMNVersion", scrJrefMNVersion)) add(SCRJREFMNVERSION);
  		if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButRegularizeActive", ButRegularizeActive)) add(BUTREGULARIZEACTIVE);
  	};
  
  	return basefound;
  };
  
  set<uint> PnlWdbeLibRec::StatShr::comm(
  			const StatShr* comp
  		) {
  	set<uint> items;
  
  	if (ixWdbeVExpstate == comp->ixWdbeVExpstate) insert(items, IXWDBEVEXPSTATE);
  	if (scrJrefDetail == comp->scrJrefDetail) insert(items, SCRJREFDETAIL);
  	if (scrJrefAMakefile == comp->scrJrefAMakefile) insert(items, SCRJREFAMAKEFILE);
  	if (scrJrefMNVersion == comp->scrJrefMNVersion) insert(items, SCRJREFMNVERSION);
  	if (ButRegularizeActive == comp->ButRegularizeActive) insert(items, BUTREGULARIZEACTIVE);
  
  	return(items);
  };
  
  set<uint> PnlWdbeLibRec::StatShr::diff(
  			const StatShr* comp
  		) {
  	set<uint> commitems;
  	set<uint> diffitems;
  
  	commitems = comm(comp);
  
  	diffitems = {IXWDBEVEXPSTATE, SCRJREFDETAIL, SCRJREFAMAKEFILE, SCRJREFMNVERSION, BUTREGULARIZEACTIVE};
  	for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
  
  	return(diffitems);
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::Tag
   ******************************************************************************/
  
  PnlWdbeLibRec::Tag::Tag(
  			const string& Cpt
  		) :
  			Block()
  		{
  	this->Cpt = Cpt;
  
  	mask = {CPT};
  };
  
  bool PnlWdbeLibRec::Tag::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "TagWdbeLibRec");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	string itemtag = "TagitemWdbeLibRec";
  
  	if (basefound) {
  		if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "Cpt", Cpt)) add(CPT);
  	};
  
  	return basefound;
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::DpchAppDo
   ******************************************************************************/
  
  PnlWdbeLibRec::DpchAppDo::DpchAppDo(
  			const string& scrJref
  			, const uint ixVDo
  			, const set<uint>& mask
  		) :
  			DpchAppWdbe(VecWdbeVDpch::DPCHAPPWDBELIBRECDO, scrJref)
  		{
  	if (find(mask, ALL)) this->mask = {SCRJREF, IXVDO};
  	else this->mask = mask;
  
  	this->ixVDo = ixVDo;
  };
  
  string PnlWdbeLibRec::DpchAppDo::getSrefsMask() {
  	vector<string> ss;
  	string srefs;
  
  	if (has(SCRJREF)) ss.push_back("scrJref");
  	if (has(IXVDO)) ss.push_back("ixVDo");
  
  	StrMod::vectorToString(ss, srefs);
  
  	return(srefs);
  };
  
  void PnlWdbeLibRec::DpchAppDo::writeXML(
  			xmlTextWriter* wr
  		) {
  	xmlTextWriterStartElement(wr, BAD_CAST "DpchAppWdbeLibRecDo");
  	xmlTextWriterWriteAttribute(wr, BAD_CAST "xmlns", BAD_CAST "http://www.mpsitech.com/wdbe");
  		if (has(SCRJREF)) writeString(wr, "scrJref", scrJref);
  		if (has(IXVDO)) writeString(wr, "srefIxVDo", VecVDo::getSref(ixVDo));
  	xmlTextWriterEndElement(wr);
  };
  
  /******************************************************************************
   class PnlWdbeLibRec::DpchEngData
   ******************************************************************************/
  
  PnlWdbeLibRec::DpchEngData::DpchEngData() :
  			DpchEngWdbe(VecWdbeVDpch::DPCHENGWDBELIBRECDATA)
  		{
  };
  
  string PnlWdbeLibRec::DpchEngData::getSrefsMask() {
  	vector<string> ss;
  	string srefs;
  
  	if (has(SCRJREF)) ss.push_back("scrJref");
  	if (has(CONTINF)) ss.push_back("continf");
  	if (has(STATAPP)) ss.push_back("statapp");
  	if (has(STATSHR)) ss.push_back("statshr");
  	if (has(TAG)) ss.push_back("tag");
  
  	StrMod::vectorToString(ss, srefs);
  
  	return(srefs);
  };
  
  void PnlWdbeLibRec::DpchEngData::readXML(
  			xmlXPathContext* docctx
  			, string basexpath
  			, bool addbasetag
  		) {
  	clear();
  
  	bool basefound;
  
  	if (addbasetag)
  		basefound = checkUclcXPaths(docctx, basexpath, basexpath, "DpchEngWdbeLibRecData");
  	else
  		basefound = checkXPath(docctx, basexpath);
  
  	if (basefound) {
  		if (extractStringUclc(docctx, basexpath, "scrJref", "", scrJref)) add(SCRJREF);
  		if (continf.readXML(docctx, basexpath, true)) add(CONTINF);
  		if (statapp.readXML(docctx, basexpath, true)) add(STATAPP);
  		if (statshr.readXML(docctx, basexpath, true)) add(STATSHR);
  		if (tag.readXML(docctx, basexpath, true)) add(TAG);
  	} else {
  		continf = ContInf();
  		statapp = StatApp();
  		statshr = StatShr();
  		tag = Tag();
  	};
  };
  