123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include "stdafx.h"
- #include "MaxEDSRule.h"
- #include "XMLSerialization.h"
- #include "OTSFileSys.h"
- #include "Element.h"
- using namespace OTSTools;
- using namespace OTSDATA;
- using namespace xmls;
- void MaxEDSRule::Serialize(bool isStoring, tinyxml2::XMLDocument* classDoc, tinyxml2::XMLElement* rootNode)
- {
- xmls::xString xElementListStr;
- xmls::xString xUsingConstants;
- xmls::xString xImgPropertyListStr;
- xmls::xString xOtherPropertyListStr;
- xmls::xString xExpstr;
- xmls::xDouble xEdsTime;
- xmls::Slo slo;
- slo.Register("EDSTime", &xEdsTime);
- slo.Register("UsingElementList", &xElementListStr);
- slo.Register("UsingConstants", &xUsingConstants);
- slo.Register("UsingImgPropertyList", &xImgPropertyListStr);
- slo.Register("UsingOtherPropertyList", &xOtherPropertyListStr);
- slo.Register("Expression", &xExpstr);
- if (isStoring)
- {
- xEdsTime = m_MaxEDSTime;
- CString s = "";
- for (auto poElement : m_elementList)
- {
- s += poElement->GetName() + ",";
- }
- s = s.TrimRight(",");
- xElementListStr = s;
- for (auto pName : m_ImgPropertyList)
- {
- s += pName.c_str();
- s += ",";
- }
- s = s.TrimRight(",");
- xImgPropertyListStr = s;
- for (auto pName : m_OtherpropertyList)
- {
- s += pName.c_str();
- s += ",";
- }
- s = s.TrimRight(",");
- xOtherPropertyListStr = s;
- slo.Serialize(true, classDoc, rootNode);
- }
- else
- {
- slo.Serialize(false, classDoc, rootNode);
- m_expressionStr = xExpstr.value();
- m_MaxEDSTime = xEdsTime.value();
- std::vector<string> eles;
- std::string elements = xElementListStr.c_str();
- xmls::SplitString(elements, eles, ",");
- for (int i = 0; i < eles.size(); ++i)
- {
- CString ss = eles[i].c_str();
- m_elementList.push_back(CElementPtr(new CElement(ss)));
- }
- std::string propertynames = xImgPropertyListStr.value();
- xmls::SplitString(propertynames, m_ImgPropertyList, ",");
- std::string otherPropertynames = xOtherPropertyListStr.value();
- xmls::SplitString(otherPropertynames, m_OtherpropertyList, ",");
- xmls::SplitString(xUsingConstants.value(), m_usingConstants, ",");
- }
- }
|