Index: /bdm/userinfo.h
===================================================================
--- /bdm/userinfo.h (revision 127)
+++ /bdm/userinfo.h (revision 142)
@@ -6,6 +6,8 @@
 #include <stdio.h>
 #include <string>
+#include <typeinfo>
 #include <map>
 #include <utility>
+#include <vector>
 #include <xercesc/dom/DOM.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
@@ -24,5 +26,4 @@
 using namespace std;
 
-
 /*!
 @brief Xerces interface class
@@ -30,5 +31,5 @@
 This class is used to interact with the Xerces library.
 */
-class GlobalXercesConnector
+class XercesConnector
 {
 public:
@@ -37,16 +38,33 @@
 	//! This DOMWriter is used to export internal data into xml files
 	DOMWriter *pSerializer;
-	//! This DOMWriter is used to import external data from xml files
-	XercesDOMParser *pParser;
-
-
+
+private:
 	//!default constructor
-	GlobalXercesConnector();
+	XercesConnector();
 	//!destructor
-	~GlobalXercesConnector();
+	~XercesConnector();
+	//!forbidden copy constructor
+	XercesConnector( XercesConnector& ref );
+public:
+
+	DOMDocument* Parse( const LocalFileInputSource & inputSource )
+	{
+		//! This DOMWriter is used to import external data from xml files
+		XercesDOMParser parser;
+
+		parser.setValidationScheme(XercesDOMParser::Val_Auto);
+		parser.setDoNamespaces(false);
+		parser.setDoSchema(false);
+
+		parser.parse( inputSource );
+		if( parser.getErrorCount() )
+			return NULL;
+		
+		return parser.adoptDocument();	
+	}
 
 
 	//! function transcodes Xerces' XMLCh-based strings into C++ strings
-	static string XMLCh2str( const XMLCh* const  XMLCh_str );
+	string XMLCh2str( const XMLCh* const  XMLCh_str );
 
 	class Comparator
@@ -56,252 +74,408 @@
 		bool operator()( const XMLCh* const a , const XMLCh* const b) const;
 	};
-};
-
-//! The only global instance of the GlobalXercesConnector class
-extern const GlobalXercesConnector XMLConnector;
+
+	//! The only global instance of the XercesConnector class
+	// potrebujeme inicializaci hned v okamziku zavolani!!
+	static XercesConnector& instance()
+	{
+		static XercesConnector gxc;
+		return gxc;
+	};
+};
+
+class BindingFrame
+{
+public:
+	// nacpe na prislusne pointery, kdyztak da NULL
+	virtual void AssemblyBindedData( DOMElement &element ) = 0;
+
+	// uvolneni pameti po slozeni objektu, tj. lze jedine po AssemblyBD
+	virtual void ReleaseUsedMemory() = 0;
+
+	// vrati bool, pokud se povedlo rozebrat a naplnit element
+	// nebude tu nahodou jeste ten help - string??
+	virtual bool DisassemblyBindedData( DOMElement &element ) = 0;		
+};
 
 
 /*!
-@brief User Info base class
-
-This class is used to store information about parameters of an object. It support loading and saving of the information and, potentially, interaction with the user.
+@brief UserInfo class is for internal purposes only. Use CompoundUserInfo<T> instead.
+
+The raison d'etre of this class is to allow pointers to (the main part of) 
+CompoundUserInfo<T> objects even for different generic types.
 */
 
