本文整理汇总了C++中CXmlNode::SetAttrib方法的典型用法代码示例。如果您正苦于以下问题:C++ CXmlNode::SetAttrib方法的具体用法?C++ CXmlNode::SetAttrib怎么用?C++ CXmlNode::SetAttrib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXmlNode
的用法示例。
在下文中一共展示了CXmlNode::SetAttrib方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveFilledVecElem
void CXMLVecLS::SaveFilledVecElem(const CFilled *pElem,CXmlNode &node)
{
node.SetAttrib(_T("Outline"),pElem->IsOutline());
node.SetAttrib(_T("DashStyle"),pElem->GetDashStyle());
node.SetAttrib(_T("OutlineWidth"),pElem->GetOutlineWidth());
node.SetAttrib(_T("OutlineColor"),pElem->GetOutlineColor());
node.SetAttrib(_T("Fill"),pElem->IsFill());
node.SetAttrib(_T("FillColor"),pElem->GetFillColor());
}
示例2: Save
BOOL CXMLVecLS::Save(LPCTSTR pcszFileName,const stVecParam ¶m,const CElems &elems)
{
CXmlDoc file;
VERIFY(file.SetText(_T("<Vector/>")));
CXmlNode node = file.GetRoot();
node.SetAttrib(_T("BkgndImage"),param.strBkgndImage);
node.SetAttrib(_T("BkColor"),param.clrBk);
node.SetAttrib(_T("CustomData"),(ULONGLONG)param.dwCustomData);
node.SetAttrib(_T("Desc"),param.strDesc);
node.SetAttrib(_T("XScale"),param.scale.cx);
node.SetAttrib(_T("YScale"),param.scale.cy);
for (int i=0; i<elems.GetCount(); ++i)
{
SaveElem(elems[i],node);
}
return file.Save(pcszFileName);
}
示例3: SaveElem
void CXMLVecLS::SaveElem(const CElem *pElem,CXmlNode &node)
{
CRectF rc;
int nType = pElem->GetType();
LPCTSTR pcszTypeName = GetTypeName(nType);
CXmlNode n = node.AppendChild(pcszTypeName);
if (pElem->GetCustomData() != 0)
n.SetAttrib(_T("CustomData"),(ULONGLONG)pElem->GetCustomData());
if (!pElem->GetDesc().IsEmpty())
n.SetAttrib(_T("Desc"),pElem->GetDesc());
//n.SetAttrib(_T("TextColor"),pElem->GetTextColor());
//n.SetAttrib(_T("Text"),pElem->GetText());
switch (nType)
{
case CElem::Line:
{
const CLine *elem = static_cast<const CLine*>(pElem);
SaveNonFillVecElem(elem,n);
n.SetAttrib(_T("StartPointX"),elem->GetStartPoint().x);
n.SetAttrib(_T("StartPointY"),elem->GetStartPoint().y);
n.SetAttrib(_T("EndPointX"),elem->GetEndPoint().x);
n.SetAttrib(_T("EndPointY"),elem->GetEndPoint().y);
}
break;
case CElem::Bezier:
{
const CBezier *elem = static_cast<const CBezier*>(pElem);
SaveNonFillVecElem(elem,n);
CXmlNode nPt;
const CFPoints &pts = elem->GetPoints();
for (int i=0; i<(int)pts.GetCount(); ++i)
{
nPt = n.AppendChild(_T("Point"));
nPt.SetAttrib(_T("X"),pts[i].x);
nPt.SetAttrib(_T("Y"),pts[i].y);
}
}
break;
case CElem::FreeLine:
{
const CFreeLine *elem = static_cast<const CFreeLine*>(pElem);
SaveNonFillVecElem(elem,n);
CXmlNode nPt;
const CFPoints &pts = elem->GetPoints();
for (int i=0; i<(int)pts.GetCount(); ++i)
{
nPt = n.AppendChild(_T("Point"));
nPt.SetAttrib(_T("X"),pts[i].x);
nPt.SetAttrib(_T("Y"),pts[i].y);
}
}
case CElem::Arc:
{
const CArc *elem = static_cast<const CArc*>(pElem);
SaveNonFillVecElem(elem,n);
elem->GetBoundsRect(rc);
n.SetAttrib(_T("RectLeft"),rc.left);
n.SetAttrib(_T("RectTop"),rc.top);
n.SetAttrib(_T("RectRight"),rc.right);
n.SetAttrib(_T("RectBottom"),rc.bottom);
n.SetAttrib(_T("StartAngel"),elem->GetStartAngel());
n.SetAttrib(_T("EndAngel"),elem->GetEndAngel());
}
break;
case CElem::Poly:
{
const CPoly *elem = static_cast<const CPoly*>(pElem);
SaveFilledVecElem(elem,n);
CXmlNode nPt;
const CFPoints &pts = elem->GetPoints();
for (int i=0; i<(int)pts.GetCount(); ++i)
{
nPt = n.AppendChild(_T("Point"));
nPt.SetAttrib(_T("X"),pts[i].x);
nPt.SetAttrib(_T("Y"),pts[i].y);
}
}
break;
case CElem::Region:
{
const CRegion *elem = static_cast<const CRegion*>(pElem);
SaveFilledVecElem(elem,n);
CXmlNode nPt;
const CFPoints &pts = elem->GetPoints();
for (int i=0; i<(int)pts.GetCount(); ++i)
{
nPt = n.AppendChild(_T("Point"));
nPt.SetAttrib(_T("X"),pts[i].x);
nPt.SetAttrib(_T("Y"),pts[i].y);
}
}
break;
//.........这里部分代码省略.........
示例4: SaveNonFillVecElem
void CXMLVecLS::SaveNonFillVecElem(const COutlined *pElem,CXmlNode &node)
{
node.SetAttrib(_T("DashStyle"),pElem->GetDashStyle());
node.SetAttrib(_T("OutlineWidth"),pElem->GetOutlineWidth());
node.SetAttrib(_T("OutlineColor"),pElem->GetOutlineColor());
}