예제 #1
0
	void XMLFileSerializer::WriteChild(tstringstream & strstr, XMLContainer & element, uint32 & tabs)
	{
		strstr << GetTabString(tabs) << _T("<") << element.GetName();
		WriteAtributes(strstr, element);
		if(element.size() == 0 && element.GetValue() == EMPTY_STRING)
		{
			strstr << _T("/>") << std::endl;
		}
		else
		{
			strstr << _T(">") << std::endl;
			if(element.GetValue() != EMPTY_STRING)
			{
				++tabs;
				strstr << GetTabString(tabs) << element.GetValue() << std::endl;
				--tabs;
				strstr << GetTabString(tabs);
				strstr << _T("</") << element.GetName();
				strstr << _T(">") << std::endl;
			}
			else if(element.size() > 0)
			{
				++tabs;
				for(auto child : element)
				{
					XMLContainer child_value;
					child_value = *(child.second);
					WriteChild(strstr, child_value, tabs);
				}
				--tabs;
				strstr << GetTabString(tabs) << _T("</") << element.GetName() << _T(">") << std::endl;
			}
		}
	}
예제 #2
0
	tstring XMLFileSerializer::WriteFile(XMLContainer & container)
	{
		tstringstream strstrResult;
		strstrResult << _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") << std::endl;
		uint32 tabs(0);
		WriteChild(strstrResult, container, tabs);

		return strstrResult.str();
	}
예제 #3
0
	void XMLFileSerializer::Write(XMLContainer & container)
	{
		tstringstream strstrResult;
		strstrResult << _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") << std::endl;
		uint32 tabs(0);
		WriteChild(strstrResult, container, tabs);

		tofstream resultFile;
		resultFile.open(m_File.GetAssetsPath());
		resultFile << strstrResult.str();
		resultFile.close();
	}