From 801a27798dd3c5ea42ce31e45e70420c987c7ca6 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Tue, 29 Sep 2020 18:44:37 +0300 Subject: [PATCH] [kml] small formatting --- kml/kml_tests/serdes_tests.cpp | 4 ++-- kml/serdes.cpp | 4 ++-- kml/serdes_binary.hpp | 12 ++++++------ kml/types.hpp | 13 +++++++------ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/kml/kml_tests/serdes_tests.cpp b/kml/kml_tests/serdes_tests.cpp index 9b205311d8..3d9417f51e 100644 --- a/kml/kml_tests/serdes_tests.cpp +++ b/kml/kml_tests/serdes_tests.cpp @@ -128,7 +128,7 @@ kml::FileData GenerateKmlFileData() compilationData1.m_toponyms = {"8", "9"}; compilationData1.m_languageCodes = {1, 2, 8}; compilationData1.m_properties = {{"property1", "value1"}, {"property2", "value2"}}; - result.m_compilationData.push_back(std::move(compilationData1)); + result.m_compilationsData.push_back(std::move(compilationData1)); kml::CategoryData compilationData2; compilationData2.m_compilationId = 4; @@ -151,7 +151,7 @@ kml::FileData GenerateKmlFileData() compilationData2.m_toponyms = {"10", "11"}; compilationData2.m_languageCodes = {1, 2, 8}; compilationData2.m_properties = {{"property1", "value1"}, {"property2", "value2"}}; - result.m_compilationData.push_back(std::move(compilationData2)); + result.m_compilationsData.push_back(std::move(compilationData2)); return result; } diff --git a/kml/serdes.cpp b/kml/serdes.cpp index f1102f0db8..d82ac2b2ab 100644 --- a/kml/serdes.cpp +++ b/kml/serdes.cpp @@ -629,7 +629,7 @@ void KmlWriter::Write(FileData const & fileData) // Save category. SaveCategoryData(m_writer, fileData.m_categoryData, fileData.m_serverId, - &fileData.m_compilationData); + &fileData.m_compilationsData); // Save bookmarks. for (auto const & bookmarkData : fileData.m_bookmarksData) @@ -926,7 +926,7 @@ void KmlParser::Pop(std::string const & tag) } else if (tag == kCompilation) { - m_data.m_compilationData.push_back(std::move(m_compilationData)); + m_data.m_compilationsData.push_back(std::move(m_compilationData)); m_categoryData = &m_data.m_categoryData; } diff --git a/kml/serdes_binary.hpp b/kml/serdes_binary.hpp index 14395e85a9..a272b6e406 100644 --- a/kml/serdes_binary.hpp +++ b/kml/serdes_binary.hpp @@ -110,7 +110,7 @@ public: void SerializeCompilations(Sink & sink) { CategorySerializerVisitor visitor(sink, kDoubleBits); - visitor(m_data.m_compilationData); + visitor(m_data.m_compilationsData); } // Serializes texts in a compressed storage with block access. @@ -128,13 +128,13 @@ private: }; template -struct HasCompilationData : std::false_type +struct HasCompilationsData : std::false_type { }; template -struct HasCompilationData> - : std::is_same> +struct HasCompilationsData> + : std::is_same> { }; @@ -302,7 +302,7 @@ private: DeserializeCategory(subReader, data); DeserializeBookmarks(subReader, data); DeserializeTracks(subReader, data); - if constexpr (HasCompilationData::value) + if constexpr (HasCompilationsData::value) DeserializeCompilations(subReader, data); DeserializeStrings(subReader, data); } @@ -346,7 +346,7 @@ private: auto compilationsSubReader = CreateCompilationsSubReader(*subReader); NonOwningReaderSource src(*compilationsSubReader); CategoryDeserializerVisitor visitor(src, m_doubleBits); - visitor(data.m_compilationData); + visitor(data.m_compilationsData); } template diff --git a/kml/types.hpp b/kml/types.hpp index 0025d0d3d8..9f892f43cd 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -228,8 +228,8 @@ struct BookmarkData visitor(m_boundTracks, "boundTracks"), visitor(m_visible, "visible"), visitor(m_nearestToponym, "nearestToponym"), - visitor(m_properties, "properties"), visitor(m_compilations, "compilations"), + visitor(m_properties, "properties"), VISITOR_COLLECTABLE) DECLARE_COLLECTABLE(LocalizableStringIndex, m_name, m_description, m_customName, @@ -248,6 +248,7 @@ struct BookmarkData m_boundTracks == data.m_boundTracks && m_visible == data.m_visible && m_nearestToponym == data.m_nearestToponym && + m_compilations == data.m_compilations && m_properties == data.m_properties; } @@ -280,10 +281,10 @@ struct BookmarkData bool m_visible = true; // Nearest toponym. std::string m_nearestToponym; - // Key-value properties. - Properties m_properties; // List of compilationIds. std::vector m_compilations; + // Key-value properties. + Properties m_properties; }; // Note: any changes in binary format of this structure @@ -448,13 +449,13 @@ struct FileData visitor(m_categoryData, "category"), visitor(m_bookmarksData, "bookmarks"), visitor(m_tracksData, "tracks"), - visitor(m_compilationData, "compilations")) + visitor(m_compilationsData, "compilations")) bool operator==(FileData const & data) const { return m_serverId == data.m_serverId && m_categoryData == data.m_categoryData && m_bookmarksData == data.m_bookmarksData && m_tracksData == data.m_tracksData && - m_compilationData == data.m_compilationData; + m_compilationsData == data.m_compilationsData; } bool operator!=(FileData const & data) const { return !operator==(data); } @@ -470,7 +471,7 @@ struct FileData // Tracks collection. std::vector m_tracksData; // Compilation collection. - std::vector m_compilationData; + std::vector m_compilationsData; }; inline std::string DebugPrint(BookmarkIcon icon)