예제 #1
0
ret_ CXMLLoaderActions::LoadEnable(CProgram &Program,
								   const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif
	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	// Check if there is the button identified by the attribute
	CWindow *pWindow = m_pTmpContainer->GetChild(sName);

	if (!pWindow || WINDOW_BUTTON != pWindow->Type())
		return XML_LOADER_ERROR;

	auto_xerces_str wsEnable("enable");
	auto_xerces_str sEnable(pElement->getAttribute(wsEnable));
	bool_ bEnble = (0 == strcmp(sEnable, "true")) ? true_v : false_v;
	
	COptEnable *pOpt = new COptEnable(sName, bEnble);

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
예제 #2
0
ret_ CXMLLoaderActions::LoadAddItem(CProgram &Program,
									const DOMElement *pElement,
									const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

	auto_xerces_str wsName("name");
	auto_xerces_str sName(pElement->getAttribute(wsName));
	
	// Check if there is the container
	if (!m_pTmpContainer)
		return XML_LOADER_ERROR;

	// Check if there is the table identified by the attribute
	CWindow *pWindow = m_pTmpContainer->GetChild(sName);

	if (!pWindow || WINDOW_TABLE != pWindow->Type())
		return XML_LOADER_ERROR;

	COptAddItem *pOpt = new COptAddItem(sName);

	DOMElement *pSub = (DOMElement *)pElement->getFirstChild();

	if (!pSub)
		return XML_LOADER_ERROR;

	while (pSub)
	{
		CVariable *pV = null_v;
		ret_ Ret = LoadVariable(Program.Data(),
								pSub,
								pV,
								pPDU);

		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			pOpt->AddVariable(pV);
		
		pSub = (DOMElement *)pSub->getNextSibling();
	}

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}