// CCSharpBaseGenerator.h
//

#if !defined(_CCSHARPBASEGENERATOR_H_)
#define _CCSHARPBASEGENERATOR_H_

#include <map>
#include <vector>
#include <string>
#include "enums.h"
#include "cmString.h"

class CXmlClassInfo;
class CXmlProjectSettings;
class CXmlProjectSettings_CSharp;
class CXmlBaseFormItem;
class CXmlBaseElement;
class CXmlProject;

using namespace std;

class CCSharpBaseGenerator
{
public:
	CCSharpBaseGenerator();
	virtual ~CCSharpBaseGenerator();

	// properties
	//
	void SetClassInfo(CXmlClassInfo* classInfo, vector<CXmlClassInfo*> parentStack);
	
	void SetProject(CXmlProject* project);

protected:

	// utils
	//
	/***
	virtual cmString DefineOf(const cmString& className);
	virtual cmString TypeOf(enDataType dataType);
	virtual cmString GetClassName(const cmString& elementName = _T(""));
	virtual cmString GetMainDlgName();
	virtual cmString ToLowCase(const cmString& s);
	virtual cmString ToUpperCase(const cmString& s);
	virtual cmString GetCamelCase(const cmString& s);
	virtual cmString GetGenerationTimeStamp();
	virtual cmString GetControlId(CXmlBaseFormItem* formItem, CXmlClassInfo* classInfo);
	virtual cmString GetDialogId(CXmlClassInfo* classInfo, int count);
	virtual cmString GetResourceFileName();
	virtual cmString GetDlgName(CXmlClassInfo* classInfo = NULL);
	virtual cmString GetArrayDialogName(CXmlClassInfo* classInfo = NULL);
	virtual cmString GetMapDialogName(CXmlClassInfo* classInfo = NULL);
	virtual cmString GetTreeControlID();
	virtual cmString GetCardinalityPostfix(CXmlBaseElement* element);
	virtual cmString BuildGeneratedSourcePath();
	virtual cmString EscapeString(const cmString& str);
	***/

	bool SaveFile(const cmString& fileName, const cmString& fileContent, bool saveIfDifferent = true);

	/***
	bool ExistingFileHasSameContent(const cmString& fileName, const cmString& fileContent);
	cmString GetCodeFromFileContent(const string& fileContent);
	cmString GetParentPath(CXmlClassInfo* classInfo, vector<CXmlClassInfo*> parentStack, bool addContainers = true);
	***/	
protected:
	// class info
	//
	CXmlClassInfo* classInfo_;
	CXmlClassInfo* rootClassInfo_;
	CXmlProjectSettings* projectSettings_;
	CXmlProjectSettings_CSharp* cSharpSettings_;
	CXmlProject* project_;
	
	vector<CXmlClassInfo*> parentStack_;

  

	static map<cmString, cmString> generatedFiles_;
};

#endif // !defined(_CCSHARPBASEGENERATOR_H_)