void BinarySerialize::addPrimitiveElementToContainer(void* _1, int counter, string className, void* cont, string container) { AMEFDecoder dec; AMEFObject* root = (AMEFObject*)_1; AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true, false); if(className=="std::string" || className=="string") { string retVal = root2->getPackets().at(0)->getValueStr(); addValueToNestedContainer(container, retVal, cont); } else if(className=="int") { int retVal = root2->getPackets().at(0)->getIntValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="short") { short retVal = root2->getPackets().at(0)->getShortValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="long") { long retVal = root2->getPackets().at(0)->getLongValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="long long") { long long retVal = root2->getPackets().at(0)->getLongLongValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="long double") { long double retVal = root2->getPackets().at(0)->getLongDoubleValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned int") { unsigned int retVal = root2->getPackets().at(0)->getUIntValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned short") { unsigned short retVal = root2->getPackets().at(0)->getUShortValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long") { unsigned long retVal = root2->getPackets().at(0)->getULongValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long long") { unsigned long long retVal = root2->getPackets().at(0)->getULongLongValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="float") { float retVal = root2->getPackets().at(0)->getFloatValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="double") { double retVal = root2->getPackets().at(0)->getDoubleValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="bool") { bool retVal = root2->getPackets().at(0)->getBoolValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="char") { char retVal = root2->getPackets().at(0)->getCharValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned char") { unsigned char retVal = root2->getPackets().at(0)->getUCharValue(); addValueToNestedContainer(container, retVal, cont); } }
void JSONSerialize::addPrimitiveElementToContainer(void* _1, int counter, string className, void* cont, string container) { JSONElement* root = (JSONElement*)_1; JSONElement ele = *(root->getChildren().at(counter)); if(className=="std::string" || className=="string") { string retVal = ele.getValue(); addValueToNestedContainer(container, retVal, cont); } else if(className=="int") { int retVal = CastUtil::lexical_cast<int>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="short") { short retVal = CastUtil::lexical_cast<short>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long") { long retVal = CastUtil::lexical_cast<long>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long long") { long long retVal = CastUtil::lexical_cast<long long>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long double") { long double retVal = CastUtil::lexical_cast<long double>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned int") { unsigned int retVal = CastUtil::lexical_cast<unsigned int>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned short") { unsigned short retVal = CastUtil::lexical_cast<unsigned short>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long") { unsigned long retVal = CastUtil::lexical_cast<unsigned long>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long long") { unsigned long long retVal = CastUtil::lexical_cast<unsigned long long>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="float") { float retVal = CastUtil::lexical_cast<float>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="double") { double retVal = CastUtil::lexical_cast<double>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="bool") { bool retVal = CastUtil::lexical_cast<bool>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="char") { char retVal = CastUtil::lexical_cast<char>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned char") { unsigned char retVal = CastUtil::lexical_cast<unsigned char>(ele.getValue()); addValueToNestedContainer(container, retVal, cont); } }
void XMLSerialize::addPrimitiveElementToContainer(void* _1, const int& counter, const std::string& className, void* cont, const std::string& container) { Element* root = (Element*)_1; Element* ele = (Element*)&(root->getChildElements().at(counter)); if(className=="std::string" || className=="string") { std::string retVal = ele->getText(); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="int") { int retVal = CastUtil::lexical_cast<int>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="short") { short retVal = CastUtil::lexical_cast<short>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="long") { long retVal = CastUtil::lexical_cast<long>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="long long") { long long retVal = CastUtil::lexical_cast<long long>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="long double") { long double retVal = CastUtil::lexical_cast<long double>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned int") { unsigned int retVal = CastUtil::lexical_cast<unsigned int>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned short") { unsigned short retVal = CastUtil::lexical_cast<unsigned short>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long") { unsigned long retVal = CastUtil::lexical_cast<unsigned long>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long long") { unsigned long long retVal = CastUtil::lexical_cast<unsigned long long>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="float") { float retVal = CastUtil::lexical_cast<float>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="double") { double retVal = CastUtil::lexical_cast<double>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="bool") { bool retVal = CastUtil::lexical_cast<bool>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="char") { char retVal = CastUtil::lexical_cast<char>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned char") { unsigned char retVal = CastUtil::lexical_cast<unsigned char>(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, retVal, cont); else addValueToNestedContainer(container, retVal, cont); } else if(className=="Date") { DateFormat formt("yyyy-mm-dd hh:mi:ss"); Date* _d = formt.parse(ele->getText()); if(container=="std::set" || container=="std::multiset") addValueToNestedContainerSV(container, *_d, cont); else addValueToNestedContainer(container, *_d, cont); delete _d; } }
void XMLSerialize::addPrimitiveElementToContainer(void* _1, const int& counter, const string& className, void* cont, const string& container) { Element* root = (Element*)_1; Element* ele = root->getChildElements().at(counter); if(className=="std::string" || className=="string") { string retVal = ele->getText(); addValueToNestedContainer(container, retVal, cont); } else if(className=="int") { int retVal = CastUtil::lexical_cast<int>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="short") { short retVal = CastUtil::lexical_cast<short>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long") { long retVal = CastUtil::lexical_cast<long>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long long") { long long retVal = CastUtil::lexical_cast<long long>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="long double") { long double retVal = CastUtil::lexical_cast<long double>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned int") { unsigned int retVal = CastUtil::lexical_cast<unsigned int>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned short") { unsigned short retVal = CastUtil::lexical_cast<unsigned short>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long") { unsigned long retVal = CastUtil::lexical_cast<unsigned long>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned long long") { unsigned long long retVal = CastUtil::lexical_cast<unsigned long long>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="float") { float retVal = CastUtil::lexical_cast<float>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="double") { double retVal = CastUtil::lexical_cast<double>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="bool") { bool retVal = CastUtil::lexical_cast<bool>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="char") { char retVal = CastUtil::lexical_cast<char>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } else if(className=="unsigned char") { unsigned char retVal = CastUtil::lexical_cast<unsigned char>(ele->getText()); addValueToNestedContainer(container, retVal, cont); } }