void AddTextElement(pugi::xml_node node, const char* name, int64_t value, bool overwrite) { if (overwrite) { node.remove_child(name); } auto child = node.append_child(name); child.text().set(static_cast<long long>(value)); }
void CServerItem::SaveItem(pugi::xml_node& element) const { auto server = element.append_child("Server"); SetServer(server, m_server); for (auto iter = m_children.cbegin() + m_removed_at_front; iter != m_children.cend(); ++iter) (*iter)->SaveItem(server); }
pugi::xml_node NameValues::Write(pugi::xml_node out) const { pugi::xml_node root = out.append_child("NameValues"); for (const_iterator i=begin(), endi=end(); i != endi; ++i) append_data(root, *i); return root; }
pugi::xml_node Bytecode::Fixup::Write(pugi::xml_node out) const { pugi::xml_node root = out.append_child("Fixup"); root.append_attribute("offset") = m_off; Value::Write(root); return root; }
void obj_DamageArea::WriteSerializedData(pugi::xml_node& node) { GameObject::WriteSerializedData(node); pugi::xml_node damageAreaNode = node.append_child(); damageAreaNode.set_name("damageArea"); damageAreaNode.append_attribute("radius") = m_Radius; damageAreaNode.append_attribute("damage") = m_Damage; }
void CArenaMapNode::serialize(pugi::xml_node &parent) { pugi::xml_node node = parent.append_child("arena"); CNode::serialize(node); // node.append_attribute("id").set_value(getId()); node.append_attribute("path").set_value(m_filePath.c_str()); }
void DR::EMHandler::getDynamicRecording(pugi::xml_node &frame) { int errorCode; if (!m_connected) return; pugi::xml_node trackSTAR = frame.append_child("TrackSTAR"); trackSTAR.append_attribute("Unit").set_value("millimeter"); m_lock.lock(); // Collect data from all birds // Loop through all sensors and get a data record if the sensor is attached. // Print result to screen // Note: The default data format is DOUBLE_POSITION_ANGLES. We can use this // format without first setting it. // // DOUBLE_POSITION_QUATERNION_RECORD record, *pRecord = &record; // scan the sensors and request a record for (int sensorID = 0; sensorID < ATC3DG.m_config.numberSensors; sensorID++) { // sensor attached so get record errorCode = GetAsynchronousRecord(sensorID, pRecord, sizeof(record)); if (errorCode != BIRD_ERROR_SUCCESS) { errorHandler(errorCode); return; } // get the status of the last data record // only report the data if everything is okay unsigned int status = GetSensorStatus(sensorID); if (status == VALID_STATUS) { pugi::xml_node bird_node = trackSTAR.append_child("BIRD"); pugi::xml_attribute id = bird_node.append_attribute("id"); id.set_value(sensorID); pugi::xml_node position_node = bird_node.append_child(); position_node.set_name("Position"); position_node.append_attribute("X").set_value(record.x*1000.0f); position_node.append_attribute("Y").set_value(record.y*1000.0f); position_node.append_attribute("Z").set_value(record.z*1000.0f); pugi::xml_node rotation_node = bird_node.append_child(); rotation_node.set_name("Rotation"); rotation_node.append_attribute("W").set_value(record.q[0]); rotation_node.append_attribute("X").set_value(record.q[1]); rotation_node.append_attribute("Y").set_value(record.q[2]); rotation_node.append_attribute("Z").set_value(record.q[3]); } } m_lock.unlock(); }
// Save Game State bool j1Render::Save(pugi::xml_node& data) const { pugi::xml_node cam = data.append_child("camera"); cam.append_attribute("x") = camera.x; cam.append_attribute("y") = camera.y; return true; }
void ImageExportSerializer::writeFrame(pugi::xml_node _parent, DataPtr _data) { pugi::xml_node node = _parent.append_child("Frame"); node.append_attribute("point").set_value(_data->getPropertyValue("Point").c_str()); size_t count = MyGUI::utility::parseValue<size_t>(_data->getPropertyValue("Count")); if (count > 1) node.append_attribute("count").set_value(MyGUI::utility::toString(count).c_str()); }
pugi::xml_node ElfSymbol::Write(pugi::xml_node out) const { pugi::xml_node root = out.append_child("ElfSymbol"); root.append_attribute("key") = key; if (m_sect) root.append_attribute("sect") = m_sect->getName().str().c_str(); append_child(root, "Value", m_value); if (!m_size.isEmpty()) append_child(root, "Size", m_size).append_attribute("source") = m_size_source.getRawEncoding(); switch (m_index) { case SHN_UNDEF: append_child(root, "Index", "UNDEF"); break; case SHN_ABS: append_child(root, "Index", "ABS"); break; case SHN_COMMON: append_child(root, "Index", "COMMON"); break; default: append_child(root, "Index", m_index); break; } switch (m_bind) { case STB_LOCAL: append_child(root, "Bind", "local"); break; case STB_GLOBAL: append_child(root, "Bind", "global"); break; case STB_WEAK: append_child(root, "Bind", "weak"); break; default: append_child(root, "Bind", static_cast<int>(m_bind)); break; } switch (m_type) { case STT_NOTYPE: append_child(root, "SymType", "notype"); break; case STT_OBJECT: append_child(root, "SymType", "object"); break; case STT_FUNC: append_child(root, "SymType", "func"); break; case STT_SECTION: append_child(root, "SymType", "section"); break; case STT_FILE: append_child(root, "SymType", "file"); break; case STT_COMMON: append_child(root, "SymType", "common"); break; case STT_TLS: append_child(root, "SymType", "tls"); break; default: append_child(root, "SymType", static_cast<int>(m_type)); break; } switch (m_vis) { case STV_DEFAULT: append_child(root, "Vis", "default"); break; case STV_INTERNAL: append_child(root, "Vis", "internal"); break; case STV_HIDDEN: append_child(root, "Vis", "hidden"); break; case STV_PROTECTED: append_child(root, "Vis", "protected"); break; default: append_child(root, "Vis", static_cast<int>(m_vis)); break; } append_child(root, "SymIndex", m_symindex); return root; }
void PathEditor::saveRoute(const std::vector<Point> & array, pugi::xml_node & node) { for ( auto i : array ) { auto child = node.append_child("point"); child.append_attribute("x").set_value( intToStr(i.x).c_str() ); child.append_attribute("y").set_value( intToStr(i.y).c_str() ); } }
bool Render::save(pugi::xml_node &node) const { pugi::xml_node cam = node.append_child("camera"); cam.append_attribute("x") = camera.x; cam.append_attribute("y") = camera.y; return true; }
void obj_ReverbZone::WriteSerializedData(pugi::xml_node& node) { GameObject::WriteSerializedData(node); pugi::xml_node reverbNode = node.append_child(); reverbNode.set_name("reverbZone"); reverbNode.append_attribute("preset") = ReverbName; reverbNode.append_attribute("min") = m_minDist; reverbNode.append_attribute("max") = m_maxDist; }
static void add_node(pugi::xml_node& graph, int id, std::string label) { auto node = graph.append_child("node"); node.append_attribute("id") = std::to_string(id).c_str(); auto data = node.append_child("data"); data.append_attribute("key") = "label"; data.text() = label.c_str(); }
void ImageExportSerializer::writeImage(pugi::xml_node _parent, DataPtr _data) { pugi::xml_node node = _parent.append_child("Resource"); node.append_attribute("type").set_value("ResourceImageSet"); node.append_attribute("name").set_value(_data->getPropertyValue("Name").c_str()); for (Data::VectorData::const_iterator child = _data->getChilds().begin(); child != _data->getChilds().end(); child ++) writeGroup(node, (*child)); }
void VCProjectConfiguration::writeSummary(pugi::xml_node& parent) const { for (auto platform : m_platforms) { std::string configPlatform = getVSConfigurationPlatform(m_name, platform.first); pugi::xml_node configDesc = parent.append_child("ProjectConfiguration"); configDesc.append_attribute("Include") = configPlatform.c_str(); appendNodeWithText(configDesc, "Configuration", m_name); appendNodeWithText(configDesc, "Platform", platform.first); } }
void ImageExportSerializer::writeGroup(pugi::xml_node _parent, DataPtr _data) { pugi::xml_node node = _parent.append_child("Group"); node.append_attribute("name").set_value(_data->getPropertyValue("Name").c_str()); node.append_attribute("texture").set_value(_data->getPropertyValue("Texture").c_str()); node.append_attribute("size").set_value(MyGUI::IntCoord::parse(_data->getPropertyValue("Size")).size().print().c_str()); for (Data::VectorData::const_iterator child = _data->getChilds().begin(); child != _data->getChilds().end(); child ++) writeIndex(node, (*child)); }
void Polyline::saveToNode(pugi::xml_node& object) { ObjectBase::saveToNode(object); std::string points; for (std::size_t i = 0; i < mPoints.size(); i++) { points += detail::toString(mPoints[i]) + " "; } object.append_child("polyline").append_attribute("points") = points.c_str(); }
void obj_ZombieDummy::WriteSerializedData(pugi::xml_node& node) { GameObject::WriteSerializedData(node); pugi::xml_node zombiedummy = node.append_child(); zombiedummy.set_name("zombiedummy"); zombiedummy.append_attribute("part0") = partIds[0]; zombiedummy.append_attribute("part1") = partIds[1]; zombiedummy.append_attribute("part2") = partIds[2]; zombiedummy.append_attribute("anim") = sAnimSelected; }
void obj_MusicTriggerArea::WriteSerializedData(pugi::xml_node& node) { GameObject::WriteSerializedData(node); pugi::xml_node musicTriggerNode = node.append_child(); musicTriggerNode.set_name("musicTrigger"); musicTriggerNode.append_attribute("Sound") = SoundFilename; musicTriggerNode.append_attribute("triggerRadius") = triggerRadius; musicTriggerNode.append_attribute("cooldownTime") = cooldownTime; musicTriggerNode.append_attribute("volume") = masterVolume; }
pugi::xml_node FillBytecode::Write(pugi::xml_node out) const { pugi::xml_node root = out.append_child("Fill"); append_data(root, m_multiple); append_data(root, m_value); if (m_skip) root.append_attribute("skip") = true; return root; }
pugi::xml_node MachReloc::DoWrite(pugi::xml_node out) const { pugi::xml_node root = out.append_child("MachReloc"); append_child(root, "Type", getTypeName()); append_child(root, "PcRel", m_pcrel); append_child(root, "Length", m_length); append_child(root, "Ext", m_ext); return root; }
void CQueueViewBase::WriteToFile(pugi::xml_node element) const { auto queue = element.child("Queue"); if (!queue) { queue = element.append_child("Queue"); } for (std::vector<CServerItem*>::const_iterator iter = m_serverList.begin(); iter != m_serverList.end(); ++iter) (*iter)->SaveItem(queue); }
void SvgPrinter::drawEdges(pugi::xml_node xmlNode) { if (m_attr.has(GraphAttributes::edgeGraphics)) { xmlNode = xmlNode.append_child("g"); for(edge e : m_attr.constGraph().edges) { drawEdge(xmlNode, e); } } }
pugi::xml_node appendNodeWithText(pugi::xml_node& parent, const String& nodeName, const String& nodeText, const String& nodeCond) { pugi::xml_node node = parent.append_child(nodeName.c_str()); node.append_child(pugi::node_pcdata).set_value(nodeText.c_str()); if (!nodeCond.empty()) { node.append_attribute("Condition") = nodeCond.c_str(); } return node; }
bool j1Render::Save(pugi::xml_node& state)const { LOG("SAVING RENDER"); pugi::xml_node cam = state.append_child("camera"); cam.append_attribute("width") = camera.x; cam.append_attribute("height") = camera.y; return true; }
pugi::xml_node SkinExportSerializer::writeState(pugi::xml_node _parent, DataPtr _data, const MyGUI::IntCoord& _value) { MyGUI::IntPoint point = MyGUI::IntPoint::parse(_data->getPropertyValue("Point")); MyGUI::IntCoord coord = _value + point; pugi::xml_node node = _parent.append_child("State"); node.append_attribute("name").set_value(convertEditorToExportStateName(_data->getPropertyValue("Name")).c_str()); node.append_attribute("offset").set_value(coord.print().c_str()); return node; }
bool ShortcutsManager::save(pugi::xml_node &node) const { pugi::xml_node shorts = node.append_child("shortcuts"); for (map<string, ACTIONS>::const_iterator it = key_to_action.begin(); it != key_to_action.end(); ++it) { pugi::xml_node s = shorts.append_child("shortcut"); s.append_attribute("key_associated") = it->first.c_str(); s.append_attribute("action") = it->second; } return true; }
pugi::xml_node Message::AppendCharStringNode(pugi::xml_node node, const char * name, const char * value) { pugi::xml_node charNode = node.append_child(name); if (charNode) { if (value != NULL && value[0] != '\0') { charNode.append_child(pugi::node_pcdata).set_value(value); } } return charNode; }
pugi::xml_node Message::AppendIntegerNode(pugi::xml_node node, const char *name, int value, const char *format) { char valueStr[30]; sprintf(valueStr, format, value); pugi::xml_node intNode = node.append_child(name); if (intNode) { intNode.append_child(pugi::node_pcdata).set_value(valueStr); } return intNode; }