Click here to Skip to main content
15,896,278 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.4K   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.
// XmlMemberGui_Boolean.cpp: implementation of the CXmlMemberGui_Boolean class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "XmlMemberGui_Boolean.h"
#include "XmlBaseElement.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CXmlMemberGui_Boolean::CXmlMemberGui_Boolean():
	displayMode_(enBooleanMemberDisplayMode_None)
{
}

CXmlMemberGui_Boolean::~CXmlMemberGui_Boolean()
{
	Clear();
}

void CXmlMemberGui_Boolean::Clear()
{
	displayMode_ = enBooleanMemberDisplayMode_None;
}

bool CXmlMemberGui_Boolean::BuildFromXml(CXMLDOMNode& node)
{
	USES_CONVERSION;

	CXMLDOMNode childNode;
	CXMLDOMNodeList children;
	string nodeName;
	long i;
	string iconFileName;
	
	Clear();
	
	children = node.GetChildNodes();
	
	for (i = 0; i < children.GetLength(); i++) {
		childNode = children.GetItem(i);
	
		nodeName = childNode.GetNodeName();

		if (nodeName == "DisplayMode") {
			displayMode_ = (enBooleanMemberDisplayMode) atoi(W2A(childNode.GetNodeTypedValue().bstrVal));	
		}
	}

	return true;
}

bool CXmlMemberGui_Boolean::AppendToDOMDocument(CXMLDOMDocument2& xmlDoc, CXMLDOMElement& parentElement, bool parentIsValid)
{
	CXMLDOMElement newElement;
	CXMLDOMElement iconElement;
	CXMLDOMElement member;
	map<string, string>::iterator it;

	newElement = xmlDoc.CreateElement(GetXmlNodeName().c_str());

	AppendMemberNode("DisplayModeStr", CXmlBaseElement::BooleanMemberDisplayMode2String(displayMode_), newElement, xmlDoc);
	AppendMemberNode("DisplayMode", (int)displayMode_, newElement, xmlDoc);
	
	if (parentIsValid)
		parentElement.AppendChild(newElement);
	else
		xmlDoc.AppendChild(newElement);	
   
	return true;
}

void CXmlMemberGui_Boolean::SetDisplayMode(enBooleanMemberDisplayMode displayMode)
{
	displayMode_ = displayMode;
}

enBooleanMemberDisplayMode CXmlMemberGui_Boolean::GetDisplayMode() const
{
	return displayMode_;
}

void CXmlMemberGui_Boolean::SetDefaults()
{
	displayMode_ = enBooleanMemberDisplayMode_None;
}

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