コード例 #1
0
void* BinarySerialize::getContainerElement(void* _1, int counter, int counter1)
{
	AMEFDecoder dec;
	AMEFObject* root = (AMEFObject*)_1;
	AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true, false);
	return root2;
}
コード例 #2
0
ファイル: BinarySerialize.cpp プロジェクト: GYGit/ffead-cpp
void* BinarySerialize::getContainerElement(void* _1, const int& counter, const int& counter1)
{
	AMEFDecoder dec;
	AMEFObject* root = static_cast<AMEFObject*>(_1);
	AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true);
	return root2;
}
コード例 #3
0
void* Serialize::unserializemultiset(AMEFObject* root, string objXml)
{
	AMEFDecoder dec;
	string stlclassName = root->getNameStr();
	string className = stlclassName.substr(9,stlclassName.find(">")-9);
	void* t = NULL;
	if(className=="std::string" || className=="string")
		t = new multiset<string>();
	else if(className=="int")
		t = new multiset<int>();
	else if(className=="short")
		t = new multiset<short>();
	else if(className=="long")
		t = new multiset<long>();
	else if(className=="float")
		t = new multiset<float>();
	else if(className=="double")
		t = new multiset<double>();
	else if(className=="bool")
		t = new multiset<bool>();
	else
	{
		return _unserMulSet(objXml,className);
	}
	if(t!=NULL)
	{
		for (int var = 0; var < (int)root->getPackets().size(); var++)
		{
			AMEFObject* root2 = dec.decodeB(root->getPackets().at(var)->getValue(), true, false);
			if(className=="std::string" || className=="string")
				((multiset<string>*)t)->insert(root2->getPackets().at(0)->getValueStr());
			else if(className=="int")
				((multiset<int>*)t)->insert(root2->getPackets().at(0)->getIntValue());
			else if(className=="short")
				((multiset<short>*)t)->insert(root2->getPackets().at(0)->getShortValue());
			else if(className=="long")
				((multiset<long>*)t)->insert(root2->getPackets().at(0)->getNumericValue());
			else if(className=="float")
				((multiset<float>*)t)->insert(root2->getPackets().at(0)->getFloatValue());
			else if(className=="double")
				((multiset<double>*)t)->insert(root2->getPackets().at(0)->getDoubleValue());
			else if(className=="bool")
				((multiset<bool>*)t)->insert(root2->getPackets().at(0)->getBoolValue());
		}
		return t;
	}
	return NULL;
}
コード例 #4
0
void* BinarySerialize::getUnserializableObject(string _1)
{
	AMEFDecoder dec;
	AMEFObject* root = dec.decodeB(_1, true, false);
	return root;
}
コード例 #5
0
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);
	}
}
コード例 #6
0
void* Serialize::_handleAllUnSerialization(string objXml,string className)
{
	AMEFDecoder dec;
	AMEFObject* root = dec.decodeB(objXml, true, false);
	if(root==NULL)
		return NULL;
	if(className=="std::string" || className=="string" || className=="int" || className=="short" ||
					className=="bool" || className=="long" || className=="float" || className=="double")
	{
		root = root->getPackets().at(0);
		if(className=="int" && className==root->getNameStr())
		{
			int *vt = new int;
			*vt = root->getIntValue();
			return vt;
		}
		else if(className=="short" && className==root->getNameStr())
		{
			short *vt = new short;
			*vt = root->getShortValue();
			return vt;
		}
		else if(className=="long" && className==root->getNameStr())
		{
			long *vt = new long;
			*vt = root->getLongValue();
			return vt;
		}
		else if(className=="Date" && className==root->getNameStr())
		{
			DateFormat formt("yyyy-mm-dd hh:mi:ss");
			return formt.parse(root->getValueStr());
		}
		else if(className=="BinaryData" && className==root->getNameStr())
		{
			return BinaryData::unSerilaize(root->getValueStr());
		}
		else if(className=="float" && className==root->getNameStr())
		{
			float *vt = new float;
			*vt = root->getFloatValue();
			return vt;
		}
		else if(className=="double" && className==root->getNameStr())
		{
			double *vt = new double;
			*vt = root->getDoubleValue();
			return vt;
		}
		else if(className=="bool" && className==root->getNameStr())
		{
			bool *vt = new bool;
			*vt = root->getBoolValue();
			return vt;
		}
		else if((className=="std::string" || className=="string") && className==root->getNameStr())
		{
			string *vt = new string;
			*vt = root->getValueStr();
			return vt;
		}
	}
	else if(root->getNameStr()!="")
	{
		if(root->getNameStr().find("vector<")==0)
		{
			return unserializevec(root, objXml);
		}
		else if(root->getNameStr().find("set<")==0)
		{
			return unserializeset(root, objXml);
		}
		else if(root->getNameStr().find("multiset<")==0)
		{
			return unserializemultiset(root, objXml);
		}
		else if(root->getNameStr().find("list<")==0)
		{
			return unserializelist(root, objXml);
		}
		else if(root->getNameStr().find("std::queue<")==0 || root->getNameStr().find("queue<")==0)
		{
			return unserializeq(root, objXml);
		}
		else if(root->getNameStr().find("deque<")==0)
		{
			return unserializedq(root, objXml);
		}
	}
	return _unser(objXml,className);
}