// XmlProjectPostGen.cpp: implementation of the CXmlProjectPostGen class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "AsCfgBuilder.h"
#include "XmlProjectPostGen.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CXmlProjectPostGen::CXmlProjectPostGen()
{
SetDefaults();
}
CXmlProjectPostGen::~CXmlProjectPostGen()
{
}
void CXmlProjectPostGen::SetActionId(enGeneratorAction actionId)
{
actionId_ = actionId;
}
enGeneratorAction CXmlProjectPostGen::GetActionId() const
{
return actionId_;
}
void CXmlProjectPostGen::SetConfigId(enGeneratorConfig configId)
{
configId_ = configId;
}
enGeneratorConfig CXmlProjectPostGen::GetConfigId() const
{
return configId_;
}
void CXmlProjectPostGen::SetTestProjectActionId(enTestProjectAction actionId)
{
testProjectActionId_ = actionId;
}
enTestProjectAction CXmlProjectPostGen::GetTestProjectActionId() const
{
return testProjectActionId_;
}
void CXmlProjectPostGen::SetDefaults()
{
actionId_ = enGeneratorAction_GenerateAndCompile;
configId_ = enGeneratorConfig_All;
testProjectActionId_ = enTestProjectAction_None;
}
void CXmlProjectPostGen::Clear()
{}
bool CXmlProjectPostGen::BuildFromXml(CXMLDOMNode& node)
{
USES_CONVERSION;
CXMLDOMNode childNode;
CXMLDOMNodeList children;
std::string nodeName;
Clear();
children = node.GetChildNodes();
for (long i = 0; i < children.GetLength(); i++) {
childNode = children.GetItem(i);
nodeName = childNode.GetNodeName();
if(nodeName == "GeneratorActionId") {
actionId_ = (enGeneratorAction)atoi(W2A(childNode.GetNodeTypedValue().bstrVal));
} else if(nodeName == "ConfigurationId") {
configId_ = (enGeneratorConfig)(atoi(W2A(childNode.GetNodeTypedValue().bstrVal)));
} else if(nodeName == "TestProjectActionId") {
testProjectActionId_ = (enTestProjectAction)(atoi(W2A(childNode.GetNodeTypedValue().bstrVal)));
}
}
return true;
}
bool CXmlProjectPostGen::AppendToDOMDocument(CXMLDOMDocument2& xmlDoc, CXMLDOMElement& parentElement, bool parentIsValid)
{
CXMLDOMElement newElement;
CXMLDOMElement member;
newElement = xmlDoc.CreateElement(GetXmlNodeName().c_str());
AppendMemberNode("GeneratorActionId", actionId_, newElement, xmlDoc);
AppendMemberNode("ConfigurationId", configId_, newElement, xmlDoc);
AppendMemberNode("TestProjectActionId", testProjectActionId_, newElement, xmlDoc);
parentElement.AppendChild(newElement);
return true;
}