本文整理汇总了C++中ptree::add方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::add方法的具体用法?C++ ptree::add怎么用?C++ ptree::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ptree
的用法示例。
在下文中一共展示了ptree::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_junction
void add_junction(std::string repID, ptree& pt) const {
std::string juncs = _roadID;
std::size_t pos = juncs.find_last_of("j");
std::string jstart = juncs.substr(0,pos);
std::string jend = juncs.substr(pos,juncs.length());
pt.add(repID + ".startJunction", jstart);
pt.add(repID + ".endJunction", jend);
}
示例2: writeToPropertyTree
void CompPhysics::writeToPropertyTree(ptree& propTree) const
{
// damping element
if (getLinearDamping() != 0.0f || getAngularDamping() != 0.0f)
{
propTree.add("damping.linear", getLinearDamping());
propTree.add("damping.angular", getAngularDamping());
}
if (m_localGravitationPoint != Vector2D(0.0f, 0.0f))
{
propTree.add("gravitationPoint.x", m_localGravitationPoint.x);
propTree.add("gravitationPoint.y", m_localGravitationPoint.y);
}
if (isFixedRotation())
{
propTree.add("isFixedRotation", true);
}
if (isBullet())
{
propTree.add("isBullet", true);
}
for (ShapeInfoVec::const_iterator it = getShapeInfos().begin(); it != getShapeInfos().end(); ++it)
{
ptree shapePropTree;
shapePropTree.add("comp_id", (*it)->compId);
if ((*it)->density != 0)
shapePropTree.add("density", (*it)->density);
if ((*it)->friction != 0)
shapePropTree.add("friction", (*it)->friction);
if ((*it)->restitution != 0)
shapePropTree.add("restitution", (*it)->restitution);
if ((*it)->isSensor)
shapePropTree.add("isSensor", true);
propTree.add_child("shape", shapePropTree);
}
}
示例3: read_hotkey
HotKey* read_hotkey(string config_key)
{
string config_value = read_config_value(config_key);
if (config_value.compare("") != 0)
{
return new HotKey(config_value);
}
else
{
// read from default config
try
{
config_value = def_config_pt.get<string>(config_key);
config_pt.add(config_key, config_value);
save_config();
return new HotKey(config_value);
}
catch (std::exception e)
{
return NULL;
}
}
}
示例4: writeToPropertyTree
void CompShapeCircle::writeToPropertyTree(ptree& propTree) const
{
propTree.add("circle.x", m_center.x);
propTree.add("circle.y", m_center.y);
propTree.add("circle.r", m_radius);
}