paramitem.cpp

来自「从各种控件中获得数据 自动生成XML文档 并通过XSLT转换为其他形式的XML文」· C++ 代码 · 共 76 行

CPP
76
字号
// Copyright by Johnson zhou. All right reserved.
// You can copy , modify and use as any purpose. I 'd like to see my name in 
// your credit.

#include "StdAfx.h"
#include "paramitem.h"

CParamItem::CParamItem(void)
{
}

CParamItem::~CParamItem(void)
{
}
CParamItem::CParamItem(long code ,const CString &  type,
				const CString &  name,
				const CString & tag):m_lCode (code ),m_strType(type),m_strName(name),m_strTag(tag)
{
}
CParamItem::CParamItem( const CParamItem &item)
{
	*this = item;
}
CParamItem& CParamItem::operator=(const CParamItem &  item)
{
	Assign(item);
	return *this;

}
void CParamItem::Assign ( const CParamItem & item)
{
	m_lCode = item.m_lCode ;
	m_strName = item.m_strName ;
	m_strTag = item.m_strTag ;
	m_strType = item.m_strType ;
}

bool CParamItem::ItIsMe(long code)
{
	return m_lCode == code;
}


bool CParamItem::operator==(const CParamItem &  item) const 
{
	return (m_lCode == item.m_lCode  &&
			m_strName == item.m_strName &&
			m_strType == item.m_strType &&
			m_strTag == item.m_strTag );
}

bool CParamItem::WriteToResult(CXMLResult &  rst)
{
	IXMLDOMNode *node = NULL;
	if (!rst.AddNewRecord (&node))
		return false;
	if (!rst.AddParamToRecord (node,_T("type"),m_strType))
		return false;
	if (!rst.AddParamToRecord (node,_T("name"),m_strName))
		return false;
	if (!rst.AddParamToRecord (node,_T("tag"),m_strTag))
		return false;
	return true;
}
bool CParamItem::ReadFromResult(int i,
			CXMLResult &  rst)
{
	if (!rst.GetRecordParam  (i,_T("type"),m_strType))
		return false;
	if (!rst.GetRecordParam (i,_T("name"),m_strName))
		return false;
	if (!rst.GetRecordParam (i,_T("tag"),m_strTag))
		return false;
	return true;
}
	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?