-class Attribute 
+class UserInfo : public BindingFrame
 {
 private:
-	//! Name which identifies the attribute among others related to the same XML-tag, 
-	//! must be unique within its context!
-	XMLCh* const transcodedName;
-
-public:
-	//! Type definition of mapping which transforms names to the related attributes 
-	typedef map<const XMLCh* const, Attribute* const, GlobalXercesConnector::Comparator> MappedAttributes;
-
-	//! The only constructor which fills the transcodedName attribute
-	Attribute( const string name );
-	//! Destructor
-	~Attribute();
-
-	//! Set accessor to this attribute converting input string into a properly-typed value 
-	virtual void Set( const string str ) = 0;
-	//! Get accessor converting stored value into a string
-	virtual const string Get() = 0;	
-	//! This method is the key method to connect the attribute to the related UI element
-	void Attach( MappedAttributes &externalAttributes);
-	//! This method add and DOMAttribute node to the DOMElement passed as an argument
-	void FillAttribute(DOMElement &element);
-};
-
-/*!
-@brief Class encapsulating all the necessary stuff to work with the double attribute 
-*/
-class DoubleAttribute: public Attribute
-{
-public:
-	double value;
-	DoubleAttribute( const string name);
-	void Set( const string str );
-	const string Get();
-};
-
-
-/*!
-@brief Class encapsulating all the necessary stuff to work with an int attribute 
-*/
-class IntAttribute : public Attribute
-{
-public:
-	int value;
-	IntAttribute( const string name );
-	void Set( const string str );
-	const string Get();
-};
-
-/*!
-@brief Class encapsulating all the necessary stuff to work with a string attribute 
-*/
-class StringAttribute : public Attribute
-{
-public:
-	string value;
-	StringAttribute( const string name );
-	void Set( const string str );
-	const string Get();
-};
-
-/*!
-@brief UserInfoCore class is for internal purposes only. Use UserInfo<T> instead.
-
-The raison d'etre of this class is to allow pointers to (the main part of) 
-UserInfo<T> objects even for different generic types.
-*/
-class UserInfoCore
-{
-public:
-	//! Fills internal attributes and descendant elements according DOMElement
-	virtual void ParseElement(DOMElement *element) = 0;
-
-	//! Fills DOMElement according internal attributes and descendant elements
-	virtual void FillElement(DOMElement &element) = 0;
-};
-
-/*!
-@brief The main user info template class
-
-You should derive this class whenever you need new UserInfo.
-*/
-template<typename T> class UserInfo : public UserInfoCore
-{
-private:
-	//! Name which identifies the element among others related to the same XML-tag, 
-	//! must be unique within its context!
-	XMLCh* transcodedName;
+	//! Type definition of mapping which transforms type names to the related user infors
+	typedef map< const string, UserInfo*> MappedName2UI;
 	
-	//! Type definition of mapping which transforms names to the related elements
-	typedef map<const XMLCh* const, UserInfoCore* const, GlobalXercesConnector::Comparator> MappedElements;
-
-protected:
-	//! MappiLength of the output vector
-	MappedElements elements;
-	//! Length of the output vector
-	Attribute::MappedAttributes attributes;
-
-public:
-	//! Explanation for an user is the only obligatory attribute
-	StringAttribute help;
-
-	//! The only constructor which fills both the transcodedName and the help attribute
-	UserInfo<T>( 
-		const string name, 
-		const string help_msg = "" ) 
-		: help("help"),		
-		transcodedName( XMLString::transcode( name.c_str() ) )
+	//! Mapped 
+	static MappedName2UI& mappedName2UI()
+	{
+		static MappedName2UI var;
+		return var;
+	}
+
+	const string underlyingTypeName;
+
+public:
+
+	//! The only constructor which fills both the transcodedTypeName and the help attribute
+	UserInfo( const string& underlyingTypeName )
+		: underlyingTypeName ( underlyingTypeName )
 	{	
-		XMLString::upperCase( transcodedName );
-		help.Attach( attributes );
-		help.value = help_msg;
-	};
-	//! Destructor
-	~UserInfo<T>()
-	{
-		XMLString::release( (XMLCh**)&transcodedName );
-	}
-
-	//! returns object of templated type filled with data stored in this UserInfo instance
-	virtual T* build(void) = 0;
-
-	//! Save UserInfo to the file (typically with an XML extension)
-	void Save ( char* fileName )
-	{
-		XMLCh* transcodedFileName = XMLString::transcode( fileName );
-		LocalFileFormatTarget outputTarget( transcodedFileName );
-		XMLString::release( &transcodedFileName );
-
-		DOMDocument* pDoc = XMLConnector.pImplementation->createDocument( 
-			XMLString::transcode( "M3K USER INFO" ), 
-			XMLString::transcode( "ROOT" ), NULL );
-		DOMElement *pRoot = pDoc->getDocumentElement();
-
-		FillElement( *pRoot );
-
-		XMLConnector.pSerializer->writeNode( &outputTarget, *pDoc);
-		delete pDoc;
-	}	
-	//! Load UserInfo from the file (typically with an XML extension)
-	void Load ( char* fileName ) 
-	{
-		bool bFailed = false;
-
-		try
-		{
-			XMLCh* transcodedFileName = XMLString::transcode( fileName ) ;
-			const LocalFileInputSource inputSource( transcodedFileName );		
-			XMLString::release( &transcodedFileName );
-
-			XMLConnector.pParser->parse( inputSource );
-			bFailed = ( XMLConnector.pParser->getErrorCount() != 0 );
-		}
-		catch (...)
-		{
-			bFailed = true;
-		}
-
-		if( !bFailed)
-		{
-			DOMDocument *pDoc = XMLConnector.pParser->getDocument();		
-			DOMElement *pRoot = pDoc->getDocumentElement();
-			bFailed = true;
-			for( DOMNode* node = pRoot->getFirstChild(); node != NULL; node = node->getNextSibling() )
-				if( node->getNodeType() == DOMNode::ELEMENT_NODE )
-				{
-					ParseElement( (DOMElement*) node );
-					bFailed = false;
-					break;
-				}
-		}
-
-		if( bFailed )
-		{
-			// exception?!
-		}		
-	}
-	//! This method is the key method to connect the element to its parent UI element
-	void Attach( MappedElements &externalElements)
-	{
-		pair<const XMLCh* const, UserInfoCore* const> newPair( transcodedName, this );
-		externalElements.insert(newPair);
-	}
+		// trik, chci jen to, aby se inicializoval!!
+		XercesConnector::instance();
+
+		cout << underlyingTypeName;
+
+		mappedName2UI().insert( make_pair( underlyingTypeName, this ) );
+	}
+
+	~UserInfo()
+	{		
+	}
+
+public:
 	
