本文整理汇总了C++中XMLNode::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLNode::IsValid方法的具体用法?C++ XMLNode::IsValid怎么用?C++ XMLNode::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLNode
的用法示例。
在下文中一共展示了XMLNode::IsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitFromXMLNode
void Gauge::InitFromXMLNode(XMLNode gaugeNode)
{
Check(gaugeNode.IsValid() && gaugeNode.GetName() == "Gauge");
double scale = globals->m_PrefManager->GetPrefD("DefaultGaugeScale");
double zoom = globals->m_PrefManager->GetPrefD("Zoom");
double x, y; // temp variables
// Set the units per pixel
if (gaugeNode.HasChild("UnitsPerPixel"))
{
SetUnitsPerPixel(gaugeNode.GetChild("UnitsPerPixel").GetTextAsDouble());
}
else
{
SetUnitsPerPixel(globals->m_PrefManager->GetPrefD("UnitsPerPixel"));
}
// Set the position
if (gaugeNode.HasChild("Position"))
{
gaugeNode.GetChild("Position").GetTextAsCoord(x, y);
SetPosition(x * zoom, y * zoom);
}
else
{
SetPosition(0.0, 0.0);
}
// Set the scale
if (gaugeNode.HasChild("Scale")) {
gaugeNode.GetChild("Scale").GetTextAsCoord(x, y);
SetScale(x * zoom * scale, y * zoom * scale);
}
else
{
SetScale(zoom * scale, zoom * scale);
}
// Set the gauge outline
if (gaugeNode.HasChild("Outline"))
{
SetGaugeOutline(gaugeNode.GetChild("Outline").GetTextAsBool());
}
CustomXMLInit(gaugeNode);
}
示例2: if
bool
ApplePropertyList::ExtractStringFromValueNode (const XMLNode &node, std::string &value)
{
value.clear();
#if defined( LIBXML2_DEFINED )
if (node.IsValid())
{
llvm::StringRef element_name = node.GetName();
if (element_name == "true" || element_name == "false")
{
// The text value _is_ the element name itself...
value = element_name.str();
return true;
}
else if (element_name == "dict" || element_name == "array")
return false; // dictionaries and arrays have no text value, so we fail
else
return node.GetElementText(value);
}
#endif
return false;
}
示例3: InitFromXMLNode
void GaugePanel::InitFromXMLNode(XMLNode gaugeNode)
{
Check(gaugeNode.IsValid() && gaugeNode.GetName() == "Panel");
// Create gauges as described by the XML file
XMLNode::NodeList nodeList = gaugeNode.GetChildList("Gauge");
XMLNode::NodeList::iterator iter;
for (iter = nodeList.begin(); iter != nodeList.end(); ++iter)
{
Gauge *pGauge = GaugeFactory::CreateGaugeInstance(*iter);
if (pGauge != NULL) {
pGauge->SetParentRenderObject(this);
AddGauge(pGauge);
}
}
double scale = globals->m_PrefManager->GetPrefD("DefaultPanelScale");
double zoom = globals->m_PrefManager->GetPrefD("Zoom");
double x, y; // temp variables
// Set the units per pixel
if (gaugeNode.HasChild("UnitsPerPixel"))
{
SetUnitsPerPixel(gaugeNode.GetChild("UnitsPerPixel").GetTextAsDouble());
}
else
{
SetUnitsPerPixel(globals->m_PrefManager->GetPrefD("UnitsPerPixel"));
}
// Set the scale
if (gaugeNode.HasChild("Scale"))
{
gaugeNode.GetChild("Scale").GetTextAsCoord(x, y);
SetScale(x * zoom * scale, y * zoom * scale);
}
else
{
SetScale(zoom * scale, zoom * scale);
}
// Set the position
if (gaugeNode.HasChild("Position"))
{
gaugeNode.GetChild("Position").GetTextAsCoord(x, y);
SetPosition(x * zoom, y * zoom);
}
else
{
SetPosition(0.0, 0.0);
}
// Set the size
if (gaugeNode.HasChild("Size"))
{
gaugeNode.GetChild("Size").GetTextAsCoord(x, y);
SetSize(x, y);
}
else
{
SetSize(0.0, 0.0);
}
// Set the gauge outline
if (gaugeNode.HasChild("Outline"))
{
SetPanelOutline(gaugeNode.GetChild("Outline").GetTextAsBool());
}
}