#pragma once

#include <stdlib.h>
class CElementContainer;
class CCommonObject;
class CWire;
class CTag;
class CInv;

class CPSCreator
{
public:
	CPSCreator();
	~CPSCreator();
	stringstream& WriteScheme(CList<CCommonObject*, CCommonObject*> *pList);

private:
	void WriteHeader();
	bool HasDefinition(CString strName);
	bool AddDefinition(CMap<CString, LPCTSTR, CString, LPCTSTR> &map, CString strFilename);
	void WriteDefinitions();
	CString ConvertAction(CString strAction, TiXmlElement *pElem, bool bFigureClosed = false);
	void WriteWire(CWire *pWire);
	void WriteTag(CTag *pTag);
	void WriteInv(CInv *pInv);
	void WriteText(CCommonObject *pObj);

public:

private:
	CMap<CString, LPCTSTR, CString, LPCTSTR> m_mapDefinitionsApp;
	CMap<CString, LPCTSTR, CString, LPCTSTR> m_mapDefinitionsPro;
	stringstream ss_out;
	stringstream ss_header;
	stringstream ss_elements;
	stringstream ss_definitions;
	stringstream ss_text;
	CElementContainer *m_pContainer;
};
