Click here to Skip to main content
15,895,782 members
Articles / Desktop Programming / ATL

CM_ConfigBuilder 1.2g: Visual Studio 6/Visual Studio 2005/Visual Studio 2008 Code Generator for Application Settings Graphic Management

Rate me:
Please Sign up or sign in to vote.
4.94/5 (126 votes)
12 Feb 2008CPOL17 min read 698.1K   9.8K   262  
CM_ConfigBuilder generates and compiles the required files to manage your application's settings/preferences and to store/retrieve them in XML format.
// CAtlBaseGenerator.h
//

#if !defined(_CATLBASEGENERATOR_H_)
#define _CATLBASEGENERATOR_H_

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

class CXmlClassInfo;
class CXmlProjectSettings;
class CXmlProjectSettings_Atl;
class CXmlBaseFormItem;
class CXmlBaseElement;
class CXmlProject;

using namespace std;

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

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

protected:
	
	// utils
	//
	virtual string DefineOf(const string& className);
	virtual string TypeOf(enDataType dataType);
	virtual string OleTypeOf(enDataType dataType);
	virtual string IdlTypeOf(enDataType dataType);
	virtual string GetClassName(const string& elementName = "");
	virtual string ToLowCase(const string& s);
	virtual string ToUpperCase(const string& s);
	virtual string GetCamelCase(const string& s);
	virtual string GetGenerationTimeStamp();
	virtual string GetControlId(CXmlBaseFormItem* formItem, CXmlClassInfo* classInfo);
	virtual string GetDialogId(CXmlClassInfo* classInfo, int count);
	virtual string GetResourceFileName();
	virtual string GetDlgName(CXmlClassInfo* classInfo = NULL);
	virtual string GetTreeControlID();
	virtual string GetCardinalityPostfix(CXmlBaseElement* element);
	virtual string BuildGeneratedSourcePath();
	virtual string EscapeString(const string& str);
	virtual string GetArrayDialogName(CXmlClassInfo* classInfo = NULL);
	virtual string GetMapDialogName(CXmlClassInfo* classInfo = NULL);
	virtual string GetMainDlgName();
	virtual string GetParentPath(CXmlClassInfo* classInfo, vector<CXmlClassInfo*> parentStack, bool addContainers = true);

	bool SaveFile(const string& fileName, const string& fileContent, bool saveIfDifferent = true);
	bool ExistingFileHasSameContent(const string& fileName, const string& fileContent);
	string GetCodeFromFileContent(const string& fileContent);

protected:
	
	// class info
	//
	CXmlClassInfo* classInfo_;
	CXmlClassInfo* rootClassInfo_;
	CXmlProjectSettings* projectSettings_;
	CXmlProjectSettings_Atl* atlSettings_;
	CXmlProject* project_;
	static map<string, string> cppGeneratedFiles_;
	static map<string, string> hGeneratedFiles_;
	vector<CXmlClassInfo*> parentStack_;
};

#endif // !defined(_CATLBASEGENERATOR_H_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Italy Italy
For all Stefano's latest code, binaries and tutorials visit www.codemachines.com

Comments and Discussions