-	void ParseElement(DOMElement *element) 
-	{
-		DOMNodeList* nodeList = element->getChildNodes();
-		if( nodeList )
-			for( int i = 0; i < nodeList->getLength(); i++ )
+	virtual void BuildInternal(void* &pInstance) = 0;
+
+	//! returns object of templated type filled with data stored in this CompoundUserInfo instance
+	// NULL if error..
+	template<class T>
+	static void Assembly( const string tagName, DOMElement &element, T* &pInstance  )
+	{	
+		pInstance = NULL;
+
+		XMLCh* transcodedTagName = XMLString::transcode( tagName.c_str() );		
+		XMLString::upperCase( transcodedTagName );
+
+/*/////////////////////////
+		DOMNodeList* nodeListe = element.getChildNodes();
+		if( nodeListe )
+			for( int i = 0; i < nodeListe->getLength(); i++ )
 			{
-				DOMNode* node = nodeList->item(i);
+				DOMNode* node = nodeListe->item(i);
 				if( node->getNodeType() == DOMNode::ELEMENT_NODE )
 				{
 					DOMElement* childElement = (DOMElement*) node;
-					MappedElements::const_iterator iter = elements.find( childElement->getTagName() );
-
-					if( iter != elements.end())
-						iter->second->ParseElement( childElement );
+					cout << XercesConnector::instance().XMLCh2str( childElement->getTagName() );
 				}
 			}
-			
-		DOMNamedNodeMap* nodeMap = element->getAttributes();
-		if( nodeMap )
-			for( int i = 0; i < nodeMap->getLength(); i++ )
+		getchar();
+
+*/////////////////////////////
+
+
+		DOMNodeList* const nodeList = element.getElementsByTagName( transcodedTagName );
+		XMLString::release( (XMLCh**)&transcodedTagName );
+
+		if( nodeList != NULL && nodeList->getLength() != 1 )
+			return;
+
+		// TAKZE MAME V RUCE ELEMENT SE JMENEM "tagName"
+		DOMElement* childElement = (DOMElement*) nodeList->item(0);
+
+		// COZ O TO, UDELAL BYCH TO STATICKOU KONSTANTOU, ALE JAK JI PAK SMAZU??
+		XMLCh* transcodedTypeAttributeName = XMLString::transcode("type");
+		const XMLCh* const transcodedType = childElement->getAttribute( transcodedTypeAttributeName );
+		XMLString::release( (XMLCh**)&transcodedTypeAttributeName );
+
+		if( !XMLString::stringLen( transcodedType ) )
+			return;
+
+		// TED MAME V RUCE JMENO TYPU Z ATRIBUTU TYPE
+		string type = XercesConnector::instance().XMLCh2str( transcodedType );
+
+		MappedName2UI::const_iterator iter = mappedName2UI().find( type  );
+		if( iter == mappedName2UI().end())
+			return;
+
+		// A TED PRISLUSNE UI
+		UserInfo *relatedUI = iter->second;
+		relatedUI->AssemblyBindedData( *childElement );		
+		relatedUI->BuildInternal( (void*&)pInstance );
+		relatedUI->ReleaseUsedMemory();
+
+		if( pInstance == NULL )
+			return;
+
+		try
+		{
+			// takhle to zkontroluju? name musi byt shodne s name nahore!!
+			// takze mame typ T, ale name bud od jeho potomka.. oki??
+			string resultingType = typeid( *pInstance ).name();
+			if( resultingType != type )
 			{
-				DOMNode* node = nodeMap->item(i);
-				if( node->getNodeType() == DOMNode::ATTRIBUTE_NODE )
+				cout << "FATAL ERROR!!" << endl;
+				pInstance = NULL;
+			}			
+		}
+		catch(...)
+		{
+			// delete? ale jak na to? asi tezko
+			pInstance = NULL;
+		}		
+		return;
+	}	
+
+	// ? pri destrukci si za ne naopak zodpovida ten, kdo je vytvoril.. protoze 
+	// budou zit v tom objektu!! tak jakapak destrkuce..
+};
+
+
+template<typename T> class TypedUserInfo : public UserInfo
+{
+protected:
+
+	//! The only constructor which fills 
+	TypedUserInfo<T>( ) 
+		: UserInfo( typeid(T).name() ) 
+	{	
+	};
+
+	//! Destructor
+	~TypedUserInfo<T>()
+	{
+	}
+
+public:
+	// FRIEND radeji
+	void BuildInternal(void* &pInstance)
+	{
+		T* &pTypedInstance = (T*&) pInstance;
+		Build( pTypedInstance );
+	}
+
+	virtual void Build(T* &pTypedInstance) = 0;
+
+	static const TypedUserInfo<T> &instance;
+};
+
+
+
+/*!
+@brief The main user info template class
+
+You should derive this class whenever you need new CompoundUserInfo.
+*/
+template<typename T> class CompoundUserInfo : public TypedUserInfo<T>
+{
+private:
+	//! Mapped elements, i.e., descendant html tags
+	vector<BindingFrame* const> bindedElements;
+
+protected:
+	template<typename U> class BindedType: public BindingFrame
+	{
+	private:
+		const TypedUserInfo<U> &factory;
+		string name;
+		string help;
+
+	public:
+		U* pInstance;
+
+		BindedType<U>( CompoundUserInfo<T> *parent, string name, string help ) 
+			: name( name), help(help)
+			factory( TypedUserInfo<U>::instance )		
+		{
+			parent->bindedElements.push_back( this );
+			pInstance = NULL;
+		}
+
+		BindedType<U>( CompoundUserInfo<T> *parent, string name ) 
+			: name( name), help(""),
+			factory( TypedUserInfo<U>::instance )		
+		{
+			parent->bindedElements.push_back( this );
+			pInstance = NULL;
+		}
+
+		void AssemblyBindedData( DOMElement &element )
+		{
+			factory.Assembly( pInstance, element, name );
+		}
+
+		void ReleaseUsedMemory()
+		{
+			if( pInstance != NULL )
+				delete pInstance;
+		}
+
+		bool DisassemblyBindedData( DOMElement &element )
+		{
+	//		return factory.Disassembly( (void*&) pInstance, element, name, help );
+			return true;
+		}
+	};
+
+
+public:
+
+	void AssemblyBindedData( DOMElement &element )
+	{
+		for( unsigned int ind = 0; ind < bindedElements.size(); ind++ )
+			bindedElements[ind]->AssemblyBindedData( element );
+	}
+
+	void ReleaseUsedMemory()
+	{			
+		for( unsigned int ind = 0; ind < bindedElements.size(); ind++ )
+			bindedElements[ind]->ReleaseUsedMemory();
+	}
+
+	bool DisassemblyBindedData( DOMElement &element )
+	{
+		for( unsigned int ind = 0; ind < bindedElements.size(); ind++ )
+			if( !bindedElements[ind]->DisassemblyBindedData( element ) )
+				return false;
+		return true;
+	}
+};
+
+
+	/*	
+	//! returns object of templated type filled with data stored in this CompoundUserInfo instance
+	bool Disassembly(void * &pInstance, DOMElement &element, string name, char * help = "" )
+	{
+		T* &pTypedInstance = (T*&) pInstance;
+		// do elementu prida vetev se jmenem name a vyplni obsahujici data z instance
+		// zde nemuze vzniknout zadna chyba, ponevadz XML vytvarime 
+
+/*
+		for( MappedElements::const_iterator iter = elements.begin(); iter != elements.end(); iter++)
+		{
+			iter->second->AppendElement( *pHead );
 				{
-					DOMAttr* attribute = (DOMAttr*) node;
-					Attribute::MappedAttributes::const_iterator iter = attributes.find( attribute->getName() );
-
-					if( iter != attributes.end())
-					{
-						string attributeValue = GlobalXercesConnector::XMLCh2str( attribute->getValue() );
-						iter->second->Set( attributeValue );
-					}
-				}
+		DOMDocument* pDoc = element.getOwnerDocument();
+
+		DOMElement* pHead = pDoc->createElement( transcodedTypeName );		
+		element.appendChild( pHead );
+
+		FillElement( pHead );
+}
 			}
-	}
-	
-	void FillElement(DOMElement &element)
-	{
-		DOMDocument* pDoc = element.getOwnerDocument();
-
-		DOMElement* pHead = pDoc->createElement( transcodedName );		
-		element.appendChild( pHead );
-
-		for( MappedElements::const_iterator iter = elements.begin(); iter != elements.end(); iter++)
-			iter->second->FillElement( *pHead );
-
-		for( Attribute::MappedAttributes::iterator iter = attributes.begin(); iter != attributes.end(); iter++)
-			iter->second->FillAttribute( *pHead );
-	}
-};
+
+		for( MappedAttributes::iterator iter = attributes.begin(); iter != attributes.end(); iter++)
+		{
+			// we do not create attributes, which are empty
+			if( !strcmp( iter->second->c_str(), "") )
+				continue;
+
+			DOMDocument* pDoc = pHead->getOwnerDocument();
+			DOMAttr* pAttribute = pDoc->createAttribute( iter->first );
+
+			XMLCh* transcodedValue = XMLString::transcode( iter->second->c_str() ); 
+			pAttribute->setValue( transcodedValue );
+			XMLString::release( &transcodedValue );
+
+			pHead->setAttributeNode(pAttribute);			
+		}
+		return true;
+	}
+*/
+
+
+template<typename T> class ValuedUserInfo : public TypedUserInfo<T>
+{
+
+private:
+	const XMLCh* const transcodedValueName;
+
+public:
+	// Value nemusi byt pointer, na rozdil od ostatnich binding framu..
+	string value;
+
+	ValuedUserInfo<T>()
+		: transcodedValueName( XMLString::transcode( "value" ))
+	{
+	}
+
+	~ValuedUserInfo<T>()
+	{
+		XMLString::release( (XMLCh**)&transcodedValueName );
+	}
+
+	void AssemblyBindedData( DOMElement &element )
+	{		
+		const XMLCh* const transcodedValue = element.getAttribute( transcodedValueName );
+		value = XercesConnector::instance().XMLCh2str( transcodedValue );
+	}
+
+	void ReleaseUsedMemory()
+	{			
+	}
+
+	bool DisassemblyBindedData( DOMElement &element )
+	{
+//		if( value.length()==0 )
+//			return false;
+		return true;
+	}
+};
+
+
+class RootElement 
+{
+// umi se pretypovat na DOMElement &element	
+// a to vzdy, save a load se muze udelat az pak!!
+
+private:
+	DOMElement * pRoot;
+	DOMDocument* pDoc;
+
+	const XMLCh* const transcodedFileName ;
+
+public:
+
+	RootElement( char* fileName )
+		: transcodedFileName( XMLString::transcode( fileName ) )
+	{		
+		pDoc = XercesConnector::instance().pImplementation->createDocument( 
+			XMLString::transcode( "M3K USER INFO" ), 
+			XMLString::transcode( "ROOT" ), NULL );
+		pRoot = pDoc->getDocumentElement();
+	}
+
+	~RootElement()
+	{
+		XMLString::release( (XMLCh**)&transcodedFileName );
+		if( pDoc ) 
+			delete pDoc;		
+	}
+
+	//! loads root element from a file
+	bool Load( void ) 
+	{
+		const LocalFileInputSource inputSource( transcodedFileName );		
+		DOMDocument * newDoc = XercesConnector::instance().Parse( inputSource );
+		if( newDoc == NULL )					
+			return false;
+
+		if( pDoc ) 
+			delete pDoc;		
+
+		pDoc = newDoc;			
+		pRoot = pDoc->getDocumentElement();
+		return true;		
+	}
+
+
+	//! Save UserInfo to the file (typically with an XML extension)
+	void Save ( void )
+	{
+		LocalFileFormatTarget outputTarget( transcodedFileName );	
+		XercesConnector::instance().pSerializer->writeNode( &outputTarget, *pDoc);
+	}	
+
+	operator DOMElement&()
+	{
+		return *pRoot;
+	}
+};
+
 
 #endif // #ifndef UI_H
