mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[editor] Change xml root to comaps
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
54ab965822
commit
2b7246d463
@@ -87,7 +87,7 @@ bool TypeDescriptionFromXml(pugi::xml_node const & root, pugi::xml_node const &
|
||||
auto const node = xNode.node();
|
||||
std::string const groupName = node.attribute("group").value();
|
||||
|
||||
std::string const xpath = "/omaps/editor/fields/field_group[@name='" + groupName + "']";
|
||||
std::string const xpath = "/comaps/editor/fields/field_group[@name='" + groupName + "']";
|
||||
auto const group = root.select_node(xpath.data()).node();
|
||||
ASSERT(group, ("No such group", groupName));
|
||||
|
||||
@@ -114,7 +114,7 @@ bool TypeDescriptionFromXml(pugi::xml_node const & root, pugi::xml_node const &
|
||||
std::vector<pugi::xml_node> GetPrioritizedTypes(pugi::xml_node const & node)
|
||||
{
|
||||
std::vector<pugi::xml_node> result;
|
||||
for (auto const & xNode : node.select_nodes("/omaps/editor/types/type[@id]"))
|
||||
for (auto const & xNode : node.select_nodes("/comaps/editor/types/type[@id]"))
|
||||
result.push_back(xNode.node());
|
||||
stable_sort(begin(result), end(result),
|
||||
[](pugi::xml_node const & lhs, pugi::xml_node const & rhs) {
|
||||
@@ -168,7 +168,7 @@ bool EditorConfig::GetTypeDescription(std::vector<std::string> classificatorType
|
||||
std::vector<std::string> EditorConfig::GetTypesThatCanBeAdded() const
|
||||
{
|
||||
auto const xpathResult =
|
||||
m_document.select_nodes("/omaps/editor/types/type[not(@can_add='no' or @editable='no')]");
|
||||
m_document.select_nodes("/comaps/editor/types/type[not(@can_add='no' or @editable='no')]");
|
||||
|
||||
std::vector<std::string> result;
|
||||
for (auto const & xNode : xpathResult)
|
||||
|
||||
@@ -16,9 +16,9 @@ using platform::tests_support::ScopedFile;
|
||||
|
||||
void CheckGeneralTags(pugi::xml_document const & doc)
|
||||
{
|
||||
auto const types = doc.select_nodes("/omaps/editor/types");
|
||||
auto const types = doc.select_nodes("/comaps/editor/types");
|
||||
TEST(!types.empty(), ());
|
||||
auto const fields = doc.select_nodes("/omaps/editor/fields");
|
||||
auto const fields = doc.select_nodes("/comaps/editor/fields");
|
||||
TEST(!fields.empty(), ());
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ void GenerateUploadedFeature(MwmSet::MwmId const & mwmId,
|
||||
osm::EditableMapObject const & emo,
|
||||
pugi::xml_document & out)
|
||||
{
|
||||
pugi::xml_node root = out.append_child("omaps");
|
||||
pugi::xml_node root = out.append_child("comaps");
|
||||
root.append_attribute("format_version") = 1;
|
||||
|
||||
pugi::xml_node mwmNode = root.append_child("mwm");
|
||||
|
||||
@@ -82,7 +82,7 @@ UNIT_TEST(OSM_ServerAPI_ChangesetAndNode)
|
||||
XMLFeature node(XMLFeature::Type::Node);
|
||||
|
||||
ServerApi06 const api = CreateAPI();
|
||||
uint64_t changeSetId = api.CreateChangeSet({{"created_by", "OMaps Unit Test"},
|
||||
uint64_t changeSetId = api.CreateChangeSet({{"created_by", "CoMaps Unit Test"},
|
||||
{"comment", "For test purposes only."}});
|
||||
auto const changesetCloser = [&]() { api.CloseChangeSet(changeSetId); };
|
||||
|
||||
@@ -110,7 +110,7 @@ UNIT_TEST(OSM_ServerAPI_ChangesetAndNode)
|
||||
TEST_EQUAL(node.GetAttribute("version"), "2", ());
|
||||
|
||||
// All tags must be specified, because there is no merging of old and new tags.
|
||||
api.UpdateChangeSet(changeSetId, {{"created_by", "OMaps Unit Test"},
|
||||
api.UpdateChangeSet(changeSetId, {{"created_by", "CoMaps Unit Test"},
|
||||
{"comment", "For test purposes only (updated)."}});
|
||||
|
||||
// To retrieve created node, changeset should be closed first.
|
||||
@@ -124,7 +124,7 @@ UNIT_TEST(OSM_ServerAPI_ChangesetAndNode)
|
||||
TEST_EQUAL(node.GetAttribute("id"), features[0].GetAttribute("id"), ());
|
||||
|
||||
// Cleanup - delete unit test node from the server.
|
||||
changeSetId = api.CreateChangeSet({{"created_by", "OMaps Unit Test"},
|
||||
changeSetId = api.CreateChangeSet({{"created_by", "CoMaps Unit Test"},
|
||||
{"comment", "For test purposes only."}});
|
||||
SCOPE_GUARD(guard, changesetCloser);
|
||||
// New changeset has new id.
|
||||
|
||||
@@ -38,7 +38,7 @@ using std::make_shared, std::string;
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr char const * kXmlRootNode = "omaps";
|
||||
constexpr char const * kXmlRootNode = "comaps";
|
||||
constexpr char const * kXmlMwmNode = "mwm";
|
||||
constexpr char const * kDeleteSection = "delete";
|
||||
constexpr char const * kModifySection = "modify";
|
||||
@@ -168,9 +168,6 @@ void Editor::LoadEdits()
|
||||
auto loadedFeatures = make_shared<FeaturesContainer>();
|
||||
|
||||
auto rootNode = doc.child(kXmlRootNode);
|
||||
// Migrate clients with an old root node.
|
||||
if (!rootNode)
|
||||
rootNode = doc.child("mapsme");
|
||||
// TODO: Empty rootNode is an OK case for the current logic and unit tests. Check if there is a better way to do it.
|
||||
for (auto const & mwm : rootNode.children(kXmlMwmNode))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user