Index: /bdm/userinfo.cpp
===================================================================
--- /bdm/userinfo.cpp (revision 127)
+++ /bdm/userinfo.cpp (revision 142)
@@ -13,5 +13,5 @@
 #include "userinfo.h"
 
-GlobalXercesConnector::GlobalXercesConnector()
+XercesConnector::XercesConnector()
 {
 	// initialize the XML library
@@ -27,14 +27,8 @@
 	if (pSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
 		pSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
-
-	pParser = new XercesDOMParser;	
-	pParser->setValidationScheme(XercesDOMParser::Val_Auto);
-	pParser->setDoNamespaces(false);
-	pParser->setDoSchema(false);
 }
 
-GlobalXercesConnector::~GlobalXercesConnector()
+XercesConnector::~XercesConnector()
 {
-	delete pParser; 
 	delete pSerializer;
 
@@ -43,5 +37,5 @@
 }
 
-string GlobalXercesConnector::XMLCh2str( const XMLCh* const  XMLCh_str )
+string XercesConnector::XMLCh2str( const XMLCh* const  XMLCh_str )
 {
 	char *local = XMLString::transcode( XMLCh_str );
@@ -51,106 +45,7 @@
 }
 
-bool GlobalXercesConnector::Comparator::operator()( const XMLCh* const a , const XMLCh* const b) const
+bool XercesConnector::Comparator::operator()( const XMLCh* const a , const XMLCh* const b) const
 {
 	return ( XMLString::compareString(a,b) > 0);
 }	
 
-const GlobalXercesConnector XMLConnector;
-
-//////////////////////
-
-Attribute::Attribute( const string name ) 
-	: 	transcodedName ( XMLString::transcode( name.c_str() ) ) 
-{	
-	XMLString::lowerCase( transcodedName );
-}
-
-Attribute::~Attribute() 
-{		 
-	XMLString::release( (XMLCh**)&transcodedName );
-}
-
-void Attribute::Attach( MappedAttributes &externalAttributes)
-{
-	pair<const XMLCh* const, Attribute* const> newPair( transcodedName, this );
-	externalAttributes.insert(newPair);
-}
-
-void Attribute::FillAttribute(DOMElement &element)
-{
-	DOMDocument* pDoc = element.getOwnerDocument();
-	DOMAttr* pAttribute = pDoc->createAttribute( transcodedName );
-
-	const string attributeValue = Get();
-	XMLCh* transcodedValue = XMLString::transcode( attributeValue.c_str() ); 
-	pAttribute->setValue( transcodedValue );
-	XMLString::release( &transcodedValue );
-
-	element.setAttributeNode(pAttribute);			
-}
-
-DoubleAttribute::DoubleAttribute( const string name) 
-	: Attribute( name )
-{
-	value = 0;
-}
-
-void DoubleAttribute::Set( const string str )
-{
-	value = atof( str.c_str() );
-}
-
-const string DoubleAttribute::Get()
-{ 
-	char buffer[50];
-	sprintf( buffer, "%f", value );
-	return string( buffer );
-}   
-
-
-/*!
-@brief User Info base class
-
-This class is used to store information about parameters of an object. It support loading and saving of the information and, potentially, interaction with the user.
-*/
-IntAttribute::IntAttribute( const string name ) 
-	: Attribute( name )
-{
-	value = 0;
-}
-
-void IntAttribute::Set( const string str )
-{
-	value = atoi( str.c_str() );
-}
-
-const string IntAttribute::Get()
-{ 
-	char buffer[50];
-	sprintf( buffer, "%d", value );
-	return string( buffer );
-}   
-
-
-/*!
-@brief User Info base class
-
-This class is used to store information about parameters of an object. It support loading and saving of the information and, potentially, interaction with the user.
-*/
-StringAttribute::StringAttribute( const string name ) 
-	: Attribute( name ),
-	value("")
-{
-}
-
-void StringAttribute::Set( const string str )
-{
-	value = str.c_str();
-}
-
-const string StringAttribute::Get()
-{ 
-	return value;		
-}   
-
-
Index: /tests/testUI.cpp
===================================================================
--- /tests/testUI.cpp (revision 128)
+++ /tests/testUI.cpp (revision 142)
@@ -1,98 +1,45 @@
 #include "userinfo.h"
 
-class Engine 
+class IntUI: public ValuedUserInfo<int>
 {
 public:
-	string producer;
-	double consumption;
 
-	Engine( string producer, double consumption )
-		: producer( producer ),
-		consumption( consumption )
+	void Build(int* &pInstance)
 	{
+		// KDO SE POSTARA O DEALOKACI TOHOTO? NADRAZENE UI? ASI..
+		// PAK TO CHCE ALE OBDOBNE UDELAT I STRING NIZE, ZKOPIROVAT atd
+		pInstance = new int( atoi( value.c_str()) );
+	}
+
+};
+
+const TypedUserInfo<int>& IntUI::instance = IntUI();
+
+
+class StringUI: public ValuedUserInfo<string>
+{
+public:
+	void Build(string* &pInstance)
+	{
+		pInstance  = &value;
 	}
 };
 
-//! User info for strings
-class EngineUI : public UserInfo<Engine> 
-{
-public:
-	StringAttribute producer;
-	DoubleAttribute consumption;
-	
-	EngineUI()
-		: UserInfo<Engine>( "engine", "type of engine" ),
-		producer( "producer"),
-		consumption( "consumption")
-	{
-		producer.Attach( attributes );
-		consumption.Attach( attributes );
-	}
-
-	Engine* build()
-	{		
-		return new Engine( producer.value, consumption.value );
-	}
-};
-
-
-class Car
-{
-public:
-	string color;
-	int year;
-	Engine engine;
-
-	Car( string color, int year, Engine engine)
-		: color( color ),
-		year( year ),
-		engine( engine )
-	{
-	}
-};
-
-//! User info for strings
-class CarUI : public UserInfo<Car> 
-{
-public:
-	EngineUI engine;
-
-	StringAttribute color;
-	IntAttribute year;
-
-	CarUI()
-		: UserInfo<Car>("car", "type of a car"), 
-		color( "color"), 
-		year( "color" )
-	{
-		engine.Attach( elements );
-
-		color.Attach( attributes );
-		year.Attach( attributes );
-	}
-
-	Car* build()
-	{		
-		Engine* pEng = engine.build();
-		return new Car(color.value, year.value,*pEng);
-	}
-};
+const TypedUserInfo<string>& StringUI::instance = StringUI();
 
 
 int main()
 {
-	CarUI car;
+	int i = 9, *pi = &i;
 
-	car.Save( "car.xml" );	
+	RootElement root("car.xml");
+	root.Load();
 
-/*
-	car.Load( "car.xml" );
-	Car *pDefaultCar = car.build();
-	cout << "our car has " << pDefaultCar->color << " color";
-	delete pDefaultCar;
-// */
-
-	getchar();
+	UserInfo::Assembly("clovek",root,pi);
+	
+	//root.Save(); 
+	
+	cout << "press any key to quit, pi=" << *pi << endl;
+	getchar(); 
 	return 0;
 }
-
